unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A proposal for the future of open-paren-in-column-0-is-defun-start.
@ 2020-04-05 13:47 Alan Mackenzie
  2020-04-05 14:33 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Alan Mackenzie @ 2020-04-05 13:47 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

The working of open-paren-in-column-0-is-defun-start is still functional
in emacs-27 and master, providing the newish variable
comment-use-syntax-ppss is set to nil.

When enabled, it still causes problems in, at the very least, CC Mode.
For example, in the following:

    /*
    (
    */
      ^
    point

, (forward-comment -1) spuriously returns nil and doesn't move point.

The root of the problem is that back_comment (in syntax.c) has no means
of distinguishing open parens in comments and strings from other open
parens.  I propose giving the function such a means.

This would be a text property `syntax-open-paren-in-literal' which would
be applied to each and every open paren at column zero inside a literal.
back_comment could easily and cheaply test this text-property.

`syntax-open-paren-in-literal' would be applied throughout the buffer
when it is first loaded into Emacs, and would be kept up to date by
"super before/after-change-functions".  (These functions would be called
at buffer changes regardless of the value of inhibit-modification-hooks.
We would want some way of inhibiting them being called on a change of
text properties, for efficiency's sake).

With this mechanism in place, o-p-i-c-0-i-d-s could safely be left
enabled, for speed's sake, without causing the all too familiar bugs in
CC Mode.

What do people think?

-- 
Alan Mackenzie (Nuremberg, Germany).



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

end of thread, other threads:[~2020-04-07 14:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-05 13:47 A proposal for the future of open-paren-in-column-0-is-defun-start Alan Mackenzie
2020-04-05 14:33 ` Stefan Monnier
2020-04-05 15:23   ` Alan Mackenzie
2020-04-05 18:39     ` Stefan Monnier
2020-04-06  2:37   ` Richard Stallman
2020-04-06 15:40     ` Stefan Monnier
2020-04-06 16:04       ` Eli Zaretskii
2020-04-06 16:25         ` Stefan Monnier
2020-04-06 16:36           ` Eli Zaretskii
2020-04-06 17:49             ` Stefan Monnier
2020-04-06 18:16               ` Eli Zaretskii
2020-04-06 18:32               ` andres.ramirez
2020-04-07  8:33         ` martin rudalics
2020-04-07 13:47           ` Stefan Monnier
2020-04-07 14:06           ` Eli Zaretskii
2020-04-06 19:08 ` Dmitry Gutov
2020-04-06 21:42 ` Stefan Monnier
2020-04-06 21:58   ` Dmitry Gutov
2020-04-06 23:44     ` Stefan Monnier

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