diff options
Diffstat (limited to 'doc/misc')
-rw-r--r-- | doc/misc/Makefile.in | 1 | ||||
-rw-r--r-- | doc/misc/cc-mode.texi | 81 | ||||
-rw-r--r-- | doc/misc/cl.texi | 2 | ||||
-rw-r--r-- | doc/misc/dired-x.texi | 15 | ||||
-rw-r--r-- | doc/misc/emacs-gnutls.texi | 12 | ||||
-rw-r--r-- | doc/misc/emacs-mime.texi | 8 | ||||
-rw-r--r-- | doc/misc/eww.texi | 18 | ||||
-rw-r--r-- | doc/misc/flymake.texi | 9 | ||||
-rw-r--r-- | doc/misc/gnus.texi | 109 | ||||
-rw-r--r-- | doc/misc/htmlfontify.texi | 3 | ||||
-rw-r--r-- | doc/misc/message.texi | 30 | ||||
-rw-r--r-- | doc/misc/sc.texi | 17 | ||||
-rw-r--r-- | doc/misc/ses.texi | 262 | ||||
-rw-r--r-- | doc/misc/speedbar.texi | 2 | ||||
-rw-r--r-- | doc/misc/texinfo.tex | 1440 | ||||
-rw-r--r-- | doc/misc/tramp.texi | 1443 | ||||
-rw-r--r-- | doc/misc/trampver.texi | 41 | ||||
-rw-r--r-- | doc/misc/url.texi | 26 |
18 files changed, 1903 insertions, 1616 deletions
diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in index 4dffeafb1d2..eca74a0c645 100644 --- a/doc/misc/Makefile.in +++ b/doc/misc/Makefile.in @@ -218,7 +218,6 @@ gnus.pdf: $(gnus_deps) cp gnustmppdf.pdf $@ rm gnustmppdf.* -${buildinfodir}/tramp.info tramp.html: EXTRA_OPTS = -D emacs ${buildinfodir}/tramp.info tramp.html: ${srcdir}/trampver.texi diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 2d95fb824fc..4f7711184d0 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -338,14 +338,15 @@ Line-Up Functions * Comment Line-Up:: * Misc Line-Up:: + Customizing Macros * Macro Backslashes:: * Macros with ;:: +* Noise Macros:: @end detailmenu @end menu - @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @node Introduction, Overview, Top, Top @comment node-name, next, previous, up @@ -6657,15 +6658,18 @@ Because a macro can expand into anything at all, near where one is invoked @ccmode{} can only indent and fontify code heuristically. Sometimes it gets it wrong. Usually you should try to design your macros so that they ''look like ordinary code'' when you invoke them. -However, one situation is so common that @ccmode{} handles it +However, two situations are so common that @ccmode{} handles them specially: that is when certain macros needn't (or mustn't) be -followed by a @samp{;}. You need to configure @ccmode{} to handle -these macros properly, see @ref{Macros with ;}. +followed by a @samp{;}, and when certain macros (or compiler +directives) expand to nothing. You need to configure @ccmode{} to +handle these macros properly, see @ref{Macros with ;} and @ref{Noise +Macros}. @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @menu * Macro Backslashes:: * Macros with ;:: +* Noise Macros:: @end menu @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -6717,7 +6721,7 @@ get aligned only when you explicitly invoke the command @end defopt @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -@node Macros with ;, , Macro Backslashes, Custom Macros +@node Macros with ;, Noise Macros, Macro Backslashes, Custom Macros @comment node-name, next, previous, up @section Macros with semicolons @cindex macros with semicolons @@ -6726,9 +6730,11 @@ Macros which needn't (or mustn't) be followed by a semicolon when you invoke them, @dfn{macros with semicolons}, are very common. These can cause @ccmode{} to parse the next line wrongly as a @code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent -it. +it. At the top level, a macro invocation before a defun start can +cause, for example, @code{c-beginning-of-defun} (@kbd{C-M-a}) not to +find the correct start of the current function. -You can prevent this by specifying which macros have semicolons. It +You can prevent these by specifying which macros have semicolons. It doesn't matter whether or not such a macro has a parameter list: @defopt c-macro-names-with-semicolon @@ -6766,10 +6772,65 @@ example: @defun c-make-macro-with-semi-re @findex make-macro-with-semi-re (c-) Call this (non-interactive) function, which sets internal variables, -each time you change the value of -@code{c-macro-names-with-semicolon}. It takes no arguments, and its +each time you change the value of @code{c-macro-names-with-semicolon} +after the major mode function has run. It takes no arguments, and its return value has no meaning. This function is called by @ccmode{}'s -initialization code. +initialization code, after the mode hooks have run. +@end defun + +@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +@node Noise Macros, , Macros with ;, Custom Macros +@comment node-name, next, previous, up +@section Noise Macros +@cindex noise macros +@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +In @ccmode{}, @dfn{noise macros} are macros which expand to nothing, +or compiler directives (such as GCC's @code{__attribute__}) which play +no part in the syntax of the C (etc.) language. Some noise macros are +followed by arguments in parentheses (possibly optionally), others +are not. + +Noise macros can easily confuse @ccmode{}'s analysis of function +headers, causing them to be mis-fontified, or even mis-indented. You +can prevent this confusion by specifying the identifiers which +constitute noise macros. + +@defopt c-noise-macro-names +@vindex noise-macro-names (c-) +This variable is a list of names of noise macros which never have +parenthesized arguments. Each element is a string, and must be a +valid identifier. An element in @code{c-noise-macro-names} must not +also be in @code{c-noise-macro-with-parens-names}. Such an element is +treated as whitespace by @ccmode{}. +@end defopt + +@defopt c-noise-macro-with-parens-names +@vindex noise-macro-with-parens-names (c-) +This variable is a list of names of noise macros which optionally have +arguments in parentheses. Each element of the list is a string, and +must be a valid identifier. An element in +@code{c-noise-macro-with-parens-names} must not also be in +@code{c-noise-macro-names}. For performance reasons, such an element, +together with the optional parenthesized arguments, is specially +handled, but it is only handled when used in declaration +contexts@footnote{If this restriction causes your project +difficulties, please get in touch with @email{bug-cc-mode@@gnu.org}.}. + +The two compiler directives @code{__attribute__} and @code{__declspec} +have traditionally been handled specially in @ccmode{}; for example +they are fontified with font-lock-keyword-face. You don't need to +include these directives in @code{c-noise-macro-with-parens-names}, +but doing so is OK. +@end defopt + +@defun c-make-noise-macro-regexps +@findex make-noise-macro-regexps (c-) +Call this (non-interactive) function, which sets internal variables, +on changing the value of @code{c-noise-macro-names} or +@code{c-noise-macro-with-parens-names} after the major mode's function +has run. This function is called by @ccmode{}'s initialization code, +after the mode hooks have run. @end defun @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 75a83602fa3..5af41a4465e 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1491,7 +1491,7 @@ for a description of type specifiers. For example, (cl-typecase x (integer (munch-integer x)) (float (munch-float x)) - (string (munch-integer (string-to-int x))) + (string (munch-integer (string-to-number x))) (t (munch-anything x))) @end example diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 474dd0a5208..7ac5bc6b53b 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -369,6 +369,18 @@ and @code{dired-texinfo-unclean-extensions}. If non-@code{nil}, a list of extensions (strings) to omit from Dired listings. Its format is the same as that of @code{completion-ignored-extensions}. +@vindex dired-omit-case-fold +@item dired-omit-case-fold + +Default: @code{filesystem} + +By default, when @code{dired-omit-case-fold} is set to @code{filesystem}, +@code{dired-omit-mode} will match filenames and extensions +case-sensitively on Dired buffers visiting case-sensitive filesystems, +and case-insensitively on case-insensitive filesystems. Set it to +@code{nil} to be always case-sensitive, and to @code{t} to be always +case-insensitive. + @vindex dired-omit-localp @item dired-omit-localp @@ -711,6 +723,9 @@ variable @code{window-min-height}. Mark all files with a certain extension for use in later commands. A @samp{.} is not automatically prepended to the string entered, you must type it explicitly. +If invoked with prefix argument @kbd{C-u}, this command unmark files instead. +If called with the @kbd{C-u C-u} prefix, asks for a character to use +as the marker, and marks files with it. When called from Lisp, @var{extension} may also be a list of extensions and an optional argument @var{marker-char} specifies the marker used. diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi index 1a850c68235..9d52508b644 100644 --- a/doc/misc/emacs-gnutls.texi +++ b/doc/misc/emacs-gnutls.texi @@ -173,7 +173,7 @@ Just use @code{open-protocol-stream} or @code{open-network-stream} You should not have to use the @file{gnutls.el} functions directly. But you can test them with @code{open-gnutls-stream}. -@defun open-gnutls-stream name buffer host service +@defun open-gnutls-stream name buffer host service &optional nowait This function creates a buffer connected to a specific @var{host} and @var{service} (port number or service name). The parameters and their syntax are the same as those given to @code{open-network-stream} @@ -181,6 +181,10 @@ syntax are the same as those given to @code{open-network-stream} Manual}). The connection process is called @var{name} (made unique if necessary). This function returns the connection process. +The @var{nowait} parameter means that the socket should be +asynchronous, and the connection process will be returned to the +caller before TLS negotiation has happened. + @lisp ;; open a HTTPS connection (open-gnutls-stream "tls" "tls-buffer" "yourserver.com" "https") @@ -191,6 +195,12 @@ necessary). This function returns the connection process. @end defun +@findex gnutls-asynchronous-parameters +If called with @var{nowait}, the process is returned immediately +(before connecting to the server). In that case, the process object +is told what parameters to use when negotiating the connection +by using the @code{gnutls-asynchronous-parameters} function. + The function @code{gnutls-negotiate} is not generally useful and it may change as needed, so please see @file{gnutls.el} for the details. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 4d68246bba4..9389435faf1 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1536,6 +1536,9 @@ Here's a bunch of time/date/second/day examples: (date-to-time "Sat Sep 12 12:21:54 1998 +0200") @result{} (13818 19266) +(parse-iso8601-time-string "1998-09-12T12:21:54+0200") +@result{} (13818 19266) + (float-time '(13818 19266)) @result{} 905595714.0 @@ -1826,6 +1829,11 @@ matching types. @vindex mailcap-mime-data This variable is an alist of alists containing backup viewing rules. +@item mailcap-user-mime-data +@vindex mailcap-user-mime-data +A customizable list of viewers that take preference over +@code{mailcap-mime-data}. + @end table Interface functions: diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 7726a8d3dc4..ea258634301 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -97,6 +97,12 @@ and the web page is rendered in it. You can leave EWW by pressing web page hit @kbd{g} (@code{eww-reload}). Pressing @kbd{w} (@code{eww-copy-page-url}) will copy the current URL to the kill ring. +@findex eww-open-in-new-buffer +@kindex M-RET + The @kbd{M-RET} command (@code{eww-open-in-new-buffer}) opens the +URL at point in a new EWW buffer, akin to opening a link in a new +``tab'' in other browsers. + @findex eww-readable @kindex R The @kbd{R} command (@code{eww-readable}) will attempt to determine @@ -109,6 +115,12 @@ only display this part. This usually gets rid of menus and the like. The @kbd{F} command (@code{eww-toggle-fonts}) toggles whether to use variable-pitch fonts or not. This sets the @code{shr-use-fonts} variable. +@findex eww-toggle-colors +@findex shr-use-colors +@kindex F + The @kbd{C} command (@code{eww-toggle-colors}) toggles whether to use +HTML-specified colors or not. This sets the @code{shr-use-colors} variable. + @findex eww-download @vindex eww-download-directory @kindex d @@ -158,12 +170,16 @@ You can view stored bookmarks with @kbd{B} (@code{eww-list-bookmarks}). This will open the bookmark buffer @file{*eww bookmarks*}. +@findex eww-switch-to-buffer @findex eww-list-buffers +@kindex s @kindex S @cindex Multiple Buffers To get summary of currently opened EWW buffers, press @kbd{S} (@code{eww-list-buffers}). The @file{*eww buffers*} buffer allows you -to quickly kill, flip through and switch to specific EWW buffer. +to quickly kill, flip through and switch to specific EWW buffer. To +switch EWW buffers through a minibuffer prompt, press @kbd{s} +(@code{eww-switch-to-buffer}). @findex eww-browse-with-external-browser @vindex shr-external-browser diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 1c4644bba14..6cece30a986 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -323,12 +323,6 @@ file cannot be run simultaneously. If any changes are made to the buffer, syntax check is automatically started after @code{flymake-no-changes-timeout} seconds. -@item flymake-gui-warnings-enabled -A boolean flag indicating whether Flymake will show message boxes for -non-recoverable errors. If @code{flymake-gui-warnings-enabled} is -@code{nil}, these errors will only be logged to the @file{*Messages*} -buffer. - @item flymake-start-syntax-check-on-newline A boolean flag indicating whether to start syntax check after a newline character is added to the buffer. @@ -697,7 +691,8 @@ The command line (command name and the list of arguments) for launching a proces initialization function. Flymake then just calls @code{start-process} to start an asynchronous process and configures a process filter and sentinel, which are used for processing the output of the syntax check -tool. +tool. When exiting Emacs, running Flymake processes will be killed +without prompting the user. @node Parsing the output @section Parsing the output diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 11f9f35227d..393787c33a3 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -828,6 +828,7 @@ Various * Thwarting Email Spam:: Simple ways to avoid unsolicited commercial email. * Spam Package:: A package for filtering and processing spam. * The Gnus Registry:: A package for tracking messages by Message-ID. +* The Gnus Cloud:: A package for synchronizing Gnus marks. * Other modes:: Interaction with other modes. * Various Various:: Things that are really various. @@ -5042,11 +5043,12 @@ access the @code{X-Newsreader} header: @item @vindex gnus-ignored-from-addresses -The @code{gnus-ignored-from-addresses} variable says when the @samp{%f} -summary line spec returns the @code{To}, @code{Newsreader} or -@code{From} header. If this regexp matches the contents of the -@code{From} header, the value of the @code{To} or @code{Newsreader} -headers are used instead. +The @code{gnus-ignored-from-addresses} variable says when the +@samp{%f} summary line spec returns the @code{To}, @code{Newsreader} +or @code{From} header. The variable may be a regexp or a predicate +function. If this matches the contents of the @code{From} +header, the value of the @code{To} or @code{Newsreader} headers are +used instead. To distinguish regular articles from those where the @code{From} field has been swapped, a string is prefixed to the @code{To} or @@ -14654,7 +14656,7 @@ an additional mail source for a particular group by including the @code{group} mail specifier in @code{mail-sources}, and setting a @code{mail-source} group parameter (@pxref{Group Parameters}) specifying a single mail source. When this is used, @code{mail-sources} is -typically just @code{(group)}; the @code{mail-source} parameter for a +typically just @code{((group))}; the @code{mail-source} parameter for a group might look like this: @lisp @@ -22207,6 +22209,7 @@ to you, using @kbd{G b u} and updating the group will usually fix this. * Thwarting Email Spam:: Simple ways to avoid unsolicited commercial email. * Spam Package:: A package for filtering and processing spam. * The Gnus Registry:: A package for tracking messages by Message-ID. +* The Gnus Cloud:: A package for synchronizing Gnus marks. * Other modes:: Interaction with other modes. * Various Various:: Things that are really various. @end menu @@ -26165,6 +26168,100 @@ default this is just @code{(marks)} so the custom registry marks are precious. @end defvar +@node The Gnus Cloud +@section The Gnus Cloud +@cindex cloud +@cindex gnus-cloud +@cindex synchronization +@cindex sync +@cindex synch + +The Gnus Cloud is a way to synchronize marks and general files and +data across multiple machines. + +Very often, you want all your marks (what articles you've read, which +ones were important, and so on) to be synchronized between several +machines. With IMAP, that's built into the protocol, so you can read +nnimap groups from many machines and they are automatically +synchronized. But NNTP, nnrss, and many other backends do not store +marks, so you have to do it locally. + +The Gnus Cloud package stores the marks, plus any files you choose, on +an IMAP server in a special folder. It's like a +DropTorrentSyncBoxOakTree(TM). + +@menu +* Gnus Cloud Setup:: +* Gnus Cloud Usage:: +@end menu + +@node Gnus Cloud Setup +@subsection Gnus Cloud Setup + +Setting up the Gnus Cloud takes less than a minute. From the Group +buffer: + +Press @kbd{^} to go to the Server buffer. Here you'll see all the +servers that Gnus knows. @xref{Server Buffer}. + +Then press @kbd{i} to mark any servers as cloud-synchronized (their marks are synchronized). + +Then press @kbd{I} to mark a single server as the cloud host (it must +be an IMAP server, and will host a special IMAP folder with all the +synchronization data). This will set the variable +@code{gnus-cloud-method} (using the Customize facilities), then ask +you to optionally upload your first CloudSynchronizationDataPack(TM). + +@node Gnus Cloud Usage +@subsection Gnus Cloud Usage + +After setting up, you can use these shortcuts from the Group buffer: + +@table @kbd +@item ~ RET +@item ~ d +@findex gnus-cloud-download-all-data +@cindex cloud, download +Download the latest Gnus Cloud data. + +@item ~ u +@item ~ ~ +@findex gnus-cloud-upload-all-data +@cindex cloud, download +Upload the local Gnus Cloud data. Creates a new +CloudSynchronizationDataPack(TM). + +@end table + +But wait, there's more. Of course there's more. So much more. You can +customize all of the following. + +@defvar gnus-cloud-synced-files +These are the files that will be part of every +CloudSynchronizationDataPack(TM). They are included in every upload, +so don't synchronize a lot of large files. Files under 100Kb are best. +@end defvar + +@defvar gnus-cloud-storage-method +This is a choice from several storage methods. It's highly recommended +to use the EPG facilities. It will be automatic if have GnuPG +installed and EPG loaded. Otherwise, you could use Base64+gzip, +Base64, or no encoding. +@end defvar + +@defvar gnus-cloud-interactive +When this is set, and by default it is, the Gnus Cloud package will +ask you for confirmation here and there. Leave it on until you're +comfortable with the package. +@end defvar + + +@defvar gnus-cloud-method +The name of the IMAP server to store the +CloudSynchronizationDataPack(TM)s. It's easiest to set this from the +Server buffer (@pxref{Gnus Cloud Setup}). +@end defvar + @node Other modes @section Interaction with other modes diff --git a/doc/misc/htmlfontify.texi b/doc/misc/htmlfontify.texi index 20cde7124d1..9cb1d6f4317 100644 --- a/doc/misc/htmlfontify.texi +++ b/doc/misc/htmlfontify.texi @@ -126,7 +126,8 @@ entities, so you should even be able to do html-within-html fontified display. You should, however, note that random control or non-ASCII characters -such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet. +such as ^L (U+000C FORM FEED (FF)) or ¤ (U+00A4 CURRENCY SIGN) won't +get mapped yet. If the @var{srcdir} and @var{file} arguments are set, lookup etags derived entries in the @ref{hfy-tags-cache} and add html anchors diff --git a/doc/misc/message.texi b/doc/misc/message.texi index 0b82f343d71..6ec761506d0 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -67,7 +67,6 @@ Message mode buffers. * Interface:: Setting up message buffers. * Commands:: Commands you can execute in message mode buffers. * Variables:: Customizing the message buffers. -* Compatibility:: Making Message backwards compatible. * Appendices:: More technical things. * GNU Free Documentation License:: The license for this documentation. * Index:: Variable, function and concept index. @@ -185,8 +184,9 @@ but you can change the behavior to suit your needs by fiddling with the @vindex message-dont-reply-to-names Addresses that match the @code{message-dont-reply-to-names} regular -expression (or list of regular expressions) will be removed from the -@code{Cc} header. A value of @code{nil} means exclude your name only. +expression (or list of regular expressions or a predicate function) +will be removed from the @code{Cc} header. A value of @code{nil} means +exclude your name only. @vindex message-prune-recipient-rules @code{message-prune-recipient-rules} is used to prune the addresses @@ -1678,10 +1678,10 @@ trailing old subject. In this case, @item message-alternative-emails @vindex message-alternative-emails -Regexp matching alternative email addresses. The first address in the -To, Cc or From headers of the original article matching this variable is -used as the From field of outgoing messages, replacing the default From -value. +Regexp or predicate function matching alternative email addresses. +The first address in the To, Cc or From headers of the original +article matching this variable is used as the From field of outgoing +messages, replacing the default From value. For example, if you have two secondary email addresses john@@home.net and john.doe@@work.com and want to use them in the From field when @@ -2592,22 +2592,6 @@ An @dfn{action} can be either: a normal function, or a list where the a form to be @code{eval}ed. -@node Compatibility -@chapter Compatibility -@cindex compatibility - -Message uses virtually only its own variables---older @code{mail-} -variables aren't consulted. To force Message to take those variables -into account, you can put the following in your @file{.emacs} file: - -@lisp -(require 'messcompat) -@end lisp - -This will initialize many Message variables from the values in the -corresponding mail variables. - - @node Appendices @chapter Appendices diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi index 1f7b73dd73b..80512292c32 100644 --- a/doc/misc/sc.texi +++ b/doc/misc/sc.texi @@ -775,18 +775,6 @@ MUA calls @code{sc-cite-original} at the right time. As mentioned above, some MUAs handle this differently. Read the sections that follow pertaining to the MUAs you are using. -@vindex sc-load-hook -@vindex load-hook (sc-) -@vindex sc-pre-hook -@vindex pre-hook (sc-) -One final note. After Supercite is loaded into your Emacs session, it -runs the hook @code{sc-load-hook}. You can put any customizations into -this hook since it is only run once. This will not work, however, if -your Emacs maintainer has put Supercite into your dumped Emacs image. -In that case, you can use the @code{sc-pre-hook} variable, but this will -get executed every time @code{sc-cite-original} is called. @xref{Reply -Buffer Initialization}. - @node Replying and Yanking @chapter Replying and Yanking @@ -964,8 +952,6 @@ reset certain variables set in @code{sc-pre-hook}. @cindex gin-mode @findex sc-setup-filladapt @findex setup-filladapt (sc-) -@vindex sc-load-hook -@vindex load-hook (sc-) Supercite will automatically fill newly cited text from the original message unless the variable @code{sc-auto-fill-region-p} has a @@ -979,7 +965,8 @@ two best known are @dfn{filladapt} and @dfn{gin-mode}. Both work well with Supercite and both are available at the normal Emacs Lisp archive sites. @dfn{gin-mode} works pretty well out of the box, but if you use @dfn{filladapt}, you may want to run the function -@code{sc-setup-filladapt} from your @code{sc-load-hook}. This simply +@code{sc-setup-filladapt} after loading @file{supercite} +(e.g., using @code{with-eval-after-load}). This simply makes @dfn{filladapt} a little more Supercite savvy than its default setup. diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index 58f9ba8ccf3..ba10be9bfa5 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -187,6 +187,14 @@ the end-points, e.g.: (The @code{apply} is necessary because @code{ses-range} produces a @emph{list} of values. This allows for more complex possibilities.) +Alternatively you can use the @code{!} modifier of @code{ses-range} to +remove blank cells from the returned list, which allows to use +@code{+} instead of @code{ses+}: + +@lisp +(apply '+ (ses-range A2 A5 !)) +@end lisp + @c =================================================================== @node The Basics @@ -374,26 +382,62 @@ Undo previous action (@code{(undo)}). @cindex printer functions @cindex cell formatting @cindex formatting cells -@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 -@findex ses-dashfill-span -@findex ses-tildefill-span - Printer functions convert binary cell values into the print forms that Emacs will display on the screen. -A printer can be a format string, like @samp{"$%.2f"}. The result +@menu +* Various kinds of printer functions:: +* Configuring what printer function applies:: +* Standard printer functions:: +* Local printer functions:: +* Writing a lambda printer function:: +@end menu + +@node Various kinds of printer functions +@subsection Various kinds of printer functions + +When configuring what printer function applies (@pxref{Configuring +what printer function applies}), you can enter a printer function as +one of the following: + +@itemize +@item +A format string, like @samp{"$%.2f"}. The result string is right-aligned within the print cell. To get left-alignment, -use parentheses: @samp{("$%.2f")}. A printer can also be a -one-argument function (a symbol or a lambda), whose result is a string -(right-aligned) or list of one string (left-aligned). While typing in -a lambda, you can use @kbd{M-@key{TAB}} to complete the names of symbols. +use parentheses: @samp{("$%.2f")}. +@item +A printer can also be a one-argument function, the result of which is +a string (right-aligned) or list of one string (left-aligned). Such a +function can be in turn configured as: +@itemize +@item +A lambda expression, for instance: + +@lisp +(lambda (x) + (cond + ((null x) "") + ((numberp x) (format "%.2f" x)) + (t (ses-center-span x ?# 'ses-prin1)))) +@end lisp + +While typing in a lambda, you can use @kbd{M-@key{TAB}} to complete +the names of symbols. +@item +A symbol referring to a standard printer function (@pxref{Standard +printer functions}). +@item +A symbol referring to a local printer function (@pxref{Local printer +functions}). +@end itemize + + +@end itemize + + +@node Configuring what printer function applies +@subsection Configuring what printer function applies Each cell has a printer. If @code{nil}, the column-printer for the cell's column is used. If that is also @code{nil}, the default-printer for the @@ -401,25 +445,35 @@ spreadsheet is used. @table @kbd @item p +@findex ses-read-cell-printer Enter a printer for current cell or range (@code{ses-read-cell-printer}). @item M-p +@findex ses-read-column-printer Enter a printer for the current column (@code{ses-read-column-printer}). @item C-c C-p +@findex ses-read-default-printer Enter the default printer for the spreadsheet (@code{ses-read-default-printer}). @end table -The @code{ses-read-@r{XXX}-printer} commands have their own minibuffer -history, which is preloaded with the set of all printers used in this -spreadsheet, plus the standard printers. +The @code{ses-read-@var{xxx}-printer} commands have their own +minibuffer history, which is preloaded with the set of all printers +used in this spreadsheet, plus the standard printers (@pxref{Standard +printer functions}) and the local printers (@pxref{Local printer +functions}). -The standard printers are suitable only for cells, not columns or -default, because they format the value using the column-printer (or -default-printer if @code{nil}) and then center the result: +@node Standard printer functions +@subsection Standard printer functions -@table @code + +Except for @code{ses-prin1}, the other standard printers are suitable +only for cells, not columns or default, because they format the value +using the column-printer (or default-printer if @code{nil}) and then +center the result: + +@ftable @code @item ses-center Just centering. @@ -434,8 +488,16 @@ Centering with dashes and spill-over. @item ses-tildefill-span Centering with tildes (~) and spill-over. -@end table +@item ses-prin1 +This is the fallback printer, used when calling the configured printer +throws some error. +@end ftable + +@node Local printer functions +@subsection Local printer functions + +@findex ses-define-local-printer 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 @@ -444,6 +506,113 @@ printer function. Then, if you call again @code{"%.3f"}, all the cells using printer @samp{foo} will be reprinted accordingly. +Sometimes there are local printers that you want to define or +re-define automatically every time you open a sheet. For instance +imagine that you want to define/re-define automatically a local +printer @code{euro} to display a number like an amount of euros, that +is to say number @code{3.1} would be displayed as +@code{3.10@dmn{}@euro{}}. To do so in any non read-only SES buffer, +you can add some code like this to your @file{.emacs} init file: + +@lisp +(defun my-ses-mode-hook () + (unless buffer-read-only + (ses-define-local-printer + 'euro + (lambda (x) + (cond + ((null x) "") + ((numberp x) (format "%.2f€" x)) + (t (ses-center-span x ?# 'ses-prin1))))))) +(add-hook 'ses-mode-hook 'my-ses-mode-hook) +@end lisp + +If you replace command @code{ses-define-local-printer} by function +@code{ses-define-if-new-local-printer} +@findex ses-define-if-new-local-printer +the definition will occur only if a local printer with the same name +in not already defined. + + +@node Writing a lambda printer function +@subsection Writing a lambda printer function + +You can write a printer function with a lambda expression taking one +argument in two cases: + +@itemize +@item +when you configure the printer function applying to a cell or column, or +@item +when you define a local printer function with command +@code{ses-define-local-printer}. +@end itemize + +When doing so, please take care that the returned value is a string, +or a list containing a string, even when the input argument has an +unexpected value. Here is an example: + +@example +(lambda (val) + (cond + ((null val) "") + ((and (numberp val) (>= val 0)) (format "%.1f" val)) + (t (ses-center-span val ?# 'ses-prin1)))) +@end example + +This example will: + +@itemize +@item +When the cell is empty (ie.@: when @code{val} is @code{nil}), print an +empty string @code{""} +@item +When the cell value is a non negative number, format the the value in +fixed-point notation with one decimal after point +@item +Otherwise, handle the value as erroneous by printing it as an +s-expression (using @code{ses-prin1}), centered and surrounded by +@code{#} filling. +@end itemize + +Another precaution to take is to avoid stack overflow due to a +printer function calling itself indefinitely. This mistake can +happen when you use a local printer as a column printer, +and this local printer implicitly calls the current column printer, so it +will call itself recursively. Imagine for instance that you want to +create some local printer @code{=fill} that would center the content +of a cell and surround it by equal signs @code{=}, and you do it this +way: + +@lisp +(lambda (x) + (cond + ((null x) "") + (t (ses-center x 0 ?=)))) +@end lisp + +Because @code{=fill} uses the standard printer @code{ses-center} without +explicitly passing any printer to it, @code{ses-center} will call the +current column printer if any, or the spreadsheet default printer +otherwise. So using @code{=fill} as a column printer will result in a +stack overflow in this column. SES does not check for that; +you just have to be careful. For instance, re-write @code{=fill} like +this: + +@lisp +(lambda (x) + (cond + ((null x) "") + ((stringp x) (ses-center x 0 ?= " %s ")) + (t (ses-center-span x ?# 'ses-prin1)))) +@end lisp + +The code above applies the @code{=} filling only to strings; it also +surrounds the string by one space on each side before filling with +@code{=} signs. So the string @samp{Foo} will be displayed like @samp{@w{=== +Foo ===}} in an 11 character wide column. Anything other than an empty cell +or a non-string is displayed as an error by using @code{#} filling. + @node Clearing cells @section Clearing cells @cindex clearing commands @@ -595,8 +764,8 @@ Pops up a menu to set the current row as the header, or revert to column letters. @item M-x ses-rename-cell @findex ses-rename-cell -Rename a cell from a standard A1-like name to any -string. +Rename a cell from a standard A1-like name to any string that can be a +valid local variable name (See also @ref{Nonrelocatable references}). @item M-x ses-repair-cell-reference-all @findex ses-repair-cell-reference-all When you interrupt a cell formula update by clicking @kbd{C-g}, then @@ -791,8 +960,17 @@ are some useful functions to call from your formulas: @table @code @item (ses-delete-blanks &rest @var{args}) -Returns a list from which all blank cells (value is either @code{nil} or -'*skip*) have been deleted. +Returns a list from which all blank cells (value is either @code{nil} +or '*skip*) have been deleted. Order of args is reverted. Please note +that @code{ses-range} has a @code{!} modifier that allows to remove +blanks, so it is possible to write: +@lisp +(ses-range A1 A5 !) +@end lisp +instead of +@lisp +(apply 'ses-delete-blanks (ses-range A1 A5 <)) +@end lisp @item (ses+ &rest @var{args}) Sum of non-blank arguments. @@ -842,9 +1020,10 @@ this to undo the effect of @kbd{t}. @end table When a printer function signals an error, the fallback printer -@samp{"%s"} is substituted. This is useful when your column printer +@findex ses-prin1 +@code{ses-prin1} is substituted. This is useful when your column printer is numeric-only and you use a string as a cell value. Note that the -standard default printer is ``%.7g'' which is numeric-only, so cells +standard default printer is @samp{"%.7g"} which is numeric-only, so cells that are empty of contain strings will use the fallback printer. @kbd{c} on such cells will display ``Format specifier doesn't match argument type''. @@ -986,7 +1165,18 @@ can type ahead without worrying about the glitch. @kbd{C-u C-y} relocates none of the cell-references. What about mixed cases? -You can use +The best way is to rename cells that you do not want to be relocatable +by using @code{ses-rename-cell}. +@findex ses-rename-cell +Cells that do not have an A1-like name style are not relocated on +yank. Using this method, the concerned cells won't be relocated +whatever formula they appear in. Please note however that when a +formula contains some range @code{(ses-range @var{cell1} @var{cell2})} +then in the yanked formula each range bound @var{cell1} and +@var{cell2} are relocated, or not, independently, depending on whether +they are A1-like or renamed. + +An alternative method is to use @lisp (symbol-value 'B3) @end lisp @@ -994,7 +1184,8 @@ to make an @dfn{absolute reference}. The formula relocator skips over quoted things, so this will not be relocated when pasted or when rows/columns are inserted/deleted. However, B3 will not be recorded as a dependency of this cell, so this cell will not be updated -automatically when B3 is changed. +automatically when B3 is changed, this is why using +@code{ses-rename-cell} is most of the time preferable. The variables @code{row} and @code{col} are dynamically bound while a cell formula is being evaluated. You can use @@ -1011,12 +1202,13 @@ kind of dependency is also not recorded. @findex ses-reconstruct-all Begins with an 014 character, followed by sets of cell-definition -macros for each row, followed by column-widths, column-printers, +macros for each row, followed by the set of local printer +definitions, followed by column-widths, column-printers, default-printer, and header-row. Then there's the global parameters -(file-format ID, numrows, numcols) and the local variables (specifying -@acronym{SES} mode for the buffer, etc.). +(file-format ID, row count, column count, local printer count) and the +local variables (specifying @acronym{SES} mode for the buffer, etc.). -When a @acronym{SES} file is loaded, first the numrows and numcols values are +When a @acronym{SES} file is loaded, first the global parameters are loaded, then the entire data area is @code{eval}ed, and finally the local variables are processed. diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi index d43c521f76a..27b57c0a03a 100644 --- a/doc/misc/speedbar.texi +++ b/doc/misc/speedbar.texi @@ -1030,7 +1030,7 @@ it is not provided, you can derive it like this: (progn (beginning-of-line) (looking-at "^\\([0-9]+\\):") - (setq depth (string-to-int (match-string 1))))) + (setq depth (string-to-number (match-string 1))))) @end example @noindent diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 37e2de896ec..c8913ab918e 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{2016-04-14.07} +\def\texinfoversion{2016-09-18.18} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -67,6 +67,10 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} +% LaTeX's \typeout. This ensures that the messages it is used for +% are identical in format to the corresponding ones from latex/pdflatex. +\def\typeout{\immediate\write17}% + \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. @@ -858,36 +862,6 @@ where each line of input produces a line of output.} \temp } -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). This command -% is not documented, not supported, and doesn't work. -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} @@ -1104,9 +1078,14 @@ where each line of input produces a line of output.} % For LuaTeX % +\newif\iftxiuseunicodedestname +\txiuseunicodedestnamefalse % For pdfTeX etc. + \ifx\luatexversion\thisisundefined \else - % Escape PDF strings UTF-8 to UTF-16 + % Use Unicode destination names + \txiuseunicodedestnametrue + % Escape PDF strings with converting UTF-16 from UTF-8 \begingroup \catcode`\%=12 \directlua{ @@ -1134,7 +1113,24 @@ where each line of input produces a line of output.} end } \endgroup - \def\pdfescapestring#1{\directlua{UTF16oct('\luaescapestring{#1}')}} + \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} + % Escape PDF strings without converting + \begingroup + \directlua{ + function PDFescstr(str) + for c in string.bytes(str) do + if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then + tex.sprint( + string.format(string.char(0x5c) .. string.char(0x25) .. '03o', + c)) + else + tex.sprint(string.char(c)) + end + end + end + } + \endgroup + \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} \ifnum\luatexversion>84 % For LuaTeX >= 0.85 \def\pdfdest{\pdfextension dest} @@ -1188,12 +1184,21 @@ where each line of input produces a line of output.} \ifx\pdfescapestring\thisisundefined % No primitive available; should we give a warning or log? % Many times it won't matter. + \xdef#1{#1}% \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } +\def\txiescapepdfutfsixteen#1{% + \ifx\pdfescapestrutfsixteen\thisisundefined + % No UTF-16 converting macro available. + \txiescapepdf{#1}% + \else + \xdef#1{\pdfescapestrutfsixteen{#1}}% + \fi +} \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot @@ -1303,17 +1308,77 @@ output) for that.)} \pdfrefximage \pdflastximage \fi} % - \def\pdfmkdest#1{{% + \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts - \turnoffactive \makevalueexpandable + \turnoffactive + \iftxiuseunicodedestname + \ifx \declaredencoding \latone + % Pass through Latin-1 characters. + % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. + \else + \ifx \declaredencoding \utfeight + % Pass through Unicode characters. + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi + \fi + \else + % Use ASCII approximations in destination names. + \passthroughcharsfalse + \fi \def\pdfdestname{#1}% \txiescapepdf\pdfdestname - \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % + \def\setpdfoutlinetext#1{{% + \indexnofonts + \makevalueexpandable + \turnoffactive + \ifx \declaredencoding \latone + % The PDF format can use an extended form of Latin-1 in bookmark + % strings. See Appendix D of the PDF Reference, Sixth Edition, for + % the "PDFDocEncoding". + \passthroughcharstrue + % Pass through Latin-1 characters. + % LuaTeX: Convert to Unicode + % pdfTeX: Use Latin-1 as PDFDocEncoding + \def\pdfoutlinetext{#1}% + \else + \ifx \declaredencoding \utfeight + \ifx\luatexversion\thisisundefined + % For pdfTeX with UTF-8. + % TODO: the PDF format can use UTF-16 in bookmark strings, + % but the code for this isn't done yet. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \else + % For LuaTeX with UTF-8. + % Pass through Unicode characters for title texts. + \passthroughcharstrue + \def\pdfoutlinetext{#1}% + \fi + \else + % For non-Latin-1 or non-UTF-8 encodings. + % Use ASCII approximations. + \passthroughcharsfalse + \def\pdfoutlinetext{#1}% + \fi + \fi + % LuaTeX: Convert to UTF-16 + % pdfTeX: Use Latin-1 as PDFDocEncoding + \txiescapepdfutfsixteen\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % @@ -1341,23 +1406,13 @@ output) for that.)} % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - { - \ifx\luatexversion\thisisundefined \else - \turnoffactive % LuaTeX can use Unicode strings for PDF - \fi - \edef\pdfoutlinedest{#3}% - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% - \else - \txiescapepdf\pdfoutlinedest - \fi - % - % Also escape PDF chars in the display string. - \edef\pdfoutlinetext{#1}% - \txiescapepdf\pdfoutlinetext - % - \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% - } + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% + \fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% @@ -1515,72 +1570,132 @@ output) for that.)} % % For XeTeX % -\newif\iftxiuseunicodedestname \ifx\XeTeXrevision\thisisundefined \else % % XeTeX version check % - \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99995}>-1 - % XeTeX 0.99995+ contains xdvipdfmx 20160307+. - % It can handle Unicode destination name for PDF. + \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 + % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. + % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). + % For avoiding PDF destination name replacement, we use this special + % instead of xdvipdfmx's command line option `-C 0x0010'. + \special{dvipdfmx:config C 0x0010} + % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. + % It can handle Unicode destination names for PDF. \txiuseunicodedestnametrue \else - % XeTeX < 0.99995 can not handle Unicode destination name for PDF - % because xdvipdfmx 20150315 has UTF-16 convert issue. - % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). + % XeTeX < 0.99996 (TeX Live < 2016) cannot use the + % `dvipdfmx:config' special. + % So for avoiding PDF destination name replacement, + % xdvipdfmx's command line option `-C 0x0010' is necessary. + % + % XeTeX < 0.99995 can not handle Unicode destination names for PDF + % because xdvipdfmx 20150315 has a UTF-16 conversion issue. + % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). \txiuseunicodedestnamefalse \fi % + % Color support + % + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % % PDF outline support % - \pdfmakepagedesttrue \relax - % Emulate the primitive of pdfTeX + % Emulate pdfTeX primitive \def\pdfdest name#1 xyz{% - \special{pdf:dest (name#1) [@thispage /XYZ @xpos @ypos]}% + \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% } - \def\pdfmkdest#1{{% + % + \def\setpdfdestname#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts + \makevalueexpandable + \turnoffactive \iftxiuseunicodedestname - \def\pdfdestname{#1}% Pass through Unicode characters. + % Pass through Unicode characters. \else - \edef\pdfdestname{#1}% Replace Unicode characters to ASCII. + % Use ASCII approximations in destination names. + \passthroughcharsfalse \fi - \turnoffactive - \makevalueexpandable + \def\pdfdestname{#1}% \txiescapepdf\pdfdestname - \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % + \def\setpdfoutlinetext#1{{% + \turnoffactive + % Always use Unicode characters in title texts. + \def\pdfoutlinetext{#1}% + % For XeTeX, xdvipdfmx converts to UTF-16. + % So we do not convert. + \txiescapepdf\pdfoutlinetext + }} + % + \def\pdfmkdest#1{% + \setpdfdestname{#1}% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + } + % + % by default, use black for everything. + \def\urlcolor{\rgbBlack} + \def\linkcolor{\rgbBlack} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % \def\dopdfoutline#1#2#3#4{% - \iftxiuseunicodedestname - \def\pdfoutlinedest{#3}% Pass through Unicode characters. - \else - \edef\pdfoutlinedest{#3}% Replace Unicode characters to ASCII. - \fi - \ifx\pdfoutlinedest\empty - \def\pdfoutlinedest{#4}% + \setpdfoutlinetext{#1} + \setpdfdestname{#3} + \ifx\pdfdestname\empty + \def\pdfdestname{#4}% \fi - { - \turnoffactive - \txiescapepdf\pdfoutlinedest - \edef\pdfoutlinetext{#1}% - \txiescapepdf\pdfoutlinetext - % - \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A - << /S /GoTo /D (name\pdfoutlinedest) >> >> }% - } + % + \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A + << /S /GoTo /D (\pdfdestname) >> >> }% } % \def\pdfmakeoutlines{% \begingroup % - % In the case of XeTeX, counts of subentries is not necesary. - % Therefore, read toc only once. + % For XeTeX, counts of subentries are not necessary. + % Therefore, we read toc only once. % - % We use the node names as the destinations. + % We use node names as destinations. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{1}{##3}{##4}}% @@ -1600,7 +1715,7 @@ output) for that.)} \let\unnsubsecentry\numsubsecentry% \let\unnsubsubsecentry\numsubsubsecentry% % - % In the case of XeTeX, xdvipdfmx converts strings to UTF-16. + % For XeTeX, xdvipdfmx converts strings to UTF-16. % Therefore, the encoding and the language may not be considered. % \indexnofonts @@ -1622,9 +1737,9 @@ output) for that.)} \special{pdf:docview << /PageMode /UseOutlines >> } % ``\special{pdf:tounicode ...}'' is not necessary % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. - % However, due to UTF-16 convert issue of xdvipdfmx 20150315, - % ``\special{pdf:dest ...}'' can not handle non-ASCII strings. - % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). + % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, + % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. + % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax @@ -1684,7 +1799,7 @@ output) for that.)} {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \special{pdf:bann << /Border [0 0 0] - /Type /Annot /Subtype /Link /A << /S /GoTo /D (name#1) >> >>}% + /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} % @@ -1696,7 +1811,7 @@ output) for that.)} \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % - % XeTeX (and the PDF format) support .pdf, .png, .jpg (among + % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. @@ -1740,40 +1855,9 @@ output) for that.)} } \fi -\message{fonts,} - -% Change the current font style to #1, remembering it in \curfontstyle. -% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in -% italics, not bold italics. -% -\def\setfontstyle#1{% - \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. - \csname ten#1\endcsname % change the current font -} -% Select #1 fonts with the current style. % -\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} - -\def\rm{\fam=0 \setfontstyle{rm}} -\def\it{\fam=\itfam \setfontstyle{it}} -\def\sl{\fam=\slfam \setfontstyle{sl}} -\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} -\def\tt{\fam=\ttfam \setfontstyle{tt}} - -% Unfortunately, we have to override this for titles and the like, since -% in those cases "rm" is bold. Sigh. -\def\rmisbold{\rm\def\curfontstyle{bf}} - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf. -\newfam\sffam -\def\sf{\fam=\sffam \setfontstyle{sf}} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this font style. -\def\ttsl{\setfontstyle{ttsl}} - +\message{fonts,} % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers @@ -2124,8 +2208,8 @@ end \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defsl\slshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf -\let\tenttsl=\defttsl \let\tensl=\defsl \bf} +\def\df{\let\ttfont=\deftt \let\bffont = \defbf +\let\ttslfont=\defttsl \let\slfont=\defsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -2212,7 +2296,7 @@ end \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} -% Reduced fonts for @acro in text (10pt). +% Reduced fonts for @acronym in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} @@ -2258,8 +2342,8 @@ end \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defsl\slshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf -\let\tensl=\defsl \let\tenttsl=\defttsl \bf} +\def\df{\let\ttfont=\deftt \let\bffont = \defbf +\let\slfont=\defsl \let\ttslfont=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -2345,7 +2429,7 @@ end \font\ssecsy=cmsy10 \def\ssececsize{1000} -% Reduced fonts for @acro in text (9pt). +% Reduced fonts for @acronym in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} @@ -2365,6 +2449,12 @@ end \rm } % end of 10pt text font size definitions, \definetextfontsizex +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + % We provide the user-level command % @fonttextsize 10 @@ -2391,20 +2481,47 @@ end \endgroup } +% +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname #1font\endcsname % change the current font +} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. We don't % bother to reset \scriptfont and \scriptscriptfont; awaiting user need. % \def\resetmathfonts{% - \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy - \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf - \textfont\ttfam=\tentt \textfont\sffam=\tensf + \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont + \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont + \textfont\ttfam=\ttfont \textfont\sffam=\sffont } -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this because \STYLE needs to also set the -% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire -% \tenSTYLE to set the current font. +% + +% The font-changing commands (all called \...fonts) redefine the meanings +% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs +% to also set the current \fam for math mode. Our \STYLE (e.g., \rm) +% commands hardwire \STYLEfont to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used @@ -2412,78 +2529,63 @@ end % % This all needs generalizing, badly. % -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy - \let\tenttsl=\textttsl - \def\curfontsize{text}% - \def\lsize{reduced}\def\lllsize{smaller}% - \resetmathfonts \setleading{\textleading}} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \def\curfontsize{title}% - \def\lsize{chap}\def\lllsize{subsec}% - \resetmathfonts \setleading{27pt}} -\def\titlefont#1{{\titlefonts\rmisbold #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy - \let\tenttsl=\chapttsl - \def\curfontsize{chap}% - \def\lsize{sec}\def\lllsize{text}% - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy - \let\tenttsl=\secttsl - \def\curfontsize{sec}% - \def\lsize{subsec}\def\lllsize{reduced}% - \resetmathfonts \setleading{17pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy - \let\tenttsl=\ssecttsl - \def\curfontsize{ssec}% - \def\lsize{text}\def\lllsize{small}% - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts -\def\reducedfonts{% - \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl - \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc - \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy - \let\tenttsl=\reducedttsl - \def\curfontsize{reduced}% - \def\lsize{small}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \def\curfontsize{small}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{10.5pt}} -\def\smallerfonts{% - \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl - \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc - \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy - \let\tenttsl=\smallerttsl - \def\curfontsize{smaller}% - \def\lsize{smaller}\def\lllsize{smaller}% - \resetmathfonts \setleading{9.5pt}} -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000}{OT1} -\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000}{OT1} -\setfont\shortconttt\ttshape{12}{1000}{OT1TT} +\def\assignfonts#1{% + \expandafter\let\expandafter\rmfont\csname #1rm\endcsname + \expandafter\let\expandafter\itfont\csname #1it\endcsname + \expandafter\let\expandafter\slfont\csname #1sl\endcsname + \expandafter\let\expandafter\bffont\csname #1bf\endcsname + \expandafter\let\expandafter\ttfont\csname #1tt\endcsname + \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname + \expandafter\let\expandafter\sffont \csname #1sf\endcsname + \expandafter\let\expandafter\ifont \csname #1i\endcsname + \expandafter\let\expandafter\syfont \csname #1sy\endcsname + \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname +} + +\newif\ifrmisbold + +% Select smaller font size with the current style. Used to change font size +% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for +% normal roman text, also use bold fonts for roman text in the smaller size. +\def\switchtolllsize{% + \expandafter\assignfonts\expandafter{\lllsize}% + \ifrmisbold + \let\rmfont\bffont + \fi + \csname\curfontstyle\endcsname +}% + +\def\switchtolsize{% + \expandafter\assignfonts\expandafter{\lsize}% + \ifrmisbold + \let\rmfont\bffont + \fi + \csname\curfontstyle\endcsname +}% + +\def\definefontsetatsize#1#2#3#4#5{% +\expandafter\def\csname #1fonts\endcsname{% + \def\curfontsize{#1}% + \def\lsize{#2}\def\lllsize{#3}% + \csname rmisbold#5\endcsname + \assignfonts{#1}% + \resetmathfonts + \setleading{#4}% +}} + +\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} +\definefontsetatsize{title} {chap} {subsec} {27pt} {true} +\definefontsetatsize{chap} {sec} {text} {19pt} {true} +\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} +\definefontsetatsize{ssec} {text} {small} {15pt} {true} +\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} +\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} +\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} + +\def\titlefont#1{{\titlefonts\rm #1}} +\let\subsecfonts = \ssecfonts +\let\subsubsecfonts = \ssecfonts % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} @@ -3108,7 +3210,7 @@ end % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% - {\selectfonts\lsize #1}% + {\switchtolsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% @@ -3201,10 +3303,10 @@ end % fix it (significant additions to font machinery) until someone notices. % \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} -\def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}% +\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% % \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} -\def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}% +\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, @@ -3268,23 +3370,10 @@ end \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. -% Unless we're in typewriter, use \ecfont because the CM text fonts do -% not have braces, and we don't want to switch into math. -\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} -\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} -\let\{=\mylbrace \let\lbracechar=\{ -\let\}=\myrbrace \let\rbracechar=\} -\begingroup - % Definitions to produce \{ and \} commands for indices, - % and @{ and @} for the aux/toc files. - \catcode`\{ = \other \catcode`\} = \other - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\! = 0 \catcode`\\ = \other - !gdef!lbracecmd[\{]% - !gdef!rbracecmd[\}]% - !gdef!lbraceatcmd[@{]% - !gdef!rbraceatcmd[@}]% -!endgroup +\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} +\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} +\let\{=\lbracechar +\let\}=\rbracechar % @comma{} to avoid , parsing problems. \let\comma = , @@ -3302,8 +3391,8 @@ end % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} -\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} -\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} +\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} @@ -3332,12 +3421,12 @@ end {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt - % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. - \selectfonts\lllsize A% + \switchtolllsize A% \fi }% \vss @@ -3403,7 +3492,7 @@ end % \newbox\errorbox % -{\tentt \global\dimen0 = 3em}% Width of the box. +{\ttfont \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} @@ -3554,7 +3643,7 @@ end % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% - $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% \hfil\crcr\Orb}}% }$% } @@ -3648,12 +3737,11 @@ end % Settings used for typesetting titles: no hyphenation, no indentation, % don't worry much about spacing, ragged right. This should be used -% inside a \vbox, and fonts need to be set appropriately first. Because -% it is always used for titles, nothing else, we call \rmisbold. \par -% should be specified before the end of the \vbox, since a vbox is a group. +% inside a \vbox, and fonts need to be set appropriately first. \par should +% be specified before the end of the \vbox, since a vbox is a group. % \def\raggedtitlesettings{% - \rmisbold + \rm \hyphenpenalty=10000 \parindent=0pt \tolerance=5000 @@ -3662,7 +3750,7 @@ end % Macros to be used within @titlepage: -\let\subtitlerm=\tenrm +\let\subtitlerm=\rmfont \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% @@ -3688,7 +3776,7 @@ end \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi - {\secfonts\rmisbold \leftline{#1}}% + {\secfonts\rm \leftline{#1}}% \fi } @@ -4603,6 +4691,31 @@ end \fi } +% Like \expandablevalue, but completely expandable (the \message in the +% definition above operates at the execution level of TeX). Used when +% writing to auxiliary files, due to the expansion that \write does. +% If flag is undefined, pass through an unexpanded @value command: maybe it +% will be set by the time it is read back in. +% +% NB flag names containing - or _ may not work here. +\def\dummyvalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + \noexpand\value{#1}% + \else + \csname SET#1\endcsname + \fi +} + +% Used for @value's in index entries to form the sort key: expand the @value +% if possible, otherwise sort late. +\def\indexnofontsvalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + ZZZZZZZ + \else + \csname SET#1\endcsname + \fi +} + % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % @@ -4727,14 +4840,7 @@ end % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% - % Only do \closeout if we haven't already done it, else we'll end up - % closing the target index. - \expandafter \ifx\csname donesynindex#2\endcsname \relax - % The \closeout helps reduce unnecessary open files; the limit on the - % Acorn RISC OS is a mere 16 files. - \expandafter\closeout\csname#2indfile\endcsname - \expandafter\let\csname donesynindex#2\endcsname = 1 - \fi + \requireopenindexfile{#3}% % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp @@ -4744,7 +4850,7 @@ end % Define \doindex, the driver for all index macros. % Argument #1 is generated by the calling \fooindex macro, -% and it the two-letter name of the index. +% and it is the two-letter name of the index. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} \def\doindexxxx #1{\doind{\indexname}{#1}} @@ -4753,63 +4859,61 @@ end \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} -% Used when writing an index entry out to an index file, to prevent + +% Used when writing an index entry out to an index file to prevent % expansion of Texinfo commands that can appear in an index entry. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. - \def\@{@}% change to @@ when we switch to @ as escape char in index files. - \def\ {\realbackslash\space }% - % - % Need these unexpandable (because we define \tt as a dummy) - % definitions when @{ or @} appear in index entry text. Also, more - % complicated, when \tex is in effect and \{ is a \delimiter again. - % We can't use \lbracecmd and \rbracecmd because texindex assumes - % braces and backslashes are used only as delimiters. Perhaps we - % should use @lbracechar and @rbracechar? - \def\{{{\tt\char123}}% - \def\}{{\tt\char125}}% + \definedummyletter\@% + \definedummyletter\ % + % + % For texindex which always views { and } as separators. + \def\{{\lbracechar{}}% + \def\}{\rbracechar{}}% % % Do the redefinitions. - \commondummies + \definedummies } -% For the aux and toc files, @ is the escape character. So we want to -% redefine everything using @ as the escape character (instead of -% \realbackslash, still used for index files). When everything uses @, -% this will be simpler. +% Used for the aux and toc files, where @ is the escape character. % \def\atdummies{% - \def\@{@@}% - \def\ {@ }% - \let\{ = \lbraceatcmd - \let\} = \rbraceatcmd + \definedummyletter\@% + \definedummyletter\ % + \definedummyletter\{% + \definedummyletter\}% % % Do the redefinitions. - \commondummies + \definedummies \otherbackslash } -% Called from \indexdummies and \atdummies. +% \definedummyword defines \#1 as \string\#1\space, thus effectively +% preventing its expansion. This is used only for control words, +% not control letters, because the \space would be incorrect for +% control characters, but is needed to separate the control word +% from whatever follows. % -\def\commondummies{% - % \definedummyword defines \#1 as \string\#1\space, thus effectively - % preventing its expansion. This is used only for control words, - % not control letters, because the \space would be incorrect for - % control characters, but is needed to separate the control word - % from whatever follows. - % - % For control letters, we have \definedummyletter, which omits the - % space. - % - % These can be used both for control words that take an argument and - % those that do not. If it is followed by {arg} in the input, then - % that will dutifully get written to the index (or wherever). - % - \def\definedummyword ##1{\def##1{\string##1\space}}% - \def\definedummyletter##1{\def##1{\string##1}}% - \let\definedummyaccent\definedummyletter +% These can be used both for control words that take an argument and +% those that do not. If it is followed by {arg} in the input, then +% that will dutifully get written to the index (or wherever). +% +% For control letters, we have \definedummyletter, which omits the +% space. +% +\def\definedummyword #1{\def#1{\string#1\space}}% +\def\definedummyletter#1{\def#1{\string#1}}% +\let\definedummyaccent\definedummyletter + +% Called from \indexdummies and \atdummies, to effectively prevent +% the expansion of commands. +% +\def\definedummies{% % + \let\commondummyword\definedummyword + \let\commondummyletter\definedummyletter + \let\commondummyaccent\definedummyaccent \commondummiesnofonts % \definedummyletter\_% @@ -4850,6 +4954,7 @@ end \definedummyword\TeX % % Assorted special characters. + \definedummyword\atchar \definedummyword\arrow \definedummyword\bullet \definedummyword\comma @@ -4889,85 +4994,82 @@ end % % We want to disable all macros so that they are not expanded by \write. \macrolist + \let\value\dummyvalue % \normalturnoffactive - % - % Handle some cases of @value -- where it does not contain any - % (non-fully-expandable) commands. - \makevalueexpandable } -% \commondummiesnofonts: common to \commondummies and \indexnofonts. -% Define \definedumyletter, \definedummyaccent and \definedummyword before -% using. +% \commondummiesnofonts: common to \definedummies and \indexnofonts. +% Define \commondummyletter, \commondummyaccent and \commondummyword before +% using. Used for accents, font commands, and various control letters. % \def\commondummiesnofonts{% % Control letters and accents. - \definedummyletter\!% - \definedummyaccent\"% - \definedummyaccent\'% - \definedummyletter\*% - \definedummyaccent\,% - \definedummyletter\.% - \definedummyletter\/% - \definedummyletter\:% - \definedummyaccent\=% - \definedummyletter\?% - \definedummyaccent\^% - \definedummyaccent\`% - \definedummyaccent\~% - \definedummyword\u - \definedummyword\v - \definedummyword\H - \definedummyword\dotaccent - \definedummyword\ogonek - \definedummyword\ringaccent - \definedummyword\tieaccent - \definedummyword\ubaraccent - \definedummyword\udotaccent - \definedummyword\dotless + \commondummyletter\!% + \commondummyaccent\"% + \commondummyaccent\'% + \commondummyletter\*% + \commondummyaccent\,% + \commondummyletter\.% + \commondummyletter\/% + \commondummyletter\:% + \commondummyaccent\=% + \commondummyletter\?% + \commondummyaccent\^% + \commondummyaccent\`% + \commondummyaccent\~% + \commondummyword\u + \commondummyword\v + \commondummyword\H + \commondummyword\dotaccent + \commondummyword\ogonek + \commondummyword\ringaccent + \commondummyword\tieaccent + \commondummyword\ubaraccent + \commondummyword\udotaccent + \commondummyword\dotless % % Texinfo font commands. - \definedummyword\b - \definedummyword\i - \definedummyword\r - \definedummyword\sansserif - \definedummyword\sc - \definedummyword\slanted - \definedummyword\t + \commondummyword\b + \commondummyword\i + \commondummyword\r + \commondummyword\sansserif + \commondummyword\sc + \commondummyword\slanted + \commondummyword\t % % Commands that take arguments. - \definedummyword\abbr - \definedummyword\acronym - \definedummyword\anchor - \definedummyword\cite - \definedummyword\code - \definedummyword\command - \definedummyword\dfn - \definedummyword\dmn - \definedummyword\email - \definedummyword\emph - \definedummyword\env - \definedummyword\file - \definedummyword\image - \definedummyword\indicateurl - \definedummyword\inforef - \definedummyword\kbd - \definedummyword\key - \definedummyword\math - \definedummyword\option - \definedummyword\pxref - \definedummyword\ref - \definedummyword\samp - \definedummyword\strong - \definedummyword\tie - \definedummyword\U - \definedummyword\uref - \definedummyword\url - \definedummyword\var - \definedummyword\verb - \definedummyword\w - \definedummyword\xref + \commondummyword\abbr + \commondummyword\acronym + \commondummyword\anchor + \commondummyword\cite + \commondummyword\code + \commondummyword\command + \commondummyword\dfn + \commondummyword\dmn + \commondummyword\email + \commondummyword\emph + \commondummyword\env + \commondummyword\file + \commondummyword\image + \commondummyword\indicateurl + \commondummyword\inforef + \commondummyword\kbd + \commondummyword\key + \commondummyword\math + \commondummyword\option + \commondummyword\pxref + \commondummyword\ref + \commondummyword\samp + \commondummyword\strong + \commondummyword\tie + \commondummyword\U + \commondummyword\uref + \commondummyword\url + \commondummyword\var + \commondummyword\verb + \commondummyword\w + \commondummyword\xref } % For testing: output @{ and @} in index sort strings as \{ and \}. @@ -5023,11 +5125,11 @@ end % \def\indexnofonts{% % Accent commands should become @asis. - \def\definedummyaccent##1{\let##1\asis}% + \def\commondummyaccent##1{\let##1\asis}% % We can just ignore other control letters. - \def\definedummyletter##1{\let##1\empty}% + \def\commondummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. - \let\definedummyword\definedummyaccent + \let\commondummyword\commondummyaccent \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command @@ -5069,37 +5171,40 @@ end \def\LaTeX{LaTeX}% \def\TeX{TeX}% % - % Assorted special characters. - % (The following {} will end up in the sort string, but that's ok.) - \def\arrow{->}% - \def\bullet{bullet}% - \def\comma{,}% - \def\copyright{copyright}% - \def\dots{...}% - \def\enddots{...}% - \def\equiv{==}% - \def\error{error}% - \def\euro{euro}% - \def\expansion{==>}% - \def\geq{>=}% - \def\guillemetleft{<<}% - \def\guillemetright{>>}% - \def\guilsinglleft{<}% - \def\guilsinglright{>}% - \def\leq{<=}% - \def\minus{-}% - \def\point{.}% - \def\pounds{pounds}% - \def\print{-|}% - \def\quotedblbase{"}% - \def\quotedblleft{"}% - \def\quotedblright{"}% - \def\quoteleft{`}% - \def\quoteright{'}% - \def\quotesinglbase{,}% - \def\registeredsymbol{R}% - \def\result{=>}% - \def\textdegree{o}% + % Assorted special characters. \defglyph gives the control sequence a + % definition that removes the {} that follows its use. + \defglyph\atchar{@}% + \defglyph\arrow{->}% + \defglyph\bullet{bullet}% + \defglyph\comma{,}% + \defglyph\copyright{copyright}% + \defglyph\dots{...}% + \defglyph\enddots{...}% + \defglyph\equiv{==}% + \defglyph\error{error}% + \defglyph\euro{euro}% + \defglyph\expansion{==>}% + \defglyph\geq{>=}% + \defglyph\guillemetleft{<<}% + \defglyph\guillemetright{>>}% + \defglyph\guilsinglleft{<}% + \defglyph\guilsinglright{>}% + \defglyph\leq{<=}% + \defglyph\lbracechar{\{}% + \defglyph\minus{-}% + \defglyph\point{.}% + \defglyph\pounds{pounds}% + \defglyph\print{-|}% + \defglyph\quotedblbase{"}% + \defglyph\quotedblleft{"}% + \defglyph\quotedblright{"}% + \defglyph\quoteleft{`}% + \defglyph\quoteright{'}% + \defglyph\quotesinglbase{,}% + \defglyph\rbracechar{\}}% + \defglyph\registeredsymbol{R}% + \defglyph\result{=>}% + \defglyph\textdegree{o}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. @@ -5112,7 +5217,11 @@ end % goes to end-of-line is not handled. % \macrolist + \let\value\indexnofontsvalue } +\def\defglyph#1#2{\def#1##1{#2}} % see above + + \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -5159,9 +5268,10 @@ end \ifx\suffix\indexisfl\def\suffix{f1}\fi % Open the file \immediate\openout\csname#1indfile\endcsname \jobname.\suffix - % Using \immediate here prevents an object entering into the current box, - % which could confound checks such as those in \safewhatsit for preceding - % skips. + % Using \immediate above here prevents an object entering into the current + % box, which could confound checks such as those in \safewhatsit for + % preceding skips. + \typeout{Writing index file \jobname.\suffix}% \fi} \def\indexisfl{fl} @@ -5359,7 +5469,7 @@ end % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). - \catcode`\@ = 11 + \catcode`\@ = 12 % See comment in \requireopenindexfile. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi \openin 1 \jobname.\indexname s @@ -5369,6 +5479,7 @@ end % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent + \typeout{No file \jobname.\indexname s.}% \else \catcode`\\ = 0 % @@ -5386,7 +5497,7 @@ end \let\indexlbrace\{ % Likewise, set these sequences for braces \let\indexrbrace\} % used in the sort key. \begindoublecolumns - \let\entryorphanpenalty=\indexorphanpenalty + \let\entrywidowpenalty=\indexwidowpenalty % % Read input from the index file line by line. \loopdo @@ -5487,6 +5598,12 @@ end \def\entry{% \begingroup % + % For pdfTeX and XeTeX. + % The redefinition 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. + \let\domark\relax + % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par @@ -5500,10 +5617,6 @@ end \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% An undocumented command % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus0.5pt - % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = @@ -5537,20 +5650,13 @@ end % \ifpdf \pdfgettoks#1.% - \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. + \hskip\skip\thinshrinkable\the\toksA \else \ifx\XeTeXrevision\thisisundefined \hskip\skip\thinshrinkable #1% \else \pdfgettoks#1.% - \bgroup\let\domark\relax - \hskip\skip\thinshrinkable\the\toksA - \egroup + \hskip\skip\thinshrinkable\the\toksA \fi \fi \fi @@ -5559,11 +5665,10 @@ end \global\setbox\entryindexbox=\vbox{\unhbox\boxA}% \else \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. % + \parindent = 0pt \advance\leftskip by 0pt plus 1fil \advance\leftskip by 0pt plus -1fill \rightskip = 0pt plus -1fil @@ -5572,8 +5677,6 @@ end % if the list of page numbers is long, to be aligned to the right. \parfillskip=0pt plus -1fill % - \hangindent=1em - % \advance\rightskip by \entryrightmargin % Determine how far we can stretch into the margin. % This allows, e.g., "Appendix H GNU Free Documentation License" to @@ -5593,17 +5696,21 @@ end \ifdim\dimen@ > 0.8\dimen@ii % due to long index text \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly \dimen@ii = \hsize - \advance \dimen@ii by -1em \ifnum\dimen@>\dimen@ii % If the entry is too long, use the whole line \dimen@ = \dimen@ii \fi \advance\leftskip by 0pt plus 1fill % ragged right \advance \dimen@ by 1\rightskip - \parshape = 2 0pt \dimen@ 1em \dimen@ii - % Ideally we'd add a finite glue at the end of the first line only, but - % TeX doesn't seem to provide a way to do such a thing. + \parshape = 2 0pt \dimen@ 0em \dimen@ii + % Ideally we'd add a finite glue at the end of the first line only, + % instead of using \parshape with explicit line lengths, but TeX + % doesn't seem to provide a way to do such a thing. + % + \leftskip = 1em + \parindent = -1em \fi\fi + \indent % start paragraph \unhbox\boxA % % Do not prefer a separate line ending with a hyphen to fewer lines. @@ -5621,7 +5728,7 @@ end \endgroup % delay text of entry until after penalty \bgroup\aftergroup\insertindexentrybox - \entryorphanpenalty + \entrywidowpenalty }} \newskip\thinshrinkable @@ -5629,40 +5736,43 @@ end \newbox\entryindexbox \def\insertindexentrybox{% - \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 + \ourunvbox\entryindexbox +} + +% Use \lastbox to take apart vbox box by box, and add each sub-box +% to the current vertical list. +\def\ourunvbox#1{% +\bgroup % for local binding of \delayedbox + % Remove the last box from box #1 + \global\setbox#1=\vbox{% + \unvbox#1% + \unskip % remove any glue + \unpenalty + \global\setbox\interbox=\lastbox }% - % 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. + \setbox\delayedbox=\box\interbox + \ifdim\ht#1=0pt\else + \ourunvbox#1 % Repeat on what's left of the box + \nobreak + \fi + \box\delayedbox +\egroup } -\newdimen\entrylinedepth +\newbox\delayedbox +\newbox\interbox % Default is no penalty -\let\entryorphanpenalty\egroup +\let\entrywidowpenalty\egroup % Used from \printindex. \firsttoken should be the first token % after the \entry. If it's not another \entry, we are at the last % line of a group of index entries, so insert a penalty to discourage -% orphaned index entries. -\long\def\indexorphanpenalty{% +% widowed index entries. +\long\def\indexwidowpenalty{% \def\isentry{\entry}% \ifx\firsttoken\isentry \else - \unskip\penalty 9000 - % The \unskip here stops breaking before the glue. It relies on the - % \vskip above being there, otherwise there is an error - % "You can't use `\unskip' in vertical mode". There has to be glue - % in the current vertical list that hasn't been added to the - % "current page". See Chapter 24 of the TeXbook. This contradicts - % Section 8.3.7 in "TeX by Topic," though. + \penalty 9000 \fi \egroup % now comes the box added with \aftergroup } @@ -5702,8 +5812,6 @@ end \newbox\partialpage \newdimen\doublecolumnhsize -\newdimen\doublecolumntopgap -\doublecolumntopgap = 0pt % Use inside an output routine to save \topmark and \firstmark \def\savemarks{% @@ -5786,12 +5894,10 @@ end % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) - \global\doublecolumntopgap = \topskip - \global\advance\doublecolumntopgap by -1\baselineskip - \advance\vsize by -1\doublecolumntopgap \vsize = 2\vsize - \topskip=0pt - \global\entrylinedepth=0pt\relax + % + % For the benefit of balancing columns + \advance\baselineskip by 0pt plus 0.5pt } % The double-column output routine for all double-column pages except @@ -5821,9 +5927,7 @@ end % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize - \vbox{% - \vskip\doublecolumntopgap - \hbox to\txipagewidth{\box0\hfil\box2}}% + \hbox to\txipagewidth{\box0\hfil\box2}% } @@ -5890,38 +5994,45 @@ end \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip - \ifdim\dimen@<14\baselineskip + \ifdim\dimen@<5\baselineskip % Don't split a short final column in two. \setbox2=\vbox{}% \else \divide\dimen@ by 2 % target to split to \dimen@ii = \dimen@ \splittopskip = \topskip - % Loop until the second column is no higher than the first + % Loop until left column is at least as high as the right column. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ - % Remove glue from bottom of first column to - % make sure it is higher than the second. - \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}% - \ifdim\ht3>\ht1 + \ifdim\ht1<\ht3 \global\advance\dimen@ by 1pt \repeat }% - \multiply\dimen@ii by 4 - \divide\dimen@ii by 5 - \ifdim\ht3<\dimen@ii - % Column heights are too different, so don't make their bottoms - % flush with each other. The glue at the end of the second column - % allows a second column to stretch, reducing the difference in - % height between the two. - \setbox0=\vbox to\dimen@{\unvbox1\vfill}% - \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}% + % Now the left column is in box 1, and the right column in box 3. + % Check whether the left column has come out higher than the page itself. + % (Note that we have doubled \vsize for the double columns, so + % the actual height of the page is 0.5\vsize). + \ifdim2\ht1>\vsize + % Just split the last of the double column material roughly in half. + \setbox2=\box0 + \setbox0 = \vsplit2 to \dimen@ii + \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}% + \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}% \else - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% + % Compare the heights of the two columns. + \ifdim4\ht1>5\ht3 + % Column heights are too different, so don't make their bottoms + % flush with each other. + \setbox2=\vbox to \ht1 {\unvbox3\vfill}% + \setbox0=\vbox to \ht1 {\unvbox1\vfill}% + \else + % Make column bottoms flush with each other. + \setbox2=\vbox to\ht1{\unvbox3\unskip}% + \setbox0=\vbox to\ht1{\unvbox1\unskip}% + \fi \fi \fi % @@ -5940,7 +6051,7 @@ end \null \vskip.3\vsize % move it down on the page a bit \begingroup - \noindent \titlefonts\rmisbold #1\par % the text + \noindent \titlefonts\rm #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page @@ -6426,7 +6537,7 @@ end \domark % {% - \chapfonts \rmisbold + \chapfonts \rm \let\footnote=\errfootnoteheading % give better error message % % Have to define \lastsection before calling \donoderef, because the @@ -6518,7 +6629,7 @@ end \let\footnote=\errfootnoteheading % % Switch to the right set of fonts. - \csname #2fonts\endcsname \rmisbold + \csname #2fonts\endcsname \rm % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs @@ -6682,7 +6793,14 @@ end % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. - \ifpdf \global\pdfmakepagedesttrue \fi + \ifpdf + \global\pdfmakepagedesttrue + \else + \ifx\XeTeXrevision\thisisundefined + \else + \global\pdfmakepagedesttrue + \fi + \fi } @@ -7784,7 +7902,7 @@ end \fi % no return type #3% output function name }% - {\rm\enskip}% hskip 0.5 em of \tenrm + {\rm\enskip}% hskip 0.5 em of \rmfont % \boldbrax % arguments will be output next, if any. @@ -7963,7 +8081,7 @@ end \newif\ifrecursive % Is it recursive? % List of all defined macros in the form -% \definedummyword\macro1\definedummyword\macro2... +% \commondummyword\macro1\commondummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} @@ -7971,7 +8089,7 @@ end % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% - \toks0 = \expandafter{\macrolist\definedummyword#1}% + \toks0 = \expandafter{\macrolist\commondummyword#1}% \xdef\macrolist{\the\toks0}% } @@ -8112,7 +8230,7 @@ end % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax - \let\definedummyword\unmacrodo + \let\commondummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else @@ -8127,7 +8245,7 @@ end \ifx #1\relax % remove this \else - \noexpand\definedummyword \noexpand#1% + \noexpand\commondummyword \noexpand#1% \fi } @@ -8402,8 +8520,7 @@ end % its parameters, looking like "\xeatspaces{\hash 1}". % \paramno is the number of parameters % \paramlist is a TeX parameter text, e.g. "#1,#2,#3," -% There are eight cases: recursive and nonrecursive macros of zero, one, -% up to nine, and many arguments. +% There are four cases: macros of zero, one, up to nine, and many arguments. % \xdef is used so that macro definitions will survive the file % they're defined in: @include reads the file inside a group. % @@ -8418,91 +8535,48 @@ end \else \let\xeatspaces\relax % suppress expansion \fi - \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\macrobody}}% - \or % 1 + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\macrobody}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname @@@\endcsname}% + \expandafter\xdef\csname\the\macname @@@\endcsname##1{% + \egroup + \noexpand\scanmacro{\macrobody}% + }% + \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\braceorline - \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{% + \noexpand\passargtomacro + \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% \expandafter\xdef\csname\the\macname @@@\endcsname##1{% - \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\expandafter - \noexpand\macroargctxt - \noexpand\expandafter - \expandafter\noexpand\csname\the\macname @@\endcsname}% - \expandafter\xdef\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}}% - \else % 10 or more - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\getargvals@{\the\macname}{\argl}% - }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody - \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble - \fi - \fi - \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%% - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\macrobody}}% - \or % 1 + \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname @@@@\endcsname\paramlist{% + \egroup\noexpand\scanmacro{\macrobody}}% + \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname @@@\endcsname}% - \expandafter\xdef\csname\the\macname @@@\endcsname##1{% - \egroup - \noexpand\scanmacro{\macrobody}% - }% - \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\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{% - \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}}% - \else % 10 or more: - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\getargvals@{\the\macname}{\argl}% - }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody - \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse - \fi + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi} @@ -8698,6 +8772,8 @@ end {% \requireauxfile \atdummies % preserve commands, but don't expand them + % match definition in \xrdef, \refx, \xrefX. + \def\value##1{##1}% \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef @@ -8790,8 +8866,8 @@ end \ifpdf % For pdfTeX and LuaTeX {\indexnofonts - \turnoffactive \makevalueexpandable + \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. @@ -8799,19 +8875,18 @@ end % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. - \edef\pdfxrefdest{#1}% - \ifx\pdfxrefdest\empty - \def\pdfxrefdest{Top}% no empty targets - \else - \txiescapepdf\pdfxrefdest % escape PDF special chars + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 - goto file{\the\filename.pdf} name{\pdfxrefdest}% + goto file{\the\filename.pdf} name{\pdfdestname}% \else - goto name{\pdfmkpgn{\pdfxrefdest}}% + goto name{\pdfmkpgn{\pdfdestname}}% \fi }% \setcolor{\linkcolor}% @@ -8820,8 +8895,8 @@ end \else % For XeTeX {\indexnofonts - \turnoffactive \makevalueexpandable + \turnoffactive % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. @@ -8829,29 +8904,27 @@ end % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. - \iftxiuseunicodedestname - \def\pdfxrefdest{#1}% Pass through Unicode characters. - \else - \edef\pdfxrefdest{#1}% Replace Unicode characters to ASCII. - \fi - \ifx\pdfxrefdest\empty - \def\pdfxrefdest{Top}% no empty targets - \else - \txiescapepdf\pdfxrefdest % escape PDF special chars + \setpdfdestname{#1}% + % + \ifx\pdfdestname\empty + \def\pdfdestname{Top}% no empty targets \fi % \leavevmode \ifnum\filenamelength>0 - % By the default settings, + % With default settings, % XeTeX (xdvipdfmx) replaces link destination names with integers. % In this case, the replaced destination names of - % remote PDF cannot be known. In order to avoid replacement, - % you can use commandline option `-C 0x0010' for xdvipdfmx. + % remote PDFs are no longer known. In order to avoid a replacement, + % you can use xdvipdfmx's command line option `-C 0x0010'. + % If you use XeTeX 0.99996+ (TeX Live 2016+), + % this command line option is no longer necessary + % because we can use the `dvipdfmx:config' special. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A - << /S /GoToR /F (\the\filename.pdf) /D (name\pdfxrefdest) >> >>}% + << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% \else \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A - << /S /GoTo /D (name\pdfxrefdest) >> >>}% + << /S /GoTo /D (\pdfdestname) >> >>}% \fi }% \setcolor{\linkcolor}% @@ -8862,6 +8935,7 @@ end % include an _ in the xref name, etc. \indexnofonts \turnoffactive + \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% @@ -9002,14 +9076,14 @@ end \fi\fi\fi } -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. -% +% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX +% is output afterwards if non-empty. \def\refx#1#2{% \requireauxfile {% \indexnofonts \otherbackslash + \def\value##1{##1}% \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% @@ -9034,16 +9108,18 @@ end #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. Usually it's -% just a \def (we prepend XR to the control sequence name to avoid -% collisions). But if this is a float type, we have more work to do. +% This is the macro invoked by entries in the aux file. Define a control +% sequence for a cross-reference target (we prepend XR to the control sequence +% name to avoid collisions). The value is the page number. If this is a float +% type, we have more work to do. % \def\xrdef#1#2{% - {% The node name might contain 8-bit characters, which in our current - % implementation are changed to commands like @'e. Don't let these - % mess up the control sequence name. + {% Expand the node or anchor name to remove control sequences. + % \turnoffactive stops 8-bit characters being changed to commands + % like @'e. \refx does the same to retrieve the value in the definition. \indexnofonts \turnoffactive + \def\value##1{##1}% \xdef\safexrefname{#1}% }% % @@ -9755,9 +9831,9 @@ directory should work if nowhere else does.} \global\righthyphenmin = #3\relax } -% XeTeX and LuaTeX can handle native Unicode. -% Their default I/O is UTF-8 sequence instead of byte-wise. -% Other TeX engine (pdfTeX etc.) I/O is byte-wise. +% XeTeX and LuaTeX can handle Unicode natively. +% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. +% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. % \newif\iftxinativeunicodecapable \newif\iftxiusebytewiseio @@ -9881,14 +9957,15 @@ directory should work if nowhere else does.} % \else \ifx \declaredencoding \utfeight \iftxinativeunicodecapable - % For native Unicode (XeTeX and LuaTeX) + % For native Unicode handling (XeTeX and LuaTeX) \nativeunicodechardefs \else - % For UTF-8 byte sequence (TeX, eTeX and pdfTeX) + % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) \setnonasciicharscatcode\active % since we already invoked \utfeightchardefs at the top level - % (below), do not re-invoke it, then our check for duplicated - % definitions triggers. Making non-ascii chars active is enough. + % (below), do not re-invoke it, otherwise our check for duplicated + % definitions gets triggered. Making non-ascii chars active is + % sufficient. \fi % \else @@ -9899,6 +9976,18 @@ directory should work if nowhere else does.} \fi % latone \fi % lattwo \fi % ascii + % + \ifx\XeTeXrevision\thisisundefined + \else + \ifx \declaredencoding \utfeight + \else + \ifx \declaredencoding \ascii + \else + \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % + non-ASCII characters in auxiliary files.}% + \fi + \fi + \fi } % emacs-page @@ -9930,18 +10019,18 @@ directory should work if nowhere else does.} \gdefchar^^a0{\tie} \gdefchar^^a1{\exclamdown} \gdefchar^^a2{{\tcfont \char162}} % cent - \gdefchar^^a3{\pounds} + \gdefchar^^a3{\pounds{}} \gdefchar^^a4{{\tcfont \char164}} % currency \gdefchar^^a5{{\tcfont \char165}} % yen \gdefchar^^a6{{\tcfont \char166}} % broken bar \gdefchar^^a7{\S} \gdefchar^^a8{\"{}} - \gdefchar^^a9{\copyright} + \gdefchar^^a9{\copyright{}} \gdefchar^^aa{\ordf} - \gdefchar^^ab{\guillemetleft} + \gdefchar^^ab{\guillemetleft{}} \gdefchar^^ac{\ensuremath\lnot} \gdefchar^^ad{\-} - \gdefchar^^ae{\registeredsymbol} + \gdefchar^^ae{\registeredsymbol{}} \gdefchar^^af{\={}} % \gdefchar^^b0{\textdegree} @@ -9955,7 +10044,7 @@ directory should work if nowhere else does.} \gdefchar^^b8{\cedilla\ } \gdefchar^^b9{$^1$} \gdefchar^^ba{\ordm} - \gdefchar^^bb{\guillemetright} + \gdefchar^^bb{\guillemetright{}} \gdefchar^^bc{$1\over4$} \gdefchar^^bd{$1\over2$} \gdefchar^^be{$3\over4$} @@ -10035,7 +10124,7 @@ directory should work if nowhere else does.} % Encoding is almost identical to Latin1. \latonechardefs % - \gdefchar^^a4{\euro} + \gdefchar^^a4{\euro{}} \gdefchar^^a6{\v S} \gdefchar^^a8{\v s} \gdefchar^^b4{\v Z} @@ -10064,7 +10153,7 @@ directory should work if nowhere else does.} \gdefchar^^ae{\v Z} \gdefchar^^af{\dotaccent Z} % - \gdefchar^^b0{\textdegree} + \gdefchar^^b0{\textdegree{}} \gdefchar^^b1{\ogonek{a}} \gdefchar^^b2{\ogonek{ }} \gdefchar^^b3{\l} @@ -10200,7 +10289,7 @@ directory should work if nowhere else does.} \countUTFx = "80 \countUTFy = "C2 \def\UTFviiiTmp{% - \gdef~{ + \gdef~{% \ifpassthroughchars $\fi}}% \UTFviiiLoop @@ -10236,8 +10325,9 @@ directory should work if nowhere else does.} \def\U#1{% \expandafter\ifx\csname uni:#1\endcsname \relax \iftxinativeunicodecapable - % Any Unicode characters can be used by native Unicode. - % However, if the font does not have the glyph, the letter will miss. + % All Unicode characters can be used if native Unicode handling is + % active. However, if the font does not have the glyph, + % letters are missing. \begingroup \uccode`\.="#1\relax \uppercase{.} @@ -10251,9 +10341,18 @@ directory should work if nowhere else does.} \fi } -% For UTF-8 byte sequence (TeX, e-TeX and pdfTeX) -% Definition macro to replace the Unicode character -% Definition macro that is used by @U command +% These macros are used here to construct the name of a control +% sequence to be defined. +\def\UTFviiiTwoOctetsName#1#2{% + \csname u8:#1\string #2\endcsname}% +\def\UTFviiiThreeOctetsName#1#2#3{% + \csname u8:#1\string #2\string #3\endcsname}% +\def\UTFviiiFourOctetsName#1#2#3#4{% + \csname u8:#1\string #2\string #3\string #4\endcsname}% + +% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), +% provide a definition macro to replace a Unicode character; +% this gets used by the @U command % \begingroup \catcode`\"=12 @@ -10267,17 +10366,18 @@ directory should work if nowhere else does.} \countUTFz = "#1\relax \begingroup \parseXMLCharref + + % Give \u8:... its definition. The sequence of seven \expandafter's + % expands after the \gdef three times, e.g. % - % Access definitions of characters given UTF-8 sequences - \def\UTFviiiTwoOctets##1##2{% - \csname u8:##1\string ##2\endcsname}% - \def\UTFviiiThreeOctets##1##2##3{% - \csname u8:##1\string ##2\string ##3\endcsname}% - \def\UTFviiiFourOctets##1##2##3##4{% - \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% - \expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter - \gdef\UTFviiiTmp{#2}% + % 1. \UTFviiTwoOctetsName B1 B2 + % 2. \csname u8:B1 \string B2 \endcsname + % 3. \u8: B1 B2 (a single control sequence token) + % + \expandafter\expandafter + \expandafter\expandafter + \expandafter\expandafter + \expandafter\gdef \UTFviiiTmp{#2}% % \expandafter\ifx\csname uni:#1\endcsname \relax \else \message{Internal error, already defined: #1}% @@ -10287,45 +10387,61 @@ directory should work if nowhere else does.} \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp \endgroup} % - % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp. + % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp + % to the corresponding UTF-8 sequence. \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% - \parseUTFviiiB C\UTFviiiTwoOctets.,% + \parseUTFviiiB C\UTFviiiTwoOctetsName.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% - \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% - \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% \fi\fi\fi } + % Extract a byte from the end of the UTF-8 representation of \countUTFx. + % It must be a non-initial byte in the sequence. + % Change \uccode of #1 for it to be used in \parseUTFviiiB as one + % of the bytes. \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 - \countUTFy = \countUTFz + \countUTFy = \countUTFz % Save to be the future value of \countUTFz. \multiply\countUTFz by 64 + + % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract + % in order to get the last five bits. \advance\countUTFx by -\countUTFz + + % Convert this to the byte in the UTF-8 sequence. \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} - % Used to set \UTFviiiTmp to a UTF-8 byte sequence + % Used to put a UTF-8 byte sequence into \UTFviiiTmp + % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 + % sequence. + % #2 is one of the \UTFviii*OctetsName macros. + % #3 is always a full stop (.) + % #4 is a template for the other bytes in the sequence. The values for these + % bytes is substituted in here with \uppercase using the \uccode's. \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup -% For native Unicode (XeTeX and LuaTeX) -% Definition macro that is set catcode other non global +% For native Unicode handling (XeTeX and LuaTeX), +% provide a definition macro that sets a catcode to `other' non-globally % \def\DeclareUnicodeCharacterNativeOther#1#2{% \catcode"#1=\other @@ -10349,18 +10465,18 @@ directory should work if nowhere else does.} \DeclareUnicodeCharacter{00A0}{\tie}% \DeclareUnicodeCharacter{00A1}{\exclamdown}% \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent - \DeclareUnicodeCharacter{00A3}{\pounds}% + \DeclareUnicodeCharacter{00A3}{\pounds{}}% \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar \DeclareUnicodeCharacter{00A7}{\S}% \DeclareUnicodeCharacter{00A8}{\"{ }}% - \DeclareUnicodeCharacter{00A9}{\copyright}% + \DeclareUnicodeCharacter{00A9}{\copyright{}}% \DeclareUnicodeCharacter{00AA}{\ordf}% - \DeclareUnicodeCharacter{00AB}{\guillemetleft}% + \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% \DeclareUnicodeCharacter{00AD}{\-}% - \DeclareUnicodeCharacter{00AE}{\registeredsymbol}% + \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% \DeclareUnicodeCharacter{00AF}{\={ }}% % \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% @@ -10374,7 +10490,7 @@ directory should work if nowhere else does.} \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% \DeclareUnicodeCharacter{00B9}{$^1$}% \DeclareUnicodeCharacter{00BA}{\ordm}% - \DeclareUnicodeCharacter{00BB}{\guillemetright}% + \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% \DeclareUnicodeCharacter{00BC}{$1\over4$}% \DeclareUnicodeCharacter{00BD}{$1\over2$}% \DeclareUnicodeCharacter{00BE}{$3\over4$}% @@ -10846,36 +10962,36 @@ directory should work if nowhere else does.} % Punctuation \DeclareUnicodeCharacter{2013}{--}% \DeclareUnicodeCharacter{2014}{---}% - \DeclareUnicodeCharacter{2018}{\quoteleft}% - \DeclareUnicodeCharacter{2019}{\quoteright}% - \DeclareUnicodeCharacter{201A}{\quotesinglbase}% - \DeclareUnicodeCharacter{201C}{\quotedblleft}% - \DeclareUnicodeCharacter{201D}{\quotedblright}% - \DeclareUnicodeCharacter{201E}{\quotedblbase}% + \DeclareUnicodeCharacter{2018}{\quoteleft{}}% + \DeclareUnicodeCharacter{2019}{\quoteright{}}% + \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% + \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% + \DeclareUnicodeCharacter{201D}{\quotedblright{}}% + \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% - \DeclareUnicodeCharacter{2022}{\bullet}% + \DeclareUnicodeCharacter{2022}{\bullet{}}% \DeclareUnicodeCharacter{202F}{\thinspace}% - \DeclareUnicodeCharacter{2026}{\dots}% - \DeclareUnicodeCharacter{2039}{\guilsinglleft}% - \DeclareUnicodeCharacter{203A}{\guilsinglright}% + \DeclareUnicodeCharacter{2026}{\dots{}}% + \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% + \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% % - \DeclareUnicodeCharacter{20AC}{\euro}% + \DeclareUnicodeCharacter{20AC}{\euro{}}% % - \DeclareUnicodeCharacter{2192}{\expansion}% - \DeclareUnicodeCharacter{21D2}{\result}% + \DeclareUnicodeCharacter{2192}{\expansion{}}% + \DeclareUnicodeCharacter{21D2}{\result{}}% % % Mathematical symbols \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% \DeclareUnicodeCharacter{2208}{\ensuremath\in}% - \DeclareUnicodeCharacter{2212}{\minus}% + \DeclareUnicodeCharacter{2212}{\minus{}}% \DeclareUnicodeCharacter{2217}{\ast}% \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% - \DeclareUnicodeCharacter{2261}{\equiv}% + \DeclareUnicodeCharacter{2261}{\equiv{}}% \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% @@ -11031,8 +11147,8 @@ directory should work if nowhere else does.} \newif\ifpassthroughchars \passthroughcharsfalse -% For native Unicode (XeTeX and LuaTeX) -% Definition macro to replace / pass-through the Unicode character +% For native Unicode handling (XeTeX and LuaTeX), +% provide a definition macro to replace/pass-through a Unicode character % \def\DeclareUnicodeCharacterNative#1#2{% \catcode"#1=\active @@ -11055,21 +11171,22 @@ directory should work if nowhere else does.} \endgroup } -% Native Unicode (XeTeX and LuaTeX) character replacing definitions -% It makes the setting that replace the Unicode characters. +% Native Unicode handling (XeTeX and LuaTeX) character replacing definition. +% It activates the setting that replaces Unicode characters. \def\nativeunicodechardefs{% \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative \unicodechardefs } -% For native Unicode (XeTeX and LuaTeX). Make the character token expand +% For native Unicode handling (XeTeX and LuaTeX), +% make the character token expand % to the sequences given in \unicodechardefs for printing. \def\DeclareUnicodeCharacterNativeAtU#1#2{% \def\UTFAtUTmp{#2} \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp } -% Native Unicode (XeTeX and LuaTeX) @U command definitions +% @U command definitions for native Unicode handling (XeTeX and LuaTeX). \def\nativeunicodechardefsatu{% \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU \unicodechardefs @@ -11080,7 +11197,7 @@ directory should work if nowhere else does.} \relax } -% define all the unicode characters we know about, for the sake of @U. +% define all Unicode characters we know about, for the sake of @U. \iftxinativeunicodecapable \nativeunicodechardefsatu \else @@ -11556,7 +11673,4 @@ directory should work if nowhere else does.} @c vim:sw=2: -@ignore - arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 -@end ignore @enablebackslashhack diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index dae514033f8..1ba22e0b594 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -12,14 +12,11 @@ @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@c Additionally, flags are set with respect to the Emacs flavor; and -@c depending whether Tramp is packaged into (X)Emacs, or standalone. - @include trampver.texi -@c Macro for formatting a file name according to the respective syntax. -@c Macro arguments should not have any leading or -@c trailing whitespace. Not very elegant, but I don't know it better. +@c Macro for formatting a file name according to the respective +@c syntax. Macro arguments should not have any leading or trailing +@c whitespace. Not very elegant, but I don't know it better. @macro trampfn {method, userhost, localname} @value{prefix}@c @@ -51,56 +48,39 @@ copy and modify this GNU manual.'' @end copying @c Entries for @command{install-info} to use -@dircategory @value{emacsname} network features +@dircategory Emacs network features @direntry * TRAMP: (tramp). Transparent Remote Access, Multiple Protocol - @value{emacsname} remote file access via ssh and scp. + Emacs remote file access via ssh and scp. @end direntry @titlepage @title @value{tramp} version @value{trampver} User Manual @author by Daniel Pittman @author based on documentation by Kai Großjohann -@page -@insertcopying @end titlepage @contents -@ifnottex @node Top, Overview, (dir), (dir) @top @value{tramp} version @value{trampver} User Manual This file documents @value{tramp} version @value{trampver}, a remote file -editing package for @value{emacsname}. +editing package for Emacs. @value{tramp} stands for ``Transparent Remote (file) Access, Multiple Protocol''. This package provides remote file editing, similar to -@value{ftppackagename}. +Ange FTP. -The difference is that @value{ftppackagename} uses FTP to transfer -files between the local and the remote host, whereas @value{tramp} uses a -combination of @command{rsh} and @command{rcp} or other work-alike -programs, such as @command{ssh}/@command{scp}. +The difference is that Ange FTP uses FTP to transfer files between the +local and the remote host, whereas @value{tramp} uses a combination of +@command{rsh} and @command{rcp} or other work-alike programs, such as +@command{ssh}/@command{scp}. You can find the latest version of this document on the web at @uref{http://www.gnu.org/software/tramp/}. -@c Pointer to the other Emacs flavor is necessary only in case of -@c standalone installation. -@ifset installchapter -The manual has been generated for @value{emacsname}. -@ifinfo -If you want to read the info pages for @value{emacsothername}, you -should read in @ref{Installation} how to create them. -@end ifinfo -@ifhtml -If you're using the other Emacs flavor, you should read the -@uref{@value{emacsotherfilename}, @value{emacsothername}} pages. -@end ifhtml -@end ifset - @ifhtml The latest release of @value{tramp} is available for @uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see @@ -115,20 +95,10 @@ There is a mailing list for @value{tramp}, available at @email{tramp-devel@@gnu.org}, and archived at @uref{http://lists.gnu.org/archive/html/tramp-devel/, the @value{tramp} Mail Archive}. -@ifhtml -Older archives are located at -@uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel, -SourceForge Mail Archive} and -@uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/, -The Mail Archive}. -@c in HTML output, there's no new paragraph. -@*@* -@end ifhtml +@page @insertcopying -@end ifnottex - @menu * Overview:: What @value{tramp} can and cannot do. @@ -137,7 +107,7 @@ For the end user: * Obtaining Tramp:: How to obtain @value{tramp}. * History:: History of @value{tramp}. @ifset installchapter -* Installation:: Installing @value{tramp} with your @value{emacsname}. +* Installation:: Installing @value{tramp} with your Emacs. @end ifset * Configuration:: Configuring @value{tramp} for use. * Usage:: An overview of the operation of @value{tramp}. @@ -150,7 +120,6 @@ For the developer: How file names, directories and localnames are mangled and managed. * Traces and Profiles:: How to Customize Traces. -* Issues:: Debatable Issues and What Was Decided. * GNU Free Documentation License:: The license for this documentation. * Function Index:: @value{tramp} functions. @@ -161,7 +130,7 @@ For the developer: --- The Detailed Node Listing --- @c @ifset installchapter -Installing @value{tramp} with your @value{emacsname} +Installing @value{tramp} with your Emacs * Installation parameters:: Parameters in order to control installation. * Load paths:: How to plug-in @value{tramp} into your environment. @@ -173,16 +142,12 @@ Configuring @value{tramp} for use * Connection types:: Types of connections to remote hosts. * Inline methods:: Inline methods. * External methods:: External methods. -@ifset emacsgvfs * GVFS based methods:: GVFS based external methods. -@end ifset -@ifset emacsgw -* Gateway methods:: Gateway methods. -@end ifset * Default Method:: Selecting a default method. * Default User:: Selecting a default user. * Default Host:: Selecting a default host. * Multi-hops:: Connecting to a remote host using multiple hops. +* Firewalls:: Passing firewalls. * Customizing Methods:: Using Non-Standard Methods. * Customizing Completion:: Selecting config files for user/host name completion. * Password handling:: Reusing passwords for several connections. @@ -200,15 +165,13 @@ Using @value{tramp} * File name Syntax:: @value{tramp} file name conventions. * File name completion:: File name completion. * Ad-hoc multi-hops:: Declaring multiple hops in the file name. -* Remote processes:: Integration with other @value{emacsname} packages. +* Remote processes:: Integration with other Emacs packages. * Cleanup remote connections:: Cleanup remote connections. How file names, directories and localnames are mangled and managed * Localname deconstruction:: Breaking a localname into its components. -@ifset emacs * External packages:: Integration with external Lisp packages. -@end ifset @end detailmenu @end menu @@ -219,10 +182,9 @@ How file names, directories and localnames are mangled and managed @cindex overview @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}. +Emacs. @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}, @@ -245,7 +207,7 @@ 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}. +benefit of direct integration of @value{tramp} in Emacs. @value{tramp} can transfer files using any number of available host programs for remote files, such as @command{rcp}, @command{scp}, @@ -279,8 +241,7 @@ first time connection to that host, here's what happens: @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. +Emacs buffer, which also shows output from the remote host. @item The remote host may prompt for a login name (for @command{telnet}, for @@ -358,7 +319,7 @@ behind the scenes when you open a file with @value{tramp}. @c For the end user @node Obtaining Tramp -@chapter Obtaining Tramp. +@chapter Obtaining @value{tramp} @cindex obtaining Tramp @value{tramp} is included as part of Emacs (since Emacs version 22.1). @@ -380,16 +341,20 @@ navigation bar at the top. Another way is to follow the terminal session below: @example -] @strong{cd ~/@value{emacsdir}} +@group +] @strong{cd ~/emacs} ] @strong{git clone git://git.savannah.gnu.org/tramp.git} +@end group @end example @noindent From behind a firewall: @example +@group ] @strong{git config --global http.proxy http://user:pwd@@proxy.server.com:8080} ] @strong{git clone http://git.savannah.gnu.org/r/tramp.git} +@end group @end example @noindent @@ -400,15 +365,17 @@ Tramp developers: @end example @noindent -After one of the above commands, @file{~/@value{emacsdir}/tramp} will +After one of the above commands, @file{~/emacs/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} +@group +] @strong{cd ~/emacs/tramp} ] @strong{git pull} +@end group @end example @noindent @@ -416,8 +383,10 @@ Run @command{autoconf} as follows to generate an up-to-date @file{configure} script: @example -] @strong{cd ~/@value{emacsdir}/tramp} +@group +] @strong{cd ~/emacs/tramp} ] @strong{autoconf} +@end group @end example @@ -436,23 +405,14 @@ 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 for gateways since April 2007. -@end ifset -@ifset emacsgvfs -GVFS integration started in February 2009. -@end ifset -@ifset emacs -Remote commands on Windows hosts since September 2011. -@end ifset -Ad-hoc multi-hop methods (with a changed syntax) re-enabled in November -2011. - -In November 2012, added Juergen Hoetzel's @file{tramp-adb.el}. - -In December 2001, XEmacs package repository adds @value{tramp}. +remote hosts was introduced in December 2005. Support for gateways +since April 2007 (and removed in December 2016). GVFS integration +started in February 2009. Remote commands on Windows hosts since +September 2011. Ad-hoc multi-hop methods (with a changed syntax) +re-enabled in November 2011. In November 2012, added Juergen +Hoetzel's @file{tramp-adb.el}. +XEmacs support has been stopped in January 2016. @c Installation chapter is necessary only in case of standalone @c installation. Text taken from trampinst.texi. @@ -469,21 +429,23 @@ In December 2001, XEmacs package repository adds @value{tramp}. @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{@trampf{user@@host,/path/to.file}}. For details, -see @xref{Default Method}. +@xref{Default Method}, @xref{Default User}, @xref{Default Host}. -For problems related to the behavior of remote shell, see @ref{Remote -shell setup} for details. +For problems related to the behavior of the remote shell, @xref{Remote +shell setup}. For changing the connection type and file access method from the -defaults to one of several other options, see (@pxref{Connection -types}). +defaults to one of several other options, @xref{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: +@strong{Note} that some user options described in these examples are +not auto loaded by Emacs. All examples require @value{tramp} is +installed and loaded: @lisp -(require 'tramp) +@group +(custom-set-variables + '(tramp-verbose 6 nil (tramp) "Enable remote command traces")) +@end group @end lisp @@ -491,12 +453,7 @@ require @value{tramp} is installed and loaded: * Connection types:: Types of connections to remote hosts. * Inline methods:: Inline methods. * External methods:: External methods. -@ifset emacsgvfs * GVFS based methods:: GVFS based external methods. -@end ifset -@ifset emacsgw -* Gateway methods:: Gateway methods. -@end ifset * Default Method:: Selecting a default method. Here we also try to help those who don't have the foggiest which method @@ -504,6 +461,7 @@ require @value{tramp} is installed and loaded: * Default User:: Selecting a default user. * Default Host:: Selecting a default host. * Multi-hops:: Connecting to a remote host using multiple hops. +* Firewalls:: Passing firewalls. * Customizing Methods:: Using Non-Standard Methods. * Customizing Completion:: Selecting config files for user/host name completion. * Password handling:: Reusing passwords for several connections. @@ -529,11 +487,6 @@ 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 - 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. @@ -561,7 +514,7 @@ 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}. +may use built-in equivalents of such programs in Emacs. Inline methods can work in situations where an external transfer program is unavailable. Inline methods also work when transferring @@ -582,8 +535,9 @@ 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. +before encoding. The user option +@option{tramp-inline-compress-start-size} specifies the file size for +such optimization. @table @asis @item @option{rsh} @@ -593,7 +547,6 @@ specifies the file size for such optimization. @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 @@ -604,7 +557,7 @@ 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. +@samp{-p 42} to the @command{ssh} command. @item @option{telnet} @cindex method telnet @@ -613,7 +566,6 @@ host name, a hash sign, then a port number). It is the same as passing Connecting to a remote host with @command{telnet} is as insecure as the @option{rsh} method. - @item @option{su} @cindex method su @cindex su method @@ -630,6 +582,22 @@ the host returned by the function @command{(system-name)}. See Similar to @option{su} method, @option{sudo} uses @command{sudo}. @command{sudo} must have sufficient rights to start a shell. +@item @option{doas} +@cindex method doas +@cindex doas method + +This method is used on OpenBSD like the @command{sudo} command. + +@item @option{sg} +@cindex method sg +@cindex sg method + +The @command{sg} program allows editing as different group. The host +can be either @samp{localhost} or the host returned by the function +@command{(system-name)}. The user name must be specified, but it +denotes a group name. See @ref{Multi-hops} for an exception to this +behavior. + @item @option{sshx} @cindex method sshx @cindex sshx method @@ -666,7 +634,6 @@ This method is also similar to @option{ssh}. It uses the This is another method from the Kerberos suite. It behaves like @option{su}. - @item @option{plink} @cindex method plink @cindex plink method @@ -680,7 +647,6 @@ session. @option{plink} method supports the @samp{-P} argument. - @item @option{plinkx} @cindex method plinkx @cindex plinkx method @@ -712,7 +678,7 @@ files smaller than @var{tramp-copy-size-limit} still use inline methods. @table @asis -@item @option{rcp}---@command{rsh} and @command{rcp} +@item @option{rcp} @cindex method rcp @cindex rcp method @cindex rcp (with rcp method) @@ -725,7 +691,7 @@ access method available. The alternative method @option{remcp} uses the @command{remsh} and @command{rcp} commands. -@item @option{scp}---@command{ssh} and @command{scp} +@item @option{scp} @cindex method scp @cindex scp method @cindex scp (with scp method) @@ -742,7 +708,7 @@ 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} +@item @option{rsync} @cindex method rsync @cindex rsync method @cindex rsync (with rsync method) @@ -757,8 +723,7 @@ is lost if the file exists only on one side of the connection. This method supports the @samp{-p} argument. - -@item @option{scpx}---@command{ssh} and @command{scp} +@item @option{scpx} @cindex method scpx @cindex scpx method @cindex scp (with scpx method) @@ -768,15 +733,14 @@ This method supports the @samp{-p} argument. in performance to @option{scp}. @option{scpx} uses @samp{ssh -t -t @var{host} -l @var{user} /bin/sh} to open a connection. -@option{sshx} is useful for Windows users when @command{ssh} triggers +@option{scpx} 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. - -@item @option{pscp}---@command{plink} and @command{pscp} -@item @option{psftp}---@command{plink} and @command{psftp} +@item @option{pscp} +@item @option{psftp} @cindex method pscp @cindex pscp method @cindex pscp (with pscp method) @@ -798,8 +762,7 @@ session. These methods support the @samp{-P} argument. - -@item @option{fcp}---@command{fsh} and @command{fcp} +@item @option{fcp} @cindex method fcp @cindex fcp method @cindex fsh (with fcp method) @@ -822,7 +785,7 @@ The command used for this connection is: @samp{fsh @var{host} -l 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} +@item @option{nc} @cindex method nc @cindex nc method @cindex nc (with nc method) @@ -839,15 +802,10 @@ decode programs. @cindex ftp method 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 method works only for unified file names, see @ref{Issues}. -@end ifset - +ftp program is specified by Ange FTP. This external program must be +capable of servicing requests from @value{tramp}. -@item @option{smb}---@command{smbclient} +@item @option{smb} @cindex method smb @cindex smb method @@ -866,7 +824,7 @@ Since SMB shares end in the @code{$} character, @value{tramp} must use substitutions. When @value{tramp} is not specific about the share name or uses the -generic remote directory @code{/}, @command{smbclient} returns all +generic remote directory @file{/}, @command{smbclient} returns all available shares. Since SMB authentication is based on each SMB share, @value{tramp} @@ -905,9 +863,9 @@ uses the anonymous user (without prompting for password). This behavior is unlike other @value{tramp} methods, where local user name is substituted. -The @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}: +The @option{smb} method is unavailable if Emacs 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 @@ -925,20 +883,20 @@ can. 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 +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}. +or the absolute path set in the user option @option{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 +the user option @option{tramp-adb-connect-if-not-connected} is not @code{nil}. Otherwise, the connection must be established outside -@value{emacsname}. +Emacs. @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. +@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 Android device because it runs under the @command{adbd} @@ -955,7 +913,6 @@ numbers are not applicable to Android devices connected through USB@. @end table -@ifset emacsgvfs @node GVFS based methods @section GVFS based external methods @cindex methods, gvfs @@ -967,9 +924,9 @@ GVFS is the virtual file system for the Gnome Desktop, mounted locally through FUSE and @value{tramp} uses this locally mounted directory internally. -@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}. +Emacs uses the D-Bus mechanism to communicate with GVFS@. Emacs must +have the message bus system, D-Bus integration active, @pxref{Top, , +D-Bus, dbus}. @table @asis @item @option{afp} @@ -992,6 +949,22 @@ syntax requires a leading volume (share) name, for example: based on standard protocols, such as HTTP@. @option{davs} does the same but with SSL encryption. Both methods support the port numbers. +@item @option{gdrive} +@cindex method gdrive +@cindex gdrive method +@cindex Google Drive + +Via the @option{gdrive} method it is possible to access your Google +Drive online storage. User and host name of the remote file name are +your email address of the Google Drive credentials, like +@file{@trampfn{gdrive,john.doe@@gmail.com,/}}. These credentials must +be populated in your @command{Online Accounts} application outside Emacs. + +Since Google Drive uses cryptic blob file names internally, +@value{tramp} works with the @code{display-name} of the files. This +could produce unexpected behavior in case two files in the same +directory have the same @code{display-name}, such a situation must be avoided. + @item @option{obex} @cindex method obex @cindex obex method @@ -999,7 +972,6 @@ but with SSL encryption. Both methods support the port numbers. 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 @@ -1019,81 +991,32 @@ requires the SYNCE-GVFS plugin. @end table @defopt tramp-gvfs-methods -@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}. +This user option is a list of external methods for GVFS@. By default, +this list includes @option{afp}, @option{dav}, @option{davs}, +@option{gdrive}, @option{obex}, @option{sftp} and @option{synce}. +Other methods to include are: @option{ftp} and @option{smb}. @end defopt -@end ifset - - -@ifset emacsgw -@node Gateway methods -@section Gateway methods -@cindex methods, gateway -@cindex gateway methods - -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 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 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} -@cindex method tunnel -@cindex tunnel method - -This method implements an HTTP tunnel via the @command{CONNECT} -command (conforming to RFC 2616, 2817 specifications). Proxy servers -using HTTP version 1.1 or later protocol support this command. - -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 @option{socks} method connects to SOCKSv5 servers (see RFC 1928) -and supports @option{Username/Password Authentication}. - -The default port number for the socks server is @option{1080}, if not -specified otherwise. - -@end table -@end ifset @node Default Method @section Selecting a default method @cindex default method -@vindex tramp-default-method -@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. +@defopt tramp-default-method +Default method is for transferring files. The user option +@option{tramp-default-method} sets it. @value{tramp} uses this user +option to determine the default method for remote file names that do +not have one specified. @lisp -(setq tramp-default-method "ssh") +(custom-set-variables '(tramp-default-method "ssh" nil (tramp))) @end lisp +@end defopt +@defopt tramp-default-method-alist Default methods for transferring files can be customized for specific -user and host combinations through the alist variable -@code{tramp-default-method-alist}. +user and host combinations through the user option +@option{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} @@ -1102,22 +1025,18 @@ specifies to use the @option{su} method for the user @samp{root} on the host @samp{localhost}. @lisp +@group (add-to-list 'tramp-default-method-alist '("" "john" "ssh")) (add-to-list 'tramp-default-method-alist '("lily" "" "rsync")) (add-to-list 'tramp-default-method-alist '("\\`localhost\\'" "\\`root\\'" "su")) +@end group @end lisp +@end defopt @noindent -See the documentation for the variable -@code{tramp-default-method-alist} for details. - -@noindent -External methods performance faster for large files. - -@noindent -@xref{Inline methods}. -@xref{External methods}. +External methods performance faster for large files. @pxref{Inline +methods}. @pxref{External methods}. Choosing the access method also depends on the security environment. For example, @option{rsh} and @option{telnet} methods that use clear @@ -1169,85 +1088,91 @@ 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 +@defopt tramp-default-user @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}. +this substitution can be overridden with @option{tramp-default-user}. For example: @lisp -(setq tramp-default-user "root") +(custom-set-variables'(tramp-default-user "root" nil (tramp))) @end lisp +@end defopt -Instead of a single default user, @code{tramp-default-user-alist} +@defopt tramp-default-user-alist +Instead of a single default user, @option{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 +@group (add-to-list 'tramp-default-user-alist '("ssh" ".*\\.somewhere\\.else\\'" "john")) +@end group @end lisp -@noindent -See the documentation for the variable @code{tramp-default-user-alist} -for more details. - 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: +the configuration files outside Emacs, such as @file{~/.ssh/config}. +To stop @value{tramp} from applying the default value, set the +corresponding alist entry to nil: @lisp +@group (add-to-list 'tramp-default-user-alist '("ssh" "\\`here\\.somewhere\\.else\\'" nil)) +@end group @end lisp -The last entry in @code{tramp-default-user-alist} should be reserved +The last entry in @option{tramp-default-user-alist} should be reserved for catch-all or most often used login. @lisp +@group (add-to-list 'tramp-default-user-alist '(nil nil "jonas") t) +@end group @end lisp +@end defopt @node Default Host @section Selecting a default host @cindex default host -@vindex tramp-default-host -@vindex tramp-default-host-alist +@defopt tramp-default-host 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 +the @option{tramp-default-host} user option. It is initially +populated with the local hostname where Emacs is running. Both the default user and default host can be overridden as follows: @lisp -(setq tramp-default-user "john" - tramp-default-host "target") +@group +(custom-set-variables + '(tramp-default-user "john" nil (tramp)) + '(tramp-default-host "target" nil (tramp))) +@end group @end lisp With both defaults set, @samp{@trampfn{ssh,,}} will connect -@value{tramp} to John's home directory on target. +@value{tramp} to John's home directory on @code{target}. -@ifset emacs @strong{Note} @samp{/::} won't work, because @samp{/:} is the prefix for quoted file names. -@end ifset +@ifinfo +@pxref{Quoted File Names, , , emacs}. +@end ifinfo +@end defopt -Instead of a single default host, @code{tramp-default-host-alist} +@defopt tramp-default-host-alist +Instead of a single default host, @option{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, +@option{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} -for more details. +@end defopt @node Multi-hops @@ -1263,10 +1188,9 @@ hop kind, where the start and end points of the connection did not have intermediate check points. @defopt tramp-default-proxies-alist -@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}). +through. This user option is list of triples consisting of +@code{(@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 @@ -1276,24 +1200,20 @@ 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}). -@end ifset -@ifclear emacsgw -The method must be an inline method (@pxref{Inline methods}). -@end ifclear -If @var{proxy} is @code{nil}, no additional hop is required reaching +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}. For example, to pass through the host @samp{bastion.your.domain} as user @samp{bird} to reach remote hosts outside the local domain: @lisp +@group (add-to-list 'tramp-default-proxies-alist '("\\." nil "@trampfn{ssh,bird@@bastion.your.domain,}")) (add-to-list 'tramp-default-proxies-alist '("\\.your\\.domain\\'" nil nil)) +@end group @end lisp @strong{Note}: @code{add-to-list} adds elements at the beginning of a @@ -1304,10 +1224,12 @@ called @samp{jump.your.domain}, which is the only host allowed to connect to @samp{bastion.your.domain}, then: @lisp +@group (add-to-list 'tramp-default-proxies-alist '("\\`bastion\\.your\\.domain\\'" "\\`bird\\'" "@trampfn{ssh,jump.your.domain,}")) +@end group @end lisp @var{proxy} can take patterns @code{%h} or @code{%u} for @var{host} or @@ -1318,13 +1240,15 @@ To login as @samp{root} on remote hosts in the domain access, then use this alist entry: @lisp +@group (add-to-list 'tramp-default-proxies-alist '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh,%h,}")) +@end group @end lisp -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. +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. 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. @@ -1337,37 +1261,13 @@ local one, first connect via @command{ssh}, and then apply @command{sudo -u root}: @lisp +@group (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "@trampfn{ssh,%h,}")) (add-to-list 'tramp-default-proxies-alist '((regexp-quote (system-name)) nil nil)) +@end group @end lisp - -The above configuration allows @value{tramp} connection as @samp{root} -to remote Ubuntu hosts. - -@ifset emacsgw -@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,}")) -@end lisp - -Gateway methods in a multiple hop chain can be declared only as the first hop. -@end ifset @end defopt Passing through hops involves dealing with restricted shells, such as @@ -1375,7 +1275,6 @@ Passing through hops involves dealing with restricted shells, such as them for proxies only. @defopt tramp-restricted-shell-hosts-alist -@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. @@ -1384,12 +1283,58 @@ To specify the bastion host from the example above as running a restricted shell: @lisp +@group (add-to-list 'tramp-restricted-shell-hosts-alist "\\`bastion\\.your\\.domain\\'") +@end group @end lisp @end defopt +@node Firewalls +@section Passing firewalls +@cindex HTTP tunnel +@cindex proxy hosts, HTTP tunnel + +Sometimes, it is not possible to reach a remote host directly. A +firewall might be in the way, which could be passed via a proxy +server. + +Both ssh and PuTTY support such proxy settings, using an HTTP tunnel +via the @command{CONNECT} command (conforming to RFC 2616, 2817 +specifications). Proxy servers using HTTP version 1.1 or later +protocol support this command. + +@subsection Tunneling with ssh + +With ssh, you could use the @code{ProxyCommand} entry in the +@file{~/.ssh/config}: + +@example +@group +Host host.other.domain + ProxyCommand nc -X connect -x proxy.your.domain:3128 %h %p +@end group +@end example + +@code{nc} is BSD's netcat program, which establishes HTTP tunnels. Any +other program with such a feature could be used as well. + +In the example, opening @file{@trampfn{ssh,host.your.domain,}} passes +the HTTP proxy server @samp{proxy.your.domain} on port 3128. + +@subsection Tunneling with PuTTY + +PuTTY does not need an external program, HTTP tunnel support is +built-in. In the PuTTY config program, create a session for +@samp{host.your.domain}. In the @option{Connection/Data} entry, +select the @option{HTTP} option, and add @samp{proxy.your.domain} as +@option{Proxy hostname}, and 3128 as @option{Port}. + +Opening @file{@trampfn{plinkx,host.your.domain,}} passes the HTTP +proxy server @samp{proxy.your.domain} on port 3128. + + @node Customizing Methods @section Using Non-Standard Methods @cindex customizing methods @@ -1424,10 +1369,12 @@ This function returns the list of completion functions for @var{method}. Example: @example +@group (tramp-get-completion-function "rsh") @result{} ((tramp-parse-rhosts "/etc/hosts.equiv") (tramp-parse-rhosts "~/.rhosts")) +@end group @end example @end defun @@ -1437,12 +1384,14 @@ for @var{method}. Example: @example +@group (tramp-set-completion-function "ssh" '((tramp-parse-sconfig "/etc/ssh_config") (tramp-parse-sconfig "~/.ssh/config"))) @result{} ((tramp-parse-sconfig "/etc/ssh_config") (tramp-parse-sconfig "~/.ssh/config")) +@end group @end example @end defun @@ -1464,7 +1413,7 @@ This function parses files which are syntactical equivalent to in such files, it can return host names only. @item @code{tramp-parse-sconfig} -@findex tramp-parse-shosts +@findex tramp-parse-sconfig This function returns the host nicknames defined by @code{Host} entries in @file{~/.ssh/config} style files. @@ -1478,7 +1427,7 @@ SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and are always @code{nil}. @item @code{tramp-parse-sknownhosts} -@findex tramp-parse-shostkeys +@findex tramp-parse-sknownhosts Another SSH2 style parsing of directories like @file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}. This @@ -1495,6 +1444,11 @@ A function dedicated to @file{/etc/hosts} for host names. A function which parses @file{/etc/passwd} files for user names. +@item @code{tramp-parse-etc-group} +@findex tramp-parse-etc-group + +A function which parses @file{/etc/group} files for group names. + @item @code{tramp-parse-netrc} @findex tramp-parse-netrc @@ -1513,9 +1467,11 @@ taken as candidates for completion for user and host names. Example: @example +@group (my-tramp-parse "~/.my-tramp-hosts") @result{} ((nil "toto") ("daniel" "melancholia")) +@end group @end example @end defun @@ -1563,27 +1519,14 @@ Setting @code{auth-source-debug} to @code{t} to debug messages. the same user or host name independent of the access method. @vindex password-cache-expiry - @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. +can they extend beyond the lifetime of the current Emacs session. Set +@code{password-cache-expiry} to @code{nil} to disable expiration. @vindex password-cache - 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 -@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 @@ -1591,22 +1534,17 @@ loading, the package through @code{load-path}. @vindex tramp-persistency-file-name For faster initial connection times, @value{tramp} stores previous -connection properties in a file specified by the variable -@code{tramp-persistency-file-name}. +connection properties in a file specified by the user option +@option{tramp-persistency-file-name}. -The default file name for @code{tramp-persistency-file-name} is: -@ifset emacs +The default file name for @option{tramp-persistency-file-name} is @file{~/.emacs.d/tramp}. -@end ifset -@ifset xemacs -@file{~/.xemacs/tramp}. -@end ifset -@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. +@value{tramp} reads this file during Emacs startup, and writes to it +when exiting Emacs. Delete this file for @value{tramp} to recreate a +new one on next Emacs startup. -Set @code{tramp-persistency-file-name} to @code{nil} to disable +Set @option{tramp-persistency-file-name} to @code{nil} to disable storing connections persistently. To reuse connection information from the persistent list, @@ -1633,11 +1571,12 @@ connection related information for that host and creates a new entry. For more precise customization, parameters specified by @code{tramp-methods} can be overwritten manually. -Set @code{tramp-connection-properties} to manually override +Set @option{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. +@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 @@ -1646,12 +1585,17 @@ string @samp{<foo>} for @var{property}. For example, this changes the remote shell: @lisp +@group (add-to-list 'tramp-connection-properties (list (regexp-quote "@trampfn{ssh,user@@randomhost.your.domain,}") "remote-shell" "/bin/ksh")) +@end group + +@group (add-to-list 'tramp-connection-properties (list (regexp-quote "@trampfn{ssh,user@@randomhost.your.domain,}") "remote-shell-login" '("-"))) +@end group @end lisp The parameters @code{tramp-remote-shell} and @@ -1659,15 +1603,17 @@ The parameters @code{tramp-remote-shell} and values for the remote host. @var{property} could also be any property found in -@code{tramp-persistency-file-name}. +@option{tramp-persistency-file-name}. To get around how restricted shells randomly drop connections, set the special property @samp{busybox}. For example: @lisp +@group (add-to-list 'tramp-connection-properties (list (regexp-quote "@trampfn{ssh,user@@randomhost.your.domain,}") "busybox" t)) +@end group @end lisp @@ -1686,12 +1632,10 @@ To improve performance and accuracy of remote file access, @command{grep} when available. @defopt tramp-remote-path -@vindex tramp-remote-path -@vindex tramp-default-remote-path -@vindex tramp-own-remote-path @option{tramp-remote-path} specifies which remote directory paths @value{tramp} can search for @ref{Remote programs}. +@vindex tramp-default-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 @@ -1708,21 +1652,25 @@ shown below for @value{tramp} to use when connecting. (add-to-list 'tramp-remote-path "/usr/local/perl/bin") @end lisp +@vindex tramp-own-remote-path 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} +this remote path after login. However, @code{tramp-own-remote-path} preserves the path value, which can be used to update -@code{tramp-remote-path}. +@option{tramp-remote-path}. @lisp (add-to-list 'tramp-remote-path 'tramp-own-remote-path) @end lisp + +@strong{Note} that this works only if your remote @command{/bin/sh} +shell supports the login argument @samp{-l}. @end defopt 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}. +Emacs, remove the persistent file (@pxref{Connection caching}), and +restart Emacs. @node Remote shell setup @@ -1753,42 +1701,47 @@ 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} +@item @option{tramp-shell-prompt-pattern} @vindex tramp-shell-prompt-pattern -@code{tramp-shell-prompt-pattern} is for remote login shell prompt, +@option{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} +@item @option{tramp-password-prompt-regexp} +@item @option{tramp-wrong-passwd-regexp} @vindex tramp-password-prompt-regexp @vindex tramp-wrong-passwd-regexp -@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: +@value{tramp} uses @option{tramp-password-prompt-regexp} to +distinguish between prompts for passwords and prompts for passphrases. +By default, @option{tramp-password-prompt-regexp} handles the +detection in English language environments. See a localization +example below: @lisp -(setq - tramp-password-prompt-regexp - (concat - "^.*" - (regexp-opt - '("passphrase" "Passphrase" - ;; English - "password" "Password" - ;; Deutsch - "passwort" "Passwort" - ;; Français - "mot de passe" "Mot de passe") t) - ".*:\0? *")) +@group +(custom-set-variables + '(tramp-password-prompt-regexp + (concat + "^.*" + (regexp-opt + '("passphrase" "Passphrase" + ;; English + "password" "Password" + ;; Deutsch + "passwort" "Passwort" + ;; Français + "mot de passe" "Mot de passe") + t) + ".*:\0? *") + nil (tramp))) +@end group @end lisp Similar localization may be necessary for handling wrong password -prompts, for which @value{tramp} uses @var{tramp-wrong-passwd-regexp}. +prompts, for which @value{tramp} uses @option{tramp-wrong-passwd-regexp}. @item @command{tset} and other questions @cindex Unix command tset @@ -1797,8 +1750,8 @@ prompts, for which @value{tramp} uses @var{tramp-wrong-passwd-regexp}. 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. +begins via the user option @option{tramp-terminal-type}. This will +silence common @command{tset} related prompts. @value{tramp}'s strategy for handling such prompts (commonly triggered from login scripts on remote hosts) is to set the environment @@ -1806,26 +1759,31 @@ variables so that no prompts interrupt the shell initialization process. @vindex tramp-actions-before-shell - An alternative approach is to configure @value{tramp} with strings that can identify such questions using @code{tramp-actions-before-shell}. Example: @lisp +@group (defconst my-tramp-prompt-regexp (concat (regexp-opt '("Enter the birth date of your mother:") t) "\\s-*") "Regular expression matching my login prompt question.") +@end group +@group (defun my-tramp-action (proc vec) "Enter \"19000101\" in order to give a correct answer." (save-window-excursion (with-current-buffer (tramp-get-connection-buffer vec) (tramp-message vec 6 "\n%s" (buffer-string)) (tramp-send-string vec "19000101")))) +@end group +@group (add-to-list 'tramp-actions-before-shell '(my-tramp-prompt-regexp my-tramp-action)) +@end group @end lisp @@ -1886,16 +1844,16 @@ follows: Then re-set the prompt string in @file{~/.emacs_SHELLNAME} as follows: @example +@group # Reset the prompt for remote Tramp shells. if [ "$@{INSIDE_EMACS/*tramp*/tramp@}" == "tramp" ] ; then PS1="[\u@@\h \w]$ " fi +@end group @end example @ifinfo -@ifset emacs -@xref{Interactive Shell, , , @value{emacsdir}}. -@end ifset +@xref{Interactive Shell, , , emacs}. @end ifinfo @item @command{busybox} / @command{nc} @@ -1910,13 +1868,16 @@ install and execute a listener as follows (see @code{tramp-methods}): @end example The above command-line syntax has changed with @command{busybox} -versions. If @command{nc} refuses the @command{-p} parameter, then +versions. If @command{nc} refuses the @samp{-p} parameter, then overwrite as follows: @lisp +@group (add-to-list 'tramp-connection-properties - `(,(regexp-quote "192.168.0.1") "remote-copy-args" (("-l") ("%r")))) + `(,(regexp-quote "192.168.0.1") + "remote-copy-args" (("-l") ("%r")))) +@end group @end lisp @noindent @@ -1938,13 +1899,15 @@ 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: -@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: +@command{sh} must be specified for remote shell since Android devices +do not provide @command{/bin/sh}. @command{sh} will then invoke +whatever shell is installed on the device with this setting: @lisp +@group (add-to-list 'tramp-connection-properties (list (regexp-quote "192.168.0.26") "remote-shell" "sh")) +@end group @end lisp @noindent @@ -1956,8 +1919,10 @@ user settings. Android devices prefer @file{/system/xbin} path over @file{/system/bin}. Both of these are set as follows: @lisp +@group (add-to-list 'tramp-remote-path 'tramp-own-remote-path) (add-to-list 'tramp-remote-path "/system/xbin") +@end group @end lisp @noindent @@ -1970,17 +1935,19 @@ directory for temporary files: @noindent 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}. +@trampfn{ssh,192.168.0.26#2222,}}, where @command{sshd} is listening +on port @samp{2222}. To add a corresponding entry to the @file{~/.ssh/config} file (recommended), use this: @example +@group Host android HostName 192.168.0.26 User root Port 2222 +@end group @end example @noindent @@ -1988,8 +1955,10 @@ To use the host name @samp{android} instead of the IP address shown in the previous example, fix the connection properties as follows: @lisp +@group (add-to-list 'tramp-connection-properties (list (regexp-quote "android") "remote-shell" "sh")) +@end group @end lisp @noindent @@ -2001,64 +1970,40 @@ Open a remote connection with a more concise command @kbd{C-x C-f @section Auto-save and Backup configuration @cindex auto-save @cindex backup -@ifset emacs @vindex backup-directory-alist -@end ifset -@ifset xemacs -@vindex bkup-backup-directory-info -@end ifset -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} -@end ifset -@ifset xemacs -@code{bkup-backup-directory-info} -@end ifset -have to be altered. +To avoid @value{tramp} from saving backup files owned by @samp{root} +to locations accessible to others, default backup settings in +@option{backup-directory-alist} 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 +Here's a scenario where files could be inadvertently exposed. Emacs +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. +of the secretfile is now owned by the user logged in from +@value{tramp} and not @samp{root}. -When -@ifset emacs -@code{backup-directory-alist} -@end ifset -@ifset xemacs -@code{bkup-backup-directory-info} -@end ifset -is @code{nil} (the default), such problems do not occur. +When @option{backup-directory-alist} is @code{nil} (the default), such +problems do not occur. To ``turn off'' the backup feature for @value{tramp} files and stop @value{tramp} from saving to the backup directory, use this: -@ifset emacs @lisp +@group (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil)) +@end group @end lisp -@end ifset -@ifset xemacs -@lisp -(require 'backup-dir) -(add-to-list 'bkup-backup-directory-info - (list tramp-file-name-regexp "")) -@end lisp -@end ifset -@ifset emacs @noindent Disabling backups can be targeted to just the @option{su} and @option{sudo} methods: @lisp +@group (setq backup-enable-predicate (lambda (name) (and (normal-backup-enable-predicate name) @@ -2066,27 +2011,15 @@ Disabling backups can be targeted to just the @option{su} and (let ((method (file-remote-p name 'method))) (when (stringp method) (member method '("su" "sudo")))))))) +@end group @end lisp -@end ifset 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} -@end ifset -@ifset xemacs -@code{tramp-bkup-backup-directory-info} -@end ifset -from the existing variable -@ifset emacs -@code{backup-directory-alist}. -@end ifset -@ifset xemacs -@code{bkup-backup-directory-info}. -@end ifset +@value{tramp} user option @option{tramp-backup-directory-alist} from +the existing user option @option{backup-directory-alist}. Then @value{tramp} backs up to a file name that is transformed with a prefix consisting of the DIRECTORY name. This file name prefixing @@ -2095,51 +2028,38 @@ happens only when the DIRECTORY is an absolute local file name. @noindent Example: -@ifset emacs @lisp +@group (add-to-list 'backup-directory-alist (cons "." "~/.emacs.d/backups/")) -(setq tramp-backup-directory-alist backup-directory-alist) -@end lisp -@end ifset -@ifset xemacs -@lisp -(require 'backup-dir) -(add-to-list 'bkup-backup-directory-info - (list "." "~/.emacs.d/backups/" 'full-path)) -(setq tramp-bkup-backup-directory-info bkup-backup-directory-info) +(custom-set-variables + '(tramp-backup-directory-alist backup-directory-alist 6 nil (tramp))) +@end group @end lisp -@end ifset @noindent The backup file name of @file{@trampfn{su,root@@localhost,/etc/secretfile}} would be -@ifset emacs +@ifset unified @file{@trampfn{su,root@@localhost,~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}} @end ifset -@ifset xemacs +@ifset separate @file{@trampfn{su,root@@localhost,~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}} @end ifset Just as for backup files, similar issues of file naming affect -auto-saving @value{tramp} files. -@ifset emacs -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. - -Set @code{auto-save-file-name-transforms} to @code{nil} to save +auto-saving @value{tramp} files. Auto-saved files are saved in the +directory specified by the user option +@option{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 Emacs was +compiled. Reset such values to a valid directory. + +Set @option{auto-save-file-name-transforms} to @code{nil} to save auto-saved files to the same directory as the original file. -Alternatively, set the variable @code{tramp-auto-save-directory} to -direct all auto saves to that location. -@end ifset -@ifset xemacs -@code{auto-save-directory} can also be used here instead of other -locations specified above. -@end ifset +Alternatively, set the user option @option{tramp-auto-save-directory} +to direct all auto saves to that location. @node Windows setup hints @section Issues with Cygwin ssh @@ -2150,9 +2070,9 @@ This section is incomplete. Please share your solutions. @cindex method sshx with Cygwin @cindex sshx method with Cygwin -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}. Incompatibilities trigger this message: +Cygwin's @command{ssh} works only with a Cygwin version of Emacs. To +check for compatibility: type @kbd{M-x eshell}, and start @kbd{ssh +test.host}. Incompatibilities trigger this message: @example Pseudo-terminal will not be allocated because stdin is not a terminal. @@ -2162,11 +2082,17 @@ 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 Cygwin and fakecygpty +@cindex fakecygpty and Cygwin + +On @uref{https://www.emacswiki.org/emacs/SshWithNTEmacs, the Emacs +Wiki} it is explained how to use the helper program @code{fakecygpty} +to fix this problem. @cindex method scpx with Cygwin @cindex scpx method with Cygwin -When using the @option{scpx} access method, @value{emacsname} may call +When using the @option{scpx} access method, Emacs 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 @@ -2176,18 +2102,17 @@ 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 +@cindex SSH_AUTH_SOCK and Emacs on Windows 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. +@env{SSH_AUTH_SOCK}. But this variable is not set when Emacs 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. +The fallback is to start Emacs from a shell. @node Usage @@ -2198,27 +2123,24 @@ The fallback is to start @value{emacsname} from a shell. 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 +authentication, host names, and file names. Ange FTP uses a similar +syntax. @cindex type-ahead -Unlike opening local files in @value{emacsname}, which are -instantaneous, opening remote files in @value{tramp} is slower at -first. Sometimes there is a noticeable 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 +Unlike opening local files in Emacs, which are instantaneous, opening +remote files in @value{tramp} is slower at first. Sometimes there is +a noticeable 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 Emacs. This type-ahead facility +is a feature of Emacs that may cause missed prompts when using @value{tramp}. @menu * File name Syntax:: @value{tramp} file name conventions. * File name completion:: File name completion. * Ad-hoc multi-hops:: Declaring multiple hops in the file name. -* Remote processes:: Integration with other @value{emacsname} packages. +* Remote processes:: Integration with other Emacs packages. * Cleanup remote connections:: Cleanup remote connections. @end menu @@ -2228,9 +2150,9 @@ passwords or authentication appear in the minibuffer. Hitting @cindex file name syntax @cindex file name examples -@file{@trampf{host,localfilename}} -opens file @var{localfilename} on the remote host @var{host}, using -the default method. @xref{Default Method}. +@file{@trampf{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 @@ -2257,7 +2179,7 @@ For the file @file{/etc/squid.conf} on the host @code{melancholia}. @var{host} can take IPv4 or IPv6 address, as in @file{@trampf{127.0.0.1,.emacs}} or @file{@trampf{@value{ipv6prefix}::1@value{ipv6postfix},.emacs}}. -@ifset emacs +@ifset unified For syntactical reasons, IPv6 addresses must be embedded in square brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}. @end ifset @@ -2270,24 +2192,16 @@ name using the proper syntax will override this default behavior: @trampf{user@@host,path/to.file} @end example -@file{@trampf{daniel@@melancholia,.emacs}} is for file -@file{.emacs} in @code{daniel}'s home directory on the host, -@code{melancholia}. +@file{@trampf{daniel@@melancholia,.emacs}} is for file @file{.emacs} +in @code{daniel}'s home directory on the host, @code{melancholia}. Specify other file access methods (@pxref{Inline methods}, @pxref{External methods}) as part of the file name. -@ifset emacs 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}@var{method}@value{postfixhop}} (Note the trailing -slash!). -@end ifset -The syntax specifications for user, host, and file do not change. +colon). The syntax specifications for user, host, and file do not +change. To connect to the host @code{melancholia} as @code{daniel}, using @option{ssh} method for @file{.emacs} in @code{daniel}'s home @@ -2307,44 +2221,38 @@ name. For example: @file{@trampfn{ssh,daniel@@melancholia#42,.emacs}}. @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 -Enable this by activating partial completion in @file{.emacs}. +located on remote hosts. Enable this by activating partial completion +in @file{.emacs}. @ifinfo -@xref{Completion Options, , , @value{emacsdir}}. +@xref{Completion Options, , , emacs}. @end ifinfo -@end ifset For example, type @kbd{C-x C-f @value{prefix}t @key{TAB}}, @value{tramp} completion choices show up as @example +@group @c @multitable {@trampfn{telnet,melancholia.danann.net,}} {@trampfn{telnet,192.168.0.1,}} @multitable @columnfractions .5 .5 -@ifset emacs @item @value{prefixhop}telnet@value{postfixhop} @tab tmp/ @item @value{prefixhop}toto@value{postfix} @tab -@end ifset -@ifset xemacs -@item @value{prefixhop}telnet@value{postfixhop} @tab @value{prefixhop}toto@value{postfix} -@end ifset @end multitable +@end group @end example -@samp{@value{prefixhop}telnet@value{postfixhop}} -is a possible completion for the respective method, -@ifset emacs -@samp{tmp/} stands for the directory @file{/tmp} on your local host, -@end ifset -and @samp{@value{prefixhop}toto@value{postfix}} -might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts} -file (when using @option{ssh} as default method). +@samp{@value{prefixhop}telnet@value{postfixhop}} is a possible +completion for the respective method, @samp{tmp/} stands for the +directory @file{/tmp} on your local host, and +@samp{@value{prefixhop}toto@value{postfix}} might be a host +@value{tramp} has detected in your @file{~/.ssh/known_hosts} file +(when using @option{ssh} as default method). 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 +@group @multitable @columnfractions .5 .5 @c @multitable {@trampfn{telnet,melancholia.danann.net,}} {@trampfn{telnet,192.168.0.1,}} @item @trampfn{telnet,127.0.0.1,} @tab @trampfn{telnet,192.168.0.1,} @@ -2352,6 +2260,7 @@ shows host names @value{tramp} from @file{/etc/hosts} file, for example. @item @value{prefix}telnet@value{postfixhop}@value{ipv6prefix}::1@value{ipv6postfix}@value{postfix} @tab @trampfn{telnet,localhost,} @item @trampfn{telnet,melancholia.danann.net,} @tab @trampfn{telnet,melancholia,} @end multitable +@end group @end example Choose a host from the above list and then continue to complete file @@ -2365,21 +2274,19 @@ persistently (@pxref{Connection caching}) will be included in the completion lists. After remote host name completion comes completion of file names on -the remote host. It works the same as with local host file completion, +the remote host. It works the same as with local host file completion except that 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 +name part of the @value{tramp} file name syntax. A triple-slash +stands for the default behavior. @ifinfo -@xref{Minibuffer File, , , @value{emacsdir}}. +@xref{Minibuffer File, , , emacs}. @end ifinfo @noindent Example: @example -@ifset emacs +@group @kbd{C-x C-f @trampfn{telnet,melancholia,/usr/local/bin//etc} @key{TAB}} @print{} @trampfn{telnet,melancholia,/etc} @@ -2388,28 +2295,20 @@ Example: @kbd{C-x C-f @trampfn{telnet,melancholia,/usr/local/bin///etc} @key{TAB}} @print{} /etc -@end ifset - -@ifset xemacs -@kbd{C-x C-f @trampfn{telnet,melancholia,/usr/local/bin//}} - @print{} @trampfn{telnet,melancholia,/} - -@kbd{C-x C-f @trampfn{telnet,melancholia,//}} - @print{} / -@end ifset +@end group @end example 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}). +the file system by applications outside Emacs (@pxref{Connection +caching}). @defopt tramp-completion-reread-directory-timeout -@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. +rereading remote directory contents. A value of 0 re-reads +immediately during file name completion, @code{nil} uses cached +directory contents. @end defopt @@ -2419,7 +2318,7 @@ file name completion, @code{nil} uses cached directory contents. @cindex proxy hosts, ad-hoc @value{tramp} file name syntax can accommodate ad hoc specification of -multiple proxies without using @code{tramp-default-proxies-alist} +multiple proxies without using @option{tramp-default-proxies-alist} configuration setup(@pxref{Multi-hops}). Each proxy is specified using the same syntax as the remote host @@ -2436,32 +2335,30 @@ proxy @samp{bird@@bastion} to a remote file on @samp{you@@remotehost}: Proxies can take patterns @code{%h} or @code{%u}. @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: +@option{tramp-default-proxies-alist} and is available for re-use +during that Emacs session. Subsequent @value{tramp} connections to +the same remote host can then use the shortcut form: @samp{@trampfn{ssh,you@@remotehost,/path}}. @defopt tramp-save-ad-hoc-proxies -@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}. +@option{tramp-default-proxies-alist} for future Emacs sessions, set +@option{tramp-save-ad-hoc-proxies} to non-@code{nil}. @lisp -(setq tramp-save-ad-hoc-proxies t) +(custom-set-variables '(tramp-save-ad-hoc-proxies t nil (tramp))) @end lisp @end defopt @node Remote processes -@section Integration with other @value{emacsname} packages +@section Integration with other Emacs packages @cindex compile @cindex recompile @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. +host for discovering remote file names. Emacs 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 @@ -2471,17 +2368,16 @@ and does not support the pty association as specified in host when the variable @code{default-directory} is remote: @lisp +@group (let ((default-directory "/ssh:remote.host:")) (start-file-process "grep" (get-buffer-create "*grep*") "/bin/sh" "-c" "grep -e tramp *")) +@end group @end lisp - -@ifset emacsgvfs 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 @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 @@ -2492,22 +2388,24 @@ like @code{compile} and @code{grep}) and @file{gud.el} (@code{gdb} or 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}): +@option{tramp-remote-path} (see @ref{Remote programs}): @lisp +@group (add-to-list 'tramp-remote-path "~/bin") (add-to-list 'tramp-remote-path "/appli/pub/bin") +@end group @end lisp -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 +Customize user option @option{tramp-remote-process-environment} to +suit the remote program's environment for the remote host. +@option{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. +To avoid any conflicts with local host environment variables set +through local configuration files, such as @file{~/.profile}, use +@samp{ENVVARNAME=} to unset them for the remote environment. @noindent Use @code{add-to-list} to add entries: @@ -2517,17 +2415,31 @@ Use @code{add-to-list} to add entries: @end lisp Modifying or deleting already existing values in the -@code{tramp-remote-process-environment} list may not be feasible on +@option{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 +disallow changing @env{HISTORY} environment variable. To accommodate +such restrictions when using @value{tramp}, fix the +@option{tramp-remote-process-environment} by the following code in the local @file{.emacs} file: @lisp +@group (let ((process-environment tramp-remote-process-environment)) (setenv "HISTORY" nil) (setq tramp-remote-process-environment process-environment)) +@end group +@end lisp + +Setting the @env{ENV} environment variable instructs some shells to +read an initialization file. Per default, @value{tramp} has disabled +this. You could overwrite this behavior by evaluating + +@lisp +@group +(let ((process-environment tramp-remote-process-environment)) + (setenv "ENV" "$HOME/.profile") + (setq tramp-remote-process-environment process-environment)) +@end group @end lisp @value{tramp} does not use the defaults specified in @@ -2537,15 +2449,17 @@ local @file{.emacs} file: them as follows: @lisp +@group (let ((process-environment (cons "HGPLAIN=1" process-environment))) (process-file @dots{})) +@end group @end lisp This works only for environment variables not already set in the @code{process-environment}. -For integrating other @value{emacsname} packages so @value{tramp} can -execute remotely, please file a bug report. @xref{Bug Reports}. +For integrating other Emacs packages so @value{tramp} can execute +remotely, please file a bug report. @xref{Bug Reports}. @subsection Running remote programs that create local X11 windows @@ -2555,8 +2469,10 @@ set the @env{DISPLAY} environment variable for the remote host as follows in the local @file{.emacs} file: @lisp +@group (add-to-list 'tramp-remote-process-environment (format "DISPLAY=%s" (getenv "DISPLAY"))) +@end group @end lisp @noindent @@ -2580,11 +2496,9 @@ 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, 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 @@ -2595,16 +2509,16 @@ on remote hosts and displays output in buffers on the local host. Example: @example +@group @kbd{C-x C-f @trampfn{sudo,,} @key{RET}} @kbd{M-! tail -f /var/log/syslog.log & @key{RET}} +@end group @end example @command{tail} command outputs continuously to the local buffer, @file{*Async Shell Command*} -@ifset emacs @kbd{M-x auto-revert-tail-mode} runs similarly showing continuous output. -@end ifset @subsection Running @code{eshell} on a remote host @@ -2617,6 +2531,7 @@ You must add the module @code{eshell-tramp} to @kbd{M-x eshell} on a remote host: @example +@group @b{~ $} cd @trampfn{sudo,,/etc} @key{RET} @b{@trampfn{sudo,root@@host,/etc} $} hostname @key{RET} host @@ -2625,28 +2540,31 @@ uid=0(root) gid=0(root) groups=0(root) @b{@trampfn{sudo,root@@host,/etc} $} find-file shadow @key{RET} #<buffer shadow> @b{@trampfn{sudo,root@@host,/etc} $} +@end group @end example -@ifset emacs -@code{eshell} in @value{emacsname} 23.2 added custom @code{su} and -@code{sudo} commands that set the default directory correctly for the +@code{eshell} in Emacs 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 +@option{tramp-default-proxies-alist} with an entry for this directory (@pxref{Multi-hops}): @example +@group @b{~ $} cd @trampfn{ssh,user@@remotehost,/etc} @key{RET} @b{@trampfn{ssh,user@@remotehost,/etc} $} find-file shadow @key{RET} File is not readable: @trampfn{ssh,user@@remotehost,/etc/shadow} @b{@trampfn{ssh,user@@remotehost,/etc} $} sudo find-file shadow @key{RET} #<buffer shadow> +@end group +@group @b{@trampfn{ssh,user@@remotehost,/etc} $} su - @key{RET} @b{@trampfn{su,root@@remotehost,/root} $} id @key{RET} uid=0(root) gid=0(root) groups=0(root) @b{@trampfn{su,root@@remotehost,/root} $} +@end group @end example -@end ifset @anchor{Running a debugger on a remote host} @@ -2656,26 +2574,36 @@ uid=0(root) gid=0(root) groups=0(root) @cindex perldb @file{gud.el} provides a unified interface to symbolic debuggers -@ifset emacs @ifinfo -(@ref{Debuggers, , , @value{emacsdir}}). +(@ref{Debuggers, , , emacs}). @end ifinfo -@end ifset @value{tramp} can run debug on remote hosts by calling @code{gdb} with a remote file name: @example +@group @kbd{M-x gdb @key{RET}} -@b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh,host,~/myprog} @key{RET} +@b{Run gdb (like this):} gdb -i=mi @trampfn{ssh,host,~/myprog} @key{RET} +@end group +@end example + +Since the remote @code{gdb} and @code{gdb-inferior} processes do not +belong to the same process group on the remote host, there will be a +warning, which can be ignored: + +@example +&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n" @end example 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: +@file{myprog.pl} exists in @file{@trampfn{ssh,host,/home/user}}, valid +calls include: @example +@group @kbd{M-x perldb @key{RET}} @b{Run perldb (like this):} perl -d myprog.pl @key{RET} +@end group @end example Just the local part of a remote file name, such as @kbd{perl -d @@ -2702,16 +2630,20 @@ 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 +@group (setq explicit-shell-file-name "cmd" explicit-cmd-args '("/q")) +@end group @end lisp @noindent To open @command{powershell} as a remote shell, use this: @lisp +@group (setq explicit-shell-file-name "powershell" explicit-powershell-args '("-file" "-")) +@end group @end lisp @@ -2727,9 +2659,8 @@ 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. +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 @@ -2772,11 +2703,9 @@ 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, run the test suite first @ref{Testing}. @end ifset -@end ifset @findex tramp-bug Check if the bug or problem is already addressed in @xref{Frequently @@ -2835,8 +2764,7 @@ Where is the latest @value{tramp}? @item Which systems does it work on? -The package works successfully on Emacs 22, Emacs 23, Emacs 24, Emacs -25, XEmacs 21 (starting with 21.4), and SXEmacs 22. +The package works successfully on Emacs 23, Emacs 24, and Emacs 25. While Unix and Unix-like systems are the primary remote targets, @value{tramp} has equal success connecting to other platforms, such as @@ -2855,7 +2783,7 @@ responsiveness slows down. Some suggestions within the scope of Use an external method, such as @option{scp}, which are faster than internal methods. -Keep the file @code{tramp-persistency-file-name}, which is where +Keep the file @option{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. @@ -2864,16 +2792,18 @@ 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 +Set @option{tramp-completion-reread-directory-timeout} to @code{nil} to speed up completions, @ref{File name completion}. Disable version control to avoid delays: @lisp +@group (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)) +@end group @end lisp Disable excessive traces. Set @code{tramp-verbose} to 3 or lower, @@ -2918,6 +2848,7 @@ When using fish shell on remote hosts, disable fancy formatting by adding the following to @file{~/.config/fish/config.fish}: @example +@group function fish_prompt if test $TERM = "dumb" echo "\$ " @@ -2925,10 +2856,24 @@ function fish_prompt @dots{} end end +@end group @end example -When using WinSSHD on remote hosts, @value{tramp} do not recognize the -strange prompt settings. +When using WinSSHD on remote hosts, @value{tramp} does not recognize +the strange prompt settings. + +A similar problem exist with the iTerm2 shell integration, which sends +proprietary escape codes when starting a shell. This can be +suppressed by changing the respective integration snippet in your +@file{~/.profile} like this: + +@example +@group +[ $TERM = "dumb" ] || \ +test -e "$@{HOME@}/.iterm2_shell_integration.bash" && \ +source "$@{HOME@}/.iterm2_shell_integration.bash" +@end group +@end example @item Echoed characters after login @@ -2956,11 +2901,13 @@ first saving to a temporary file. @end ifinfo @lisp +@group (add-hook 'find-file-hook (lambda () (when (file-remote-p default-directory) (set (make-local-variable 'file-precious-flag) t)))) +@end group @end lisp @end itemize @@ -2974,8 +2921,10 @@ configuration for @command{ssh} can be configured to kill such hangs with the following command in the @file{~/.ssh/config}: @example +@group Host * ServerAliveInterval 5 +@end group @end example @@ -2984,30 +2933,37 @@ Host * @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 a master session opened outside the Emacs session is no longer +open. That is why @value{tramp} prompts for the password again even +if there is an @command{ssh} already open. +@vindex tramp-ssh-controlmaster-options Some @command{ssh} versions support a @code{ControlPersist} option, which allows you to set the @code{ControlPath} provided the variable @code{tramp-ssh-controlmaster-options} is customized as follows: @lisp +@group (setq tramp-ssh-controlmaster-options (concat "-o ControlPath=/tmp/ssh-ControlPath-%%r@@%%h:%%p " "-o ControlMaster=auto -o ControlPersist=yes")) +@end group @end lisp Note how "%r", "%h" and "%p" must be encoded as "%%r", "%%h" and "%%p". +@vindex tramp-use-ssh-controlmaster-options 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) +@group +(custom-set-variables + '(tramp-use-ssh-controlmaster-options nil nil (tramp))) +@end group @end lisp @@ -3021,9 +2977,9 @@ 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. +disable @samp{--color=yes} or @samp{--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 directories with large number of @@ -3036,7 +2992,7 @@ shell's limit on length of command lines and hang. @value{tramp} uses globbing. To test if globbing hangs, open a shell on the remote host and then -run @samp{ls -d * ..?* > /dev/null}. +run @command{ls -d * ..?* > /dev/null}. When testing, ensure the remote shell is the same shell (@command{/bin/sh}, @command{ksh} or @command{bash}), that @@ -3046,117 +3002,62 @@ When testing, ensure the remote shell is the same shell @item How to get notified after @value{tramp} completes file transfers? -Make @value{emacsname} beep after reading from or writing to the -remote host with the following code in @file{~/.emacs} file. +Make Emacs beep after reading from or writing to the remote host with +the following code in @file{~/.emacs} file. @lisp +@group (defadvice tramp-handle-write-region (after tramp-write-beep-advice activate) "Make tramp beep after writing a file." (interactive) (beep)) +@end group +@group (defadvice tramp-handle-do-copy-or-rename-file (after tramp-copy-beep-advice activate) "Make tramp beep after copying a file." (interactive) (beep)) +@end group +@group (defadvice tramp-handle-insert-file-contents (after tramp-insert-beep-advice activate) "Make tramp beep after inserting a file." (interactive) (beep)) +@end group @end lisp -@ifset emacs -@item -How to get a Visual Warning when working with @samp{root} privileges - -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 () - (when (string-match "^/su\\(do\\)?:" default-directory) - (setq mode-line-format - (format-mode-line mode-line-format 'font-lock-warning-face)))) - -(add-hook 'find-file-hook 'my-mode-line-function) -(add-hook 'dired-mode-hook 'my-mode-line-function) -@end lisp -@end ifset - - -@ifset emacs @item -How to get host indication in the mode line? - -The following code (tested with @value{emacsname} 22.1) in -@file{~/.emacs} file shows it: - -@lisp -(defconst my-mode-line-buffer-identification - (list - '(:eval - (let ((host-name - (if (file-remote-p default-directory) - (tramp-file-name-host - (tramp-dissect-file-name default-directory)) - (system-name)))) - (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name) - (substring host-name 0 (match-beginning 1)) - host-name))) - ": %12b")) - -(setq-default - mode-line-buffer-identification - my-mode-line-buffer-identification) - -(add-hook - 'dired-mode-hook - (lambda () - (setq - mode-line-buffer-identification - my-mode-line-buffer-identification))) -@end lisp - -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: +How to get a Visual Warning when working with @samp{root} privileges? +Host indication in the mode line? -@lisp - '(:eval - (let ((host-name - (or (file-remote-p default-directory 'host) - (system-name)))) - (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name) - (substring host-name 0 (match-beginning 1)) - host-name))) -@end lisp -@end ifset +Install @file{tramp-theme} from GNU ELPA via Emacs' Package Manager. +Enable it via @kbd{M-x load-theme @key{RET} tramp}. Further +customization is explained in user option +@option{tramp-theme-face-remapping-alist}. -@ifset emacs @item Remote host does not understand default options for directory listing -@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: +Emacs 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 +@group (add-hook 'dired-before-readin-hook (lambda () (when (file-remote-p default-directory) (setq dired-actual-switches "-al")))) +@end group @end lisp -@end ifset @item @@ -3168,6 +3069,7 @@ turn off saving history by putting this shell code in the @file{.kshrc} file: @example +@group if [ -f $HOME/.sh_history ] ; then /bin/rm $HOME/.sh_history fi @@ -3177,6 +3079,7 @@ fi if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then unset HISTSIZE fi +@end group @end example For @option{ssh}-based method, add the following line to your @@ -3202,8 +3105,11 @@ You can define default methods and user names for hosts, (@pxref{Default Method}, @pxref{Default User}): @lisp -(setq tramp-default-method "ssh" - tramp-default-user "news") +@group +(custom-set-variables + '(tramp-default-method "ssh" nil (tramp)) + '(tramp-default-user "news" nil (tramp))) +@end group @end lisp The reduced typing: @kbd{C-x C-f @trampf{news.my.domain,/opt/news/etc}}. @@ -3220,9 +3126,11 @@ Programs used for access methods already offer powerful configurations file @file{~/.ssh/config}: @example +@group Host xy HostName news.my.domain User news +@end group @end example The reduced typing: @kbd{C-x C-f @trampfn{ssh,xy,/opt/news/etc}}. @@ -3235,8 +3143,8 @@ completion can further reduce key strokes: @kbd{C-x C-f Use environment variables to expand long strings 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: +the minibuffer. Environment variables are set either outside Emacs or +inside Emacs with Lisp: @lisp (setenv "xy" "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}") @@ -3250,9 +3158,10 @@ minibuffer. @item Define own keys: -Redefine another key sequence in @value{emacsname} for @kbd{C-x C-f}: +Redefine another key sequence in Emacs for @kbd{C-x C-f}: @lisp +@group (global-set-key [(control x) (control y)] (lambda () @@ -3261,13 +3170,14 @@ Redefine another key sequence in @value{emacsname} for @kbd{C-x C-f}: (read-file-name "Find Tramp file: " "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}")))) +@end group @end lisp Simply typing @kbd{C-x C-y} would prepare minibuffer editing of file name. -See @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the Emacs -Wiki} for a more comprehensive example. +See @uref{https://www.emacswiki.org/emacs/TrampMode, the Emacs Wiki} +for a more comprehensive example. @item Define own abbreviation (1): @@ -3275,9 +3185,11 @@ Define own abbreviation (1): Abbreviation list expansion can be used to reduce typing long file names: @lisp +@group (add-to-list 'directory-abbrev-alist '("^/xy" . "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}")) +@end group @end lisp The reduced typing: @kbd{C-x C-f /xy @key{RET}}. @@ -3293,23 +3205,31 @@ The @code{abbrev-mode} gives additional flexibility for editing in the minibuffer: @lisp +@group (define-abbrev-table 'my-tramp-abbrev-table '(("xy" "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))) +@end group +@group (add-hook 'minibuffer-setup-hook (lambda () (abbrev-mode 1) (setq local-abbrev-table my-tramp-abbrev-table))) +@end group +@group (defadvice minibuffer-complete (before my-minibuffer-complete activate) (expand-abbrev)) +@end group +@group ;; If you use partial-completion-mode (defadvice PC-do-completion (before my-PC-do-completion activate) (expand-abbrev)) +@end group @end lisp The reduced typing: @kbd{C-x C-f xy @key{TAB}}. @@ -3320,157 +3240,118 @@ The minibuffer expands for further editing. Use bookmarks to save Tramp file names. @ifinfo -@pxref{Bookmarks, , , @value{emacsdir}}. +@pxref{Bookmarks, , , emacs}. @end ifinfo 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 -@ifset xemacs -@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}. -@end ifset To revisit that bookmark: -@ifset emacs @kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}. -@end ifset -@ifset xemacs -@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{jump}}. -@end ifset @item Use recent files: -@ifset emacs -@file{recentf} -@end ifset -@ifset xemacs -@file{recent-files} -@end ifset -remembers visited places. +@file{recentf} remembers visited places. @ifinfo -@ifset emacs -@pxref{File Conveniences, , , @value{emacsdir}}. -@end ifset -@ifset xemacs -@pxref{recent-files, , , edit-utils}. -@end ifset +@pxref{File Conveniences, , , emacs}. @end ifinfo Keep remote file names in the recent list without have to check for their accessibility through remote access: @lisp -@ifset emacs (recentf-mode 1) -@end ifset -@ifset xemacs -(recent-files-initialize) -(add-hook - 'find-file-hook - (lambda () - (when (file-remote-p (buffer-file-name)) - (recent-files-make-permanent))) - 'append) -@end ifset @end lisp -Reaching recently opened files: -@ifset emacs -@kbd{@key{menu-bar} @key{file} @key{Open Recent}}. -@end ifset -@ifset xemacs -@kbd{@key{menu-bar} @key{Recent Files}}. -@end ifset +Reaching recently opened files: @kbd{@key{menu-bar} @key{file} +@key{Open Recent}}. -@ifset emacs @item Use filecache: Since @file{filecache} remembers visited places, add the remote directory to the cache: @lisp +@group @c `with-eval-after-load' has been introduced with Emacs 24.4. Shall @c be used when appropriate. (eval-after-load "filecache" '(file-cache-add-directory "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}")) +@end group @end lisp 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 also works for @value{tramp} file names. +@file{bbdb} has a built-in feature for Ange FTP files, which also +works for @value{tramp} file names. @ifinfo @pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}. @end ifinfo -Load @file{bbdb} in @value{emacs}: +Load @file{bbdb} in Emacs: @lisp +@group (require 'bbdb) (bbdb-initialize) +@end group @end lisp Create a BBDB entry with @kbd{M-x bbdb-create-ftp-site}. Then specify a method and user name where needed. Examples: @example +@group @kbd{M-x bbdb-create-ftp-site @key{RET}} @b{Ftp Site:} news.my.domain @key{RET} @b{Ftp Directory:} /opt/news/etc/ @key{RET} @b{Ftp Username:} ssh@value{postfixhop}news @key{RET} @b{Company:} @key{RET} @b{Additional Comments:} @key{RET} +@end group @end example In BBDB buffer, access an entry by pressing the key @key{F}. -@end ifset @end enumerate 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? +Why saved multi-hop file names do not work in a new Emacs session? 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, use the full ad-hoc file name including all hops, -like +multi-hops}) via bookmarks, recent files, filecache, bbdb, 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, 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 non-@code{nil} +@file{@trampfn{ssh,news@@news.my.domain,/opt/news/etc}}, the user +option @option{tramp-save-ad-hoc-proxies} must be set non-@code{nil} value. -@ifset emacs @item -How to connect to a remote @value{emacsname} session using @value{tramp}? +How to connect to a remote Emacs session using @value{tramp}? Configure Emacs Client @ifinfo -(@pxref{Emacs Server, , , @value{emacsdir}}). +(@pxref{Emacs Server, , , emacs}). @end ifinfo Then on the remote host, start the Emacs Server: @lisp +@group (require 'server) (setq server-host (system-name) server-use-tcp t) (server-start) +@end group @end lisp If @code{(system-name)} of the remote host cannot be resolved on the @@ -3492,8 +3373,10 @@ To make Emacs Client an editor for other programs, use a wrapper script @file{emacsclient.sh}: @example +@group #!/bin/sh emacsclient @trampfn{ssh,$(whoami)@@$(hostname --fqdn),$1} +@end group @end example Then change the environment variable @env{EDITOR} to point to the @@ -3502,7 +3385,6 @@ wrapper script: @example export EDITOR=/path/to/emacsclient.sh @end example -@end ifset @item @@ -3520,8 +3402,7 @@ disable such features. Disable @value{tramp} file name completion: @lisp -(custom-set-variables - '(ido-enable-tramp-completion nil)) +(custom-set-variables '(ido-enable-tramp-completion nil)) @end lisp @item @@ -3539,35 +3420,25 @@ Disable remote directory tracking mode: How to disable @value{tramp}? @itemize @minus -@ifset emacs @item -To keep @value{ftppackagename} as default the remote files access -package, set this in @file{.emacs}: +To keep Ange FTP as default the remote files access package, set this +in @file{.emacs}: @lisp -(setq tramp-default-method "ftp") +(custom-set-variables '(tramp-default-method "ftp" nil (tramp))) @end lisp -@end ifset @item -To disable both -@ifset emacs -@value{tramp} (and @value{ftppackagename}), -@end ifset -@ifset xemacs -@value{tramp}, -@end ifset -set @code{tramp-mode} to @code{nil} in @file{.emacs}. +To disable both @value{tramp} (and Ange FTP), set @code{tramp-mode} to +@code{nil} in @file{.emacs}. @lisp -(setq tramp-mode nil) +(custom-set-variables '(tramp-mode nil nil (tramp))) @end lisp @item -To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}. -@ifset emacs -Unloading @value{tramp} resets @value{ftppackagename} plugins also. -@end ifset +To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}. Unloading +@value{tramp} resets Ange FTP plugins also. @end itemize @end itemize @@ -3578,9 +3449,7 @@ Unloading @value{tramp} resets @value{ftppackagename} plugins also. @menu * Localname deconstruction:: Splitting a localname into its component parts. -@ifset emacs * External packages:: Integrating with external Lisp packages. -@end ifset @end menu @@ -3598,7 +3467,6 @@ file name. By relying on the original handlers for localnames, handlers. -@ifset emacs @node External packages @section Integrating with external Lisp packages @subsection File name completion. @@ -3617,8 +3485,10 @@ the variable @code{non-essential} temporarily and bind it to non-@code{nil} value. @lisp +@group (let ((non-essential t)) @dots{}) +@end group @end lisp @@ -3636,8 +3506,10 @@ situations where callers to @code{process-file} know there are no file attribute changes. The let-bind form to accomplish this: @lisp +@group (let (process-file-side-effects) @dots{}) +@end group @end lisp For asynchronous processes, @value{tramp} uses a process sentinel to @@ -3649,14 +3521,15 @@ sentinel is overwritten. The caller can still flush the file attributes cache in its process sentinel with this code: @lisp +@group (unless (memq (process-status proc) '(run open)) (dired-uncache remote-directory)) +@end group @end lisp 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 @@ -3687,7 +3560,7 @@ set the @code{tramp-verbose} level to 6 (@pxref{Bug Reports}). The debug buffer is in @ifinfo -@ref{Outline Mode, , , @value{emacsdir}}. +@ref{Outline Mode, , , emacs}. @end ifinfo @ifnotinfo Outline Mode. @@ -3696,88 +3569,34 @@ 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 navigation keys are described in -@ref{Outline Visibility, , , @value{emacsdir}}. +@ref{Outline Visibility, , , emacs}. @end ifinfo @value{tramp} handles errors internally. But to get a Lisp backtrace, both the error and the signal have to be set as follows: @lisp +@group (setq debug-on-error t debug-on-signal t) +@end group @end lisp To enable stepping through @value{tramp} function call traces, they have to be specifically enabled as shown in this code: @lisp +@group (require 'trace) (dolist (elt (all-completions "tramp-" obarray 'functionp)) (trace-function-background (intern elt))) (untrace-function 'tramp-read-passwd) -(untrace-function 'tramp-gw-basic-authentication) +@end group @end lisp 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 -@chapter Debatable Issues and What Was Decided - -@itemize @bullet -@item The uuencode method does not always work. - -@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. - -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 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 yet -another syntax though it is okay to learn new extensions. - -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:} 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 - -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}. - -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}. -@end ifset -@end itemize +call traces. Disable @code{tramp-read-passwd} to stop password +strings from being written to @file{*trace-output*}. @node GNU Free Documentation License diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index b12614bae53..2677672444e 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.25.2 +@set trampver 2.3.1 @c Other flags from configuration @set instprefix /usr/local @@ -16,54 +16,29 @@ @set infodir /usr/local/share/info @c Formatting of the tramp program name consistent. -@set tramp @sc{tramp} +@set tramp @sc{Tramp} -@c Whether or not describe GVFS integration. -@ifclear noemacsgvfs -@set emacsgvfs -@end ifclear - -@c Whether or not describe gateway methods. -@ifclear noemacsgw -@set emacsgw -@end ifclear - -@c Some flags which make the text independent on the (X)Emacs flavor. -@c "emacs" resp "xemacs" are set in the Makefile. Default is "emacs". -@ifclear emacs -@ifclear xemacs -@set emacs +@c Some flags which define the remote file name syntax. +@ifclear unified +@ifclear separate +@set unified @end ifclear @end ifclear -@c Emacs values. -@ifset emacs -@set emacsname Emacs -@set emacsdir emacs -@set ftppackagename Ange-FTP +@ifset unified @set prefix / @set prefixhop @set postfix : @set postfixhop : @set ipv6prefix [ @set ipv6postfix ] -@set emacsothername XEmacs -@set emacsotherdir xemacs -@set emacsotherfilename tramp-xemacs.html @end ifset -@c XEmacs counterparts. -@ifset xemacs -@set emacsname XEmacs -@set emacsdir xemacs -@set ftppackagename EFS +@ifset separate @set prefix /[ @set prefixhop [ @set postfix ] @set postfixhop / @set ipv6prefix @set ipv6postfix -@set emacsothername Emacs -@set emacsotherdir emacs -@set emacsotherfilename tramp-emacs.html @end ifset diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 91cb6b54a84..06d2e559c38 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -289,7 +289,7 @@ string or a parsed URL structure. If it is a string, that string is passed through @code{url-encode-url} before using it, to ensure that it is properly URI-encoded (@pxref{URI Encoding}). -@defun url-retrieve-synchronously url silent no-cookies +@defun url-retrieve-synchronously url &optional silent no-cookies timeout This function synchronously retrieves the data specified by @var{url}, and returns a buffer containing the data. The return value is @code{nil} if there is no data associated with the URL (as is the case @@ -297,7 +297,9 @@ for @code{dired}, @code{info}, and @code{mailto} URLs). If the optional argument @var{silent} is non-@code{nil}, progress messages are suppressed. If the optional argument @var{no-cookies} is -non-@code{nil}, cookies are not stored or sent. +non-@code{nil}, cookies are not stored or sent. If the optional +argument @var{timeout} is non-@code{nil}, it should be a number that +says (in seconds) how long to wait for a response before giving up. @end defun @defun url-retrieve url callback &optional cbargs silent no-cookies @@ -421,6 +423,12 @@ cookies, if there are any. You can remove a cookie using the @kbd{C-k} (@code{url-cookie-delete}) command. @end defun +@defun url-cookie-delete-cookies &optional regexp +This function takes a regular expression as its parameters and deletes +all cookies from that domain. If @var{regexp} is @code{nil}, delete +all cookies. +@end defun + @defopt url-cookie-file The file in which cookies are stored, defaulting to @file{cookies} in the directory specified by @code{url-configuration-directory}. @@ -1335,10 +1343,16 @@ Connect directly. @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 +The User Agent string used for sending @acronym{HTTP}/@acronym{HTTPS} +requests. The value should be @code{nil}, which means that no +@samp{User-Agent} header is generated, @code{default}, which means +that a string is generated based on the setting of +@code{url-privacy-leve}, a string or a function of no arguments that +returns a string. + +The default is @code{default}, which means that the +@w{@samp{User-Agent: @var{package-name} URL/Emacs}} string will be +generated, where @var{package-name} is the value of @code{url-package-name} and its version, if they are non-@code{nil}. @end defopt |