[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109244: * simple.el (delete-trailing
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109244: * simple.el (delete-trailing-lines): New option. |
Date: |
Sat, 28 Jul 2012 18:38:55 +0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109244
fixes bug: http://debbugs.gnu.org/11879
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-28 18:38:55 +0800
message:
* simple.el (delete-trailing-lines): New option.
(delete-trailing-whitespace): Obey it.
modified:
etc/NEWS
lisp/ChangeLog
lisp/simple.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-07-26 01:27:33 +0000
+++ b/etc/NEWS 2012-07-28 10:38:55 +0000
@@ -147,6 +147,10 @@
* Editing Changes in Emacs 24.2
+** New option `delete-trailing-lines' specifies whether the
+M-x delete-trailing-lines command should delete trailing lines at the
+end of the buffer. It defaults to t.
+
** Search changes
*** Global `M-s _' starts a symbol (identifier) incremental search,
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-07-28 09:19:53 +0000
+++ b/lisp/ChangeLog 2012-07-28 10:38:55 +0000
@@ -1,3 +1,8 @@
+2012-07-28 Chong Yidong <address@hidden>
+
+ * simple.el (delete-trailing-lines): New option.
+ (delete-trailing-whitespace): Obey it (Bug#11879).
+
2012-07-28 David Engster <address@hidden>
* xml.el (xml-node-name, xml-parse-file, xml-parse-region):
=== modified file 'lisp/simple.el'
--- a/lisp/simple.el 2012-07-18 14:29:34 +0000
+++ b/lisp/simple.el 2012-07-28 10:38:55 +0000
@@ -564,13 +564,28 @@
(if (looking-at "^[ \t]*\n\\'")
(delete-region (point) (point-max)))))
+(defcustom delete-trailing-lines t
+ "If non-nil, \\[delete-trailing-whitespace] deletes trailing lines.
+Trailing lines are deleted only if `delete-trailing-whitespace'
+is called on the entire buffer (rather than an active region)."
+ :type 'boolean
+ :group 'editing
+ :version "24.2")
+
(defun delete-trailing-whitespace (&optional start end)
- "Delete all the trailing whitespace across the current buffer.
-All whitespace after the last non-whitespace character in a line is deleted.
-This respects narrowing, created by \\[narrow-to-region] and friends.
-A formfeed is not considered whitespace by this function.
-If END is nil, also delete all trailing lines at the end of the buffer.
-If the region is active, only delete whitespace within the region."
+ "Delete trailing whitespace between START and END.
+If called interactively, START and END are the start/end of the
+region if the mark is active, or of the buffer's accessible
+portion if the mark is inactive.
+
+This command deletes whitespace characters after the last
+non-whitespace character in each line between START and END. It
+does not consider formfeed characters to be whitespace.
+
+If this command acts on the entire buffer (i.e. if called
+interactively with the mark inactive, or called from Lisp with
+END nil), it also deletes all trailing lines at the end of the
+buffer if the variable `delete-trailing-lines' is non-nil."
(interactive (progn
(barf-if-buffer-read-only)
(if (use-region-p)
@@ -590,6 +605,7 @@
;; Delete trailing empty lines.
(goto-char end-marker)
(when (and (not end)
+ delete-trailing-lines
;; Really the end of buffer.
(save-restriction (widen) (eobp))
(<= (skip-chars-backward "\n") -2))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109244: * simple.el (delete-trailing-lines): New option.,
Chong Yidong <=