aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-08-26 15:15:02 +0000
committerRichard M. Stallman1996-08-26 15:15:02 +0000
commit2a81150148a10acfb4e722148547695d74ec4257 (patch)
tree6df5c7ba56eb4287fe8d792c69cdcc290635af1c
parentfd20f0150d8211fc83f8a5d57d43cbd3beee17e5 (diff)
downloademacs-2a81150148a10acfb4e722148547695d74ec4257.tar.gz
emacs-2a81150148a10acfb4e722148547695d74ec4257.zip
(ensure-mark): Minor rewrite.
(scroll-down-mark): Handle pc-select-override-scroll-error, (scroll-down-nomark): Likewise. (scroll-up-mark, scroll-up-nomark): Likewise. (pc-selection-mode): Get rid of the advice on scroll-up, scroll-down.
-rw-r--r--lisp/emulation/pc-select.el33
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/emulation/pc-select.el b/lisp/emulation/pc-select.el
index 77a50c5f3c1..a9ca7048243 100644
--- a/lisp/emulation/pc-select.el
+++ b/lisp/emulation/pc-select.el
@@ -108,7 +108,7 @@ and transient-mark-mode."
108(defun ensure-mark() 108(defun ensure-mark()
109 ;; make sure mark is active 109 ;; make sure mark is active
110 ;; test if it is active, if it isn't, set it and activate it 110 ;; test if it is active, if it isn't, set it and activate it
111 (and (not mark-active) (set-mark-command nil))) 111 (or mark-active (set-mark-command nil)))
112 112
113;;;;;;;;;;;;;;;;;;;;;;;;;;; 113;;;;;;;;;;;;;;;;;;;;;;;;;;;
114;;;;; forward and mark 114;;;;; forward and mark
@@ -196,7 +196,10 @@ Negative ARG means scroll upward.
196When calling from a program, supply a number as argument or nil." 196When calling from a program, supply a number as argument or nil."
197 (interactive "P") 197 (interactive "P")
198 (ensure-mark) 198 (ensure-mark)
199 (scroll-down arg)) 199 (cond (pc-select-override-scroll-error
200 (condition-case nil (scroll-down arg)
201 (beginning-of-buffer (goto-char (point-min)))))
202 (t (scroll-down arg))))
200 203
201(defun end-of-buffer-mark (&optional arg) 204(defun end-of-buffer-mark (&optional arg)
202 "Ensure mark is active; move point to the end of the buffer. 205 "Ensure mark is active; move point to the end of the buffer.
@@ -318,7 +321,10 @@ Negative ARG means scroll upward.
318When calling from a program, supply a number as argument or nil." 321When calling from a program, supply a number as argument or nil."
319 (interactive "P") 322 (interactive "P")
320 (setq mark-active nil) 323 (setq mark-active nil)
321 (scroll-down arg)) 324 (cond (pc-select-override-scroll-error
325 (condition-case nil (scroll-down arg)
326 (beginning-of-buffer (goto-char (point-min)))))
327 (t (scroll-down arg))))
322 328
323(defun end-of-buffer-nomark (&optional arg) 329(defun end-of-buffer-nomark (&optional arg)
324 "Deactivate mark; move point to the end of the buffer. 330 "Deactivate mark; move point to the end of the buffer.
@@ -422,7 +428,10 @@ Negative ARG means scroll downward.
422When calling from a program, supply a number as argument or nil." 428When calling from a program, supply a number as argument or nil."
423 (interactive "P") 429 (interactive "P")
424 (ensure-mark) 430 (ensure-mark)
425 (scroll-up arg)) 431 (cond (pc-select-override-scroll-error
432 (condition-case nil (scroll-up arg)
433 (end-of-buffer (goto-char (point-max)))))
434 (t (scroll-up arg))))
426 435
427(defun beginning-of-buffer-mark (&optional arg) 436(defun beginning-of-buffer-mark (&optional arg)
428 "Ensure mark is active; move point to the beginning of the buffer. 437 "Ensure mark is active; move point to the beginning of the buffer.
@@ -508,7 +517,10 @@ Negative ARG means scroll downward.
508When calling from a program, supply a number as argument or nil." 517When calling from a program, supply a number as argument or nil."
509 (interactive "P") 518 (interactive "P")
510 (setq mark-active nil) 519 (setq mark-active nil)
511 (scroll-up arg)) 520 (cond (pc-select-override-scroll-error
521 (condition-case nil (scroll-up arg)
522 (end-of-buffer (goto-char (point-max)))))
523 (t (scroll-up arg))))
512 524
513(defun beginning-of-buffer-nomark (&optional arg) 525(defun beginning-of-buffer-nomark (&optional arg)
514 "Deactivate mark; move point to the beginning of the buffer. 526 "Deactivate mark; move point to the beginning of the buffer.
@@ -673,14 +685,5 @@ In addition, certain other PC bindings are imitated:
673 (setq transient-mark-mode t) 685 (setq transient-mark-mode t)
674 (setq mark-even-if-inactive t) 686 (setq mark-even-if-inactive t)
675 (delete-selection-mode 1) 687 (delete-selection-mode 1)
676 (cond (pc-select-override-scroll-error 688)
677 (defadvice scroll-up (around scroll-to-bottom-if-eob activate)
678 (condition-case nil
679 ad-do-it
680 (end-of-buffer (goto-char (point-max)))))
681 (defadvice scroll-down (around scroll-to-top-if-bob activate)
682 (condition-case nil
683 ad-do-it
684 (beginning-of-buffer (goto-char (point-min))))))))
685
686;;; pc-select.el ends here 689;;; pc-select.el ends here