From fb5b2591a6b112ee3747d24dceb1797ef770c6e0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 1 Jun 2011 12:52:35 -0300 Subject: [PATCH] * lisp/simple.el (goto-line): Use read-number. (overriding-map-is-bound): Remove. (saved-overriding-map): Change default. (save&set-overriding-map): Rename from ensure-overriding-map-is-bound; Take the map as argument. (universal-argument, negative-argument, digit-argument): Use it. (restore-overriding-map): Adjust. (do-auto-fill): Use fill-forward-paragraph. (keyboard-quit): Don't signal an error when debug-on-quit is non-nil. --- lisp/ChangeLog | 10 ++++++++++ lisp/simple.el | 41 ++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2ec54b36d1d..ac5a6db7508 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,15 @@ 2011-06-01 Stefan Monnier + * simple.el (goto-line): Use read-number. + (overriding-map-is-bound): Remove. + (saved-overriding-map): Change default. + (save&set-overriding-map): Rename from ensure-overriding-map-is-bound; + Take the map as argument. + (universal-argument, negative-argument, digit-argument): Use it. + (restore-overriding-map): Adjust. + (do-auto-fill): Use fill-forward-paragraph. + (keyboard-quit): Don't signal an error when debug-on-quit is non-nil. + * minibuffer.el (minibuffer-inactive-mode-map): New var. (minibuffer-inactive-mode): New major mode. * mouse.el (mouse-drag-region): Remove the "mouse-1 pops up diff --git a/lisp/simple.el b/lisp/simple.el index 18ae1367d74..df32ce8fd08 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -967,13 +967,11 @@ rather than line counts." (concat " in " (buffer-name buffer)) ""))) ;; Read the argument, offering that number (if any) as default. - (list (read-from-minibuffer (format (if default "Goto line%s (%s): " - "Goto line%s: ") - buffer-prompt - default) - nil nil t - 'minibuffer-history - default) + (list (read-number (format (if default "Goto line%s (%s): " + "Goto line%s: ") + buffer-prompt + default) + default) buffer)))) ;; Switch to the desired buffer, one way or another. (if buffer @@ -2815,25 +2813,21 @@ The return value is always nil." `universal-argument-other-key' uses this to discard those events from (this-command-keys), and reread only the final command.") -(defvar overriding-map-is-bound nil - "Non-nil when `overriding-terminal-local-map' is `universal-argument-map'.") - -(defvar saved-overriding-map nil +(defvar saved-overriding-map t "The saved value of `overriding-terminal-local-map'. That variable gets restored to this value on exiting \"universal argument mode\".") -(defun ensure-overriding-map-is-bound () - "Check `overriding-terminal-local-map' is `universal-argument-map'." - (unless overriding-map-is-bound +(defun save&set-overriding-map (map) + "Set `overriding-terminal-local-map' to MAP." + (when (eq saved-overriding-map t) (setq saved-overriding-map overriding-terminal-local-map) - (setq overriding-terminal-local-map universal-argument-map) - (setq overriding-map-is-bound t))) + (setq overriding-terminal-local-map map))) (defun restore-overriding-map () "Restore `overriding-terminal-local-map' to its saved value." (setq overriding-terminal-local-map saved-overriding-map) - (setq overriding-map-is-bound nil)) + (setq saved-overriding-map t)) (defun universal-argument () "Begin a numeric argument for the following command. @@ -2848,7 +2842,7 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." (interactive) (setq prefix-arg (list 4)) (setq universal-argument-num-events (length (this-command-keys))) - (ensure-overriding-map-is-bound)) + (save&set-overriding-map universal-argument-map)) ;; A subsequent C-u means to multiply the factor by 4 if we've typed ;; nothing but C-u's; otherwise it means to terminate the prefix arg. @@ -2873,7 +2867,7 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." (t (setq prefix-arg '-))) (setq universal-argument-num-events (length (this-command-keys))) - (ensure-overriding-map-is-bound)) + (save&set-overriding-map universal-argument-map)) (defun digit-argument (arg) "Part of the numeric argument for the next command. @@ -2892,7 +2886,7 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." (t (setq prefix-arg digit)))) (setq universal-argument-num-events (length (this-command-keys))) - (ensure-overriding-map-is-bound)) + (save&set-overriding-map universal-argument-map)) ;; For backward compatibility, minus with no modifiers is an ordinary ;; command if digits have already been entered. @@ -5177,8 +5171,8 @@ Returns t if it really did any work." (or (null fill-prefix) (string= fill-prefix ""))) (let ((prefix (fill-context-prefix - (save-excursion (backward-paragraph 1) (point)) - (save-excursion (forward-paragraph 1) (point))))) + (save-excursion (fill-forward-paragraph -1) (point)) + (save-excursion (fill-forward-paragraph 1) (point))))) (and prefix (not (equal prefix "")) ;; Use auto-indentation rather than a guessed empty prefix. (not (and fill-indent-according-to-mode @@ -5660,7 +5654,8 @@ At top-level, as an editor command, this simply beeps." (if (fboundp 'kmacro-keyboard-quit) (kmacro-keyboard-quit)) (setq defining-kbd-macro nil) - (signal 'quit nil)) + (let ((debug-on-quit nil)) + (signal 'quit nil))) (defvar buffer-quit-function nil "Function to call to \"quit\" the current buffer, or nil if none.