Hmm. Do I need to do raco scribble guide.scrbl —dest ~/racketguide? Or *.scrbl?
Consider this s-expression (a (b
c) d
e
When indenting the last line - where should the e end up?
Curiously DrRacket, lisp-mode and racket-mode in Emacs has 3 different answers.
sniffs the bait, tempted… but runs away terrified
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.
So whatever happens to the following e
, seems like it’s going to be weird?
My fault. Forgot how to quote code.
In slack.
Yeah at first I wondered if you meant indenting quoted or quasiquoted expressions, specifically. But I figured out what you meant.
How did you get the hidden args warning?
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.
(24.5 here)
I’ll try that.
It might be 26.1 only. I just put that text in a buffer, and M-x lisp-mode
.
Just started using 26.1 within the last week.
Wouldn’t have bothered except for smoke-testing for racket-mode.
No noteworthy news in 26.1?
So (taking the bait), lisp-mode
’s handling of this is “wrong”, but they kind of warn you.
I think DrR is not helpful to do this: (a (b
c) d
e)
For instance, what if it were an application of hash
not a
.
This seems not helpful, what DrR does: (hash (a
b) c
(c
d) e)
I prefer what racket-mode does: (hash (a
b) c
(c
d) e)
Agree.
Not to sound like an authority on this. Indentation can be a big hairball, and I’ve gotten it wrong many times.
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.
The lisp-mode indentation code has a lot of history and is just mind-numbing, to me anyway.
@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.
26.1 does now have threads, but I hope package authors don’t start using them directly and badly.
They really need a higher-level thing, like ML/Racket concurrency.
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.
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.
+1
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.
Hi, Why don’t we get rid of the “irc” channel, and connect this “general” channel with irc?
@greg oh shit. I didn’t know about font-lock-studio
! Thank you!!!
@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).
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.
fantastic. I need both of these
> 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!
They’re the moral equivalent of scribble files «k:this»
:left_right_arrow: @k{this}
. :wink:
Well. A tiny subset of at-expressions.
Hi! Could anyone share me some examples of how to do logging in multiple modules?
@markx I usually use define-logger
and include the module name in the logger name
@notjack Do you define a logger in every module, instead of sharing one for the whole project?
@markx Yes. Occasionally I define multiple loggers in the same module
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?
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
I’d set up the receiver in whatever the main entry point of the program is
Do you have some example code to show me?
I want to see how you do this in real world code. :smile:
I can whip up a little example later tonight but I gotta go now
Ah no problem. Even tomorrow is fine.
but… why whip up a little example? Do you use logging in any real project that is open source?
My open source projects are small libraries. Most of my recent racket work hasn’t been open source
@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
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.
I did one special log receiver that forwards the logging events on to Amazon CloudWatch Logs, but that’s in a close-source project.