[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A proposal for the future of open-paren-in-column-0-is-defun-start.
From: |
Alan Mackenzie |
Subject: |
A proposal for the future of open-paren-in-column-0-is-defun-start. |
Date: |
Sun, 5 Apr 2020 13:47:35 +0000 |
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).
- A proposal for the future of open-paren-in-column-0-is-defun-start.,
Alan Mackenzie <=
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Stefan Monnier, 2020/04/05
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Alan Mackenzie, 2020/04/05
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Richard Stallman, 2020/04/05
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Stefan Monnier, 2020/04/06
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Eli Zaretskii, 2020/04/06
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Stefan Monnier, 2020/04/06
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Eli Zaretskii, 2020/04/06
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Stefan Monnier, 2020/04/06
- Re: A proposal for the future of open-paren-in-column-0-is-defun-start., Eli Zaretskii, 2020/04/06