emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/simple.el


From: Luc Teirlinck
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el
Date: Thu, 29 May 2003 19:29:29 -0400

Index: emacs/lisp/simple.el
diff -c emacs/lisp/simple.el:1.607 emacs/lisp/simple.el:1.608
*** emacs/lisp/simple.el:1.607  Wed May 28 16:07:09 2003
--- emacs/lisp/simple.el        Thu May 29 19:29:29 2003
***************
*** 2210,2232 ****
  
  (defun kill-whole-line (&optional arg)
    "Kill current line.
! With prefix arg, kill that many lines from point.
! If arg is negative, kill backwards.
  If arg is zero, kill current line but exclude the trailing newline."
    (interactive "P")
    (setq arg (prefix-numeric-value arg))
    (cond ((zerop arg)
!        (kill-region (point) (progn (forward-visible-line 0) (point)))
         (kill-region (point) (progn (end-of-visible-line) (point))))
        ((< arg 0)
!        (kill-line 1)
!        (kill-line (1+ arg))
!        (unless (bobp) (forward-visible-line -1)))
        (t
!        (kill-line 0)
!        (if (eobp)
!            (signal 'end-of-buffer nil)
!          (kill-line arg)))))
  
  (defun forward-visible-line (arg)
    "Move forward by ARG lines, ignoring currently invisible newlines only.
--- 2210,2250 ----
  
  (defun kill-whole-line (&optional arg)
    "Kill current line.
! With prefix arg, kill that many lines starting from the current line.
! If arg is negative, kill backward.  Also kill the preceding newline.
! \(This is meant to make C-x z work well with negative arguments.\)
  If arg is zero, kill current line but exclude the trailing newline."
    (interactive "P")
    (setq arg (prefix-numeric-value arg))
+   (if (and (> arg 0) (eobp) (save-excursion (forward-visible-line 0) (eobp)))
+       (signal 'end-of-buffer nil))
+   (if (and (< arg 0) (bobp) (save-excursion (end-of-visible-line) (bobp)))
+       (signal 'beginning-of-buffer nil))
+   (unless (eq last-command 'kill-region)
+     (kill-new "")
+     (setq last-command 'kill-region))
    (cond ((zerop arg)
!        ;; We need to kill in two steps, because the previous command
!        ;; could have been a kill command, in which case the text
!        ;; before point needs to be prepended to the current kill
!        ;; ring entry and the text after point appended.  Also, we
!        ;; need to use save-excursion to avoid copying the same text
!        ;; twice to the kill ring in read-only buffers.
!        (save-excursion
!          (kill-region (point) (progn (forward-visible-line 0) (point))))
         (kill-region (point) (progn (end-of-visible-line) (point))))
        ((< arg 0)
!        (save-excursion
!          (kill-region (point) (progn (end-of-visible-line) (point))))
!        (kill-region (point)
!                     (progn (forward-visible-line (1+ arg))
!                            (unless (bobp) (backward-char))
!                            (point))))
        (t
!        (save-excursion
!          (kill-region (point) (progn (forward-visible-line 0) (point))))
!        (kill-region (point)
!                     (progn (forward-visible-line arg) (point))))))
  
  (defun forward-visible-line (arg)
    "Move forward by ARG lines, ignoring currently invisible newlines only.




reply via email to

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