all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Swift <swift@alum.mit.edu>
Cc: Luc Teirlinck <teirllm@dms.auburn.edu>
Subject: Re: confusion over undocumented syntax-table features, font-lock and syntax-tables
Date: Sun, 16 Feb 2003 00:46:57 -0500	[thread overview]
Message-ID: <m2ptps93qm.fsf@beth.swift.xxx> (raw)
In-Reply-To: <200302152337.RAA15707@eel.dms.auburn.edu> (Luc Teirlinck's message of "Sat, 15 Feb 2003 17:37:26 -0600 (CST)")


>> "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

  C----D++++D====C

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
problem.)

    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
gives:

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

  reply	other threads:[~2003-02-16  5:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-15 23:37 confusion over undocumented syntax-table features, font-lock and syntax-tables Luc Teirlinck
2003-02-16  5:46 ` Matt Swift [this message]
     [not found] <mailman.1933.1045148974.21513.bug-gnu-emacs@gnu.org>
2003-02-15 20:11 ` Matt Swift
  -- strict thread matches above, loose matches on Subject: below --
2003-02-13 15:09 Luc Teirlinck
2003-02-13  4:17 Luc Teirlinck
2003-02-13  3:43 Luc Teirlinck
2003-02-11  5:08 Matthew Swift

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ptps93qm.fsf@beth.swift.xxx \
    --to=swift@alum.mit.edu \
    --cc=teirllm@dms.auburn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.