unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* (forward-comment -1) fails when line comment ends with a backslash
@ 2003-11-27 11:50 Alan Mackenzie
  0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2003-11-27 11:50 UTC (permalink / raw)
  Cc: bug-cc-mode

Emacs-21.1 (or .2 or .3):

C mode (or Emacs Lisp Mode, or many others):  When a backslash is the
last character of a line comment, and point is immediately after it (at
the beginning of the next line), (forward-comment -1) gets stuck at the
backslash.  It ought to move to the beginning of the comment.  e.g.:

// C Mode line-comment ending in backslash.  \
    a = b;
^
|
point

#########################################################################

The cause of the problem is in syntax.c (version 1.143) at L1931:

          quoted = char_quoted (from, from_byte);
          if (quoted)             <=================== L1931.
            {
              DEC_BOTH (from, from_byte);
              goto leave;
            }                     <=================== L1935

This was all fixed (thanks Stefan!) in version 1.145, by removing
L1931-1935, and instead checking `quoted' later on in the function.  I've
tried this patch, and it does indeed cope properly with backslashes in
line-comments at EOLs.

#########################################################################

However, syntax.c V1.145 appeared on 12th October 2001, over two years
ago.  Yet, even in Emacs 21.3, syntax.c is still at V1.143, unchanged
from Emacs 21.1.

Down at CC Mode (and possibly at Ada Mode, Emacs Lisp Mode, Shell Script
Mode, .....), we've been tearing our hair out, suffering sleepness
nights, risking our marriages (excuse the poetic licence) trying to
diagnose and work round this problem.  Yet it was apparently fixed over
two years ago.  :-(

Is there any good reason syntax.c hasn't been updated to a more recent
version in the last couple of years?  If not, I'd like to request that it
be updated for Emacs 21.4 (or 22.1 :-).

-- 
Alan Mackenzie (Munich, Germany)
acm@muc.de





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-27 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-27 11:50 (forward-comment -1) fails when line comment ends with a backslash Alan Mackenzie

Code repositories for project(s) associated with this public inbox

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

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