From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marc Tfardy Newsgroups: gmane.emacs.help Subject: Re: problems with save-excursion Date: Thu, 09 Mar 2006 11:43:46 +0100 Message-ID: <47af84Feeg51U2@individual.net> References: <1141857397.880352.44860@u72g2000cwu.googlegroups.com> <47aev8Feeg51U1@individual.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141901177 12928 80.91.229.2 (9 Mar 2006 10:46:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Mar 2006 10:46:17 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 09 11:46:15 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FHIeZ-0008DH-7y for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Mar 2006 11:45:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHIeY-0005Qs-MQ for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Mar 2006 05:45:54 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.news.ucla.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.gamma.ru!Gamma.RU!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-X-Trace: individual.net L+JpGelzVc9e4ubz400bGwE8Cr4SZipyc8+daafbXQZ7+Hh4HT User-Agent: Thunderbird 1.5 (Windows/20051201) In-Reply-To: <47aev8Feeg51U1@individual.net> Original-Xref: shelby.stanford.edu gnu.emacs.help:138061 Original-To: help-gnu-emacs@gnu.org 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:33672 Archived-At: Marc Tfardy schrieb: > filcab@gmail.com schrieb: >> I have the following function: >> (defun copy-line () >> (interactive) >> (save-excursion >> (beginning-of-line) >> (set-mark-command) >> (end-of-line) >> (copy-region-as-kill))) >> >> But it's not working... >> It says: >> save-excursion: Wrong number of arguments: #[(arg) ... (some trash) >> >> >> Any clues? > > You may try: > > (defun copy-line () > (interactive) > (save-excursion > (let (beg) > (beginning-of-line) > (setq beg (point)) > (end-of-line) > (copy-region-as-kill beg (point))))) > Second and shorter version: (defun copy-line () (interactive) (copy-region-as-kill (line-beginning-position) (line-end-position))) Marc