help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with save-excursion


From: Marc Tfardy
Subject: Re: problems with save-excursion
Date: Thu, 09 Mar 2006 11:43:46 +0100
User-agent: Thunderbird 1.5 (Windows/20051201)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]