From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sarir Khamsi Newsgroups: gmane.emacs.help Subject: Re: Making code more Emacs Lisp-like Date: Mon, 02 Nov 2009 15:17:41 -0700 Organization: Raytheon Company Message-ID: References: <871vkgzo80.fsf@kzsu.stanford.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257201759 16805 80.91.229.12 (2 Nov 2009 22:42:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2009 22:42:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 02 23:42:32 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N55bb-0004UH-9P for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Nov 2009 23:42:31 +0100 Original-Received: from localhost ([127.0.0.1]:53125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N55ba-0000iO-TD for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Nov 2009 17:42:30 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!bloom-beacon.mit.edu!4.24.21.218.MISMATCH!newsfeed2.dallas1.level3.net!news.level3.com!bos-service1.raytheon.com!bos-service2b.ext.ray.com.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:Thw3FXvcj6XsGr2B4njSd0A5e2M= Original-Lines: 30 Original-NNTP-Posting-Host: 147.24.167.103 Original-X-Complaints-To: news@ext.ray.com Original-X-Trace: bos-service2b.ext.ray.com 1257200266 147.24.167.103 (Mon, 02 Nov 2009 22:17:46 UTC) Original-NNTP-Posting-Date: Mon, 02 Nov 2009 22:17:46 UTC Original-Xref: news.stanford.edu gnu.emacs.help:174336 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69417 Archived-At: Joseph Brenner 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