mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-07 15:21:46 +00:00
Optionally, undo several consequential deletion in one step.
* lisp/simple.el (kill-append): Remove undo boundary depending on ... (kill-append-merge-undo): New user option.
This commit is contained in:
parent
5d2638bd31
commit
2fde356acb
@ -1,3 +1,8 @@
|
|||||||
|
2014-06-23 Sam Steingold <sds@gnu.org>
|
||||||
|
|
||||||
|
* simple.el (kill-append): Remove undo boundary depending on ...
|
||||||
|
(kill-append-merge-undo): New user option.
|
||||||
|
|
||||||
2014-06-23 Stefan Monnier <monnier@iro.umontreal.ca>
|
2014-06-23 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
* simple.el (handle-shift-selection, exchange-point-and-mark)
|
* simple.el (handle-shift-selection, exchange-point-and-mark)
|
||||||
|
@ -3742,14 +3742,34 @@ argument should still be a \"useful\" string for such uses."
|
|||||||
(if interprogram-cut-function
|
(if interprogram-cut-function
|
||||||
(funcall interprogram-cut-function string)))
|
(funcall interprogram-cut-function string)))
|
||||||
|
|
||||||
|
;; It has been argued that this should work similar to `self-insert-command'
|
||||||
|
;; which merges insertions in undo-list in groups of 20 (hard-coded in cmds.c).
|
||||||
|
(defcustom kill-append-merge-undo nil
|
||||||
|
"Whether appending to kill ring also makes \\[undo] restore both pieces of text simultaneously."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'killing
|
||||||
|
:version "24.5")
|
||||||
|
|
||||||
(defun kill-append (string before-p)
|
(defun kill-append (string before-p)
|
||||||
"Append STRING to the end of the latest kill in the kill ring.
|
"Append STRING to the end of the latest kill in the kill ring.
|
||||||
If BEFORE-P is non-nil, prepend STRING to the kill.
|
If BEFORE-P is non-nil, prepend STRING to the kill.
|
||||||
|
Also removes the last undo boundary in the current buffer,
|
||||||
|
depending on `kill-append-merge-undo'.
|
||||||
If `interprogram-cut-function' is set, pass the resulting kill to it."
|
If `interprogram-cut-function' is set, pass the resulting kill to it."
|
||||||
(let* ((cur (car kill-ring)))
|
(let* ((cur (car kill-ring)))
|
||||||
(kill-new (if before-p (concat string cur) (concat cur string))
|
(kill-new (if before-p (concat string cur) (concat cur string))
|
||||||
(or (= (length cur) 0)
|
(or (= (length cur) 0)
|
||||||
(equal nil (get-text-property 0 'yank-handler cur))))))
|
(equal nil (get-text-property 0 'yank-handler cur))))
|
||||||
|
(when (and kill-append-merge-undo (not buffer-read-only))
|
||||||
|
(let ((prev buffer-undo-list)
|
||||||
|
(next (cdr buffer-undo-list)))
|
||||||
|
;; find the next undo boundary
|
||||||
|
(while (car next)
|
||||||
|
(pop next)
|
||||||
|
(pop prev))
|
||||||
|
;; remove this undo boundary
|
||||||
|
(when prev
|
||||||
|
(setcdr prev (cdr next)))))))
|
||||||
|
|
||||||
(defcustom yank-pop-change-selection nil
|
(defcustom yank-pop-change-selection nil
|
||||||
"Whether rotating the kill ring changes the window system selection.
|
"Whether rotating the kill ring changes the window system selection.
|
||||||
|
Loading…
Reference in New Issue
Block a user