1

I am looking to set up a syntax table for a major mode, and many of the examples, such as lisp-mode-syntax-table have entries like the following:

(modify-syntax-entry ?\[ "_   " table)

My question that I cannot seem to find in the Info nor in the help text is this: What do the three (3) spaces after the _ mean?

I know that \[ is a symbol constituent ('_'). But what do the three (3) spaces in the string after the underscore mean?

How does the following code differ from the example in the Info manual and the value used in lisp-mode.el, given above?

(modify-syntax-entry ?\[ "_" table)
1

In the above code, "_ " does exactly the same as "_". The second char in that string holds the matching "paren-like char" when the first char is ( or ) but for symbol constituents it's unused. The subsequent chars can contain any combination of the characters 1234bcnp which are used for comment delimiters and to mark the char as a possible "prefix" but here aren't used for that (and Emacs doesn't complain if you put some arbitrary number of spaces there, instead it just ignores them).

  • Thank you. I realized that the second char was the "matching parenthesis, used only if the first character is ‘(’ or ‘)’" from the documentation, but since that was not the case, nor was I was not adding a comment syntax (>, or <), I was afraid that the space had some other special meaning I was simply not grokking for other syntax types. My guess is that the spaces in lisp-mode-syntax-table are artifacts from when the file was created eons ago. – JalapenoGremlin Apr 23 at 15:37
  • @JalapenoGremlin: It's also common for those calls to use such spaces so that all entries have strings of the same length (e.g. one entry has ". 12" so all entries use 4-char strings). I find it's better to add spaces after the string rather than within it, but you know what they say about taste. – Stefan Apr 23 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.