all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Andreas Röhler" <andreas.roehler@online.de>
Cc: emacs-devel@gnu.org
Subject: Re: beginning-of-defun (again)
Date: Thu, 29 Oct 2015 14:14:03 +0000	[thread overview]
Message-ID: <20151029141402.GD2510@acm.fritz.box> (raw)
In-Reply-To: <56321791.8040809@online.de>

Hello, Andreas

On Thu, Oct 29, 2015 at 01:56:49PM +0100, Andreas Röhler wrote:
>   On 29.10.2015 13:46, Alan Mackenzie wrote:
> > On Thu, Oct 29, 2015 at 12:24:48PM +0100, Andreas Röhler wrote:
> >>    Hi guys,
> >> maybe it's time to have a reasonable default-behavior of
> >> beginning-of-defun in Emacs Lisp.
> >> IMO there is no reason for stuff like
> >> open-paren-in-column-0-is-defun-start
> > Unfortunately, there is.  Setting it to nil ensures accurate recognition
> > of non-nested parens,

> Sorry, Alan, but if there is no syntax expecting a start in column 0, 
> there is no reason to assume that.

> Relying on such means working in some cases, in other not. You won't 
> want that.

Note that o-p-i-c-0-i-d-s being non-nil doesn't mean that this is the
only way defun starts are recognised.  It is an additional facility in
addition to however else a major mode detects defun starts.


> >   though this can be slow, sometimes very slow.
> > Setting it to non-nil makes it fast, but sometimes so inaccurate it
> > looks like a bug.

> >> A function resp. top-level-form starts if the beginning of a list is
> >> followed by a respective keyword.
> > Not necessarily: how does Emacs know whether something looking like a
> > "top-level-form" is actually at the top level or not?

> Top-level here is the beginning of a not nested list.
> Remains to set the keywords more or less restrictive.

Like I said, without that variable, Emacs scans all the way from the
beginning of the buffer each time it needs to test the non-nestedness.
Sometimes this is what you want, sometimes not.  It's up to the user (or,
perhaps, the writer of the major mode) to set o-p-i-c-0-i-d-s
appropriately.

> >    When
> > open-paren-in-column-0-is-defun-start is non-nil, it need scan no
> > further back than the first such paren encountered.  When
> > o-p-i-c-0-i-d-s is nil, it must scan all the way from the beginning of
> > the file.

> >> The list of keywords being customizable seems a plus :)
> > This would not work in all modes.


> The default can't work in all modes but be reliable in Emacs Lisp.

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2015-10-29 14:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 11:24 beginning-of-defun (again) Andreas Röhler
2015-10-29 11:52 ` Oleh Krehel
2015-10-29 12:03   ` David Kastrup
2015-10-29 13:07     ` Oleh Krehel
2015-10-29 13:28       ` David Kastrup
2015-10-29 13:47       ` David Kastrup
2015-10-29 17:39         ` Andreas Röhler
2015-10-29 12:11   ` Andreas Röhler
2015-10-29 12:16     ` Kaushal Modi
2015-10-29 17:56   ` John Wiegley
2015-10-30  1:35     ` Richard Stallman
2015-10-30  2:20       ` John Wiegley
2015-10-30  9:29         ` Oleh Krehel
2015-10-30 18:17           ` John Wiegley
2015-10-30 23:13         ` Richard Stallman
2015-10-30 23:29           ` Alan Mackenzie
2015-10-30 23:34             ` John Wiegley
2015-11-01  1:05             ` Richard Stallman
2015-10-29 12:46 ` Alan Mackenzie
2015-10-29 12:56   ` Andreas Röhler
2015-10-29 13:31     ` David Kastrup
2015-10-29 14:46       ` Andreas Röhler
2015-10-29 14:57         ` David Kastrup
2015-10-29 14:14     ` Alan Mackenzie [this message]
2015-10-30  1:34 ` Richard Stallman
2015-10-30  6:47   ` Andreas Röhler
2015-10-30 23:14     ` Richard Stallman
2015-10-31  8:01       ` Andreas Röhler
2015-10-31 12:24         ` David Kastrup
2015-10-31 15:55           ` Andreas Röhler
2015-11-01  1:06         ` Richard Stallman

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=20151029141402.GD2510@acm.fritz.box \
    --to=acm@muc.de \
    --cc=andreas.roehler@online.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 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.