all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: Re: problems with save-excursion
Date: Thu, 09 Mar 2006 07:57:14 +0900	[thread overview]
Message-ID: <b4m64mo4kad.fsf@jpl.org> (raw)
In-Reply-To: 1141857397.880352.44860@u72g2000cwu.googlegroups.com

>>>>> In <1141857397.880352.44860@u72g2000cwu.googlegroups.com>
>>>>>	filcab@gmail.com wrote:

> 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)

You can modify it to work as follows:

(defun copy-line ()
   (interactive)
   (save-excursion
      (beginning-of-line)
      (call-interactively 'set-mark-command)
      (end-of-line)
      (call-interactively 'copy-region-as-kill)))

If you wish only to copy a line, it can be simplified as follows:

(defun copy-line ()
  (interactive)
  (kill-new
   (buffer-substring (line-beginning-position)
		     (line-end-position))))

  reply	other threads:[~2006-03-08 22:57 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 [this message]
2006-03-09  4:30 ` Eli Zaretskii
2006-03-09 10:39 ` Marc Tfardy
2006-03-09 10:43   ` Marc Tfardy
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4m64mo4kad.fsf@jpl.org \
    --to=yamaoka@jpl.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.