unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marc Tfardy <m-t-o___CUT_IT___@web.de>
Subject: Re: problems with save-excursion
Date: Thu, 09 Mar 2006 11:43:46 +0100	[thread overview]
Message-ID: <47af84Feeg51U2@individual.net> (raw)
In-Reply-To: <47aev8Feeg51U1@individual.net>

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

  reply	other threads:[~2006-03-09 10:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08 22:36 problems with save-excursion filcab
2006-03-08 22:57 ` Katsumi Yamaoka
2006-03-09  4:30 ` Eli Zaretskii
2006-03-09 10:39 ` Marc Tfardy
2006-03-09 10:43   ` Marc Tfardy [this message]
2006-03-11 17:19   ` Stefan Monnier
2006-03-15 14:26 ` Peter Lee
  -- strict thread matches above, loose matches on Subject: below --
2006-03-08 23:00 bhenz
2006-03-10 19:21 ` Kevin Rodgers

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=47af84Feeg51U2@individual.net \
    --to=m-t-o___cut_it___@web.de \
    /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).