diff options
| author | Chong Yidong | 2012-11-08 04:43:38 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-11-08 04:43:38 +0800 |
| commit | 7d806bfec978fbc99c95797e4f236daa44c44007 (patch) | |
| tree | ba7db25273d10f41d1a1822a0fbb80d32f446d11 | |
| parent | 8a3afaf9ea1812d8c341ea27744d68441f3ce5a5 (diff) | |
| download | emacs-7d806bfec978fbc99c95797e4f236daa44c44007.tar.gz emacs-7d806bfec978fbc99c95797e4f236daa44c44007.zip | |
Fix and docfix for the minibuffer-eldef-shorten-default feature.
* lisp/minibuf-eldef.el (minibuffer-eldef-shorten-default): Convert to
a defcustom with an appropriate :set function.
(minibuffer-default--in-prompt-regexps): New function.
* doc/emacs/mini.texi (Basic Minibuffer): New node. Document
minibuffer-electric-default-mode.
* doc/emacs/display.texi (Visual Line Mode): Fix index entry.
| -rw-r--r-- | doc/emacs/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/emacs/display.texi | 1 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 1 | ||||
| -rw-r--r-- | doc/emacs/mini.texi | 54 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/minibuf-eldef.el | 20 |
7 files changed, 68 insertions, 24 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 489da459838..5804af2733a 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2012-11-07 Chong Yidong <cyd@gnu.org> | 1 | 2012-11-07 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * mini.texi (Basic Minibuffer): New node. Document | ||
| 4 | minibuffer-electric-default-mode. | ||
| 5 | |||
| 6 | * display.texi (Visual Line Mode): Fix index entry. | ||
| 7 | |||
| 3 | * buffers.texi (Several Buffers): List Buffer Menu command anmes, | 8 | * buffers.texi (Several Buffers): List Buffer Menu command anmes, |
| 4 | and index the keybindings. Document tabulated-list-sort. | 9 | and index the keybindings. Document tabulated-list-sort. |
| 5 | (Kill Buffer): Capitalize Buffer Menu. | 10 | (Kill Buffer): Capitalize Buffer Menu. |
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index c40c545ec53..b6ab4913f9c 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi | |||
| @@ -1500,6 +1500,7 @@ attempts to wrap the line at word boundaries near the right window | |||
| 1500 | edge. This makes the text easier to read, as wrapping does not occur | 1500 | edge. This makes the text easier to read, as wrapping does not occur |
| 1501 | in the middle of words. | 1501 | in the middle of words. |
| 1502 | 1502 | ||
| 1503 | @cindex mode, Visual Line | ||
| 1503 | @cindex Visual Line mode | 1504 | @cindex Visual Line mode |
| 1504 | @findex visual-line-mode | 1505 | @findex visual-line-mode |
| 1505 | @findex global-visual-line-mode | 1506 | @findex global-visual-line-mode |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index e7e0feb9e88..74da3d9587b 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -261,6 +261,7 @@ Basic Editing Commands | |||
| 261 | 261 | ||
| 262 | The Minibuffer | 262 | The Minibuffer |
| 263 | 263 | ||
| 264 | * Basic Minibuffer:: Basic usage of the minibuffer. | ||
| 264 | * Minibuffer File:: Entering file names with the minibuffer. | 265 | * Minibuffer File:: Entering file names with the minibuffer. |
| 265 | * Minibuffer Edit:: How to edit in the minibuffer. | 266 | * Minibuffer Edit:: How to edit in the minibuffer. |
| 266 | * Completion:: An abbreviation facility for minibuffer input. | 267 | * Completion:: An abbreviation facility for minibuffer input. |
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index e5a84bda56d..ebccedacc05 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi | |||
| @@ -13,24 +13,54 @@ special-purpose buffer with a small amount of screen space. You can | |||
| 13 | use the usual Emacs editing commands in the minibuffer to edit the | 13 | use the usual Emacs editing commands in the minibuffer to edit the |
| 14 | argument text. | 14 | argument text. |
| 15 | 15 | ||
| 16 | @menu | ||
| 17 | * Basic Minibuffer:: Basic usage of the minibuffer. | ||
| 18 | * Minibuffer File:: Entering file names with the minibuffer. | ||
| 19 | * Minibuffer Edit:: How to edit in the minibuffer. | ||
| 20 | * Completion:: An abbreviation facility for minibuffer input. | ||
| 21 | * Minibuffer History:: Reusing recent minibuffer arguments. | ||
| 22 | * Repetition:: Re-executing commands that used the minibuffer. | ||
| 23 | * Passwords:: Entering passwords in the echo area. | ||
| 24 | * Yes or No Prompts:: Replying yes or no in the echo area. | ||
| 25 | @end menu | ||
| 26 | |||
| 27 | @node Basic Minibuffer | ||
| 28 | @section Using the Minibuffer | ||
| 29 | |||
| 16 | @cindex prompt | 30 | @cindex prompt |
| 17 | When the minibuffer is in use, it appears in the echo area, with a | 31 | When the minibuffer is in use, it appears in the echo area, with a |
| 18 | cursor. The minibuffer starts with a @dfn{prompt} in a distinct | 32 | cursor. The minibuffer starts with a @dfn{prompt}, usually ending |
| 19 | color, usually ending with a colon. The prompt states what kind of | 33 | with a colon. The prompt states what kind of input is expected, and |
| 20 | input is expected, and how it will be used. | 34 | how it will be used. The prompt is highlighted using the |
| 35 | @code{minibuffer-prompt} face (@pxref{Faces}). | ||
| 21 | 36 | ||
| 22 | The simplest way to enter a minibuffer argument is to type the text, | 37 | The simplest way to enter a minibuffer argument is to type the text, |
| 23 | then @key{RET} to submit the argument and exit the minibuffer. You | 38 | then @key{RET} to submit the argument and exit the minibuffer. |
| 24 | can cancel the minibuffer, and the command that wants the argument, by | 39 | Alternatively, you can type @kbd{C-g} to exit the minibuffer by |
| 25 | typing @kbd{C-g}. | 40 | cancelling the command asking for the argument (@pxref{Quitting}). |
| 26 | 41 | ||
| 27 | @cindex default argument | 42 | @cindex default argument |
| 28 | Sometimes, a @dfn{default argument} appears in the prompt, inside | 43 | Sometimes, the prompt shows a @dfn{default argument}, inside |
| 29 | parentheses before the colon. This default will be used as the | 44 | parentheses before the colon. This default will be used as the |
| 30 | argument if you just type @key{RET}. For example, commands that read | 45 | argument if you just type @key{RET}. For example, commands that read |
| 31 | buffer names usually show a buffer name as the default; you can type | 46 | buffer names usually show a buffer name as the default; you can type |
| 32 | @key{RET} to operate on that default buffer. | 47 | @key{RET} to operate on that default buffer. |
| 33 | 48 | ||
| 49 | @cindex Minibuffer Electric Default mode | ||
| 50 | @cindex mode, Minibuffer Electric Default | ||
| 51 | @findex minibuffer-electric-default-mode | ||
| 52 | @vindex minibuffer-eldef-shorten-default | ||
| 53 | If you enable Minibuffer Electric Default mode, a global minor mode, | ||
| 54 | Emacs hides the default argument as soon as you modify the contents of | ||
| 55 | the minibuffer (since typing @key{RET} would no longer submit that | ||
| 56 | default). If you ever bring back the original minibuffer text, the | ||
| 57 | prompt again shows the default. Furthermore, if you change the | ||
| 58 | variable @code{minibuffer-eldef-shorten-default} to a non-@code{nil} | ||
| 59 | value, the default argument is displayed as @samp{[@var{default}]} | ||
| 60 | instead of @samp{(default @var{default})}, saving some screen space. | ||
| 61 | To enable this minor mode, type @kbd{M-x | ||
| 62 | minibuffer-electric-default-mode}. | ||
| 63 | |||
| 34 | Since the minibuffer appears in the echo area, it can conflict with | 64 | Since the minibuffer appears in the echo area, it can conflict with |
| 35 | other uses of the echo area. If an error message or an informative | 65 | other uses of the echo area. If an error message or an informative |
| 36 | message is emitted while the minibuffer is active, the message hides | 66 | message is emitted while the minibuffer is active, the message hides |
| @@ -38,16 +68,6 @@ the minibuffer for a few seconds, or until you type something; then | |||
| 38 | the minibuffer comes back. While the minibuffer is in use, keystrokes | 68 | the minibuffer comes back. While the minibuffer is in use, keystrokes |
| 39 | do not echo. | 69 | do not echo. |
| 40 | 70 | ||
| 41 | @menu | ||
| 42 | * Minibuffer File:: Entering file names with the minibuffer. | ||
| 43 | * Minibuffer Edit:: How to edit in the minibuffer. | ||
| 44 | * Completion:: An abbreviation facility for minibuffer input. | ||
| 45 | * Minibuffer History:: Reusing recent minibuffer arguments. | ||
| 46 | * Repetition:: Re-executing commands that used the minibuffer. | ||
| 47 | * Passwords:: Entering passwords in the echo area. | ||
| 48 | * Yes or No Prompts:: Replying yes or no in the echo area. | ||
| 49 | @end menu | ||
| 50 | |||
| 51 | @node Minibuffer File | 71 | @node Minibuffer File |
| 52 | @section Minibuffers for File Names | 72 | @section Minibuffers for File Names |
| 53 | 73 | ||
| @@ -127,15 +127,14 @@ autoloads have been redefined as functions). | |||
| 127 | --- | 127 | --- |
| 128 | *** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the | 128 | *** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the |
| 129 | next and previous path separator, respectively. | 129 | next and previous path separator, respectively. |
| 130 | 130 | +++ | |
| 131 | *** minibuffer-electric-default-mode can rewrite (default ...) to [...]. | 131 | *** minibuffer-electric-default-mode can rewrite (default ...) to [...]. |
| 132 | Just set minibuffer-eldef-shorten-default to t before enabling the mode. | 132 | Just set minibuffer-eldef-shorten-default to t before enabling the mode. |
| 133 | 133 | ||
| 134 | ** ImageMagick support, if available, is automatically enabled. | 134 | ** ImageMagick support, if available, is automatically enabled. |
| 135 | It is no longer necessary to call `imagemagick-register-types' | 135 | It is no longer necessary to call `imagemagick-register-types' |
| 136 | explicitly to install ImageMagick image types; that function is called | 136 | explicitly to install ImageMagick image types; that function is called |
| 137 | automatically at startup, or when customizing a relevant imagemagick- | 137 | automatically at startup, or when customizing an imagemagick- option. |
| 138 | option. | ||
| 139 | +++ | 138 | +++ |
| 140 | *** Setting `imagemagick-types-inhibit' to t now disables the use of | 139 | *** Setting `imagemagick-types-inhibit' to t now disables the use of |
| 141 | ImageMagick to view images. You must call imagemagick-register-types | 140 | ImageMagick to view images. You must call imagemagick-register-types |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff9684ad175..98e47dd83d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-11-07 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * minibuf-eldef.el (minibuffer-eldef-shorten-default): Convert to | ||
| 4 | a defcustom with an appropriate :set function. | ||
| 5 | (minibuffer-default--in-prompt-regexps): New function. | ||
| 6 | |||
| 1 | 2012-11-07 Glenn Morris <rgm@gnu.org> | 7 | 2012-11-07 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * emacs-lisp/cl.el (define-setf-expander, defsetf) | 9 | * emacs-lisp/cl.el (define-setf-expander, defsetf) |
diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el index 92d5ec821b0..950c28b227f 100644 --- a/lisp/minibuf-eldef.el +++ b/lisp/minibuf-eldef.el | |||
| @@ -33,13 +33,25 @@ | |||
| 33 | 33 | ||
| 34 | ;;; Code: | 34 | ;;; Code: |
| 35 | 35 | ||
| 36 | (defvar minibuffer-eldef-shorten-default nil | 36 | (defvar minibuffer-eldef-shorten-default) |
| 37 | "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts.") | ||
| 38 | 37 | ||
| 39 | (defvar minibuffer-default-in-prompt-regexps | 38 | (defun minibuffer-default--in-prompt-regexps () |
| 40 | `(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'" | 39 | `(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'" |
| 41 | 1 ,(if minibuffer-eldef-shorten-default " [\\2]")) | 40 | 1 ,(if minibuffer-eldef-shorten-default " [\\2]")) |
| 42 | ("\\( \\[.*\\]\\):? *\\'" 1)) | 41 | ("\\( \\[.*\\]\\):? *\\'" 1))) |
| 42 | |||
| 43 | (defcustom minibuffer-eldef-shorten-default nil | ||
| 44 | "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts." | ||
| 45 | :set (lambda (symbol value) | ||
| 46 | (set-default symbol value) | ||
| 47 | (setq-default minibuffer-default-in-prompt-regexps | ||
| 48 | (minibuffer-default--in-prompt-regexps))) | ||
| 49 | :type 'boolean | ||
| 50 | :group 'minibuffer | ||
| 51 | :version "24.3") | ||
| 52 | |||
| 53 | (defvar minibuffer-default-in-prompt-regexps | ||
| 54 | (minibuffer-default--in-prompt-regexps) | ||
| 43 | "A list of regexps matching the parts of minibuffer prompts showing defaults. | 55 | "A list of regexps matching the parts of minibuffer prompts showing defaults. |
| 44 | When `minibuffer-electric-default-mode' is active, these regexps are | 56 | When `minibuffer-electric-default-mode' is active, these regexps are |
| 45 | used to identify the portions of prompts to elide. | 57 | used to identify the portions of prompts to elide. |