From: Oleh Krehel <ohwoeowho@gmail.com>
To: Richard Stallman <rms@gnu.org>
Cc: andreas.roehler@online.de, emacs-devel@gnu.org
Subject: Re: beginning-of-defun (again)
Date: Fri, 30 Oct 2015 10:29:58 +0100 [thread overview]
Message-ID: <87twp8wvop.fsf@gmail.com> (raw)
In-Reply-To: <m237wtrtbj.fsf@newartisans.com> (John Wiegley's message of "Thu, 29 Oct 2015 19:20:00 -0700")
John Wiegley <johnw@newartisans.com> writes:
>>>>>> Richard Stallman <rms@gnu.org> writes:
>
>> Is there a specific practical reason why it is important for the defuns in
>> init.el not to start in column 0?
>
> They are within macros controlling whether they are evaluated or compiled or
> not, based on available packages on the system.
If they are within macros, they're data and not defuns in my mind. For
me, a defun is a top-level expression with "(" at column 0. It doesn't
even need to define something callable (like `defun' or `defmacro'), so
a `defcustom' statement is a defun for purposes of `beginning-of-defun'.
> I'm not particularly disturbed by the fact that beginning-of-defun doesn't
> work for these functions, however.
Nor it should, unless we hook up a static code analyzer to Emacs and
make `beginning-of-defun' use that data:
(defun semantic-beginning-of-defun ()
(interactive)
(semantic-mode 1)
(let ((tag-starts
(mapcar
(lambda (x)
(semantic-tag-start x))
(cl-remove-if-not
(lambda (x)
(eq (semantic-tag-class x) 'function))
(semantic-fetch-tags))))
pt)
(while (and tag-starts (< (car tag-starts) (point)))
(setq pt (pop tag-starts)))
(goto-char pt)))
But it would be silly to use the above approach unless
`semantic-fetch-tags' is made somehow very fast and very smart.
The column 0 heuristic is a perfectly fine and fast alternative.
Besides, guess where the above function would bring me from this
situation (| is the point):
(defun ...)
(defvar ...)
(defvar ...)
(defvar ...|)
Would anyone actually want that behavior on "C-M-a", which is basically
(re-search-backward "(defun") at this point?
next prev parent reply other threads:[~2015-10-30 9:29 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 [this message]
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
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
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=87twp8wvop.fsf@gmail.com \
--to=ohwoeowho@gmail.com \
--cc=andreas.roehler@online.de \
--cc=emacs-devel@gnu.org \
--cc=rms@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).