summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2004-07-16 10:42:00 +0000
committerKim F. Storm <storm@cua.dk>2004-07-16 10:42:00 +0000
commita416e7ef563a0a40050b61615dcdb8ae43be641c (patch)
treedecf8f72ae275b4e8f6bec34d35e1e53b5bb3df2 /lisp/simple.el
parent62eb6ca914174c2335db53666cd15681ca06cb0c (diff)
downloademacs-a416e7ef563a0a40050b61615dcdb8ae43be641c.tar.gz
(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.
Diffstat (limited to 'lisp/simple.el')
-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."
(skip-chars-forward " \t")
(constrain-to-field nil orig-pos t)))))
+(defvar inhibit-mark-movement nil
+ "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.")
+
(defun beginning-of-buffer (&optional arg)
"Move point to the beginning of the buffer; leave mark at previous position.
-With arg N, put point N/10 of the way from the beginning.
+With \\[universal-argument] prefix, do not set mark at previous position.
+With numeric arg N, put point N/10 of the way from the beginning.
If the buffer is narrowed, this command uses the beginning and size
of the accessible part of the buffer.
@@ -572,9 +576,10 @@ of the accessible part of the buffer.
Don't use this command in Lisp programs!
\(goto-char (point-min)) is faster and avoids clobbering the mark."
(interactive "P")
- (push-mark)
+ (unless (or inhibit-mark-movement (consp arg))
+ (push-mark))
(let ((size (- (point-max) (point-min))))
- (goto-char (if arg
+ (goto-char (if (and arg (not (consp arg)))
(+ (point-min)
(if (> size 10000)
;; Avoid overflow for large buffer sizes!
@@ -586,7 +591,8 @@ Don't use this command in Lisp programs!
(defun end-of-buffer (&optional arg)
"Move point to the end of the buffer; leave mark at previous position.
-With arg N, put point N/10 of the way from the end.
+With \\[universal-argument] prefix, do not set mark at previous position.
+With numeric arg N, put point N/10 of the way from the end.
If the buffer is narrowed, this command uses the beginning and size
of the accessible part of the buffer.
@@ -594,9 +600,10 @@ of the accessible part of the buffer.
Don't use this command in Lisp programs!
\(goto-char (point-max)) is faster and avoids clobbering the mark."
(interactive "P")
- (push-mark)
+ (unless (or inhibit-mark-movement (consp arg))
+ (push-mark))
(let ((size (- (point-max) (point-min))))
- (goto-char (if arg
+ (goto-char (if (and arg (not (consp arg)))
(- (point-max)
(if (> size 10000)
;; Avoid overflow for large buffer sizes!