diff options
| author | Richard M. Stallman | 2004-12-29 01:33:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-12-29 01:33:04 +0000 |
| commit | a1a801de6aaafa061d304322e9f51a026fe98ed0 (patch) | |
| tree | 9bfc350790d483a75adb17215d90fdfb234fbb10 | |
| parent | afb62fddcf8a30e757fcf87b7424a5552cfc9e78 (diff) | |
| download | emacs-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.el | 38 |
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. | ||
| 1529 | We don't ask the user about truncating the undo list until the | ||
| 1530 | current 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. |
| 3578 | The place mark goes is the same place \\[forward-word] would | 3594 | The place mark goes is the same place \\[forward-word] would |
| 3579 | move to with the same argument. | 3595 | move to with the same argument. |
| 3580 | If this command is repeated or mark is active in Transient Mark mode, | 3596 | Interactively, if this command is repeated |
| 3597 | or (in Transient Mark mode) if the mark is active, | ||
| 3581 | it marks the next ARG words after the ones already marked." | 3598 | it 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 |