commit 80082d00d8ab8803c792751c0019c2f88614f48e (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Wed Aug 17 10:10:47 2016 +0200 Fix Bug#24203 * lisp/comint.el (comint-password-prompt-regexp): Relax regexp. (Bug#24203) diff --git a/lisp/comint.el b/lisp/comint.el index 863374d..0319eeb 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -350,8 +350,8 @@ This variable is buffer-local." t) " +\\)" "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)" - "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\ -\\(?: for [^::៖]+\\)?[::៖]\\s *\\'") + "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?" + "\\(?: for .+\\)?[::៖]\\s *\\'") "Regexp matching prompts for passwords in the inferior process. This is used by `comint-watch-for-password-prompt'." :version "25.2" commit 527bf164bb56d67115ff7fda97c565ee8b0e569f Author: Karl Fogel Date: Tue Aug 16 15:25:52 2016 -0500 Improve doc string. * src/fileio.c (Ffile_name_as_directory): Be precise about the conditions under which a slash is appended. diff --git a/src/fileio.c b/src/fileio.c index 66ea761..37948bc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -508,7 +508,8 @@ This operation exists because a directory is also a file, but its name as a directory is different from its name as a file. The result can be used as the value of `default-directory' or passed as second argument to `expand-file-name'. -For a Unix-syntax file name, just appends a slash. */) +For a Unix-syntax file name, just appends a slash unless a trailing slash +is already present. */) (Lisp_Object file) { char *buf; commit 4b1b8dd80a287ec5e726e0672d94d5399c09b94c Author: Paul Eggert Date: Tue Aug 16 13:16:49 2016 -0700 Omit substitute-command-keys code no longer needed * src/doc.c (Fsubstitute_command_keys): Remove duplicate initializations. diff --git a/src/doc.c b/src/doc.c index 37a731b..4b91831 100644 --- a/src/doc.c +++ b/src/doc.c @@ -743,10 +743,12 @@ Otherwise, return a new string. */) if (NILP (string)) return Qnil; + /* If STRING contains non-ASCII unibyte data, process its + properly-encoded multibyte equivalent instead. This simplifies + the implementation and is OK since substitute-command-keys is + intended for use only on text strings. Keep STRING around, since + it will be returned if no changes occur. */ Lisp_Object str = Fstring_make_multibyte (string); - tem = Qnil; - keymap = Qnil; - name = Qnil; enum text_quoting_style quoting_style = text_quoting_style (); @@ -905,6 +907,8 @@ Otherwise, return a new string. */) } subst_string: + /* Convert non-ASCII unibyte data to properly-encoded multibyte, + for the same reason STRING was converted to STR. */ tem = Fstring_make_multibyte (tem); start = SDATA (tem); length = SCHARS (tem); commit c7119916dc958eeb8e6e2ef50d4a9f262db5be32 Author: Tino Calancha Date: Tue Aug 16 18:18:44 2016 +0900 Allow not erase output buffer in shell commands * lisp/simple.el (shell-command-not-erase-buffer): New option to allow not erasing the output buffer between shell commands. Defaults to nil. (shell-command-on-region): Use it. (shell-command--save-pos-or-erase): New defun; store a buffer position if 'shell-command-not-erase-buffer' is non-nil; otherwise erase the output buffer of the shell command. (shell-command, shell-command-on-region): Use it. (shell-command--set-point-after-cmd): New defun; if 'shell-command-not-erase-buffer' is non-nil, set point in the output buffer to the position in 'shell-command-saved-pos'. (shell-command-sentinel, shell-command-on-region): Use it. * doc/emacs/misc.texi (shell-command-not-erase-buffer): Document this feature in the manual. ; * etc/NEWS: Add entry for this new feature. See discussion on: http://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00610.html diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 94e1f19..acddb7a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -771,6 +771,14 @@ the output buffer. But if you change the value of the variable @code{shell-command-default-error-buffer} to a string, error output is inserted into a buffer of that name. +@vindex shell-command-not-erase-buffer + By default, the output buffer is erased between shell commands. +If you change the value of the variable +@code{shell-command-not-erase-buffer} to a non-@code{nil} value, +the output buffer is not erased. This variable also controls where to +set the point in the output buffer after the command completes; see the +documentation of the variable for details. + @node Interactive Shell @subsection Interactive Subshell diff --git a/etc/NEWS b/etc/NEWS index d62dcac..8a13d52 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,6 +56,16 @@ affected by this, as SGI stopped supporting IRIX in December 2013. * Changes in Emacs 25.2 +++ +** The new user option 'shell-command-not-erase-buffer' controls +if the output buffer is erased between shell commands; if non-nil, +the output buffer is not erased; this variable also controls where +to set the point in the output buffer: beginning of the output, +end of the buffer or save the point. +When 'shell-command-not-erase-buffer' is nil, the default value, +the behaviour of 'shell-command', 'shell-command-on-region' and +'async-shell-command' is as usual. + ++++ ** The new user option 'mouse-select-region-move-to-beginning' controls the position of point when double-clicking mouse-1 on the end of a parenthetical grouping or string-delimiter: the default value nil diff --git a/lisp/simple.el b/lisp/simple.el index e91b6e0..f77c9f8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -37,6 +37,27 @@ (defvar compilation-current-error) (defvar compilation-context-lines) +(defcustom shell-command-not-erase-buffer nil + "If non-nil, output buffer is not erased between shell commands. +Also, a non-nil value set the point in the output buffer +once the command complete. +The value `beg-last-out' set point at the beginning of the output, +`end-last-out' set point at the end of the buffer, `save-point' +restore the buffer position before the command." + :type '(choice + (const :tag "Erase buffer" nil) + (const :tag "Set point to beginning of last output" beg-last-out) + (const :tag "Set point to end of last output" end-last-out) + (const :tag "Save point" save-point)) + :group 'shell + :version "25.2") + +(defvar shell-command-saved-pos nil + "Point position in the output buffer after command complete. +It is an alist (BUFFER . POS), where BUFFER is the output +buffer, and POS is the point position in BUFFER once the command finish. +This variable is used when `shell-command-not-erase-buffer' is non-nil.") + (defcustom idle-update-delay 0.5 "Idle time delay before updating various things on the screen. Various Emacs features that update auxiliary information when point moves @@ -3210,6 +3231,53 @@ output buffer and running a new command in the default buffer, :group 'shell :version "24.3") +(defun shell-command--save-pos-or-erase () + "Store a buffer position or erase the buffer. +See `shell-command-not-erase-buffer'." + (let ((sym shell-command-not-erase-buffer) + pos) + (setq buffer-read-only nil) + ;; Setting buffer-read-only to nil doesn't suffice + ;; if some text has a non-nil read-only property, + ;; which comint sometimes adds for prompts. + (setq pos + (cond ((eq sym 'save-point) (point)) + ((eq sym 'beg-last-out) (point-max)) + ((not sym) + (let ((inhibit-read-only t)) + (erase-buffer) nil)))) + (when pos + (goto-char (point-max)) + (push (cons (current-buffer) pos) + shell-command-saved-pos)))) + +(defun shell-command--set-point-after-cmd (&optional buffer) + "Set point in BUFFER after command complete. +BUFFER is the output buffer of the command; if nil, then defaults +to the current BUFFER. +Set point to the `cdr' of the element in `shell-command-saved-pos' +whose `car' is BUFFER." + (when shell-command-not-erase-buffer + (let* ((sym shell-command-not-erase-buffer) + (buf (or buffer (current-buffer))) + (pos (alist-get buf shell-command-saved-pos))) + (setq shell-command-saved-pos + (assq-delete-all buf shell-command-saved-pos)) + (when (buffer-live-p buf) + (let ((win (car (get-buffer-window-list buf))) + (pmax (with-current-buffer buf (point-max)))) + (unless (and pos (memq sym '(save-point beg-last-out))) + (setq pos pmax)) + ;; Set point in the window displaying buf, if any; otherwise + ;; display buf temporary in selected frame and set the point. + (if win + (set-window-point win pos) + (save-window-excursion + (let ((win (display-buffer + buf + '(nil (inhibit-switch-frame . t))))) + (set-window-point win pos))))))))) + (defun async-shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND asynchronously in background. @@ -3271,7 +3339,8 @@ Noninteractive callers can specify coding systems by binding The optional second argument OUTPUT-BUFFER, if non-nil, says to put the output in some other buffer. If OUTPUT-BUFFER is a buffer or buffer name, erase that buffer -and insert the output there. +and insert the output there; a non-nil value of +`shell-command-not-erase-buffer' prevent to erase the buffer. If OUTPUT-BUFFER is not a buffer and not nil, insert the output in current buffer after point leaving mark after it. This cannot be done asynchronously. @@ -3408,13 +3477,8 @@ the use of a shell (with its need to quote arguments)." (setq buffer (get-buffer-create (or output-buffer "*Async Shell Command*")))))) (with-current-buffer buffer - (setq buffer-read-only nil) - ;; Setting buffer-read-only to nil doesn't suffice - ;; if some text has a non-nil read-only property, - ;; which comint sometimes adds for prompts. - (let ((inhibit-read-only t)) - (erase-buffer)) (display-buffer buffer '(nil (allow-no-window . t))) + (shell-command--save-pos-or-erase) (setq default-directory directory) (setq proc (start-process "Shell" buffer shell-file-name shell-command-switch command)) @@ -3497,12 +3561,14 @@ and are only used if a pop-up buffer is displayed." ;; We have a sentinel to prevent insertion of a termination message -;; in the buffer itself. +;; in the buffer itself, and to set the point in the buffer when +;; `shell-command-not-erase-buffer' is non-nil. (defun shell-command-sentinel (process signal) - (if (memq (process-status process) '(exit signal)) - (message "%s: %s." - (car (cdr (cdr (process-command process)))) - (substring signal 0 -1)))) + (when (memq (process-status process) '(exit signal)) + (shell-command--set-point-after-cmd (process-buffer process)) + (message "%s: %s." + (car (cdr (cdr (process-command process)))) + (substring signal 0 -1)))) (defun shell-command-on-region (start end command &optional output-buffer replace @@ -3536,7 +3602,8 @@ appears at the end of the output. Optional fourth arg OUTPUT-BUFFER specifies where to put the command's output. If the value is a buffer or buffer name, -erase that buffer and insert the output there. +erase that buffer and insert the output there; a non-nil value of +`shell-command-not-erase-buffer' prevent to erase the buffer. If the value is nil, use the buffer `*Shell Command Output*'. Any other non-nil value means to insert the output in the current buffer after START. @@ -3616,7 +3683,10 @@ interactively, this is t." (let ((buffer (get-buffer-create (or output-buffer "*Shell Command Output*")))) (unwind-protect - (if (eq buffer (current-buffer)) + (if (and (eq buffer (current-buffer)) + (or (not shell-command-not-erase-buffer) + (and (not (eq buffer (get-buffer "*Shell Command Output*"))) + (not (region-active-p))))) ;; If the input is the same buffer as the output, ;; delete everything but the specified region, ;; then replace that region with the output. @@ -3635,10 +3705,9 @@ interactively, this is t." ;; output there. (let ((directory default-directory)) (with-current-buffer buffer - (setq buffer-read-only nil) (if (not output-buffer) (setq default-directory directory)) - (erase-buffer))) + (shell-command--save-pos-or-erase))) (setq exit-status (call-process-region start end shell-file-name nil (if error-file @@ -3656,8 +3725,10 @@ interactively, this is t." (format " - Exit [%d]" exit-status))))) (if (with-current-buffer buffer (> (point-max) (point-min))) ;; There's some output, display it - (display-message-or-buffer buffer) - ;; No output; error? + (progn + (display-message-or-buffer buffer) + (shell-command--set-point-after-cmd buffer)) + ;; No output; error? (let ((output (if (and error-file (< 0 (nth 7 (file-attributes error-file)))) commit 5783984787998f8222d66338efa61f0741466a54 Author: Michael Albinus Date: Tue Aug 16 09:48:24 2016 +0200 Rearrange Tramp manual title page * doc/misc/tramp.texi: Move @insertcopying out of the title page. Do not use @ifnottex anymore. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 5e04a2d..8a144a5 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -58,14 +58,11 @@ copy and modify this GNU manual.'' @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 @@ -99,8 +96,8 @@ There is a mailing list for @value{tramp}, available at @uref{http://lists.gnu.org/archive/html/tramp-devel/, the @value{tramp} Mail Archive}. +@page @insertcopying -@end ifnottex @menu * Overview:: What @value{tramp} can and cannot do. commit 126f95a708d637941e9eae1b023a87733bb5fd38 Author: Glenn Morris Date: Mon Aug 15 12:48:01 2016 -0400 * doc/misc/tramp.texi: Adapt 2016-08-14 change for makeinfo 4. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index d64d5e5..5e04a2d 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -65,8 +65,8 @@ copy and modify this GNU manual.'' @contents -@node Top, Overview, (dir), (dir) @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 commit 15c16a5d3b45c95bcb0855b607f975310a707ee1 Author: Alan Mackenzie Date: Mon Aug 15 16:22:36 2016 +0000 Fix minor bug in c-syntactic-re-search-forward. Bug was: when NOERROR is neither nil nor t, BOUND is non-nil, PAREN-LEVEL is non-nil, and the first internal search attempt fails, point wrongly ends up at BOUND, rather than just before the next closing paren. * lisp/progmodes/cc-engine.el (c-syntactic-re-search-forward): Guard against the above situation. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 4a29896..625e87f 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -4337,7 +4337,19 @@ comment at the start of cc-engine.el for more info." (and (progn (setq search-pos (point)) - (re-search-forward regexp bound noerror)) + (if (re-search-forward regexp bound noerror) + t + ;; Without the following, when PAREN-LEVEL it non-nil, and + ;; NOERROR is not nil or t, and the very first search above + ;; has just failed, point would end up at BOUND rather than + ;; just before the next close paren. + (when (and (eq search-pos start) + paren-level + (not (memq noerror '(nil t)))) + (setq state (parse-partial-sexp start bound -1)) + (if (eq (car state) -1) + (setq bound (1- (point))))) + nil)) (progn (setq state (parse-partial-sexp commit ce1ed9c8116e280c69f04a455176f6097ca0855c Author: Alan Mackenzie Date: Mon Aug 15 11:52:32 2016 +0000 Handle C++11 lambda functions. * lisp/progmodes/cc-engine.el (c-looking-at-inexpr-block): Enhance also to handle C++ lambda functions. (c-looking-at-c++-lambda-capture-list): New function. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize the parameter list of a lambda function and set `context' and `c-restricted-<>-arglists' suitably for it. (c-font-lock-c++-lambda-captures): New function. (c-complex-decl-matchers): Insert c-font-lock-c++-lambda-captures into it. * lisp/progmodes/cc-langs.el (c-pre-lambda-tokens, c-pre-lambda-tokens-re): New language constants/variables. (c-paren-nontype-kwds): Include "noexcept" in the C++ value. * lisp/progmodes/cc-mode.el (c-fl-decl-start): Handle being in a C++ lambda function capture list. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index e22b98d..4a29896 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10005,12 +10005,27 @@ comment at the start of cc-engine.el for more info." ;; This function might do hidden buffer changes. (save-excursion - (let ((res 'maybe) passed-paren + (let ((res 'maybe) (passed-bracket-pairs 0) bracket-pos passed-paren + haskell-op-pos (closest-lim (or containing-sexp lim (point-min))) ;; Look at the character after point only as a last resort ;; when we can't disambiguate. (block-follows (and (eq (char-after) ?{) (point)))) + ;; Search for a C++11 "->" which suggests a lambda declaration. + (when (and (c-major-mode-is 'c++-mode) + (setq haskell-op-pos + (save-excursion + (while + (progn + (c-syntactic-skip-backward "^;=}>" closest-lim t) + (and (eq (char-before) ?>) + (c-backward-token-2) + (not (looking-at c-haskell-op-re))))) + (and (looking-at c-haskell-op-re) + (point))))) + (goto-char haskell-op-pos)) + (while (and (eq res 'maybe) (progn (c-backward-syntactic-ws) (> (point) closest-lim)) @@ -10048,6 +10063,11 @@ comment at the start of cc-engine.el for more info." (zerop (c-forward-token-2 1 t))) (eq (char-after) ?\()))) (cons 'inexpr-class (point)))) + ((c-keyword-member kw-sym 'c-paren-any-kwds) ; e.g. C++11 "throw" or "noexcept" + (setq passed-paren nil) + (setq passed-bracket-pairs 0) + (setq bracket-pos nil) + 'maybe) ((c-keyword-member kw-sym 'c-inexpr-block-kwds) (when (not passed-paren) (cons 'inexpr-statement (point)))) @@ -10062,20 +10082,49 @@ comment at the start of cc-engine.el for more info." (if (looking-at "\\s(") (if passed-paren - (if (and (eq passed-paren ?\[) - (eq (char-after) ?\[)) - ;; Accept several square bracket sexps for - ;; Java array initializations. - 'maybe) - (setq passed-paren (char-after)) + (cond + ((and (eq passed-paren ?\[) + (eq (char-after) ?\[) + (not (eq (char-after (1+ (point))) ?\[))) ; C++ attribute. + ;; Accept several square bracket sexps for + ;; Java array initializations. + (setq passed-bracket-pairs (1+ passed-bracket-pairs)) + 'maybe) + ((and (eq passed-paren ?\() + (eq (char-after) ?\[) + (not (eq (char-after (1+ (point))) ?\[)) + (eq passed-bracket-pairs 0)) + ;; C++11 lambda function declaration + (setq passed-bracket-pairs 1) + (setq bracket-pos (point)) + 'maybe) + (t nil)) + (when (not (looking-at "\\[\\[")) + (setq passed-paren (char-after)) + (when (eq passed-paren ?\[) + (setq passed-bracket-pairs 1) + (setq bracket-pos (point)))) 'maybe) 'maybe)))) (if (eq res 'maybe) - (when (and c-recognize-paren-inexpr-blocks - block-follows - containing-sexp - (eq (char-after containing-sexp) ?\()) + (cond + ((and (c-major-mode-is 'c++-mode) + block-follows + (eq passed-bracket-pairs 1) + (save-excursion + (goto-char bracket-pos) + (or (<= (point) (or lim (point-min))) + (progn + (c-backward-token-2 1 nil lim) + (and + (not (c-on-identifier)) + (not (looking-at c-opt-op-identifier-prefix))))))) + (cons 'inlambda bracket-pos)) + ((and c-recognize-paren-inexpr-blocks + block-follows + containing-sexp + (eq (char-after containing-sexp) ?\()) (goto-char containing-sexp) (if (or (save-excursion (c-backward-syntactic-ws lim) @@ -10089,7 +10138,7 @@ comment at the start of cc-engine.el for more info." (and c-special-brace-lists (c-looking-at-special-brace-list))) nil - (cons 'inexpr-statement (point)))) + (cons 'inexpr-statement (point))))) res)))) @@ -10115,6 +10164,18 @@ comment at the start of cc-engine.el for more info." paren-state) containing-sexp))))) +(defun c-looking-at-c++-lambda-capture-list () + ;; Return non-nil if we're at the opening "[" of the capture list of a C++ + ;; lambda function, nil otherwise. + (and + (eq (char-after) ?\[) + (not (eq (char-before) ?\[)) + (not (eq (char-after (1+ (point))) ?\[)) + (save-excursion + (or (eq (c-backward-token-2 1) 1) + (looking-at c-pre-lambda-tokens-re))) + (not (c-in-literal)))) + (defun c-at-macro-vsemi-p (&optional pos) ;; Is there a "virtual semicolon" at POS or point? ;; (See cc-defs.el for full details of "virtual semicolons".) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index b45686c..ae18d0a 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1242,6 +1242,20 @@ casts and declarations are fontified. Used on level 2 and higher." ((eq type 'c-decl-arg-start) (setq context 'decl c-restricted-<>-arglists nil)) + ;; Inside a C++11 lambda function arglist. + ((and (c-major-mode-is 'c++-mode) + (eq (char-before match-pos) ?\() + (save-excursion + (goto-char match-pos) + (c-backward-token-2) + (and + (c-safe (goto-char (scan-sexps (point) -1))) + (c-looking-at-c++-lambda-capture-list)))) + (setq context 'decl + c-restricted-<>-arglists nil) + (c-put-char-property (1- match-pos) 'c-type + 'c-decl-arg-start)) + ;; Inside an angle bracket arglist. ((or (eq type 'c-<>-arg-sep) (eq (char-before match-pos) ?<)) @@ -1583,6 +1597,90 @@ casts and declarations are fontified. Used on level 2 and higher." (setq raw-id (match-string-no-properties 2))))))))) nil) +(defun c-font-lock-c++-lambda-captures (limit) + ;; Fontify the lambda capture component of C++ lambda declarations. + ;; + ;; This function will be called from font-lock for a region bounded by POINT + ;; and LIMIT, as though it were to identify a keyword for + ;; font-lock-keyword-face. It always returns NIL to inhibit this and + ;; prevent a repeat invocation. See elisp/lispref page "Search-based + ;; Fontification". + (let (mode capture-default id-start id-end declaration sub-begin sub-end) + (while (and (< (point) limit) + (search-forward "[" limit t)) + (when (progn (backward-char) + (prog1 + (c-looking-at-c++-lambda-capture-list) + (forward-char))) + (c-forward-syntactic-ws) + (setq mode (and (memq (char-after) '(?= ?&)) + (char-after))) + ;; Is the first element of the list a bare "=" or "&"? + (when mode + (forward-char) + (c-forward-syntactic-ws) + (if (memq (char-after) '(?, ?\])) + (progn + (setq capture-default mode) + (when (eq (char-after) ?,) + (forward-char) + (c-forward-syntactic-ws))) + (c-backward-token-2))) + + ;; Go round the following loop once per captured item. + (while (and (not (eq (char-after) ?\])) + (< (point) limit)) + (if (eq (char-after) ?&) + (progn (setq mode ?&) + (forward-char) + (c-forward-syntactic-ws)) + (setq mode ?=)) + (if (c-on-identifier) + (progn + (setq id-start (point)) + (forward-char) + (c-end-of-current-token) + (setq id-end (point)) + (c-forward-syntactic-ws) + + (setq declaration (eq (char-after) ?=)) + (when declaration + (forward-char) ; over "=" + (c-forward-syntactic-ws) + (setq sub-begin (point))) + (if (or (and (< (point) limit) + (c-syntactic-re-search-forward "," limit t t)) + (and (c-go-up-list-forward nil limit) + (eq (char-before) ?\]))) + (backward-char) + (goto-char limit)) + (when declaration + (save-excursion + (setq sub-end (point)) + (goto-char sub-begin) + (c-font-lock-c++-lambda-captures sub-end))) + + (c-put-font-lock-face id-start id-end + (cond + (declaration + 'font-lock-variable-name-face) + ((and capture-default + (eq mode capture-default)) + 'font-lock-warning-face) + ((eq mode ?=) font-lock-constant-face) + (t 'font-lock-variable-name-face)))) + (c-syntactic-re-search-forward "," limit 'bound t)) + + (c-forward-syntactic-ws) + (when (eq (char-after) ?,) + (forward-char) + (c-forward-syntactic-ws))) + + (setq capture-default nil) + (forward-char)))) ; over the terminating "]". + nil) + + (c-lang-defconst c-simple-decl-matchers "Simple font lock matchers for types and declarations. These are used on level 2 only and so aren't combined with `c-complex-decl-matchers'." @@ -1700,6 +1798,9 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'." ,@(when (c-lang-const c-recognize-<>-arglists) `(c-font-lock-<>-arglists)) + ,@(when (c-major-mode-is 'c++-mode) + `(c-font-lock-c++-lambda-captures)) + ;; The first two rules here mostly find occurrences that ;; `c-font-lock-declarations' has found already, but not ;; declarations containing blocks in the type (see note below). diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index ec894f6..934186d 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -474,6 +474,7 @@ so that all identifiers are recognized as words.") ;; The value here may be a list of functions or a single function. t nil c++ '(c-extend-region-for-CPP +; c-before-after-change-extend-region-for-lambda-capture ; doesn't seem needed. c-before-change-check-raw-strings c-before-change-check-<>-operators c-depropertize-CPP @@ -517,6 +518,7 @@ parameters \(point-min) and \(point-max).") c-change-expand-fl-region) c++ '(c-depropertize-new-text c-extend-font-lock-region-for-macros +; c-before-after-change-extend-region-for-lambda-capture ; doens't seem needed. c-before-after-change-digit-quote c-after-change-re-mark-raw-strings c-neutralize-syntax-in-and-mark-CPP @@ -1360,6 +1362,25 @@ operators." t '(";" "{" "}")) (c-lang-defvar c-pre-start-tokens (c-lang-const c-pre-start-tokens)) +(c-lang-defconst c-pre-lambda-tokens + "List of tokens which may precede a lambda declaration. +In C++ this is something like \"[a,b] (foo, bar) -> int { ... };\". +Currently (2016-08) only used in C++ mode." + t (c--set-difference + (c--delete-duplicates + (append (c-lang-const c-operator-list) + (c-lang-const c-other-op-syntax-tokens))) + (append + '("#" "%:" "??=" "##" "%:%:" "??=??=" "::" "." "->" + "]" "<:" ":>" "??(" "??)" "??-" "new" "delete" + ")" ".*" "->*" "??'" "??!" "??!??!" "??!=" "??'=") + '("<%" "%>" "<:" ":>" "%:" "%:%:" "#" "##" "::" "...")) + :test #'string-equal)) + +(c-lang-defconst c-pre-lambda-tokens-re + ;; Regexp matching any token in the list `c-pre-lambda-tokens'. + t (regexp-opt (c-lang-const c-pre-lambda-tokens))) +(c-lang-defvar c-pre-lambda-tokens-re (c-lang-const c-pre-lambda-tokens-re)) ;;; Syntactic whitespace. @@ -2284,7 +2305,8 @@ contain type identifiers." (c c++) '(;; GCC extension. "__attribute__" ;; MSVC extension. - "__declspec")) + "__declspec") + c++ (append (c-lang-const c-paren-nontype-kwds) '("noexcept"))) (c-lang-defconst c-paren-nontype-key t (c-make-keywords-re t (c-lang-const c-paren-nontype-kwds))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 0747601..f630b05 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1142,6 +1142,38 @@ Note that the style variables are always made local to the buffer." (goto-char try-end) (setq num-begin (point))))) +;; The following doesn't seem needed at the moment (2016-08-15). +;; (defun c-before-after-change-extend-region-for-lambda-capture +;; (_beg _end &optional _old-len) +;; ;; In C++ Mode, extend the region (c-new-BEG c-new-END) to cover any lambda +;; ;; function capture lists we happen to be inside. This function is expected +;; ;; to be called both as a before-change and after change function. +;; ;; +;; ;; Note that these things _might_ be nested, with a capture list looking +;; ;; like: +;; ;; +;; ;; [ ...., &foo = [..](){...}(..), ... ] +;; ;; +;; ;; . What a wonderful language is C++. ;-) +;; (c-save-buffer-state (paren-state pos) +;; (goto-char c-new-BEG) +;; (setq paren-state (c-parse-state)) +;; (while (setq pos (c-pull-open-brace paren-state)) +;; (goto-char pos) +;; (when (c-looking-at-c++-lambda-capture-list) +;; (setq c-new-BEG (min c-new-BEG pos)) +;; (if (c-go-list-forward) +;; (setq c-new-END (max c-new-END (point)))))) + +;; (goto-char c-new-END) +;; (setq paren-state (c-parse-state)) +;; (while (setq pos (c-pull-open-brace paren-state)) +;; (goto-char pos) +;; (when (c-looking-at-c++-lambda-capture-list) +;; (setq c-new-BEG (min c-new-BEG pos)) +;; (if (c-go-list-forward) +;; (setq c-new-END (max c-new-END (point)))))))) + (defun c-before-change (beg end) ;; Function to be put on `before-change-functions'. Primarily, this calls ;; the language dependent `c-get-state-before-change-functions'. It is @@ -1329,12 +1361,24 @@ Note that the style variables are always made local to the buffer." ;; lock context (etc.) fontification. (let ((lit-start (c-literal-start)) (new-pos pos) + capture-opener bod-lim bo-decl) (goto-char (c-point 'bol new-pos)) (when lit-start ; Comment or string. (goto-char lit-start)) (setq bod-lim (c-determine-limit 500)) + ;; In C++ Mode, first check if we are within a (possibly nested) lambda + ;; form capture list. + (when (c-major-mode-is 'c++-mode) + (let ((paren-state (c-parse-state)) + opener) + (save-excursion + (while (setq opener (c-pull-open-brace paren-state)) + (goto-char opener) + (if (c-looking-at-c++-lambda-capture-list) + (setq capture-opener (point))))))) + (while ;; Go to a less nested declaration each time round this loop. (and @@ -1361,6 +1405,8 @@ Note that the style variables are always made local to the buffer." c-<-as-paren-syntax))))) (not (bobp))) (backward-char)) ; back over (, [, <. + (when (and capture-opener (< capture-opener new-pos)) + (setq new-pos capture-opener)) (and (/= new-pos pos) new-pos))) (defun c-change-expand-fl-region (_beg _end _old-len) commit 9c2ce57719d0db8ac0a01b65d7e8d7ccc3f2d6ca Author: Michael Albinus Date: Mon Aug 15 12:29:20 2016 +0200 Fix stale cache problem in Tramp * lisp/net/tramp-cache.el (tramp-get-connection-property): Check, that a process as key is still running. (Bug#22478) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 07176be..76b49a0 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -237,9 +237,14 @@ connection, returns DEFAULT." (aset key 3 nil) (aset key 4 nil)) (let* ((hash (tramp-get-hash-table key)) - (value (if (hash-table-p hash) - (gethash property hash default) - default))) + (value + ;; If the key is an auxiliary process object, check whether + ;; the process is still alive. + (if (and (processp key) (not (memq (process-status key) '(run open)))) + default + (if (hash-table-p hash) + (gethash property hash default) + default)))) (tramp-message key 7 "%s %s" property value) value)) commit 9c2ea5cdd626f011cb535824223e49e5bdb20146 Author: Paul Eggert Date: Sun Aug 14 15:05:22 2016 -0500 * doc/misc/tramp.texi (Configuration): Fix @xref typo. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 3160ba3..d64d5e5 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -433,8 +433,8 @@ 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, @xref{Default Method}, @xref{Default User}, @xref{Default Host}. -For problems related to the behavior of remote shell, @xref{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, @xref{Connection types}. commit 7aaeb86f8ceea761abc6e693a0d25bea29241a10 Author: Eli Zaretskii Date: Sun Aug 14 21:25:52 2016 +0300 Another fix for scroll-conservatively and overlay strings * src/xdisp.c (redisplay_window): Handle also the case where the calculated window-start point has an overlay string touching it. (Bug#24179) diff --git a/src/xdisp.c b/src/xdisp.c index a8376af..5eaa809 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -16957,7 +16957,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) try_window (window, it.current.pos, 0); } else if (scroll_conservatively > SCROLL_LIMIT - && it.method == GET_FROM_STRING + && (it.method == GET_FROM_STRING + || overlay_touches_p (IT_CHARPOS (it))) && IT_CHARPOS (it) < ZV) { /* If the window starts with a before-string that spans more @@ -16973,7 +16974,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) clear_glyph_matrix (w->desired_matrix); do { move_it_by_lines (&it, 1); - } while (IT_CHARPOS (it) == pos0 && it.method == GET_FROM_STRING); + } while (IT_CHARPOS (it) == pos0); try_window (window, it.current.pos, 0); } else commit 59720dc1379bb0e0c4a78930fac7f48740780c80 Author: Michael Albinus Date: Sun Aug 14 13:31:07 2016 +0200 Improve handling of defcustoms in tramp * doc/misc/tramp.texi: Protect all multi-line examples by @group ... @end group. Use proper `custom-set-variables' examples. Use consequently @option for user options. Remove superfluous @cindex and @vindex entries. (Top): Remove reference to outdated mail archives. (Configuration): Tune references. (Default Method): Make `tramp-default-method' and `tramp-default-method-alist' a @defopt. (Default User): Make `tramp-default-user' and `tramp-default-user-alist' a @defopt. (Default Host): Make `tramp-default-host' and `tramp-default-host-alist' a @defopt. * lisp/net/tramp.el (tramp-mode, tramp-verbose) (tramp-backup-directory-alist, tramp-auto-save-directory) (tramp-encoding-shell, tramp-encoding-command-switch) (tramp-encoding-command-interactive, tramp-default-method) (tramp-default-method-alist, tramp-default-user) (tramp-default-user-alist, tramp-default-host) (tramp-default-host-alist, tramp-default-proxies-alist) (tramp-save-ad-hoc-proxies) (tramp-restricted-shell-hosts-alist) (tramp-local-end-of-line, tramp-rsh-end-of-line) (tramp-login-prompt-regexp, tramp-shell-prompt-pattern) (tramp-password-prompt-regexp, tramp-wrong-passwd-regexp) (tramp-yesno-prompt-regexp, tramp-yn-prompt-regexp) (tramp-terminal-prompt-regexp) (tramp-operation-not-permitted-regexp) (tramp-copy-failed-regexp, tramp-process-alive-regexp) (tramp-syntax, tramp-chunksize) (tramp-process-connection-type, tramp-connection-timeout) (tramp-connection-min-time-diff) (tramp-completion-reread-directory-timeout): * lisp/net/tramp-adb.el (tramp-adb-program) (tramp-adb-connect-if-not-connected, tramp-adb-prompt): * lisp/net/tramp-cache.el (tramp-connection-properties) (tramp-persistency-file-name): * lisp/net/tramp-gvfs.el (tramp-gvfs-methods) (tramp-gvfs-zeroconf-domain) (tramp-bluez-discover-devices-timeout): * lisp/net/tramp-sh.el (tramp-inline-compress-start-size) (tramp-copy-size-limit, tramp-terminal-type) (tramp-histfile-override) (tramp-use-ssh-controlmaster-options, tramp-remote-path) (tramp-remote-process-environment, tramp-sh-extra-args): * lisp/net/tramp-smb.el (tramp-smb-program, tramp-smb-acl-program) (tramp-smb-conf, tramp-smb-winexe-program) (tramp-smb-winexe-shell-command) (tramp-smb-winexe-shell-command-switch): Add :require 'tramp. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 3751828..3160ba3 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -12,9 +12,6 @@ @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 @@ -69,9 +66,9 @@ copy and modify this GNU manual.'' @node Top, Overview, (dir), (dir) +@ifnottex @top @value{tramp} version @value{trampver} User Manual -@ifnottex This file documents @value{tramp} version @value{trampver}, a remote file editing package for Emacs. @@ -101,15 +98,6 @@ 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 @insertcopying @end ifnottex @@ -356,16 +344,20 @@ navigation bar at the top. Another way is to follow the terminal session below: @example +@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 @@ -383,8 +375,10 @@ containing the latest version of @value{tramp}. To fetch updates from the repository, use git pull: @example +@group ] @strong{cd ~/emacs/tramp} ] @strong{git pull} +@end group @end example @noindent @@ -392,8 +386,10 @@ Run @command{autoconf} as follows to generate an up-to-date @file{configure} script: @example +@group ] @strong{cd ~/emacs/tramp} ] @strong{autoconf} +@end group @end example @@ -434,22 +430,24 @@ XEmacs support has been stopped in January 2016. @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}. +file name @file{@trampf{user@@host,/path/to.file}}. For details, +@xref{Default Method}, @xref{Default User}, @xref{Default Host}. -For problems related to the behavior of remote shell, see @ref{Remote +For problems related to the behavior of remote shell, @xref{Remote shell setup} for details. For changing the connection type and file access method from the -defaults to one of several other options, see (@pxref{Connection -types}). +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 Emacs. 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,11 +489,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. @@ -544,8 +537,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} @@ -891,13 +885,13 @@ 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 Emacs. @@ -999,9 +993,8 @@ 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}, +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 @@ -1055,21 +1048,22 @@ specified otherwise. @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} @@ -1078,22 +1072,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 @@ -1145,83 +1135,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 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 Emacs is running. Both the default user -and default host can be overridden as follows: +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}. @strong{Note} @samp{/::} won't work, because @samp{/:} is the prefix for quoted file names. +@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 @@ -1237,10 +1235,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 @@ -1259,10 +1256,12 @@ 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 @@ -1273,10 +1272,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 @@ -1287,8 +1288,10 @@ 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 @@ -1306,16 +1309,18 @@ 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. -@code{tramp-default-proxies-alist} is also used for passing through +@option{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 @@ -1329,9 +1334,11 @@ such a port, like 443 (https). See discussion of ethical issues.} Then the configuration is: @lisp +@group (add-to-list 'tramp-default-proxies-alist '("\\`host\\.other\\.domain\\'" nil "@trampfn{tunnel,proxy.your.domain#3128,}")) +@end group @end lisp Gateway methods in a multiple hop chain can be declared only as the first hop. @@ -1342,7 +1349,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. @@ -1351,8 +1357,10 @@ 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 @@ -1391,10 +1399,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 @@ -1404,12 +1414,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 @@ -1431,7 +1443,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. @@ -1445,7 +1457,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 @@ -1485,9 +1497,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 @@ -1535,14 +1549,12 @@ 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 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. @@ -1552,17 +1564,17 @@ Set @code{password-cache} to @code{nil} to disable password caching. @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 +The default file name for @option{tramp-persistency-file-name} is @file{~/.emacs.d/tramp}. @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, @@ -1589,11 +1601,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 @@ -1602,12 +1615,17 @@ string @samp{} 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 @@ -1615,15 +1633,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 @@ -1642,12 +1662,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 @@ -1664,11 +1682,12 @@ 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 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) @@ -1712,42 +1731,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 @@ -1756,8 +1780,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 @@ -1765,26 +1789,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 @@ -1845,10 +1874,12 @@ 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 @@ -1871,9 +1902,12 @@ 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 @@ -1900,8 +1934,10 @@ 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 @@ -1913,8 +1949,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 @@ -1934,10 +1972,12 @@ 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 @@ -1945,8 +1985,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 @@ -1962,7 +2004,7 @@ Open a remote connection with a more concise command @kbd{C-x C-f To avoid @value{tramp} from saving backup files owned by @samp{root} to locations accessible to others, default backup settings in -@code{backup-directory-alist} have to be altered. +@option{backup-directory-alist} have to be altered. Here's a scenario where files could be inadvertently exposed. Emacs by default writes backup files to the same directory as the original @@ -1973,15 +2015,17 @@ default by @value{tramp} when using, say, a restricted file of the secretfile is now owned by the user logged in from @value{tramp} and not @samp{root}. -When @code{backup-directory-alist} is @code{nil} (the default), such +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: @lisp +@group (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil)) +@end group @end lisp @noindent @@ -1989,6 +2033,7 @@ 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) @@ -1996,14 +2041,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 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 @code{tramp-backup-directory-alist} from the -existing variable @code{backup-directory-alist}. +@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 @@ -2013,9 +2059,12 @@ happens only when the DIRECTORY is an absolute local file name. Example: @lisp +@group (add-to-list 'backup-directory-alist (cons "." "~/.emacs.d/backups/")) -(setq tramp-backup-directory-alist backup-directory-alist) +(custom-set-variables + '(tramp-backup-directory-alist backup-directory-alist 6 nil (tramp))) +@end group @end lisp @noindent @@ -2030,17 +2079,17 @@ The backup file name of Just as for backup files, similar issues of file naming affect auto-saving @value{tramp} files. 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 Emacs was compiled. -Reset such values to a valid directory. +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 @code{auto-save-file-name-transforms} to @code{nil} to save +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. +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 @@ -2206,11 +2255,13 @@ 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 @item @value{prefixhop}telnet@value{postfixhop} @tab tmp/ @item @value{prefixhop}toto@value{postfix} @tab @end multitable +@end group @end example @samp{@value{prefixhop}telnet@value{postfixhop}} is a possible @@ -2225,6 +2276,7 @@ Type @kbd{e @key{TAB}} for the minibuffer completion to 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,} @@ -2232,6 +2284,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 @@ -2257,6 +2310,7 @@ stands for the default behavior. Example: @example +@group @kbd{C-x C-f @trampfn{telnet,melancholia,/usr/local/bin//etc} @key{TAB}} @print{} @trampfn{telnet,melancholia,/etc} @@ -2265,6 +2319,7 @@ Example: @kbd{C-x C-f @trampfn{telnet,melancholia,/usr/local/bin///etc} @key{TAB}} @print{} /etc +@end group @end example During file name completion, remote directory contents are re-read @@ -2274,10 +2329,10 @@ 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 @@ -2287,7 +2342,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 @@ -2304,19 +2359,18 @@ 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 Emacs 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 Emacs sessions, set -@option{tramp-save-ad-hoc-proxies}. +@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 @@ -2338,9 +2392,11 @@ 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 Remote processes do not apply to GVFS (see @ref{GVFS based methods}) @@ -2356,16 +2412,18 @@ 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}. @@ -2381,17 +2439,19 @@ 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} environment variable. To accommodate such restrictions when using @value{tramp}, fix the -@code{tramp-remote-process-environment} by the following code in 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 @@ -2399,9 +2459,11 @@ read an initialization file. Per default, @value{tramp} has disabled this. You could overwrite this behaviour 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 @@ -2411,8 +2473,10 @@ this. You could overwrite this behaviour by evaluating 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 @@ -2429,8 +2493,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 @@ -2467,8 +2533,10 @@ 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, @@ -2487,6 +2555,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 @@ -2495,25 +2564,30 @@ uid=0(root) gid=0(root) groups=0(root) @b{@trampfn{sudo,root@@host,/etc} $} find-file shadow @key{RET} # @b{@trampfn{sudo,root@@host,/etc} $} +@end group @end example @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} # +@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 @@ -2531,8 +2605,10 @@ uid=0(root) gid=0(root) groups=0(root) 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} +@end group @end example Relative file names are based on the remote default directory. When @@ -2540,8 +2616,10 @@ Relative file names are based on the remote default directory. When 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 @@ -2568,16 +2646,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 @@ -2717,7 +2799,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. @@ -2726,16 +2808,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, @@ -2780,6 +2864,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 "\$ " @@ -2787,6 +2872,7 @@ function fish_prompt @dots{} end end +@end group @end example When using WinSSHD on remote hosts, @value{tramp} do not recognize the @@ -2818,11 +2904,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 @@ -2836,8 +2924,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 @@ -2850,26 +2940,33 @@ 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 @@ -2912,23 +3009,29 @@ 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 @@ -2938,8 +3041,8 @@ Host indication in the mode line? 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 variable -@code{tramp-theme-face-remapping-alist}. +customization is explained in user option +@option{tramp-theme-face-remapping-alist}. @item @@ -2950,11 +3053,13 @@ 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 @@ -2967,6 +3072,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 @@ -2976,6 +3082,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 @@ -3001,8 +3108,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}}. @@ -3019,9 +3129,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}}. @@ -3052,6 +3164,7 @@ minibuffer. Redefine another key sequence in Emacs for @kbd{C-x C-f}: @lisp +@group (global-set-key [(control x) (control y)] (lambda () @@ -3060,6 +3173,7 @@ Redefine another key sequence in Emacs 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 @@ -3074,9 +3188,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}}. @@ -3092,23 +3208,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}}. @@ -3151,11 +3275,13 @@ 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 @@ -3172,20 +3298,24 @@ works for @value{tramp} file names. 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}. @@ -3203,8 +3333,8 @@ 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. @@ -3219,10 +3349,12 @@ Configure Emacs Client 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 @@ -3244,8 +3376,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 @@ -3271,8 +3405,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 @@ -3295,7 +3428,7 @@ 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 @item @@ -3303,7 +3436,7 @@ 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 @@ -3355,8 +3488,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 @@ -3374,8 +3509,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 @@ -3387,8 +3524,10 @@ 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 @@ -3440,19 +3579,23 @@ Other navigation keys are described in 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 diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 07fc3e2..24b7322 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -40,7 +40,8 @@ "Name of the Android Debug Bridge program." :group 'tramp :version "24.4" - :type 'string) + :type 'string + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-adb-connect-if-not-connected nil @@ -48,7 +49,8 @@ It is used for TCP/IP devices." :group 'tramp :version "25.1" - :type 'boolean) + :type 'boolean + :require 'tramp) ;;;###tramp-autoload (defconst tramp-adb-method "adb" @@ -60,7 +62,8 @@ It is used for TCP/IP devices." "Regexp used as prompt in almquist shell." :type 'string :version "24.4" - :group 'tramp) + :group 'tramp + :require 'tramp) (defconst tramp-adb-ls-date-regexp "[[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]][0-9][0-9]:[0-9][0-9][[:space:]]" diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 158cfb5..07176be 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -72,13 +72,16 @@ details see the info pages." :version "24.4" :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil)) (choice :tag " Property" string) - (choice :tag " Value" sexp)))) + (choice :tag " Value" sexp))) + :require 'tramp) +;;;###tramp-autoload (defcustom tramp-persistency-file-name (expand-file-name (locate-user-emacs-file "tramp")) "File which keeps connection history for Tramp connections." :group 'tramp - :type 'file) + :type 'file + :require 'tramp) (defvar tramp-cache-data-changed nil "Whether persistent cache data have been changed.") diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index d12bab9..82abf54 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -123,7 +123,8 @@ (const "obex") (const "sftp") (const "smb") - (const "synce")))) + (const "synce"))) + :require 'tramp) ;; Add defaults for `tramp-default-user-alist' and `tramp-default-host-alist'. ;;;###tramp-autoload @@ -141,7 +142,8 @@ "Zeroconf domain to be used for discovering services, like host names." :group 'tramp :version "23.2" - :type 'string) + :type 'string + :require 'tramp) ;; Add the methods to `tramp-methods', in order to allow minibuffer ;; completion. @@ -393,7 +395,8 @@ completion, nil means to use always cached values for discovered devices." :group 'tramp :version "23.2" - :type '(choice (const nil) integer)) + :type '(choice (const nil) integer) + :require 'tramp) (defvar tramp-bluez-discovery nil "Indicator for a running bluetooth device discovery. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5cc239a..ee59529 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -46,7 +46,8 @@ When inline transfer, compress transferred data of file whose size is this value or above (up to `tramp-copy-size-limit'). If it is nil, no compression at all will be applied." :group 'tramp - :type '(choice (const nil) integer)) + :type '(choice (const nil) integer) + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-copy-size-limit 10240 @@ -54,7 +55,8 @@ If it is nil, no compression at all will be applied." out-of-the-band copy. If it is nil, out-of-the-band copy will be used without a check." :group 'tramp - :type '(choice (const nil) integer)) + :type '(choice (const nil) integer) + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-terminal-type "dumb" @@ -63,7 +65,8 @@ Because Tramp wants to parse the output of the remote shell, it is easily confused by ANSI color escape sequences and suchlike. Often, shell init files conditionalize this setup based on the TERM environment variable." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-histfile-override ".tramp_history" @@ -81,7 +84,8 @@ e.g. \"$HOME/.sh_history\"." :version "25.1" :type '(choice (const :tag "Do not override HISTFILE" nil) (const :tag "Unset HISTFILE" t) - (string :tag "Redirect to a file"))) + (string :tag "Redirect to a file")) + :require 'tramp) ;;;###tramp-autoload (defconst tramp-display-escape-sequence-regexp "\e[[;0-9]+m" @@ -115,7 +119,8 @@ detected as prompt when being sent on echoing hosts, therefore.") "Whether to use `tramp-ssh-controlmaster-options'." :group 'tramp :version "24.4" - :type 'boolean) + :type 'boolean + :require 'tramp) (defvar tramp-ssh-controlmaster-options nil "Which ssh Control* arguments to use. @@ -542,7 +547,8 @@ the list by the special value `tramp-own-remote-path'." :type '(repeat (choice (const :tag "Default Directories" tramp-default-remote-path) (const :tag "Private Directories" tramp-own-remote-path) - (string :tag "Directory")))) + (string :tag "Directory"))) + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-remote-process-environment @@ -561,7 +567,8 @@ Special handling is applied to the PATH environment, which should not be set here. Instead, it should be set via `tramp-remote-path'." :group 'tramp :version "25.2" - :type '(repeat string)) + :type '(repeat string) + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) @@ -578,7 +585,8 @@ shell from reading its init file." ;; `alist' is available. Who knows the right way to test it? :type (if (get 'alist 'widget-type) '(alist :key-type string :value-type string) - '(repeat (cons string string)))) + '(repeat (cons string string))) + :require 'tramp) (defconst tramp-actions-before-shell '((tramp-login-prompt-regexp tramp-action-login) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index bbf88fb..be7eb88 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -74,14 +74,16 @@ (defcustom tramp-smb-program "smbclient" "Name of SMB client to run." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-smb-acl-program "smbcacls" "Name of SMB acls to run." :group 'tramp :type 'string - :version "24.4") + :version "24.4" + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-smb-conf "/dev/null" @@ -89,7 +91,8 @@ If it is nil, no smb.conf will be added to the `tramp-smb-program' call, letting the SMB client use the default one." :group 'tramp - :type '(choice (const nil) (file :must-match t))) + :type '(choice (const nil) (file :must-match t)) + :require 'tramp) (defvar tramp-smb-version nil "Version string of the SMB client.") @@ -293,7 +296,8 @@ If it isn't found in the local $PATH, the absolute path of winexe shall be given. This is needed for remote processes." :group 'tramp :type 'string - :version "24.3") + :version "24.3" + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command "powershell.exe" @@ -301,7 +305,8 @@ shall be given. This is needed for remote processes." This must be Powershell V2 compatible." :group 'tramp :type 'string - :version "24.3") + :version "24.3" + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command-switch "-file -" @@ -309,7 +314,8 @@ This must be Powershell V2 compatible." This can be used to disable echo etc." :group 'tramp :type 'string - :version "24.3") + :version "24.3" + :require 'tramp) ;; It must be a `defsubst' in order to push the whole code into ;; tramp-loaddefs.el. Otherwise, there would be recursive autoloading. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 429cd36..f262b73 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -76,7 +76,8 @@ "Whether Tramp is enabled. If it is set to nil, all remote file names are used literally." :group 'tramp - :type 'boolean) + :type 'boolean + :require 'tramp) (defcustom tramp-verbose 3 "Verbosity level for Tramp messages. @@ -94,7 +95,8 @@ Any level x includes messages for all levels 1 .. x-1. The levels are 9 test commands 10 traces (huge)." :group 'tramp - :type 'integer) + :type 'integer + :require 'tramp) (defcustom tramp-backup-directory-alist nil "Alist of filename patterns and backup directory names. @@ -109,7 +111,8 @@ gives the same backup policy for Tramp files on their hosts like the policy for local files." :group 'tramp :type '(repeat (cons (regexp :tag "Regexp matching filename") - (directory :tag "Backup directory name")))) + (directory :tag "Backup directory name"))) + :require 'tramp) (defcustom tramp-auto-save-directory nil "Put auto-save files in this directory, if set. @@ -117,7 +120,8 @@ The idea is to use a local directory so that auto-saving is faster. This setting has precedence over `auto-save-file-name-transforms'." :group 'tramp :type '(choice (const :tag "Use default" nil) - (directory :tag "Auto save directory name"))) + (directory :tag "Auto save directory name")) + :require 'tramp) (defcustom tramp-encoding-shell (or (tramp-compat-funcall 'w32-shell-name) "/bin/sh") @@ -141,14 +145,16 @@ Note that this variable is not used for remote commands. There are mechanisms in tramp.el which automatically determine the right shell to use for the remote host." :group 'tramp - :type '(file :must-match t)) + :type '(file :must-match t) + :require 'tramp) (defcustom tramp-encoding-command-switch (if (tramp-compat-funcall 'w32-shell-dos-semantics) "/c" "-c") "Use this switch together with `tramp-encoding-shell' for local commands. See the variable `tramp-encoding-shell' for more information." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) (defcustom tramp-encoding-command-interactive (unless (tramp-compat-funcall 'w32-shell-dos-semantics) "-i") @@ -156,7 +162,8 @@ See the variable `tramp-encoding-shell' for more information." See the variable `tramp-encoding-shell' for more information." :version "24.1" :group 'tramp - :type '(choice (const nil) string)) + :type '(choice (const nil) string) + :require 'tramp) ;;;###tramp-autoload (defvar tramp-methods nil @@ -300,7 +307,8 @@ useful only in combination with `tramp-default-proxies-alist'.") See `tramp-methods' for possibilities. Also see `tramp-default-method-alist'." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-default-method-alist nil @@ -318,7 +326,8 @@ See `tramp-methods' for a list of possibilities for METHOD." :group 'tramp :type '(repeat (list (choice :tag "Host regexp" regexp sexp) (choice :tag "User regexp" regexp sexp) - (choice :tag "Method name" string (const nil))))) + (choice :tag "Method name" string (const nil)))) + :require 'tramp) (defcustom tramp-default-user nil "Default user to use for transferring files. @@ -327,7 +336,8 @@ It is nil by default; otherwise settings in configuration files like This variable is regarded as obsolete, and will be removed soon." :group 'tramp - :type '(choice (const nil) string)) + :type '(choice (const nil) string) + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-default-user-alist nil @@ -343,13 +353,15 @@ empty string for the method name." :group 'tramp :type '(repeat (list (choice :tag "Method regexp" regexp sexp) (choice :tag " Host regexp" regexp sexp) - (choice :tag " User name" string (const nil))))) + (choice :tag " User name" string (const nil)))) + :require 'tramp) (defcustom tramp-default-host (system-name) "Default host to use for transferring files. Useful for su and sudo methods mostly." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) ;;;###tramp-autoload (defcustom tramp-default-host-alist nil @@ -366,7 +378,8 @@ empty string for the method name." :version "24.4" :type '(repeat (list (choice :tag "Method regexp" regexp sexp) (choice :tag " User regexp" regexp sexp) - (choice :tag " Host name" string (const nil))))) + (choice :tag " Host name" string (const nil)))) + :require 'tramp) (defcustom tramp-default-proxies-alist nil "Route to be followed for specific host/user pairs. @@ -385,13 +398,15 @@ interpreted as a regular expression which always matches." :group 'tramp :type '(repeat (list (choice :tag "Host regexp" regexp sexp) (choice :tag "User regexp" regexp sexp) - (choice :tag " Proxy name" string (const nil))))) + (choice :tag " Proxy name" string (const nil)))) + :require 'tramp) (defcustom tramp-save-ad-hoc-proxies nil "Whether to save ad-hoc proxies persistently." :group 'tramp :version "24.3" - :type 'boolean) + :type 'boolean + :require 'tramp) (defcustom tramp-restricted-shell-hosts-alist (when (memq system-type '(windows-nt)) @@ -403,7 +418,8 @@ proxies only, see `tramp-default-proxies-alist'. If the local host runs a registered shell, it shall be added to this list, too." :version "24.3" :group 'tramp - :type '(repeat (regexp :tag "Host regexp"))) + :type '(repeat (regexp :tag "Host regexp")) + :require 'tramp) ;;;###tramp-autoload (defconst tramp-local-host-regexp @@ -464,14 +480,16 @@ the remote shell.") "String used for end of line in local processes." :version "24.1" :group 'tramp - :type 'string) + :type 'string + :require 'tramp) (defcustom tramp-rsh-end-of-line "\n" "String used for end of line in rsh connections. I don't think this ever needs to be changed, so please tell me about it if you need to change this." :group 'tramp - :type 'string) + :type 'string + :require 'tramp) (defcustom tramp-login-prompt-regexp ".*\\(user\\|login\\)\\( .*\\)?: *" @@ -480,7 +498,8 @@ The regexp should match at end of buffer. Sometimes the prompt is reported to look like \"login as:\"." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-shell-prompt-pattern ;; Allow a prompt to start right after a ^M since it indeed would be @@ -502,7 +521,8 @@ which should work well in many cases. This regexp must match both `tramp-initial-end-of-output' and `tramp-end-of-output'." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-password-prompt-regexp (format "^.*\\(%s\\).*:\^@? *" @@ -516,7 +536,8 @@ The regexp should match at end of buffer. The `sudo' program appears to insert a `^@' character into the prompt." :version "24.4" :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-wrong-passwd-regexp (concat "^.*" @@ -540,7 +561,8 @@ The `sudo' program appears to insert a `^@' character into the prompt." "Regexp matching a `login failed' message. The regexp should match at end of buffer." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-yesno-prompt-regexp (concat @@ -551,19 +573,22 @@ The confirmation should be done with yes or no. The regexp should match at end of buffer. See also `tramp-yn-prompt-regexp'." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-yn-prompt-regexp (concat (regexp-opt '("Store key in cache? (y/n)" - "Update cached key? (y/n, Return cancels connection)") t) + "Update cached key? (y/n, Return cancels connection)") + t) "\\s-*") "Regular expression matching all y/n queries which need to be confirmed. The confirmation should be done with y or n. The regexp should match at end of buffer. See also `tramp-yesno-prompt-regexp'." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-terminal-prompt-regexp (concat "\\(" @@ -575,7 +600,8 @@ See also `tramp-yesno-prompt-regexp'." The regexp should match at end of buffer. The answer will be provided by `tramp-action-terminal', which see." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-operation-not-permitted-regexp (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*" @@ -584,18 +610,21 @@ The answer will be provided by `tramp-action-terminal', which see." Copying has been performed successfully already, so this message can be ignored safely." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-copy-failed-regexp (concat "\\(.+: " (regexp-opt '("Permission denied" "not a regular file" "is a directory" - "No such file or directory") t) + "No such file or directory") + t) "\\)\\s-*") "Regular expression matching copy problems in (s)cp operations." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defcustom tramp-process-alive-regexp "" @@ -605,7 +634,8 @@ check regularly the status of the associated process. The answer will be provided by `tramp-action-process-alive', `tramp-action-out-of-band', which see." :group 'tramp - :type 'regexp) + :type 'regexp + :require 'tramp) (defconst tramp-temp-name-prefix "tramp." "Prefix to use for temporary files. @@ -636,7 +666,8 @@ It can have the following values: :group 'tramp :version "24.4" :type '(choice (const :tag "Ange-FTP" ftp) - (const :tag "XEmacs" sep))) + (const :tag "XEmacs" sep)) + :require 'tramp) (defconst tramp-prefix-format (cond ((equal tramp-syntax 'ftp) "/") @@ -951,7 +982,8 @@ in the third line of the code. Please raise a bug report via \"M-x tramp-bug\" if your system needs this variable to be set as well." :group 'tramp - :type '(choice (const nil) integer)) + :type '(choice (const nil) integer) + :require 'tramp) ;; Logging in to a remote host normally requires obtaining a pty. But ;; Emacs on MacOS X has process-connection-type set to nil by default, @@ -962,7 +994,8 @@ this variable to be set as well." Tramp binds `process-connection-type' to the value given here before opening a connection to a remote host." :group 'tramp - :type '(choice (const nil) (const t) (const pty))) + :type '(choice (const nil) (const t) (const pty)) + :require 'tramp) (defcustom tramp-connection-timeout 60 "Defines the max time to wait for establishing a connection (in seconds). @@ -971,7 +1004,8 @@ This can be overwritten for different connection types in `tramp-methods'. The timeout does not include the time reading a password." :group 'tramp :version "24.4" - :type 'integer) + :type 'integer + :require 'tramp) (defcustom tramp-connection-min-time-diff 5 "Defines seconds between two consecutive connection attempts. @@ -985,7 +1019,8 @@ in a short time frame. In those cases it is recommended to let-bind this variable." :group 'tramp :version "24.4" - :type '(choice (const nil) integer)) + :type '(choice (const nil) integer) + :require 'tramp) (defcustom tramp-completion-reread-directory-timeout 10 "Defines seconds since last remote command before rereading a directory. @@ -997,7 +1032,8 @@ have been gone since last remote command execution. A value of t would require an immediate reread during filename completion, nil means to use always cached values for the directory contents." :group 'tramp - :type '(choice (const nil) (const t) integer)) + :type '(choice (const nil) (const t) integer) + :require 'tramp) ;;; Internal Variables: