aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-12-13 03:08:52 +0000
committerJuri Linkov2004-12-13 03:08:52 +0000
commit705a593394ef51c2dc024cac2a2905ee28d57761 (patch)
tree044c5ec006d06e2c8069a6ee7262700b87cacf6c
parent836c086be02471ee541f3943b6d14843518b0d23 (diff)
downloademacs-705a593394ef51c2dc024cac2a2905ee28d57761.tar.gz
emacs-705a593394ef51c2dc024cac2a2905ee28d57761.zip
* simple.el (beginning-of-buffer, end-of-buffer):
Do not push mark when mark is active in transient-mark-mode. * simple.el (mark-word): Extend the region when mark is active in transient-mark-mode, regardless of the last command. Doc fix. * simple.el (mark-word): Preserve direction when repeating. Make arg optional. Interactive "p" -> "P". (transient-mark-mode, inhibit-mark-movement): Doc fix.
-rw-r--r--lisp/simple.el47
1 files changed, 28 insertions, 19 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index c11430c3395..92dc5ad0cb0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -646,7 +646,8 @@ If BACKWARD-ONLY is non-nil, only delete spaces before point."
646 (constrain-to-field nil orig-pos t))))) 646 (constrain-to-field nil orig-pos t)))))
647 647
648(defvar inhibit-mark-movement nil 648(defvar inhibit-mark-movement nil
649 "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.") 649 "If non-nil, movement commands, such as \\[beginning-of-buffer], \
650do not set the mark.")
650 651
651(defun beginning-of-buffer (&optional arg) 652(defun beginning-of-buffer (&optional arg)
652 "Move point to the beginning of the buffer; leave mark at previous position. 653 "Move point to the beginning of the buffer; leave mark at previous position.
@@ -659,8 +660,10 @@ of the accessible part of the buffer.
659Don't use this command in Lisp programs! 660Don't use this command in Lisp programs!
660\(goto-char (point-min)) is faster and avoids clobbering the mark." 661\(goto-char (point-min)) is faster and avoids clobbering the mark."
661 (interactive "P") 662 (interactive "P")
662 (unless (or inhibit-mark-movement (consp arg)) 663 (or inhibit-mark-movement
663 (push-mark)) 664 (consp arg)
665 (and transient-mark-mode mark-active)
666 (push-mark))
664 (let ((size (- (point-max) (point-min)))) 667 (let ((size (- (point-max) (point-min))))
665 (goto-char (if (and arg (not (consp arg))) 668 (goto-char (if (and arg (not (consp arg)))
666 (+ (point-min) 669 (+ (point-min)
@@ -683,8 +686,10 @@ of the accessible part of the buffer.
683Don't use this command in Lisp programs! 686Don't use this command in Lisp programs!
684\(goto-char (point-max)) is faster and avoids clobbering the mark." 687\(goto-char (point-max)) is faster and avoids clobbering the mark."
685 (interactive "P") 688 (interactive "P")
686 (unless (or inhibit-mark-movement (consp arg)) 689 (or inhibit-mark-movement
687 (push-mark)) 690 (consp arg)
691 (and transient-mark-mode mark-active)
692 (push-mark))
688 (let ((size (- (point-max) (point-min)))) 693 (let ((size (- (point-max) (point-min))))
689 (goto-char (if (and arg (not (consp arg))) 694 (goto-char (if (and arg (not (consp arg)))
690 (- (point-max) 695 (- (point-max)
@@ -2987,11 +2992,11 @@ You can also deactivate the mark by typing \\[keyboard-quit] or
2987Many commands change their behavior when Transient Mark mode is in effect 2992Many commands change their behavior when Transient Mark mode is in effect
2988and the mark is active, by acting on the region instead of their usual 2993and the mark is active, by acting on the region instead of their usual
2989default part of the buffer's text. Examples of such commands include 2994default part of the buffer's text. Examples of such commands include
2990\\[comment-dwim], \\[flush-lines], \\[ispell], \\[keep-lines], 2995\\[comment-dwim], \\[flush-lines], \\[keep-lines], \
2991\\[query-replace], \\[query-replace-regexp], and \\[undo]. Invoke 2996\\[query-replace], \\[query-replace-regexp], \\[ispell], and \\[undo].
2992\\[apropos-documentation] and type \"transient\" or \"mark.*active\" at 2997Invoke \\[apropos-documentation] and type \"transient\" or
2993the prompt, to see the documentation of commands which are sensitive to 2998\"mark.*active\" at the prompt, to see the documentation of
2994the Transient Mark mode." 2999commands which are sensitive to the Transient Mark mode."
2995 :global t :group 'editing-basics :require nil) 3000 :global t :group 'editing-basics :require nil)
2996 3001
2997(defun pop-global-mark () 3002(defun pop-global-mark ()
@@ -3523,12 +3528,17 @@ With argument, do this that many times."
3523 (interactive "p") 3528 (interactive "p")
3524 (forward-word (- (or arg 1)))) 3529 (forward-word (- (or arg 1))))
3525 3530
3526(defun mark-word (arg) 3531(defun mark-word (&optional arg)
3527 "Set mark arg words away from point. 3532 "Set mark ARG words away from point.
3528If this command is repeated, it marks the next ARG words after the ones 3533The place mark goes is the same place \\[forward-word] would
3529already marked." 3534move to with the same argument.
3530 (interactive "p") 3535If this command is repeated or mark is active in Transient Mark mode,
3531 (cond ((and (eq last-command this-command) (mark t)) 3536it marks the next ARG words after the ones already marked."
3537 (interactive "P")
3538 (cond ((or (and (eq last-command this-command) (mark t))
3539 (and transient-mark-mode mark-active))
3540 (setq arg (if arg (prefix-numeric-value arg)
3541 (if (< (mark) (point)) -1 1)))
3532 (set-mark 3542 (set-mark
3533 (save-excursion 3543 (save-excursion
3534 (goto-char (mark)) 3544 (goto-char (mark))
@@ -3537,7 +3547,7 @@ already marked."
3537 (t 3547 (t
3538 (push-mark 3548 (push-mark
3539 (save-excursion 3549 (save-excursion
3540 (forward-word arg) 3550 (forward-word (prefix-numeric-value arg))
3541 (point)) 3551 (point))
3542 nil t)))) 3552 nil t))))
3543 3553
@@ -4021,8 +4031,7 @@ or go back to just one window (by deleting all but the selected window)."
4021 (abort-recursive-edit)) 4031 (abort-recursive-edit))
4022 (current-prefix-arg 4032 (current-prefix-arg
4023 nil) 4033 nil)
4024 ((and transient-mark-mode 4034 ((and transient-mark-mode mark-active)
4025 mark-active)
4026 (deactivate-mark)) 4035 (deactivate-mark))
4027 ((> (recursion-depth) 0) 4036 ((> (recursion-depth) 0)
4028 (exit-recursive-edit)) 4037 (exit-recursive-edit))