aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-12-29 01:33:04 +0000
committerRichard M. Stallman2004-12-29 01:33:04 +0000
commita1a801de6aaafa061d304322e9f51a026fe98ed0 (patch)
tree9bfc350790d483a75adb17215d90fdfb234fbb10
parentafb62fddcf8a30e757fcf87b7424a5552cfc9e78 (diff)
downloademacs-a1a801de6aaafa061d304322e9f51a026fe98ed0.tar.gz
emacs-a1a801de6aaafa061d304322e9f51a026fe98ed0.zip
(mark-word): New arg ALLOW-EXTEND
enables the feature to extend the existing region.
-rw-r--r--lisp/simple.el38
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 65a667f482e..f5bc8a40fa6 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1524,17 +1524,33 @@ is not *inside* the region START...END."
1524 '(0 . 0))) 1524 '(0 . 0)))
1525 '(0 . 0))) 1525 '(0 . 0)))
1526 1526
1527(defvar undo-extra-outer-limit nil
1528 "If non-nil, an extra level of size that's ok in an undo item.
1529We don't ask the user about truncating the undo list until the
1530current item gets bigger than this amount.")
1531(make-variable-buffer-local 'undo-extra-outer-limit)
1532
1527;; When the first undo batch in an undo list is longer than undo-outer-limit, 1533;; When the first undo batch in an undo list is longer than undo-outer-limit,
1528;; this function gets called to ask the user what to do. 1534;; this function gets called to ask the user what to do.
1529;; Garbage collection is inhibited around the call, 1535;; Garbage collection is inhibited around the call,
1530;; so it had better not do a lot of consing. 1536;; so it had better not do a lot of consing.
1531(setq undo-outer-limit-function 'undo-outer-limit-truncate) 1537(setq undo-outer-limit-function 'undo-outer-limit-truncate)
1532(defun undo-outer-limit-truncate (size) 1538(defun undo-outer-limit-truncate (size)
1533 (if (let (use-dialog-box) 1539 (when (or (null undo-extra-outer-limit)
1534 (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? " 1540 (> size undo-extra-outer-limit))
1535 (buffer-name) size))) 1541 ;; Don't ask the question again unless it gets even bigger.
1536 (progn (setq buffer-undo-list nil) t) 1542 ;; This applies, in particular, if the user quits from the question.
1537 nil)) 1543 ;; Such a quit quits out of GC, but something else will call GC
1544 ;; again momentarily. It will call this function again,
1545 ;; but we don't want to ask the question again.
1546 (setq undo-extra-outer-limit (+ size 50000))
1547 (if (let (use-dialog-box)
1548 (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? "
1549 (buffer-name) size)))
1550 (progn (setq buffer-undo-list nil)
1551 (setq undo-extra-outer-limit nil)
1552 t)
1553 nil)))
1538 1554
1539(defvar shell-command-history nil 1555(defvar shell-command-history nil
1540 "History list for some commands that read shell commands.") 1556 "History list for some commands that read shell commands.")
@@ -3573,15 +3589,17 @@ With argument, do this that many times."
3573 (interactive "p") 3589 (interactive "p")
3574 (forward-word (- (or arg 1)))) 3590 (forward-word (- (or arg 1))))
3575 3591
3576(defun mark-word (&optional arg) 3592(defun mark-word (&optional arg allow-extend)
3577 "Set mark ARG words away from point. 3593 "Set mark ARG words away from point.
3578The place mark goes is the same place \\[forward-word] would 3594The place mark goes is the same place \\[forward-word] would
3579move to with the same argument. 3595move to with the same argument.
3580If this command is repeated or mark is active in Transient Mark mode, 3596Interactively, if this command is repeated
3597or (in Transient Mark mode) if the mark is active,
3581it marks the next ARG words after the ones already marked." 3598it marks the next ARG words after the ones already marked."
3582 (interactive "P") 3599 (interactive "P\np")
3583 (cond ((or (and (eq last-command this-command) (mark t)) 3600 (cond ((and allow-extend
3584 (and transient-mark-mode mark-active)) 3601 (or (and (eq last-command this-command) (mark t))
3602 (and transient-mark-mode mark-active)))
3585 (setq arg (if arg (prefix-numeric-value arg) 3603 (setq arg (if arg (prefix-numeric-value arg)
3586 (if (< (mark) (point)) -1 1))) 3604 (if (< (mark) (point)) -1 1)))
3587 (set-mark 3605 (set-mark