unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stuart D. Herring" <herring@lanl.gov>
Cc: martin rudalics <rudalics@gmx.at>,
	Chong Yidong <cyd@stupidchicken.com>,
	emacs-devel@gnu.org, Richard Stallman <rms@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: What `opic0ids' really is [was: Mysterious fontification/C++  context issue - Patch      for	beginning-of-defun-raw.]
Date: Thu, 14 Dec 2006 13:53:22 -0800 (PST)	[thread overview]
Message-ID: <48768.128.165.123.18.1166133202.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <20061214193733.GA1269@muc.de>

> I say we should GIVE THE USER THE CHOICE.  I have proposed a way of
> doing this to which nobody's commented yet: Have three values for the
> variable with the furlong long name, namely (t nil mode).  t and nil
> will carry on meaning what they mean, and the symbol 'mode, the
> default, will mean "Major mode may set its own default here".
>
> Comments, please!

I've not been in this thread thus far, but I feel that the point may be
being missed here.  open-paren-in-column-0-is-defun-start is purely an
optimization:

1. If the user knows that "bad" C0 parens are sufficiently rare
("sufficiently" for his purposes) that assuming them to be defun-start
points, he should set the variable to t (perhaps as a file-local in a long
C file which would otherwise be a problem).

2. If another user knows that code she deals with does not follow good
indentation standards or is using some preprocessor or so that makes that
assumption invalid, she should set the variable to nil (again, perhaps
locally).

3. If a mode knows that its language requires that the rule be followed
(or that it is followed in all halfway-sensible cases), it MAY (see RFC
2119) set opic0ids to t locally in its buffers, but it SHOULD NOT assume
that the variable is non-nil (in that, perhaps, it assumes that low-level
functions involved in `beginning-of-defun' will act as they do when it is
non-nil) unless it specifically dynamically binds the variable so.

4. If a mode knows that its language requires or merely often involves
that other C0 parens appear, it SHOULD set opic0ids to nil locally in its
buffers.  If a user overrides this setting, the mode SHOULD NOT fail or
raise errors, and MUST NOT make incorrect textual buffer modifications,
but may of course produce and/or cache incorrect answers about the
structure of text in the buffer.

All that I think is common sense or follows from the definition of
opic0ids as an optimization control.  My own suggested guidelines follow.

5. A mode MAY ignore opic0ids in its own code (and bind it conveniently
when calling into standard routines) if parens are not associated with
defuns in its language.  A mode MAY similarly ignore the variable if (for
some operation) it provides a more powerful, faster, more convenient, or
otherwise superior (e.g., updates useful internal data) mechanism for
finding the beginnings of defuns that incurs no user-perceptible
performance penalty for any operation on a well-formed file of a size and
complexity ever encountered in practice on the overwhelming majority of
modern hardware.

6. Any feature or behavior without which a mode is usable (even if
crippled) and which has the potential in any plausible scenario to delay
editing (particularly repeatedly) MUST be controllable by a user option
(although the default value SHOULD enable it so that it is available
except when problematic and is known in the first place).

