aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-11-08 04:43:38 +0800
committerChong Yidong2012-11-08 04:43:38 +0800
commit7d806bfec978fbc99c95797e4f236daa44c44007 (patch)
treeba7db25273d10f41d1a1822a0fbb80d32f446d11
parent8a3afaf9ea1812d8c341ea27744d68441f3ce5a5 (diff)
downloademacs-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/ChangeLog5
-rw-r--r--doc/emacs/display.texi1
-rw-r--r--doc/emacs/emacs.texi1
-rw-r--r--doc/emacs/mini.texi54
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/minibuf-eldef.el20
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 @@
12012-11-07 Chong Yidong <cyd@gnu.org> 12012-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
1500edge. This makes the text easier to read, as wrapping does not occur 1500edge. This makes the text easier to read, as wrapping does not occur
1501in the middle of words. 1501in 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
262The Minibuffer 262The 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
13use the usual Emacs editing commands in the minibuffer to edit the 13use the usual Emacs editing commands in the minibuffer to edit the
14argument text. 14argument 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
18cursor. The minibuffer starts with a @dfn{prompt} in a distinct 32cursor. The minibuffer starts with a @dfn{prompt}, usually ending
19color, usually ending with a colon. The prompt states what kind of 33with a colon. The prompt states what kind of input is expected, and
20input is expected, and how it will be used. 34how 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,
23then @key{RET} to submit the argument and exit the minibuffer. You 38then @key{RET} to submit the argument and exit the minibuffer.
24can cancel the minibuffer, and the command that wants the argument, by 39Alternatively, you can type @kbd{C-g} to exit the minibuffer by
25typing @kbd{C-g}. 40cancelling 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
29parentheses before the colon. This default will be used as the 44parentheses before the colon. This default will be used as the
30argument if you just type @key{RET}. For example, commands that read 45argument if you just type @key{RET}. For example, commands that read
31buffer names usually show a buffer name as the default; you can type 46buffer 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,
54Emacs hides the default argument as soon as you modify the contents of
55the minibuffer (since typing @key{RET} would no longer submit that
56default). If you ever bring back the original minibuffer text, the
57prompt again shows the default. Furthermore, if you change the
58variable @code{minibuffer-eldef-shorten-default} to a non-@code{nil}
59value, the default argument is displayed as @samp{[@var{default}]}
60instead of @samp{(default @var{default})}, saving some screen space.
61To enable this minor mode, type @kbd{M-x
62minibuffer-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
35other uses of the echo area. If an error message or an informative 65other uses of the echo area. If an error message or an informative
36message is emitted while the minibuffer is active, the message hides 66message 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
38the minibuffer comes back. While the minibuffer is in use, keystrokes 68the minibuffer comes back. While the minibuffer is in use, keystrokes
39do not echo. 69do 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
diff --git a/etc/NEWS b/etc/NEWS
index ed69ae3fa6f..cbbe17cfccf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
129next and previous path separator, respectively. 129next 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 [...].
132Just set minibuffer-eldef-shorten-default to t before enabling the mode. 132Just 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.
135It is no longer necessary to call `imagemagick-register-types' 135It is no longer necessary to call `imagemagick-register-types'
136explicitly to install ImageMagick image types; that function is called 136explicitly to install ImageMagick image types; that function is called
137automatically at startup, or when customizing a relevant imagemagick- 137automatically at startup, or when customizing an imagemagick- option.
138option.
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
141ImageMagick to view images. You must call imagemagick-register-types 140ImageMagick 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 @@
12012-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
12012-11-07 Glenn Morris <rgm@gnu.org> 72012-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.
44When `minibuffer-electric-default-mode' is active, these regexps are 56When `minibuffer-electric-default-mode' is active, these regexps are
45used to identify the portions of prompts to elide. 57used to identify the portions of prompts to elide.