all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Syntax properties and \_>
@ 2004-12-17 22:27 Ralf Angeli
  2004-12-20 10:56 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Angeli @ 2004-12-17 22:27 UTC (permalink / raw)


Hello everybody,

for font locking in AUCTeX am trying to match strings like "\\",
"\\*", "\-" but also "\newpage" and similar with a single regular
expression.  I was trying to limit the match with help of \_> for
matching the empty string at the end of the strings.  This works for
all constructs except "\\" because the character ?\\ has escape
syntax.  Now I thought that placing a symbol syntax property onto the
second "\" would help, but it doesn't.  Here is an example:

(with-temp-buffer
  (insert "\\\\")
  (put-text-property (1- (point)) (point) 'syntax-table '(3))
  (newline)
  (goto-char (point-min))
  (let ((parse-sexp-lookup-properties t))
    (re-search-forward "\\\\\\\\\\_>" nil t)))

Upon executing it you should see that it returns nil.  But trying the
same example with "\\s_" instead of "\\\\\\\\\\_>" for the
`re-search-forward' statement returns a match.

Is this a bug in the way \_> is handled?  It doesn't seem to recognize
syntax properties because there is a match if the syntax for "\" is
changed with `(modify-syntax-entry ?\\ "_")' instead of setting a
syntax property.  Or am I doing something wrong?

-- 
Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax properties and \_>
  2004-12-17 22:27 Syntax properties and \_> Ralf Angeli
@ 2004-12-20 10:56 ` Richard Stallman
  2004-12-20 13:42   ` Ralf Angeli
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2004-12-20 10:56 UTC (permalink / raw)
  Cc: emacs-devel

Does this patch fix your problem?

*** regex.c	06 Dec 2004 00:42:45 -0500	1.198
--- regex.c	20 Dec 2004 04:49:54 -0500	
***************
*** 5860,5866 ****
  		  PREFETCH_NOLIMIT ();
  		  c2 = RE_STRING_CHAR (d, dend - d);
  #ifdef emacs
! 		  UPDATE_SYNTAX_TABLE_FORWARD (charpos);
  #endif
  		  s2 = SYNTAX (c2);
  
--- 5860,5866 ----
  		  PREFETCH_NOLIMIT ();
  		  c2 = RE_STRING_CHAR (d, dend - d);
  #ifdef emacs
! 		  UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
  #endif
  		  s2 = SYNTAX (c2);
  
***************
*** 5947,5953 ****
  		  PREFETCH_NOLIMIT ();
  		  c2 = RE_STRING_CHAR (d, dend - d);
  #ifdef emacs
! 		  UPDATE_SYNTAX_TABLE_FORWARD (charpos);
  #endif
  		  s2 = SYNTAX (c2);
  
--- 5947,5953 ----
  		  PREFETCH_NOLIMIT ();
  		  c2 = RE_STRING_CHAR (d, dend - d);
  #ifdef emacs
! 		  UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
  #endif
  		  s2 = SYNTAX (c2);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax properties and \_>
  2004-12-20 10:56 ` Richard Stallman
@ 2004-12-20 13:42   ` Ralf Angeli
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Angeli @ 2004-12-20 13:42 UTC (permalink / raw)
  Cc: emacs-devel

* Richard Stallman (2004-12-20) writes:

> Does this patch fix your problem?
>
> *** regex.c	06 Dec 2004 00:42:45 -0500	1.198
> --- regex.c	20 Dec 2004 04:49:54 -0500	
[...]

Yes, this fixes it.  Thank you very much.

-- 
Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-20 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-17 22:27 Syntax properties and \_> Ralf Angeli
2004-12-20 10:56 ` Richard Stallman
2004-12-20 13:42   ` Ralf Angeli

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.