Is it possible to comment the string "emacs" below while keeping this code one line? If so, how?
(message "hi") "emacs" (message "hi!")
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityFor the usual meaning of "comment", the answer is mostly no (see Dan answer for details), but if you just want to prevent code from being executed, then you can simply do nothing in your case, since the execution of "emacs"
will not have any visible effect. If you want to use it on elements whose execution does have visible effects, you can use
(defmacro comment-out (&rest args) nil)
after which you can do things like:
(message "foo") (comment-out (message "bar")) (message "baz")
It looks like the answer is no, you cannot.
The elisp manual node on Comments states that:
In Lisp, a semicolon (
;
) starts a comment if it is not within a string or character constant. The comment continues to the end of line.
It also, however, goes on to say that:
The
#@count
construct, which skips the next count characters, is useful for program-generated comments containing binary data. The Emacs Lisp byte compiler uses this in its output files (see Byte Compilation). It isn't meant for source files, however.
The manual index links the #@count
construct to
Documentation Strings and Compilation.
It states:
Internally, the dynamic loading of documentation strings is accomplished by writing compiled files with a special Lisp reader construct,
#@count
. This construct skips the next count characters. It also uses the#$
construct, which stands for "the name of this file, as a string". Do not use these constructs in Lisp source files; they are not designed to be clear to humans reading the file.