[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: beginning-of-defun (again)
From: |
Alan Mackenzie |
Subject: |
Re: beginning-of-defun (again) |
Date: |
Thu, 29 Oct 2015 14:14:03 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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).
- Re: beginning-of-defun (again), (continued)
- Re: beginning-of-defun (again), John Wiegley, 2015/10/30
- Re: beginning-of-defun (again), Richard Stallman, 2015/10/30
- Re: beginning-of-defun (again), Alan Mackenzie, 2015/10/30
- Re: beginning-of-defun (again), John Wiegley, 2015/10/30
- Re: beginning-of-defun (again), Richard Stallman, 2015/10/31
Re: beginning-of-defun (again), Alan Mackenzie, 2015/10/29
Re: beginning-of-defun (again),
Alan Mackenzie <=
Re: beginning-of-defun (again), Richard Stallman, 2015/10/29