Merge from gnus--rel--5.10
Patches applied:
* gnus--rel--5.10 (patch 128)
- Update from CVS
2006-09-01 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings):
Use standard-syntax-table.
2006-09-01 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/gnus-art.el (gnus-decode-address-function): New variable.
(article-decode-encoded-words): Use it to decode headers which are
assumed to contain addresses.
(gnus-mime-delete-part): Remove useless `or'.
* lisp/gnus/gnus-sum.el (gnus-decode-encoded-address-function): New variable.
(gnus-summary-from-or-to-or-newsgroups): Use it to decode To header.
(gnus-nov-parse-line): Use it to decode From header.
(gnus-get-newsgroup-headers): Ditto.
(gnus-summary-enter-digest-group): Use it to decode `to-address'.
* lisp/gnus/mail-parse.el (mail-decode-encoded-address-region): New alias.
(mail-decode-encoded-address-string): New alias.
* lisp/gnus/rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings):
New function.
(rfc2047-encode-message-header, rfc2047-encode-region): Use it.
(rfc2047-strip-backslashes-in-quoted-strings): New fnction.
(rfc2047-decode-region): Use it; add optional argument `address-mime'.
(rfc2047-decode-string): Ditto.
(rfc2047-decode-address-region): New function.
(rfc2047-decode-address-string): New function.
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-418
@c This is part of the Emacs manual.@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,@c 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.@c See file emacs.texi for copying conditions.@node Minibuffer, M-x, Basic, Top@chapter The Minibuffer@cindex minibuffer The @dfn{minibuffer} is where Emacs commands read complicatedarguments (anything more a single number). We call it the``minibuffer'' because it's a special-purpose buffer with a smallamount of screen space. Minibuffer arguments can be file names,buffer names, Lisp function names, Emacs command names, Lispexpressions, and many other things---whatever the command wants toread. You can use the usual Emacs editing commands in the minibufferto edit the argument text.@cindex prompt When the minibuffer is in use, it appears in the echo area, with acursor. The minibuffer display starts with a @dfn{prompt} in adistinct color; it says what kind of input is expected and how it willbe used. Often the prompt is derived from the name of the commandthat is reading the argument. The prompt normally ends with a colon.@cindex default argument Sometimes a @dfn{default argument} appears in the prompt, insideparentheses before the colon. The default will be used as theargument value if you just type @key{RET}. For example, commands thatread buffer names show a buffer name as the default. You can type@key{RET} to operate on that default buffer. The simplest way to enter a minibuffer argument is to type the text,then @key{RET} to exit the minibuffer. You can cancel the minibuffer,and the command that wants the argument, by typing @kbd{C-g}. Since the minibuffer appears in the echo area, it can conflict withother uses of the echo area. Here is how Emacs handles suchconflicts:@itemize @bullet@itemAn error occurs while the minibuffer is active.The error message hides the minibuffer for a few seconds, or until youtype something. Then the minibuffer comes back.@itemA command such as @kbd{C-x =} needs to display a message in the echoarea.The message hides the minibuffer for a few seconds, or until you typesomething. Then the minibuffer comes back.@itemKeystrokes don't echo while the minibuffer is in use.@end itemize@menu* File: Minibuffer File. Entering file names with the minibuffer.* Edit: Minibuffer Edit. How to edit in the minibuffer.* Completion:: An abbreviation facility for minibuffer input.* Minibuffer History:: Reusing recent minibuffer arguments.* Repetition:: Re-executing commands that used the minibuffer.@end menu@node Minibuffer File@section Minibuffers for File Names When you use the minibuffer to enter a file name, it starts out withsome initial text---the @dfn{default directory}, ending in a slash.The file you specify will be in this directory unless you alter orreplace it.@c Separate paragraph to clean up ugly page break--rms@need 1500 For example, if the minibuffer starts out with these contents:@exampleFind File: /u2/emacs/src/@end example@noindent(where @samp{Find File:@: } is the prompt), and you type@kbd{buffer.c} as input, that specifies the file@file{/u2/emacs/src/buffer.c}. You can specify the parent directoryby adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, youwill get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use@kbd{M-@key{DEL}} to kill the directory names you don't want(@pxref{Words}). You can kill the entire default with @kbd{C-a C-k}, but there's noneed to do that. It's easier to ignore the default, and enter anabsolute file name starting with a slash or a tilde after the defaultdirectory. For example, to specify @file{/etc/termcap}, just typethat name:@exampleFind File: /u2/emacs/src//etc/termcap@end example@noindent@cindex // in file name@cindex double slash in file name@cindex slashes repeated in file name@findex file-name-shadow-modeGNU Emacs interprets a double slash (which is not normally useful infile names) as, ``ignore everything before the second slash in thepair.'' In the example above. @samp{/u2/emacs/src/} is ignored, soyou get @file{/etc/termcap}. The ignored part of the file name isdimmed if the terminal allows it; to disable this dimming, turn offFile Name Shadow mode (a minor mode) with the command@kbd{M-x file-name-shadow-mode}. If the variable @code{insert-default-directory} is @code{nil}, thedefault directory is never inserted in the minibuffer---so theminibuffer starts out empty. Nonetheless, relative file namearguments are still interpreted based on the same default directory.@node Minibuffer Edit@section Editing in the Minibuffer The minibuffer is an Emacs buffer (albeit a peculiar one), and theusual Emacs commands are available for editing the argument text. Since @key{RET} in the minibuffer is defined to exit the minibuffer,you can't use it to insert a newline in the minibuffer. To do that,type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the@acronym{ASCII} character control-J.) The minibuffer has its own window, which normally has space in theframe at all times, but it only acts like an Emacs window when theminibuffer is active. When active, this window is much like any otherEmacs window; for instance, you can switch to another window (with@kbd{C-x o}), edit text there, then return to the minibuffer window tofinish the argument. You can even kill text in another window, returnto the minibuffer window, and then yank the text into the argument.@xref{Windows}.@cindex height of minibuffer@cindex size of minibuffer@cindex growing minibuffer@cindex resizing minibuffer There are some restrictions on the minibuffer window, however: youcannot kill it, or split it, or switch buffers in it---the minibufferand its window are permanently attached.@vindex resize-mini-windows The minibuffer window expands vertically as necessary to hold thetext that you put in the minibuffer. If @code{resize-mini-windows} is@code{t} (the default), the window always resizes as needed by itscontents. If its value is the symbol @code{grow-only}, the windowgrows automatically as needed, but shrinks (back to the normal size)only when the minibuffer becomes inactive. If its value is@code{nil}, you have to adjust the height yourself.@vindex max-mini-window-height The variable @code{max-mini-window-height} controls the maximumheight for resizing the minibuffer window: a floating-point numberspecifies a fraction of the frame's height; an integer specifies themaximum number of lines; @code{nil} means do not resize the minibufferwindow automatically. The default value is 0.25. The @kbd{C-M-v} command in the minibuffer scrolls the help text fromcommands that display help text of any sort in another window.@kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on thathelp text. This is especially useful with long lists of possiblecompletions. @xref{Other Window}.@vindex enable-recursive-minibuffers Emacs normally disallows most commands that use the minibuffer whilethe minibuffer is active. (Entering the minibuffer from theminibuffer can be confusing.) To allow such commands in theminibuffer, set the variable @code{enable-recursive-minibuffers} to@code{t}.@node Completion@section Completion@cindex completion Some arguments allow @dfn{completion} to enter their value. Thismeans that after you type part of the argument, Emacs can fill in therest, or some of it, based on what you have typed so far. When completion is available, certain keys---@key{TAB}, @key{RET},and @key{SPC}---are rebound to complete the text in the minibufferbefore point into a longer string chosen from a set of @dfn{completionalternatives} provided by the command that requested the argument.(@key{SPC} does not do completion in reading file names, because it iscommon to use spaces in file names on some systems.) @kbd{?} displaysa list of the possible completions at any time. For example, @kbd{M-x} uses the minibuffer to read the name of acommand, so it provides a list of all Emacs command names forcompletion candidates. The completion keys match the minibuffer textagainst these candidates, find any additional name characters impliedby the text already present in the minibuffer, and add thosecharacters. This makes it possible to type @kbd{M-x ins @key{SPC} b@key{RET}} instead of @kbd{M-x insert-buffer @key{RET}}, for example. Case is significant in completion when it is significant in theargument you are entering (buffer names, file names, command names,for instance). Thus, @samp{fo} does not complete to @samp{Foo}.Completion ignores case distinctions for certain arguments in whichcase does not matter. Completion acts only on the text before point. If there is text inthe minibuffer after point---i.e., if you move point backward aftertyping some text into the minibuffer---it remains unchanged.@menu* Example: Completion Example. Examples of using completion.* Commands: Completion Commands. A list of completion commands.* Strict Completion:: Different types of completion.* Options: Completion Options. Options for completion.@end menu@node Completion Example@subsection Completion Example@kindex TAB @r{(completion)} A concrete example may help here. If you type @kbd{M-x au@key{TAB}}, the @key{TAB} looks for alternatives (in this case,command names) that start with @samp{au}. There are several,including @code{auto-fill-mode} and @code{auto-save-mode}, but theyall begin with @code{auto-}, so the @samp{au} in the minibuffercompletes to @samp{auto-}. If you type @key{TAB} again immediately, it cannot determine thenext character; it could be any of @samp{cfilrs}. So it does not addany characters; instead, @key{TAB} displays a list of all possiblecompletions in another window. Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. Theonly command name starting with that is @code{auto-fill-mode}, socompletion fills in the rest of that. You have been able to enter@samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}.@node Completion Commands@subsection Completion Commands Here is a list of the completion commands defined in the minibufferwhen completion is allowed.@table @kbd@item @key{TAB}@findex minibuffer-completeComplete the text before point in the minibuffer as much as possible(@code{minibuffer-complete}).@item @key{SPC}Complete up to one word from the minibuffer text before point(@code{minibuffer-complete-word}). @key{SPC} for completion is notavailable when entering a file name, since file names often includespaces.@item @key{RET}Submit the text in the minibuffer as the argument, possibly completingfirst as described@iftexin the next subsection (@code{minibuffer-complete-and-exit}).@end iftex@ifnottexin the next node (@code{minibuffer-complete-and-exit}). @xref{StrictCompletion}.@end ifnottex@item ?Display a list of possible completions of the text before point(@code{minibuffer-completion-help}).@end table@kindex SPC@findex minibuffer-complete-word @key{SPC} completes like @key{TAB}, but only up to the next hyphenor space. If you have @samp{auto-f} in the minibuffer and type@key{SPC}, it finds that the completion is @samp{auto-fill-mode}, butit only inserts @samp{ill-}, giving @samp{auto-fill-}. Another@key{SPC} at this point completes all the way to@samp{auto-fill-mode}. The command that implements this behavior iscalled @code{minibuffer-complete-word}. When you display a list of possible completions, you can chooseone from it:@table @kbd@findex mouse-choose-completion@item Mouse-1@itemx Mouse-2Clicking mouse button 1 or 2 on a completion possibility chooses thatcompletion (@code{mouse-choose-completion}). You must click in thelist of completions, not in the minibuffer.@findex switch-to-completions@item @key{PRIOR}@itemx M-vTyping @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in theminibuffer, selects the window showing the completion list buffer(@code{switch-to-completions}). This paves the way for using thecommands below. (Selecting that window in other ways has the sameeffect.)@findex choose-completion@item @key{RET}Typing @key{RET} @emph{in the completion list buffer} chooses thecompletion that point is in or next to (@code{choose-completion}). Touse this command, you must first switch to the completion list window.@findex next-completion@item @key{RIGHT}Typing the right-arrow key @key{RIGHT} @emph{in the completion listbuffer} moves point to the following completion possibility(@code{next-completion}).@findex previous-completion@item @key{LEFT}Typing the left-arrow key @key{LEFT} @emph{in the completion listbuffer} moves point to the previous completion possibility(@code{previous-completion}).@end table@node Strict Completion@subsection Strict Completion There are three different ways that @key{RET} can do completion,depending on how the argument will be used.@itemize @bullet@item@dfn{Strict} completion accepts only known completion candidates. Forexample, when @kbd{C-x k} reads the name of a buffer to kill, only thename of an existing buffer makes sense. In strict completion,@key{RET} refuses to exit if the text in the minibuffer does notcomplete to an exact match.@item@dfn{Cautious} completion is similar to strict completion, except that@key{RET} exits only if the text is an already exact match.Otherwise, @key{RET} does not exit, but it does complete the text. Ifthat completes to an exact match, a second @key{RET} will exit.Cautious completion is used for reading file names for files that mustalready exist, for example.@item@dfn{Permissive} completion allows any input; the completioncandidates are just suggestions. For example, when @kbd{C-x C-f}reads the name of a file to visit, any file name is allowed, includingnonexistent file (in case you want to create a file). In permissivecompletion, @key{RET} does not complete, it just submits the argumentas you have entered it.@end itemize The completion commands display a list of all possible completionswhenever they can't determine even one more character by completion.Also, typing @kbd{?} explicitly requests such a list. You can scrollthe list with @kbd{C-M-v} (@pxref{Other Window}).@node Completion Options@subsection Completion Options@vindex completion-ignored-extensions@cindex ignored file names, in completion When completing file names, certain file names are usually ignored.The variable @code{completion-ignored-extensions} contains a list ofstrings; a file name ending in any of those strings is ignored as acompletion candidate. The standard value of this variable has severalelements including @code{".o"}, @code{".elc"}, @code{".dvi"} and@code{"~"}. The effect is that, for example, @samp{foo} can completeto @samp{foo.c} even though @samp{foo.o} exists as well. However, if@emph{all} the possible completions end in ``ignored'' strings, thenthey are not ignored. Displaying a list of possible completionsdisregards @code{completion-ignored-extensions}; it shows them all. If an element of @code{completion-ignored-extensions} ends in aslash (@file{/}), it's a subdirectory name; then that directory andits contents are ignored. Elements of@code{completion-ignored-extensions} which do not end in a slash areordinary file names, and do not apply to names of directories.@vindex completion-auto-help If @code{completion-auto-help} is set to @code{nil}, the completioncommands never display a list of possibilities; you must type @kbd{?}to display the list.@cindex Partial Completion mode@vindex partial-completion-mode@findex partial-completion-mode Partial Completion mode implements a more powerful kind ofcompletion that can complete multiple words in parallel. For example,it can complete the command name abbreviation @code{p-b} into@code{print-buffer} if no other command starts with two words whoseinitials are @samp{p} and @samp{b}. To enable this mode, use @kbd{M-x partial-completion-mode}, orcustomize the variable @code{partial-completion-mode}. This modebinds special partial completion commands to @key{TAB}, @key{SPC},@key{RET}, and @kbd{?} in the minibuffer. The usual completioncommands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}),@kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}. Partial completion of directories in file names uses @samp{*} toindicate the places for completion; thus, @file{/u*/b*/f*} mightcomplete to @file{/usr/bin/foo}. For remote files, partial completionenables completion of methods, user names and host names.@xref{Remote Files}.@vindex PC-include-file-path@vindex PC-disable-includes Partial Completion mode also extends @code{find-file} so that@samp{<@var{include}>} looks for the file named @var{include} in thedirectories in the path @code{PC-include-file-path}. If you set@code{PC-disable-includes} to non-@code{nil}, this feature isdisabled.@cindex Icomplete mode@findex icomplete-mode Icomplete mode presents a constantly-updated display that tells youwhat completions are available for the text you've entered so far. Thecommand to enable or disable this minor mode is @kbd{M-xicomplete-mode}.@node Minibuffer History@section Minibuffer History@cindex minibuffer history@cindex history of minibuffer input Every argument that you enter with the minibuffer is saved on a@dfn{minibuffer history list} so you can easily use it again later.Special commands fetch the text of an earlier argument into theminibuffer, replacing the old minibuffer contents. You can think ofthem as moving through the history of previous arguments.@table @kbd@item @key{UP}@itemx M-pMove to the previous item in the minibuffer history, an earlier argument(@code{previous-history-element}).@item @key{DOWN}@itemx M-nMove to the next item in the minibuffer history(@code{next-history-element}).@item M-r @var{regexp} @key{RET}Move to an earlier item in the minibuffer history that matches @var{regexp} (@code{previous-matching-history-element}).@item M-s @var{regexp} @key{RET}Move to a later item in the minibuffer history that matches@var{regexp} (@code{next-matching-history-element}).@end table@kindex M-p @r{(minibuffer history)}@kindex M-n @r{(minibuffer history)}@findex next-history-element@findex previous-history-element To move through the minibuffer history list one item at a time, use@kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch thenext earlier minibuffer input, and use @kbd{M-n} or down-arrow(@code{next-history-element}) to fetch the next later input. Thesecommands don't move the cursor, they pull different saved strings intothe minibuffer. But you can think of them as ``moving'' through thehistory list. The input that you fetch from the history entirely replaces thecontents of the minibuffer. To use it again unchanged, just type@key{RET}. You can also edit the text before you reuse it; this doesnot change the history element that you ``moved'' to, but your newargument does go at the end of the history list in its own right. For many minibuffer arguments there is a ``default'' value. You caninsert the default value into the minibuffer as text by using@kbd{M-n}. You can think of this as moving ``into the future'' in thehistory.@findex previous-matching-history-element@findex next-matching-history-element@kindex M-r @r{(minibuffer history)}@kindex M-s @r{(minibuffer history)} There are also commands to search forward or backward through thehistory; they search for history elements that match a regularexpression. @kbd{M-r} (@code{previous-matching-history-element})searches older elements in the history, while @kbd{M-s}(@code{next-matching-history-element}) searches newer elements. Thesecommands are unusual; they use the minibuffer to read the regularexpression even though they are invoked from the minibuffer. As withincremental searching, an upper-case letter in the regular expressionmakes the search case-sensitive (@pxref{Search Case}).@ignore We may change the precise way these commands read their arguments.Perhaps they will search for a match for the string given so far in theminibuffer; perhaps they will search for a literal match rather than aregular expression match; perhaps they will only accept matches at thebeginning of a history element; perhaps they will read the string tosearch for incrementally like @kbd{C-s}. To find out what interface isactually available, type @kbd{C-h f previous-matching-history-element}.@end ignore All uses of the minibuffer record your input on a history list, butthere are separate history lists for different kinds of arguments.For example, there is a list for file names, used by all the commandsthat read file names. (As a special feature, this history listrecords the absolute file name, even if the name you entered was notabsolute.) There are several other specific history lists, including one forbuffer names, one for arguments of commands like @code{query-replace},one used by @kbd{M-x} for command names, and one used by@code{compile} for compilation commands. Finally, there is one``miscellaneous'' history list that most minibuffer arguments use.@vindex history-length The variable @code{history-length} specifies the maximum length of aminibuffer history list; adding a new element deletes the oldestelement if the list gets too long. If the value of@code{history-length} is @code{t}, though, there is no maximum length.@vindex history-delete-duplicates The variable @code{history-delete-duplicates} specifies whether todelete duplicates in history. If it is @code{t}, adding a new elementdeletes from the list all other elements that are equal to it.@node Repetition@section Repeating Minibuffer Commands@cindex command history@cindex history of commands Every command that uses the minibuffer once is recorded on a specialhistory list, the @dfn{command history}, together with the values ofits arguments, so that you can repeat the entire command. Inparticular, every use of @kbd{M-x} is recorded there, since @kbd{M-x}uses the minibuffer to read the command name.@findex list-command-history@table @kbd@item C-x @key{ESC} @key{ESC}Re-execute a recent minibuffer command from the command history (@code{repeat-complex-command}).@item M-x list-command-historyDisplay the entire command history, showing all the commands@kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.@end table@kindex C-x ESC ESC@findex repeat-complex-command @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent commandthat used the minibuffer. With no argument, it repeats the last suchcommand. A numeric argument specifies which command to repeat; 1means the last one, 2 the previous, and so on. @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous commandinto a Lisp expression and then entering a minibuffer initialized withthe text for that expression. Even if you don't understand Lispsyntax, it will probably be obvious which command is displayed forrepetition. If you type just @key{RET}, that repeats the commandunchanged. You can also change the command by editing the Lispexpression before you execute it. The repeated command is added tothe front of the command history unless it is identical to the mostrecently item. Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you canuse the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r},@kbd{M-s}; @pxref{Minibuffer History}) to move through the history listof saved entire commands. After finding the desired previous command,you can edit its expression as usual and then repeat it by typing@key{RET}.@vindex isearch-resume-in-command-history Incremental search does not, strictly speaking, use the minibuffer.Therefore, although it behaves like a complex command, it normallydoes not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}.You can make incremental search commands appear in the history bysetting @code{isearch-resume-in-command-history} to a non-@code{nil}value. @xref{Incremental Search}.@vindex command-history The list of previous minibuffer-using commands is stored as a Lisplist in the variable @code{command-history}. Each element is a Lispexpression which describes one command and its arguments. Lisp programscan re-execute a command by calling @code{eval} with the@code{command-history} element.@ignore arch-tag: ba913cfd-b70e-400f-b663-22b2c309227f@end ignore