all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: 43558@debbugs.gnu.org, "Mattias Engdegård" <mattiase@acm.org>
Subject: bug#43558: [PATCH]: Fix (forward-comment 1) when end delimiter is escaped.
Date: Thu, 19 Nov 2020 17:47:40 -0500	[thread overview]
Message-ID: <jwvzh3d3rry.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20201119211822.GE6259@ACM> (Alan Mackenzie's message of "Thu, 19 Nov 2020 21:18:22 +0000")

>> So, yeah, you can add yet-another-hack on top of the other syntax.c
>> hacks if you want, but there's a good chance it will only ever be used
>> by CC-mode.  It will take a lot more code changes in syntax.c than
>> a quick tweak to your Elisp code to search for "\*/".
[...]
> OK, here's the patch.

I think the patch agrees with my assessment above (even though it's
still missing a etc/NEWS entry, adjustment to the docstring of
modify-syntax-entry and to the .texi manual).

I really can't understand why you resist so much the use of
a `syntax-table` property on those rare \\\n sequences.


        Stefan


PS: Also, I just noticed that `gcc -Wall` warns about the use of such
multiline comments, so it doesn't seem to be a very popular feature.

PPS: For reference, I just tried to add support for it in sm-c-mode
and this is the resulting code:


@@ -312,7 +315,15 @@ E.g. a #define nested within 2 #ifs will be turned into \"#  define\"."
                                'syntax-table (string-to-syntax "|"))
             (put-text-property (match-beginning 2) (match-end 2)
                                'syntax-table (string-to-syntax "|")))
-          (sm-c--cpp-syntax-propertize end)))))
+          (sm-c--cpp-syntax-propertize end))))
+    ("\\\\\\(\n\\)"
+     (1 (let ((ppss (save-excursion (syntax-ppss (match-beginning 0)))))
+          (when (and (nth 4 ppss)        ;Within a comment
+                     (null (nth 7 ppss)) ;Within a // comment
+                     (save-excursion     ;The \ is not itself escaped
+                       (goto-char (match-beginning 0))
+                       (zerop (mod (skip-chars-backward "\\\\") 2))))
+            (string-to-syntax "."))))))
    (point) end))
 
 (defun sm-c-syntactic-face-function (ppss)






  reply	other threads:[~2020-11-19 22:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22  9:35 bug#43558: [PATCH]: Fix (forward-comment 1) when end delimiter is escaped Alan Mackenzie
2020-09-22 14:09 ` Stefan Monnier
2020-09-22 19:41   ` Alan Mackenzie
     [not found] ` <handler.43558.B.160076736116422.ack@debbugs.gnu.org>
2020-09-23  8:57   ` Alan Mackenzie
2020-09-23  9:01 ` Mattias Engdegård
2020-09-23 14:48   ` Alan Mackenzie
2020-09-23 18:44     ` Stefan Monnier
2020-09-23 19:44       ` Alan Mackenzie
2020-09-23 20:02         ` Stefan Monnier
2020-09-24 10:20       ` Alan Mackenzie
2020-09-24 16:56         ` Stefan Monnier
2020-09-24 18:50           ` Alan Mackenzie
2020-09-24 22:43             ` Stefan Monnier
2020-11-19 21:18           ` Alan Mackenzie
2020-11-19 22:47             ` Stefan Monnier [this message]
2020-11-22 13:12               ` Alan Mackenzie
2020-11-22 15:20                 ` Stefan Monnier
2020-11-22 17:08                   ` Alan Mackenzie
2020-11-22 17:46                     ` Dmitry Gutov
2020-11-22 18:19                       ` Alan Mackenzie
2020-11-22 20:39                         ` Dmitry Gutov
2020-11-22 21:13                           ` Alan Mackenzie
2020-11-22 21:34                             ` Dmitry Gutov
2020-11-22 22:01                               ` Alan Mackenzie
2020-11-22 23:00                                 ` Stefan Monnier
2021-05-13 10:38                                   ` Lars Ingebrigtsen
2021-05-13 14:51                                     ` Alan Mackenzie
2021-05-16 13:53                                       ` Lars Ingebrigtsen
2022-04-28 11:17                                       ` Lars Ingebrigtsen
2022-04-28 18:52                                         ` Alan Mackenzie
2020-11-22 23:10                     ` Stefan Monnier
2020-11-22 15:35                 ` Eli Zaretskii
2020-11-22 17:03                   ` Alan Mackenzie
2020-09-24 18:52     ` Michael Welsh Duggan
2020-09-24 19:57       ` Alan Mackenzie
2020-09-24 20:27         ` Michael Welsh Duggan

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=jwvzh3d3rry.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=43558@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=mattiase@acm.org \
    /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.