emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog simple.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog simple.el
Date: Sat, 13 Jun 2009 18:56:12 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/06/13 18:56:12

Modified files:
        lisp           : ChangeLog simple.el 

Log message:
        * simple.el (kill-visual-line): Rewrite (Bug#3437).  Don't try to
        handle kill-whole-line, as it doesn't make sense in this context.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15679&r2=1.15680
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.987&r2=1.988

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15679
retrieving revision 1.15680
diff -u -b -r1.15679 -r1.15680
--- ChangeLog   12 Jun 2009 20:14:45 -0000      1.15679
+++ ChangeLog   13 Jun 2009 18:56:07 -0000      1.15680
@@ -1,3 +1,8 @@
+2009-06-13  Chong Yidong  <address@hidden>
+
+       * simple.el (kill-visual-line): Rewrite (Bug#3437).  Don't try to
+       handle kill-whole-line, as it doesn't make sense in this context.
+
 2009-06-12  Sam Steingold  <address@hidden>
 
        * vc-hg.el (vc-hg-log-switches): Add defcustom.

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.987
retrieving revision 1.988
diff -u -b -r1.987 -r1.988
--- simple.el   11 May 2009 15:35:47 -0000      1.987
+++ simple.el   13 Jun 2009 18:56:11 -0000      1.988
@@ -4471,20 +4471,10 @@
 
 (defun kill-visual-line (&optional arg)
   "Kill the rest of the visual line.
-If there are only whitespace characters there, kill through the
-newline as well.
-
-With prefix argument ARG, kill that many lines from point.
-Negative arguments kill lines backward.
-With zero argument, kill the text before point on the current line.
-
-When calling from a program, nil means \"no arg\",
-a number counts as a prefix arg.
-
-If `kill-whole-line' is non-nil, then this command kills the whole line
-including its terminating newline, when used at the beginning of a line
-with no argument.  As a consequence, you can always kill a whole line
-by typing \\[beginning-of-line] \\[kill-line].
+With prefix argument ARG, kill that many visual lines from point.
+If ARG is negative, kill visual lines backward.
+If ARG is zero, kill the text before point on the current visual
+line.
 
 If you want to append the killed line to the last killed text,
 use \\[append-next-kill] before \\[kill-line].
@@ -4495,29 +4485,20 @@
 \(If the variable `kill-read-only-ok' is non-nil, then this won't
 even beep.)"
   (interactive "P")
-  (let ((opoint (point))
-       (line-move-visual t)
-       end)
-    ;; It is better to move point to the other end of the kill before
-    ;; killing.  That way, in a read-only buffer, point moves across
-    ;; the text that is copied to the kill ring.  The choice has no
-    ;; effect on undo now that undo records the value of point from
-    ;; before the command was run.
+  ;; Like in `kill-line', it's better to move point to the other end
+  ;; of the kill before killing.
+  (let ((opoint (point)))
     (if arg
        (vertical-motion (prefix-numeric-value arg))
-      (if (eobp)
-         (signal 'end-of-buffer nil))
-      (setq end (save-excursion
-                 (end-of-visual-line) (point)))
-      (if (or (save-excursion
-               ;; If trailing whitespace is visible,
-               ;; don't treat it as nothing.
-               (unless show-trailing-whitespace
-                 (skip-chars-forward " \t" end))
-               (= (point) end))
-             (and kill-whole-line (bolp)))
-         (line-move 1)
-       (goto-char end)))
+      (end-of-visual-line 1)
+      (if (= (point) opoint)
+         (vertical-motion 1)
+       ;; Skip any trailing whitespace at the end of the visual line.
+       ;; We used to do this only if `show-trailing-whitespace' is
+       ;; nil, but that's wrong; the correct thing would be to check
+       ;; whether the trailing whitespace is highlighted.  But, it's
+       ;; OK to just do this unconditionally.
+       (skip-chars-forward " \t")))
     (kill-region opoint (point))))
 
 (defun next-logical-line (&optional arg try-vscroll)




reply via email to

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