[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: confusion over undocumented syntax-table features, font-lock and syn

From: Matt Swift
Subject: Re: confusion over undocumented syntax-table features, font-lock and syntax-tables
Date: Sun, 16 Feb 2003 00:46:57 -0500
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2

>> "L" == Luc wrote:

    L> Hence there indeed is either an inaccuracy in the Elisp manual and the
    L> various documentation strings you alluded to in your prior posting or
    L> the usage in the packages you mentioned is inappropriate.

    L> I do not know which of the two alternatives applies. 

    L> For string quote, it seems really strange. 

    L>  - Syntax class: string quote
    L>      "String quote characters" (designated by `"') are used in many
    L>      languages, including Lisp and C, to delimit string constants.
    L>      The same string quote character appears at the beginning and the
    L>      end of a string.  Such quoted strings do not nest.

What seems to be implied here by "the same" is that if distinct chars
C and D are both declared as string-quote class, then for example the
buffer substring


contains the delimited string constants "----D++++D====" and "++++".
If the initial C matched the next string-quote char rather than the
next C, then the two strings would be "----" and "====".

Perhaps the authors of these packages thought they would get the
second result if they did not specify a matching character.  Perhaps
it was indeed necessary in an earlier version of Emacs.  Perhaps it
means something significant that no one has mentioned yet (I checked
the source and it would take a long time for me to answer it that way;
I am not really interested in the answer, it is just an issue that
came up as a possible answer while I was trying to solve another

    L> Thus, if a package mentions the identical character as a matcher, then
    L> this seems totally redundant.  If it mentions another character, it
    L> seems dangerous (at least to me), since plenty of Lisp code might
    L> expect the identical character to match, relying on the above quote.

Following is a crude (i.e. incomplete) listing of packages in the
latest CVS Emacs that specify a matching char for a char of class
other than ( or ).  You can't get a complete list with a single regexp
match (the quoting and quote marks will drive you crazy, and many
packages do not set the syntax table with constants), and this is
trimmed of some false hits:

    ./progmodes/m4-mode.el:(modify-syntax-entry ?# "<\n" m4-mode-syntax-table)
    ./progmodes/m4-mode.el:(modify-syntax-entry ?\n ">#" m4-mode-syntax-table)
    ./textmodes/bibtex.el:    (modify-syntax-entry ?$ "$$  " st)
    ./textmodes/sgml-mode.el:       (modify-syntax-entry ?\" "\"\"" table))
    ./textmodes/sgml-mode.el:       (modify-syntax-entry ?\' "\"'" table))

Again with latest CVS Emacs, sh-script.el doesn't set it vars simply,
but starting a fresh emacs and entering sh-mode[bash], then C-hs

C-j             >#      which means: endcomment, matches #
"               ""      which means: string, matches "
'               "'      which means: string, matches '
`               "`      which means: string, matches `

reply via email to

[Prev in Thread] Current Thread [Next in Thread]