aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorBasil L. Contovounesios2018-04-30 00:58:32 +0100
committerNoam Postavsky2018-05-02 20:20:25 -0400
commit74ff5ade8002a1a2cc8956607310e5466f2ed596 (patch)
tree20f5fd66b677c6e690f145039792df8d71140691 /lisp
parentf2c74543edc7e8d07655b459ba8898eec9b6d4e8 (diff)
downloademacs-74ff5ade8002a1a2cc8956607310e5466f2ed596.tar.gz
emacs-74ff5ade8002a1a2cc8956607310e5466f2ed596.zip
Minor simple.el simplifications (Bug#31211)
* lisp/simple.el (kill-append, push-mark, pop-mark): Simplify conditionals and surrounding code.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el46
1 files changed, 22 insertions, 24 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 9fde9a5c90a..a0a6898e17f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4423,20 +4423,20 @@ If `interprogram-cut-function' is non-nil, call it with the
4423resulting kill. 4423resulting kill.
4424If `kill-append-merge-undo' is non-nil, remove the last undo 4424If `kill-append-merge-undo' is non-nil, remove the last undo
4425boundary in the current buffer." 4425boundary in the current buffer."
4426 (let* ((cur (car kill-ring))) 4426 (let ((cur (car kill-ring)))
4427 (kill-new (if before-p (concat string cur) (concat cur string)) 4427 (kill-new (if before-p (concat string cur) (concat cur string))
4428 (or (= (length cur) 0) 4428 (or (string= cur "")
4429 (equal nil (get-text-property 0 'yank-handler cur)))) 4429 (null (get-text-property 0 'yank-handler cur)))))
4430 (when (and kill-append-merge-undo (not buffer-read-only)) 4430 (when (and kill-append-merge-undo (not buffer-read-only))
4431 (let ((prev buffer-undo-list) 4431 (let ((prev buffer-undo-list)
4432 (next (cdr buffer-undo-list))) 4432 (next (cdr buffer-undo-list)))
4433 ;; find the next undo boundary 4433 ;; Find the next undo boundary.
4434 (while (car next) 4434 (while (car next)
4435 (pop next) 4435 (pop next)
4436 (pop prev)) 4436 (pop prev))
4437 ;; remove this undo boundary 4437 ;; Remove this undo boundary.
4438 (when prev 4438 (when prev
4439 (setcdr prev (cdr next))))))) 4439 (setcdr prev (cdr next))))))
4440 4440
4441(defcustom yank-pop-change-selection nil 4441(defcustom yank-pop-change-selection nil
4442 "Whether rotating the kill ring changes the window system selection. 4442 "Whether rotating the kill ring changes the window system selection.
@@ -5713,19 +5713,17 @@ Novice Emacs Lisp programmers often try to use the mark for the wrong
5713purposes. See the documentation of `set-mark' for more information. 5713purposes. See the documentation of `set-mark' for more information.
5714 5714
5715In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil." 5715In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil."
5716 (unless (null (mark t)) 5716 (when (mark t)
5717 (let ((old (nth mark-ring-max mark-ring)) 5717 (let ((old (nth mark-ring-max mark-ring))
5718 (history-delete-duplicates nil)) 5718 (history-delete-duplicates nil))
5719 (add-to-history 'mark-ring (copy-marker (mark-marker)) mark-ring-max t) 5719 (add-to-history 'mark-ring (copy-marker (mark-marker)) mark-ring-max t)
5720 (when old 5720 (when old
5721 (set-marker old nil)))) 5721 (set-marker old nil))))
5722 (set-marker (mark-marker) (or location (point)) (current-buffer)) 5722 (set-marker (mark-marker) (or location (point)) (current-buffer))
5723 ;; Now push the mark on the global mark ring. 5723 ;; Don't push the mark on the global mark ring if the last global
5724 (if (and global-mark-ring 5724 ;; mark pushed was in this same buffer.
5725 (eq (marker-buffer (car global-mark-ring)) (current-buffer))) 5725 (unless (and global-mark-ring
5726 ;; The last global mark pushed was in this same buffer. 5726 (eq (marker-buffer (car global-mark-ring)) (current-buffer)))
5727 ;; Don't push another one.
5728 nil
5729 (let ((old (nth global-mark-ring-max global-mark-ring)) 5727 (let ((old (nth global-mark-ring-max global-mark-ring))
5730 (history-delete-duplicates nil)) 5728 (history-delete-duplicates nil))
5731 (add-to-history 5729 (add-to-history
@@ -5743,10 +5741,10 @@ In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil."
5743Does not set point. Does nothing if mark ring is empty." 5741Does not set point. Does nothing if mark ring is empty."
5744 (when mark-ring 5742 (when mark-ring
5745 (setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker))))) 5743 (setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker)))))
5746 (set-marker (mark-marker) (+ 0 (car mark-ring)) (current-buffer)) 5744 (set-marker (mark-marker) (car mark-ring))
5747 (move-marker (car mark-ring) nil) 5745 (set-marker (car mark-ring) nil)
5748 (if (null (mark t)) (ding)) 5746 (unless (mark t) (ding))
5749 (setq mark-ring (cdr mark-ring))) 5747 (pop mark-ring))
5750 (deactivate-mark)) 5748 (deactivate-mark))
5751 5749
5752(define-obsolete-function-alias 5750(define-obsolete-function-alias