unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: "Robert D. Crawford" <rdc1x@comcast.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: What is this syntax for in php-mode.el
Date: Fri, 20 Apr 2007 16:17:40 +0200	[thread overview]
Message-ID: <4628CB84.4040004@gmail.com> (raw)
In-Reply-To: <87slav8a7u.fsf@comcast.net>

Robert D. Crawford wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>> Thanks Ted. Now I only wonder about that strange
>> font-lock-syntactic-keywords spec that I can not find in the Emacs
>> lisp manual.
> 
> This might help, fetched with apropos:
> 
> font-lock-syntactic-keywords is a variable defined in `font-lock.el'.
> Its value is nil
> 
> 
> Documentation:
> A list of the syntactic keywords to put syntax properties on.
> The value can be the list itself, or the name of a function or variable
> whose value is the list.
> 
> See `font-lock-keywords' for a description of the form of this list;
> only the differences are stated here.  MATCH-HIGHLIGHT should be of the form:
> 
>  (SUBEXP SYNTAX OVERRIDE LAXMATCH)
> 
> where SYNTAX can be a string (as taken by `modify-syntax-entry'), a syntax
> table, a cons cell (as returned by `string-to-syntax') or an expression whose
> value is such a form.  OVERRIDE cannot be `prepend' or `append'.
> 
> Here are two examples of elements of `font-lock-syntactic-keywords'
> and what they do:
> 
>  ("\\$\\(#\\)" 1 ".")
> 
>  gives a hash character punctuation syntax (".") when following a
>  dollar-sign character.  Hash characters in other contexts will still
>  follow whatever the syntax table says about the hash character.
> 
>  ("\\('\\).\\('\\)"
>   (1 "\"")
>   (2 "\""))
> 
>  gives a pair single-quotes, which surround a single character, a SYNTAX of
>  "\"" (meaning string quote syntax).  Single-quote characters in other
>  contexts will not be affected.
> 
> This is normally set via `font-lock-defaults'.


Maybe. My trouble is that I can not fit something like the below into 
this format:

     (list
      ;; Mark _all_ # chars as being comment-start.  That will be
      ;; ignored when inside a quoted string.
      '("\\(\#\\)"
        (1 (11 . nil)))
      ;; Mark all newlines ending a line with # as being comment-end.
      ;; This causes a problem, premature end-of-comment, when '#'
      ;; appears inside a multiline C-style comment.  Oh well.
      '("#.*?\\([\n]\\)"
        (1 (12 . nil)))

This code works except for trouble of the kind noted in the comment. I 
am trying to understand if there is any way around this problem.

  reply	other threads:[~2007-04-20 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  1:26 What is this syntax for in php-mode.el Lennart Borgman (gmail)
2007-04-20  7:24 ` Edward O'Connor
2007-04-20 12:24   ` Lennart Borgman (gmail)
     [not found]   ` <mailman.2303.1177072165.7795.help-gnu-emacs@gnu.org>
2007-04-20 13:08     ` Robert D. Crawford
2007-04-20 14:17       ` Lennart Borgman (gmail) [this message]
     [not found] <mailman.2283.1177032673.7795.help-gnu-emacs@gnu.org>
2007-04-20 14:56 ` Stefan Monnier
2007-04-20 16:16   ` Lennart Borgman (gmail)
2007-04-20 16:39     ` Lennart Borgman (gmail)

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4628CB84.4040004@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rdc1x@comcast.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).