hunter.t.joz
2018-8-2 13:11:28

Hmm. Do I need to do raco scribble guide.scrbl —dest ~/racketguide? Or *.scrbl?


soegaard2
2018-8-2 13:39:33

Consider this s-expression (a (b c) d e When indenting the last line - where should the e end up?


soegaard2
2018-8-2 13:40:11

Curiously DrRacket, lisp-mode and racket-mode in Emacs has 3 different answers.


greg
2018-8-2 14:15:04

sniffs the bait, tempted… but runs away terrified


greg
2018-8-2 14:19:55

OK I will point out that lisp-mode on Emacs 26.1 font-locks the d for me due to this font-lock rule: lisp--match-hidden-arg (0 '(face font-lock-warning-face help-echo "Hidden behind deeper element; move to another line?")) So the d is red (in my current theme) and you see that text if you hover.


greg
2018-8-2 14:20:32

So whatever happens to the following e, seems like it’s going to be weird?


soegaard2
2018-8-2 14:21:22

My fault. Forgot how to quote code.


soegaard2
2018-8-2 14:21:29

In slack.


greg
2018-8-2 14:22:02

Yeah at first I wondered if you meant indenting quoted or quasiquoted expressions, specifically. But I figured out what you meant.


soegaard2
2018-8-2 14:22:33

How did you get the hidden args warning?


greg
2018-8-2 14:22:59

By the way, if you do any Emacs mode work, or are just curious, the font-lock-studio package is awesome. It’s like the macro stepper but for font-lock. You can see the font-lock rules for a mode, and watch them work one by one on the buffer.


soegaard2
2018-8-2 14:23:06

(24.5 here)


soegaard2
2018-8-2 14:23:27

I’ll try that.


greg
2018-8-2 14:23:36

It might be 26.1 only. I just put that text in a buffer, and M-x lisp-mode.


greg
2018-8-2 14:23:49

Just started using 26.1 within the last week.


greg
2018-8-2 14:24:13

Wouldn’t have bothered except for smoke-testing for racket-mode.


soegaard2
2018-8-2 14:25:21

No noteworthy news in 26.1?


greg
2018-8-2 14:27:29

So (taking the bait), lisp-mode’s handling of this is “wrong”, but they kind of warn you.


greg
2018-8-2 14:27:57

I think DrR is not helpful to do this: (a (b c) d e)


greg
2018-8-2 14:28:22

For instance, what if it were an application of hash not a.


greg
2018-8-2 14:28:52

This seems not helpful, what DrR does: (hash (a b) c (c d) e)


greg
2018-8-2 14:29:17

I prefer what racket-mode does: (hash (a b) c (c d) e)


soegaard2
2018-8-2 14:31:52

Agree.


greg
2018-8-2 14:32:53

Not to sound like an authority on this. Indentation can be a big hairball, and I’ve gotten it wrong many times.


greg
2018-8-2 14:33:22

It helped to stop following the example of scheme-mode, which tries to reuse lisp-mode as much as possible, and instead make a clean start.


greg
2018-8-2 14:33:55

The lisp-mode indentation code has a lot of history and is just mind-numbing, to me anyway.


greg
2018-8-2 14:34:53

@soegaard2 Nothing earth-shattering so far in 26.1, for me. I think 25.x added some things I liked but can’t remember b/c now take for granted.


greg
2018-8-2 14:35:21

26.1 does now have threads, but I hope package authors don’t start using them directly and badly.


greg
2018-8-2 14:36:00

They really need a higher-level thing, like ML/Racket concurrency.



soegaard2
2018-8-2 14:38:44

Haven’t looked at threads in Emacs yet. Since buffers are mutable, it is not a good idea for multiple threads to work on the same buffer though.


greg
2018-8-2 14:43:25

In Emacs buffers are the uber data structure. A lot of things you’d do with strings in other langs, you often should just with-temp-buffer and use the whole Emacs function library. :slightly_smiling_face: Also for external processes, there can be an associated buffer, and it’s your sync object. They’re sort of a random-access async channel. Process output calls your function with more text, you can add to the buffer or not, etc. The proc output func being called, is your concurrency “hook”. It’s only called when Emacs is waiting for input, idle. So to-date it’s been safe. Adding raw pthreads is… not so much.


soegaard2
2018-8-2 14:49:08

+1


soegaard2
2018-8-2 15:26:04

Hmm. If the (c d) is a very large s-expression then using backward-sexp to go back could potentially become expensive. Especially if indenting a large region.


markx
2018-8-2 16:20:03

Hi, Why don’t we get rid of the “irc” channel, and connect this “general” channel with irc?


zenspider
2018-8-2 20:31:06

@greg oh shit. I didn’t know about font-lock-studio! Thank you!!!


greg
2018-8-2 20:33:39

@zenspider The author has a whole set of font-lock related packages: https://github.com/Lindydancer/font-lock-studio#other-font-lock-tools I also use faceup to do regression tests on font-lock for racket-mode. I haven’t tried the others (yet).


zenspider
2018-8-2 20:35:43

I prefer racket-mode here too… but I like that elisp has been coloring c and e red for hanging them off of another sexp.


zenspider
2018-8-2 20:36:06

fantastic. I need both of these


zenspider
2018-8-2 20:37:18

> The underlying idea is to convert text with highlights (“faces”) into a plain text representation using the Faceup markup language. This language is semi-human readable, for example: > > «k:this» is a keyword

I actually already have something just like this in my test suite, but not at the font-lock level… at the parse level. This will help a lot. Thank you!


greg
2018-8-2 20:40:26

They’re the moral equivalent of scribble files «k:this» :left_right_arrow: @k{this}. :wink:


greg
2018-8-2 20:41:42

Well. A tiny subset of at-expressions.


markx
2018-8-3 01:41:02

Hi! Could anyone share me some examples of how to do logging in multiple modules?


notjack
2018-8-3 02:46:36

@markx I usually use define-logger and include the module name in the logger name


markx
2018-8-3 02:53:31

@notjack Do you define a logger in every module, instead of sharing one for the whole project?


notjack
2018-8-3 02:54:35

@markx Yes. Occasionally I define multiple loggers in the same module


markx
2018-8-3 02:55:16

That’s interesting. So if you want to log to a file, you will have to setup the logger to the file in every module?


notjack
2018-8-3 02:57:01

No, I would set that up with a single log receiver that listens to the current logger. If I wanted to only listen for certain kinds of messages I filter by logger topics, but still attach the receiver to the current logger. I never directly attach receivers to loggers created with define-logger


notjack
2018-8-3 02:57:31

I’d set up the receiver in whatever the main entry point of the program is


markx
2018-8-3 02:58:31

Do you have some example code to show me?


markx
2018-8-3 02:58:58

I want to see how you do this in real world code. :smile:


notjack
2018-8-3 03:01:00

I can whip up a little example later tonight but I gotta go now


markx
2018-8-3 03:01:21

Ah no problem. Even tomorrow is fine.


markx
2018-8-3 03:02:35

but… why whip up a little example? Do you use logging in any real project that is open source?


notjack
2018-8-3 03:06:02

My open source projects are small libraries. Most of my recent racket work hasn’t been open source


greg
2018-8-3 04:18:14

@markx Here’s an example of defining a logger and providing the resulting functions, from one file, for others to use: https://github.com/greghendershott/aws/blob/8803567f2e5fc8bc497d510d510f7943d1b8fbd8/aws/util.rkt#L184-L189 And here are examples of one of them being used: https://github.com/greghendershott/aws/search?q=log-aws-debug&type=Code


greg
2018-8-3 04:20:35

This example doesn’t do anything special in terms of a log receiver. It assumes you’ll use one of the normal ways to set log levels for various loggers. DrRacket has a UI for this. racket-mode has a racket-logger-mode. There are command line flags and env vars for command-line racket.


greg
2018-8-3 04:21:38

I did one special log receiver that forwards the logging events on to Amazon CloudWatch Logs, but that’s in a close-source project.