[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making code more Emacs Lisp-like
From: |
Sarir Khamsi |
Subject: |
Re: Making code more Emacs Lisp-like |
Date: |
Mon, 02 Nov 2009 15:17:41 -0700 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (windows-nt) |
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