aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2004-07-16 10:42:00 +0000
committerKim F. Storm2004-07-16 10:42:00 +0000
commita416e7ef563a0a40050b61615dcdb8ae43be641c (patch)
treedecf8f72ae275b4e8f6bec34d35e1e53b5bb3df2
parent62eb6ca914174c2335db53666cd15681ca06cb0c (diff)
downloademacs-a416e7ef563a0a40050b61615dcdb8ae43be641c.tar.gz
emacs-a416e7ef563a0a40050b61615dcdb8ae43be641c.zip
(inhibit-mark-movement): New defvar.
(beginning-of-buffer, end-of-buffer): Do not push mark if inhibit-mark-movement is non-nil or C-u prefix is given.
-rw-r--r--lisp/simple.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 4e7628fe66e..9d61a390575 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -562,9 +562,13 @@ If BACKWARD-ONLY is non-nil, only delete spaces before point."
562 (skip-chars-forward " \t") 562 (skip-chars-forward " \t")
563 (constrain-to-field nil orig-pos t))))) 563 (constrain-to-field nil orig-pos t)))))
564 564
565(defvar inhibit-mark-movement nil
566 "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.")
567
565(defun beginning-of-buffer (&optional arg) 568(defun beginning-of-buffer (&optional arg)
566 "Move point to the beginning of the buffer; leave mark at previous position. 569 "Move point to the beginning of the buffer; leave mark at previous position.
567With arg N, put point N/10 of the way from the beginning. 570With \\[universal-argument] prefix, do not set mark at previous position.
571With numeric arg N, put point N/10 of the way from the beginning.
568 572
569If the buffer is narrowed, this command uses the beginning and size 573If the buffer is narrowed, this command uses the beginning and size
570of the accessible part of the buffer. 574of the accessible part of the buffer.
@@ -572,9 +576,10 @@ of the accessible part of the buffer.
572Don't use this command in Lisp programs! 576Don't use this command in Lisp programs!
573\(goto-char (point-min)) is faster and avoids clobbering the mark." 577\(goto-char (point-min)) is faster and avoids clobbering the mark."
574 (interactive "P") 578 (interactive "P")
575 (push-mark) 579 (unless (or inhibit-mark-movement (consp arg))
580 (push-mark))
576 (let ((size (- (point-max) (point-min)))) 581 (let ((size (- (point-max) (point-min))))
577 (goto-char (if arg 582 (goto-char (if (and arg (not (consp arg)))
578 (+ (point-min) 583 (+ (point-min)
579 (if (> size 10000) 584 (if (> size 10000)
580 ;; Avoid overflow for large buffer sizes! 585 ;; Avoid overflow for large buffer sizes!
@@ -586,7 +591,8 @@ Don't use this command in Lisp programs!
586 591
587(defun end-of-buffer (&optional arg) 592(defun end-of-buffer (&optional arg)
588 "Move point to the end of the buffer; leave mark at previous position. 593 "Move point to the end of the buffer; leave mark at previous position.
589With arg N, put point N/10 of the way from the end. 594With \\[universal-argument] prefix, do not set mark at previous position.
595With numeric arg N, put point N/10 of the way from the end.
590 596
591If the buffer is narrowed, this command uses the beginning and size 597If the buffer is narrowed, this command uses the beginning and size
592of the accessible part of the buffer. 598of the accessible part of the buffer.
@@ -594,9 +600,10 @@ of the accessible part of the buffer.
594Don't use this command in Lisp programs! 600Don't use this command in Lisp programs!
595\(goto-char (point-max)) is faster and avoids clobbering the mark." 601\(goto-char (point-max)) is faster and avoids clobbering the mark."
596 (interactive "P") 602 (interactive "P")
597 (push-mark) 603 (unless (or inhibit-mark-movement (consp arg))
604 (push-mark))
598 (let ((size (- (point-max) (point-min)))) 605 (let ((size (- (point-max) (point-min))))
599 (goto-char (if arg 606 (goto-char (if (and arg (not (consp arg)))
600 (- (point-max) 607 (- (point-max)
601 (if (> size 10000) 608 (if (> size 10000)
602 ;; Avoid overflow for large buffer sizes! 609 ;; Avoid overflow for large buffer sizes!