From: Sarir Khamsi <sarir.khamsi@raytheon.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Making code more Emacs Lisp-like
Date: Mon, 02 Nov 2009 15:17:41 -0700 [thread overview]
Message-ID: <upr80po56.fsf@raytheon.com> (raw)
In-Reply-To: 871vkgzo80.fsf@kzsu.stanford.edu
Joseph Brenner <doom@kzsu.stanford.edu> writes:
> For example, if you look up "set-mark", there's an example that's
> easily adapted to what you're doing here:
>
>> (set-mark (+ (point) 1)) ; save the current position
>> (beginning-of-line)
>> (kill-region (point) (mark))
>
> Would become:
>
> (let ((beg (point)))
> (beginning-of-line)
> (delete-region beg (point)))
Thanks, this looks better.
> The goal there is to avoid messing with the kill-ring or the mark
> history if that's not necessary. Otherwise you may surprise the
> user with the unwanted side-effects.
save-excursion is supposed to "Save point, mark, and current buffer;
execute BODY; restore those things" but I understand that you want to
avoid modifying the kill ring. Thanks.
Sarir
--
Sarir Khamsi
sarir.khamsi@raytheon.com
next prev parent reply other threads:[~2009-11-02 22:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 15:19 Making code more Emacs Lisp-like Sarir Khamsi
2009-11-02 20:05 ` Joseph Brenner
2009-11-02 22:17 ` Sarir Khamsi [this message]
2009-11-03 0:39 ` Joseph Brenner
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=upr80po56.fsf@raytheon.com \
--to=sarir.khamsi@raytheon.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.
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.