# HG changeset patch # User Richard M. Stallman # Date 1104283984 0 # Node ID abe8f4f2982cb811d271ff8634524a0094583125 # Parent 5188f5b11d56024a771b5ac888c6c75359e45e11 (mark-word): New arg ALLOW-EXTEND enables the feature to extend the existing region. diff -r 5188f5b11d56 -r abe8f4f2982c lisp/simple.el --- a/lisp/simple.el Wed Dec 29 01:32:06 2004 +0000 +++ b/lisp/simple.el Wed Dec 29 01:33:04 2004 +0000 @@ -1524,17 +1524,33 @@ '(0 . 0))) '(0 . 0))) +(defvar undo-extra-outer-limit nil + "If non-nil, an extra level of size that's ok in an undo item. +We don't ask the user about truncating the undo list until the +current item gets bigger than this amount.") +(make-variable-buffer-local 'undo-extra-outer-limit) + ;; When the first undo batch in an undo list is longer than undo-outer-limit, ;; this function gets called to ask the user what to do. ;; Garbage collection is inhibited around the call, ;; so it had better not do a lot of consing. (setq undo-outer-limit-function 'undo-outer-limit-truncate) (defun undo-outer-limit-truncate (size) - (if (let (use-dialog-box) - (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? " - (buffer-name) size))) - (progn (setq buffer-undo-list nil) t) - nil)) + (when (or (null undo-extra-outer-limit) + (> size undo-extra-outer-limit)) + ;; Don't ask the question again unless it gets even bigger. + ;; This applies, in particular, if the user quits from the question. + ;; Such a quit quits out of GC, but something else will call GC + ;; again momentarily. It will call this function again, + ;; but we don't want to ask the question again. + (setq undo-extra-outer-limit (+ size 50000)) + (if (let (use-dialog-box) + (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? " + (buffer-name) size))) + (progn (setq buffer-undo-list nil) + (setq undo-extra-outer-limit nil) + t) + nil))) (defvar shell-command-history nil "History list for some commands that read shell commands.") @@ -3573,15 +3589,17 @@ (interactive "p") (forward-word (- (or arg 1)))) -(defun mark-word (&optional arg) +(defun mark-word (&optional arg allow-extend) "Set mark ARG words away from point. The place mark goes is the same place \\[forward-word] would move to with the same argument. -If this command is repeated or mark is active in Transient Mark mode, +Interactively, if this command is repeated +or (in Transient Mark mode) if the mark is active, it marks the next ARG words after the ones already marked." - (interactive "P") - (cond ((or (and (eq last-command this-command) (mark t)) - (and transient-mark-mode mark-active)) + (interactive "P\np") + (cond ((and allow-extend + (or (and (eq last-command this-command) (mark t)) + (and transient-mark-mode mark-active))) (setq arg (if arg (prefix-numeric-value arg) (if (< (mark) (point)) -1 1))) (set-mark