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

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

modified cut cannot be pasted with yank command - why?


From: Chris Seberino
Subject: modified cut cannot be pasted with yank command - why?
Date: Fri, 2 Nov 2001 20:54:07 -0800
User-agent: Mutt/1.2.5i

I wrote my own delete line or cut line(s) command.
How do I make it so that "yanking" or pasting
will copy the text to somewhere else???
(I can cut multiple lines e.g. 5 with ESC 5 C-d
so prefix works fine.)

Here is my command...

; Define Ctrl-d to delete a line.
(global-set-key "\C-d" 'new-kill-line)

(defun new-kill-line(&optional arg)
   (interactive "P")
   (setq n-lines-left (prefix-numeric-value arg))
   (while (> n-lines-left 0)
      (setq current-pos (point))
      (end-of-line)
      (setq end-pos (point))
      (beginning-of-line)
      (setq beg-pos (point))
      (kill-line)
      (kill-line)
      (end-of-line)
      (setq new-end-pos (point))
      (beginning-of-line)
      (forward-char (min (- new-end-pos beg-pos)
                         (- current-pos beg-pos)
                       )
         )
      (setq n-lines-left (- n-lines-left 1))
      )
)

Thanks,

Chris



reply via email to

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