When I read some elisp code, I found something like:
(\,(* 2 \#1))
\,(format "%s %s id%d %s" \1 \2 (+1 \#) \3)
#'(bla bla)
What does the symbol like "\,", "#", "#'" mean? Which session should I look into for those kind of things?
\,
is special in replacements when using query-replace-regexp
. It means "evaluate the following elisp expression, and use the resulting value in the replacement".
n.b. It's not special elsewhere (that I'm aware of), so that should be the usage you've seen.
\#
is also special in the replacement string, and is substituted with the number of replacements made thus far. (i.e. an incrementing counter).
\#N
(where N is a number) is a variant of \N
which treats the group in question as a number rather than a string, which is useful when the expression you're evaluating requires a number.
So (\,(* 2 \#1))
would be a replacement which evaluates the expression (* 2 \#1)
, multiplying the number matched by the first group of the regexp by 2 to produce some value N, such that the final replacement is (N)
.
You can find these detailed in the manual.
C-hig (emacs)
RET followed by a search for the syntax in question. e.g. C-s \,
with a repeated C-s if the search fails (as it will) to find a match in the subsequent nodes.
#'...
is short-hand for (function ...)
which is a variant of '...
/ (quote...)
which indicates that the quoted object is a function.
As this is elisp syntax, you find it in the elisp manual:
C-hig (elisp)
RET
You can either use C-s #'
or in this case it's indexed, so I #'
RET also works.
(In general check the index first, and then use isearch.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With