0

What is the Raw Syntax Descriptor for a char at POS? Can I have some examples so I can understand what this thing is all about?

3
  • 1
    Do `C-h i g (elisp)<RET> i raw syn<TAB>' and read the section. Why do you need to know? What are you trying to do? IME, an approximate understanding of syntax tables is almost always enough (and those sections fill the gap when and only when I really need to dig into very low level details).
    – NickD
    Jul 20, 2022 at 11:55
  • I want to know whether a ( or ) occurs within a string, comment or is escaped.
    – Dilna
    Jul 20, 2022 at 12:40
  • Please explain the context: I cannot guess what you mean. Are you trying to parse a piece of code? What kind of code? Give an example.
    – NickD
    Jul 20, 2022 at 13:11

1 Answer 1

2

In order to understand syntax, you need to understand what the syntax of a char is. You can find this with how to use the command C-u C-x =. The syntax of the same char could be different based on the mode in use.

See Syntax of some char

See Syntax of some other char


C-x = runs the command what-cursor-position (found in global-map), which is an interactive compiled Lisp function in simple.el.

It is bound to C-x =.

(what-cursor-position &optional DETAIL)

Print info on cursor position (on screen and within buffer). Also describe the character after point, and give its character code in octal, decimal and hex. If what-cursor-show-names is non-nil, additionally show the name of the character.

For a non-ASCII multibyte character, also give its encoding in the buffer`s selected coding system if the coding system encodes the character safely. If the character is encoded into one byte, that code is shown in hex. If the character is encoded into more than one byte, just "..." is shown.

In addition, with prefix argument, show details about that character in Help buffer. See also the command describe-char.

Probably introduced at or before Emacs version 27.1.

[back]

10
  • does syntax-ppss give () in your example?
    – Dilna
    Jul 20, 2022 at 15:14
  • What is C-u C-x = bound to?
    – Dilna
    Jul 20, 2022 at 15:20
  • It is there in my response. What Emacs version are you using and on which OS?
    – user31220
    Jul 20, 2022 at 15:30
  • I have circled things ... What do you see there?
    – user31220
    Jul 20, 2022 at 15:33
  • desribe-char then. Have been wondering what (nth 3 (syntax-ppss)) does.
    – Dilna
    Jul 20, 2022 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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