unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: A proposal for the future of open-paren-in-column-0-is-defun-start.
Date: Sun, 5 Apr 2020 13:47:35 +0000	[thread overview]
Message-ID: <20200405134735.GD5049@ACM> (raw)

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



             reply	other threads:[~2020-04-05 13:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 13:47 Alan Mackenzie [this message]
2020-04-05 14:33 ` A proposal for the future of open-paren-in-column-0-is-defun-start 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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200405134735.GD5049@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.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 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).