7. A mode SHOULD interpret the assumption implied by opic0ids non-nil as
appropriate to that mode; for instance, in C mode, where functions begin
not with their opening { but rather with the return type of the function,
a C0 paren (with opic0ids set) may be assumed to be the beginning of a
function's root block, but the mode should still arrange to move before
the argument list, name, and return type (as possible) when performing
`beginning-of-defun' or the equivalent.

8. A mode MUST NOT use the value of opic0dis to decide whether to make
other unrelated assumptions or simplifications, but it MAY provide a value
of a user option which means "enable <feature> iff opic0ids is set".

9. All code MUST NOT assume the converse -- that all starts of defuns are
heralded by C0 parens -- as a result of the value of opic0ids.

10. All code SHOULD NOT assume that converse ever, unless their language
requires it to be the case.  If it is prohibitively expensive not to
assume it, it may be assumed, but this variance MUST be documented and
SHOULD be controlled by a user option (whose default value MAY allow the
assumption) if feasible.

I note that in 21.3.1 (the only version I have available at the moment)
Emacs Lisp mode violates #10.

Sorry that this is something of a rant, but I want to put out a set of
rules such that either
A) we come to agree that they are a good representation of how things
should be, so that we now have a guide for how to resolve things;
B) we discover that we are not in agreement about what the goals/effects
of this user option are/should be, so that we can address them instead of
wasting time talking at cross purposes; or
C) we find that I was right to stay out of this thread because I do not
understand the subject or have uselessly unique ideas about it, so that I
will resume silence and not waste anyone's time with lots of shorter
messages that would be no more helpful.

So, er, which is it?
Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

  parent reply	other threads:[~2006-12-14 21:53 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87y7po2e9b.fsf@leeloo.anubex.internal>
     [not found] ` <45741FBE.3000107@swipnet.se>
     [not found]   ` <45742464.1090504@gmx.at>
2006-12-04 21:17     ` Mysterious fontification/C++ context issue Alan Mackenzie
2006-12-06  0:47       ` Richard Stallman
2006-12-06  9:04       ` martin rudalics
2006-12-06 12:22         ` Kim F. Storm
2006-12-06 16:31           ` Chong Yidong
2006-12-07  4:59             ` Richard Stallman
2006-12-09 17:46               ` Chong Yidong
2006-12-09 20:09                 ` Stefan Monnier
2006-12-11  1:05                   ` Richard Stallman
2006-12-11  2:27                     ` Stefan Monnier
2006-12-11  4:38                     ` Stefan Monnier
2006-12-12 16:24                       ` Chong Yidong
2006-12-12 17:10                         ` Stefan Monnier
2006-12-10  4:24                 ` Richard Stallman
2006-12-10  0:35               ` Alan Mackenzie
2006-12-10  1:11                 ` Chong Yidong
2006-12-10  9:12                   ` Alan Mackenzie
2006-12-10 12:46                     ` David Kastrup
2006-12-10 14:50                       ` Alan Mackenzie
2006-12-10 15:13                         ` David Kastrup
2006-12-10 20:30                     ` Chong Yidong
2006-12-13 21:29                       ` Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw Alan Mackenzie
2006-12-14  1:02                         ` Chong Yidong
2006-12-14  7:36                           ` Alan Mackenzie
2006-12-14 10:47                             ` martin rudalics
2006-12-14 18:26                               ` Alan Mackenzie
2006-12-14 18:53                                 ` David Kastrup
2006-12-14 20:21                                 ` Chong Yidong
2006-12-14 20:35                                 ` Chong Yidong
2006-12-14 22:18                                   ` Alan Mackenzie
2006-12-14 22:51                                     ` Chong Yidong
2006-12-15  0:53                                     ` David Kastrup
2006-12-15 10:35                                     ` Johan Bockgård
2006-12-14 21:53                                 ` Stuart D. Herring [this message]
2006-12-15  7:32                                 ` martin rudalics
2006-12-15 19:22                                   ` Alan Mackenzie
2006-12-15 22:20                                     ` David Kastrup
2006-12-16 10:17                                     ` martin rudalics
2006-12-17 11:44                                       ` Alan Mackenzie
2006-12-17 12:02                                         ` David Kastrup
2006-12-17 12:08                                           ` Alan Mackenzie
2006-12-17 12:14                                             ` David Kastrup
2006-12-17 12:26                                               ` Alan Mackenzie
2006-12-17 12:51                                                 ` David Kastrup
2006-12-17 17:28                                         ` martin rudalics
2006-12-17 18:36                                         ` Mysterious fontification/C++ context issue - Patch for c-basic-common-init Alan Mackenzie
2006-12-17 18:45                                           ` Chong Yidong
2006-12-17 22:18                                             ` Alan Mackenzie
2006-12-17 22:59                                               ` Chong Yidong
2006-12-18  0:06                                         ` Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw Stefan Monnier
2006-12-15 23:24                               ` Stefan Monnier
2006-12-16 10:17                                 ` martin rudalics
2006-12-16 18:14                                   ` Chong Yidong
2006-12-16 18:27                                   ` martin rudalics
2006-12-16 19:00                                     ` martin rudalics
2006-12-16 19:33                                       ` Chong Yidong
2006-12-16 19:59                                         ` martin rudalics
2006-12-16 20:10                                           ` Chong Yidong
2006-12-16 21:26                                             ` Chong Yidong
2006-12-16 22:43                                               ` martin rudalics
2006-12-16 23:30                                               ` Stefan Monnier
2006-12-16 23:40                                                 ` martin rudalics
2006-12-17  0:04                                                   ` Stefan Monnier
2006-12-17  4:02                                                     ` Chong Yidong
2006-12-17 10:32                                                       ` martin rudalics
2006-12-17 10:26                                                     ` martin rudalics
2006-12-17 10:59                                                       ` David Kastrup
2006-12-17 23:23                                                       ` Stefan Monnier
2006-12-17 11:10                                                     ` Alan Mackenzie
2006-12-17 12:01                                                       ` David Kastrup
2006-12-18  0:04                                                       ` Stefan Monnier
2006-12-16 22:11                                             ` martin rudalics
2006-12-16 23:29                                           ` Stefan Monnier
2006-12-16 23:37                                             ` martin rudalics
2006-12-16 20:22                                         ` David Kastrup
2006-12-16 22:21                                           ` martin rudalics
2006-12-14 17:29                             ` Chong Yidong
2006-12-14 18:56                               ` David Kastrup
2006-12-14 22:57                               ` Alan Mackenzie
2006-12-15 22:56                           ` Stefan Monnier
2006-12-15 23:03                             ` David Kastrup
2006-12-14 10:45                         ` martin rudalics
2006-12-14 18:29                           ` Alan Mackenzie
2006-12-15 22:49                         ` Stefan Monnier
2006-12-10 21:39                     ` Mysterious fontification/C++ context issue Stefan Monnier
2006-12-10 23:14                       ` Kim F. Storm
2006-12-14  7:43                       ` Alan Mackenzie
2006-12-14  7:51                         ` Miles Bader
2006-12-15 23:36                         ` Stefan Monnier
2006-12-10  9:18                   ` martin rudalics
2006-12-11  1:23                     ` Stefan Monnier
2006-12-11  7:23                       ` martin rudalics
2006-12-11  7:36                         ` Stefan Monnier
2006-12-11  8:32                           ` martin rudalics
2006-12-11 16:30                             ` Stefan Monnier
2006-12-11  1:05                 ` Stefan Monnier
2006-12-11  1:06                 ` Richard Stallman
2006-12-06 18:44         ` Richard Stallman
2006-12-06 22:38           ` martin rudalics
2006-12-08  5:05             ` Richard Stallman
2006-12-09  9:42               ` martin rudalics
2006-12-10  4:24                 ` Richard Stallman
2006-12-10  8:38                   ` martin rudalics
2006-12-10 10:56                   ` Alan Mackenzie
2006-12-10 11:58                     ` martin rudalics
2006-12-10 14:30                       ` Slawomir Nowaczyk
2006-12-11  1:29                     ` Stefan Monnier
2006-12-06 20:52         ` Alan Mackenzie
2006-12-06 22:38           ` martin rudalics
2006-12-07  5:07           ` 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=48768.128.165.123.18.1166133202.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    --cc=rudalics@gmx.at \
    /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).