diff options
Diffstat (limited to 'doc')
51 files changed, 3306 insertions, 2426 deletions
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi index 23d7e28f4e3..695ffa8d1cd 100644 --- a/doc/emacs/abbrevs.texi +++ b/doc/emacs/abbrevs.texi @@ -407,7 +407,7 @@ you are expanding. in this search; if it is @code{nil}, the word and the expansion must match in case. If the value is @code{case-fold-search} (the default), then the variable @code{case-fold-search} controls whether to ignore -case while searching for expansions (@pxref{Search Case}). +case while searching for expansions (@pxref{Lax Search}). @vindex dabbrev-case-replace Normally, dynamic abbrev expansion preserves the case pattern @@ -421,7 +421,7 @@ the dynamic abbrev's case pattern is preserved in most cases; if it is @code{nil}, the expansion is always copied verbatim. If the value is @code{case-replace} (the default), then the variable @code{case-replace} controls whether to copy the expansion verbatim -(@pxref{Replacement and Case}). +(@pxref{Replacement and Lax Matches}). However, if the expansion contains a complex mixed case pattern, and the dynamic abbrev matches this pattern as far as it goes, then the diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 1c88e97a659..4d53456d0f0 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -64,6 +64,10 @@ point vertically fixed by scrolling the window when moving up and down in the buffer. @item +AurĂ©lien Aptel added dynamic module support to Emacs. Philipp +Stephani and others also worked on the dynamic module code. + +@item Joe Arceneaux wrote the original text property implementation, and implemented support for X11. diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 5a4d1abfc39..ae64fefbb70 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -703,5 +703,6 @@ C-b}. To customize this buffer list, use the @code{bs} Custom group MSB global minor mode (``MSB'' stands for ``mouse select buffer'') provides a different and customizable mouse buffer menu which you may prefer. It replaces the bindings of @code{mouse-buffer-menu}, -normally on @kbd{C-Down-Mouse-1}, and the menu bar buffer menu. You -can customize the menu in the @code{msb} Custom group. +normally on @kbd{C-Down-Mouse-1} and @kbd{C-@key{F10}}, and the menu +bar buffer menu. You can customize the menu in the @code{msb} Custom +group. diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 8441c889bbf..fc405e3a147 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -403,6 +403,8 @@ customizations in your initialization file. This is because saving customizations from such a session would wipe out all the other customizations you might have on your initialization file. +@cindex unsaved customizations, reminder to save +@findex custom-prompt-customize-unsaved-options Please note that any customizations you have not chosen to save for future sessions will be lost when you terminate Emacs. If you'd like to be prompted about unsaved customizations at termination time, add @@ -1131,6 +1133,12 @@ won't confuse other programs that the file is intended for. The example above is for the C programming language, where comments start with @samp{/*} and end with @samp{*/}. +If some unrelated text might look to Emacs as a local variables list, +you can countermand that by inserting a form-feed character (a page +delimiter, @pxref{Pages}) after that text. Emacs only looks for +file-local variables in the last page of a file, after the last page +delimiter. + @findex add-file-local-variable @findex delete-file-local-variable @findex copy-dir-locals-to-file-locals diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 27bb77d5cac..0030467cdce 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -188,6 +188,7 @@ Advanced Features * Sending Mail:: Sending mail in Emacs. * Rmail:: Reading mail in Emacs. * Gnus:: A flexible mail and news reader. +* Host Security:: Security issues on a single computer. * Network Security:: Managing the network security. * Document View:: Viewing PDF, PS and DVI files. * EWW:: A web browser in Emacs. @@ -392,18 +393,20 @@ Searching and Replacement * Regexps:: Syntax of regular expressions. * Regexp Backslash:: Regular expression constructs starting with `\'. * Regexp Example:: A complex regular expression explained. -* Search Case:: To ignore case while searching, or not. +* Lax Search:: Search ignores some distinctions between + similar characters, like letter-case. * Replace:: Search, and replace some or all matches. * Other Repeating Search:: Operating on all matches for some regexp. +* Search Customizations:: Various search customizations. Incremental Search * Basic Isearch:: Basic incremental search commands. * Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. * Isearch Yank:: Commands that grab text into the search string or else edit the search string. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. * Not Exiting Isearch:: Prefix argument and scrolling commands. * Isearch Minibuffer:: Incremental search of the minibuffer history. @@ -411,7 +414,8 @@ Replacement Commands * Unconditional Replace:: Replacing all matches for a string. * Regexp Replace:: Replacing all matches for a regexp. -* Replacement and Case:: How replacements preserve case of letters. +* Replacement and Lax Matches:: + Lax searching for text to replace. * Query Replace:: How to use querying. Commands for Fixing Typos @@ -534,6 +538,7 @@ Frames and Graphical Displays * Multiple Displays:: How one Emacs instance can talk to several displays. * Frame Parameters:: Changing the colors and other modes of frames. * Scroll Bars:: How to enable and disable scroll bars; how to use them. +* Window Dividers:: Window separators that can be dragged with the mouse. * Drag and Drop:: Using drag and drop to open files and insert text. * Menu Bars:: Enabling and disabling the menu bar. * Tool Bars:: Enabling and disabling the tool bar. @@ -589,6 +594,7 @@ Commands for Human Languages * Sentences:: Moving over and killing sentences. * Paragraphs:: Moving over paragraphs. * Pages:: Moving over pages. +* Quotation Marks:: Inserting quotation marks. * Filling:: Filling or justifying text. * Case:: Changing the case of text. * Text Mode:: The major modes for editing text files. @@ -1164,6 +1170,11 @@ Reporting Bugs * Checklist:: Steps to follow for a good bug report. * Sending Patches:: How to send a patch for GNU Emacs. +Contributing to Emacs Development + +* Coding Standards:: Gnu Emacs coding standards. +* Copyright Assignment:: Assigning copyright to the FSF. + Command Line Arguments for Emacs Invocation * Action Arguments:: Arguments to visit files, load libraries, diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 5752d02fe85..4f7596e058c 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1295,11 +1295,12 @@ would make to the file if you save the buffer. @findex compare-windows The command @kbd{M-x compare-windows} compares the text in the -current window with that in the next window. (For more information -about windows in Emacs, @ref{Windows}.) Comparison starts at point in -each window, after pushing each initial point value on the mark ring -in its respective buffer. Then it moves point forward in each window, -one character at a time, until it reaches characters that don't match. +current window with that in the window that was the selected window +before you selected the current one. (For more information about +windows in Emacs, @ref{Windows}.) Comparison starts at point in each +window, after pushing each initial point value on the mark ring in its +respective buffer. Then it moves point forward in each window, one +character at a time, until it reaches characters that don't match. Then the command exits. If point in the two windows is followed by non-matching text when diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 95b721fa739..acfdfe25cb2 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1265,10 +1265,11 @@ Some text terminals support mouse clicks in the terminal window. In a terminal emulator which is compatible with @command{xterm}, you can use @kbd{M-x xterm-mouse-mode} to give Emacs control over simple uses of the mouse---basically, only non-modified single clicks are -supported. The normal @command{xterm} mouse functionality for such -clicks is still available by holding down the @kbd{SHIFT} key when you -press the mouse button. Xterm Mouse mode is a global minor mode -(@pxref{Minor Modes}). Repeating the command turns the mode off +supported. Newer versions of @command{xterm} also support +mouse-tracking. The normal @command{xterm} mouse functionality for +such clicks is still available by holding down the @kbd{SHIFT} key +when you press the mouse button. Xterm Mouse mode is a global minor +mode (@pxref{Minor Modes}). Repeating the command turns the mode off again. @findex gpm-mouse-mode diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index e66cd79e740..cc81101d67a 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -175,11 +175,22 @@ corresponding Control character. @xref{User Input,C-M-}. Case conversion means changing text from upper case to lower case or vice versa. @xref{Case}. +@item Case Folding +Case folding means ignoring the differences between case variants of +the same letter: upper-case, lower-case, and title-case. Emacs +performs case folding by default in text search. @xref{Lax Search}. + @item Character Characters form the contents of an Emacs buffer. Also, key sequences (q.v.@:) are usually made up of characters (though they may include other input events as well). @xref{User Input}. +@item Character Folding +Character folding means ignoring differences between similarly looking +characters, such as between @code{a}, and @code{@:a} and @code{@'a}. +Emacs performs character folding by default in text search. @xref{Lax +Search}. + @item Character Set Emacs supports a number of character sets, each of which represents a particular alphabet or script. @xref{International}. diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index a9c63b91785..25e783f6ed7 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -126,6 +126,10 @@ Display documentation of the current major mode and minor modes (@code{describe-mode}). @item C-h n Display news of recent Emacs changes (@code{view-emacs-news}). +@item C-h o @var{symbol} +Display documentation of the Lisp symbol named @var{symbol} +(@code{describe-symbol}). This will show the documentation of all +kinds of symbols: functions, variables, and faces. @item C-h p Find packages by topic keyword (@code{finder-by-keyword}). This lists packages using a package menu buffer. @xref{Packages}. @@ -272,6 +276,14 @@ source files installed (@pxref{Hyperlinking}). (@code{Info-goto-emacs-command-node}). This knows about various manuals, not just the Emacs manual, and finds the right one. +@kindex C-h o +@findex describe-symbol + @kbd{C-h o} (@code{describe-symbol}) is like @kbd{C-h f} and +@kbd{C-h v}, but it describes any symbol, be it a function, a +variable, or a face. If the symbol has more than one definition, like +it has both definition as a function and as a variable, this command +will show the documentation of all of them, one after the other. + @node Apropos @section Apropos @cindex apropos @@ -524,8 +536,9 @@ command works depend on the major mode. @findex view-lossage If something surprising happens, and you are not sure what you typed, use @kbd{C-h l} (@code{view-lossage}). @kbd{C-h l} displays your last -300 input keystrokes. If you see commands that you don't know, you can -use @kbd{C-h c} to find out what they do. +300 input keystrokes and the commands they invoked. If you see +commands that you are not familiar with, you can use @kbd{C-h k} or +@kbd{C-h f} to find out what they do. @kindex C-h e @findex view-echo-area-messages diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index d453647b0c5..9761ac7d11c 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi @@ -504,9 +504,9 @@ does not alter the clipboard. However, if you change @code{yank-pop-change-selection} to @code{t}, then @kbd{M-y} saves the new yank to the clipboard. -@vindex x-select-enable-clipboard +@vindex select-enable-clipboard To prevent kill and yank commands from accessing the clipboard, -change the variable @code{x-select-enable-clipboard} to @code{nil}. +change the variable @code{select-enable-clipboard} to @code{nil}. @cindex clipboard manager @vindex x-select-enable-clipboard-manager @@ -519,14 +519,14 @@ when exiting Emacs; if you wish to prevent Emacs from transferring data to the clipboard manager, change the variable @code{x-select-enable-clipboard-manager} to @code{nil}. -@vindex x-select-enable-primary +@vindex select-enable-primary @findex clipboard-kill-region @findex clipboard-kill-ring-save @findex clipboard-yank Prior to Emacs 24, the kill and yank commands used the primary selection (@pxref{Primary Selection}), not the clipboard. If you -prefer this behavior, change @code{x-select-enable-clipboard} to -@code{nil}, @code{x-select-enable-primary} to @code{t}, and +prefer this behavior, change @code{select-enable-clipboard} to +@code{nil}, @code{select-enable-primary} to @code{t}, and @code{mouse-drag-copy-region} to @code{t}. In this case, you can use the following commands to act explicitly on the clipboard: @code{clipboard-kill-region} kills the region and saves it to the @@ -853,6 +853,19 @@ so in a rectangular fashion, and killing and yanking operate on the rectangle. @xref{Killing}. The mode persists only as long as the region is active. +Unlike the standard region, the region-rectangle can have its corners +extended past the end of buffer, or inside stretches of white space +that point normally cannot enter, like the TAB. + +@findex rectangle-exchange-point-and-mark +@findex exchange-point-and-mark@r{, in rectangle-mark-mode} +@kindex C-x C-x@r{, in rectangle-mark-mode} +When the region is in rectangle-mark-mode, @kbd{C-x C-x} runs the +command @code{rectangle-exchange-point-and-mark}, which cycles between +the four corners of the region-rectangle. This comes in handy if you +want to modify the dimensions of the region-rectangle before invoking +an operation on the marked text. + @node CUA Bindings @section CUA Bindings @findex cua-mode diff --git a/doc/emacs/m-x.texi b/doc/emacs/m-x.texi index c9ae559f984..795d6fe373b 100644 --- a/doc/emacs/m-x.texi +++ b/doc/emacs/m-x.texi @@ -43,6 +43,13 @@ Note that @code{forward-char} is the same command that you invoke with the key @kbd{C-f}. The existence of a key binding does not stop you from running the command by name. +@cindex obsolete command + When @kbd{M-x} completes on commands, it ignores the commands that +are declared @dfn{obsolete}; for these, you will have to type their +full name. Obsolete commands are those for which newer, better +alternatives exist, and which are slated for removal in some future +Emacs release. + To cancel the @kbd{M-x} and not run a command, type @kbd{C-g} instead of entering the command name. This takes you back to command level. @@ -57,7 +64,16 @@ mentions this in the echo area after running the command. For example, if you type @kbd{M-x forward-word}, the message says that you can run the same command by typing @kbd{M-f}. You can turn off these messages by setting the variable @code{suggest-key-bindings} to -@code{nil}. +@code{nil}. The value of @code{suggest-key-bindings} can also be a +number, in which case Emacs will show the binding for that many +seconds before removing it from display. The default behavior is to +display the binding for 2 seconds. + + Commands that don't have key bindings, can still be invoked after +typing less than their full name at the @samp{M-x} prompt. Emacs +mentions such shorthands in the echo area if they are significantly +shorter than the full command name. The setting of +@code{suggest-key-bindings} affects these hints as well. In this manual, when we speak of running a command by name, we often omit the @key{RET} that terminates the name. Thus we might say diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index a571ea7ed67..801d147845b 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -47,6 +47,17 @@ variable @code{vc-handled-backends} to @code{nil} (@pxref{Customizing VC}). @end ifnottex +@findex vc-refresh-state +@findex vc-state-refresh + To update the VC state information for the file visited in the +current buffer, use the command @code{vc-refresh-state}. This command +is useful when you perform version control commands outside Emacs +(e.g., from the shell prompt), or if you put the buffer's file under a +different version control system, or remove it from version control +entirely. A companion command @code{vc-state-refresh} does the same, +but does not consider switching the version control system or removal +from VC. + @menu * Introduction to VC:: How version control works in general. * VC Mode Line:: How the mode line shows version control status. @@ -821,15 +832,19 @@ corresponding to @var{revision}, saves it to window. @findex vc-annotate +@vindex vc-annotate-background-mode @kindex C-x v g Many version control systems allow you to view files @dfn{annotated} with per-line revision information, by typing @kbd{C-x v g} (@code{vc-annotate}). This creates a new ``annotate'' buffer -displaying the file's text, with each line colored to show -how old it is. Red text is new, blue is old, and intermediate colors -indicate intermediate ages. By default, the color is scaled over the -full range of ages, such that the oldest changes are blue, and the -newest changes are red. +displaying the file's text, with each line colored to show how old it +is. Red text is new, blue is old, and intermediate colors indicate +intermediate ages. By default, the color is scaled over the full +range of ages, such that the oldest changes are blue, and the newest +changes are red. If the variable @code{vc-annotate-background-mode} +is non-@code{nil}, the colors expressing the age of each line are +applied to the background color, leaving the foreground at its default +color. When you give a prefix argument to this command, Emacs reads two arguments using the minibuffer: the revision to display and annotate @@ -1009,6 +1024,22 @@ increase the number of revisions shown in an existing entries} or @samp{Show unlimited entries} buttons at the end of the buffer. However, RCS, SCCS, and CVS do not support this feature. +@findex vc-region-history +A useful variant of examining changes is provided by the command +@kbd{vc-region-history}, which shows a @file{*VC-history*} buffer with +the history of changes to the region of the current file between point +and the mark (@pxref{Mark}). The history of changes includes the +commit log messages and also the changes themselves in the Diff +format. + +Invoke this command after marking the region of the current file in +whose changes you are interested. In the @file{*VC-history*} buffer +it pops up, you can use all of the commands available in the +@file{*vc-change-log*} buffer described above, and also the commands +defined by Diff mode (@pxref{Diff Mode}). + +This command is currently available only with Git. + @node VC Undo @subsection Undoing Version Control Actions @@ -1353,19 +1384,43 @@ commit will be committed to that specific branch. @subsubsection Pulling/Pushing Changes into/from a Branch @table @kbd +@item C-x v P +On a decentralized version control system, update another location +with changes from the current branch (a.k.a. ``push'' changes). This +concept does not exist for centralized version control systems + @item C-x v + On a decentralized version control system, update the current branch by ``pulling in'' changes from another location. On a centralized version control system, update the current VC fileset. - -@item C-x v P -On a decentralized version control system, ``push'' changes from the -current branch to another location. This concept does not exist -for centralized version control systems. @end table +@kindex C-x v P +@findex vc-push +On a decentralized version control system, the command @kbd{C-x v P} +(@code{vc-push}) updates another location with changes from the +current branch. With a prefix argument, it prompts for the exact +version control command to run, which lets you specify where to push +changes; the default is @command{bzr push} with Bazaar, @command{git +push} with Git, and @command{hg push} with Mercurial. The default +commands always push to a default location determined by the version +control system from your branch configuration. + +Prior to pushing, you can use @kbd{C-x v O} (@code{vc-log-outgoing}) +to view a log buffer of the changes to be sent. @xref{VC Change Log}. + +@cindex bound branch (Bazaar VCS) +This command is currently supported only by Bazaar, Git, and Mercurial. +The concept of ``pushing'' does not exist for centralized version +control systems, where this operation is a part of committing a +changeset, so invoking this command on a centralized VCS signals an +error. This command also signals an error when attempted in a Bazaar +@dfn{bound branch}, where committing a changeset automatically pushes +the changes to the remote repository to which the local branch is +bound. + @kindex C-x v + @findex vc-pull On a decentralized version control system, the command @kbd{C-x v +} @@ -1377,12 +1432,12 @@ Otherwise, it pulls from a default location determined by the version control system. Amongst decentralized version control systems, @kbd{C-x v +} is -currently supported only by Bazaar, Git, and Mercurial. On Bazaar, it -calls @command{bzr pull} for ordinary branches (to pull from a master -branch into a mirroring branch), and @command{bzr update} for a bound -branch (to pull from a central repository). On Git, it calls +currently supported only by Bazaar, Git, and Mercurial. With Bazaar, +it calls @command{bzr pull} for ordinary branches (to pull from a +master branch into a mirroring branch), and @command{bzr update} for a +bound branch (to pull from a central repository). With Git, it calls @command{git pull} to fetch changes from a remote repository and merge -it into the current branch. On Mercurial, it calls @command{hg pull +it into the current branch. With Mercurial, it calls @command{hg pull -u} to fetch changesets from the default remote repository and update the working directory. @@ -1393,21 +1448,6 @@ Log}. On a centralized version control system like CVS, @kbd{C-x v +} updates the current VC fileset from the repository. -@kindex C-x v P -@findex vc-push - On a decentralized version control system, the command @kbd{C-x v P} -(@code{vc-push}) sends changes from your current branch to another location. -With a prefix argument, the command prompts for the exact -version control command to use, which lets you specify where to push -changes. Otherwise, it pushes to a default location determined -by the version control system. - - Prior to pushing, you can use @kbd{C-x v O} (@code{vc-log-outgoing}) -to view a log buffer of the changes to be sent. @xref{VC Change Log}. - -This command is currently supported only by Bazaar, Git, and Mercurial. -It signals an error for centralized version control systems. - @node Merging @subsubsection Merging Branches @cindex merging changes @@ -2285,7 +2325,7 @@ input. @xref{Query Replace}, for more information on query replace. You can control the case-sensitivity of tags search commands by customizing the value of the variable @code{tags-case-fold-search}. The default is to use the same setting as the value of -@code{case-fold-search} (@pxref{Search Case}). +@code{case-fold-search} (@pxref{Lax Search}). It is possible to get through all the files in the tags table with a single invocation of @kbd{M-x tags-query-replace}. But often it is diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 2493fdadf37..869e06424ad 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -588,13 +588,17 @@ argument into the minibuffer: @table @kbd @item M-p -@itemx @key{UP} Move to the previous item in the minibuffer history, an earlier argument (@code{previous-history-element}). @item M-n -@itemx @key{DOWN} Move to the next item in the minibuffer history (@code{next-history-element}). +@item @key{UP} +@itemx @key{DOWN} +Like @kbd{M-p} and @kbd{M-n}, but move to the previous or next line of +a multi-line item before going to the previous history item +(@code{previous-line-or-history-element} and +@code{next-line-or-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}). @@ -609,13 +613,13 @@ Move to a later item in the minibuffer history that matches @kindex DOWN @r{(minibuffer history)} @findex next-history-element @findex previous-history-element - While in the minibuffer, @kbd{M-p} or @key{UP} -(@code{previous-history-element}) moves through the minibuffer history -list, one item at a time. Each @kbd{M-p} fetches an earlier item from -the history list into the minibuffer, replacing its existing contents. -Typing @kbd{M-n} or @key{DOWN} (@code{next-history-element}) moves -through the minibuffer history list in the opposite direction, -fetching later entries into the minibuffer. + While in the minibuffer, @kbd{M-p} (@code{previous-history-element}) +moves through the minibuffer history list, one item at a time. Each +@kbd{M-p} fetches an earlier item from the history list into the +minibuffer, replacing its existing contents. Typing @kbd{M-n} +(@code{next-history-element}) moves through the minibuffer history +list in the opposite direction, fetching later entries into the +minibuffer. If you type @kbd{M-n} in the minibuffer when there are no later entries in the minibuffer history (e.g., if you haven't previously @@ -623,6 +627,14 @@ typed @kbd{M-p}), Emacs tries fetching from a list of default arguments: values that you are likely to enter. You can think of this as moving through the ``future history''. +@findex previous-line-or-history-element +@findex next-line-or-history-element + The arrow keys @kbd{@key{UP}} and @kbd{@key{DOWN}} work like +@kbd{M-p} and @kbd{M-n}, but if the current history item is longer +than a single line, they allow you to move to the previous or next +line of the current history item before going to the previous or next +history item. + If you edit the text inserted by the @kbd{M-p} or @kbd{M-n} minibuffer history commands, this does not change its entry in the history list. However, the edited argument does go at the end of the @@ -642,8 +654,8 @@ expressions. A numeric prefix argument @var{n} means to fetch the @var{n}th matching entry. These commands are unusual, in that they use the minibuffer to read the regular expression argument, even though they are invoked from the minibuffer. An upper-case letter in -the regular expression makes the search case-sensitive (@pxref{Search -Case}). +the regular expression makes the search case-sensitive (@pxref{Lax +Search}). You can also search through the history using an incremental search. @xref{Isearch Minibuffer}. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 7fad8268d06..41dce521c0a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -6,7 +6,8 @@ @chapter Miscellaneous Commands This chapter contains several brief topics that do not fit anywhere -else: reading Usenet news, viewing PDFs and other such documents, web +else: reading Usenet news, host and network security, +viewing PDFs and other such documents, web browsing, running shell commands and shell subprocesses, using a single shared Emacs for utilities that expect to run an editor as a subprocess, printing, sorting text, editing binary files, saving an @@ -249,6 +250,25 @@ Search forward for articles containing a match for @var{regexp}. Exit the summary buffer and return to the group buffer. @end table +@node Host Security +@section Host Security +@cindex security + +Emacs runs inside an operating system such as GNU/Linux, and relies on +the operating system to check security constraints such as accesses to +files. The default settings for Emacs are designed for typical use; +they may require some tailoring in environments where security is more +of a concern, or less of a concern, than usual. For example, +file-local variables can be risky, and you can set the variable +@code{enable-local-variables} to @code{:safe} or (even more +conservatively) to @code{nil}; conversely, if your files can all be +trusted and the default checking for these variables is irritating, +you can set @code{enable-local-variables} to @code{:all}. @xref{Safe +File Variables}. + +@xref{Security Considerations,,, elisp, The Emacs Lisp Reference +Manual}, for more information about security considerations when using +Emacs as part of a larger application. @node Network Security @section Network Security @@ -741,6 +761,10 @@ advancing point, and any terminal input for the subshell comes from text in the buffer. To give input to the subshell, go to the end of the buffer and type the input, terminated by @key{RET}. + By default, when the subshell is invoked interactively, the +@file{*shell*} buffer is displayed in a new window. This behavior can +be customized via @code{display-buffer-alist} (@pxref{Window Choice}). + While the subshell is waiting or running a command, you can switch windows or buffers and perform other editing in Emacs. Emacs inserts the output from the subshell into the Shell buffer whenever it has diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 1a6a735d3ae..5f80b0afe3f 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -59,7 +59,12 @@ The package's version number (e.g., @samp{11.86}). The package's status---normally one of @samp{available} (can be downloaded from the package archive), @samp{installed}, @c @samp{unsigned} (installed, but not signed; @pxref{Package Signing}), -or @samp{built-in} (included in Emacs by default). +or @samp{built-in} (included in Emacs by default). The status +@samp{external} means the package is not built-in and not from the +directory specified by @code{package-user-dir} (@pxref{Package +Files}). External packages are treated much like built-in: they +cannot be deleted through the package menu, and are not considered for +upgrading. The status can also be @samp{new}. This is equivalent to @samp{available}, except that it means the package became newly @@ -106,7 +111,13 @@ line; typing @kbd{x} (see below) will delete the package. @xref{Package Files}, for information about what package deletion entails. +@item ~ +Mark all obsolete packages for deletion +(@code{package-menu-mark-obsolete-for-deletion}). This marks for +deletion all the packages whose status is @samp{obsolete}. + @item u +@itemx @key{DEL} Remove any installation or deletion mark previously added to the current line by an @kbd{i} or @kbd{d} command. @@ -117,6 +128,7 @@ on the new available versions, and a deletion mark on the old installed versions. @item x +@vindex package-menu-async Download and install all packages marked with @kbd{i}, and their dependencies; also, delete all packages marked with @kbd{d} (@code{package-menu-execute}). This also removes the marks. @@ -131,6 +143,14 @@ Filter the package list (@code{package-menu-filter}). This prompts for a keyword (e.g., @samp{games}), then shows only the packages that relate to that keyword. To restore the full package list, type @kbd{q}. + +@item H +Permanently hide packages that match a regexp +(@code{package-menu-hide-package}). + +@item ( +Toggle visibility of old versions of packages and also of versions +from lower-priority archives (@code{package-menu-toggle-hiding}). @end table @noindent @@ -205,6 +225,17 @@ offer different versions of the same package, you may find the option pairs to this list, to ensure that the specified package is only ever downloaded from the specified archive. +@vindex package-archive-priorities +@vindex package-menu-hide-low-priority + Another option that is useful when you have several package archives +enabled is @code{package-archive-priorities}. It specifies the +priority of each archive (higher numbers specify higher priority +archives). By default, archives have the priority of zero, unless +specified otherwise by this option's value. Packages from +lower-priority archives will not be shown in the menu, if the same +package is available from a higher-priority archive. (This is +controlled by the value of @code{package-menu-hide-low-priority}.) + Once a package is downloaded and installed, it is @dfn{loaded} into the current Emacs session. Loading a package is not quite the same as loading a Lisp library (@pxref{Lisp Libraries}); its effect varies diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 1f2c8b1e1c2..8423b70203c 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -833,9 +833,36 @@ displayed. The default is 102400. @findex show-paren-mode Show Paren mode, a global minor mode, provides a more powerful kind of automatic matching. Whenever point is before an opening delimiter -or after a closing delimiter, both that delimiter and its opposite -delimiter are highlighted. To toggle Show Paren mode, type @kbd{M-x -show-paren-mode}. +or after a closing delimiter, the delimiter, its matching delimiter, +and optionally the text between them are highlighted. To toggle Show +Paren mode, type @kbd{M-x show-paren-mode}. To customize it, type +@kbd{M-x customize-group @key{RET} paren-showing}. The customizable +options which control the operation of this mode include: + +@itemize @bullet +@item +@code{show-paren-highlight-open-paren} controls whether to highlight +an open paren when point stands just before it, and hence its position +is marked by the cursor anyway. The default is non-@code{nil} (yes). + +@item +@code{show-paren-style} controls whether just the two parens, or also +the space between them get highlighted. The valid options here are +@code{parenthesis} (show the matching paren), @code{expression} +(highlight the entire expression enclosed by the parens), and +@code{mixed} (highlight the matching paren if it is visible, the +expression otherwise). + +@item +@code{show-paren-when-point-inside-paren}, when non-@code{nil}, causes +highlighting also when point is on the inside of a parenthesis. + +@item +@code{show-paren-when-point-in-periphery}, when non-@code{nil}, causes +highlighting also when point is in whitespace at the beginning or end +of a line, and there is a paren at, respectively, the first or last, +or the last, non-whitespace position on the line. +@end itemize @cindex Electric Pair mode @cindex inserting matching parentheses @@ -917,6 +944,8 @@ will indent the comment to the appropriate position. @item @kbd{M-;} Insert or realign comment on current line; if the region is active, comment or uncomment the region instead (@code{comment-dwim}). +@item @kbd{C-x C-;} +Comment or uncomment the current line (@code{comment-line}). @item @kbd{C-u M-;} Kill comment on current line (@code{comment-kill}). @item @kbd{C-x ;} @@ -971,6 +1000,18 @@ are not moved. Even when an existing comment is properly aligned, @kbd{M-;} is still useful for moving directly to the start of the comment text. +@findex comment-line +@kindex C-x C-; + @kbd{C-x C-;} (@code{comment-line}) comments or uncomments complete +lines. When a region is active (@pxref{Mark}), @kbd{C-x C-;} either +comments or uncomments the lines in the region. If the region is not +active, this command comments or uncomments the line point is on. +With a positive prefix argument @var{n}, it operates on @var{n} lines +starting with the current one; with a negative @var{n}, it affects +@var{n} preceding lines. After invoking this command with a negative +argument, successive invocations with a positive argument will operate +on preceding lines as if the argument were negated. + @findex comment-kill @kindex C-u M-; @kbd{C-u M-;} (@code{comment-dwim} with a prefix argument) kills any @@ -1220,13 +1261,16 @@ variables that you want to use. @xref{Name Help}. @cindex Eldoc mode @findex eldoc-mode +@findex global-eldoc-mode Eldoc is a buffer-local minor mode that helps with looking up Lisp documentation. When it is enabled, the echo area displays some useful information whenever there is a Lisp function or variable at point; for a function, it shows the argument list, and for a variable it shows the first line of the variable's documentation string. To -toggle Eldoc mode, type @kbd{M-x eldoc-mode}. Eldoc mode can be used -with the Emacs Lisp and Lisp Interaction major modes. +toggle Eldoc mode, type @kbd{M-x eldoc-mode}. There's also a Global +Eldoc mode, which is turned on by default, and affects buffers, such +as @samp{*scratch*}, whose major mode is Emacs Lisp or Lisp +Interaction (@w{@kbd{M-x global-eldoc-mode}} to turn it off globally). @node Hideshow @section Hideshow minor mode @@ -1484,14 +1528,21 @@ with the Foldout package (@pxref{Foldout}). @findex prettify-symbols-mode Prettify Symbols mode is a buffer-local minor mode that replaces -certain strings with more attractive versions for display -purposes. For example, in Emacs Lisp mode, it replaces the string -@samp{lambda} with the Greek lambda character @samp{λ}. You may wish -to use this -in non-programming modes as well. You can customize the mode by -adding more entries to @code{prettify-symbols-alist}. There is also a -global version, @code{global-prettify-symbols-mode}, which enables the -mode in all buffers that support it. +certain strings with more attractive versions for display purposes. +For example, in Emacs Lisp mode, it replaces the string @samp{lambda} +with the Greek lambda character @samp{λ}. You may wish to use this in +non-programming modes as well. You can customize the mode by adding +more entries to @code{prettify-symbols-alist}. More elaborate +customization is available via customizing +@code{prettify-symbols-compose-predicate} if its default value +@code{prettify-symbols-default-compose-p} is not appropriate. There +is also a global version, @code{global-prettify-symbols-mode}, which +enables the mode in all buffers that support it. + + The symbol at point can be shown in its original form. This is +controlled by the variable @code{prettify-symbols-unprettify-at-point}: +if non-@code{nil}, the original form of symbol at point will be +restored for as long as point is at it. @node C Modes diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index d8841caa311..13c03f78a52 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -293,9 +293,11 @@ various files. Set the bookmark for the visited file, at point. @item C-x r m @var{bookmark} @key{RET} -@findex bookmark-set Set the bookmark named @var{bookmark} at point (@code{bookmark-set}). +@item C-x r M @var{bookmark} @key{RET} +Like @kbd{C-x r m}, but don't overwrite an existing bookmark. + @item C-x r b @var{bookmark} @key{RET} @findex bookmark-jump Jump to the bookmark named @var{bookmark} (@code{bookmark-jump}). @@ -320,6 +322,12 @@ name. If you name each bookmark after the file it points to, then you can conveniently revisit any of those files with @kbd{C-x r b}, and move to the position of the bookmark at the same time. +@kindex C-x r M +@findex bookmark-set-no-overwrite + The command @kbd{C-x r M} (@code{bookmark-set-no-overwrite}) works +like @kbd{C-x r m}, but it signals an error if the specified bookmark +already exists, instead of overwriting it. + @kindex C-x r l To display a list of all your bookmarks in a separate buffer, type @kbd{C-x r l} (@code{list-bookmarks}). If you switch to that buffer, diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi index 6e2a60b6378..b37f42cc56f 100644 --- a/doc/emacs/rmail.texi +++ b/doc/emacs/rmail.texi @@ -282,9 +282,9 @@ current message and select another. @kbd{d} messages already deleted, while @kbd{C-d} (@code{rmail-delete-backward}) moves to the previous nondeleted message. If there is no nondeleted message to move to in the specified direction, the message that was just -deleted remains current. @kbd{d} with a prefix argument is equivalent -to @kbd{C-d}. Note that the Rmail summary versions of these commands -behave slightly differently (@pxref{Rmail Summary Edit}). +deleted remains current. A numeric prefix argument serves as a repeat +count, to allow deletion of several messages in a single command. A +negative argument reverses the meaning of @kbd{d} and @kbd{C-d}. @c mention other hooks, e.g., show message hook? @vindex rmail-delete-message-hook @@ -305,7 +305,8 @@ type @kbd{x} (@code{rmail-expunge}). Until you do this, you can still effect of a @kbd{d} command in most cases. It undeletes the current message if the current message is deleted. Otherwise it moves backward to previous messages until a deleted message is found, and undeletes -that message. +that message. A numeric prefix argument serves as a repeat count, to +allow deletion of several messages in a single command. You can usually undo a @kbd{d} with a @kbd{u} because the @kbd{u} moves back to and undeletes the message that the @kbd{d} deleted. But @@ -974,13 +975,11 @@ different lines. It doesn't matter what Emacs command you use to move point; whichever line point is on at the end of the command, that message is selected in the Rmail buffer. - Almost all Rmail commands work in the summary buffer as well as in the -Rmail buffer. Thus, @kbd{d} in the summary buffer deletes the current -message, @kbd{u} undeletes, and @kbd{x} expunges. (However, in the -summary buffer, a numeric argument to @kbd{d}, @kbd{C-d} and @kbd{u} -serves as a repeat count. A negative argument reverses the meaning of -@kbd{d} and @kbd{C-d}. Also, if there are no more undeleted messages in -the relevant direction, the delete commands go to the first or last + Almost all Rmail commands work in the summary buffer as well as in +the Rmail buffer. Thus, @kbd{d} in the summary buffer deletes the +current message, @kbd{u} undeletes, and @kbd{x} expunges. (However, +in the summary buffer, if there are no more undeleted messages in the +relevant direction, the delete commands go to the first or last message, rather than staying on the current message.) @kbd{o} and @kbd{C-o} output the current message to a FILE; @kbd{r} starts a reply to it; etc. You can scroll the current message while remaining in the @@ -1224,6 +1223,15 @@ tagline (except for buttons for other actions, if there are any). Type the undecoded @acronym{MIME} data. With a prefix argument, this command toggles the display of only an entity at point. +@vindex rmail-mime-prefer-html + If the message has an @acronym{HTML} @acronym{MIME} part, Rmail +displays it in preference to the plain-text part, if Emacs can render +@acronym{HTML}@footnote{ +This capability requires that Emacs be built with @file{libxml2} +support or that you have the Lynx browser installed.}. To prevent +that, and have the plain-text part displayed instead, customize the +variable @code{rmail-mime-prefer-html} to a @code{nil} value. + To prevent Rmail from handling MIME decoded messages, change the variable @code{rmail-enable-mime} to @code{nil}. When this is the case, the @kbd{v} (@code{rmail-mime}) command instead creates a diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index ae275d1ca67..1cc7753f113 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -26,9 +26,11 @@ thing, but search for patterns instead of fixed strings. * Regexps:: Syntax of regular expressions. * Regexp Backslash:: Regular expression constructs starting with `\'. * Regexp Example:: A complex regular expression explained. -* Search Case:: To ignore case while searching, or not. +* Lax Search:: Search ignores some distinctions among + similar characters, like letter-case. * Replace:: Search, and replace some or all matches. * Other Repeating Search:: Operating on all matches for some regexp. +* Search Customizations:: Various search customizations. @end menu @node Incremental Search @@ -54,10 +56,10 @@ Incremental search backward (@code{isearch-backward}). @menu * Basic Isearch:: Basic incremental search commands. * Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. * Isearch Yank:: Commands that grab text into the search string or else edit the search string. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. * Not Exiting Isearch:: Prefix argument and scrolling commands. * Isearch Minibuffer:: Incremental search of the minibuffer history. @end menu @@ -89,31 +91,46 @@ cursor moves to just after the first @samp{FOO}. @cindex isearch face At each step, Emacs highlights the @dfn{current match}---the buffer text that matches the search string---using the @code{isearch} face -(@pxref{Faces}). The current search string is also displayed in the -echo area. +(@pxref{Faces}). @xref{Search Customizations}, for various options +that customize this highlighting. The current search string is also +displayed in the echo area. If you make a mistake typing the search string, type @key{DEL}. Each @key{DEL} cancels the last character of the search string. +@xref{Error in Isearch}, for more about dealing with unsuccessful +search. +@cindex exit incremental search +@cindex incremental search, exiting When you are satisfied with the place you have reached, type @key{RET}. This stops searching, leaving the cursor where the search brought it. Also, any command not specially meaningful in searches stops the searching and is then executed. Thus, typing @kbd{C-a} -exits the search and then moves to the beginning of the line. -@key{RET} is necessary only if the next command you want to type is a -printing character, @key{DEL}, @key{RET}, or another character that is -special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, -@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some others -described below). +exits the search and then moves to the beginning of the line; typing +one of the arrow keys exits the search and performs the respective +movement command; etc. @key{RET} is necessary only if the next +command you want to type is a printing character, @key{DEL}, +@key{RET}, or another character that is special within searches +(@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, @kbd{C-y}, @kbd{M-y}, +@kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some others described below). +You can fine-tune the commands that exit the search; see @ref{Not +Exiting Isearch}. As a special exception, entering @key{RET} when the search string is empty launches nonincremental search (@pxref{Nonincremental Search}). +(This can be customized; see @ref{Search Customizations}.) + + To abandon the search and return to the place where you started, +type @kbd{@key{ESC} @key{ESC} @key{ESC}} (@code{isearch-cancel}) or +@kbd{C-g C-g} (@code{isearch-abort}). When you exit the incremental search, it adds the original value of point to the mark ring, without activating the mark; you can thus use -@kbd{C-u C-@key{SPC}} to return to where you were before beginning the -search. @xref{Mark Ring}. It only does this if the mark was not -already active. +@kbd{C-u C-@key{SPC}} or @kbd{C-x C-x} to return to where you were +before beginning the search. @xref{Mark Ring}. (Emacs only does this +if the mark was not already active; if the mark was active when you +started the search, both @kbd{C-u C-@key{SPC}} and @kbd{C-x C-x} will +go to the mark.) @kindex C-r @findex isearch-backward @@ -134,7 +151,6 @@ characters with @key{DEL}. Similarly, each @kbd{C-r} in a backward incremental search repeats the backward search. @cindex lazy search highlighting -@vindex isearch-lazy-highlight If you pause for a little while during incremental search, Emacs highlights all the other possible matches for the search string that are present on the screen. This helps you anticipate where you can @@ -142,21 +158,26 @@ get to by typing @kbd{C-s} or @kbd{C-r} to repeat the search. The other matches are highlighted differently from the current match, using the customizable face @code{lazy-highlight} (@pxref{Faces}). If you don't like this feature, you can disable it by setting -@code{isearch-lazy-highlight} to @code{nil}. +@code{isearch-lazy-highlight} to @code{nil}. For other customizations +related to highlighting matches, see @ref{Search Customizations}. After exiting a search, you can search for the same string again by typing just @kbd{C-s C-s}. The first @kbd{C-s} is the key that invokes incremental search, and the second @kbd{C-s} means to search -again. Similarly, @kbd{C-r C-r} searches backward for the last -search string. In determining the last search string, it doesn't -matter whether the string was searched for with @kbd{C-s} or -@kbd{C-r}. +again for the last search string. Similarly, @kbd{C-r C-r} searches +backward for the last search string. In determining the last search +string, it doesn't matter whether that string was searched for with +@kbd{C-s} or @kbd{C-r}. If you are searching forward but you realize you were looking for something before the starting point, type @kbd{C-r} to switch to a backward search, leaving the search string unchanged. Similarly, @kbd{C-s} in a backward search switches to a forward search. +@cindex search, wrapping around +@cindex search, overwrapped +@cindex wrapped search +@cindex overwrapped search If a search is failing and you ask to repeat it by typing another @kbd{C-s}, it starts again from the beginning of the buffer. Repeating a failing reverse search with @kbd{C-r} starts again from @@ -169,19 +190,86 @@ you have already seen. @cindex search ring @kindex M-n @r{(Incremental search)} @kindex M-p @r{(Incremental search)} +@vindex search-ring-max To reuse earlier search strings, use the @dfn{search ring}. The commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search string to reuse. These commands leave the selected search ring -element in the minibuffer, where you can edit it. - +element in the minibuffer, where you can edit it. Type +@kbd{C-s}/@kbd{C-r} or @key{RET} to accept the string and start +searching for it. The number of most recently used search strings +saved in the search ring is specified by the variable +@code{search-ring-max}, 16 by default. + +@cindex incremental search, edit search string +@cindex interactively edit search string @kindex M-e @r{(Incremental search)} +@kindex Mouse-1 @r{in the minibuffer (Incremental Search)} To edit the current search string in the minibuffer without -replacing it with items from the search ring, type @kbd{M-e}. Type @key{RET}, -@kbd{C-s} or @kbd{C-r} to finish editing the string and search for it. +replacing it with items from the search ring, type @kbd{M-e} or click +@kbd{Mouse-1} in the minibuffer. Type @key{RET}, @kbd{C-s} or +@kbd{C-r} to finish editing the string and search for it. Type +@kbd{C-f} or @kbd{@key{RIGHT}} to add to the search string characters +following point from the buffer from which you started the search. + +@node Isearch Yank +@subsection Isearch Yanking + + In many cases, you will want to use text at or near point as your +search string. The commands described in this subsection let you do +that conveniently. + +@kindex C-w @r{(Incremental search)} +@findex isearch-yank-word-or-char + @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next +character or word at point to the search string. This is an easy way +to search for another occurrence of the text at point. (The decision +of whether to copy a character or a word is heuristic.) + +@kindex M-s C-e @r{(Incremental search)} +@findex isearch-yank-line + Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest +of the current line to the search string. If point is already at the +end of a line, it appends the next line. With a prefix argument +@var{n}, it appends the next @var{n} lines. + +@kindex C-y @r{(Incremental search)} +@kindex M-y @r{(Incremental search)} +@kindex Mouse-2 @r{in the minibuffer (Incremental search)} +@findex isearch-yank-kill +@findex isearch-yank-pop +@findex isearch-yank-x-selection + Within incremental search, @kbd{C-y} (@code{isearch-yank-kill}) +appends the current kill to the search string. @kbd{M-y} +(@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that +appended text with an earlier kill, similar to the usual @kbd{M-y} +(@code{yank-pop}) command (@pxref{Yanking}). Clicking @kbd{Mouse-2} +in the echo area appends the current X selection (@pxref{Primary +Selection}) to the search string (@code{isearch-yank-x-selection}). + +@kindex C-M-w @r{(Incremental search)} +@kindex C-M-y @r{(Incremental search)} +@findex isearch-del-char +@findex isearch-yank-char + @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character +from the search string, and @kbd{C-M-y} (@code{isearch-yank-char}) +appends the character after point to the search string. An +alternative method to add the character after point is to enter the +minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f} +or @kbd{@key{RIGHT}} at the end of the search string in the +minibuffer. Each @kbd{C-f} or @kbd{@key{RIGHT}} you type adds another +character following point to the search string. + + Normally, when the search is case-insensitive, text yanked into the +search string is converted to lower case, so that the search remains +case-insensitive (@pxref{Lax Search, case folding}). However, if the +value of the variable @code{search-upper-case} (@pxref{Lax Search, +search-upper-case}) is other than @code{not-yanks}, that disables this +down-casing. @node Error in Isearch @subsection Errors in Incremental Search +@cindex isearch-fail face If your string is not found at all, the echo area says @samp{Failing I-Search}, and the cursor moves past the place where Emacs found as much of your string as it could. Thus, if you search for @samp{FOOT}, @@ -192,12 +280,13 @@ string that failed to match is highlighted using the face At this point, there are several things you can do. If your string was mistyped, you can use @key{DEL} to erase some of it and correct -it. If you like the place you have found, you can type @key{RET} to -remain there. Or you can type @kbd{C-g}, which removes from the -search string the characters that could not be found (the @samp{T} in -@samp{FOOT}), leaving those that were found (the @samp{FOO} in -@samp{FOOT}). A second @kbd{C-g} at that point cancels the search -entirely, returning point to where it was when the search started. +it, or you can type @kbd{M-e} and edit it. If you like the place you +have found, you can type @key{RET} to remain there. Or you can type +@kbd{C-g}, which removes from the search string the characters that +could not be found (the @samp{T} in @samp{FOOT}), leaving those that +were found (the @samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at +that point cancels the search entirely, returning point to where it +was when the search started. @cindex quitting (in search) @kindex C-g @r{(Incremental search)} @@ -216,34 +305,21 @@ search. @node Special Isearch @subsection Special Input for Incremental Search - Some of the characters you type during incremental search have -special effects. + In addition to characters described in the previous subsections, +some of the other characters you type during incremental search have +special effects. They are described here. -@cindex lax space matching -@kindex M-s SPC @r{(Incremental search)} -@kindex SPC @r{(Incremental search)} -@findex isearch-toggle-lax-whitespace -@vindex search-whitespace-regexp - By default, incremental search performs @dfn{lax space matching}: -each space, or sequence of spaces, matches any sequence of one or more -spaces in the text. Hence, @samp{foo bar} matches @samp{foo bar}, -@samp{foo@w{ }bar}, @samp{foo@w{ }bar}, and so on (but not -@samp{foobar}). More precisely, Emacs matches each sequence of space -characters in the search string to a regular expression specified by -the variable @code{search-whitespace-regexp}. For example, to make -spaces match sequences of newlines as well as spaces, set it to -@samp{"[[:space:]\n]+"}. - - To toggle lax space matching, type @kbd{M-s @key{SPC}} -(@code{isearch-toggle-lax-whitespace}). To disable this feature -entirely, change @code{search-whitespace-regexp} to @code{nil}; then -each space in the search string matches exactly one space. - - If the search string you entered contains only lower-case letters, -the search is case-insensitive; as long as an upper-case letter exists -in the search string, the search becomes case-sensitive. If you -delete the upper-case character from the search string, it ceases to -have this effect. @xref{Search Case}. + To toggle lax space matching (@pxref{Lax Search, lax space +matching}), type @kbd{M-s @key{SPC}}. + + To toggle case sensitivity of the search, type @kbd{M-c} or +@kbd{M-s c}. @xref{Lax Search, case folding}. If the search string +includes upper-case letters, the search is case-sensitive by default. + + To toggle whether or not the search will consider similar and +equivalent characters as a match, type @kbd{M-s '}. @xref{Lax Search, +character folding}. If the search string includes accented +characters, that disables character folding during that search. @cindex invisible text, searching for @kindex M-s i @r{(Incremental search)} @@ -251,7 +327,17 @@ have this effect. @xref{Search Case}. To toggle whether or not invisible text is searched, type @kbd{M-s i} (@code{isearch-toggle-invisible}). @xref{Outline Search}. - To search for a newline character, type @kbd{C-j}. +@kindex M-r @r{(Incremental Search)} +@kindex M-s r @r{(Incremental Search)} +@findex isearch-toggle-regexp + To toggle between non-regexp and regexp incremental search, type +@kbd{M-r} or @kbd{M-s r} (@code{isearch-toggle-regexp}). +@xref{Regexp Search}. + + To toggle symbol mode, type @kbd{M-s _}. @xref{Symbol Search}. + + To search for a newline character, type @kbd{C-j} as part of the +search string. To search for non-@acronym{ASCII} characters, use one of the following methods: @@ -265,17 +351,21 @@ example, @kbd{C-q C-s} during incremental search adds the @samp{control-S} character to the search string. @item -Type @kbd{C-x 8 @key{RET}}, followed by a Unicode name or code-point. -This adds the specified character into the search string, similar to -the usual @code{insert-char} command (@pxref{Inserting Text}). +Type @kbd{C-x 8 @key{RET}}, followed by a Unicode name or code-point +in hex. This adds the specified character into the search string, +similar to the usual @code{insert-char} command (@pxref{Inserting +Text}). @item +@kindex C-^ @r{(Incremental Search)} +@findex isearch-toggle-input-method +@findex isearch-toggle-specified-input-method Use an input method (@pxref{Input Methods}). If an input method is -enabled in the current buffer when you start the search, you can use -it in the search string also. While typing the search string, you can -toggle the input method with @kbd{C-\} -(@code{isearch-toggle-input-method}). You can also turn on a -non-default input method with @kbd{C-^} +enabled in the current buffer when you start the search, the same +method will be active in the minibuffer when you type the search +string. While typing the search string, you can toggle the input +method with @kbd{C-\} (@code{isearch-toggle-input-method}). You can +also turn on a non-default input method with @kbd{C-^} (@code{isearch-toggle-specified-input-method}), which prompts for the name of the input method. When an input method is active during incremental search, the search prompt includes the input method @@ -286,13 +376,17 @@ I-search [@var{im}]: @end example @noindent -@findex isearch-toggle-input-method -@findex isearch-toggle-specified-input-method where @var{im} is the mnemonic of the active input method. Any input method you enable during incremental search remains enabled in the current buffer afterwards. @end itemize +@kindex M-s o @r{(Incremental Search)} +@findex isearch-occur + Typing @kbd{M-s o} in incremental search invokes +@code{isearch-occur}, which runs @code{occur} with the current search +string. @xref{Other Repeating Search, occur}. + @kindex M-% @r{(Incremental search)} Typing @kbd{M-%} in incremental search invokes @code{query-replace} or @code{query-replace-regexp} (depending on search mode) with the @@ -302,83 +396,72 @@ prefix argument means to replace backward. @xref{Query Replace}. @kindex M-TAB @r{(Incremental search)} Typing @kbd{M-@key{TAB}} in incremental search invokes @code{isearch-complete}, which attempts to complete the search string -using the search ring as a list of completion alternatives. -@xref{Completion}. In many operating systems, the @kbd{M-@key{TAB}} -key sequence is captured by the window manager; you then need to -rebind @code{isearch-complete} to another key sequence if you want to -use it (@pxref{Rebinding}). - +using the search ring (the previous search strings you used) as a list +of completion alternatives. @xref{Completion}. In many operating +systems, the @kbd{M-@key{TAB}} key sequence is captured by the window +manager; you then need to rebind @code{isearch-complete} to another +key sequence if you want to use it (@pxref{Rebinding}). + +@kindex M-s h r @r{(Incremental Search)} +@findex isearch-highlight-regexp + You can exit the search while leaving the matches for the last +search string highlighted on display. To this end, type @kbd{M-s h r} +(@code{isearch-highlight-regexp}), which will run +@code{highlight-regexp} (@pxref{Highlight Interactively}) passing +it the regexp derived from the last search string and prompting you +for the face to use for highlighting. To remove the highlighting, +type @kbd{M-s h u} (@code{unhighlight-regexp}). + +@cindex incremental search, help on special keys +@kindex C-h C-h @r{(Incremental Search)} +@findex isearch-help-map @vindex isearch-mode-map - When incremental search is active, you can type @kbd{C-h C-h} to -access interactive help options, including a list of special key -bindings. These key bindings are part of the keymap -@code{isearch-mode-map} (@pxref{Keymaps}). - -@node Isearch Yank -@subsection Isearch Yanking - -@kindex C-y @r{(Incremental search)} -@kindex M-y @r{(Incremental search)} -@findex isearch-yank-kill -@findex isearch-yank-pop - Within incremental search, @kbd{C-y} (@code{isearch-yank-kill}) -appends the current kill to the search string. @kbd{M-y} -(@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that -appended text with an earlier kill, similar to the usual @kbd{M-y} -(@code{yank-pop}) command (@pxref{Yanking}). @kbd{Mouse-2} appends -the current X selection (@pxref{Primary Selection}). - -@kindex C-w @r{(Incremental search)} -@findex isearch-yank-word-or-char - @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next -character or word at point to the search string. This is an easy way -to search for another occurrence of the text at point. (The decision -of whether to copy a character or a word is heuristic.) - -@kindex M-s C-e @r{(Incremental search)} -@findex isearch-yank-line - Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest -of the current line to the search string. If point is already at the -end of a line, it appends the next line. With a prefix argument -@var{n}, it appends the next @var{n} lines. - - If the search is currently case-insensitive, both @kbd{C-w} and -@kbd{M-s C-e} convert the text they copy to lower case, so that the -search remains case-insensitive. - -@kindex C-M-w @r{(Incremental search)} -@kindex C-M-y @r{(Incremental search)} -@findex isearch-del-char -@findex isearch-yank-char - @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character -from the search string, and @kbd{C-M-y} (@code{isearch-yank-char}) -appends the character after point to the search string. An -alternative method to add the character after point is to enter the -minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f} -at the end of the search string in the minibuffer. + When incremental search is active, you can type @kbd{C-h C-h} +(@code{isearch-help-map}) to access interactive help options, +including a list of special key bindings. These key bindings are part +of the keymap @code{isearch-mode-map} (@pxref{Keymaps}). @node Not Exiting Isearch @subsection Not Exiting Incremental Search -This subsection describes two categories of commands which you can -type without exiting the current incremental search, even though they -are not themselves part of incremental search. +This subsection describes how to control whether typing a command not +specifically meaningful is searches exits the search before executing +the command. It also describes two categories of commands which you +can type without exiting the current incremental search, even though +they are not themselves part of incremental search. + +@vindex search-exit-option + Normally, typing a command that is not bound by the incremental +search exits the search before executing the command. Thus, the +command operates on the buffer from which you invoked the search. +However, if you customize the variable @code{search-exit-option} to +@code{nil}, the characters which you type that are not interpreted by +the incremental search are simply appended to the search string. This +is so you could include in the search string control characters, such +as @kbd{C-a}, that would normally exit the search and invoke the +command bound to them on the buffer. @table @asis @item Prefix Arguments +@cindex prefix argument commands, during incremental search @vindex isearch-allow-prefix - In incremental search, when you enter a prefix argument -(@pxref{Arguments}), by default it will apply either to the next -action in the search or to the command that exits the search. + In incremental search, when you type a command that specifies a +prefix argument (@pxref{Arguments}), by default it will apply either +to the next action in the search or to the command that exits the +search. In other words, entering a prefix argument will not by itself +terminate the search. In previous versions of Emacs, entering a prefix argument always terminated the search. You can revert to this behavior by setting the variable @code{isearch-allow-prefix} to @code{nil}. When @code{isearch-allow-scroll} is non-@code{nil} (see below), -prefix arguments always have the default behavior described above. +prefix arguments always have the default behavior described above, +i.e., they don't terminate the search, even if +@code{isearch-allow-prefix} is @code{nil}. @item Scrolling Commands +@cindex scrolling commands, during incremental search @vindex isearch-allow-scroll Normally, scrolling commands exit incremental search. If you change the variable @code{isearch-allow-scroll} to a non-@code{nil} value, @@ -390,12 +473,14 @@ prefix arguments to these commands in the usual way. This feature won't let you scroll the current match out of visibility, however. The @code{isearch-allow-scroll} feature also affects some other -commands, such as @kbd{C-x 2} (@code{split-window-below}) and @kbd{C-x -^} (@code{enlarge-window}), which don't exactly scroll but do affect -where the text appears on the screen. It applies to any command whose -name has a non-@code{nil} @code{isearch-scroll} property. So you can -control which commands are affected by changing these properties. - +commands, such as @kbd{C-x 2} (@code{split-window-below}) and +@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do +affect where the text appears on the screen. It applies to any +command whose name has a non-@code{nil} @code{isearch-scroll} +property. So you can control which commands are affected by changing +these properties. + +@cindex prevent commands from exiting incremental search For example, to make @kbd{C-h l} usable within an incremental search in all future Emacs sessions, use @kbd{C-h c} to find what command it runs (@pxref{Key Help}), which is @code{view-lossage}. Then you can @@ -409,7 +494,8 @@ put the following line in your init file (@pxref{Init File}): This feature can be applied to any command that doesn't permanently change point, the buffer contents, the match data, the current buffer, or the selected window and frame. The command must not itself attempt -an incremental search. +an incremental search. This feature is disabled if +@code{isearch-allow-scroll} is @code{nil} (which it is by default). @end table @node Isearch Minibuffer @@ -455,14 +541,22 @@ This enters the minibuffer to read the search string; terminate the string with @key{RET}, and then the search takes place. If the string is not found, the search command signals an error. -@findex search-forward -@findex search-backward When you type @kbd{C-s @key{RET}}, the @kbd{C-s} invokes incremental search as usual. That command is specially programmed to invoke the -command for nonincremental search, @code{search-forward}, if the -string you specify is empty. (Such an empty argument would otherwise -be useless.) @kbd{C-r @key{RET}} does likewise, invoking the command -@code{search-backward}. +command for nonincremental search, if the string you specify is empty. +(Such an empty argument would otherwise be useless.) @kbd{C-r +@key{RET}} does likewise, invoking the nonincremental +backward-searching command. + + Nonincremental search can also be invoked form the menu bar's +@samp{Edit->Search} menu. + +@findex search-forward +@findex search-backward + You can also use two simpler commands, @kbd{M-x search-forward} and +@kbd{M-x search-backward}. These commands look for the literal +strings you specify, and don't support any of the lax-search features +(@pxref{Lax Search}) except case folding. @node Word Search @section Word Search @@ -475,11 +569,13 @@ search matches any sequence of those two words separated by one or more spaces, newlines, or other punctuation characters. This is particularly useful for searching text documents, because you don't have to worry whether the words you are looking for are separated by -newlines or spaces. +newlines or spaces. Note that major modes for programming languages +or other specialized modes can modify the definition of a word to suit +their syntactic needs. @table @kbd @item M-s w -If incremental search is active, toggle word search mode + If incremental search is active, toggle word search mode (@code{isearch-toggle-word}); otherwise, begin an incremental forward word search (@code{isearch-forward-word}). @item M-s w @key{RET} @var{words} @key{RET} @@ -514,6 +610,18 @@ so that the matching can proceed incrementally as you type. This additional laxity does not apply to the lazy highlight (@pxref{Incremental Search}), which always matches whole words. + The word search commands don't perform character folding, and +toggling lax whitespace matching (@pxref{Lax Search, lax space +matching}) has no effect on them. + +@kindex M-s M-w +@findex eww-search-word +@vindex eww-search-prefix + Search the Web for the text in region. This command performs an +Internet search for the words in region using the search engine whose +@acronym{URL} is specified by the variable @code{eww-search-prefix}. +@xref{Basics, EWW, , eww, The Emacs Web Wowser Manual}. + @node Symbol Search @section Symbol Search @cindex symbol search @@ -529,6 +637,7 @@ searching source code. @table @kbd @item M-s _ +@findex isearch-toggle-symbol If incremental search is active, toggle symbol search mode (@code{isearch-toggle-symbol}); otherwise, begin an incremental forward symbol search (@code{isearch-forward-symbol}). @@ -561,6 +670,10 @@ search. In nonincremental symbol searches, the beginning and end of the search string are required to match the beginning and end of a symbol, respectively. + The symbol search commands don't perform character folding, and +toggling lax whitespace matching (@pxref{Lax Search, lax space +matching}) has no effect on them. + @node Regexp Search @section Regular Expression Search @cindex regexp search @@ -595,22 +708,31 @@ for. To search backward for a regexp, use @kbd{C-M-r} (@code{isearch-backward-regexp}), @kbd{C-r} with a prefix argument, or @kbd{M-r} within a backward incremental search. +@vindex regexp-search-ring-max All of the special key sequences in an ordinary incremental search -do similar things in an incremental regexp search. For instance, -typing @kbd{C-s} immediately after starting the search retrieves the -last incremental search regexp used and searches forward for it. -Incremental regexp and non-regexp searches have independent defaults. -They also have separate search rings, which you can access with -@kbd{M-p} and @kbd{M-n}. +(@pxref{Special Isearch}) do similar things in an incremental regexp +search. For instance, typing @kbd{C-s} immediately after starting the +search retrieves the last incremental search regexp used and searches +forward for it. Incremental regexp and non-regexp searches have +independent defaults. They also have separate search rings, which you +can access with @kbd{M-p} and @kbd{M-n}. The maximum number of search +regexps saved in the search ring is determined by the value of +@code{regexp-search-ring-max}, 16 by default. Unlike ordinary incremental search, incremental regexp search -do not use lax space matching by default. To toggle this feature +does not use lax space matching by default. To toggle this feature use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}). Then any @key{SPC} typed in incremental regexp search will match any sequence of one or more whitespace characters. The variable @code{search-whitespace-regexp} specifies the regexp for the lax space matching. @xref{Special Isearch}. + Also unlike ordinary incremental search, incremental regexp search +cannot use character folding (@pxref{Lax Search}). (If you toggle +character folding during incremental regexp search with @kbd{M-s '}, +the search becomes a non-regexp search and the search pattern you +typed is interpreted as a literal string.) + In some cases, adding characters to the regexp in an incremental regexp search can make the cursor move back and start again. For example, if you have searched for @samp{foo} and you add @samp{\|bar}, @@ -629,7 +751,10 @@ starting position. These search methods are not mirror images. Nonincremental search for a regexp is done with the commands @code{re-search-forward} and @code{re-search-backward}. You can invoke these with @kbd{M-x}, or by way of incremental regexp search -with @kbd{C-M-s @key{RET}} and @kbd{C-M-r @key{RET}}. +with @kbd{C-M-s @key{RET}} and @kbd{C-M-r @key{RET}}. When you invoke +these commands with @kbd{M-x}, they search for the exact regexp you +specify, and thus don't support any lax-search features (@pxref{Lax +Search}) except case folding. If you use the incremental regexp search commands with a prefix argument, they perform ordinary string search, like @@ -1030,21 +1155,67 @@ This contains two parts in succession: a character set matching period, @samp{?}, or @samp{!}, and a character set matching close-brackets, quotes, or parentheses, repeated zero or more times. -@node Search Case -@section Searching and Case +@node Lax Search +@section Lax Matching During Searching - Searches in Emacs normally ignore the case of the text they are -searching through, if you specify the text in lower case. Thus, if -you specify searching for @samp{foo}, then @samp{Foo} and @samp{foo} -also match. Regexps, and in particular character sets, behave -likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b} or -@samp{B}. +@cindex lax search +@cindex character equivalence in search + Normally, you'd want search commands to disregard certain minor +differences between the search string you type and the text being +searched. For example, sequences of whitespace characters of +different length are usually perceived as equivalent; letter-case +differences usually don't matter; etc. This is known as +@dfn{character equivalence}. - An upper-case letter anywhere in the incremental search string makes -the search case-sensitive. Thus, searching for @samp{Foo} does not find -@samp{foo} or @samp{FOO}. This applies to regular expression search as -well as to string search. The effect ceases if you delete the -upper-case letter from the search string. + This section describes the Emacs lax search features, and how to +tailor them to your needs. + +@cindex lax space matching in search +@kindex M-s SPC @r{(Incremental search)} +@kindex SPC @r{(Incremental search)} +@findex isearch-toggle-lax-whitespace +@vindex search-whitespace-regexp + By default, search commands perform @dfn{lax space matching}: +each space, or sequence of spaces, matches any sequence of one or more +whitespace characters in the text. (Incremental regexp search has a +separate default; see @ref{Regexp Search}.) Hence, @samp{foo bar} +matches @samp{foo bar}, @samp{foo@w{ }bar}, @samp{foo@w{ }bar}, and +so on (but not @samp{foobar}). More precisely, Emacs matches each +sequence of space characters in the search string to a regular +expression specified by the variable @code{search-whitespace-regexp}. +For example, to make spaces match sequences of newlines as well as +spaces, set it to @samp{"[[:space:]\n]+"}. The default value of this +variable depends on the buffer's major mode; most major modes classify +spaces, tabs, and formfeed characters as whitespace. + + If you want whitespace characters to match exactly, you can turn lax +space matching off by typing @kbd{M-s @key{SPC}} +(@code{isearch-toggle-lax-whitespace}) within an incremental search. +Another @kbd{M-s @key{SPC}} turns lax space matching back on. To +disable lax whitespace matching for all searches, change +@code{search-whitespace-regexp} to @code{nil}; then each space in the +search string matches exactly one space. + +@cindex case folding in search +@cindex case-sensitivity and search + Searches in Emacs by default ignore the case of the text they are +searching through, if you specify the search string in lower case. +Thus, if you specify searching for @samp{foo}, then @samp{Foo} and +@samp{foo} also match. Regexps, and in particular character sets, +behave likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b} +or @samp{B}. This feature is known as @dfn{case folding}, and it is +supported in both incremental and non-incremental search modes. + +@vindex search-upper-case + An upper-case letter anywhere in the search string makes the search +case-sensitive. Thus, searching for @samp{Foo} does not find +@samp{foo} or @samp{FOO}. This applies to regular expression search +as well as to literal string search. The effect ceases if you delete +the upper-case letter from the search string. The variable +@code{search-upper-case} controls this: if it is non-@code{nil} (the +default), an upper-case character in the search string make the search +case-sensitive; setting it to @code{nil} disables this effect of +upper-case characters. @vindex case-fold-search If you set the variable @code{case-fold-search} to @code{nil}, then @@ -1055,12 +1226,14 @@ This variable applies to nonincremental searches also, including those performed by the replace commands (@pxref{Replace}) and the minibuffer history matching commands (@pxref{Minibuffer History}). -@c isearch-toggle-case-fold - Typing @kbd{M-c} within an incremental search toggles the case -sensitivity of that search. The effect does not extend beyond the -current incremental search to the next one, but it does override the -effect of adding or removing an upper-case letter in the current -search. +@kindex M-c @r{(Incremental search)} +@kindex M-s c @r{(Incremental search)} +@findex isearch-toggle-case-fold + Typing @kbd{M-c} or @kbd{M-s c} (@code{isearch-toggle-case-fold}) +within an incremental search toggles the case sensitivity of that +search. The effect does not extend beyond the current incremental +search, but it does override the effect of adding or removing an +upper-case letter in the current search. Several related variables control case-sensitivity of searching and matching for specific commands or activities. For instance, @@ -1068,6 +1241,45 @@ matching for specific commands or activities. For instance, @code{find-tag}. To find these variables, do @kbd{M-x apropos-variable @key{RET} case-fold-search @key{RET}}. +@cindex character folding in search +@cindex equivalent character sequences + Case folding disregards case distinctions among characters, making +upper-case characters match lower-case variants, and vice versa. A +generalization of case folding is @dfn{character folding}, which +disregards wider classes of distinctions among similar characters. +For instance, under character folding the letter @code{a} matches all +of its accented cousins like @code{@"a} and @code{@'a}, i.e., the +match disregards the diacritics that distinguish these +variants. In addition, @code{a} matches other characters that +resemble it, or have it as part of their graphical representation, +such as @sc{u+249c parenthesized latin small letter a} and @sc{u+2100 +account of} (which looks like a small @code{a} over @code{c}). +Similarly, the @acronym{ASCII} double-quote character @code{"} matches +all the other variants of double quotes defined by the Unicode +standard. Finally, character folding can make a sequence of one or +more characters match another sequence of a different length: for +example, the sequence of two characters @code{ff} matches @sc{u+fb00 +latin small ligature ff}. Character sequences that are not identical, +but match under character folding are known as @dfn{equivalent +character sequences}. + +@kindex M-s ' @r{(Incremental Search)} +@findex isearch-toggle-character-fold + Generally, search commands in Emacs by default perform character +folding, thus matching equivalent character sequences. You can +disable this behavior by customizing the variable +@code{search-default-regexp-mode} to @code{nil}. @xref{Search +Customizations}. Within an incremental search, typing @kbd{M-s '} +(@code{isearch-toggle-character-fold}) toggles character folding, but +only for that search. (Replace commands have a different default, +controlled by a separate option; see @ref{Replacement and Lax +Matches}.) + + Like with case folding, typing an explicit variant of a character, +such as @code{@"a}, as part of the search string disables character +folding for that search. If you delete such a character from the +search string, this effect ceases. + @node Replace @section Replacement Commands @cindex replacement @@ -1078,7 +1290,8 @@ apropos-variable @key{RET} case-fold-search @key{RET}}. Emacs provides several commands for performing search-and-replace operations. In addition to the simple @kbd{M-x replace-string} command, there is @kbd{M-%} (@code{query-replace}), which presents -each occurrence of the pattern and asks you whether to replace it. +each occurrence of the search pattern and asks you whether to replace +it. The replace commands normally operate on the text from point to the end of the buffer. When the region is active, they operate on it @@ -1087,17 +1300,11 @@ instead (@pxref{Mark}). The basic replace commands replace one is possible to perform several replacements in parallel, using the command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}). -@vindex replace-lax-whitespace - Unlike incremental search, the replacement commands do not use lax -space matching (@pxref{Special Isearch}) by default. To enable lax -space matching for replacement, change the variable -@code{replace-lax-whitespace} to @code{t}. (This only affects how -Emacs finds the text to replace, not the replacement text.) - @menu * Unconditional Replace:: Replacing all matches for a string. * Regexp Replace:: Replacing all matches for a regexp. -* Replacement and Case:: How replacements preserve case of letters. +* Replacement and Lax Matches:: + Lax searching for text to replace. * Query Replace:: How to use querying. @end menu @@ -1128,8 +1335,8 @@ activating the mark; use @kbd{C-u C-@key{SPC}} to move back there. A prefix argument restricts replacement to matches that are surrounded by word boundaries. - @xref{Replacement and Case}, for details about case-sensitivity in -replace commands. + @xref{Replacement and Lax Matches}, for details about +case-sensitivity in replace commands. @node Regexp Replace @subsection Regexp Replacement @@ -1137,7 +1344,7 @@ replace commands. The @kbd{M-x replace-string} command replaces exact matches for a single string. The similar command @kbd{M-x replace-regexp} replaces -any match for a specified pattern. +any match for a specified regular expression pattern (@pxref{Regexps}). @table @kbd @item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET} @@ -1218,9 +1425,28 @@ M-x replace-regexp @key{RET} ^.\@{0,72\@}$ @key{RET} \,(format "%-72sABC%05d" \& \#) @key{RET} @end example -@node Replacement and Case -@subsection Replace Commands and Case +@node Replacement and Lax Matches +@subsection Replace Commands and Lax Matches + + This subsection describes the behavior of replace commands with +respect to lax matches (@pxref{Lax Search}) and how to customize it. +In general, replace commands mostly default to stricter matching than +their search counterparts. +@cindex lax space matching in replace commands +@vindex replace-lax-whitespace + Unlike incremental search, the replacement commands do not use lax +space matching (@pxref{Lax Search, lax space matching}) by default. +To enable lax space matching for replacement, change the variable +@code{replace-lax-whitespace} to non-@code{nil}. (This only affects +how Emacs finds the text to replace, not the replacement text.) + +@vindex replace-regexp-lax-whitespace + A companion variable @code{replace-regexp-lax-whitespace} controls +whether @code{query-replace-regexp} uses lax whitespace matching when +searching for patterns. + +@cindex case folding in replace commands If the first argument of a replace command is all lower case, the command ignores case while searching for occurrences to replace---provided @code{case-fold-search} is non-@code{nil}. If @@ -1250,6 +1476,15 @@ exactly as given, with no case conversion. Likewise, if either @code{case-replace} or @code{case-fold-search} is set to @code{nil}, replacement is done without case conversion. +@cindex character folding in replace commands + The replacement commands by default do not use character folding +(@pxref{Lax Search, character folding}) when looking for the text to +replace. To enable character folding for matching in +@code{query-replace} and @code{replace-string}, set the variable +@code{replace-character-fold} to a non-@code{nil} value. (This +setting does not affect the replacement text, only how Emacs finds the +text to replace. It also doesn't affect @code{replace-regexp}.) + @node Query Replace @subsection Query Replace @cindex query replace @@ -1270,9 +1505,9 @@ occurrence and asks you whether to replace it. Aside from querying, @code{query-replace} works just like @code{replace-string} (@pxref{Unconditional Replace}). In particular, it preserves case provided @code{case-replace} is non-@code{nil}, as it normally is -(@pxref{Replacement and Case}). A numeric argument means to consider -only occurrences that are bounded by word-delimiter characters. A -negative prefix argument replaces backward. +(@pxref{Replacement and Lax Matches}). A numeric argument means to +consider only occurrences that are bounded by word-delimiter +characters. A negative prefix argument replaces backward. @kindex C-M-% @findex query-replace-regexp @@ -1280,18 +1515,38 @@ negative prefix argument replaces backward. It works like @code{replace-regexp} except that it queries like @code{query-replace}. +@vindex query-replace-from-to-separator + You can reuse earlier replacements with these commands. When +@code{query-replace} or @code{query-replace-regexp} prompts for the +search string, use @kbd{M-p} and @kbd{M-n} to show previous +replacements in the form @samp{@var{from} -> @var{to}}, where +@var{from} is the search pattern, @var{to} is its replacement, and the +separator between them is determined by the value of the variable +@code{query-replace-from-to-separator}. Type @key{RET} to select the +desired replacement. + @cindex faces for highlighting query replace @cindex query-replace face -@cindex lazy-highlight face +@cindex lazy-highlight face, in replace +@vindex query-replace-highlight +@vindex query-replace-lazy-highlight +@vindex query-replace-show-replacement These commands highlight the current match using the face -@code{query-replace}. They highlight other matches using -@code{lazy-highlight} just like incremental search (@pxref{Incremental -Search}). By default, @code{query-replace-regexp} will show the -substituted replacement string for the current match in the -minibuffer. If you want to keep special sequences @samp{\&} and -@samp{\@var{n}} unexpanded, customize +@code{query-replace}. You can disable this highlight by setting the +variable @code{query-replace-highlight} to @code{nil}. They highlight +other matches using @code{lazy-highlight} just like incremental search +(@pxref{Incremental Search}); this can be disabled by setting +@code{query-replace-lazy-highlight} to @code{nil}. By default, +@code{query-replace-regexp} will show the substituted replacement +string for the current match in the minibuffer. If you want to keep +special sequences @samp{\&} and @samp{\@var{n}} unexpanded, customize @code{query-replace-show-replacement} variable. +@vindex query-replace-skip-read-only + The variable @code{query-replace-skip-read-only}, if set +non-@code{nil}, will cause replacement commands to ignore matches in +read-only text. The default is not to ignore them. + The characters you can type when you are shown a match for the string or regexp are: @@ -1311,9 +1566,13 @@ or regexp are: @c WideCommands @table @kbd @item @key{SPC} +@itemx y to replace the occurrence with @var{newstring}. @item @key{DEL} +@itemx @key{Delete} +@itemx @key{BACKSPACE} +@itemx n to skip to the next occurrence without replacing this one. @item , @r{(Comma)} @@ -1329,6 +1588,7 @@ must use @kbd{C-x @key{ESC} @key{ESC} @key{RET}} to restart (@pxref{Repetition}). @item @key{RET} +@itemx q to exit without doing any more replacements. @item .@: @r{(Period)} @@ -1338,19 +1598,6 @@ occurrences. @item ! to replace all remaining occurrences without asking again. -@item Y @r{(Upper-case)} -to replace all remaining occurrences in all remaining buffers in -multi-buffer replacements (like the Dired @key{Q} command that performs -query replace on selected files). It answers this question and all -subsequent questions in the series with ``yes'', without further -user interaction. - -@item N @r{(Upper-case)} -to skip to the next buffer in multi-buffer replacements without -replacing remaining occurrences in the current buffer. It answers -this question ``no'', gives up on the questions for the current buffer, -and continues to the next buffer in the sequence. - @item ^ to go back to the position of the previous occurrence (or what used to be an occurrence), in case you changed it by mistake or want to @@ -1378,19 +1625,30 @@ replacement string for any further occurrences. to redisplay the screen. Then you must type another character to specify what to do with this occurrence. +@item Y @r{(Upper-case)} +to replace all remaining occurrences in all remaining buffers in +multi-buffer replacements (like the Dired @key{Q} command that performs +query replace on selected files). It answers this question and all +subsequent questions in the series with ``yes'', without further +user interaction. + +@item N @r{(Upper-case)} +to skip to the next buffer in multi-buffer replacements without +replacing remaining occurrences in the current buffer. It answers +this question ``no'', gives up on the questions for the current buffer, +and continues to the next buffer in the sequence. + @item C-h +@itemx ? +@itemx @key{F1} to display a message summarizing these options. Then you must type another character to specify what to do with this occurrence. @end table - Some other characters are aliases for the ones listed above: @kbd{y}, -@kbd{n} and @kbd{q} are equivalent to @key{SPC}, @key{DEL} and -@key{RET}. - Aside from this, any other character exits the @code{query-replace}, and is then reread as part of a key sequence. Thus, if you type @kbd{C-k}, it exits the @code{query-replace} and then kills to end of -line. +line. In particular, @kbd{C-g} simply exits the @code{query-replace}. To restart a @code{query-replace} once it is exited, use @kbd{C-x @key{ESC} @key{ESC}}, which repeats the @code{query-replace} because it @@ -1454,12 +1712,17 @@ a multi-file incremental search is activated automatically. @cindex Occur mode @cindex mode, Occur +@cindex match (face name) +@vindex list-matching-lines-default-context-lines @item M-x occur Prompt for a regexp, and display a list showing each line in the -buffer that contains a match for it. To limit the search to part of -the buffer, narrow to that part (@pxref{Narrowing}). A numeric +buffer that contains a match for it. The text that matched is +highlighted using the @code{match} face. To limit the search to part +of the buffer, narrow to that part (@pxref{Narrowing}). A numeric argument @var{n} specifies that @var{n} lines of context are to be -displayed before and after each matching line. +displayed before and after each matching line. The default number of +context lines is specified by the variable +@code{list-matching-lines-default-context-lines}. @kindex RET @r{(Occur mode)} @kindex o @r{(Occur mode)} @@ -1526,3 +1789,89 @@ it never deletes lines that are only partially contained in the region If a match is split across lines, this command keeps all those lines. @end table + +@node Search Customizations +@section Tailoring Search to Your Needs +@cindex search customizations + + This section describes miscellaneous search-related customizations +not described elsewhere. + +@cindex default search mode +@cindex search mode, default + The default search mode for the incremental search is specified by +the variable @code{search-default-regexp-mode}. It can be @code{nil}, +@code{t}, or a function. If it is @code{nil}, the default mode is to +do literal searches without character folding, but with case folding +and lax-whitespace matches as determined by @code{case-fold-search} +and @code{search-whitespace-regexp}, respectively (@pxref{Lax +Search}). If the value is @code{t}, incremental search defaults to +regexp searches. The default value specifies a function that causes +the default search mode to perform character folding in addition to +case folding and lax-whitespace matching. + +@vindex search-highlight + The current match of an on-going incremental search is highlighted +using the @code{isearch} face. This highlighting can be disabled by +setting the variable @code{search-highlight} to @code{nil}. + +@cindex lazy highlighting customizations +@vindex isearch-lazy-highlight +@cindex lazy-highlight face + The other matches for the search string that are visible on display +are highlighted using the @code{lazy-highlight} face. Setting the +variable @code{isearch-lazy-highlight} to @code{nil} disables this +highlighting. Here are some other variables that customize the lazy +highlighting: + +@table @code +@item lazy-highlight-initial-delay +Time in seconds to wait before highlighting visible matches. + +@item lazy-highlight-interval +Time in seconds between highlighting successive matches. + +@item lazy-highlight-max-at-a-time +The maximum number of matches to highlight before checking for input. +A large number can take some time to highlight, so if you want to +continue searching and type @kbd{C-s} or @kbd{C-r} during that time, +Emacs will not respond until it finishes highlighting all those +matches. Thus, smaller values make Emacs more responsive. +@end table + +@vindex search-nonincremental-instead + Normally, entering @key{RET} within incremental search when the +search string is empty launches a nonincremental search. (Actually, +it lets you edit the search string, and the next @key{RET} does the +search.) However, if you customize the variable +@code{search-nonincremental-instead} to @code{nil}, typing @key{RET} +will always exit the incremental search, even if the search string is +empty. + +@vindex isearch-hide-immediately + By default, incremental search and query-replace commands match +invisible text, but hide any such matches as soon as the current match +moves off the invisible text. If you customize the variable +@code{isearch-hide-immediately} to @code{nil}, any invisible text +where matches were found stays on display until the search or the +replace command exits. + +@cindex search display on slow terminals +@vindex search-slow-speed +@vindex search-slow-window-lines + Searching incrementally on slow terminals, such as displays +connected to remote machines over slow connection, could be annoying +due to the need to redraw large portions of the display as the search +proceeds. Emacs provides a special display mode for slow terminals, +whereby search pops up a separate small window and displays the text +surrounding the match in that window. Small windows display faster, +so the annoying effect of slow speed is alleviated. The variable +@code{search-slow-speed} determines the baud rate threshold below +which Emacs will use this display mode. The variable +@code{search-slow-window-lines} controls the number of lines in the +window Emacs pops up for displaying the search results; the default is +1 line. Normally, this window will pop up at the bottom of the window +that displays the buffer where you start searching, bit if the value +of @code{search-slow-window-lines} is negative, that means to put the +window at the top and give it the number of lines that is the absolute +value of that value. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 087681b5618..4286cfeb737 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1065,7 +1065,7 @@ send it to the developers. Sending it to recommended, because that list is coupled to a tracking system that makes it easier to locate patches. If your patch is not complete and you think it needs more discussion, you might want to send it to -@email{emacs-devel@@gnu@@gnu.org} instead. If you revise your patch, +@email{emacs-devel@@gnu.org} instead. If you revise your patch, send it as a followup to the initial topic. We prefer to get the patches as plain text, either inline (be careful diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 45a21c8e806..55fa5bcd6f0 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi @@ -716,7 +716,9 @@ The special commands of these modes bind @code{buffer-read-only} to @defvar buffer-read-only This buffer-local variable specifies whether the buffer is read-only. -The buffer is read-only if this variable is non-@code{nil}. +The buffer is read-only if this variable is non-@code{nil}. However, +characters that have the @code{inhibit-read-only} text property can +still be modified. @xref{Special Properties, inhibit-read-only}. @end defvar @defvar inhibit-read-only diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index ad248b116ed..d1ac85a7cab 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -330,7 +330,7 @@ support them, then @code{message-box} uses the echo area, like @code{message}. @end defun -@defun display-message-or-buffer message &optional buffer-name not-this-window frame +@defun display-message-or-buffer message &optional buffer-name action frame This function displays the message @var{message}, which may be either a string or a buffer. If it is shorter than the maximum height of the echo area, as defined by @code{max-mini-window-height}, it is displayed @@ -346,7 +346,7 @@ pop-up buffer is used, defaulting to @file{*Message*}. In the case where @var{message} is a string and displayed in the echo area, it is not specified whether the contents are inserted into the buffer anyway. -The optional arguments @var{not-this-window} and @var{frame} are as for +The optional arguments @var{action} and @var{frame} are as for @code{display-buffer}, and only used if a buffer is displayed. @end defun @@ -1889,12 +1889,13 @@ end of the result if it falls short of @var{width}. It is also used at the beginning of the result if one multi-column character in @var{string} extends across the column @var{start-column}. +@vindex truncate-string-ellipsis If @var{ellipsis} is non-@code{nil}, it should be a string which will replace the end of @var{string} (including any padding) if it extends beyond @var{width}, unless the display width of @var{string} is equal to or less than the display width of @var{ellipsis}. If @var{ellipsis} is non-@code{nil} and not a string, it stands for -@code{"..."}. +the value of the variable @code{truncate-string-ellipsis}. @example (truncate-string-to-width "\tab\t" 12 4) @@ -3659,6 +3660,39 @@ tag (or @code{nil}, which stands for the default langsys), and each @end table @end defun +@cindex font information for layout +The following four functions return size information about fonts used +by various faces, allowing various layout considerations in Lisp +programs. These functions take face remapping into consideration, +returning information about the remapped face, if the face in question +was remapped. @xref{Face Remapping}. + +@defun default-font-width +This function returns the average width in pixels of the font used by +the current buffer's default face. +@end defun + +@defun default-font-height +This function returns the height in pixels of the font used by the +current buffer's default face. +@end defun + +@defun window-font-width &optional window face +This function returns the average width in pixels for the font used by +@var{face} in @var{window}. The specified @var{window} must be a live +window. If @code{nil} or omitted, @var{window} defaults to the +selected window, and @var{face} defaults to the default face in +@var{window}. +@end defun + +@defun window-font-height &optional window face +This function returns the height in pixels for the font used by +@var{face} in @var{window}. The specified @var{window} must be a live +window. If @code{nil} or omitted, @var{window} defaults to the +selected window, and @var{face} defaults to the default face in +@var{window}. +@end defun + @node Fringes @section Fringes @cindex fringes diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 2d3548f65ba..56d303e2e9e 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -467,6 +467,10 @@ Control Structures * Generators:: Generic sequences and coroutines. * Nonlocal Exits:: Jumping out of a sequence. +Conditionals + +* Pattern matching case statement:: How to use @code{pcase}. + Nonlocal Exits * Catch and Throw:: Nonlocal exits for the program's own purposes. @@ -535,6 +539,7 @@ Functions * Function Cells:: Accessing or setting the function definition of a symbol. * Closures:: Functions that enclose a lexical environment. +* Advising Functions:: Adding to the definition of a function. * Obsolete Functions:: Declaring functions obsolete. * Inline Functions:: Defining functions that the compiler will expand inline. @@ -552,6 +557,13 @@ Lambda Expressions * Argument List:: Details and special features of argument lists. * Function Documentation:: How to put documentation in a function. +Advising Emacs Lisp Functions + +* Core Advising Primitives:: Primitives to manipulate advice. +* Advising Named Functions:: Advising named functions. +* Advice combinators:: Ways to compose advice. +* Porting old advice:: Adapting code using the old defadvice. + Macros * Simple Macro:: A basic example. @@ -602,6 +614,7 @@ Loading * Unloading:: How to unload a library that was loaded. * Hooks for Loading:: Providing code to be run when particular libraries are loaded. +* Dynamic Modules:: Modules provide additional Lisp primitives. Byte Compilation @@ -1191,6 +1204,10 @@ Text Properties * Not Intervals:: Why text properties do not use Lisp-visible text intervals. +Parsing HTML and XML + +* Document Object Model:: Access, manipulate and search the @acronym{DOM}. + Non-@acronym{ASCII} Characters * Text Representations:: How Emacs represents text. @@ -1530,9 +1547,12 @@ GNU Emacs Internals * Building Emacs:: How the dumped Emacs is made. * Pure Storage:: Kludge to make preloaded Lisp functions shareable. * Garbage Collection:: Reclaiming space for Lisp objects no longer used. +* Stack-allocated Objects:: Temporary conses and strings on C stack. * Memory Usage:: Info about total size of Lisp objects made so far. +* C Dialect:: What C variant Emacs is written in. * Writing Emacs Primitives:: Writing C code for Emacs. * Object Internals:: Data formats of buffers, windows, processes. +* C Integer Types:: How C integer types are used inside Emacs. Object Internals diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 067dbd2d99f..dfad9fb709d 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -780,7 +780,8 @@ to specify this function, but it is more robust to use the @deffn Command eval-buffer &optional buffer-or-name stream filename unibyte print This is similar to @code{eval-region}, but the arguments provide different optional features. @code{eval-buffer} operates on the -entire accessible portion of buffer @var{buffer-or-name}. +entire accessible portion of buffer @var{buffer-or-name} +(@pxref{Narrowing,,, emacs, The GNU Emacs Manual}). @var{buffer-or-name} can be a buffer, a buffer name (a string), or @code{nil} (or omitted), which means to use the current buffer. @var{stream} is used as in @code{eval-region}, unless @var{stream} is @@ -833,9 +834,9 @@ The value of this variable is a list of the values returned by all the expressions that were read, evaluated, and printed from buffers (including the minibuffer) by the standard Emacs commands which do this. (Note that this does @emph{not} include evaluation in -@file{*ielm*} buffers, nor evaluation using @kbd{C-j} in -@code{lisp-interaction-mode}.) The elements are ordered most recent -first. +@file{*ielm*} buffers, nor evaluation using @kbd{C-j}, @kbd{C-x C-e}, +and similar evaluation commands in @code{lisp-interaction-mode}.) The +elements are ordered most recent first. @example @group diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 9a1b2cd217f..918bf5becbd 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2030,11 +2030,6 @@ form. @end example @end defun -@defun directory-name-p filename -This function returns non-@code{nil} if @var{filename} ends with a -forward slash (@samp{/}) character. -@end defun - @node Directory Names @subsection Directory Names @cindex directory name @@ -2076,6 +2071,13 @@ string (if it does not already end in one). @end example @end defun +@defun directory-name-p filename +This function returns non-@code{nil} if @var{filename} ends with a +directory separator character. This is the forward slash @samp{/} on +Unix and GNU systems; MS-Windows and MS-DOS recognize both the forward +slash and the backslash @samp{\} as directory separators. +@end defun + @defun directory-file-name dirname This function returns a string representing @var{dirname} in a form that the operating system will interpret as the name of a file (a @@ -2632,12 +2634,20 @@ An error is signaled if @var{directory} is not the name of a directory that can be read. @end defun -@defun directory-files-recursively directory match &optional include-directories -Return all files under @var{directory} whose file names match -@var{match} recursively. The file names are returned depth first, -meaning that contents of sub-directories are returned before contents -of the directories. If @var{include-directories} is non-@code{nil}, -also return directory names that have matching names. +@defun directory-files-recursively directory regexp &optional include-directories +Return all files under @var{directory} whose names match @var{regexp}. +This function searches the specified @var{directory} and its +sub-directories, recursively, for files whose basenames (i.e., without +the leading directories) match the specified @var{regexp}, and returns +a list of the absolute file names of the matching files +(@pxref{Relative File Names, absolute file names}). The file names +are returned in depth-first order, meaning that files in some +sub-directory are returned before the files in its parent directory. +In addition, matching files found in each subdirectory are sorted +alphabetically by their basenames. By default, directories whose +names match @var{regexp} are omitted from the list, but if the +optional argument @var{include-directories} is non-@code{nil}, they +are included. @end defun @defun directory-files-and-attributes directory &optional full-name match-regexp nosort id-format diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 3ae33082fc4..80a4af29f1a 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -557,7 +557,7 @@ The top left corner of the native frame specifies the @dfn{native position} of the frame. (1)--(3) in the drawing above indicate that position for the various builds: -@itemize @w +@itemize @w{} @item (1) non-toolkit and terminal frames @item (2) Lucid, Motif and Windows frames @@ -1001,18 +1001,40 @@ parameters of @var{frame} and their values. If @var{frame} is @end defun @defun modify-frame-parameters frame alist -This function alters the parameters of frame @var{frame} based on the -elements of @var{alist}. Each element of @var{alist} has the form -@code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a -parameter. If you don't mention a parameter in @var{alist}, its value -doesn't change. If @var{frame} is @code{nil}, it defaults to the selected -frame. +This function alters the frame @var{frame} based on the elements of +@var{alist}. Each element of @var{alist} has the form +@code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming +a parameter. If you don't mention a parameter in @var{alist}, its +value doesn't change. If @var{frame} is @code{nil}, it defaults to +the selected frame. + +Some parameters are only meaningful for frames on certain kinds of +display (@pxref{Frames}). If @var{alist} includes parameters that are +not meaningful for the @var{frame}'s display, this function will +change its value in the frame's parameter list, but will otherwise +ignore it. + +When @var{alist} specifies more than one parameter whose value can +affect the new size of @var{frame}, the final size of the frame may +differ according to the toolkit used. For example, specifying that a +frame should from now on have a menu and/or tool bar instead of none and +simultaneously specifying the new height of the frame will inevitably +lead to a recalculation of the frame's height. Conceptually, in such +case, this function will try to have the explicit height specification +prevail. It cannot be excluded, however, that the addition (or removal) +of the menu or tool bar, when eventually performed by the toolkit, will +defeat this intention. + +Sometimes, binding @code{frame-inhibit-implied-resize} (@pxref{Implied +Frame Resizing}) to a non-@code{nil} value around calls to this function +may fix the problem sketched here. Sometimes, however, exactly such +binding may be hit by the problem. @end defun @defun set-frame-parameter frame parm value This function sets the frame parameter @var{parm} to the specified -@var{value}. If @var{frame} is @code{nil}, it defaults to the -selected frame. +@var{value}. If @var{frame} is @code{nil}, it defaults to the selected +frame. @end defun @defun modify-all-frames-parameters alist diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 8835667b82d..7cc041fa77e 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -861,15 +861,18 @@ into a list. @code{mapc} always returns @var{sequence}. @defun mapconcat function sequence separator @code{mapconcat} applies @var{function} to each element of -@var{sequence}: the results, which must be strings, are concatenated. -Between each pair of result strings, @code{mapconcat} inserts the string -@var{separator}. Usually @var{separator} contains a space or comma or -other suitable punctuation. +@var{sequence}; the results, which must be sequences of characters +(strings, vectors, or lists), are concatenated into a single string +return value. Between each pair of result sequences, @code{mapconcat} +inserts the characters from @var{separator}, which also must be a +string, or a vector or list of characters. @xref{Sequences Arrays +Vectors}. The argument @var{function} must be a function that can take one -argument and return a string. The argument @var{sequence} can be any -kind of sequence except a char-table; that is, a list, a vector, a -bool-vector, or a string. +argument and returns a sequence of characters: a string, a vector, or +a list. The argument @var{sequence} can be any kind of sequence +except a char-table; that is, a list, a vector, a bool-vector, or a +string. @example @group diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 387587a4203..685995b395f 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -352,16 +352,16 @@ string in Emacs Lisp. @defvar text-quoting-style @cindex curved quotes @cindex curly quotes -The value of this variable specifies the style used to generate text -quotes. If the variable's value is @code{curve}, the style is +The value of this variable is a symbol that specifies the style Emacs +should use for single quotes in the wording of help and messages. +If the variable's value is @code{curve}, the style is @t{‘like this’} with curved single quotes. If the value is @code{straight}, the style is @t{'like this'} with straight apostrophes. If the value is @code{grave}, the style is @t{`like -this'} with grave accent and apostrophe. The default value @code{nil} +this'} with grave accent and apostrophe, the standard style +before Emacs version 25. The default value @code{nil} acts like @code{curve} if curved single quotes are displayable, and -like @code{grave} otherwise. To use the traditional @code{grave} -style, put the line @code{(setq text-quoting-style 'grave)} into your -@file{~/.emacs} file. +like @code{grave} otherwise. @end defvar @defun substitute-command-keys string diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index e620da0b4ff..e111d358ba0 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -32,7 +32,9 @@ executable. You don't have to know this material to build and install Emacs, since the makefiles do all these things automatically. This information is pertinent to Emacs developers. - Compilation of the C source files in the @file{src} directory + Building Emacs requires GNU Make version 3.81 or later. + + Compilation of the C source files in the @file{src} directory produces an executable file called @file{temacs}, also called a @dfn{bare impure Emacs}. It contains the Emacs Lisp interpreter and I/O routines, but not the editing commands. diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 82de765876e..e01f3161731 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -29,7 +29,15 @@ into a buffer and evaluated there. (Indeed, most code is tested this way.) Most often, the forms are function definitions and variable definitions. -For on-demand loading of external libraries, @pxref{Dynamic Libraries}. + Emacs can also load compiled dynamic modules: shared libraries that +provide additional functionality for use in Emacs Lisp programs, just +like a package written in Emacs Lisp would. When a dynamic module is +loaded, Emacs calls a specially-named initialization function which +the module needs to implement, and which exposes the additional +functions and variables to Emacs Lisp programs. + +For on-demand loading of external libraries which are known in advance +to be required by certain Emacs primitives, @pxref{Dynamic Libraries}. @menu * How Programs Do Loading:: The @code{load} function and others. @@ -43,6 +51,7 @@ For on-demand loading of external libraries, @pxref{Dynamic Libraries}. * Unloading:: How to unload a library that was loaded. * Hooks for Loading:: Providing code to be run when particular libraries are loaded. +* Dynamic Modules:: Modules provide additional Lisp primitives. @end menu @node How Programs Do Loading @@ -1076,3 +1085,53 @@ defined in another library (those meant for outside use), you can do it immediately---there is no need to wait until the library is loaded. If you need to call functions defined by that library, you should load the library, preferably with @code{require} (@pxref{Named Features}). + +@node Dynamic Modules +@section Emacs Dynamic Modules +@cindex dynamic modules + +@c FIXME: This is intentionally incomplete, as the module integration +@c is not yet finished. To be refined later. + A @dfn{dynamic Emacs module} is a shared library that provides +additional functionality for use in Emacs Lisp programs, just like a +package written in Emacs Lisp would. + + Functions that load Emacs Lisp packages can also load dynamic +modules. They recognize dynamic modules by looking at their file-name +extension, a.k.a.@: ``suffix''. This suffix is platform-dependent. + +@defvar module-file-suffix +This variable holds the system-dependent value of the file-name +extension of the module files. Its value is @file{.so} on Posix hosts +and @file{.dll} on MS-Windows. +@end defvar + +@findex emacs_module_init +@vindex plugin_is_GPL_compatible +Every dynamic module should export a C-callable function named +@code{emacs_module_init}, which Emacs will call as part of the call to +@code{load} or @code{require} which loads the module. It should also +export a symbol named @code{plugin_is_GPL_compatible} to indicate that +its code is released under the GPL or compatible license; Emacs will +refuse to load modules that don't export such a symbol. + +If a module needs to call Emacs functions, it should do so through the +API defined and documented in the header file @file{emacs-module.h} +that is part of the Emacs distribution. + +@cindex user-ptr object +Modules can create @code{user-ptr} Lisp objects that embed pointers to +C struct's defined by the module. This is useful for keeping around +complex data structures created by a module, to be passed back to the +module's functions. User-ptr objects can also have associated +@dfn{finalizers} -- functions to be run when the object is GC'ed; this +is useful for freeing any resources allocated for the underlying data +structure, such as memory, open file descriptors, etc. + +@defun user-ptrp object +This function returns @code{t} if its argument is a @code{user-ptr} +object. +@end defun + +Loadable modules in Emacs are enabled by using the +@kbd{--with-modules} option at configure time. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index a1747707d11..3b8550e13b9 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2509,6 +2509,53 @@ Search-based fontification happens second. @node Font Lock Basics @subsection Font Lock Basics + The Font Lock functionality is based on several basic functions. +Each of these calls the function specified by the corresponding +variable. This indirection allows major modes to modify the way +fontification works in the buffers of that mode, and even use the Font +Lock mechanisms for features that have nothing to do with +fontification. (This is why the description below says ``should'' +when it describes what the functions do: the major mode can customize +the values of the corresponding variables to do something entirely +different.) The variables mentioned below are described in @ref{Other +Font Lock Variables}. + +@ftable @code +@item font-lock-fontify-buffer +This function should fontify the current buffer's accessible portion, +by calling the function specified by +@code{font-lock-fontify-buffer-function}. + +@item font-lock-unfontify-buffer +Used when turning Font Lock off to remove the fontification. Calls +the function specified by @code{font-lock-unfontify-buffer-function}. + +@item font-lock-fontify-region beg end &optional loudly +Should fontify the region between @var{beg} and @var{end}. If +@var{loudly} is non-@code{nil}, should display status messages while +fontifying. Calls the function specified by +@code{font-lock-fontify-region-function}. + +@item font-lock-unfontify-region beg end +Should remove fontification from the region between @var{beg} and +@var{end}. Calls the function specified by +@code{font-lock-unfontify-region-function}. + +@item font-lock-flush &optional beg end +This function should mark the fontification of the region between +@var{beg} and @var{end} as outdated. If not specified or @code{nil}, +@var{beg} and @var{end} default to the beginning and end of the +buffer's accessible portion. Calls the function specified by +@code{font-lock-flush-function}. + +@item font-lock-ensure &optional beg end +This function should make sure the region between @var{beg} and +@var{end} has been fontified. The optional arguments @var{beg} and +@var{end} default to the beginning and the end of the buffer's +accessible portion. Calls the function specified by +@code{font-lock-ensure-function}. +@end ftable + There are several variables that control how Font Lock mode highlights text. But major modes should not set any of these variables directly. Instead, they should set @code{font-lock-defaults} as a buffer-local @@ -2936,6 +2983,22 @@ arguments, the beginning and end of the region. The default value is @code{font-lock-default-unfontify-region}. @end defvar +@defvar font-lock-flush-function +Function to use for declaring that a region's fontification is out of +date. It takes two arguments, the beginning and end of the region. +The default value of this variable is +@code{font-lock-after-change-function}. +@end defvar + +@defvar font-lock-ensure-function +Function to use for making sure a region of the current buffer has +been fontified. It is called with two arguments, the beginning and +end of the region. The default value of this variable is a function +that calls @code{font-lock-default-fontify-buffer} if the buffer is +not fontified; the effect is to make sure the entire accessible +portion of the buffer is fontified. +@end defvar + @defun jit-lock-register function &optional contextual This function tells Font Lock mode to run the Lisp function @var{function} any time it has to fontify or refontify part of the diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 17a0b47ad06..92e3ee2b33c 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -902,6 +902,9 @@ Hewlett-Packard HPUX operating system. @item irix Silicon Graphics Irix system. +@item nacl +Google Native Client (@acronym{NaCl}) sandboxing system. + @item ms-dos Microsoft's DOS@. Emacs compiled with DJGPP for MS-DOS binds @code{system-type} to @code{ms-dos} even when you run it on MS-Windows. @@ -911,7 +914,7 @@ AT&T Unix System V. @item windows-nt Microsoft Windows NT, 9X and later. The value of @code{system-type} -is always @code{windows-nt}, e.g., even on Windows 7. +is always @code{windows-nt}, e.g., even on Windows 10. @end table @@ -2922,6 +2925,18 @@ means complete; it is intended to give you an idea of the security issues involved, rather than to be a security checklist. @table @asis +@item File local variables +@cindex file local variables +A file that Emacs visits can contain variable settings that affects +the buffer visiting that file; @xref{File Local Variables}. +Similarly, a directory can specify local variable values common to all +files in that directory; @xref{Directory Local Variables}. Although +Emacs takes some effort to protect against misuse of these variables, +a security hole can be created merely by a package setting +@code{safe-local-variable} too optimistically, a problem that is all +too common. To disable this feature for both files and directories, +set @code{enable-local-variables} to @code{nil}. + @item Access control Although Emacs normally respects access permissions of the underlying operating system, in some cases it handles accesses specially. For diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 72b76ce5c8f..9daf5cef059 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -572,6 +572,18 @@ The value returned is the window line number point has moved to, with the top line in the window numbered 0. @end deffn +@vindex move-to-window-group-line-function +@defun move-to-window-group-line count +This function is like @code{move-to-window-line}, except that when the +selected window is a part of a group of windows (@pxref{Window +Group}), @code{move-to-window-group-line} will move to a position with +respect to the entire group, not just the single window. This +condition holds when the buffer local variable +@code{move-to-window-group-line-function} is set to a function. In +this case, @code{move-to-window-group-line} calls the function with +the argument @var{count}, then returns its result. +@end defun + @defun compute-motion from frompos to topos width offsets window This function scans the current buffer, calculating screen positions. It scans the buffer forward from position @var{from}, assuming that is diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 0ce696ad533..41255e7e8d0 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -737,10 +737,12 @@ If @var{stopped} is non-@code{nil}, start the process in the stopped state. @item :filter @var{filter} -Initialize the process filter to @var{filter}. +Initialize the process filter to @var{filter}. If not specified, a +default filter will be provided. @xref{Filter Functions}. @item :sentinel @var{sentinel} -Initialize the process sentinel to @var{sentinel}. +Initialize the process sentinel to @var{sentinel}. If not specified, +a default sentinel will be used. @xref{Sentinels}. @item :stderr @var{stderr} Associate @var{stderr} with the standard error of the process. @@ -789,10 +791,12 @@ If @var{stopped} is non-@code{nil}, start the process in the stopped state. @item :filter @var{filter} -Initialize the process filter to @var{filter}. +Initialize the process filter to @var{filter}. If not specified, a +default filter will be provided. @xref{Filter Functions}. @item :sentinel @var{sentinel} -Initialize the process sentinel to @var{sentinel}. +Initialize the process sentinel to @var{sentinel}. If not specified, +a default sentinel will be used. @xref{Sentinels}. @end table The original argument list, modified with the actual connection @@ -922,9 +926,10 @@ For a network process, the values include (see @item :buffer The associated value is the process buffer. @item :filter -The associated value is the process filter function. +The associated value is the process filter function. @xref{Filter +Functions}. @item :sentinel -The associated value is the process sentinel function. +The associated value is the process sentinel function. @xref{Sentinels}. @item :remote In a connection, the address in internal format of the remote peer. @item :local @@ -1379,6 +1384,7 @@ subprocess with a @code{SIGHUP} signal (@pxref{Signals to Processes}). @cindex filter function @cindex process filter +@cindex default filter function of a process A process @dfn{filter function} is a function that receives the standard output from the associated process. @emph{All} output from that process is passed to the filter. The default filter simply @@ -1632,21 +1638,43 @@ also called if the process exits. The sentinel receives two arguments: the process for which the event occurred, and a string describing the type of event. +@cindex default sentinel function of a process + If no sentinel function was specified for a process, it will use the +default sentinel function, which inserts a message in the process's +buffer with the process name and the string describing the event. + The string describing the event looks like one of the following: -@c FIXME? Also "killed\n" - see example below? @itemize @bullet @item @code{"finished\n"}. @item -@code{"exited abnormally with code @var{exitcode}\n"}. +@code{"deleted\n"}. + +@item +@code{"exited abnormally with code @var{exitcode} (core dumped)\n"}. +The ``core dumped'' part is optional, and only appears if the process +dumped core. + +@item +@code{"failed with code @var{fail-code}\n"}. + +@item +@code{"@var{signal-description} (core dumped)\n"}. The +@var{signal-description} is a system-dependent textual description of +a signal, e.g., @code{"killed"} for @code{SIGKILL}. The ``core +dumped'' part is optional, and only appears if the process dumped +core. + +@item +@code{"open from @var{host-name}\n"}. @item -@code{"@var{name-of-signal}\n"}. +@code{"open\n"}. @item -@code{"@var{name-of-signal} (core dumped)\n"}. +@code{"connection broken by remote peer\n"}. @end itemize A sentinel runs only while Emacs is waiting (e.g., for terminal diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index f8685d9312c..8aa4539bd78 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -465,6 +465,7 @@ Representations}. @code{string-equal} is another name for @code{string=}. @end defun +@cindex locale-dependent string equivalence @defun string-collate-equalp string1 string2 &optional locale ignore-case This function returns @code{t} if @var{string1} and @var{string2} are equal with respect to collation rules. A collation rule is not only @@ -493,6 +494,7 @@ systems. If @var{ignore-case} is non-@code{nil}, characters are converted to lower-case before comparing them. +@vindex w32-collate-ignore-punctuation To emulate Unicode-compliant collation on MS-Windows systems, bind @code{w32-collate-ignore-punctuation} to a non-@code{nil} value, since the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows. @@ -518,7 +520,7 @@ optional argument @var{ignore-case} is non-@code{nil}, the comparison ignores case differences. @end defun -@cindex lexical comparison +@cindex lexical comparison of strings @defun string< string1 string2 @c (findex string< causes problems for permuted index!!) This function compares two strings a character at a time. It @@ -576,6 +578,7 @@ are used. @code{string-lessp} is another name for @code{string<}. @end defun +@cindex locale-dependent string comparison @defun string-collate-lessp string1 string2 &optional locale ignore-case This function returns @code{t} if @var{string1} is less than @var{string2} in collation order. A collation order is not only @@ -594,15 +597,15 @@ for sorting (@pxref{Sequence Functions}): @end group @end example -This behavior is system-dependent; punctuation and whitespace are -never ignored on Cygwin, regardless of locale. +This behavior is system-dependent; e.g., punctuation and whitespace +are never ignored on Cygwin, regardless of locale. The optional argument @var{locale}, a string, overrides the setting of your current locale identifier for collation. The value is system dependent; a @var{locale} @code{"en_US.UTF-8"} is applicable on POSIX systems, while it would be, e.g., @code{"enu_USA.1252"} on MS-Windows -systems. The @var{locale} @code{"POSIX"} lets @code{string-collate-lessp} -behave like @code{string-lessp}: +systems. The @var{locale} value of @code{"POSIX"} or @code{"C"} lets +@code{string-collate-lessp} behave like @code{string-lessp}: @example @group diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index 7a984e3d87b..831ebd12f55 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -945,6 +945,14 @@ whitespace by the functions in this section and by @code{forward-sexp}, The behavior of @code{parse-partial-sexp} is also affected by @code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}). +@defvar comment-end-can-be-escaped +If this buffer local variable is non-@code{nil}, a single character +which usually terminates a comment doesn't do so when that character +is escaped. This is used in C and C++ Modes, where line comments +starting with @samp{//} can be continued onto the next line by +escaping the newline with @samp{\}. +@end defvar + You can use @code{forward-comment} to move forward or backward over one comment or several comments. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 6d9d26f0ad1..f3679a88f74 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -899,13 +899,25 @@ adds it to the most recent element. It determines automatically (using @code{last-command}) whether the previous command was a kill command, and if so appends the killed text to the most recent entry. -@deffn Command kill-region start end -This function kills the text in the region defined by @var{start} and -@var{end}. The text is deleted but saved in the kill ring, along with -its text properties. The value is always @code{nil}. +@cindex filtering killed text + The commands described below can filter the killed text before they +save it in the kill ring. They call @code{filter-buffer-substring} +(@pxref{Buffer Contents}) to perform the filtering. By default, +there's no filtering, but major and minor modes and hook functions can +set up filtering, so that text saved in the kill ring is different +from what was in the buffer. + +@deffn Command kill-region start end &optional region +This function kills the stretch of text between @var{start} and +@var{end}; but if the optional argument @var{region} is +non-@code{nil}, it ignores @var{start} and @var{end}, and kills the +text in the current region instead. The text is deleted but saved in +the kill ring, along with its text properties. The value is always +@code{nil}. In an interactive call, @var{start} and @var{end} are point and -the mark. +the mark, and @var{region} is always non-@code{nil}, so the command +always kills the text in the current region. If the buffer or text is read-only, @code{kill-region} modifies the kill ring just the same, then signals an error without modifying the buffer. @@ -919,18 +931,20 @@ error if the buffer or text is read-only. Instead, it simply returns, updating the kill ring but not changing the buffer. @end defopt -@deffn Command copy-region-as-kill start end -This command saves the region defined by @var{start} and @var{end} on -the kill ring (including text properties), but does not delete the text -from the buffer. It returns @code{nil}. +@deffn Command copy-region-as-kill start end &optional region +This function saves the stretch of text between @var{start} and +@var{end} on the kill ring (including text properties), but does not +delete the text from the buffer. However, if the optional argument +@var{region} is non-@code{nil}, the function ignores @var{start} and +@var{end}, and saves the current region instead. It always returns +@code{nil}. + +In an interactive call, @var{start} and @var{end} are point and +the mark, and @var{region} is always non-@code{nil}, so the command +always saves the text in the current region. The command does not set @code{this-command} to @code{kill-region}, so a subsequent kill command does not append to the same kill ring entry. - -@c FIXME Why is it better? Why isn't copy-region-as-kill obsolete then? -@c Why is it used in many places in Emacs? -In Lisp programs, it is better to use @code{kill-new} or -@code{kill-append} instead of this command. @xref{Low-Level Kill Ring}. @end deffn @node Yanking @@ -1343,27 +1357,39 @@ This function places a boundary element in the undo list. The undo command stops at such a boundary, and successive undo commands undo to earlier and earlier boundaries. This function returns @code{nil}. -The editor command loop automatically calls @code{undo-boundary} just -before executing each key sequence, so that each undo normally undoes -the effects of one command. As an exception, the command -@code{self-insert-command}, which produces self-inserting input -characters (@pxref{Commands for Insertion}), may remove the boundary -inserted by the command loop: a boundary is accepted for the first -such character, the next 19 consecutive self-inserting input -characters do not have boundaries, and then the 20th does; and so on -as long as the self-inserting characters continue. Hence, sequences -of consecutive character insertions can be undone as a group. - -All buffer modifications add a boundary whenever the previous undoable -change was made in some other buffer. This is to ensure that -each command makes a boundary in each buffer where it makes changes. - Calling this function explicitly is useful for splitting the effects of a command into more than one unit. For example, @code{query-replace} calls @code{undo-boundary} after each replacement, so that the user can undo individual replacements one by one. + +Mostly, however, this function is called automatically at an +appropriate time. +@end defun + +@defun undo-auto-amalgamate +@cindex amalgamating commands, and undo +The editor command loop automatically calls @code{undo-boundary} just +before executing each key sequence, so that each undo normally undoes +the effects of one command. A few exceptional commands are +@dfn{amalgamating}: these commands generally cause small changes to +buffers, so with these a boundary is inserted only every 20th command, +allowing to undo them as a group. By default, commands +@code{self-insert-command}, which produces self-inserting input +characters (@pxref{Commands for Insertion}), and @code{delete-char} +which deletes characters (@pxref{Deletion}) are amalgamating. +Where a command affects the contents of several buffers, as may happen, +for example, when a function on the @code{post-command-hook} affects a +buffer other than the @code{current-buffer}, then @code{undo-boundary} +will be called in each of the affected buffers. @end defun +@defvar undo-auto-current-boundary-timer +Some buffers, such as process buffers, can change even when no +commands are executing. In these cases, @code{undo-boundary} is +normally called periodically by the timer in this variable. Setting +this variable to non-@code{nil} prevents this behavior. +@end defvar + @defvar undo-in-progress This variable is normally @code{nil}, but the undo commands bind it to @code{t}. This is so that various kinds of change hooks can tell when @@ -2336,6 +2362,84 @@ already indented, it calls @code{completion-at-point} to complete the text at point (@pxref{Completion in Buffers}). @end defopt +@cindex literate programming +@cindex multi-mode indentation + Some major modes need to support embedded regions of text whose +syntax belongs to a different major mode. Examples include +@dfn{literate programming} source files that combine documentation and +snippets of source code, Yacc/Bison programs that include snippets of +plain C code, etc. To correctly indent the embedded chunks, the major +mode needs to delegate the indentation to another mode's indentation +engine (e.g., call @code{c-indent-defun} for C code or +@code{python-indent-line} for Python), while providing it with some +context to guide the indentation. The following facilities support +such multi-mode indentation. + +@defvar prog-indentation-context +This variable, when non-@code{nil}, holds the indentation context for +the sub-mode's indentation engine provided by the superior major mode. +The value should be a list of the form @code{(@var{first-column} +@w{(@var{start} . @var{end})} @code{prev-chunk})}. The members of the +list have the following meaning: + +@table @var +@item first-column +The column to be used for top-level constructs. This replaces the +default value of the top-level column used by the sub-mode, usually +zero. +@item start +@itemx end +The region of the code chunk to be indented by the sub-mode. The +value of @var{end} can be @code{nil}, which stands for the value of +@code{point-max}. +@item prev-chunk +If this is non-@code{nil}, it should provide the sub-mode's +indentation engine with a virtual context of the code chunk. Valid +values include: + +@itemize @minus +@item +A string whose contents is the text the sub-mode's indentation engine +should consider to precede the code chunk. The sub-mode's indentation +engine can add text properties to that string, to be reused in +repeated calls with the same string, thus using it as a cache. An +example where this is useful is code chunks that need to be indented +as function bodies, but lack the function's preamble---the string +could then include that missing preamble. +@item +A function. It is expected to be called with the start position of +the current chunk, and should return a cons cell +@w{@code{(@var{prev-start} . @var{prev-end})}} that specifies the +region of the previous code chunk, or @code{nil} if there is no previous +chunk. This is useful in literate-programming sources, where code is +split into chunks, and correct indentation needs to access previous +chunks. +@end itemize +@end table +@end defvar + +The following convenience functions should be used by major mode's +indentation engine in support of invocations as sub-modes of another +major mode. + +@defun prog-first-column +Call this function instead of using a literal value (usually, zero) of +the column number for indenting top-level program constructs. The +function's value is the column number to use for top-level constructs. +When no superior mode is in effect, this function returns zero. +@end defun + +@defun prog-widen +Call this function instead of @code{widen} to remove any restrictions +imposed by the mode's indentation engine and restore the restrictions +recorded in @code{prog-indentation-context}. This prevents the +indentation engine of a sub-mode from inadvertently operating on text +outside of the chunk it was supposed to indent, and preserves the +restriction imposed by the superior mode. When no superior mode is in +effect, this function just calls @code{widen}. +@end defun + + @node Region Indent @subsection Indenting an Entire Region @@ -3256,8 +3360,8 @@ and then remove the property. @xref{Read Only Buffers}. @item inhibit-read-only @kindex inhibit-read-only @r{(text property)} -If a character has the property @code{inhibit-read-only}, and the -buffer is read-only, editing the character in question is allowed. +Characters that have the property @code{inhibit-read-only} can be +edited even in read-only buffers. @xref{Read Only Buffers}. @item invisible @kindex invisible @r{(text property)} diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index d9cbf473306..ffce920bf4e 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -14,11 +14,17 @@ it gives advice on making effective use of the features described in the previous chapters, and describes conventions Emacs Lisp programmers should follow. +@findex checkdoc +@findex checkdoc-current-buffer +@findex checkdoc-file You can automatically check some of the conventions described below by running the command @kbd{M-x checkdoc RET} when visiting a Lisp file. It cannot check all of the conventions, and not all the warnings it gives necessarily correspond to problems, but it is worth examining them -all. +all. Alternatively, use the command @kbd{M-x checkdoc-current-buffer RET} +to check the conventions in the current buffer, or @code{checkdoc-file} +when you want to check a file in batch mode, e.g., with a command run by +@kbd{@w{M-x compile RET}}. @menu * Coding Conventions:: Conventions for clean and robust programs. @@ -1007,8 +1013,14 @@ of multiple files, we recommend not writing the version in every file, but only the main one. @item Keywords +@vindex checkdoc-package-keywords-flag +@findex checkdoc-package-keywords This line lists keywords for the @code{finder-by-keyword} help command. -Please use that command to see a list of the meaningful keywords. +Please use that command to see a list of the meaningful keywords. The +command @kbd{M-x checkdoc-package-keywords RET} will find and display +any keywords that are not in @code{finder-known-keywords}. If you set +the variable @code{checkdoc-package-keywords-flag} non-@code{nil}, +checkdoc commands will include the keyword verification in its checks. This field is how people will find your package when they're looking for things by topic. To separate the keywords, you can use spaces, diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 357247ef433..e45201b0570 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -133,6 +133,30 @@ This function returns the selected window (which is always a live window). @end defun +@anchor{Window Group}Sometimes several windows collectively and +cooperatively display a buffer, for example, under the management of +Follow Mode (@pxref{Follow Mode,,, emacs}), where the windows together +display a bigger portion of the buffer than one window could alone. +It is often useful to consider such a @dfn{window group} as a single +entity. Several functions such as @code{window-group-start} +(@pxref{Window Start and End}) allow you to do this by supplying, as +an argument, one of the windows as a stand in for the whole group. + +@defun selected-window-group +@vindex selected-window-group-function +When the selected window is a member of a group of windows, this +function returns a list of the windows in the group, ordered such that +the first window in the list is displaying the earliest part of the +buffer, and so on. Otherwise the function returns a list containing +just the selected window. + +The selected window is considered part of a group when the buffer +local variable @code{selected-window-group-function} is set to a +function. In this case, @code{selected-window-group} calls it with no +arguments and returns its result (which should be the list of windows +in the group). +@end defun + @node Windows and Frames @section Windows and Frames @@ -521,9 +545,9 @@ its pixel height is the pixel height of the screen areas spanned by its children. @end defun -@cindex window pixel height -@cindex pixel height of a window -@cindex total pixel height of a window +@cindex window pixel width +@cindex pixel width of a window +@cindex total pixel width of a window @defun window-pixel-width &optional Lisp_Object &optional window This function returns the width of window @var{window} in pixels. @@ -558,7 +582,6 @@ that of the root window on that frame. If @var{window} is omitted or @cindex window body height @cindex body height of a window -@cindex window body width The @dfn{body height} of a window is the height of its text area, which does not include a mode or header line, a horizontal scroll bar, or a bottom divider. @@ -578,9 +601,8 @@ counted. It also means that the height of a window's body can never exceed its total height as returned by @code{window-total-height}. @end defun +@cindex window body width @cindex body width of a window -@cindex body size of a window -@cindex window body size The @dfn{body width} of a window is the width of its text area, which does not include the scroll bar, fringes, margins or a right divider. @@ -599,6 +621,8 @@ counted. It also means that the width of a window's body can never exceed its total width as returned by @code{window-total-width}. @end defun +@cindex window body size +@cindex body size of a window @defun window-body-size &optional window horizontal pixelwise This function returns the body height or body width of @var{window}. If @var{horizontal} is omitted or @code{nil}, it is equivalent to calling @@ -607,7 +631,7 @@ to calling @code{window-body-width}. In either case, the optional argument @var{pixelwise} is passed to the function called. @end defun - For compatibility with previous versions of Emacs, +For compatibility with previous versions of Emacs, @code{window-height} is an alias for @code{window-total-height}, and @code{window-width} is an alias for @code{window-body-width}. These aliases are considered obsolete and will be removed in the future. @@ -635,6 +659,22 @@ Functions for retrieving the height and/or width of window dividers (@pxref{Scroll Bars}), and display margins (@pxref{Display Margins}) are described in the corresponding sections. +If your Lisp program needs to make layout decisions, you will find the +following function useful: + +@defun window-max-chars-per-line &optional window face +This function returns the number of characters displayed in the +specified @var{face} in the specified @var{window} (which must be a +live window). If @var{face} was remapped (@pxref{Face Remapping}), +the information is returned for the remapped face. If omitted or +@code{nil}, @var{face} defaults to the default face, and @var{window} +defaults to the selected window. Unlike @code{window-body-width}, +this function accounts for the actual size of the @var{face}'s font, +instead of working in units of frame's canonical character width. It +also accounts for space used by the continuation glyph, if +@var{window} lacks one or both of its fringes. +@end defun + @cindex fixed-size window @vindex window-min-height @vindex window-min-width @@ -643,7 +683,7 @@ or split them (@pxref{Splitting Windows}), obey the variables @code{window-min-height} and @code{window-min-width}, which specify the smallest allowable window height and width. They also obey the variable @code{window-size-fixed}, with which a window can be @dfn{fixed} in -size: +size (@pxref{Preserving Window Sizes}). @defopt window-min-height This option specifies the minimum total height, in lines, of any window. @@ -3082,6 +3122,17 @@ window-start position; if you move point, do not expect the window-start position to change in response until after the next redisplay. @end defun +@defun window-group-start &optional window +@vindex window-group-start-function +This function is like @code{window-start}, except that when +@var{window} is a part of a group of windows (@pxref{Window Group}), +@code{window-group-start} returns the start position of the entire +group. This condition holds when the buffer local variable +@code{window-group-start-function} is set to a function. In this +case, @code{window-group-start} calls the function with the single +argument @var{window}, then returns its result. +@end defun + @cindex window end position @defun window-end &optional window update This function returns the position where display of its buffer ends in @@ -3108,6 +3159,18 @@ way real redisplay would do. It does not alter the text will end if scrolling is not required. @end defun +@vindex window-group-end-function +@defun window-group-end window update +This function is like @code{window-end}, except that when @var{window} +is a part of a group of windows (@pxref{Window Group}), +@code{window-group-end} returns the end position of the entire group. +This condition holds when the buffer local variable +@code{window-group-end-function} is set to a function. In this case, +@code{window-group-end} calls the function with the two arguments +@var{window} and @var{update}, then returns its result. The argument +@var{update} has the same meaning as in @code{window-end}. +@end defun + @defun set-window-start window position &optional noforce This function sets the display-start position of @var{window} to @var{position} in @var{window}'s buffer. It returns @var{position}. @@ -3171,6 +3234,19 @@ off screen at the next redisplay, then redisplay computes a new window-start position that works well with point, and thus @var{position} is not used. @end defun +@vindex set-window-group-start-function +@defun set-window-group-start window position &optional noforce +This function is like @code{set-window-start}, except that when +@var{window} is a part of a group of windows (@pxref{Window Group}), +@code{set-window-group-start} sets the start position of the entire +group. This condition holds when the buffer local variable +@code{set-window-group-start-function} is set to a function. In this +case, @code{set-window-group-start} calls the function with the three +arguments @var{window}, @var{position}, and @var{noforce}, then +returns its result. The arguments @var{position} and @var{noforce} in +this function have the same meaning as in @code{set-window-start}. +@end defun + @defun pos-visible-in-window-p &optional position window partially This function returns non-@code{nil} if @var{position} is within the range of text currently visible on the screen in @var{window}. It @@ -3212,6 +3288,21 @@ Here is an example: @end example @end defun +@vindex pos-visible-in-window-group-p-function +@defun pos-visible-in-window-group-p &optional position window partially +This function is like @code{pos-visible-in-window-p}, except that when +@var{window} is a part of a group of windows (@pxref{Window Group}), +@code{pos-visible-in-window-group-p} tests the visibility of @var{pos} +in the entire group, not just in the single @var{window}. This +condition holds when the buffer local variable +@code{pos-visible-in-window-group-p-function} is set to a function. +In this case @code{pos-visible-in-window-group-p} calls the function +with the three arguments @var{position}, @var{window}, and +@var{partially}, then returns its result. The arguments +@var{position} and @var{partially} have the same meaning as in +@code{pos-visible-in-window-p}. +@end defun + @defun window-line-height &optional line window This function returns the height of text line @var{line} in @var{window}. If @var{line} is one of @code{header-line} or @@ -3455,6 +3546,19 @@ the top of the window. The command @code{recenter-top-bottom} offers a more convenient way to achieve this. @end deffn +@vindex recenter-window-group-function +@defun recenter-window-group &optional count +This function is like @code{recenter}, except that when the selected +window is part of a group of windows (@pxref{Window Group}), +@code{recenter-window-group} scrolls the entire group. This condition +holds when the buffer local variable +@code{recenter-window-group-function} is set to a function. In this +case, @code{recenter-window-group} calls the function with the +argument @var{count}, then returns its result. The argument +@var{count} has the same meaning as in @code{recenter}, but with +respect to the entire window group. +@end defun + @defopt recenter-redisplay If this variable is non-@code{nil}, calling @code{recenter} with a @code{nil} argument redraws the frame. The default value is @@ -4264,10 +4368,10 @@ work. @end defvar @defvar window-size-change-functions -This variable holds a list of functions to be called if the size of any -window changes for any reason. The functions are called just once per -redisplay, and just once for each frame on which size changes have -occurred. +This variable holds a list of functions to be called if the size of +any window changes for any reason. The functions are called at the +beginning of a redisplay cycle, and just once for each frame on which +size changes have occurred. Each function receives the frame as its sole argument. There is no direct way to find out which windows on that frame have changed size, or diff --git a/doc/man/etags.1 b/doc/man/etags.1 index fab8901427d..7cb6b6cb6ab 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 @@ -51,7 +51,7 @@ format understood by \&. Both forms of the program understand the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, Forth, HTML, LaTeX, Emacs Lisp/Common Lisp, Lua, Makefile, Pascal, Perl, -PHP, PostScript, Python, Prolog, Scheme and +Ruby, PHP, PostScript, Python, Prolog, Scheme and most assembler\-like syntaxes. Both forms read the files specified on the command line, and write a tag table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 8579d0f16f5..02f94469c71 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -12597,7 +12597,6 @@ in this mode. Explicit simplification commands, such as @kbd{=} or @xref{Algebraic Definitions}, for a sample use of No-Simplification mode. - @kindex m N @pindex calc-num-simplify-mode The @kbd{m N} (@code{calc-num-simplify-mode}) command turns off simplification @@ -22463,7 +22462,6 @@ Hyperbolic prefix @kbd{H} can be used similarly; the @kbd{H a s} will replace any hyperbolic functions in the formula with the appropriate combinations of @samp{sinh}s and @samp{cosh}s before simplifying. - @menu * Basic Simplifications:: * Algebraic Simplifications:: @@ -28032,7 +28030,7 @@ column of the Units Table. @noindent The definitions of many units have changed over the years. For example, the meter was originally defined in 1791 as one ten-millionth of the -distance from the equator to the north pole. In order to be more +distance from the Equator to the North Pole. In order to be more precise, the definition was adjusted several times, and now a meter is defined as the distance that light will travel in a vacuum in 1/299792458 of a second; consequently, the speed of light in a @@ -28071,13 +28069,8 @@ of the various temperature scales. The unit of volume ``liters'' can be referred to by either the lower-case @code{l} or the upper-case @code{L}. -The unit @code{A} stands for Amperes; the name @code{Ang} is used -@tex -for \AA ngstroms. -@end tex -@ifnottex -for Angstroms. -@end ifnottex +The unit @code{A} stands for amperes; the name @code{Ang} is used +for angstroms. The unit @code{pt} stands for pints; the name @code{point} stands for a typographical point, defined by @samp{72 point = 1 in}. This is @@ -28099,7 +28092,6 @@ use the @samp{tex} prefix; the unit name for a @TeX{} point will be the unit names for pint and parsec will simply be @samp{pint} and @samp{parsec} instead of @samp{pt} and @samp{pc}. - The unit @code{e} stands for the elementary (electron) unit of charge; because algebra command could mistake this for the special constant @expr{e}, Calc provides the alternate unit name @code{ech} which is @@ -28496,7 +28488,6 @@ a frequency or a midi number to scientific pitch notation. For example, @code{500 Hz} gets converted to @code{B_4 + 21.3094853649 cents} and @code{84} to @code{C_6}. - @kindex l m @pindex calc-midi @tindex midi @@ -28527,7 +28518,6 @@ notation @code{B_3 + 99.9962592773 cents}; with the default value of @code{1}, Calc converts @code{261.625 Hz} to @code{C_4}. - @node Store and Recall, Graphics, Units, Top @chapter Storing and Recalling @@ -29907,7 +29897,7 @@ The @kbd{C-y} command can be given a prefix, which will interpret the text being yanked with a different radix. If the text being yanked can be interpreted as a binary, octal, hexadecimal, or decimal number, then a prefix of @kbd{2}, @kbd{8}, @kbd{6} or @kbd{0} will have Calc -interpret the yanked text as a number in the appropriate base. For example, +interpret the yanked text as a number in the appropriate base. For example, if @samp{111} has just been killed and is yanked into Calc with a command of @kbd{C-2 C-y}, then the number @samp{7} will be put on the stack. If you use the plain prefix @kbd{C-u}, then you will be prompted for a diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 9b488cb3125..7415da5d5bd 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -2461,7 +2461,7 @@ handled a little differently from the other style variables. It's default global binding is the empty list @code{nil}, rather than @code{set-from-style}. Before the style system is initialized, you can add individual elements to @code{c-offsets-alist} by calling -@code{c-set-offset}(@pxref{c-offsets-alist}) just like you would set +@code{c-set-offset} (@pxref{c-offsets-alist}) just like you would set other style variables with @code{setq}. Those elements will then prevail when the style system later initializes a buffer-local copy of @code{c-offsets-alist}. @@ -5234,13 +5234,13 @@ This command changes the entry for a syntactic symbol in the current binding of @code{c-offsets-alist}, or it inserts a new entry if there isn't already one for that syntactic symbol. -You can use @code{c-set-offsets} interactively within a @ccmode{} +You can use @code{c-set-offset} interactively within a @ccmode{} buffer to make experimental changes to your indentation settings. @kbd{C-c C-o} prompts you for the syntactic symbol to change (defaulting to that of the current line) and the new offset (defaulting to the current offset). -@code{c-set-offsets} takes two arguments when used programmatically: +@code{c-set-offset} takes two arguments when used programmatically: @var{symbol}, the syntactic element symbol to change and @var{offset}, the new offset for that syntactic element. You can call the command in your @file{.emacs} to change the global binding of diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 1f38ca98c62..0ab2477b86d 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -2937,7 +2937,7 @@ error if the argument is not an integer. @defun cl-digit-char-p char radix Test if @var{char} is a digit in the specified @var{radix} (default is -10). If true return the decimal value of digit @var{char} in +10). If it is, return the numerical value of digit @var{char} in @var{radix}. @end defun @@ -3027,9 +3027,10 @@ of @code{cl-truncate}. This function implements the Common Lisp @code{parse-integer} function. It parses an integer in the specified @var{radix} from the substring of @var{string} between @var{start} and @var{end}. Any -leading and trailing whitespace chars are ignored. It signals an error -if the substring between @var{start} and @var{end} cannot be parsed as -an integer unless @var{junk-allowed} is non-nil. +leading and trailing whitespace chars are ignored. The function +signals an error if the substring between @var{start} and @var{end} +cannot be parsed as an integer, unless @var{junk-allowed} is +non-@code{nil}. @end defun @node Random Numbers diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 35d315c64b8..c2363237b97 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -283,6 +283,15 @@ with a zero exit status if all tests passed, or nonzero if any tests failed or if anything else went wrong. It will also print progress messages and error diagnostics to standard output. +You can also redirect the above output to a log file, say +@file{output.log}, and use the +@code{ert-summarize-tests-batch-and-exit} function to produce a neat +summary as shown below: + +@example +emacs -batch -l ert -f ert-summarize-tests-batch-and-exit output.log +@end example + If ERT is not part of your Emacs distribution, you may need to use @code{-L /path/to/ert/} so that Emacs can find it. You may need additional @code{-L} flags to ensure that @code{my-tests.el} and all the diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi index 33c9a0eb3a9..8d59e97b44e 100644 --- a/doc/misc/eudc.texi +++ b/doc/misc/eudc.texi @@ -9,11 +9,10 @@ @c %**end of header @copying -This file documents EUDC v1.30b. +This file documents EUDC version 1.40.0. EUDC is the Emacs Unified Directory Client, a common interface to -directory servers using various protocols such as LDAP or the CCSO white -pages directory system (PH/QI) +directory servers and contact information. Copyright @copyright{} 1998, 2000--2015 Free Software Foundation, Inc. @@ -32,7 +31,7 @@ modify this GNU manual.'' @dircategory Emacs network features @direntry -* EUDC: (eudc). Emacs client for directory servers (LDAP, PH). +* EUDC: (eudc). Emacs client for directory servers (LDAP, BBDB). @end direntry @footnotestyle end @@ -41,7 +40,7 @@ modify this GNU manual.'' @title EUDC Manual @subtitle The Emacs Unified Directory Client @author by Oscar Figueiredo -@code{1.30b} +@code{1.40.0} @page @vskip 0pt plus 1fill @@ -83,8 +82,6 @@ Currently supported back-ends are: @item LDAP, Lightweight Directory Access Protocol @item -CCSO PH/QI -@item BBDB, Big Brother's Insidious Database @end itemize @@ -109,7 +106,6 @@ Interface to BBDB to let you insert server records into your own BBDB database @menu * LDAP:: What is LDAP ? -* CCSO PH/QI:: What is CCSO, PH, QI ? * BBDB:: What is BBDB ? @end menu @@ -141,30 +137,6 @@ EUDC requires external support to access LDAP directory servers (@pxref{LDAP Configuration}) -@node CCSO PH/QI -@section CCSO PH/QI - -The Central Computing Services Office (CCSO) of the University of -Illinois at Urbana Champaign created and freely distributed a -directory system that was used by many organizations in the 1990s. -The system records information about people such as their address, -phone number, email, academic information or any other details it was -configured to. Nowadays this system is not widely used. - -The system consists of two parts: a database server traditionally called -@samp{qi} and a command-line client called @samp{ph}. -@ignore -Until 2010, the code could be downloaded from -@url{http://www-dev.cites.uiuc.edu/ph/}. -@end ignore - -The original command-line @samp{ph} client that came with the -@samp{ph/qi} distribution provided additional features that are -not implemented in EUDC, like the possibility to communicate with the -server in login-mode, which made it possible to change records in the -database. - - @node BBDB @section BBDB @@ -175,14 +147,14 @@ and news readers. It is often used as an enhanced email address book. -EUDC considers BBDB as a directory server back end just like LDAP or -PH/QI servers, though BBDB has no client/server protocol and thus always -resides locally on your machine. The point in this is not to offer an +EUDC considers BBDB as a directory server back end just like LDAP, +though BBDB has no client/server protocol and thus always resides +locally on your machine. The point in this is not to offer an alternate way to query your BBDB database (BBDB itself provides much -more flexible ways to do that), but rather to offer an interface to your -local directory that is consistent with the interface to external -directories (LDAP, PH/QI). This is particularly interesting when -performing queries on multiple servers. +more flexible ways to do that), but rather to offer an interface to +your local directory that is consistent with the interface to external +LDAP directories. This is particularly interesting when performing +queries on multiple servers. EUDC also offers a means to insert results from directory queries into your own local BBDB (@pxref{Creating BBDB Records}) @@ -473,7 +445,7 @@ it will be ignored anyway. @defvar eudc-protocol The directory protocol to use to query the server. Currently supported -protocols in this version of EUDC are @code{ph}, @code{ldap} and @code{bbdb}. +protocols in this version of EUDC are @code{ldap} and @code{bbdb}. @end defvar @deffn Command eudc-set-server @@ -510,11 +482,8 @@ attributes are ignored. Default is @code{t}. Directory standards may authorize different instances of the same attribute in a record. For instance the record of a person may contain -several email fields containing different email addresses. When using -a QI directory server this is difficult to distinguish from attributes -having multi-line values such as the postal address that may contain a -line for the street and another one for the zip code and city name. In -both cases, EUDC will consider the attribute duplicated. +several email fields containing different email addresses, in which +case EUDC will consider the attribute duplicated. EUDC has several methods to deal with duplicated attributes. The available methods are: @@ -956,39 +925,6 @@ convenience functions to parse phones and addresses. @end table @end defvar -The default value of the PH-specific value of that variable is -@code{eudc-ph-bbdb-conversion-alist}: - -@lisp -((name . name) - (net . email) - (address . (eudc-bbdbify-address address "Address")) - (phone . ((eudc-bbdbify-phone phone "Phone") - (eudc-bbdbify-phone office_phone "Office Phone")))) -@end lisp - -This means that: - -@itemize @bullet -@item -the @code{name} field of the BBDB record gets its value -from the @code{name} attribute of the directory record -@item -the @code{net} field of the BBDB record gets its value -from the @code{email} attribute of the directory record -@item -the @code{address} field of the BBDB record is obtained by parsing the -@code{address} attribute of the directory record with the function -@code{eudc-bbdbify-address} -@item -two @code{phone} fields are created (when possible) in the BBDB record. -The first one has @cite{Phone} for location and its value is obtained by -parsing the @code{phone} attribute of the PH/QI record with the function -@code{eudc-bbdbify-phone}. The second one has @cite{Office Phone} for location -its value is obtained by parsing the @code{office_phone} attribute of the -PH/QI record with the function @code{eudc-bbdbify-phone}. -@end itemize - @defun eudc-bbdbify-phone phone location This is a convenience function provided for use in @code{eudc-bbdb-conversion-alist}. It parses @var{phone} into a vector diff --git a/doc/misc/ido.texi b/doc/misc/ido.texi index afc323888c3..e06d248becc 100644 --- a/doc/misc/ido.texi +++ b/doc/misc/ido.texi @@ -706,7 +706,8 @@ packages. @noindent After @kbd{C-x b} (@code{ido-switch-buffer}), the buffer at the head of the list can be killed by pressing @kbd{C-k}. If the buffer needs -saving, you will be queried before the buffer is killed. +saving, you will be queried before the buffer is killed. @kbd{C-S-b} +buries the buffer at the head of the list. Likewise, after @kbd{C-x C-f}, you can delete (i.e., physically remove) the file at the head of the list with @kbd{C-k}. You will diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index 2f92e3ea836..9b2a457a710 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -377,6 +377,7 @@ Undo previous action (@code{(undo)}). @findex ses-read-cell-printer @findex ses-read-column-printer @findex ses-read-default-printer +@findex ses-define-local-printer @findex ses-center @findex ses-center-span @findex ses-dashfill @@ -435,13 +436,13 @@ Centering with dashes and spill-over. Centering with tildes (~) and spill-over. @end table -You can define printer function local to a sheet with command -@code{ses-define-local-printer}. For instance define printer -@samp{foo} to @code{"%.2f"} and then use symbol @samp{foo} as a -printer function. Then, if you call again +You can define printer function local to a sheet with the command +@code{ses-define-local-printer}. For instance, define a printer +@samp{foo} to @code{"%.2f"}, and then use symbol @samp{foo} as a +printer function. Then, if you call again @code{ses-define-local-printer} on @samp{foo} to redefine it as -@code{"%.3f"} all the cells using printer @samp{foo} will be reprinted -accordingly. +@code{"%.3f"}, all the cells using printer @samp{foo} will be +reprinted accordingly. @node Clearing cells @section Clearing cells diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index f555ce3f659..34fd353a9dc 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2015-10-29.16} +\def\texinfoversion{2015-12-17.20} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -158,22 +158,10 @@ \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -% Since the category of space is not known, we have to be careful. -\chardef\spacecat = 10 -\def\spaceisspace{\catcode`\ =\spacecat} +% Give the space character the catcode for a space. +\def\spaceisspace{\catcode`\ =10\relax} -% sometimes characters are active, so we need control sequences. -\chardef\ampChar = `\& -\chardef\colonChar = `\: -\chardef\commaChar = `\, \chardef\dashChar = `\- -\chardef\dotChar = `\. -\chardef\exclamChar= `\! -\chardef\hashChar = `\# -\chardef\lquoteChar= `\` -\chardef\questChar = `\? -\chardef\rquoteChar= `\' -\chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ @@ -271,11 +259,18 @@ % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top -% of a page, or that at the bottom of a page. The solution is -% described on page 260 of The TeXbook. It involves outputting two -% marks for the sectioning macros, one before the section break, and -% one after. I won't pretend I can describe this better than DEK... -% +% of a page, or that at the bottom of a page. + +% \domark is called twice inside \chapmacro, to add one +% mark before the section break, and one after. +% In the second call \prevchapterdefs is the same as \lastchapterdefs, +% and \prevsectiondefs is the same as \lastsectiondefs. +% Then if the page is not broken at the mark, some of the previous +% section appears on the page, and we can get the name of this section +% from \firstmark for @everyheadingmarks top. +% @everyheadingmarks bottom uses \botmark. +% +% See page 260 of The TeXbook. \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% @@ -283,13 +278,14 @@ \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% - \the\toks0 \the\toks2 % 0: top marks (\last...) - \noexpand\or \the\toks4 \the\toks6 % 1: bottom marks (default, \prev...) + \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top + \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom \noexpand\else \the\toks8 % 2: color marks }% } -% \gettopheadingmarks, \getbottomheadingmarks - extract needed part of mark. +% \gettopheadingmarks, \getbottomheadingmarks, +% \getcolormarks - extract needed part of mark. % % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us @@ -345,28 +341,21 @@ % values in \headline and \footline. % % This is used to check if we are on the first page of a chapter. - \ifcase0\topmark\fi - \ifx\thischapter\empty - % See comment for \gettopheadingmarks - \ifcase0\firstmark\fi - \let\curchaptername\thischaptername - \ifcase1\firstmark\fi - \let\prevchaptername\thischaptername - \else - \let\curchaptername\thischaptername - \ifcase1\topmark\fi - \let\prevchaptername\thischaptername - \fi + \ifcase1\topmark\fi + \let\prevchaptername\thischaptername + \ifcase0\firstmark\fi + \let\curchaptername\thischaptername % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi % \ifx\curchaptername\prevchaptername + \let\thischapterheading\thischapter \else - % If on the first page of a chapter, clear @thischapter so it - % doesn't appear in the headline, because the chapter is already - % shown in the chapter heading. - \def\thischapter{}% + % \thischapterheading is the same as \thischapter except it is blank + % for the first page of a chapter. This is to prevent the chapter name + % being shown twice. + \def\thischapterheading{}% \fi % \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% @@ -1164,8 +1153,8 @@ output) for that.)} \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % - % k sets the color for filling (usual text, etc.); - % K sets the color for stroking (thin rules, e.g., normal _'s). + % rg sets the color for filling (usual text, etc.); + % RG sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, @@ -1416,7 +1405,6 @@ output) for that.)} \normalturnoffactive \def\@{@}% \let\/=\empty - \let\xprocessmacroarg=\eatspaces % in case we are in a macro expansion \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? @@ -2452,8 +2440,8 @@ end % \catcode`@=11 \def\plainfrenchspacing{% - \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m - \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m + \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% @@ -2641,9 +2629,9 @@ end % Allow line breaks around only a few characters (only). \def\urefcatcodes{% - \catcode\ampChar=\active \catcode\dotChar=\active - \catcode\hashChar=\active \catcode\questChar=\active - \catcode\slashChar=\active + \catcode`\&=\active \catcode`\.=\active + \catcode`\#=\active \catcode`\?=\active + \catcode`\/=\active } { \urefcatcodes @@ -2852,23 +2840,24 @@ end \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% - \tex - \mathunderscore - \let\\ = \mathbackslash - \mathactive - % make the texinfo accent commands work in math mode - \let\"=\ddot - \let\'=\acute - \let\==\bar - \let\^=\hat - \let\`=\grave - \let\u=\breve - \let\v=\check - \let\~=\tilde - \let\dotaccent=\dot - % have to provide another name for sup operator - \let\mathopsup=\sup - $\finishmath + \ifmmode\else % only go into math if not in math mode already + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + % have to provide another name for sup operator + \let\mathopsup=\sup + $\expandafter\finishmath\fi } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. @@ -3517,7 +3506,7 @@ end \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager @@ -3528,8 +3517,8 @@ end \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenheadline={\line{\thischapterheading\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} @@ -3540,7 +3529,7 @@ end \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } @@ -3548,8 +3537,8 @@ end \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\evenheadline={\line{\thischapterheading\hfil\folio}} +\global\oddheadline={\line{\thischapterheading\hfil\folio}} \global\let\contentsalignmacro = \chappager } @@ -4676,16 +4665,6 @@ end \definedummyword\verb \definedummyword\w \definedummyword\xref - % - % Consider: - % @macro mkind{arg1,arg2} - % @cindex \arg2\ - % @end macro - % @mkind{foo, bar} - % The space after the comma will end up in the temporary definition - % that we make for arg2 (see \parsemargdef ff.). We want all this to be - % expanded for the sake of the index, so we end up just seeing "bar". - \let\xprocessmacroarg\eatspaces } % For testing: output @{ and @} in index sort strings as \{ and \}. @@ -5212,16 +5191,12 @@ end % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% - \def\entrybreak{\hfil\break}% + \def\entrybreak{\hfil\break}% An undocumented command % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus0.5pt % - % Badness calculation for paragraph affected by - - % How much \indexdotfill is stretched, or how much \parfillskip is shrunk - % Number of lines (\linepenalty) - % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = @@ -5255,16 +5230,23 @@ end % \ifpdf \pdfgettoks#1.% - \hskip\skip\thinshrinkable\the\toksA + \bgroup\let\domark\relax + \hskip\skip\thinshrinkable\the\toksA + \egroup + % The redefinion of \domark stops marks being added in \pdflink to + % preserve coloured links across page boundaries. Otherwise the marks + % would get in the way of \lastbox in \insertindexentrybox. \else \hskip\skip\thinshrinkable #1% \fi \fi \egroup % end \boxA \ifdim\wd\boxB = 0pt - \global\setbox\entryindexbox=\box\boxA + \global\setbox\entryindexbox=\vbox{\unhbox\boxA}% \else - \global\setbox\entryindexbox=\vbox\bgroup\noindent + \global\setbox\entryindexbox=\vbox\bgroup + \prevdepth=\entrylinedepth + \noindent % We want the text of the entries to be aligned to the left, and the % page numbers to be aligned to the right. % @@ -5333,10 +5315,21 @@ end \newbox\entryindexbox \def\insertindexentrybox{% -\lineskip=.7ex plus .5ex % This comes into effect when the \vbox has a large - % height due to the paragraph in it having several - % lines. -\box\entryindexbox} + \copy\entryindexbox + % The following gets the depth of the last box. This is for even + % line spacing when entries span several lines. + \setbox\dummybox\vbox{% + \unvbox\entryindexbox + \nointerlineskip + \lastbox + \global\entrylinedepth=\prevdepth + }% + % Note that we couldn't simply \unvbox\entryindexbox followed by + % \nointerlineskip\lastbox to remove the last box and then reinstate it, + % because this resets how far the box has been \moveleft'ed to 0. \unvbox + % doesn't affect \prevdepth either. +} +\newdimen\entrylinedepth % Default is no penalty \let\entryorphanpenalty\egroup @@ -5387,16 +5380,35 @@ end % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 +\catcode`\@=11 % private names \newbox\partialpage \newdimen\doublecolumnhsize \newdimen\doublecolumntopgap \doublecolumntopgap = 0pt -\newtoks\savedtopmark % Used in \begindoublecolumns +% Use inside an output routine to save \topmark and \firstmark +\def\savemarks{% + \global\savedtopmark=\expandafter{\topmark }% + \global\savedfirstmark=\expandafter{\firstmark }% +} +\newtoks\savedtopmark \newtoks\savedfirstmark +% Set \topmark and \firstmark for next time \output runs. +% Can't be run from withinside \output (because any material +% added while an output routine is active, including +% penalties, is saved for after it finishes). The page so far +% should be empty, otherwise what's on it will be thrown away. +\def\restoremarks{% + \mark{\the\savedtopmark}% + \bgroup\output = {% + \setbox\dummybox=\box\PAGE + }abc\eject\egroup + % "abc" because output routine doesn't fire for a completely empty page. + \mark{\the\savedfirstmark}% +} + \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% @@ -5417,22 +5429,15 @@ end \unvbox\PAGE \kern-\topskip \kern\baselineskip }% - % Save \topmark and \firstmark - \global\savedtopmark=\expandafter{\topmark}% - \global\savedfirstmark=\expandafter{\firstmark}% + \savemarks }% \eject % run that output routine to set \partialpage + \restoremarks % % We recover the two marks that the last output routine saved in order % to propagate the information in marks added around a chapter heading, % which could be otherwise be lost by the time the final page is output. % - \mark{\the\savedtopmark}% Only mark in page passed to following \output. - \output = {% - \setbox0=\box\PAGE % clear box 255 - }abc\eject - % - \mark{\the\savedfirstmark}% % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% @@ -5465,12 +5470,14 @@ end \global\advance\vsize by -1\doublecolumntopgap \vsize = 2\vsize \topskip=0pt + \global\entrylinedepth=0pt\relax } % The double-column output routine for all double-column pages except % the last, which is done by \balancecolumns. % \def\doublecolumnout{% + % \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the @@ -5532,6 +5539,7 @@ end \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. + \savemarks \balancecolumns % % If we end up splitting too much material for the current page, @@ -5545,6 +5553,8 @@ end }% \eject \endgroup % started in \begindoublecolumns + \restoremarks + \box\balancedcolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column @@ -5552,6 +5562,8 @@ end % \endgroup where \vsize got restored). \pagegoal = \vsize } +\newbox\balancedcolumns +\setbox\balancedcolumns=\vbox{shouldnt see this}% % % Only called for the last of the double column material. \doublecolumnout % does the others. @@ -5595,7 +5607,7 @@ end \fi \fi % - \pagesofar + \global\setbox\balancedcolumns=\vbox{\pagesofar}% } \catcode`\@ = \other @@ -7612,8 +7624,7 @@ end % Argument is macro body with arguments substituted \def\scanmacro#1{% \newlinechar`\^^M - % Reduce doubled backslashes to one - \def\xprocessmacroarg{\passargtomacro\eatspaces}% + \def\xprocessmacroarg{\eatspaces}% % % Process the macro body under the current catcode regime. \scantokens{#1\texinfoc}\aftermacro% @@ -7629,6 +7640,7 @@ end % to allow macros to open or close groups themselves. } +% Used for copying and captions \def\scanexp#1{% \bgroup % Undo catcode changes of \startcontents and \printindex @@ -7733,6 +7745,7 @@ end % an argument to another Texinfo command. \def\macroargctxt{% \scanctxt + \catcode`\ =\active \catcode`\^^M=\other \catcode`\\=\active } @@ -8127,16 +8140,23 @@ end \egroup\noexpand\scanmacro{\macrobody}}% \else \ifnum\paramno<10\relax % at most 9 + % See non-recursive section below for comments \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname @@\endcsname}% + \bgroup + \noexpand\expandafter + \noexpand\macroargctxt + \noexpand\expandafter + \expandafter\noexpand\csname\the\macname @@\endcsname}% \expandafter\xdef\csname\the\macname @@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% + \noexpand\passargtomacro + \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% + \expandafter\xdef\csname\the\macname @@@\endcsname##1{% + \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter - \csname\the\macname @@@\endcsname - \paramlist{\egroup\noexpand\scanmacro{\macrobody}}% + \csname\the\macname @@@@\endcsname\paramlist{% + \egroup\noexpand\scanmacro{\macrobody}}% \else % 10 or more \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% @@ -8166,19 +8186,27 @@ end }% \else % at most 9 \ifnum\paramno<10\relax + % @MACNAME sets the context for reading the macro argument + % @MACNAME@@ gets the argument, processes backslashes and appends a + % comma. + % @MACNAME@@@ removes braces surrounding the argument list. + % @MACNAME@@@@ scans the macro body with arguments substituted. \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname @@\endcsname}% + \bgroup + \noexpand\expandafter % This \expandafter skip any spaces after the + \noexpand\macroargctxt % macro before we change the catcode of space. + \noexpand\expandafter + \expandafter\noexpand\csname\the\macname @@\endcsname}% \expandafter\xdef\csname\the\macname @@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% + \noexpand\passargtomacro + \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% + \expandafter\xdef\csname\the\macname @@@\endcsname##1{% + \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter - \csname\the\macname @@@\endcsname - \paramlist{% - \egroup - \noexpand\scanmacro{\macrobody}% - }% + \csname\the\macname @@@@\endcsname\paramlist{% + \egroup\noexpand\scanmacro{\macrobody}}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% @@ -8194,71 +8222,96 @@ end \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} -{\catcode`\@=0 \catcode`\\=13 -@catcode`@_=11 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape +@catcode`@_=11 % private names +@catcode`@!=11 % used as argument separator +% \passargtomacro#1#2 - % Call #1 with a list of tokens #2, with any doubled backslashes in #2 % compressed to one. +% +% This implementation works by expansion, and not execution (so we cannot use +% \def or similar). This reduces the risk of this failing in contexts where +% complete expansion is done with no execution (for example, in writing out to +% an auxiliary file for an index entry). +% +% State is kept in the input stream: the argument passed to +% @look_ahead, @gobble_and_check_finish and @add_segment is +% +% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) +% +% where: +% THE_MACRO - name of the macro we want to call +% ARG_RESULT - argument list we build to pass to that macro +% PENDING_BS - either a backslash or nothing +% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next + @gdef@passargtomacro#1#2{% - @def@the_macro{#1}% - @def@pending_backslash{}% - @def@finish{@finish}% - @def@arg_result{}% - @let@next_token=@relax - @add_segment#2\@finish\% -} - -% Input stream is just after a backslash. If the next token is not a -% backslash, process the rest of the argument; otherwise, remove the next -% token. -@gdef@look_ahead{% - @futurelet@next_token@look_aheadzzz} -@gdef@look_aheadzzz{% - @ifx@next_token\% - @let@next=@gobble_and_check_finish - @else - @let@next=@add_segment - @fi@next + @add_segment #1!{}@relax#2\@_finish\% } +@gdef@_finish{@_finishx} @global@let@_finishx@relax -% Double backslash found. Add a single backslash here. -@gdef@gobble_and_check_finish#1{% - @add_the_backslash - @def@pending_backslash{}% - @futurelet@next_token@add_segment +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 used to look ahead +% +% If the next token is not a backslash, process the rest of the argument; +% otherwise, remove the next token. +@gdef@look_ahead#1!#2#3#4{% + @ifx#4\% + @expandafter@gobble_and_check_finish + @else + @expandafter@add_segment + @fi#1!{#2}#4#4% } -% append a backslash to \arg_result -@gdef@add_the_backslash{% - @expandafter@gdef@expandafter@arg_result@expandafter{@arg_result\}% +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 should be a backslash, which is gobbled. +% #5 looks ahead +% +% Double backslash found. Add a single backslash, and look ahead. +@gdef@gobble_and_check_finish#1!#2#3#4#5{% + @add_segment#1\!{}#5#5% } +@gdef@is_fi{@fi} + +% #1 - THE_MACRO ARG_RESULT +% #2 - PENDING_BS +% #3 - NEXT_TOKEN +% #4 is input stream until next backslash +% % Input stream is either at the start of the argument, or just after a % backslash sequence, either a lone backslash, or a doubled backslash. -% \next_token contains the first token in the input stream: if it is \finish, -% finish; otherwise, append to \arg_result the segment of the argument up until -% the next backslash. \pending_backslash contains a backslash to represent +% NEXT_TOKEN contains the first token in the input stream: if it is \finish, +% finish; otherwise, append to ARG_RESULT the segment of the argument up until +% the next backslash. PENDING_BACKSLASH contains a backslash to represent % a backslash just before the start of the input stream that has not been -% added to \arg_result. -@gdef@add_segment#1\{% -@ifx@next_token@finish - @let@next=@call_the_macro% +% added to ARG_RESULT. +@gdef@add_segment#1!#2#3#4\{% +@ifx#3@_finish + @call_the_macro#1!% @else - @let@next=@look_ahead - % - % append to @arg_result - % token list registers might be better - @expandafter@expandafter@expandafter@gdef - @expandafter@expandafter@expandafter@arg_result - @expandafter@expandafter@expandafter{% - @expandafter@arg_result - @pending_backslash#1}% - @def@pending_backslash{\}% -@fi@next} + % append the pending backslash to the result, followed by the next segment + @expandafter@is_fi@look_ahead#1#2#4!{\}@fi + % this @fi is discarded by @look_ahead. + % we can't get rid of it with \expandafter because we don't know how + % long #4 is. +} -@gdef@call_the_macro{@expandafter@the_macro@expandafter{@arg_result}} +% #1 - THE_MACRO +% #2 - ARG_RESULT +% #3 discards the res of the conditional in @add_segment, and @is_fi ends the +% conditional. +@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \braceorline MAC is used for a one-argument macro MAC. It checks % whether the next non-whitespace character is a {. It sets the context @@ -10818,11 +10871,12 @@ directory should work if nowhere else does.} % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). +% Set catcodes for Texinfo file + +% Active characters for printing the wanted glyph. % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. - +% \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote @@ -10832,12 +10886,10 @@ directory should work if nowhere else does.} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} -\let\realunder=_ -% Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } +\let\realunder=_ -\catcode`\|=\active -\def|{{\tt\char124}} +\catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 07d34bd4d2f..bd7d921cefe 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -98,6 +98,7 @@ copy and modify this GNU manual.'' @contents + @ifnottex @node Top, Overview, (dir), (dir) @top @value{tramp} version @value{trampver} User Manual @@ -176,7 +177,9 @@ For the end user: For the developer: -* Files directories and localnames:: How file names, directories and localnames are mangled and managed. +* Files directories and localnames:: + How file names, directories and localnames + are mangled and managed. * Traces and Profiles:: How to Customize Traces. * Issues:: Debatable Issues and What Was Decided. @@ -198,7 +201,7 @@ Installing @value{tramp} with your @value{emacsname} Configuring @value{tramp} for use -* Connection types:: Types of connections made to remote hosts. +* Connection types:: Types of connections to remote hosts. * Inline methods:: Inline methods. * External methods:: External methods. @ifset emacsgvfs @@ -246,149 +249,138 @@ How file names, directories and localnames are mangled and managed @chapter An overview of @value{tramp} @cindex overview -After the installation of @value{tramp} into your @value{emacsname}, you -will be able to access files on remote hosts as though they were -local. Access to the remote file system for editing files, version -control, and @code{dired} are transparently enabled. - -Your access to the remote host can be with the @command{rsh}, -@command{rlogin}, @command{telnet} programs or with any similar -connection method. This connection must pass @acronym{ASCII} -successfully to be usable but need not be 8-bit clean. - -The package provides support for @command{ssh} connections out of the -box, one of the more common uses of the package. This allows -relatively secure access to hosts, especially if @command{ftp} -access is disabled. - -Under Windows, @value{tramp} is integrated with the PuTTY package, -using the @command{plink} program. - -The majority of activity carried out by @value{tramp} requires only that -the remote login is possible and is carried out at the terminal. In -order to access remote files @value{tramp} needs to transfer their content -to the local host temporarily. - -@value{tramp} can transfer files between the hosts in a variety of ways. -The details are easy to select, depending on your needs and the -hosts in question. - -The fastest transfer methods for large files rely on a remote file -transfer package such as @command{rcp}, @command{scp}, @command{rsync} -or (under Windows) @command{pscp}. - -If the remote copy methods are not suitable for you, @value{tramp} also -supports the use of encoded transfers directly through the shell. -This requires that the @command{mimencode} or @command{uuencode} tools -are available on the remote host. These methods are generally -faster for small files. - -@value{tramp} is still under active development and any problems you encounter, -trivial or major, should be reported to the @value{tramp} developers. -@xref{Bug Reports}. +@value{tramp} is for transparently accessing remote files from within +@value{emacsname}. @value{tramp} enables an easy, convenient, and +consistent interface to remote files as if they are local files. +@value{tramp}'s transparency extends to editing, version control, and +@code{dired}. + +@value{tramp} can access remote hosts using any number of access +methods, such as @command{rsh}, @command{rlogin}, @command{telnet}, +and related programs. If these programs can successfully pass +@acronym{ASCII]} characters, @value{tramp} can use them. +@value{tramp} does not require or mandate 8-bit clean connections. + +@value{tramp}'s most common access method is through @command{ssh}, a +more secure alternative to @command{ftp} and other older access +methods. + +@value{tramp} on Windows operating systems is integrated with the +PuTTY package, and uses the @command{plink} program. + +@value{tramp} mostly operates transparently in the background using +the connection programs. As long as these programs enable remote login +and can use the terminal, @value{tramp} can adapt them for seamless +and transparent access. + +@value{tramp} temporarily transfers a remote file's contents to the +local host editing and related operations. @value{tramp} can also +transfer files between hosts using standard Emacs interfaces, a +benefit of direct integration of @value{tramp} in @value{emacsname}. + +@value{tramp} can transfer files using any number of available host +programs for remote files, such as @command{rcp}, @command{scp}, +@command{rsync} or (under Windows) @command{pscp}. @value{tramp} +provides easy ways to specify these programs and customize them to +specific files, hosts, or access methods. + +For faster small-size file transfers, @value{tramp} supports encoded +transfers directly through the shell using @command{mimencode} or +@command{uuencode} provided such tools are available on the remote +host. -@subsubheading Behind the scenes +@subsubheading @value{tramp} behind the scenes @cindex behind the scenes @cindex details of operation @cindex how it works -This section tries to explain what goes on behind the scenes when you -access a remote file through @value{tramp}. +Accessing a remote file through @value{tramp} entails a series of +actions, many of which are transparent to the user. Yet some actions +may require user response (such as entering passwords or completing +file names). One typical scenario, opening a file on a remote host, is +presented here to illustrate the steps involved: -Suppose you type @kbd{C-x C-f} and enter part of an @value{tramp} file name, -then hit @kbd{@key{TAB}} for completion. Suppose further that this is -the first time that @value{tramp} is invoked for the host in question. Here's -what happens: +@kbd{C-x C-f} to initiate find-file, enter part of the @value{tramp} +file name, then hit @kbd{@key{TAB}} for completion. If this is the +first time connection to that host, here's what happens: @itemize @item -@value{tramp} discovers that it needs a connection to the host. So it -invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l -@var{user}} or a similar tool to connect to the remote host. -Communication with this process happens through an -@value{emacsname} buffer, that is, the output from the remote end -goes into a buffer. +@value{tramp} invokes @samp{telnet @var{host}} or @samp{rsh @var{host} +-l @var{user}} and establishes an external process to connect to the +remote host. @value{tramp} communicates with the process through an +@value{emacsname} buffer, which also shows output from the remote +host. @item -The remote host may prompt for a login name (for @command{telnet}). -The login name is given in the file name, so @value{tramp} sends the -login name and a newline. +The remote host may prompt for a login name (for @command{telnet}, for +example) in the buffer. If on the other hand, the login name was +included in the file name portion, @value{tramp} sends the login name +followed by a newline. @item -The remote host may prompt for a password or pass phrase (for -@command{rsh} or for @command{telnet} after sending the login name). -@value{tramp} displays the prompt in the minibuffer, asking you for the -password or pass phrase. - -You enter the password or pass phrase. @value{tramp} sends it to the remote -host, followed by a newline. +The remote host may then prompt for a password or pass phrase (for +@command{rsh} or for @command{telnet}). @value{tramp} displays the +password prompt in the minibuffer. @value{tramp} then sends whatever +is entered to the remote host, followed by a newline. @item -@value{tramp} now waits for the shell prompt or for a message that the login -failed. +@value{tramp} now waits for either the shell prompt or a failed login +message. -If @value{tramp} sees neither of them after a certain period of time -(a minute, say), then it issues an error message saying that it -couldn't find the remote shell prompt and shows you what the remote -host has sent. +If @value{tramp} does not receive any messages within a timeout period +(a minute, for example), then @value{tramp} responds with an error +message about not finding the remote shell prompt. If any messages +from the remote host, @value{tramp} displays them in the buffer. -If @value{tramp} sees a @samp{login failed} message, it tells you so, -aborts the login attempt and allows you to try again. +For any @samp{login failed} message from the remote host, +@value{tramp} aborts the login attempt, and repeats the login steps +again. @item -Suppose that the login was successful and @value{tramp} sees the shell prompt -from the remote host. Now @value{tramp} invokes @command{/bin/sh} because -Bourne shells and C shells have different command -syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login -shell doesn't recognize @samp{exec /bin/sh} as a valid command. -Maybe you use the Scheme shell @command{scsh}@dots{}} +Upon successful login and @value{tramp} recognizes the shell prompt +from the remote host, @value{tramp} prepares the shell environment by +turning off echoing, setting shell prompt, and other housekeeping +chores. -After the Bourne shell has come up, @value{tramp} sends a few commands to -ensure a good working environment. It turns off echoing, it sets the -shell prompt, and a few other things. +@strong{Note} that for the remote shell, @value{tramp} invokes +@command{/bin/sh}. The remote host must recognize @samp{exec /bin/sh} +and execute the appropriate shell. This shell must support Bourne +shell syntax. @item -Now the remote shell is up and it good working order. Remember, what -was supposed to happen is that @value{tramp} tries to find out what files exist -on the remote host so that it can do file name completion. - -So, @value{tramp} basically issues @command{cd} and @command{ls} commands and -also sometimes @command{echo} with globbing. Another command that is -often used is @command{test} to find out whether a file is writable or a -directory or the like. The output of each command is parsed for the -necessary operation. +@value{tramp} executes @command{cd} and @command{ls} commands to find +which files exist on the remote host. @value{tramp} sometimes uses +@command{echo} with globbing. @value{tramp} checks if a file or +directory is writable with @command{test}. After each command, +@value{tramp} parses the output from the remote host for completing +the next operation. @item -Suppose you are finished with file name completion, have entered @kbd{C-x -C-f}, a full file name and hit @kbd{@key{RET}}. Now comes the time to -transfer the file contents from the remote host to the local host so -that you can edit them. - -See above for an explanation of how @value{tramp} transfers the file contents. +After remote file name completion, @value{tramp} transfers the file +contents from the remote host. -For inline transfers, @value{tramp} issues a command like @samp{mimencode -b -/path/to/remote/file}, waits until the output has accumulated in the -buffer that's used for communication, then decodes that output to -produce the file contents. +For inline transfers, @value{tramp} sends a command, such as +@samp{mimencode -b /path/to/remote/file}, waits until the output has +accumulated in the buffer, decodes that output to produce the file's +contents. -For external transfers, @value{tramp} issues a command like the -following: +For external transfers, @value{tramp} sends a command as follows: @example rcp user@@host:/path/to/remote/file /tmp/tramp.4711 @end example -It then reads the local temporary file @file{/tmp/tramp.4711} into a -buffer and deletes the temporary file. +@value{tramp} reads the local temporary file @file{/tmp/tramp.4711} +into a buffer, and then deletes the temporary file. @item -You now edit the buffer contents, blithely unaware of what has happened -behind the scenes. (Unless you have read this section, that is.) When -you are finished, you type @kbd{C-x C-s} to save the buffer. +Edit, modify, change the buffer contents as normal, and then save the +buffer wth @kbd{C-x C-s}. @item -Again, @value{tramp} transfers the file contents to the remote host -either inline or external. This is the reverse of what happens when -reading the file. +@value{tramp} transfers the buffer contents to the remote host in +a reverse of the process using the appropriate inline or external +program. @end itemize I hope this has provided you with a basic overview of what happens @@ -400,28 +392,23 @@ behind the scenes when you open a file with @value{tramp}. @chapter Obtaining Tramp. @cindex obtaining Tramp -@value{tramp} is freely available on the Internet and the latest -release may be downloaded from @uref{ftp://ftp.gnu.org/gnu/tramp/}. -This release includes the full documentation and code for -@value{tramp}, suitable for installation. But Emacs (22 or later) -includes @value{tramp} already, and there is a @value{tramp} package -for XEmacs, as well. So maybe it is easier to just use those. But if -you want the bleeding edge, read on@dots{} +@value{tramp} is included as part of Emacs (since Emacs version 22.1). -For the especially brave, @value{tramp} is available from Git. The Git -version is the latest version of the code and may contain incomplete -features or new issues. Use these versions at your own risk. +@value{tramp} is also freely packaged for download on the Internet at +@uref{ftp://ftp.gnu.org/gnu/tramp/}. -Instructions for obtaining the latest development version of @value{tramp} -from Git can be found by going to the Savannah project page at the -following URL and then clicking on the Git link in the navigation bar -at the top. +@value{tramp} development versions are available on Git servers. +Development versions contain new and incomplete features. + +One way to obtain from Git server is to visit the Savannah project +page at the following URL and then clicking on the Git link in the +navigation bar at the top. @noindent @uref{http://savannah.gnu.org/projects/tramp/} @noindent -Or follow the example session below: +Another way is to follow the terminal session below: @example ] @strong{cd ~/@value{emacsdir}} @@ -429,7 +416,7 @@ Or follow the example session below: @end example @noindent -If you reside behind a firewall, you could use +From behind a firewall: @example ] @strong{git config --global http.proxy http://user:pwd@@proxy.server.com:8080} @@ -437,16 +424,18 @@ If you reside behind a firewall, you could use @end example @noindent -Tramp developers use instead +Tramp developers: @example ] @strong{git clone login@@git.sv.gnu.org:/srv/git/tramp.git} @end example @noindent -You should now have a directory @file{~/@value{emacsdir}/tramp} -containing the latest version of @value{tramp}. You can fetch the latest -updates from the repository by issuing the command: +After one of the above commands, @file{~/@value{emacsdir}/tramp} will +containing the latest version of @value{tramp}. + +@noindent +To fetch updates from the repository, use git pull: @example ] @strong{cd ~/@value{emacsdir}/tramp} @@ -454,9 +443,8 @@ updates from the repository by issuing the command: @end example @noindent -Once you've got updated files from the Git repository, you need to run -@command{autoconf} in order to get an up-to-date @file{configure} -script: +Run @command{autoconf} as follows to generate an up-to-date +@file{configure} script: @example ] @strong{cd ~/@value{emacsdir}/tramp} @@ -469,36 +457,32 @@ script: @cindex history @cindex development history -Development was started end of November 1998. The package was called -@file{rssh.el}, back then. It only provided one method to access a -file, using @command{ssh} to log in to a remote host and using -@command{scp} to transfer the file contents. After a while, the name -was changed to @file{rcp.el}, and now it's @value{tramp}. Along the way, -many more methods for getting a remote shell and for transferring the -file contents were added. Support for VC was added. - -After that, there were added the multi-hop methods in April 2000 and -the unification of @value{tramp} and Ange-FTP file names in July 2002. -In July 2004, multi-hop methods have been replaced by proxy hosts. -Running commands on remote hosts was introduced in December 2005. +@value{tramp} development started at the end of November 1998 as +@file{rssh.el}. It provided only one method of access. It used +@command{ssh} for login and @command{scp} to transfer file contents. +The name was changed to @file{rcp.el} before it got its preset name +@value{tramp}. New methods of remote access were added, so was support +for version control. + +April 2000 was the first time when multi-hop methods were added. In +July 2002, @value{tramp} unified file names with Ange-FTP@. In July +2004, proxy hosts replaced multi-hop methods. Running commands on +remote hosts was introduced in December 2005. @ifset emacsgw -Support of gateways exists since April 2007. +Support for gateways since April 2007. @end ifset @ifset emacsgvfs GVFS integration started in February 2009. @end ifset @ifset emacs -Remote commands on Windows hosts are available since September 2011. +Remote commands on Windows hosts since September 2011. @end ifset -Ad-hoc multi-hop methods (with a changed syntax) have been reenabled -in November 2011. In November 2012, Juergen Hoetzel's -@file{tramp-adb.el} has been added. +Ad-hoc multi-hop methods (with a changed syntax) re-enabled in November +2011. -In December 2001, @value{tramp} has been added to the XEmacs package -repository. Being part of the Emacs repository happened in June 2002, -the first release including @value{tramp} was Emacs 22.1. +In November 2012, added Juergen Hoetzel's @file{tramp-adb.el}. -@value{tramp} is also a Debian GNU/Linux package since February 2001. +In December 2001, XEmacs package repository adds @value{tramp}. @c Installation chapter is necessary only in case of standalone @@ -509,33 +493,25 @@ the first release including @value{tramp} was Emacs 22.1. @node Configuration -@chapter Configuring @value{tramp} for use +@chapter Configuring @value{tramp} @cindex configuration - @cindex default configuration -@value{tramp} is (normally) fully functional when it is initially -installed. It is initially configured to use the @command{scp} -program to connect to the remote host. So in the easiest case, you -just type @kbd{C-x C-f} and then enter the file name -@file{@trampfn{, user, host, /path/to.file}}. - -On some hosts, there are problems with opening a connection. These are -related to the behavior of the remote shell. See @xref{Remote shell -setup}, for details on this. - -If you do not wish to use these commands to connect to the remote -host, you should change the default connection and transfer method -that @value{tramp} uses. There are several different methods that @value{tramp} -can use to connect to remote hosts and transfer files -(@pxref{Connection types}). - -If you don't know which method is right for you, see @xref{Default -Method}. - -@strong{Note} that the following descriptions reference the setting of -user options or variables, not all of which are autoloaded by -@value{emacsname}. All examples assume that you have loaded -@value{tramp} first: + +@value{tramp} is initially configured to use the @command{scp} program +to connect to the remote host. Just type @kbd{C-x C-f} and then enter +file name @file{@trampfn{, user, host, /path/to.file}}. For details, +see @xref{Default Method}. + +For problems related to the behavior of remote shell, see @ref{Remote +shell setup} for details. + +For changing the connection type and file access method from the +defaults to one of several other options, see (@pxref{Connection +types}). + +@strong{Note} that some user options and variables described in these +examples are not auto loaded by @value{emacsname}. All examples +require @value{tramp} is installed and loaded: @lisp (require 'tramp) @@ -543,7 +519,7 @@ user options or variables, not all of which are autoloaded by @menu -* Connection types:: Types of connections made to remote hosts. +* Connection types:: Types of connections to remote hosts. * Inline methods:: Inline methods. * External methods:: External methods. @ifset emacsgvfs @@ -574,35 +550,26 @@ user options or variables, not all of which are autoloaded by @node Connection types -@section Types of connections made to remote hosts +@section Types of connections to remote hosts @cindex connection types, overview -There are two basic types of transfer methods, each with its own -advantages and limitations. Both types of connection make use of a -remote shell access program such as @command{rsh}, @command{ssh} or -@command{telnet} to connect to the remote host. - -This connection is used to perform many of the operations that @value{tramp} -requires to make the remote file system transparently accessible from -the local host. It is only when visiting files that the methods -differ. +@dfn{Inline method} and @dfn{external method} are the two basic types +of access methods. While they both use the same remote shell access +programs, such as @command{rsh}, @command{ssh}, or @command{telnet}, +they differ in the file access methods. Choosing the right method +becomes important for editing files, transferring large files, or +operating on a large number of files. @cindex inline methods @cindex external methods @cindex methods, inline @cindex methods, external -Loading or saving a remote file requires that the content of the file -be transferred between the two hosts. The content of the file can -be transferred using one of two methods: the @dfn{inline method} over -the same connection used to log in to the remote host, or the -@dfn{external method} through another connection using a remote copy -program such as @command{rcp}, @command{scp} or @command{rsync}. The performance of the external methods is generally better than that of the inline methods, at least for large files. This is caused by the need to encode and decode the data when transferring inline. -The one exception to this rule are the @command{scp} based transfer +The one exception to this rule are the @option{scp}-based access methods. While these methods do see better performance when actually transferring files, the overhead of the cryptographic negotiation at startup may drown out the improvement in file transfer times. @@ -621,68 +588,60 @@ action. @cindex inline methods @cindex methods, inline -The inline methods in @value{tramp} are quite powerful and can work in -situations where you cannot use an external transfer program to -connect. There are also strange inline methods which allow you to -transfer files between @emph{user identities} rather than hosts, see -below. +Inline methods use the same login connection to transfer file +contents. Inline methods are quick and easy for small files. They +depend on the availability of suitable encoding and decoding programs +on the remote host. For local source and destination, @value{tramp} +may use built-in equivalents of such programs in @value{emacsname}. -These methods depend on the existence of a suitable encoding and -decoding command on remote host. Locally, @value{tramp} may be able to -use features of @value{emacsname} to decode and encode the files or -it may require access to external commands to perform that task. +Inline methods can work in situations where an external transfer +program is unavailable. Inline methods also work when transferring +files between different @emph{user identities} on the same host. @cindex uuencode @cindex mimencode @cindex base-64 encoding -@value{tramp} checks the availability and usability of commands like -@command{mimencode} (part of the @command{metamail} package) or -@command{uuencode} on the remote host. The first reliable command -will be used. The search path can be customized, see @ref{Remote -programs}. -If both commands aren't available on the remote host, @value{tramp} -transfers a small piece of Perl code to the remote host, and tries to -apply it for encoding and decoding. +@value{tramp} checks the remote host for the availability and +usability of @command{mimencode} (part of the @command{metamail} +package) or @command{uuencode}. @value{tramp} uses the first reliable +command it finds. @value{tramp}'s search path can be customized, see +@ref{Remote programs}. -The variable @var{tramp-inline-compress-start-size} controls, whether -a file shall be compressed before encoding. This could increase -transfer speed for large text files. +In case both @command{mimencode} and @command{uuencode} are +unavailable, @value{tramp} first transfers a small Perl program to the +remote host, and then tries that program for encoding and decoding. +To increase transfer speeds for large text files, use compression +before encoding. The variable @var{tramp-inline-compress-start-size} +specifies the file size for such optimization. @table @asis @item @option{rsh} @cindex method rsh @cindex rsh method -Connect to the remote host with @command{rsh}. Due to the unsecure -connection it is recommended for very local host topology only. - -On operating systems which provide the command @command{remsh} instead -of @command{rsh}, you can use the method @option{remsh}. This is true -for HP-UX or Cray UNICOS, for example. +@command{rsh} is an option for connecting to hosts within local +networks since @command{rsh} is not as secure as other methods. @item @option{ssh} @cindex method ssh @cindex ssh method -Connect to the remote host with @command{ssh}. This is identical to -the previous option except that the @command{ssh} package is used, -making the connection more secure. - -All the methods based on @command{ssh} have an additional feature: you -can specify a host name which looks like @file{host#42} (the real host -name, then a hash sign, then a port number). This means to connect to -the given host but to also pass @code{-p 42} as arguments to the -@command{ssh} command. +@command{ssh} is a more secure option than others to connect to a +remote host. +@command{ssh} can also take extra parameters as port numbers. For +example, a host on port 42 is specified as @file{host#42} (the real +host name, a hash sign, then a port number). It is the same as passing +@code{-p 42} to the @command{ssh} command. @item @option{telnet} @cindex method telnet @cindex telnet method -Connect to the remote host with @command{telnet}. This is as unsecure +Connecting to a remote host with @command{telnet} is as insecure as the @option{rsh} method. @@ -690,63 +649,46 @@ as the @option{rsh} method. @cindex method su @cindex su method -This method does not connect to a remote host at all, rather it uses -the @command{su} program to allow you to edit files as another user. -That means, the specified host name in the file name must be either -@samp{localhost} or the host name as returned by the function -@command{(system-name)}. For an exception of this rule see -@ref{Multi-hops}. - +Instead of connecting to a remote host, @command{su} program allows +editing as another user. The host can be either @samp{localhost} or +the host returned by the function @command{(system-name)}. See +@ref{Multi-hops} for an exception to this behavior. @item @option{sudo} @cindex method sudo @cindex sudo method -This is similar to the @option{su} method, but it uses @command{sudo} -rather than @command{su} to become a different user. - -Note that @command{sudo} must be configured to allow you to start a -shell as the user. It would be nice if it was sufficient if -@command{ls} and @command{mimencode} were allowed, but that is not -easy to implement, so I haven't got around to it, yet. - +Similar to @option{su} method, @option{sudo} uses @command{sudo}. +@command{sudo} must have sufficient rights to start a shell. @item @option{sshx} @cindex method sshx @cindex sshx method -As you would expect, this is similar to @option{ssh}, only a little -different. Whereas @option{ssh} opens a normal interactive shell on -the remote host, this option uses @samp{ssh -t -t @var{host} -l -@var{user} /bin/sh} to open a connection. This is useful for users -where the normal login shell is set up to ask them a number of -questions when logging in. This procedure avoids these questions, and -just gives @value{tramp} a more-or-less ``standard'' login shell to work -with. - -Note that this procedure does not eliminate questions asked by -@command{ssh} itself. For example, @command{ssh} might ask ``Are you -sure you want to continue connecting?'' if the host key of the remote -host is not known. @value{tramp} does not know how to deal with such a -question (yet), therefore you will need to make sure that you can log -in without such questions. +Works like @option{ssh} but without the extra authentication prompts. +@option{sshx} uses @samp{ssh -t -t @var{host} -l @var{user} /bin/sh} +to open a connection with a ``standard'' login shell. -This is also useful for Windows users where @command{ssh}, when -invoked from an @value{emacsname} buffer, tells them that it is not -allocating a pseudo tty. When this happens, the login shell is wont -to not print any shell prompt, which confuses @value{tramp} mightily. +@strong{Note} that @option{sshx} does not bypass authentication +questions. For example, if the host key of the remote host is not +known, @option{sshx} will still ask ``Are you sure you want to +continue connecting?''. @value{tramp} cannot handle such questions. +Connections will have to be setup where logins can proceed without +such questions. -This supports the @samp{-p} argument. +@option{sshx} is useful for Windows users when @command{ssh} triggers +an error about allocating a pseudo tty. This happens due to missing +shell prompts that confuses @value{tramp}. +@option{sshx} supports the @samp{-p} argument. @item @option{krlogin} @cindex method krlogin @cindex krlogin method @cindex Kerberos (with krlogin method) -This method is also similar to @option{ssh}. It only uses the -@command{krlogin -x} command to log in to the remote host. - +This method is also similar to @option{ssh}. It uses the +@command{krlogin -x} command only for remote host login. @item @option{ksu} @cindex method ksu @@ -760,26 +702,26 @@ This is another method from the Kerberos suite. It behaves like @option{su}. @cindex method plink @cindex plink method -This method is mostly interesting for Windows users using the PuTTY +@option{plink} method is for Windows users with the PuTTY implementation of SSH@. It uses @samp{plink -ssh} to log in to the remote host. -With a recent PuTTY, it is recommended to check the @samp{Share SSH -connections if possible} control for that session. +Check the @samp{Share SSH connections if possible} control for that +session. -This method supports the @samp{-P} argument. +@option{plink} method supports the @samp{-P} argument. @item @option{plinkx} @cindex method plinkx @cindex plinkx method -Another method using PuTTY on Windows. Instead of host names, it -expects PuTTY session names, calling @samp{plink -load @var{session} --t}. User names and port numbers must be defined in the session. +Another method using PuTTY on Windows with session names instead of +host names. @option{plinkx} calls @samp{plink -load @var{session} -t}. +User names and port numbers must be defined in the session. -With a recent PuTTY, it is recommended to check the @samp{Share SSH -connections if possible} control for that session. +Check the @samp{Share SSH connections if possible} control for that +session. @end table @@ -789,17 +731,16 @@ connections if possible} control for that session. @cindex methods, external @cindex external methods -The external methods operate through multiple channels, using the -remote shell connection for many actions while delegating file -transfers to an external transfer utility. +External methods operate over multiple channels, using the remote +shell connection for some actions while delegating file transfers to +an external transfer program. -This saves the overhead of encoding and decoding that multiplexing the -transfer through the one connection has with the inline methods. +External methods save on the overhead of encoding and decoding of +inline methods. -Since external methods need their own overhead opening a new channel, -all files which are smaller than @var{tramp-copy-size-limit} are still -transferred with the corresponding inline method. It should provide a -fair trade-off between both approaches. +Since external methods have the overhead of opening a new channel, +files smaller than @var{tramp-copy-size-limit} still use inline +methods. @table @asis @item @option{rcp}---@command{rsh} and @command{rcp} @@ -808,14 +749,12 @@ fair trade-off between both approaches. @cindex rcp (with rcp method) @cindex rsh (with rcp method) -This method uses the @command{rsh} and @command{rcp} commands to connect -to the remote host and transfer files. This is probably the fastest -connection method available. +This method uses the @command{rsh} and @command{rcp} commands to +connect to the remote host and transfer files. This is the fastest +access method available. The alternative method @option{remcp} uses the @command{remsh} and -@command{rcp} commands. It should be applied on hosts where -@command{remsh} is used instead of @command{rsh}. - +@command{rcp} commands. @item @option{scp}---@command{ssh} and @command{scp} @cindex method scp @@ -823,22 +762,16 @@ The alternative method @option{remcp} uses the @command{remsh} and @cindex scp (with scp method) @cindex ssh (with scp method) -Using @command{ssh} to connect to the remote host and @command{scp} to -transfer files between the hosts is the best method for securely -connecting to a remote host and accessing files. - -The performance of this option is also quite good. It may be slower than -the inline methods when you often open and close small files however. -The cost of the cryptographic handshake at the start of an @command{scp} -session can begin to absorb the advantage that the lack of encoding and -decoding presents. - -All the @command{ssh} based methods support the @samp{-p} feature -where you can specify a port number to connect to in the host name. -For example, the host name @file{host#42} tells @value{tramp} to -specify @samp{-p 42} in the argument list for @command{ssh}, and to -specify @samp{-P 42} in the argument list for @command{scp}. +Using a combination of @command{ssh} to connect and @command{scp} to +transfer is the most secure. While the performance is good, it is +slower than the inline methods for smaller files. Though there is no +overhead of encoding and decoding of the inline methods, +@command{scp}'s cryptographic handshake negates those speed gains. +@option{ssh}-based methods support @samp{-p} feature for specifying +port numbers. For example, @file{host#42} passes @samp{-p 42} in the +argument list to @command{ssh}, and @samp{-P 42} in the argument list +to @command{scp}. @item @option{rsync}---@command{ssh} and @command{rsync} @cindex method rsync @@ -846,17 +779,12 @@ specify @samp{-P 42} in the argument list for @command{scp}. @cindex rsync (with rsync method) @cindex ssh (with rsync method) -Using the @command{ssh} command to connect securely to the remote -host and the @command{rsync} command to transfer files is almost -identical to the @option{scp} method. +@command{ssh} command to connect in combination with @command{rsync} +command to transfer is similar to the @option{scp} method. -While @command{rsync} performs much better than @command{scp} when -transferring files that exist on both hosts, this advantage is lost if -the file exists only on one side of the connection. A file can exists -on both the remote and local host, when you copy a file from/to a -remote host. When you just open a file from the remote host (or write -a file there), a temporary file on the local side is kept as long as -the corresponding buffer, visiting this file, is alive. +@command{rsync} performs much better than @command{scp} when +transferring files that exist on both hosts. However, this advantage +is lost if the file exists only on one side of the connection. This method supports the @samp{-p} argument. @@ -867,19 +795,13 @@ This method supports the @samp{-p} argument. @cindex scp (with scpx method) @cindex ssh (with scpx method) -As you would expect, this is similar to @option{scp}, only a little -different. Whereas @option{scp} opens a normal interactive shell on -the remote host, this option uses @samp{ssh -t -t @var{host} -l -@var{user} /bin/sh} to open a connection. This is useful for users -where the normal login shell is set up to ask them a number of -questions when logging in. This procedure avoids these questions, and -just gives @value{tramp} a more-or-less ``standard'' login shell to work -with. +@option{scpx} is useful to avoid login shell questions. It is similar +in performance to @option{scp}. @option{scpx} uses @samp{ssh -t -t +@var{host} -l @var{user} /bin/sh} to open a connection. -This is also useful for Windows users where @command{ssh}, when -invoked from an @value{emacsname} buffer, tells them that it is not -allocating a pseudo tty. When this happens, the login shell is wont -to not print any shell prompt, which confuses @value{tramp} mightily. +@option{sshx} is useful for Windows users when @command{ssh} triggers +an error about allocating a pseudo tty. This happens due to missing +shell prompts that confuses @value{tramp}. This method supports the @samp{-p} argument. @@ -902,8 +824,8 @@ use the @command{plink} command to connect to the remote host, and they use @command{pscp} or @command{psftp} for transferring the files. These programs are part of PuTTY, an SSH implementation for Windows. -With a recent PuTTY, it is recommended to configure the @samp{Share -SSH connections if possible} control for that session. +Check the @samp{Share SSH connections if possible} control for that +session. These methods support the @samp{-P} argument. @@ -914,27 +836,22 @@ These methods support the @samp{-P} argument. @cindex fsh (with fcp method) @cindex fcp (with fcp method) -This method is similar to @option{scp}, but it uses the @command{fsh} -command to connect to the remote host, and it uses @command{fcp} for -transferring the files. @command{fsh/fcp} are a front-end for -@command{ssh} which allow for reusing the same @command{ssh} session -for submitting several commands. This avoids the startup overhead of -@command{scp} (which has to establish a secure connection whenever it -is called). Note, however, that you can also use one of the inline -methods to achieve a similar effect. +This method is similar to @option{scp}, but uses @command{fsh} to +connect and @command{fcp} to transfer files. @command{fsh/fcp}, a +front-end for @command{ssh}, reuse @command{ssh} session by +submitting several commands. This avoids the startup overhead due to +@command{scp}'s secure connection. Inline methods have similar +benefits. -This method uses the command @samp{fsh @var{host} -l @var{user} -/bin/sh -i} to establish the connection, it does not work to just say -@command{fsh @var{host} -l @var{user}}. +The command used for this connection is: @samp{fsh @var{host} -l +@var{user} /bin/sh -i} @cindex method fsh @cindex fsh method -There is no inline method using @command{fsh} as the multiplexing -provided by the program is not very useful in our context. @value{tramp} -opens just one connection to the remote host and then keeps it open, -anyway. - +@option{fsh} has no inline method since the multiplexing it offers is +not useful for @value{tramp}. @command{fsh} connects to remote host +and @value{tramp} keeps that one connection open. @item @option{nc}---@command{telnet} and @command{nc} @cindex method nc @@ -942,21 +859,22 @@ anyway. @cindex nc (with nc method) @cindex telnet (with nc method) -Using @command{telnet} to connect to the remote host and @command{nc} -for file transfer is often the only possibility to access dumb -devices, like routers or NAS hosts. Those hosts have just a -restricted @command{busybox} as local shell, and there is no program -to encode and decode files for transfer. - +Using @command{telnet} to connect and @command{nc} to transfer files +is sometimes the only combination suitable for accessing routers or +NAS hosts. These dumb devices have severely restricted local shells, +such as the @command{busybox} and do not host any other encode or +decode programs. @item @option{ftp} @cindex method ftp @cindex ftp method -This is not a native @value{tramp} method. Instead, it forwards all -requests to @value{ftppackagename}. +When @value{tramp} uses @option{ftp}, it forwards requests to whatever +ftp program is specified by @value{ftppackagename}. This external +program must be capable of servicing requests from @value{tramp}. + @ifset xemacs -This works only for unified file names, see @ref{Issues}. +This method works only for unified file names, see @ref{Issues}. @end ifset @@ -964,83 +882,107 @@ This works only for unified file names, see @ref{Issues}. @cindex method smb @cindex smb method -This is another not native @value{tramp} method. It uses the -@command{smbclient} command on different Unices in order to connect to -an SMB server. An SMB server might be a Samba (or CIFS) server on -another UNIX host or, more interesting, a host running MS Windows. So -far, it is tested against MS Windows NT, MS Windows 2000, MS Windows -XP, MS Windows Vista, and MS Windows 7. - -The first directory in the localname must be a share name on the remote -host. Remember that the @code{$} character, in which default shares -usually end, must be written @code{$$} due to environment variable -substitution in file names. If no share name is given (i.e., remote -directory @code{/}), all available shares are listed. - -Since authorization is done on share level, you will always be -prompted for a password if you access another share on the same host. -This can be suppressed by @ref{Password handling}. - -For authorization, MS Windows uses both a user name and a domain name. -Because of this, the @value{tramp} syntax has been extended: you can -specify a user name which looks like @code{user%domain} (the real user -name, then a percent sign, then the domain name). So, to connect to -the host @code{melancholia} as user @code{daniel} of the domain -@code{BIZARRE}, and edit @file{.emacs} in the home directory (share -@code{daniel$}) I would specify the file name @file{@trampfn{smb, -daniel%BIZARRE, melancholia, /daniel$$/.emacs}}. - -Depending on the Windows domain configuration, a Windows user might be -considered as domain user per default. In order to connect as local -user, the WINS name of that host must be given as domain name. -Usually, it is the host name in capital letters. In the example -above, the local user @code{daniel} would be specified as -@file{@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs}}. - -The domain name as well as the user name are optional. If no user -name is specified at all, the anonymous user (without password -prompting) is assumed. This is different from all other @value{tramp} -methods, where in such a case the local user name is taken. - -The @option{smb} method supports the @samp{-p} argument. - -@strong{Please note:} If @value{emacsname} runs locally under MS -Windows, this method isn't available. Instead, you can use UNC -file names like @file{//melancholia/daniel$$/.emacs}. The only -disadvantage is that there's no possibility to specify another user -name. +This is another non-native @value{tramp} method. @command{smbclient} +connects to any host with SMB/CIFS protocol, such as MS Windows and +Samba Servers running on Unixes. Tests show this @value{tramp} method +works with MS Windows NT, MS Windows 2000, MS Windows XP, MS Windows +Vista, and MS Windows 7. + +Using @command{smbclient} requires a few tweaks when working with +@value{tramp}: + +The first directory in the localname must be a share name on the +remote host. + +Since smb shares end in the @code{$} character, @value{tramp} must use +@code{$$} when specifying those shares to avoid environment variable +substitutions. + +When @value{tramp} is not specific about the share name or uses the +generic remote directory @code{/}, @command{smbclient} returns all +available shares. + +Since SMB authentication is based on each SMB share, @value{tramp} +prompts for a password even when accessing a different share on the +same SMB host. This prompting can be suppressed by @ref{Password +handling}. + +To accommodate user name/domain name syntax required by MS Windows +authorization, @value{tramp} provides for an extended syntax in +@code{user%domain} format (where user is username, @code{%} is the +percent symbol, and domain is the windows domain name). An example: + +@example +@trampfn{smb, daniel%BIZARRE, melancholia, /daniel$$/.emacs} +@end example + +where user @code{daniel} connects as a domain user to the SMB host +@code{melancholia} in the windows domain @code{BIZARRE} to edit +@file{.emacs} located in the home directory (share @code{daniel$}). + +Alternatively, for local WINS users (as opposed to domain users), +substitute the domain name with the name of the local host in +UPPERCASE as shown here: + +@example +@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs} +@end example + +where user @code{daniel} connects as local user to the SMB host +@code{melancholia} in the local domain @code{MELANCHOLIA} to edit +@file{.emacs} located in the home directory (share @code{daniel$}). + +The domain name and user name are optional for @command{smbclient} +authentication. When user name is not specified, @command{smbclient} +uses the anonymous user (without prompting for password). This +behavior is unlike other @value{tramp} methods, where local user name +is substituted. + +@option{smb} method is unavailable if @value{emacsname} is run under a +local user authentication context in MS Windows. However such users +can still access remote files using UNC file names instead of @value{tramp}: + +@example +//melancholia/daniel$$/.emacs +@end example + +UNC file name specification does not allow to specify a different user +name for authentication like the @command{smbclient} can. @item @option{adb} @cindex method adb @cindex adb method -This special method uses the Android Debug Bridge for accessing -Android devices. The Android Debug Bridge must be installed locally. -Some GNU/Linux distributions offer it for installation, otherwise it -can be installed as part of the Android SDK@. If the @command{adb} -program is not found via the @env{PATH} environment variable, the -variable @var{tramp-adb-program} must point to its absolute path. - -@value{tramp} does not connect Android devices to @command{adb}, -unless the custom option @option{tramp-adb-connect-if-not-connected} -is non-@code{nil}. If there is exactly one Android device connected -to @command{adb}, a host name is not needed in the remote file name. -The default @value{tramp} name to be used is @file{@trampfn{adb, , ,}}, -therefore. Otherwise, one could find potential host names with the -command @command{adb devices}. - -Usually, the @command{adb} method does not need any user name. It -runs under the permissions of the @command{adbd} process on the -Android device. If a user name is specified, @value{tramp} applies an -@command{su} on the device. This does not work with all Android -devices, especially with unrooted ones. In that case, an error -message is displayed. - -If a device shall be connected via TCP/IP, it is possible to declare -the port number to be used like @file{device#42}. Without a port -number, the default value as declared in @command{adb} will be used. -Port numbers are not applicable to Android devices connected via USB. +This method uses Android Debug Bridge program for accessing Android +devices. The Android Debug Bridge must be installed locally for +@value{tramp} to work. Some GNU/Linux distributions provide Android +Debug Bridge as an installation package. Alternatively, the program is +installed as part of the Android SDK@. @value{tramp} finds the +@command{adb} program either via the @env{PATH} environment variable +or the absolute path set in the variable @var{tramp-adb-program}. + +@value{tramp} connects to Android devices with @option{adb} only when +the custom option @option{tramp-adb-connect-if-not-connected} is not +@code{nil}. Otherwise, the connection must be established outside +@value{emacsname}. + +@value{tramp} does not require a host name part of the remote file +name when a single Android device is connected to @command{adb}. +@value{tramp} instead uses @file{@trampfn{adb, , ,}} as the default +name. @command{adb devices} shows available host names. + +@option{adb} method normally does not need user name to authenticate +on the Andriod device because it runs under the @command{adbd} +process. But when a user name is specified, however, @value{tramp} +applies an @command{su} in the syntax. When authentication does not +succeed, especially on un-rooted Android devices, @value{tramp} +displays login errors. + +For Andriod devices connected through TCP/IP, a port number can be +specified using @file{device#42} host name syntax or @value{tramp} can +use the default value as declared in @command{adb} command. Port +numbers are not applicable to Android devices connected through USB@. @end table @@ -1052,75 +994,68 @@ Port numbers are not applicable to Android devices connected via USB. @cindex gvfs based methods @cindex dbus -The connection methods described in this section are based on GVFS -@uref{http://en.wikipedia.org/wiki/GVFS}. Via GVFS, the remote -filesystem is mounted locally through FUSE@. @value{tramp} uses -this local mounted directory internally. +GVFS is the virtual file system for the Gnome Desktop, +@uref{http://en.wikipedia.org/wiki/GVFS}. Remote files on GVFS are +mounted locally through FUSE and @value{tramp} uses this locally +mounted directory internally. -The communication with GVFS is implemented via D-Bus messages. -Therefore, your @value{emacsname} must have D-Bus integration, -@pxref{Top, , D-Bus, dbus}. +@value{emacsname} uses the D-Bus mechanism to communicate with GVFS@. +@value{emacsname} must have the message bus system, D-Bus integration +active, @pxref{Top, , D-Bus, dbus}. @table @asis @item @option{afp} @cindex method afp @cindex afp method -Access to Mac OS X volumes via the Apple Filing Protocol is offered by -this method. The access must always be performed with a leading -volume (share) name, like @file{@trampfn{afp, user, host, /volume}}. - - +This method is for connecting to remote hosts with the Apple Filing +Protocol for accessing files on Mac OS X volumes. @value{tramp} access +syntax requires a leading volume (share) name, for example: +@file{@trampfn{afp, user, host, /volume}}. @item @option{dav} +@item @option{davs} @cindex method dav @cindex method davs @cindex dav method @cindex davs method -This method provides access to WebDAV files and directories. There -exists also the external method @option{davs}, which uses SSL -encryption for the access. - -Both methods support the port number specification as discussed above. - +@option{dav} method provides access to WebDAV files and directories +based on standard protocols, such as HTTP@. @option{davs} does the same +but with SSL encryption. Both methods support the port numbers. @item @option{obex} @cindex method obex @cindex obex method -OBEX is an FTP-like access protocol for simple devices, like cell -phones. For the time being, @value{tramp} only supports OBEX over Bluetooth. +OBEX is an FTP-like access protocol for cell phones and similar simple +devices. @value{tramp} supports OBEX over Bluetooth. @item @option{sftp} @cindex method sftp @cindex sftp method -As you might expect, this method uses @command{sftp} in order to -access the remote host. Contrary to the @option{ssh} and @option{scp} -methods, it doesn't open an @command{ssh} session for login. -Therefore, it could be used to access to remote hosts which refuse -@command{ssh} for security reasons. - +This method uses @command{sftp} in order to securely access remote +hosts. @command{sftp} is a more secure option for connecting to hosts +that for security reasons refuse @command{ssh} connections. @item @option{synce} @cindex method synce @cindex synce method -The @option{synce} method allows communication with Windows Mobile -devices. Beside GVFS for mounting remote files and directories via -FUSE, it also needs the SYNCE-GVFS plugin. +@option{synce} method allows connecting to Windows Mobile devices. It +uses GVFS for mounting remote files and directories via FUSE and +requires the SYNCE-GVFS plugin. @end table -@vindex tramp-gvfs-methods @defopt tramp-gvfs-methods -This custom option, a list, defines the external methods which shall -be used with GVFS@. Per default, these are @option{afp}, -@option{dav}, @option{davs}, @option{obex}, @option{sftp} and -@option{synce}. Other possible values are @option{ftp} and -@option{smb}. +@vindex tramp-gvfs-methods +This custom option is a list of external methods for GVFS@. By +default, this list includes @option{afp}, @option{dav}, @option{davs}, +@option{obex}, @option{sftp} and @option{synce}. Other methods to +include are: @option{ftp} and @option{smb}. @end defopt @end ifset @@ -1131,20 +1066,19 @@ be used with GVFS@. Per default, these are @option{afp}, @cindex methods, gateway @cindex gateway methods -Gateway methods are not methods to access a remote host directly. -These methods are intended to pass firewalls or proxy servers. -Therefore, they can be used for proxy host declarations -(@pxref{Multi-hops}) only. +Gateway methods are for proxy host declarations (@pxref{Multi-hops}) +so as to pass through firewalls and proxy servers. They are not like +the other methods that declare direct connections to a remote host. -A gateway method must always come along with a method which supports -port setting. This is because @value{tramp} targets the accompanied -method to @file{localhost#random_port}, from where the firewall or -proxy server is accessed. +A gateway method always comes with a port setting. @value{tramp} +targets the port number with the gateway method +@file{localhost#random_port} from where the firewall or proxy server +is accessed. -Gateway methods support user name and password declarations. These -are used to authenticate towards the corresponding firewall or proxy -server. They can be passed only if your friendly administrator has -granted your access. +Gateway methods support user name and password declarations for +authenticating the corresponding firewall or proxy server. Such +authentication can be passed through only if granted access by system +administrators. @table @asis @item @option{tunnel} @@ -1152,23 +1086,22 @@ granted your access. @cindex tunnel method This method implements an HTTP tunnel via the @command{CONNECT} -command (see RFC 2616, 2817). Any HTTP 1.1 compliant (proxy) server -shall support this command. +command (conforming to RFC 2616, 2817 specifications). Proxy servers +using HTTP version 1.1 or later protocol support this command. -As authentication method, only @option{Basic Authentication} (see RFC -2617) is implemented so far. If no port number is given in the -declaration, port @option{8080} is used for the proxy server. +For authentication, this protocol uses only @option{Basic +Authentication} (see RFC 2617). When no port number is specified, this +protocol defaults to @option{8080}. @item @option{socks} @cindex method socks @cindex socks method -The @command{socks} method provides access to SOCKSv5 servers (see -RFC 1928). @option{Username/Password Authentication} according to RFC -1929 is supported. +The @option{socks} method connects to SOCKSv5 servers (see RFC 1928) +and supports @option{Username/Password Authentication}. -The default port number of the socks server is @option{1080}, if not +The default port number for the socks server is @option{1080}, if not specified otherwise. @end table @@ -1178,21 +1111,23 @@ specified otherwise. @node Default Method @section Selecting a default method @cindex default method - @vindex tramp-default-method -When you select an appropriate transfer method for your typical usage -you should set the variable @code{tramp-default-method} to reflect that -choice. This variable controls which method will be used when a method -is not specified in the @value{tramp} file name. For example: +@vindex tramp-default-method-alist + +Default method is for transferring files. The variable +@code{tramp-default-method} sets it. @value{tramp} uses this variable +to determine the default method for tramp file names that do not have +one specified. @lisp (setq tramp-default-method "ssh") @end lisp -@vindex tramp-default-method-alist -You can also specify different methods for certain user/host -combinations, via the variable @code{tramp-default-method-alist}. For -example, the following two lines specify to use the @option{ssh} +Default methods for transferring files can be customized for specific +user and host combinations through the alist variable +@code{tramp-default-method-alist}. + +For example, the following two lines specify to use the @option{ssh} method for all user names matching @samp{john} and the @option{rsync} method for all host names matching @samp{lily}. The third line specifies to use the @option{su} method for the user @samp{root} on @@ -1207,95 +1142,82 @@ the host @samp{localhost}. @noindent See the documentation for the variable -@code{tramp-default-method-alist} for more details. +@code{tramp-default-method-alist} for details. -External methods are normally preferable to inline methods, giving -better performance. +@noindent +External methods performance faster for large files. +@noindent @xref{Inline methods}. @xref{External methods}. -Another consideration with the selection of transfer methods is the -environment you will use them in and, especially when used over the -Internet, the security implications of your preferred method. +Choosing the access method also depends on the security environment. +For example, @option{rsh} and @option{telnet} methods that use clear +text password transfers are inappropriate for over the Internet +connections. Secure remote connections should use @option{ssh} that +provide encryption. -The @option{rsh} and @option{telnet} methods send your password as -plain text as you log in to the remote host, as well as -transferring the files in such a way that the content can easily be -read from other hosts. -If you need to connect to remote systems that are accessible from the -Internet, you should give serious thought to using @option{ssh} based -methods to connect. These provide a much higher level of security, -making it a non-trivial exercise for someone to obtain your password -or read the content of the files you are editing. +@subsection Which method to use? +@cindex choosing the right method +@value{tramp} provides maximum number of choices for maximum +flexibility. Choosing which method depends on the hosts, clients, +network speeds, and the security context. -@subsection Which method is the right one for me? -@cindex choosing the right method +Start by using an inline method. -Given all of the above, you are probably thinking that this is all fine -and good, but it's not helping you to choose a method! Right you are. -As a developer, we don't want to boss our users around but give them -maximum freedom instead. However, the reality is that some users would -like to have some guidance, so here I'll try to give you this guidance -without bossing you around. You tell me whether it works @dots{} - -My suggestion is to use an inline method. For large files, external -methods might be more efficient, but I guess that most people will -want to edit mostly small files. And if you access large text files, -compression (driven by @var{tramp-inline-compress-start-size}) shall -still result in good performance. - -I guess that these days, most people can access a remote host by -using @command{ssh}. So I suggest that you use the @option{ssh} -method. So, type @kbd{C-x C-f @trampfn{ssh, root, otherhost, -/etc/motd} @key{RET}} to edit the @file{/etc/motd} file on the other -host. +External methods might be more efficient for large files, but most +@value{tramp} users edit small files more often than large files. -If you can't use @option{ssh} to log in to the remote host, then -select a method that uses a program that works. For instance, Windows -users might like the @option{plink} method which uses the PuTTY -implementation of @command{ssh}. Or you use Kerberos and thus like -@option{krlogin}. +Enable compression, @var{tramp-inline-compress-start-size}, for a +performance boost for large files. -For the special case of editing files on the local host as another -user, see the @option{su} or @option{sudo} methods. They offer -shortened syntax for the @samp{root} account, like -@file{@trampfn{su, , , /etc/motd}}. +Since @command{ssh} has become the most common method of remote host +access and it has the most reasonable security protocols, use +@option{ssh} method. Typical @option{ssh} usage to edit the +@file{/etc/motd} file on the otherhost: -People who edit large files may want to consider @option{scp} instead -of @option{ssh}, or @option{pscp} instead of @option{plink}. These -external methods are faster than inline methods for large files. -Note, however, that external methods suffer from some limitations. -Please try first whether you really get a noticeable speed advantage -from using an external method! Maybe even for large files, inline -methods are fast enough. +@example +@kbd{C-x C-f @trampfn{ssh, root, otherhost,/etc/motd} @key{RET}} +@end example + +If @option{ssh} is unavailable for whatever reason, look for other +obvious options. For Windows, try the @option{plink} method. For +Kerberos, try @option{krlogin}. + +For editing local files as @option{su} or @option{sudo} methods, try +the shortened syntax of @samp{root}: + +@example +@kbd{C-x C-f @trampfn{su, , , /etc/motd} @key{RET}} +@end example + +For editing large files, @option{scp} is faster than @option{ssh}. +@option{pscp} is faster than @option{plink}. But this speed +improvement is not always true. @node Default User @section Selecting a default user @cindex default user +@vindex tramp-default-user +@vindex tramp-default-user-alist -The user part of a @value{tramp} file name can be omitted. Usually, -it is replaced by the user name you are logged in. Often, this is not -what you want. A typical use of @value{tramp} might be to edit some -files with root permissions on the local host. This case, you should -set the variable @code{tramp-default-user} to reflect that choice. +@value{tramp} file name can omit the user name part since +@value{tramp} substitutes the currently logged-in user name. However +this substitution can be overridden with @code{tramp-default-user}. For example: @lisp (setq tramp-default-user "root") @end lisp -@code{tramp-default-user} is regarded as obsolete, and will be removed -soon. - -@vindex tramp-default-user-alist -You can also specify different users for certain method/host -combinations, via the variable @code{tramp-default-user-alist}. For -example, if you always have to use the user @samp{john} in the domain -@samp{somewhere.else}, you can specify the following: +Instead of a single default user, @code{tramp-default-user-alist} +allows multiple default user values based on access method or host +name combinations. The alist can hold multiple values. For example, to +use the @samp{john} as the default user for the domain +@samp{somewhere.else} only: @lisp (add-to-list 'tramp-default-user-alist @@ -1306,69 +1228,54 @@ example, if you always have to use the user @samp{john} in the domain See the documentation for the variable @code{tramp-default-user-alist} for more details. -One trap to fall in must be known. If @value{tramp} finds a default -user, this user will be passed always to the connection command as -parameter (for example @command{ssh here.somewhere.else -l john}. If -you have specified another user for your command in its configuration -files, @value{tramp} cannot know it, and the remote access will fail. -If you have specified in the given example in @file{~/.ssh/config} the -lines - -@example -Host here.somewhere.else - User lily -@end example - -@noindent -than you must discard selecting a default user by @value{tramp}. This -will be done by setting it to @code{nil} (or @samp{lily}, likewise): +A Caution: @value{tramp} will override any default user specified in +the configuration files outside @value{emacsname}, such as +@file{~/.ssh/config}. To stop @value{tramp} from applying the default +value, set the corresponding alist entry to nil: @lisp (add-to-list 'tramp-default-user-alist '("ssh" "\\`here\\.somewhere\\.else\\'" nil)) @end lisp -The last entry in @code{tramp-default-user-alist} could be your -default user you'll apply predominantly. You shall @emph{append} it -to that list at the end: +The last entry in @code{tramp-default-user-alist} should be reserved +for catch-all or most often used login. @lisp -(add-to-list 'tramp-default-user-alist '(nil nil "jonas") t) +(add-to-list 'tramp-default-user-alist + '(nil nil "jonas") t) @end lisp @node Default Host @section Selecting a default host @cindex default host - @vindex tramp-default-host -Finally, it is even possible to omit the host name part of a -@value{tramp} file name. This case, the value of the variable -@code{tramp-default-host} is used. Per default, it is initialized -with the host name your local @value{emacsname} is running. +@vindex tramp-default-host-alist -If you, for example, use @value{tramp} mainly to contact the host -@samp{target} as user @samp{john}, you can specify: +When host name is omitted, @value{tramp} substitutes the value from +the @code{tramp-default-host} variable. It is initially populated with +the local hostname where @value{emacsname} is running. Both the +default user and default host can be overridden as follows: @lisp (setq tramp-default-user "john" tramp-default-host "target") @end lisp -Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you -to John's home directory on target. +With both defaults set, @samp{@trampfn{ssh, , ,}} will connect +@value{tramp} to John's home directory on target. + @ifset emacs -Note, however, that the most simplification @samp{/::} won't work, -because @samp{/:} is the prefix for quoted file names. +@strong{Note} @samp{/::} won't work, because @samp{/:} is the prefix +for quoted file names. @end ifset -@vindex tramp-default-host-alist -Like with methods and users, you can also specify different default -hosts for certain method/user combinations via the variable -@code{tramp-default-host-alist}. Usually, this isn't necessary, -because @code{tramp-default-host} should be sufficient. For some -methods, like @option{adb}, that default value must be overwritten, -which is already the initial value of @code{tramp-default-host-alist}. +Instead of a single default host, @code{tramp-default-host-alist} +allows multiple default host values based on access method or user +name combinations. The alist can hold multiple values. While +@code{tramp-default-host} is sufficient in most cases, some methods, +like @option{adb}, require defaults overwritten. @noindent See the documentation for the variable @code{tramp-default-host-alist} @@ -1380,28 +1287,27 @@ for more details. @cindex multi-hop @cindex proxy hosts -Sometimes, the methods described before are not sufficient. -Sometimes, it is not possible to connect to a remote host using a -simple command. For example, if you are in a secured network, you -might have to log in to a bastion host first before you can connect to -the outside world. Of course, the target host may also require a -bastion host. +Multi-hops are methods to reach hosts behind firewalls or to reach the +outside world from inside a bastion host. With multi-hops, +@value{tramp} can negotiate these hops with the appropriate user/host +authentication at each hop. All methods until now have been the single +hop kind, where the start and end points of the connection did not +have intermediate check points. -@vindex tramp-default-proxies-alist @defopt tramp-default-proxies-alist -In order to specify multiple hops, it is possible to define a proxy -host to pass through, via the custom option -@option{tramp-default-proxies-alist}. This variable keeps a list of -triples (@var{host} @var{user} @var{proxy}). - -The first matching item specifies the proxy host to be passed for a -file name located on a remote target matching @var{user}@@@var{host}. -@var{host} and @var{user} are regular expressions or @code{nil}, which -is interpreted as a regular expression which always matches. - -@var{proxy} must be a Tramp file name which localname part is ignored. -Method and user name on @var{proxy} are optional, which is interpreted -with the default values. +@vindex tramp-default-proxies-alist +@option{tramp-default-proxies-alist} specifies proxy hosts to pass +through. This variable is list of triples consisting of (@var{host} +@var{user} @var{proxy}). + +The first match is the proxy host through which passes the file name +and the target host matching @var{user}@@@var{host}. @var{host} and +@var{user} are regular expressions or @code{nil}, interpreted as a +regular expression which always matches. + +@var{proxy} is a literal @value{tramp} file name whose local name part +is ignored, and the method and user name parts are optional. + @ifset emacsgw The method must be an inline or gateway method (@pxref{Inline methods}, @pxref{Gateway methods}). @@ -1412,9 +1318,8 @@ The method must be an inline method (@pxref{Inline methods}). If @var{proxy} is @code{nil}, no additional hop is required reaching @var{user}@@@var{host}. -If you, for example, must pass the host @samp{bastion.your.domain} as -user @samp{bird} for any remote host which is not located in your local -domain, you can set +For example, to pass through the host @samp{bastion.your.domain} as +user @samp{bird} to reach remote hosts outside the local domain: @lisp (add-to-list 'tramp-default-proxies-alist @@ -1423,13 +1328,12 @@ domain, you can set '("\\.your\\.domain\\'" nil nil)) @end lisp -Please note the order of the code. @code{add-to-list} adds elements at the -beginning of a list. Therefore, most relevant rules must be added last. +@strong{Note}: @code{add-to-list} adds elements at the beginning of a +list. Therefore, most relevant rules must come last in the list. -Proxy hosts can be cascaded. If there is another host called -@samp{jump.your.domain}, which is the only one in your local domain who -is allowed connecting @samp{bastion.your.domain}, you can add another -rule: +Proxy hosts can be cascaded in the alist. If there is another host +called @samp{jump.your.domain}, which is the only host allowed to +connect to @samp{bastion.your.domain}, then: @lisp (add-to-list 'tramp-default-proxies-alist @@ -1438,31 +1342,31 @@ rule: "@trampfn{ssh, , jump.your.domain,}")) @end lisp -@var{proxy} can contain the patterns @code{%h} or @code{%u}. These -patterns are replaced by the strings matching @var{host} or -@var{user}, respectively. +@var{proxy} can take patterns @code{%h} or @code{%u} for @var{host} or +@var{user} respectively. -If you, for example, wants to work as @samp{root} on hosts in the -domain @samp{your.domain}, but login as @samp{root} is disabled for -non-local access, you might add the following rule: +To login as @samp{root} on remote hosts in the domain +@samp{your.domain}, but login as @samp{root} is disabled for non-local +access, then use this alist entry: @lisp (add-to-list 'tramp-default-proxies-alist '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}")) @end lisp -Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect -first @samp{randomhost.your.domain} via @code{ssh} under your account -name, and perform @code{sudo -u root} on that host afterwards. It is -important to know that the given method is applied on the host which -has been reached so far. @code{sudo -u root}, applied on your local -host, wouldn't be useful here. +Opening @file{@trampfn{sudo, , randomhost.your.domain,}} first +connects to @samp{randomhost.your.domain} via @code{ssh} under your +account name, and then perform @code{sudo -u root} on that host. -@var{host}, @var{user} and @var{proxy} can also be Lisp forms. These -forms are evaluated, and must return a string, or @code{nil}. The -previous example could be generalized then: For all hosts except my -local one connect via @command{ssh} first, and apply @command{sudo -u -root} afterwards: +It is key for the sudo method in the above example to be applied on +the host after reaching it and not on the local host. + +@var{host}, @var{user} and @var{proxy} can also take Lisp forms. These +forms when evaluated must return either a string or @code{nil}. + +To generalize (from the previous example): For all hosts, except my +local one, first connect via @command{ssh}, and then apply +@command{sudo -u root}: @lisp (add-to-list 'tramp-default-proxies-alist @@ -1471,46 +1375,45 @@ root} afterwards: '((regexp-quote (system-name)) nil nil)) @end lisp -This is the recommended configuration to work as @samp{root} on remote -Ubuntu hosts. +The above configuration allows @value{tramp} connection as @samp{root} +to remote Ubuntu hosts. @ifset emacsgw -Finally, @code{tramp-default-proxies-alist} can be used to pass -firewalls or proxy servers. Imagine your local network has a host -@samp{proxy.your.domain} which is used on port 3128 as HTTP proxy to -the outer world. Your friendly administrator has granted you access -under your user name to @samp{host.other.domain} on that proxy -server.@footnote{HTTP tunnels are intended for secure SSL/TLS -communication. Therefore, many proxy server restrict the tunnels to -related target ports. You might need to run your ssh server on your -target host @samp{host.other.domain} on such a port, like 443 (https). -See @uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall} -for discussion of ethical issues.} You would need to add the -following rule: +@code{tramp-default-proxies-alist} is also used for passing through +firewalls or proxy servers. + +For example, the local host @samp{proxy.your.domain} on port 3128 +serves as HTTP proxy to the outer world. User has access rights to +another proxy server on @samp{host.other.domain}.@footnote{HTTP tunnels +are intended for secure SSL/TLS communication. Therefore, many proxy +servers restrict the tunnels to related target ports. You might need +to run your ssh server on your target host @samp{host.other.domain} on +such a port, like 443 (https). See +@uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall} for +discussion of ethical issues.} Then the configuration is: @lisp (add-to-list 'tramp-default-proxies-alist '("\\`host\\.other\\.domain\\'" nil - "@trampfn{tunnel, , proxy.your.domain#3128,}")) + "@trampfn{tunnel, , proxy.your.domain#3128,}")) @end lisp -Gateway methods can be declared as first hop only in a multiple hop -chain. +Gateway methods in a multiple hop chain can be declared only as the first hop. @end ifset @end defopt -Hops to be passed tend to be restricted firewalls and alike. -Sometimes they offer limited features only, like running @command{rbash} -(restricted bash). This must be told to @value{tramp}. +Passing through hops involves dealing with restricted shells, such as +@command{rbash}. If @value{tramp} is made aware, then it would use +them for proxies only. -@vindex tramp-restricted-shell-hosts-alist @defopt tramp-restricted-shell-hosts-alist -This custom option keeps a list of regular expressions, which denote -hosts running a registered shell like @command{rbash}. Those hosts -can be used as proxies only. +@vindex tramp-restricted-shell-hosts-alist +An alist of regular expressions of hosts running restricted shells, +such as @command{rbash}. @value{tramp} will then use them only as +proxies. -If the bastion host from the example above runs a restricted shell, -you shall apply +To specify the bastion host from the example above as running a +restricted shell: @lisp (add-to-list 'tramp-restricted-shell-hosts-alist @@ -1525,11 +1428,10 @@ you shall apply @cindex using non-standard methods @cindex create your own methods -There is a variable @code{tramp-methods} which you can change if the -predefined methods don't seem right. - -For the time being, I'll refer you to the Lisp documentation of that -variable, accessible with @kbd{C-h v tramp-methods @key{RET}}. +The @code{tramp-methods} variable currently has an exhaustive list of +predefined methods. Any part of this list can be modified with more +suitable settings. Refer to the Lisp documentation of that variable, +accessible with @kbd{C-h v tramp-methods @key{RET}}. @node Customizing Completion @@ -1538,15 +1440,14 @@ variable, accessible with @kbd{C-h v tramp-methods @key{RET}}. @cindex selecting config files @vindex tramp-completion-function-alist -The variable @code{tramp-completion-function-alist} is intended to -customize which files are taken into account for user and host name -completion (@pxref{File name completion}). For every method, it keeps -a set of configuration files, accompanied by a Lisp function able to -parse that file. Entries in @code{tramp-completion-function-alist} -have the form (@var{method} @var{pair1} @var{pair2} @dots{}). +@code{tramp-completion-function-alist} uses predefined files for user +and host name completion (@pxref{File name completion}). For each +method, it keeps a set of configuration files and a function that can +parse that file. Each entry in @code{tramp-completion-function-alist} +is of the form (@var{method} @var{pair1} @var{pair2} @dots{}). Each @var{pair} is composed of (@var{function} @var{file}). -@var{function} is responsible to extract user names and host names +@var{function} is responsible for extracting user names and host names from @var{file} for completion. There are two functions which access this variable: @@ -1619,31 +1520,28 @@ case, hosts names are coded in file names @item @code{tramp-parse-hosts} @findex tramp-parse-hosts -A function dedicated to @file{/etc/hosts} style files. It returns -host names only. +A function dedicated to @file{/etc/hosts} for host names. @item @code{tramp-parse-passwd} @findex tramp-parse-passwd -A function which parses @file{/etc/passwd} like files. Obviously, it -can return user names only. +A function which parses @file{/etc/passwd} files for user names. @item @code{tramp-parse-netrc} @findex tramp-parse-netrc -Finally, a function which parses @file{~/.netrc} like files. This -includes also @file{~/.authinfo}-style files. +A function which parses @file{~/.netrc} and @file{~/.authinfo}-style files. @end table -If you want to keep your own data in a file, with your own structure, -you might provide such a function as well. This function must meet -the following conventions: +To keep a custom file with custom data in a custom structure, a custom +function has to be provided. This function must meet the following +conventions: @defun my-tramp-parse file -@var{file} must be either a file name on your host, or @code{nil}. -The function must return a list of (@var{user} @var{host}), which are -taken as candidates for user and host name completion. +@var{file} must be either a file on the host, or @code{nil}. The +function must return a list of (@var{user} @var{host}), which are +taken as candidates for completion for user and host names. Example: @example @@ -1658,144 +1556,127 @@ Example: @section Reusing passwords for several connections @cindex passwords -Sometimes it is necessary to connect to the same remote host several -times. Reentering passwords again and again would be annoying, when -the chosen method does not support access without password prompt -through own configuration. - -The best recommendation is to use the method's own mechanism for -password handling. Consider @command{ssh-agent} for @option{ssh}-like +To avoid repeated prompts for passwords, consider native caching +mechanisms, such as @command{ssh-agent} for @option{ssh}-like methods, or @command{pageant} for @option{plink}-like methods. -However, if you cannot apply such native password handling, -@value{tramp} offers alternatives. +@value{tramp} offers alternatives when native solutions cannot meet +the need. @anchor{Using an authentication file} @subsection Using an authentication file - @vindex auth-sources -The package @file{auth-source.el}, originally developed in No Gnus, -offers the possibility to read passwords from a file, like FTP does it -from @file{~/.netrc}. The default authentication file is -@file{~/.authinfo.gpg}, this can be changed via the variable + +The package @file{auth-source.el}, originally developed for No Gnus, +reads passwords from different sources, @xref{Help for users, , +auth-source, auth}. The default authentication file is +@file{~/.authinfo.gpg}, but this can be changed via the variable @code{auth-sources}. @noindent -A typical entry in the authentication file would be +A typical entry in the authentication file: @example machine melancholia port scp login daniel password geheim @end example -The port can be any @value{tramp} method (@pxref{Inline methods}, -@pxref{External methods}), to match only this method. When you omit -the port, you match all @value{tramp} methods. +The port can take any @value{tramp} method (@pxref{Inline methods}, +@pxref{External methods}). Omitting port values matches all +@value{tramp} methods. -In case of problems, setting @code{auth-source-debug} to @code{t} -gives useful debug messages. +Setting @code{auth-source-debug} to @code{t} to debug messages. @anchor{Caching passwords} @subsection Caching passwords -If there is no authentication file, @value{tramp} caches the passwords -entered by you. They will be reused next time if a connection needs -them for the same user name and host name, independently of the -connection method. +@value{tramp} can cache passwords as entered and reuse when needed for +the same user or host name independent of the access method. @vindex password-cache-expiry -Passwords are not saved permanently, that means the password caching -is limited to the lifetime of your @value{emacsname} session. You -can influence the lifetime of password caching by customizing the -variable @code{password-cache-expiry}. The value is the number of -seconds how long passwords are cached. Setting it to @code{nil} -disables the expiration. + +@code{password-cache-expiry} sets the duration (in seconds) the +passwords are remembered. Passwords are never saved permanently nor +can they extend beyond the lifetime of the current @value{emacsname} +session. Set @code{password-cache-expiry} to @code{nil} to disable +expiration. @vindex password-cache -If you don't like this feature for security reasons, password caching -can be disabled totally by customizing the variable -@code{password-cache} (setting it to @code{nil}). -Implementation Note: password caching is based on the package -@file{password-cache.el}. For the time being, it is activated only -when this package is seen in the @code{load-path} while loading -@value{tramp}. +Set @code{password-cache} to @code{nil} to disable password caching. + +@strong{Implementation Note}: password caching depends on +@file{password-cache.el} package. @value{tramp} activates password +caching only if @value{tramp} can discover, while @value{emacsname} is +loading, the package through @code{load-path}. + @ifset installchapter -If you don't use No Gnus, you can take @file{password.el} from the -@value{tramp} @file{contrib} directory, see @ref{Installation -parameters}. +@file{password.el} is available from No Gnus or from the @value{tramp} +@file{contrib} directory, see @ref{Installation parameters}. @end ifset @node Connection caching @section Reusing connection related information @cindex caching - @vindex tramp-persistency-file-name -In order to reduce initial connection time, @value{tramp} stores -connection related information persistently. The variable -@code{tramp-persistency-file-name} keeps the file name where these -information are written. Its default value is + +For faster initial connection times, @value{tramp} stores previous +connection properties in a file specified by the variable +@code{tramp-persistency-file-name}. + +The default file name for @code{tramp-persistency-file-name} is: @ifset emacs @file{~/.emacs.d/tramp}. @end ifset @ifset xemacs @file{~/.xemacs/tramp}. @end ifset -It is recommended to choose a local file name. - -@value{tramp} reads this file during startup, and writes it when -exiting @value{emacsname}. You can simply remove this file if -@value{tramp} shall be urged to recompute these information next -@value{emacsname} startup time. - -Using such persistent information can be disabled by setting -@code{tramp-persistency-file-name} to @code{nil}. - -Once consequence of reusing connection related information is that -@value{tramp} needs to distinguish hosts. If you, for example, run a -local @code{sshd} on port 3001, which tunnels @command{ssh} to another -host, you could access both @file{@trampfn{ssh, , localhost,}} and -@file{@trampfn{ssh, , localhost#3001,}}. @value{tramp} would use the -same host related information (like paths, Perl variants, etc) for -both connections, although the information is valid only for one of -them. -In order to avoid trouble, you must use another host name for one of -the connections, like introducing a @option{Host} section in -@file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying -multiple hops (@pxref{Multi-hops}). +@value{tramp} reads this file during @value{emacsname} startup, and +writes to it when exiting @value{emacsname}. Delete this file for +@value{tramp} to recreate a new one on next @value{emacsname} startup. + +Set @code{tramp-persistency-file-name} to @code{nil} to disable +storing connections persistently. -When @value{tramp} detects a changed operating system version on a -remote host (via the command @command{uname -sr}), it flushes all -connection related information for this host, and opens the -connection again. +To reuse connection information from the persistent list, +@value{tramp} needs to uniquely identify every host. However in some +cases, two different connections may result in the same persistent +information. For example, connecting to a host using @command{ssh} and +connecting to the same host through @code{sshd} on port 3001. Both +access methods result in nearly identical persistent specifications +@file{@trampfn{ssh, , localhost,}} and @file{@trampfn{ssh, , +localhost#3001,}}. + +Changing host names could avoid duplicates. One way is to add a +@option{Host} section in @file{~/.ssh/config} (@pxref{Frequently Asked +Questions}). Another way is to apply multiple hops (@pxref{Multi-hops}). + +When @value{tramp} detects a change in the operating system version in +a remote host (via the command @command{uname -sr}), it flushes all +connection related information for that host and creates a new entry. @node Predefined connection information @section Setting own connection related information +@vindex tramp-connection-properties -Sometimes, method specific arguments in @code{tramp-methods} do not -fit your needs. Sometimes, @value{tramp} is not able to detect -correct connection related information. In such cases, you could tell -@value{tramp} which value it has to take. Since this could result in -errors, it has to be used with care. +For more precise customization, parameters specified by +@code{tramp-methods} can be overwritten manually. -@vindex tramp-connection-properties -Such settings can be performed via the list -@code{tramp-connection-properties}. An entry in this list has the -form @code{(@var{regexp} @var{property} @var{value})}. @var{regexp} -matches remote file names for which a property shall be predefined. -It can be @code{nil}. @var{property} is a string, and @var{value} the -corresponding value. - -@var{property} could be any method specific parameter found in -@code{tramp-methods}. The parameter key in @code{tramp-methods} is a -symbol name @code{tramp-<foo>}. In order to overwrite it, -@var{property} must be the string @samp{<foo>}. If you, for example, -want to change the remote shell to be used on a remote machine, you -could apply +Set @code{tramp-connection-properties} to manually override +@code{tramp-methods}. Properties in this list are in the form +@code{(@var{regexp} @var{property} @var{value})}. @var{regexp} matches +remote file names. Use @code{nil} to match all. @var{property} is the +property's name, and @var{value} is the property's value. + +@var{property} is any method specific parameter contained in +@code{tramp-methods}. The parameter key in @code{tramp-methods} is a +symbol name @code{tramp-<foo>}. To overwrite that property, use the +string @samp{<foo>} for @var{property}. For example, this changes the +remote shell: @lisp (add-to-list 'tramp-connection-properties @@ -1806,17 +1687,15 @@ could apply "remote-shell-login" '("-"))) @end lisp -This would overwrite the @code{tramp-remote-shell} and -@code{tramp-remote-shell-login} parameters in @code{tramp-methods}, to -be used on that remote host. +The parameters @code{tramp-remote-shell} and +@code{tramp-remote-shell-login} in @code{tramp-methods} now have new +values for the remote host. -@var{property} could also be any property found in the file +@var{property} could also be any property found in @code{tramp-persistency-file-name}. -A special property is @samp{busybox}. This must be set, if the remote -host runs a very restricted busybox as shell, which closes the -connection at will. Since there is no reliable test for this, -@value{tramp} must be indicated this way. Example: +To get around how restricted shells randomly drop connections, set the +special property @samp{busybox}. For example: @lisp (add-to-list 'tramp-connection-properties @@ -1828,69 +1707,55 @@ connection at will. Since there is no reliable test for this, @node Remote programs @section How @value{tramp} finds and uses programs on the remote host -@value{tramp} depends on a number of programs on the remote host in order to -function, including @command{ls}, @command{test}, @command{find} and +@value{tramp} requires access to and rights to several commands on +remote hosts: @command{ls}, @command{test}, @command{find} and @command{cat}. -In addition to these required tools, there are various tools that may be -required based on the connection method. See @ref{Inline methods} and -@ref{External methods} for details on these. +Besides there are other required programs for @ref{Inline methods} and +@ref{External methods} of connection. -Certain other tools, such as @command{perl} (or @command{perl5}) and -@command{grep} will be used if they can be found. When they are -available, they are used to improve the performance and accuracy of -remote file access. +To improve performance and accuracy of remote file access, +@value{tramp} uses @command{perl} (or @command{perl5}) and +@command{grep} when available. +@defopt tramp-remote-path @vindex tramp-remote-path @vindex tramp-default-remote-path @vindex tramp-own-remote-path -@defopt tramp-remote-path -When @value{tramp} connects to the remote host, it searches for the -programs that it can use. The custom option -@option{tramp-remote-path} controls the directories searched on the -remote host. +@option{tramp-remote-path} specifies which remote directory paths +@value{tramp} can search for @ref{Remote programs}. -By default, this is set to a reasonable set of defaults for most -hosts. The symbol @code{tramp-default-remote-path} is a place -holder, it is replaced by the list of directories received via the -command @command{getconf PATH} on your remote host. For example, -on Debian GNU/Linux this is @file{/bin:/usr/bin}, whereas on Solaris -this is @file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin}. -It is recommended to apply this symbol on top of -@option{tramp-remote-path}. +@value{tramp} uses standard defaults, such as @file{/bin} and +@file{/usr/bin}, which are reasonable for most hosts. To accommodate +differences in hosts and paths, for example, @file{/bin:/usr/bin} on +Debian GNU/Linux or +@file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin} on +Solaris, @value{tramp} queries the remote host with @command{getconf +PATH} and updates the symbol @code{tramp-default-remote-path}. -It is possible, however, that your local (or remote ;) system -administrator has put the tools you want in some obscure local -directory. - -In this case, you can still use them with @value{tramp}. You simply -need to add code to your @file{.emacs} to add the directory to the -remote path. This will then be searched by @value{tramp} when you -connect and the software found. - -To add a directory to the remote search path, you could use code such -as: +For instances where hosts keep obscure locations for paths for +security reasons, manually add such paths to local @file{.emacs} as +shown below for @value{tramp} to use when connecting. @lisp (add-to-list 'tramp-remote-path "/usr/local/perl/bin") @end lisp -Another possibility is to reuse the path settings of your remote -account when you log in. Usually, these settings are overwritten, -because they might not be useful for @value{tramp}. The place holder -@code{tramp-own-remote-path} preserves these settings. You can -activate it via +Another way to find the remote path is to use the path assigned to the +remote user by the remote host. @value{tramp} does not normally retain +this remote path after logging. However, @code{tramp-own-remote-path} +preserves the path value, which can be used to update +@code{tramp-remote-path}. @lisp (add-to-list 'tramp-remote-path 'tramp-own-remote-path) @end lisp @end defopt -@value{tramp} caches several information, like the Perl binary -location. The changed remote search path wouldn't affect these -settings. In order to force @value{tramp} to recompute these values, -you must exit @value{emacsname}, remove your persistency file -(@pxref{Connection caching}), and restart @value{emacsname}. +When remote search paths are changed, local @value{tramp} caches must +be recomputed. To force @value{tramp} to recompute afresh, exit +@value{emacsname}, remove the persistent file (@pxref{Connection +caching}), and restart @value{emacsname}. @node Remote shell setup @@ -1900,77 +1765,44 @@ you must exit @value{emacsname}, remove your persistency file @cindex @file{.login} file @cindex shell init files -As explained in the @ref{Overview} section, @value{tramp} connects to the -remote host and talks to the shell it finds there. Of course, when you -log in, the shell executes its init files. Suppose your init file -requires you to enter the birth date of your mother; clearly @value{tramp} -does not know this and hence fails to log you in to that host. - -There are different possible strategies for pursuing this problem. One -strategy is to enable @value{tramp} to deal with all possible situations. -This is a losing battle, since it is not possible to deal with -@emph{all} situations. The other strategy is to require you to set up -the remote host such that it behaves like @value{tramp} expects. This might -be inconvenient because you have to invest a lot of effort into shell -setup before you can begin to use @value{tramp}. - -The package, therefore, pursues a combined approach. It tries to -figure out some of the more common setups, and only requires you to -avoid really exotic stuff. For example, it looks through a list of -directories to find some programs on the remote host. And also, it -knows that it is not obvious how to check whether a file exists, and -therefore it tries different possibilities. (On some hosts and -shells, the command @command{test -e} does the trick, on some hosts -the shell builtin doesn't work but the program @command{/usr/bin/test --e} or @command{/bin/test -e} works. And on still other hosts, -@command{ls -d} is the right way to do this.) - -Below you find a discussion of a few things that @value{tramp} does not deal -with, and that you therefore have to set up correctly. +@value{tramp} checks for the availability of standard programs in the +usual locations. Common tactics include successively trying +@command{test -e}, @command{/usr/bin/test -e}, and @command{/bin/test +-e}. @command{ls -d} is another approach. But these approaches do not +help with these new login patterns. -@table @asis -@item @var{shell-prompt-pattern} -@vindex shell-prompt-pattern - -After logging in to the remote host, @value{tramp} has to wait for the remote -shell startup to finish before it can send commands to the remote -shell. The strategy here is to wait for the shell prompt. In order to -recognize the shell prompt, the variable @code{shell-prompt-pattern} has -to be set correctly to recognize the shell prompt on the remote host. - -Note that @value{tramp} requires the match for @code{shell-prompt-pattern} -to be at the end of the buffer. Many people have something like the -following as the value for the variable: @samp{^[^>$][>$] *}. Now -suppose your shell prompt is @code{a <b> c $ }. In this case, -@value{tramp} recognizes the @code{>} character as the end of the prompt, -but it is not at the end of the buffer. +When @value{tramp} encounters two-factor logins or additional challenge +questions, such as entering birth date or security code or passphrase, +@value{tramp} needs a few more configuration steps to accommodate +them. +The difference between a password prompt and a passphrase prompt is +that the password for completing the login while the passphrase is +for authorizing access to local authentication information, such as +the ssh key. + +There is no one configuration to accommodate all the variations in +login security, especially not the exotic ones. However, @value{tramp} +provides a few tweaks to address the most common ones. + +@table @asis @item @var{tramp-shell-prompt-pattern} @vindex tramp-shell-prompt-pattern -This regular expression is used by @value{tramp} in the same way as -@code{shell-prompt-pattern}, to match prompts from the remote shell. -This second variable exists because the prompt from the remote shell -might be different from the prompt from a local shell---after all, -the whole point of @value{tramp} is to log in to remote hosts as a -different user. The default value of -@code{tramp-shell-prompt-pattern} is the same as the default value of -@code{shell-prompt-pattern}, which is reported to work well in many -circumstances. +@code{tramp-shell-prompt-pattern} is for remote login shell prompt, +which may not be the same as the local login shell prompt, +@code{shell-prompt-pattern}. Since most hosts use identical prompts, +@value{tramp} sets a similar default value for both prompts. @item @var{tramp-password-prompt-regexp} +@item @var{tramp-wrong-passwd-regexp} @vindex tramp-password-prompt-regexp @vindex tramp-wrong-passwd-regexp -During login, @value{tramp} might be forced to enter a password or a -passphrase. The difference between both is that a password is -requested from the shell on the remote host, while a passphrase is -needed for accessing local authentication information, like your ssh -key. - -@var{tramp-password-prompt-regexp} handles the detection of such -requests for English environments. When you use another localization -of your (local or remote) host, you might need to adapt this. Example: +@value{tramp} uses @var{tramp-password-prompt-regexp} to distinguish +between prompts for passwords and prompts for passphrases. By default, +@var{tramp-password-prompt-regexp} handles the detection in English +language environments. See a localization example below: @lisp (setq @@ -1988,29 +1820,29 @@ of your (local or remote) host, you might need to adapt this. Example: ".*:\0? *")) @end lisp -In parallel, it might also be necessary to adapt -@var{tramp-wrong-passwd-regexp}. +Similar localization may be necessary for handling wrong password +prompts, for which @value{tramp} uses @var{tramp-wrong-passwd-regexp}. @item @command{tset} and other questions @cindex Unix command tset @cindex tset Unix command +@vindex tramp-terminal-type -Some people invoke the @command{tset} program from their shell startup -scripts which asks the user about the terminal type of the shell. -Maybe some shells ask other questions when they are started. -@value{tramp} does not know how to answer these questions. There are -two approaches for dealing with this problem. One approach is to take -care that the shell does not ask any questions when invoked from -@value{tramp}. You can do this by checking the @env{TERM} -environment variable, it will be set to @code{dumb} when connecting. +To suppress inappropriate prompts for terminal type, @value{tramp} +sets the @env{TERM} to @code{dumb} before the remote login process +begins via the variable @code{tramp-terminal-type}. This will silence +common @command{tset} related prompts. -@vindex tramp-terminal-type -The variable @code{tramp-terminal-type} can be used to change this value -to @code{dumb}. +@value{tramp}'s strategy for handling such prompts (commonly triggered +from login scripts on remote hosts) is to set the environment +variables so that no prompts interrupt the shell initialization +process. @vindex tramp-actions-before-shell -The other approach is to teach @value{tramp} about these questions. See -the variable @code{tramp-actions-before-shell}. Example: + +An alternative approach is to configure @value{tramp} with strings +that can identify such questions using +@code{tramp-actions-before-shell}. Example: @lisp (defconst my-tramp-prompt-regexp @@ -2030,80 +1862,61 @@ the variable @code{tramp-actions-before-shell}. Example: @end lisp -@item Environment variables named like users in @file{.profile} +@item Conflicting names for users and variables in @file{.profile} -If you have a user named frumple and set the variable @env{FRUMPLE} in -your shell environment, then this might cause trouble. Maybe rename -the variable to @env{FRUMPLE_DIR} or the like. - -This weird effect was actually reported by a @value{tramp} user! +When a user name is the same as a variable name in a local file, such +as @file{.profile}, then @value{tramp} may send incorrect values for +environment variables. To avoid incorrect values, change the local +variable name to something different from the user name. For example, +if the user name is @env{FRUMPLE}, then change the variable name to +@env{FRUMPLE_DIR}. @item Non-Bourne commands in @file{.profile} -After logging in to the remote host, @value{tramp} issues the command -@command{exec /bin/sh}. (Actually, the command is slightly -different.) When @command{/bin/sh} is executed, it reads some init -files, such as @file{~/.shrc} or @file{~/.profile}. - -Now, some people have a login shell which is not @code{/bin/sh} but a -Bourne-ish shell such as bash or ksh. Some of these people might put -their shell setup into the files @file{~/.shrc} or @file{~/.profile}. -This way, it is possible for non-Bourne constructs to end up in those -files. Then, @command{exec /bin/sh} might cause the Bourne shell to -barf on those constructs. - -As an example, imagine somebody putting @command{export FOO=bar} into -the file @file{~/.profile}. The standard Bourne shell does not -understand this syntax and will emit a syntax error when it reaches -this line. - -Another example is the tilde (@code{~}) character, say when adding -@file{~/bin} to @env{PATH}. Many Bourne shells will not expand this -character, and since there is usually no directory whose name consists -of the single character tilde, strange things will happen. - -What can you do about this? - -Well, one possibility is to make sure that everything in -@file{~/.shrc} and @file{~/.profile} on all remote hosts is -Bourne-compatible. In the above example, instead of @command{export -FOO=bar}, you might use @command{FOO=bar; export FOO} instead. - -The other possibility is to put your non-Bourne shell setup into some -other files. For example, bash reads the file @file{~/.bash_profile} -instead of @file{~/.profile}, if the former exists. So bash -aficionados just rename their @file{~/.profile} to -@file{~/.bash_profile} on all remote hosts, and Bob's your uncle. - -The @value{tramp} developers would like to circumvent this problem, so -if you have an idea about it, please tell us. However, we are afraid -it is not that simple: before saying @command{exec /bin/sh}, -@value{tramp} does not know which kind of shell it might be talking -to. It could be a Bourne-ish shell like ksh or bash, or it could be a -csh derivative like tcsh, or it could be zsh, or even rc. If the -shell is Bourne-ish already, then it might be prudent to omit the -@command{exec /bin/sh} step. But how to find out if the shell is -Bourne-ish? +When the remote host's @file{.profile} is also used for shells other +than Bourne shell, then some incompatible syntaxes for commands in +@file{.profile} may trigger errors in Bourne shell on the host and may +not complete client's @value{tramp} connections. + +One example of a Bourne shell incompatible syntax in @file{.profile}: +using @command{export FOO=bar} instead of @command{FOO=bar; export +FOO}. After remote login, @value{tramp} will trigger an error during +its execution of @command{/bin/sh} on the remote host because Bourne +shell does not recognize the export command as entered in +@file{.profile}. + +Likewise, (@code{~}) character in paths will cause errors because +Bourne shell does not do (@code{~}) character expansions. + +One approach to avoiding these incompatibilities is to make all +commands in @file{~/.shrc} and @file{~/.profile} Bourne shell +compatible so @value{tramp} can complete connections to that remote. +To accommodate using non-Bourne shells on that remote, use other +shell-specific config files. For example, bash can use +@file{~/.bash_profile} and ignore @file{.profile}. @item Interactive shell prompt -@value{tramp} redefines the shell prompt in order to parse the shell's -output robustly. When calling an interactive shell by @kbd{M-x -shell}, this doesn't look nice. +@value{tramp} redefines the remote shell prompt internally for robust +parsing. This redefinition affects the looks of a prompt in an +interactive remote shell through commands, such as @kbd{M-x +shell}. Such prompts, however, can be reset to something more readable +and recognizable using these @value{tramp} variables. -You can redefine the shell prompt by checking the environment variable -@env{INSIDE_EMACS}, which is set by @value{tramp}, in your startup -script @file{~/.emacs_SHELLNAME}. @env{SHELLNAME} might be the string -@code{bash} or similar, in case of doubt you could set it the -environment variable @env{ESHELL} in your @file{.emacs}: +@value{tramp} sets the @env{INSIDE_EMACS} variable in the startup +script file @file{~/.emacs_SHELLNAME}. + +@env{SHELLNAME} is @code{bash} or equivalent shell names. Change it by +setting the environment variable @env{ESHELL} in the @file{.emacs} as +follows: @lisp (setenv "ESHELL" "bash") @end lisp -Your file @file{~/.emacs_SHELLNAME} could contain code like +Then re-set the prompt string in @file{~/.emacs_SHELLNAME} as follows: @example # Reset the prompt for remote Tramp shells. @@ -2122,18 +1935,16 @@ fi @cindex Unix command nc @cindex nc Unix command -The @command{nc} command will be used with the @option{nc} method. On -the remote host, a listener will be installed. Unfortunately, the -command line syntax for this has been changed with the different -@command{busybox} versions. @value{tramp} uses the following syntax -(see @code{tramp-methods}): +@value{tramp}'s @option{nc} method uses the @command{nc} command to +install and execute a listener as follows (see @code{tramp-methods}): @example # nc -l -p 42 @end example -If your remote @command{nc} refuses to accept the @command{-p} -parameter, you could overwrite the syntax with the following form: +The above command-line syntax has changed with @command{busybox} +versions. If @command{nc} refuses the @command{-p} parameter, then +overwrite as follows: @lisp (add-to-list @@ -2142,7 +1953,7 @@ parameter, you could overwrite the syntax with the following form: @end lisp @noindent -with @samp{192.168.0.1} being the IP address of your remote host +where @samp{192.168.0.1} is the remote host IP address (@pxref{Predefined connection information}). @end table @@ -2152,18 +1963,17 @@ with @samp{192.168.0.1} being the IP address of your remote host @section Android shell setup hints @cindex android shell setup -Android devices use a restricted shell. They can be accessed via the -@option{adb} method. However, this restricts the access to a USB -connection, and it requires the installation of the Android SDK on the -local host. +@value{tramp} uses the @option{adb} method to access Android +devices. Android devices provide a restricted shell access through an +USB connection. The local host must have Andriod SDK installed. -When an @command{sshd} process runs on the Android device, like -provided by the @code{SSHDroid} app, any @option{ssh}-based method can -be used. This requires some special settings. +Applications such as @code{SSHDroid} that run @command{sshd} process +on the Android device can accept any @option{ssh}-based methods +provided these settings are adjusted: -The default shell @code{/bin/sh} does not exist. Instead, you shall -use just @code{sh}, which invokes the shell installed on the device. -You can instruct @value{tramp} by this form: +@code{sh} must be specified for remote shell since Android devices do +not provide @code{/bin/sh}. @code{sh} will then invoke whatever shell is +installed on the device with this setting: @lisp (add-to-list 'tramp-connection-properties @@ -2171,13 +1981,12 @@ You can instruct @value{tramp} by this form: @end lisp @noindent -with @samp{192.168.0.26} being the IP address of your Android device +where @samp{192.168.0.26} is the Android device's IP address. (@pxref{Predefined connection information}). -The user settings for the @env{PATH} environment variable must be -preserved. It has also been reported, that the commands in -@file{/system/xbin} are better suited than the ones in -@file{/system/bin}. Add these setting: +@value{tramp} requires preserving @env{PATH} environment variable from +user settings. Android devices prefer @file{/system/xbin} path over +@file{/system/bin}. Both of these are set as follows: @lisp (add-to-list 'tramp-remote-path 'tramp-own-remote-path) @@ -2185,20 +1994,20 @@ preserved. It has also been reported, that the commands in @end lisp @noindent -If the Android device is not @samp{rooted}, you must give the shell a -writable directory for temporary files: +When the Android device is not @samp{rooted}, specify a writable +directory for temporary files: @lisp (add-to-list 'tramp-remote-process-environment "TMPDIR=$HOME") @end lisp @noindent -Now you shall be able to open a remote connection with @kbd{C-x C-f -@trampfn{ssh, , 192.168.0.26#2222, }}, given that @command{sshd} -listens on port @samp{2222}. +Open a remote connection with the command @kbd{C-x C-f @trampfn{ssh, , +192.168.0.26#2222, }}, where @command{sshd} is listening on port +@samp{2222}. -It is also recommended to add a corresponding entry to your -@file{~/.ssh/config} for that connection, like +To add a corresponding entry to the @file{~/.ssh/config} file +(recommended), use this: @example Host android @@ -2208,7 +2017,8 @@ Host android @end example @noindent -In this case, you must change the setting for the remote shell to +To use the host name @samp{android} instead of the IP address shown in +the previous example, fix the connection properties as follows: @lisp (add-to-list 'tramp-connection-properties @@ -2216,8 +2026,8 @@ In this case, you must change the setting for the remote shell to @end lisp @noindent -You would open the connection with @kbd{C-x C-f @trampfn{ssh, , -android, }} then. +Open a remote connection with a more concise command @kbd{C-x C-f +@trampfn{ssh, , android, }}. @node Auto-save and Backup @@ -2231,22 +2041,24 @@ android, }} then. @vindex bkup-backup-directory-info @end ifset -Normally, @value{emacsname} writes backup files to the same directory -as the original files, but this behavior can be changed via the -variable +To avoid @value{tramp} from saving backup files owned by root to +locations accessible to others, default backup settings in @ifset emacs -@code{backup-directory-alist}. +@code{backup-directory-alist} @end ifset @ifset xemacs -@code{bkup-backup-directory-info}. +@code{bkup-backup-directory-info} @end ifset -In connection with @value{tramp}, this can have unexpected side -effects. Suppose that you specify that all backups should go to the -directory @file{~/.emacs.d/backups/}, and then you edit the file -@file{@trampfn{su, root, localhost, /etc/secretfile}}. The effect is -that the backup file will be owned by you and not by root, thus -possibly enabling others to see it even if they were not intended to -see it. +have to be altered. + +Here's a scenario where files could be inadvertently +exposed. @value{emacsname} by default writes backup files to the same +directory as the original files unless changed to another location, +such as @file{~/.emacs.d/backups/}. Such a directory will also be used +by default by @value{tramp} when using, say, a restricted file +@file{@trampfn{su, root, localhost, /etc/secretfile}}. The backup file +of the secretfile is now owned by the user logged in from tramp and +not root. When @ifset emacs @@ -2257,16 +2069,8 @@ When @end ifset is @code{nil} (the default), such problems do not occur. -Therefore, it is useful to set special values for @value{tramp} -files. For example, the following statement effectively ``turns off'' -the effect of -@ifset emacs -@code{backup-directory-alist} -@end ifset -@ifset xemacs -@code{bkup-backup-directory-info} -@end ifset -for @value{tramp} files: +To ``turns off'' the backup feature for @value{tramp} files and stop +@value{tramp} from saving to the backup directory, use this: @ifset emacs @lisp @@ -2283,8 +2087,8 @@ for @value{tramp} files: @end ifset @ifset emacs -It is also possible to disable backups depending on the used method. -The following code disables backups for the @option{su} and +@noindent +Disabling backups can be targetted to just @option{su} and @option{sudo} methods: @lisp @@ -2298,24 +2102,28 @@ The following code disables backups for the @option{su} and @end lisp @end ifset - -Another possibility is to use the @value{tramp} variable +Another option is to create better backup file naming with user and +host names prefixed to the file name. For example, transforming +@file{/etc/secretfile} to +@file{~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile}, set the +@value{tramp} variable @ifset emacs -@code{tramp-backup-directory-alist}. +@code{tramp-backup-directory-alist} @end ifset @ifset xemacs -@code{tramp-bkup-backup-directory-info}. +@code{tramp-bkup-backup-directory-info} @end ifset -This variable has the same meaning like +from the existing variable @ifset emacs @code{backup-directory-alist}. @end ifset @ifset xemacs @code{bkup-backup-directory-info}. @end ifset -If a @value{tramp} file is backed up, and DIRECTORY is an absolute -local file name, DIRECTORY is prepended with the @value{tramp} file -name prefix of the file to be backed up. + +Then @value{tramp} backs up to a file name that is transformed with a +prefix consisting of the DIRECTORY name. This file name prefixing +happens only when the DIRECTORY is an absolute local file name. @noindent Example: @@ -2348,101 +2156,98 @@ The backup file name of @file{@trampfn{su, root, localhost, ~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}} @end ifset -The same problem can happen with auto-saving files. +Just as for backup files, similar issues of file naming affect +auto-saving @value{tramp} files. @ifset emacs -The variable @code{auto-save-file-name-transforms} keeps information, -on which directory an auto-saved file should go. By default, it is -initialized for @value{tramp} files to the local temporary directory. - -On some versions of @value{emacsname}, namely the version built for -Debian GNU/Linux, the variable @code{auto-save-file-name-transforms} -contains the directory where @value{emacsname} was built. A -workaround is to manually set the variable to a sane value. +Auto-saved files are saved in the directory specified by the variable +@code{auto-save-file-name-transforms}. By default this is set to the +local temporary directory. But in some versions of Debian GNU/Linux, +this points to the source directory where the @value{emacsname} was +compiled. Reset such values to a valid directory. -If auto-saved files should go into the same directory as the original -files, @code{auto-save-file-name-transforms} should be set to @code{nil}. +Set @code{auto-save-file-name-transforms} to @code{nil} to save +auto-saved files to the same directory as the original file. -Another possibility is to set the variable -@code{tramp-auto-save-directory} to a proper value. +Alternatively, set the variable @code{tramp-auto-save-directory} to +direct all auto saves to that location. @end ifset @ifset xemacs -For this purpose you can set the variable @code{auto-save-directory} -to a proper value. +@code{auto-save-directory} can also be used here instead of other +locations specfied above. @end ifset - @node Windows setup hints @section Issues with Cygwin ssh @cindex Cygwin, issues -This section needs a lot of work! Please help. +This section is incomplete. Please share your solutions. @cindex method sshx with Cygwin @cindex sshx method with Cygwin -The recent Cygwin installation of @command{ssh} works only with a -Cygwinized @value{emacsname}. You can check it by typing @kbd{M-x -eshell}, and starting @kbd{ssh test.host}. The problem is evident -if you see a message like this: + +Cygwin's @command{ssh} works only with a Cygwin version of +@value{emacsname}. To check for compatibility: type @kbd{M-x eshell}, and +start @kbd{ssh test.host}. Incompatbilities trigger this message: @example Pseudo-terminal will not be allocated because stdin is not a terminal. @end example -Older @command{ssh} versions of Cygwin are told to cooperate with -@value{tramp} selecting @option{sshx} as the connection method. You -can find information about setting up Cygwin in their FAQ at -@uref{http://cygwin.com/faq/}. +Some older versions of Cygwin's @command{ssh} work with the +@option{sshx} access method. Consult Cygwin's FAQ at +@uref{http://cygwin.com/faq/} for details. + @cindex method scpx with Cygwin @cindex scpx method with Cygwin -If you wish to use the @option{scpx} connection method, then you might -have the problem that @value{emacsname} calls @command{scp} with a -Windows file name such as @code{c:/foo}. The Cygwin version of -@command{scp} does not know about Windows file names and interprets -this as a remote file name on the host @code{c}. -One possible workaround is to write a wrapper script for @option{scp} -which converts the Windows file name to a Cygwinized file name. +When using the @option{scpx} access method, @value{emacsname} may call +@command{scp} with Windows file naming, such as @code{c:/foo}. But +the version of @command{scp} that is installed with Cygwin does not +know about Windows file naming, which causes it to incorrectly look +for a host named @code{c}. + +A workaround: write a wrapper script for @option{scp} to convert +Windows file names to Cygwin file names. @cindex Cygwin and ssh-agent @cindex SSH_AUTH_SOCK and @value{emacsname} on Windows -If you want to use either @option{ssh} based method on Windows, then -you might encounter problems with @command{ssh-agent}. Using this -program, you can avoid typing the pass-phrase every time you log in. -However, if you start @value{emacsname} from a desktop shortcut, then -the environment variable @env{SSH_AUTH_SOCK} is not set and so -@value{emacsname} and thus @value{tramp} and thus @command{ssh} and -@command{scp} started from @value{tramp} cannot communicate with -@command{ssh-agent}. It works better to start @value{emacsname} from -the shell. -If anyone knows how to start @command{ssh-agent} under Windows in such a -way that desktop shortcuts can profit, please holler. I don't really -know anything at all about Windows@dots{} +When using the @command{ssh-agent} on Windows for password-less +interaction, @option{ssh} methods depend on the environment variable +@env{SSH_AUTH_SOCK}. But this variable is not set when +@value{emacsname} is started from a Desktop shortcut and +authentication fails. + +One workaround is to use a Windows based SSH Agent, such as +Pageant. It is part of the Putty Suite of tools. + +The fallback is to start @value{emacsname} from a shell. @node Usage @chapter Using @value{tramp} @cindex using @value{tramp} -Once you have installed @value{tramp} it will operate fairly -transparently. You will be able to access files on any remote host -that you can log in to as though they were local. - -Files are specified to @value{tramp} using a formalized syntax specifying the -details of the system to connect to. This is similar to the syntax used -by the @value{ftppackagename} package. +@value{tramp} operates transparently, accessing remote files as if +they are local. However, @value{tramp} employs a formalized remote +file naming syntax to perform its functions transparently. This +syntax consists of many parts specifying access methods, +authentication, host names, and file names. +@ifset emacs +@value{ftppackagename} uses a similar syntax. +@end ifset @cindex type-ahead -Something that might happen which surprises you is that -@value{emacsname} remembers all your keystrokes, so if you see a -password prompt from @value{emacsname}, say, and hit @kbd{@key{RET}} -twice instead of once, then the second keystroke will be processed by -@value{emacsname} after @value{tramp} has done its thing. Why, this -type-ahead is normal behavior, you say. Right you are, but be aware -that opening a remote file might take quite a while, maybe half a -minute when a connection needs to be opened. Maybe after half a -minute you have already forgotten that you hit that key! + +Unlike opening local files in @value{emacsname}, which are +instantaneous, opening remote files in @value{tramp} is slower at +first. Sometimes there is a noticable delay before the prompts for +passwords or authentication appear in the minibuffer. Hitting +@kbd{@key{RET}} or other keys during this gap will be processed by +@value{emacsname}. This type-ahead facility is a feature of +@value{emacsname} that may cause missed prompts when using +@value{tramp}. @menu * File name Syntax:: @value{tramp} file name conventions. @@ -2458,107 +2263,96 @@ minute you have already forgotten that you hit that key! @cindex file name syntax @cindex file name examples -To access the file @var{localname} on the remote host @var{host} -you would specify the file name @file{@trampfn{, , host, -localname}}. This will connect to @var{host} and transfer the file -using the default method. @xref{Default Method}. - -Some examples of @value{tramp} file names are shown below. +@file{@trampfn{, , host, localfilename}} +opens file @var{localfilename} on the remote host @var{host}, using +the default method. @xref{Default Method}. @table @file @item @value{prefix}melancholia@value{postfix}.emacs -Edit the file @file{.emacs} in your home directory on the host +For the file @file{.emacs} located in the home directory, on the host @code{melancholia}. @item @value{prefix}melancholia.danann.net@value{postfix}.emacs -This edits the same file, using the fully qualified domain name of +For the file @file{.emacs} specified using the fully qualified domain name of the host. @item @value{prefix}melancholia@value{postfix}~/.emacs -This also edits the same file; the @file{~} is expanded to your -home directory on the remote host, just like it is locally. +For the file @file{.emacs} specified using the @file{~}, which is expanded. @item @value{prefix}melancholia@value{postfix}~daniel/.emacs -This edits the file @file{.emacs} in the home directory of the user -@code{daniel} on the host @code{melancholia}. The @file{~<user>} -construct is expanded to the home directory of that user on the remote -host. +For the file @file{.emacs} located in @code{daniel}'s home directory +on the host, @code{melancholia}. The @file{~<user>} construct is +expanded to the home directory of that user on the remote host. @item @value{prefix}melancholia@value{postfix}/etc/squid.conf -This edits the file @file{/etc/squid.conf} on the host -@code{melancholia}. +For the file @file{/etc/squid.conf} on the host @code{melancholia}. @end table -@var{host} can also be an IPv4 or IPv6 address, like in -@file{@trampfn{, , 127.0.0.1, .emacs}} or @file{@trampfn{, , +@var{host} can take IPv4 or IPv6 address, as in @file{@trampfn{, , +127.0.0.1, .emacs}} or @file{@trampfn{, , @value{ipv6prefix}::1@value{ipv6postfix}, .emacs}}. @ifset emacs For syntactical reasons, IPv6 addresses must be embedded in square brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}. @end ifset -Unless you specify a different name to use, @value{tramp} will use the -current local user name as the remote user name to log in with. If you -need to log in as a different user, you can specify the user name as -part of the file name. +By default, @value{tramp} will use the current local user name as the +remote user name for log in to the remote host. Specifying a different +name using the proper syntax will override this default behavior: + +@example +@trampfn{, user, host, path/to.file} +@end example + +@file{@trampfn{, daniel, melancholia, .emacs}} is for file +@file{.emacs} in @code{daniel}'s home directory on the host, +@code{melancholia}. -To log in to the remote host as a specific user, you use the syntax -@file{@trampfn{, user, host, path/to.file}}. That means that -connecting to @code{melancholia} as @code{daniel} and editing -@file{.emacs} in your home directory you would specify -@file{@trampfn{, daniel, melancholia, .emacs}}. +Specify other file access methods (@pxref{Inline methods}, +@pxref{External methods}) as part of the file name. -It is also possible to specify other file transfer methods -(@pxref{Inline methods}, @pxref{External methods}) as part of the -file name. @ifset emacs -This is done by putting the method before the user and host name, as -in @file{@value{prefix}@var{method}@value{postfixhop}} (Note the -trailing colon). +Method name comes before user name, as in +@file{@value{prefix}@var{method}@value{postfixhop}} (Note the trailing +colon). @end ifset @ifset xemacs This is done by replacing the initial @file{@value{prefix}} with -@file{@value{prefix}<method>@value{postfixhop}}. (Note the trailing +@file{@value{prefix}@var{method}@value{postfixhop}} (Note the trailing slash!). @end ifset -The user, host and file specification remain the same. +The syntax specificaton for user, host, and file do not change. -So, to connect to the host @code{melancholia} as @code{daniel}, -using the @option{ssh} method to transfer files, and edit -@file{.emacs} in my home directory I would specify the file name -@file{@trampfn{ssh, daniel, melancholia, .emacs}}. +To connect to the host @code{melancholia} as @code{daniel}, using +@option{ssh} method for @file{.emacs} in @code{daniel}'s home +directory, the full specification is: @file{@trampfn{ssh, daniel, +melancholia, .emacs}}. -@ifset emacs -A remote file name containing a host name only, which is equal to a -method name, is not allowed. If such a host name is used, it must -always be preceded by an explicit method name, like -@file{@value{prefix}ssh@value{postfixhop}ssh@value{postfix}}. -@end ifset +A remote file name containing a host name, which is the same string as +a method name, is not allowed. -Finally, for some methods it is possible to specify a different port -number than the default one, given by the method. This is specified -by adding @file{#<port>} to the host name, like in @file{@trampfn{ssh, -daniel, melancholia#42, .emacs}}. +For specifying port numbers, affix @file{#<port>} to the host +name. For example: @file{@trampfn{ssh, daniel, melancholia#42, +.emacs}}. @node File name completion @section File name completion @cindex file name completion -File name completion works with @value{tramp} for completion of method -names, of user names and of host names as well as for completion of -file names on remote hosts. +@value{tramp} can complete the following @value{tramp} file name +components: method names, user names, host names, and file names +located on remote hosts. @ifset emacs -In order to enable this, partial completion must be activated in your -@file{.emacs}. +Enable this by activating partial completion in @file{.emacs}. @ifinfo @xref{Completion Options, , , @value{emacsdir}}. @end ifinfo @end ifset -If you, for example, type @kbd{C-x C-f @value{prefix}t -@key{TAB}}, @value{tramp} might give you as result the choice for +For example, type @kbd{C-x C-f @value{prefix}t @key{TAB}}, +@value{tramp} completion choices show up as @example @c @multitable {@trampfn{telnet, , melancholia.danann.net,}} {@trampfn{telnet, , 192.168.0.1,}} @@ -2580,12 +2374,11 @@ is a possible completion for the respective method, @end ifset and @samp{@value{prefixhop}toto@value{postfix}} might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts} -file (given you're using default method @option{ssh}). +file (when using @option{ssh} as default method). -If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to -@samp{@value{prefix}telnet@value{postfixhop}}. -Next @kbd{@key{TAB}} brings you all host names @value{tramp} detects in -your @file{/etc/hosts} file, let's say +Type @kbd{e @key{TAB}} for the minibuffer completion to +@samp{@value{prefix}telnet@value{postfixhop}}. Typing @kbd{@key{TAB}} +shows host names @value{tramp} from @file{/etc/hosts} file, for example. @example @multitable @columnfractions .5 .5 @@ -2596,21 +2389,20 @@ your @file{/etc/hosts} file, let's say @end multitable @end example -Now you can choose the desired host, and you can continue to -complete file names on that host. +Choose a host from the above list and then continue to complete file +names on that host. -If the configuration files (@pxref{Customizing Completion}), which -@value{tramp} uses for analysis of completion, offer user names, those user -names will be taken into account as well. +When the configuration (@pxref{Customizing Completion}) includes user +names, then the completion lists will account for the user names as well. -Remote hosts which have been visited in the past and kept -persistently (@pxref{Connection caching}) will be offered too. +Remote hosts previously visited or hosts whose connections are kept +persistently (@pxref{Connection caching}) will be included in the +completion lists. -Once the remote host identification is completed, it comes to -file name completion on the remote host. This works pretty much like -for files on the local host, with the exception that minibuffer -killing via a double-slash works only on the file name part, except -that file name part starts with @file{//}. +After remote host name completion comes completion of file names on +the remote host. It works the same as on loal host file completion +except when killing with double-slash @file{//} kills only the file +name part of the @value{tramp} file name syntax. @ifset emacs A triple-slash stands for the default behavior. @end ifset @@ -2642,18 +2434,17 @@ Example: @end ifset @end example -A remote directory might have changed its contents out of -@value{emacsname} control, for example by creation or deletion of -files by other processes. Therefore, during file name completion, the -remote directory contents are reread regularly in order to detect such -changes, which would be invisible otherwise (@pxref{Connection caching}). +During file name completion, remote directory contents are re-read +regularly to account for any changes in the filesystem that may affect +the completion candidates. Such re-reads can account for changes to +the file system by applications outside @value{emacsname} +(@pxref{Connection caching}). -@vindex tramp-completion-reread-directory-timeout @defopt tramp-completion-reread-directory-timeout -This custom option defines the number of seconds since last remote -command before rereading a directory contents. A value of 0 would -require an immediate reread during file name completion, @code{nil} -means to use always cached values for the directory contents. +@vindex tramp-completion-reread-directory-timeout +The timeout is number of seconds since last remote command for +rereading remote directory contents. 0 re-reads immediately during +file name completion, @code{nil} uses cached directory contents. @end defopt @@ -2662,17 +2453,15 @@ means to use always cached values for the directory contents. @cindex multi-hop, ad-hoc @cindex proxy hosts, ad-hoc -Multiple hops are configured with the variable -@code{tramp-default-proxies-alist} (@pxref{Multi-hops}). However, -sometimes it is desirable to reach a remote host immediately, without -configuration changes. This can be reached by an ad-hoc specification -of the proxies. +@value{tramp} file name syntax can accommodate ad hoc specification of +multiple proxies without using @code{tramp-default-proxies-alist} +configuration setup(@pxref{Multi-hops}). -A proxy looks like a remote file name specification without the local -file name part. It is prepended to the target remote file name, -separated by @samp{|}. As an example, a remote file on -@samp{you@@remotehost}, passing the proxy @samp{bird@@bastion}, could -be opened by +Each proxy is specified using the same syntax as the remote host +specification minus the file name part. Each hop is separated by a +@samp{|}. Chain the proxies from the starting host to the destination +remote host name and file name. For example, hopping over a single +proxy @samp{bird@@bastion} to a remote file on @samp{you@@remotehost}: @example @c @kbd{C-x C-f @trampfn{ssh@value{postfixhop}bird@@bastion|ssh, you, @@ -2680,21 +2469,23 @@ be opened by @kbd{C-x C-f @value{prefix}ssh@value{postfixhop}bird@@bastion|ssh@value{postfixhop}you@@remotehost@value{postfix}/path} @end example -Multiple hops can be cascaded, separating all proxies by @samp{|}. -The proxies can also contain the patterns @code{%h} or @code{%u}. +Proxies can take patterns @code{%h} or @code{%u}. -The ad-hoc definition is added on the fly to -@code{tramp-default-proxies-alist}. Therefore, during the lifetime of -the @value{emacsname} session it is not necessary to enter this ad-hoc -specification, again. The remote file name @samp{@trampfn{ssh, you, -remotehost, /path}} would be sufficient from now on. +@value{tramp} adds the ad-hoc definitions on the fly to +@code{tramp-default-proxies-alist} and is available for re-use during +that @value{emacsname} session. Subsequent @value{tramp} connections +to the same remote host can then use the shortcut form: +@samp{@trampfn{ssh, you, remotehost, /path}}. -@vindex tramp-save-ad-hoc-proxies @defopt tramp-save-ad-hoc-proxies -This custom option controls whether ad-hoc definitions are kept -persistently in @option{tramp-default-proxies-alist}. That means, -those definitions are available also for future @value{emacsname} -sessions. +@vindex tramp-save-ad-hoc-proxies +For ad-hoc definitions to be saved automatically in +@option{tramp-default-proxies-alist} for future @value{emacsname} +sessions, set @option{tramp-save-ad-hoc-proxies}. + +@lisp +(setq tramp-save-ad-hoc-proxies t) +@end lisp @end defopt @@ -2703,11 +2494,14 @@ sessions. @cindex compile @cindex recompile -@value{tramp} supports running processes on a remote host. This -allows to exploit @value{emacsname} packages without modification for -remote file names. It does not work for the @option{ftp} method. -Association of a pty, as specified in @code{start-file-process}, is -not supported. +@value{tramp} supports starting new running processes on the remote +host for discovering remote file names. @value{emacsname} packages on +the remote host need no specific modifications for @value{tramp}'s +use. + +This type of integration does not work with the @option{ftp} method, +and does not support the pty association as specified in +@code{start-file-process}. @code{process-file} and @code{start-file-process} work on the remote host when the variable @code{default-directory} is remote: @@ -2718,51 +2512,53 @@ host when the variable @code{default-directory} is remote: "/bin/sh" "-c" "grep -e tramp *")) @end lisp + @ifset emacsgvfs -If the remote host is mounted via GVFS (see @ref{GVFS based methods}), -the remote filesystem is mounted locally. Therefore, there are no -remote processes; all processes run still locally on your host with -an adapted @code{default-directory}. This section does not apply for -such connection methods. +Remote processes do not apply to GVFS (see @ref{GVFS based methods}) +because the remote file system is mounted on the local host and +@value{tramp} just accesses by changing the @code{default-directory}. @end ifset -Remote processes are started when a corresponding command is executed -from a buffer belonging to a remote file or directory. Up to now, the -packages @file{compile.el} (commands like @code{compile} and -@code{grep}) and @file{gud.el} (@code{gdb} or @code{perldb}) have been -integrated. Integration of further packages is planned, any help for -this is welcome! +@value{tramp} starts a remote process when a command is executed in a +remote file or directory buffer. As of now, these packages have been +integrated to work with @value{tramp}: @file{compile.el} (commands +like @code{compile} and @code{grep}) and @file{gud.el} (@code{gdb} or +@code{perldb}). -When your program is not found in the default search path -@value{tramp} sets on the remote host, you should either use an -absolute path, or extend @code{tramp-remote-path} (see @ref{Remote -programs}): +For @value{tramp} to find the command on the remote, it must be +accessible through the default search path as setup by @value{tramp} +upon first connection. Alternatively, use an absolute path or extend +@code{tramp-remote-path} (see @ref{Remote programs}): @lisp (add-to-list 'tramp-remote-path "~/bin") (add-to-list 'tramp-remote-path "/appli/pub/bin") @end lisp -The environment for your program can be adapted by customizing -@code{tramp-remote-process-environment}. This variable is a list of -strings. It is structured like @code{process-environment}. Each -element is a string of the form @samp{ENVVARNAME=VALUE}. An entry -@samp{ENVVARNAME=} disables the corresponding environment variable, -which might have been set in your init file like @file{~/.profile}. +Customize @code{tramp-remote-process-environment} to suit the remote +program's environment for the remote host. +@code{tramp-remote-process-environment} is a list of strings +structured similar to @code{process-environment}, where each element +is a string of the form @samp{ENVVARNAME=VALUE}. + +To avoid any conflicts with local host variables set through local +configuration files, such as @file{~/.profile}, use @samp{ENVVARNAME=} +to unset them for the remote environment. @noindent -Adding an entry can be performed via @code{add-to-list}: +Use @code{add-to-list} to add entries: @lisp (add-to-list 'tramp-remote-process-environment "JAVA_HOME=/opt/java") @end lisp -Changing or removing an existing entry is not encouraged. The default -values are chosen for proper @value{tramp} work. Nevertheless, if for -example a paranoid system administrator disallows changing the -@env{HISTORY} environment variable, you can customize -@code{tramp-remote-process-environment}, or you can apply the -following code in your @file{.emacs}: +Modifying or deleting already existing values in the +@code{tramp-remote-process-environment} list may not be feasible on +restricted remote hosts. For example, some system administrators +disallow changing @env{HISTORY} variable. To accommodate such +restrictions when using @value{tramp}, fix the +@code{tramp-remote-process-environment} by the following code in the +local @file{.emacs} file: @lisp (let ((process-environment tramp-remote-process-environment)) @@ -2770,31 +2566,29 @@ following code in your @file{.emacs}: (setq tramp-remote-process-environment process-environment)) @end lisp -When running @code{process-file} or @code{start-file-process} on a -remote @code{default-directory}, the default settings in -@code{process-environment} are not used as it is the case for local -processes. However, if you need environment variables other than set -in @code{tramp-remote-process-environment}, you can let-bind them to -@code{process-environment}. Only those variables will be set then: +@value{tramp} does not use the defaults specified in +@code{process-environment} for running @code{process-file} or +@code{start-file-process} on remote hosts. When values from +@code{process-environment} are needed for remote processes, then set +them as follows: @lisp (let ((process-environment (cons "HGPLAIN=1" process-environment))) (process-file @dots{})) @end lisp -This works only for environment variables which are not set already in +This works only for environment variables not already set in the @code{process-environment}. -If you use other @value{emacsname} packages which do not run -out-of-the-box on a remote host, please let us know. We will try to -integrate them as well. @xref{Bug Reports}. +For integrating other @value{emacsname} packages so @value{tramp} can +execute remotely, please file a bug report. @xref{Bug Reports}. @subsection Running remote programs that create local X11 windows -If you want to run a remote program, which shall connect the X11 -server you are using with your local host, you can set the -@env{DISPLAY} environment variable on the remote host: +To allow a remote program to create an X11 window on the local host, +set the @env{DISPLAY} environment variable for the remote host as +follows in the local @file{.emacs} file: @lisp (add-to-list 'tramp-remote-process-environment @@ -2802,65 +2596,61 @@ server you are using with your local host, you can set the @end lisp @noindent -@code{(getenv "DISPLAY")} shall return a string containing a host -name, which can be interpreted on the remote host; otherwise you might -use a fixed host name. Strings like @code{:0} cannot be used properly -on the remote host. - -Another trick might be that you put @code{ForwardX11 yes} or -@code{ForwardX11Trusted yes} to your @file{~/.ssh/config} file for -that host. +@code{(getenv "DISPLAY")} should return a recognizable name for the +local host that the remote host can redirect X11 window +interactions. If querying for a recognizable name is not possible for +whatever reason, then replace @code{(getenv "DISPLAY")} with a +hard-coded, fixed name. Note that using @code{:0} for X11 display name +here will not work as expected. + +An alternate approach is specify @code{ForwardX11 yes} or +@code{ForwardX11Trusted yes} in the file @file{~/.ssh/config} on the +local host. @subsection Running @code{shell} on a remote host @cindex shell -Calling @kbd{M-x shell} in a buffer related to a remote host runs the -local shell as defined in @option{shell-file-name}. This might be -also a valid file name for a shell to be applied on the remote host, -but it will fail at least when your local and remote hosts belong to -different system types, like @samp{windows-nt} and @samp{gnu/linux}. - -You must set the variable @option{explicit-shell-file-name} to the -shell file name on the remote host, in order to start that shell on -the remote host. +Set @option{explicit-shell-file-name} to the appropriate shell name +when using @value{tramp} between two hosts with different operating +systems, such as @samp{windows-nt} and @samp{gnu/linux}. This option +ensures the correct name of the remote shell program. @ifset emacs -Starting with Emacs 24 this won't be necessary, if you call -@code{shell} interactively. You will be asked for the remote shell -file name, if you are on a remote buffer, and if -@option{explicit-shell-file-name} is equal to @code{nil}. +Starting with Emacs 24, when @option{explicit-shell-file-name} is +equal to @code{nil}, calling @code{shell} interactively will prompt +for a shell name. @end ifset @subsection Running @code{shell-command} on a remote host @cindex shell-command -@code{shell-command} allows to execute commands in a shell, either -synchronously, either asynchronously. This works also on remote -hosts. Example: +@code{shell-command} executes commands synchronously or asynchronously +on remote hosts and displays output in buffers on the local +host. Example: @example @kbd{C-x C-f @trampfn{sudo, , , } @key{RET}} @kbd{M-! tail -f /var/log/syslog.log & @key{RET}} @end example -You will see the buffer @file{*Async Shell Command*}, containing the -continuous output of the @command{tail} command. +@command{tail} command outputs continuously to the local buffer, +@file{*Async Shell Command*} @ifset emacs -A similar behavior can be reached by @kbd{M-x auto-revert-tail-mode}, -if available. +@kbd{M-x auto-revert-tail-mode} runs similarly showing continuous output. @end ifset @subsection Running @code{eshell} on a remote host @cindex eshell -@value{tramp} is integrated into @file{eshell.el}. That is, you can -open an interactive shell on your remote host, and run commands there. -After you have started @kbd{M-x eshell}, you could perform commands -like this: +@value{tramp} is integrated into @file{eshell.el}, which enables +interactive eshell sessions on remote hosts at the command prompt. +You must add the module @code{eshell-tramp} to +@code{eshell-modules-list}. Here's a sample interaction after opening +@kbd{M-x eshell} on a remote host: @example @b{~ $} cd @trampfn{sudo, , , /etc} @key{RET} @@ -2874,12 +2664,11 @@ uid=0(root) gid=0(root) groups=0(root) @end example @ifset emacs -Since @value{emacsname} 23.2, @code{eshell} has also an own -implementation of the @code{su} and @code{sudo} commands. Both -commands change the default directory of the @file{*eshell*} buffer to -the value related to the user the command has switched to. This works -even on remote hosts, adding silently a corresponding entry to the -variable @code{tramp-default-proxies-alist} (@pxref{Multi-hops}): +@code{eshell} in @value{emacsname} 23.2 added custom @code{su} and +@code{sudo} commands that set the default directory correctly for the +@file{*eshell*} buffer. @value{tramp} silently updates +@code{tramp-default-proxies-alist} with an entry for this directory +(@pxref{Multi-hops}): @example @b{~ $} cd @trampfn{ssh, user, remotehost, /etc} @key{RET} @@ -2902,56 +2691,51 @@ uid=0(root) gid=0(root) groups=0(root) @cindex gdb @cindex perldb -@file{gud.el} offers a unified interface to several symbolic -debuggers +@file{gud.el} provides a unified interface to symbolic debuggers @ifset emacs @ifinfo (@ref{Debuggers, , , @value{emacsdir}}). @end ifinfo @end ifset -With @value{tramp}, it is possible to debug programs on -remote hosts. You can call @code{gdb} with a remote file name: +@value{tramp} can run debug on remote hosts by calling @code{gdb} +with a remote file name: @example @kbd{M-x gdb @key{RET}} @b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh, , host, ~/myprog} @key{RET} @end example -The file name can also be relative to a remote default directory. -Given you are in a buffer that belongs to the remote directory -@trampfn{ssh, , host, /home/user}, you could call +Relative file names are based on the remote default directory. When +@file{myprog.pl} exists in @file{@trampfn{ssh, , host, /home/user}}, +valid calls include: @example @kbd{M-x perldb @key{RET}} @b{Run perldb (like this):} perl -d myprog.pl @key{RET} @end example -It is not possible to use just the absolute local part of a remote -file name as program to debug, like @kbd{perl -d -/home/user/myprog.pl}, though. +Just the local part of a remote file name, such as @kbd{perl -d +/home/user/myprog.pl}, is not possible. -Arguments of the program to be debugged are taken literally. That -means, file names as arguments must be given as ordinary relative or -absolute file names, without any remote specification. +Arguments of the program to be debugged must be literal, can take +relative or absolute paths, but not remote paths. @subsection Running remote processes on Windows hosts @cindex winexe @cindex powershell -With the help of the @command{winexe} it is possible tu run processes -on a remote Windows host. @value{tramp} has implemented this for -@code{process-file} and @code{start-file-process}. +@command{winexe} runs processes on a remote Windows host, and +@value{tramp} can use it for @code{process-file} and +@code{start-file-process}. -The variable @code{tramp-smb-winexe-program} must contain the file -name of your local @command{winexe} command. On the remote host, -Powershell V2.0 must be installed; it is used to run the remote -process. +@code{tramp-smb-winexe-program} specifies the local @command{winexe} +command. Powershell V2.0 on the remote host is required to run +processes triggered from @value{tramp}. -In order to open a remote shell on the Windows host via @kbd{M-x -shell}, you must set the variables @option{explicit-shell-file-name} -and @option{explicit-*-args}. If you want, for example, run -@command{cmd}, you must set: +@option{explicit-shell-file-name} and @option{explicit-*-args} have to +be set properly so @kbd{M-x shell} can open a proper remote shell on a +Windows host. To open @command{cmd}, set it as follows: @lisp (setq explicit-shell-file-name "cmd" @@ -2959,7 +2743,7 @@ and @option{explicit-*-args}. If you want, for example, run @end lisp @noindent -In case of running @command{powershell} as remote shell, the settings are +To open @command{powershell} as a remote shell, use this: @lisp (setq explicit-shell-file-name "powershell" @@ -2971,34 +2755,32 @@ In case of running @command{powershell} as remote shell, the settings are @section Cleanup remote connections @cindex cleanup -Sometimes it is useful to cleanup remote connections. The following -commands support this. +@value{tramp} provides several ways to flush remote connections. @deffn Command tramp-cleanup-connection vec This command flushes all connection related objects. @option{vec} is -the internal representation of a remote connection. Called -interactively, the command offers all active remote connections in the -minibuffer as remote file name prefix like @file{@trampfn{method, -user, host, }}. The cleanup includes password cache (@pxref{Password -handling}), file cache, connection cache (@pxref{Connection caching}), -connection buffers. +the internal representation of a remote connection. When called +interactively, this command lists active remote connections in the +minibuffer. Each connection is of the format @file{@trampfn{method, +user, host, }}. Flushing remote connections also cleans the password +cache (@pxref{Password handling}), file cache, connection cache +(@pxref{Connection caching}), and connection buffers. @end deffn @deffn Command tramp-cleanup-this-connection -This command flushes all objects of the current buffer's remote -connection. The same objects are removed as in -@code{tramp-cleanup-connection}. +Flushes only the current buffer's remote connection objects, the same +as in @code{tramp-cleanup-connection}. @end deffn @deffn Command tramp-cleanup-all-connections -This command flushes objects for all active remote connections. The -same objects are removed as in @code{tramp-cleanup-connection}. +Flushes all active remote connection objects, the same as in +@code{tramp-cleanup-connection}. @end deffn @deffn Command tramp-cleanup-all-buffers -Like in @code{tramp-cleanup-all-connections}, all remote connections -are cleaned up. Additionally all buffers, which are related to a -remote connection, are killed. +Just as for @code{tramp-cleanup-all-connections}, all remote +connections are cleaned up in addition to killing buffers related to +that remote connection. @end deffn @@ -3006,60 +2788,62 @@ remote connection, are killed. @chapter Reporting Bugs and Problems @cindex bug reports -Bugs and problems with @value{tramp} are actively worked on by the -development team. Feature requests and suggestions are also more than -welcome. +@value{tramp}'s development team is actively engaged in solving bugs +and problems and looks to feature requests and suggestions. + +@value{tramp}'s mailing list is the place for more advice and +information on working with @value{tramp}, solving problems, +discussing, and general discussions about @value{tramp}. -The @value{tramp} mailing list is a great place to get information on -working with @value{tramp}, solving problems and general discussion -and advice on topics relating to the package. It is moderated so -non-subscribers can post but messages will be delayed, possibly up to -48 hours (or longer in case of holidays), until the moderator approves -your message. +@value{tramp}'s mailing list is moderated but even non-subscribers can +post for moderator approval. Sometimes this approval step may take as +long as 48 hours due to public holidays. -The mailing list is at @email{tramp-devel@@gnu.org}. Messages sent to -this address go to all the subscribers. This is @emph{not} the address -to send subscription requests to. +@email{tramp-devel@@gnu.org} is the mailing list. Messages sent to +this address go to all the subscribers. This is @emph{not} the +address to send subscription requests to. -Subscribing to the list is performed via -@uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/, -the @value{tramp} Mail Subscription Page}. +To subscribe to the mailing list, visit: +@uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/, the +@value{tramp} Mail Subscription Page}. @ifset emacs @ifset installchapter -Before sending a bug report, you could check whether @value{tramp} -works at all. Run the test suite on your local host, @ref{Testing}. +Before sending a bug report, run the test suite first @ref{Testing}. @end ifset @end ifset @findex tramp-bug -To report a bug in @value{tramp}, you should execute @kbd{M-x -tramp-bug}. This will automatically generate a buffer with the details -of your system and @value{tramp} version. - -When submitting a bug report, please try to describe in excruciating -detail the steps required to reproduce the problem, the setup of the -remote host and any special conditions that exist. You should also -check that your problem is not described already in @xref{Frequently +Check if the bug or problem is already addressed in @xref{Frequently Asked Questions}. -If you can identify a minimal test case that reproduces the problem, -include that with your bug report. This will make it much easier for -the development team to analyze and correct the problem. +Run @kbd{M-x tramp-bug} to generate a buffer with details of the +system along with the details of the @value{tramp} +installation. Please include these details with the bug report. + +The bug report must describe in as excruciating detail as possible the +steps required to reproduce the problem. These details must include +the setup of the remote host and any special or unique conditions that +exist. + +Include a minimal test case that reproduces the problem. This will +help the development team find the best solution and avoid unrelated +detours. -Sometimes, there might be also problems due to Tramp caches. Flush -all caches before running the test, @ref{Cleanup remote connections}. +To exclude cache-related problems, flush all caches before running the +test, @ref{Cleanup remote connections}. -Before reporting the bug, you should set the verbosity level to 6 -(@pxref{Traces and Profiles, Traces}) in the @file{~/.emacs} file and -repeat the bug. Then, include the contents of the @file{*tramp/foo*} -and @file{*debug tramp/foo*} buffers in your bug report. A verbosity -level greater than 6 will produce a very huge debug buffer, which is -mostly not necessary for the analysis. +When including @value{tramp}'s messages in the bug report, increase +the verbosity level to 6 (@pxref{Traces and Profiles, Traces}) in the +@file{~/.emacs} file before repeating steps to the bug. Include the +contents of the @file{*tramp/foo*} and @file{*debug tramp/foo*} +buffers with the bug report. -Please be aware that, with a verbosity level of 6 or greater, the +@strong{Note} that a verbosity level greater than 6 is not necessary +at this stage. Also note that a verbosity level of 6 or greater, the contents of files and directories will be included in the debug -buffer. Passwords you've typed will never be included there. +buffer. Passwords typed in @value{tramp} will never be included +there. @node Frequently Asked Questions @@ -3069,15 +2853,15 @@ buffer. Passwords you've typed will never be included there. @itemize @bullet @item -Where can I get the latest @value{tramp}? +Where is the latest @value{tramp}? -@value{tramp} is available under the URL below. +@value{tramp} is available at the GNU URL: @noindent @uref{ftp://ftp.gnu.org/gnu/tramp/} @noindent -There is also a Savannah project page. +@value{tramp}'s GNU project page is located here: @noindent @uref{http://savannah.gnu.org/projects/tramp/} @@ -3086,38 +2870,39 @@ There is also a Savannah project page. @item Which systems does it work on? -The package has been used successfully on Emacs 22, Emacs 23, Emacs -24, XEmacs 21 (starting with 21.4), and SXEmacs 22. +The package works successfully on Emacs 22, Emacs 23, Emacs 24, Emacs +25, XEmacs 21 (starting with 21.4), and SXEmacs 22. -The package was intended to work on Unix, and it really expects a -Unix-like system on the remote end (except the @option{smb} method), -but some people seemed to have some success getting it to work on MS -Windows XP/Vista/7 @value{emacsname}. +While Unix and Unix-like systems are the primary remote targets, +@value{tramp} has equal success connecting to other platforms, such as +MS Windows XP/Vista/7. @item -How could I speed up @value{tramp}? +How to speed up @value{tramp}? -In the backstage, @value{tramp} needs a lot of operations on the -remote host. The time for transferring data from and to the remote -host as well as the time needed to perform the operations there count. -In order to speed up @value{tramp}, one could either try to avoid some -of the operations, or one could try to improve their performance. +@value{tramp} does many things in the background, some of which +depends on network speeds, response speeds of remote hosts, and +authentication delays. During these operations, @value{tramp}'s +responsiveness slows down. Some suggestions within the scope of +@value{tramp}'s settings include: -Use an external method, like @option{scp}. +Use an external method, such as @option{scp}, which are faster than +internal methods. -Use caching. This is already enabled by default. Information about -the remote host as well as the remote files are cached for reuse. The -information about remote hosts is kept in the file specified in -@code{tramp-persistency-file-name}. Keep this file. If you are -confident that files on remote hosts are not changed out of -@value{emacsname}' control, set @code{remote-file-name-inhibit-cache} -to @code{nil}. Set also @code{tramp-completion-reread-directory-timeout} -to @code{nil}, @ref{File name completion}. +Keep the file @code{tramp-persistency-file-name}, which is where +@value{tramp} caches remote information about hosts and files. Caching +is enabled by default. Don't disable it. -Disable version control. If you access remote files which are not -under version control, a lot of check operations can be avoided by -disabling VC@. This can be achieved by +Set @code{remote-file-name-inhibit-cache} to @code{nil} if remote +files are not independently updated outside @value{tramp}'s control. +That cache cleanup will be necessary if the remote directories or +files are updated independent of @value{tramp}. + +Set @code{tramp-completion-reread-directory-timeout} to @code{nil} to +speed up completions, @ref{File name completion}. + +Disable version control to avoid delays: @lisp (setq vc-ignore-dir-regexp @@ -3126,49 +2911,46 @@ disabling VC@. This can be achieved by tramp-file-name-regexp)) @end lisp -Disable excessive traces. The default trace level of @value{tramp}, -defined in the variable @code{tramp-verbose}, is 3. You should -increase this level only temporarily, hunting bugs. - +Disable excessive traces. Set @code{tramp-verbose} to 3 or lower, +default being 3. Increase trace levels temporarily when hunting for +bugs. @item @value{tramp} does not connect to the remote host -When @value{tramp} does not connect to the remote host, there are three -reasons heading the bug mailing list: +Three main reasons for why @value{tramp} does not connect to the remote host: @itemize @minus @item Unknown characters in the prompt -@value{tramp} needs to recognize the prompt on the remote host -after execution any command. This is not possible when the prompt -contains unknown characters like escape sequences for coloring. This -should be avoided on the remote side. @xref{Remote shell setup}. for -setting the regular expression detecting the prompt. +@value{tramp} needs a clean recognizable prompt on the remote host for +accurate parsing. Shell prompts that contain escape sequences for +coloring cause parsing problems. @ref{Remote shell setup} for +customizing prompt detection using regular expressions. -You can check your settings after an unsuccessful connection by -switching to the @value{tramp} connection buffer @file{*tramp/foo*}, -setting the cursor at the top of the buffer, and applying the expression +To check if the remote host's prompt is being recognized, use this +test: switch to @value{tramp} connection buffer @file{*tramp/foo*}, +put the cursor at the top of the buffer, and then apply the following +expression: @example @kbd{M-: (re-search-forward (concat tramp-shell-prompt-pattern "$"))} @end example -If it fails, or the cursor is not moved at the end of the buffer, your -prompt is not recognized correctly. +If the cursor has not moved to the prompt at the bottom of the buffer, +then @value{tramp} has failed to recognize the prompt. -A special problem is the zsh shell, which uses left-hand side and -right-hand side prompts in parallel. Therefore, it is necessary to -disable the zsh line editor on the remote host. You shall add to -@file{~/.zshrc} the following command: +When using zsh on remote hosts, disable zsh line editor because zsh +uses left-hand side and right-hand side prompts in parallel. Add the +following line to @file{~/.zshrc}: @example [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' @end example -Similar fancy prompt settings are known from the fish shell. Here you -must add in @file{~/.config/fish/config.fish}: +When using fish shell on remote hosts, disable fancy formatting by +adding the following to @file{~/.config/fish/config.fish}: @example function fish_prompt @@ -3180,35 +2962,30 @@ function fish_prompt end @end example -Furthermore it has been reported, that @value{tramp} (like sshfs, -incidentally) doesn't work with WinSSHD due to strange prompt settings. +When using WinSSHD on remote hosts, @value{tramp} do not recognize the +strange prompt settings. @item Echoed characters after login -When the remote host opens an echoing shell, there might be control -characters in the welcome message. @value{tramp} tries to suppress -such echoes via the @command{stty -echo} command, but sometimes this -command is not reached, because the echoed output has confused -@value{tramp} already. In such situations it might be helpful to use -the @option{sshx} or @option{scpx} methods, which allocate a pseudo tty. -@xref{Inline methods}. +@value{tramp} suppresses echos from remote hosts with the +@command{stty -echo} command. But sometimes it is too late to suppress +welcome messages from the remote host containing harmful control +characters. Using @option{sshx} or @option{scpx} methods can avoid +this problem because they allocate a pseudo tty. @xref{Inline +methods}. @item -@value{tramp} doesn't transfer strings with more than 500 characters -correctly - -On some few systems, the implementation of @code{process-send-string} -seems to be broken for longer strings. It is reported for HP-UX, -FreeBSD and Tru64 Unix, for example. This case, you should customize -the variable @code{tramp-chunksize} to 500. For a description how to -determine whether this is necessary see the documentation of -@code{tramp-chunksize}. - -Additionally, it will be useful to set @code{file-precious-flag} to -@code{t} for @value{tramp} files. Then the file contents will be -written into a temporary file first, which is checked for correct -checksum. +@value{tramp} stops transferring strings longer than 500 characters + +Set @code{tramp-chunksize} to 500 to get around this problem, which is +related to faulty implementation of @code{process-send-string} on +HP-UX, FreeBSD and Tru64 Unix systems. Consult the documentation for +@code{tramp-chunksize} to see when this is necessary. + +Set @code{file-precious-flag} to @code{t} for files accessed by +@value{tramp} so the file contents are checked using checksum by +first saving to a temporary file. @ifinfo @pxref{Saving Buffers, , , elisp} @end ifinfo @@ -3224,17 +3001,12 @@ checksum. @item -@value{tramp} does not recognize hung @command{ssh} sessions - -When your network connection is down, @command{ssh} sessions might -hang. @value{tramp} cannot detect it safely, because it still sees a -running @command{ssh} process. Timeouts cannot be used as well, -because it cannot be predicted how long a remote command will last, -for example when copying very large files. +@value{tramp} does not recognize if a @command{ssh} session hangs -Therefore, you must configure the @command{ssh} process to die -in such a case. The following entry in @file{~/.ssh/config} would do -the job: +@command{ssh} sessions on the local host hang when the network is +down. @value{tramp} cannot safely detect such hangs. The network +configuration for @command{ssh} can be configured to kill such hangs +with the following command in the @file{~/.ssh/config}: @example Host * @@ -3243,25 +3015,17 @@ Host * @item -@value{tramp} does not use my @command{ssh} @code{ControlPath} +@value{tramp} does not use default @command{ssh} @code{ControlPath} -Your @code{ControlPath} setting will be overwritten by @command{ssh} -sessions initiated by @value{tramp}. This is because a master -session, initiated outside @value{emacsname}, could be closed, which -would stall all other @command{ssh} sessions for that host inside -@value{emacsname}. - -Consequently, if you connect to a remote host via @value{tramp}, you -might be prompted for a password again, even if you have established -already an @command{ssh} connection to that host. Further -@value{tramp} connections to that host, for example in order to run a -process on that host, will reuse that initial @command{ssh} -connection. +@value{tramp} overwrites @code{ControlPath} settings when initiating +@command{ssh} sessions. @value{tramp} does this to fend off a stall +if a master session opened outside the @value{emacsname} session is no +longer open. That is why @value{tramp} prompts for the password again +even if there is an @command{ssh} already open. -If your @command{ssh} version supports the @code{ControlPersist} -option, you could customize the variable -@code{tramp-ssh-controlmaster-options} to use your @code{ControlPath}, -for example: +Some @command{ssh} versions support a @code{ControlPersist} option, +which allows to set the @code{ControlPath} provided the variable +@code{tramp-ssh-controlmaster-options} is customized as follows: @lisp (setq tramp-ssh-controlmaster-options @@ -3270,11 +3034,12 @@ for example: "-o ControlMaster=auto -o ControlPersist=yes")) @end lisp -Note, that "%r", "%h" and "%p" must be encoded as "%%r", "%%h" and -"%%p", respectively. +Note how "%r", "%h" and "%p" must be encoded as "%%r", "%%h" and +"%%p". -These settings can be suppressed, if they are configured properly in -your @file{~/.ssh/config}: +If the @file{~/.ssh/config} is configured appropriately for the above +behavior, then any changes to @command{ssh} can be suppressed with +this @code{nil} setting: @lisp (setq tramp-use-ssh-controlmaster-options nil) @@ -3284,44 +3049,40 @@ your @file{~/.ssh/config}: @item File name completion does not work with @value{tramp} -When you log in to the remote host, do you see the output of -@command{ls} in color? If so, this may be the cause of your problems. - -@command{ls} outputs @acronym{ANSI} escape sequences that your terminal -emulator interprets to set the colors. These escape sequences will -confuse @value{tramp} however. - -In your @file{.bashrc}, @file{.profile} or equivalent on the remote -host you probably have an alias configured that adds the option -@option{--color=yes} or @option{--color=auto}. +@acronym{ANSI} escape sequences from the remote shell may cause errors +in @value{tramp}'s parsing of remote buffers. -You should remove that alias and ensure that a new login @emph{does not} -display the output of @command{ls} in color. If you still cannot use -file name completion, report a bug to the @value{tramp} developers. +To test if this is the case, open a remote shell and check if the output +of @command{ls} is in color. +To disable @acronym{ANSI} escape sequences from the remote hosts, +disable @option{--color=yes} or @option{--color=auto} in the remote +host's @file{.bashrc} or @file{.profile}. Turn this alias on and off +to see if file name completion works. @item -File name completion does not work in large directories +File name completion does not work in directories with large number of +files -@value{tramp} uses globbing for some operations. (Globbing means to use the -shell to expand wildcards such as @samp{*.c}.) This might create long -command lines, especially in directories with many files. Some shells -choke on long command lines, or don't cope well with the globbing -itself. +This may be related to globbing, which is the use of shell's ability +to expand wild card specifications, such as @samp{*.c}. For +directories with large number of files, globbing might exceed the +shell's limit on length of command lines and hang. @value{tramp} uses +globbing. -If you have a large directory on the remote end, you may wish to execute -a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs. -Note that you must first start the right shell, which might be -@command{/bin/sh}, @command{ksh} or @command{bash}, depending on which -of those supports tilde expansion. +To test if globbing hangs, open a shell on the remote host and then +run @samp{ls -d * ..?* > /dev/null}. + +When testing, ensure the remote shell is the same shell +(@command{/bin/sh}, @command{ksh} or @command{bash}), that +@value{tramp} uses when connecting to that host. @item -How can I get notified when @value{tramp} file transfers are complete? +How to get notified after @value{tramp} completes file transfers? -The following snippet can be put in your @file{~/.emacs} file. It -makes @value{emacsname} beep after reading from or writing to the -remote host. +Make @value{emacsname} beep after reading from or writing to the +remote host with the following code in @file{~/.emacs} file. @lisp (defadvice tramp-handle-write-region @@ -3346,12 +3107,11 @@ remote host. @ifset emacs @item -I'ld like to get a Visual Warning when working in a sudo:ed context +How to get a Visual Warning when working with @samp{root} privileges -When you are working with @samp{root} privileges, it might be useful -to get an indication in the buffer's modeline. The following code, -tested with @value{emacsname} 22.1, does the job. You should put it -into your @file{~/.emacs}: +Get a modeline indication when working with @samp{root} privileges +with the following code (tested with @value{emacsname} 22.1) in +@file{~/.emacs} file: @lisp (defun my-mode-line-function () @@ -3367,10 +3127,10 @@ into your @file{~/.emacs}: @ifset emacs @item -I'ld like to see a host indication in the mode line when I'm remote +How to get host indication in the mode line? -The following code has been tested with @value{emacsname} 22.1. You -should put it into your @file{~/.emacs}: +The following code (tested with @value{emacsname} 22.1) in +@file{~/.emacs} file shows it: @lisp (defconst my-mode-line-buffer-identification @@ -3398,11 +3158,11 @@ should put it into your @file{~/.emacs}: my-mode-line-buffer-identification))) @end lisp -Since @value{emacsname} 23.1, the mode line contains an indication if -@code{default-directory} for the current buffer is on a remote host. -The corresponding tooltip includes the name of that host. If you -still want the host name as part of the mode line, you can use the -example above, but the @code{:eval} clause can be simplified: +The mode line in @value{emacsname} 23.1 and later versions now +contains an indication if @code{default-directory} for the current +buffer is on a remote host. Moreover, the corresponding tool-tip +shows the remote host name. The above @code{:eval} clause can also be +simplified to show the host name in the mode line: @lisp '(:eval @@ -3418,12 +3178,11 @@ example above, but the @code{:eval} clause can be simplified: @ifset emacs @item -My remote host does not understand default directory listing options +Remote host does not understand default options for directory listing -@value{emacsname} computes the @command{dired} options depending on -the local host you are working. If your @command{ls} command on the -remote host does not understand those options, you can change them -like this: +@value{emacsname} computes the @command{dired} options based on the +local host but if the remote host cannot understand the same +@command{ls} command, then set them with a hook as follows: @lisp (add-hook @@ -3436,13 +3195,12 @@ like this: @item -There's this @file{~/.sh_history} file on the remote host which keeps -growing and growing. What's that? +Why is @file{~/.sh_history} file on the remote host growing? -Sometimes, @value{tramp} starts @command{ksh} on the remote host for -tilde expansion. Maybe @command{ksh} saves the history by default. -@value{tramp} tries to turn off saving the history, but maybe you have -to help. For example, you could put this in your @file{.kshrc}: +Due to @command{ksh} saving tilde expansions triggered by +@value{tramp}, the history file is probably growing rapidly. To fix, +turn off saving history by putting this shell code in the +@file{.kshrc} file: @example if [ -f $HOME/.sh_history ] ; then @@ -3456,23 +3214,24 @@ if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then fi @end example -Furthermore, if you use an @option{ssh}-based method, you could add -the following line to your @file{~/.ssh/environment} file: +For @option{ssh}-based method, add the following line to your +@file{~/.ssh/environment} file: @example HISTFILE=/dev/null @end example -@item There are longish file names to type. How to shorten this? +@item +How to shorten long file names when typing in @value{tramp}? -Let's say you need regularly access to @file{@trampfn{ssh, news, -news.my.domain, /opt/news/etc}}, which is boring to type again and -again. The following approaches can be mixed: +Adapt several of these approaches to reduce typing. If the full name +is @file{@trampfn{ssh, news, news.my.domain, /opt/news/etc}}, then: @enumerate -@item Use default values for method and user name: +@item +Use default values for method name and user name: You can define default methods and user names for hosts, (@pxref{Default Method}, @pxref{Default User}): @@ -3482,18 +3241,18 @@ You can define default methods and user names for hosts, tramp-default-user "news") @end lisp -The file name left to type would be -@kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}. +The reduced typing: @kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}. -Note that there are some useful settings already. Accessing your -local host as @samp{root} user, is possible just by @kbd{C-x C-f +@strong{Note} that there are some useful shortcuts already. Accessing +your local host as @samp{root} user, is possible just by @kbd{C-x C-f @trampfn{su, , ,}}. -@item Use configuration possibilities of your method: +@item +Use configuration options of the access method: -Several connection methods (i.e., the programs used) offer powerful -configuration possibilities (@pxref{Customizing Completion}). In the -given case, this could be @file{~/.ssh/config}: +Programs used for access methods already offer powerful configurations +(@pxref{Customizing Completion}). For @option{ssh}, configure the +file @file{~/.ssh/config}: @example Host xy @@ -3501,30 +3260,32 @@ Host xy User news @end example -The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy, -/opt/news/etc}}. Depending on files in your directories, it is even -possible to complete the host name with @kbd{C-x C-f +The reduced typing: @kbd{C-x C-f @trampfn{ssh, , xy, /opt/news/etc}}. + +Depending on the number of files in the directories, host names +completion can further reduce key strokes: @kbd{C-x C-f @value{prefix}ssh@value{postfixhop}x @key{TAB}}. -@item Use environment variables: +@item +Use environment variables to expand long strings -File names typed in the minibuffer can be expanded by environment -variables. You can set them outside @value{emacsname}, or even with -Lisp: +For long file names, set up environment variables that are expanded in +the minibuffer. Environment variables are set either outside +@value{emacsname} or inside @value{emacsname} with Lisp: @lisp (setenv "xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}") @end lisp -Then you need simply to type @kbd{C-x C-f $xy @key{RET}}, and here you -are. The disadvantage is that you cannot edit the file name, because +The reduced typing: @kbd{C-x C-f $xy @key{RET}}. + +@strong{Note} that file name cannot be edited here because the environment variables are not expanded during editing in the minibuffer. @item Define own keys: -You can define your own key sequences in @value{emacsname}, which can -be used instead of @kbd{C-x C-f}: +Redefine another key sequence in @value{emacsname} for @kbd{C-x C-f}: @lisp (global-set-key @@ -3537,16 +3298,16 @@ be used instead of @kbd{C-x C-f}: "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")))) @end lisp -Simply typing @kbd{C-x C-y} would initialize the minibuffer for -editing with your beloved file name. +Simply typing @kbd{C-x C-y} would prepare minibuffer editing of file +name. -See also @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the -Emacs Wiki} for a more comprehensive example. +See @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the Emacs +Wiki} for a more comprehensive example. -@item Define own abbreviation (1): +@item +Define own abbreviation (1): -It is possible to define an own abbreviation list for expanding file -names: +Abbreviation list expansion can be used to reduce typing long file names: @lisp (add-to-list @@ -3554,13 +3315,16 @@ names: '("^/xy" . "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")) @end lisp -This shortens the file opening command to @kbd{C-x C-f /xy -@key{RET}}. The disadvantage is, again, that you cannot edit the file -name, because the expansion happens after entering the file name only. +The reduced typing: @kbd{C-x C-f /xy @key{RET}}. + +@strong{Note} that file name cannot be edited here because the +environment variables are not expanded during editing in the +minibuffer. -@item Define own abbreviation (2): +@item +Define own abbreviation (2): -The @code{abbrev-mode} gives more flexibility for editing the +The @code{abbrev-mode} gives additional flexibility for editing in the minibuffer: @lisp @@ -3583,18 +3347,18 @@ minibuffer: (expand-abbrev)) @end lisp -After entering @kbd{C-x C-f xy @key{TAB}}, the minibuffer is -expanded, and you can continue editing. +The reduced typing: @kbd{C-x C-f xy @key{TAB}}. + +The minibuffer expands for further editing. @item Use bookmarks: -Bookmarks can be used to visit Tramp files or directories. +Use bookmarks to save Tramp file names. @ifinfo -@pxref{Bookmarks, , , @value{emacsdir}} +@pxref{Bookmarks, , , @value{emacsdir}}. @end ifinfo -When you have opened @file{@trampfn{ssh, news, news.my.domain, -/opt/news/etc/}}, you should save the bookmark via +Upon visiting a location with @value{tramp}, save it as a bookmark with @ifset emacs @kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}. @end ifset @@ -3602,7 +3366,7 @@ When you have opened @file{@trampfn{ssh, news, news.my.domain, @kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}. @end ifset -Later on, you can always navigate to that bookmark via +To revisit that bookmark: @ifset emacs @kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}. @end ifset @@ -3621,15 +3385,15 @@ Later on, you can always navigate to that bookmark via remembers visited places. @ifinfo @ifset emacs -@pxref{File Conveniences, , , @value{emacsdir}} +@pxref{File Conveniences, , , @value{emacsdir}}. @end ifset @ifset xemacs -@pxref{recent-files, , , edit-utils} +@pxref{recent-files, , , edit-utils}. @end ifset @end ifinfo -You could keep remote file names in the recent list without checking -their readability through a remote access: +Keep remote file names in the recent list without have to check for +their accessibility through remote access: @lisp @ifset emacs @@ -3646,7 +3410,7 @@ their readability through a remote access: @end ifset @end lisp -The list of files opened recently is reachable via +Reaching recently opened files: @ifset emacs @kbd{@key{menu-bar} @key{file} @key{Open Recent}}. @end ifset @@ -3657,8 +3421,8 @@ The list of files opened recently is reachable via @ifset emacs @item Use filecache: -@file{filecache} remembers visited places. Add the directory into -the cache: +Since @file{filecache} remembers visited places, add the remote +directory to the cache: @lisp (eval-after-load "filecache" @@ -3666,30 +3430,28 @@ the cache: "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")) @end lisp -Whenever you want to load a file, you can enter @kbd{C-x C-f -C-@key{TAB}} in the minibuffer. The completion is done for the given -directory. +Then use directory completion in the minibuffer with @kbd{C-x C-f +C-@key{TAB}}. @end ifset @ifset emacs @item Use bbdb: @file{bbdb} has a built-in feature for @value{ftppackagename} files, -which works also for @value{tramp}. +which also works for @value{tramp} file names. @ifinfo -@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb} +@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}. @end ifinfo -You need to load @file{bbdb}: +Load @file{bbdb} in @value{emacs}: @lisp (require 'bbdb) (bbdb-initialize) @end lisp -Then you can create a BBDB entry via @kbd{M-x bbdb-create-ftp-site}. -Because BBDB is not prepared for @value{tramp} syntax, you must -specify a method together with the user name when needed. Example: +Create a BBDB entry with @kbd{M-x bbdb-create-ftp-site}. Then specify +a method and user name where needed. Examples: @example @kbd{M-x bbdb-create-ftp-site @key{RET}} @@ -3700,45 +3462,42 @@ specify a method together with the user name when needed. Example: @b{Additional Comments:} @key{RET} @end example -When you have opened your BBDB buffer, you can access such an entry by -pressing the key @key{F}. +In BBDB buffer, access an entry by pressing the key @key{F}. @end ifset @end enumerate -I would like to thank all @value{tramp} users who have contributed to -the different recipes! +Thanks to @value{tramp} users for contributing to these recipes. +@item +Why saved multi-hop file names do not work in a new @value{emacsname} +session? -@item I have saved @value{tramp} file names as indicated. But it -doesn't work in a new @value{emacsname} session! - -If you have saved an ad-hoc multi-hop @value{tramp} file name -(@pxref{Ad-hoc multi-hops}) via bookmarks, recent files, +When saving ad-hoc multi-hop @value{tramp} file names (@pxref{Ad-hoc +multi-hops}) via bookmarks, recent files, @ifset emacs filecache, bbdb, @end ifset -or another package, you must use the full ad-hoc file name including -all hops, like @file{@trampfn{ssh, bird, +or another package, use the full ad-hoc file name including all hops, +like @file{@trampfn{ssh, bird, bastion|ssh@value{postfixhop}news.my.domain, /opt/news/etc}}. -Alternatively, if you save only the abbreviated multi-hop file name +Alternatively, when saving abbreviated multi-hop file names @file{@trampfn{ssh, news, news.my.domain, /opt/news/etc}}, the custom -option @code{tramp-save-ad-hoc-proxies} must be set to a to a -non-@code{nil} value. +option @code{tramp-save-ad-hoc-proxies} must be set non-@code{nil} +value. @ifset emacs @item -How can I use @value{tramp} to connect to a remote @value{emacsname} -session? +How to connect to a remote @value{emacsname} session using @value{tramp}? -You can configure Emacs Client doing this. +Configure Emacs Client @ifinfo -@xref{Emacs Server, , , @value{emacsdir}}. +(@pxref{Emacs Server, , , @value{emacsdir}}). @end ifinfo -On the remote host, you start the Emacs Server: +Then on the remote host, start the Emacs Server: @lisp (require 'server) @@ -3747,29 +3506,31 @@ On the remote host, you start the Emacs Server: (server-start) @end lisp -Make sure that the result of @code{(system-name)} can be resolved on -your local host; otherwise you might use a hard coded IP address. +If @code{(system-name)} of the remote host cannot be resolved on the +local host, use IP address instead. + +Copy from the remote host the resulting file +@file{~/.emacs.d/server/server} to the local host, to the same +location. -The resulting file @file{~/.emacs.d/server/server} must be copied to -your local host, at the same location. You can call then the Emacs -Client from the command line: +Then start Emacs Client from the command line: @example emacsclient @trampfn{ssh, user, host, /file/to/edit} @end example -@code{user} and @code{host} shall be related to your local host. +@code{user} and @code{host} refer to the local host. -If you want to use Emacs Client also as editor for other programs, you -could write a script @file{emacsclient.sh}: +To make Emacs Client an editor for other programs, use a wrapper +script @file{emacsclient.sh}: @example #!/bin/sh emacsclient @trampfn{ssh, $(whoami), $(hostname --fqdn), $1} @end example -Then you must set the environment variable @env{EDITOR} pointing to -that script: +Then change the environment variable @env{EDITOR} to point to the +wrapper script: @example export EDITOR=/path/to/emacsclient.sh @@ -3778,18 +3539,18 @@ export EDITOR=/path/to/emacsclient.sh @item -There are packages which call @value{tramp} although I haven't entered -a remote file name ever. I dislike it, how could I disable it? +How to disable other packages from calling @value{tramp}? -In general, @value{tramp} functions are used only when -you apply remote file name syntax. However, some packages enable -@value{tramp} on their own. +There are packages that call @value{tramp} without the user ever +entering a remote file name. Even without applying a remote file +syntax, some packages enable @value{tramp} on their own. How can users +disable such features. @itemize @minus @item @file{ido.el} -You could disable @value{tramp} file name completion: +Disable @value{tramp} file name completion: @lisp (custom-set-variables @@ -3799,7 +3560,7 @@ You could disable @value{tramp} file name completion: @item @file{rlogin.el} -You could disable remote directory tracking mode: +Disable remote directory tracking mode: @lisp (rlogin-directory-tracking-mode -1) @@ -3808,15 +3569,13 @@ You could disable remote directory tracking mode: @item -How can I disable @value{tramp} at all? - -Shame on you, why did you read until now? +How to disable @value{tramp}? @itemize @minus @ifset emacs @item -If you just want to have @value{ftppackagename} as default remote -files access package, you should apply the following code: +To keep @value{ftppackagename} as default the remote files access +package, set this in @file{.emacs}: @lisp (setq tramp-default-method "ftp") @@ -3824,24 +3583,23 @@ files access package, you should apply the following code: @end ifset @item -In order to disable +To disable both @ifset emacs @value{tramp} (and @value{ftppackagename}), @end ifset @ifset xemacs @value{tramp}, @end ifset -you must set @code{tramp-mode} to @code{nil}: +set @code{tramp-mode} to @code{nil} in @file{.emacs}. @lisp (setq tramp-mode nil) @end lisp @item -Unloading @value{tramp} can be achieved by applying @kbd{M-x -tramp-unload-tramp}. +To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}. @ifset emacs -This resets also the @value{ftppackagename} plugins. +Unloading @value{tramp} resets @value{ftppackagename} plugins also. @end ifset @end itemize @end itemize @@ -3852,48 +3610,44 @@ This resets also the @value{ftppackagename} plugins. @chapter How file names, directories and localnames are mangled and managed. @menu -* Localname deconstruction:: Breaking a localname into its components. +* Localname deconstruction:: Splitting a localname into its component parts. @ifset emacs -* External packages:: Integration with external Lisp packages. +* External packages:: Integrating with external Lisp packages. @end ifset @end menu @node Localname deconstruction -@section Breaking a localname into its components - -@value{tramp} file names are somewhat different, obviously, to ordinary file -names. As such, the lisp functions @code{file-name-directory} and -@code{file-name-nondirectory} are overridden within the @value{tramp} -package. +@section Splitting a localname into its component parts -Their replacements are reasonably simplistic in their approach. They -dissect the file name, call the original handler on the localname and -then rebuild the @value{tramp} file name with the result. +@value{tramp} package redefines lisp functions +@code{file-name-directory} and @code{file-name-nondirectory} to +accommodate the unique file naming syntax that @value{tramp} requires. -This allows the platform specific hacks in the original handlers to take -effect while preserving the @value{tramp} file name information. +The replacements dissect the file name, use the original handler for +the localname, take that result, and then re-build the @value{tramp} +file name. By relying on the original handlers for localnames, +@value{tramp} benefits from platform specific hacks to the original +handlers. @ifset emacs @node External packages -@section Integration with external Lisp packages +@section Integrating with external Lisp packages @subsection File name completion. -While reading file names in the minibuffer, @value{tramp} must decide -whether it completes possible incomplete file names, or not. Imagine -there is the following situation: You have typed @kbd{C-x C-f -@value{prefix}ssh@value{postfixhop} @key{TAB}}. @value{tramp} cannot -know, whether @option{ssh} is a method or a host name. It checks -therefore the last input character you have typed. If this is -@key{TAB}, @key{SPACE} or @kbd{?}, @value{tramp} assumes that you are -still in file name completion, and it does not connect to the possible -remote host @option{ssh}. - -External packages, which use other characters for completing file names -in the minibuffer, must signal this to @value{tramp}. For this case, -the variable @code{non-essential} can be bound temporarily to -a non-@code{nil} value. +For name completions in the minibuffer, @value{tramp} depends on the +last input character to decide whether to look for method name +completion or host name completion. For example, @kbd{C-x C-f +@value{prefix}ssh@value{postfixhop} @key{TAB}} is not entirely clear +if @option{ssh} is a method or a host name. But if the last input +character was either @key{TAB}, @key{SPACE} or @kbd{?}, then +@value{tramp} favors file name completion over host name completion. + +What about external packages using other characters to trigger file +name completions? They must somehow signal this to @value{tramp}. Use +the variable @code{non-essential} temporarily and bind it to +non-@code{nil} value. @lisp (let ((non-essential t)) @@ -3903,27 +3657,27 @@ a non-@code{nil} value. @subsection File attributes cache. -When @value{tramp} runs remote processes, files on the remote host -could change their attributes. Consequently, @value{tramp} must flush -its complete cache keeping attributes for all files of the remote host -it has seen so far. +Keeping a local cache of remote file attributes in sync with the +remote host is a time-consuming operation. Flushing and re-querying +these attributes can tax @value{tramp} to a grinding halt on busy +remote servers. -This is a performance degradation, because the lost file attributes -must be recomputed when needed again. In cases where the caller of -@code{process-file} knows that there are no file attribute changes, it -should let-bind the variable @code{process-file-side-effects} to -@code{nil}. Then @value{tramp} won't flush the file attributes cache. +To get around these types of slow-downs in @value{tramp}'s +responsiveness, set the @code{process-file-side-effects} to @code{nil} +to stop @value{tramp} from flushing the cache. This is helpful in +situations where callers to @code{process-file} know there are no file +attribute changes. The let-bind form to accomplish this: @lisp (let (process-file-side-effects) @dots{}) @end lisp -For asynchronous processes, @value{tramp} flushes the file attributes -cache via a process sentinel. If the caller of -@code{start-file-process} knows that there are no file attribute -changes, it should set the process sentinel to the default. In cases -where the caller defines its own process sentinel, @value{tramp}'s process +For asynchronous processes, @value{tramp} uses a process sentinel to +flush file attributes cache. When callers to @code{start-file-process} +know beforehand no file attribute changes are expected, then the +process sentinel should be set to the default state. In cases where +the caller defines its own process sentinel, @value{tramp}'s process sentinel is overwritten. The caller can still flush the file attributes cache in its process sentinel with this code: @@ -3932,21 +3686,18 @@ attributes cache in its process sentinel with this code: (dired-uncache remote-directory)) @end lisp -@code{remote-directory} shall be the root directory, where file -attribute changes can happen during the process lifetime. -@value{tramp} traverses all subdirectories, starting at this -directory. Often, it is sufficient to use @code{default-directory} of -the process buffer as root directory. +Since @value{tramp} traverses subdirectories starting with the +root-directory, it is most likely sufficient to make the +@code{default-directory} of the process buffer as the root directory. @end ifset @node Traces and Profiles @chapter How to Customize Traces -All @value{tramp} messages are raised with a verbosity level. The -verbosity level can be any number between 0 and 10. Only messages with -a verbosity level less than or equal to @code{tramp-verbose} are -displayed. +@value{tramp} messages are raised with verbosity levels ranging from 0 +to 10. @value{tramp} does not display all messages; only those with a +verbosity level less than or equal to @code{tramp-verbose}. The verbosity levels are @@ -3962,11 +3713,10 @@ The verbosity levels are @*@indent @w{ 9} test commands @*@indent @w{10} traces (huge) -When @code{tramp-verbose} is greater than or equal to 4, the messages -are also written into a @value{tramp} debug buffer. This debug buffer -is useful for analyzing problems; sending a @value{tramp} bug report -should be done with @code{tramp-verbose} set to a verbosity level of at -least 6 (@pxref{Bug Reports}). +With @code{tramp-verbose} greater than or equal to 4, messages are +also written to a @value{tramp} debug buffer. Such debug buffers are +essential to bug and problem analyses. For @value{tramp} bug reports, +set the @code{tramp-verbose} level to 6 (@pxref{Bug Reports}). The debug buffer is in @ifinfo @@ -3975,25 +3725,23 @@ The debug buffer is in @ifnotinfo Outline Mode. @end ifnotinfo -That means, you can change the level of messages to be viewed. If you -want, for example, see only messages up to verbosity level 5, you must -enter @kbd{C-u 6 C-c C-q}. +In this buffer, messages can be filtered by their level. To see +messages up to verbosity level 5, enter @kbd{C-u 6 C-c C-q}. @ifinfo -Other keys for navigating are described in +Other navigation keys are described in @ref{Outline Visibility, , , @value{emacsdir}}. @end ifinfo -@value{tramp} errors are handled internally in order to raise the -verbosity level 1 messages. When you want to get a Lisp backtrace in -case of an error, you need to set both +@value{tramp} handles errors internally. But to get a Lisp backtrace, +both the error and the signal have to be set as follows: @lisp (setq debug-on-error t debug-on-signal t) @end lisp -Sometimes, it might be even necessary to step through @value{tramp} -function call traces. Such traces are enabled by the following code: +To enable stepping through @value{tramp} function call traces, they +have to be specifically enabled as shown in this code: @lisp (require 'trace) @@ -4003,11 +3751,10 @@ function call traces. Such traces are enabled by the following code: (untrace-function 'tramp-gw-basic-authentication) @end lisp -The function call traces are inserted in the buffer -@file{*trace-output*}. @code{tramp-read-passwd} and -@code{tramp-gw-basic-authentication} shall be disabled when the -function call traces are added to @value{tramp}, because both -functions return password strings, which should not be distributed. +The buffer @file{*trace-output*} contains the output from the function +call traces. Disable @code{tramp-read-passwd} and +@code{tramp-gw-basic-authentication} to stop password strings from +being written to @file{*trace-output*}. @node Issues @@ -4016,52 +3763,49 @@ functions return password strings, which should not be distributed. @itemize @bullet @item The uuencode method does not always work. -Due to the design of @value{tramp}, the encoding and decoding programs -need to read from stdin and write to stdout. On some systems, -@command{uudecode -o -} will read stdin and write the decoded file to -stdout, on other systems @command{uudecode -p} does the same thing. -But some systems have uudecode implementations which cannot do this at -all---it is not possible to call these uudecode implementations with -suitable parameters so that they write to stdout. +@command{uudecode} on some systems cannot write to stdout, but +@value{tramp} depends on encoding and decoding programs to be able to +read from stdin and write to stdout. -Of course, this could be circumvented: the @code{begin foo 644} line -could be rewritten to put in some temporary file name, then -@command{uudecode} could be called, then the temp file could be -printed and deleted. +We can find ways to circumvent @command{uudecode}'s ability to write +to stdout, such as writing to a temporary file and then piping that to +stdout. -But I have decided that this is too fragile to reliably work, so on some -systems you'll have to do without the uuencode methods. +But I have decided not to implement workarounds as they are too +fragile to work reliably. Some on systems, @value{tramp} will not have +uuencode method. @item The @value{tramp} file name syntax differs between Emacs and XEmacs. The Emacs maintainers wish to use a unified file name syntax for -Ange-FTP and @value{tramp} so that users don't have to learn a new -syntax. It is sufficient to learn some extensions to the old syntax. +Ange-FTP and @value{tramp} so that users don't have to learn yet +another syntax though it is okay to learn new extensions. -For the XEmacs maintainers, the problems caused from using a unified -file name syntax are greater than the gains. The XEmacs package system -uses EFS for downloading new packages. So, obviously, EFS has to be -installed from the start. If the file names were unified, @value{tramp} -would have to be installed from the start, too. +For the XEmacs maintainers, the disruption from a unified file name +syntax are not worth the gains. Firstly, the XEmacs package system +relies on EFS for downloading new packages and therefore is already +installed. On the other hand, @value{tramp} is not installed by +default in XEmacs. Unifying will require @value{tramp} installed from +the start. @ifset xemacs -@strong{Note:} If you'd like to use a similar syntax like -@value{ftppackagename}, you need the following settings in your init -file: +@strong{Note:} To make the syntax similar to @value{ftppackagename}, +make this change to the init file: @lisp (setq tramp-unified-filenames t) (require 'tramp) @end lisp -The autoload of the @value{emacsname} @value{tramp} package must be -disabled. This can be achieved by setting file permissions @code{000} -to the files @file{@dots{}/xemacs-packages/lisp/tramp/auto-autoloads.el*}. +To disable auto loading @value{emacsname} @value{tramp} package, set +file permissions of +@file{@dots{}/xemacs-packages/lisp/tramp/auto-autoloads.el*} to +@code{000}. -In case of unified file names, all @value{emacsname} download sites are -added to @code{tramp-default-method-alist} with default method -@option{ftp} @xref{Default Method}. These settings shouldn't be -touched for proper working of the @value{emacsname} package system. +When using unified file names, @value{emacsname} download sites are +added to @code{tramp-default-method-alist} with default method of +@option{ftp} @xref{Default Method} for proper working of the +@value{emacsname} package system. The syntax for unified file names is described in the @value{tramp} manual for @value{emacsothername}. diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index dccf3175386..436679613a1 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi @@ -8,7 +8,7 @@ @c In the Tramp GIT, the version number is auto-frobbed from @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@set trampver 2.2.13-pre +@set trampver 2.2.13.25.1 @c Other flags from configuration @set instprefix /usr/local diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 95fe5eabc33..121c28eb8f8 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -373,9 +373,10 @@ for specific schemes. * rlogin/telnet/tn3270:: Remote host connectivity. * irc:: Internet Relay Chat. * data:: Embedded data URLs. -* nfs:: Networked File System -* ldap:: Lightweight Directory Access Protocol +* nfs:: Networked File System. +* ldap:: Lightweight Directory Access Protocol. * man:: Unix man pages. +* Tramp:: Schemes supported via Tramp. @end menu @node http/https @@ -549,8 +550,8 @@ file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} @noindent If the URL specifies a local file, it is retrieved by reading the file contents in the usual way. If it specifies a remote file, it is -retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs, -The GNU Emacs Manual}. +retrieved using either the Tramp or the Ange-FTP package. +@xref{Remote Files,,, emacs, The GNU Emacs Manual}. When retrieving a compressed file, it is automatically uncompressed if it has the file suffix @file{.z}, @file{.gz}, @file{.Z}, @@ -682,7 +683,8 @@ telnet://@var{user}:@var{password}@@@var{host}:@var{port} @end example @noindent -but the @var{password} component is ignored. +but the @var{password} component is ignored. By default, the +@code{telnet} scheme is handled via Tramp (@pxref{Tramp}). To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, @code{telnet} or @code{tn3270} (the program names and arguments are @@ -798,6 +800,38 @@ The @code{man} scheme is a non-standard one. Such URLs have the form and are retrieved by passing @var{page-spec} to the Lisp function @code{man}. +@node Tramp +@section URL Types Supported via Tramp + +@vindex url-tramp-protocols +Some additional URL types are supported by passing them to Tramp +(@pxref{Top, The Tramp Manual,, tramp, The Tramp Manual}). These +protocols are listed in the @code{url-tramp-protocols} variable, which +you can customize. The default value includes the following +protocols: + +@table @code +@item ftp +The file transfer protocol. @xref{file/ftp}. + +@item ssh +@cindex ssh +The secure shell protocol. @xref{Inline Methods,,, tramp, The Tramp +Manual}. + +@item scp +@cindex scp +The secure file copy protocol. @xref{External Methods,,, tramp, The +Tramp Manual}. + +@item rsync +@cindex rsync +The remote sync protocol. + +@item telnet +The telnet protocol. +@end table + @node General Facilities @chapter General Facilities @@ -1296,6 +1330,14 @@ Connect directly. @end table @end defopt +@defopt url-user-agent +The User Agent string used for sending HTTP/HTTPS requests. The value +should be a string or a function of no arguments that returns a +string. The default value is @w{@samp{User-Agent: @var{package-name} +URL/Emacs}}, where @var{package-name} is the value of +@code{url-package-name} and its version, if they are non-@code{nil}. +@end defopt + @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi |