From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Moving to beginning and end of a list
Date: Thu, 22 Oct 2009 18:20:03 +0200 [thread overview]
Message-ID: <877hun5rkc.fsf@galatea.local> (raw)
In-Reply-To: 887f5295-4a75-408e-ad2f-ccd30f9c5694@f10g2000vbl.googlegroups.com
Nordlöw <per.nordlow@gmail.com> writes:
> I have found these two functions very useful especially when do lisp
> hacking and designing clever macros:
>
> (defun move-beginning-of-list ()
> "Move to beginning of list, before first element."
> (interactive)
> (while (ignore-errors (backward-sexp) t)))
> (global-set-key [(meta shift ?a)] 'move-beginning-of-list)
>
> (defun move-end-of-list ()
> "Move to end of list, after first element."
> (interactive)
> (while (ignore-errors (forward-sexp) t)))
> (global-set-key [(meta shift ?e)] 'move-end-of-list)
>
> Does Emacs contain something similar by default.
AFAIK, no.
There is a nice minor mode to edit sexps: paredit
but it doesn't contain these features.
http://mumble.net/~campbell/emacs/
Slime contains a _function_ slime-beginning-of-list, that could be
wrapped in a command, but no slime-end-of-list.
Notice that to keep consistency with emacs lisp beginning-of-line,
end-of-line, beginning-of-buffer, end-of-buffer, etc, you should name
them beginning-of-list and end-of-list.
Similarly, emacs lisp contains functions that would allow to implement
them more easily (and possibly, more generally):
(defun beginning-of-list ()
"Move to beginning of list, before first element."
(interactive)
(up-list)
(beginning-of-sexp)
(down-list))
(defun end-of-list ()
"Move to end of list, after last element."
(interactive)
(up-list)
(down-list -1))
It might be a good idea to propose inclusion of these functions to
paredit.
--
__Pascal Bourguignon__
prev parent reply other threads:[~2009-10-22 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 14:51 Moving to beginning and end of a list Nordlöw
2009-10-22 16:20 ` Pascal J. Bourguignon [this message]
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=877hun5rkc.fsf@galatea.local \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@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.
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).