summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sudoedit.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2018-12-16 10:32:53 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2018-12-16 10:32:53 -0500
commit07d8827946f9364180f18d6842acc80f0997ed75 (patch)
tree53a43e103081c815c3377475f187ffb5347cfb5e /lisp/net/tramp-sudoedit.el
parente8199e765f81968be840d8e7e3978f5974c1be9d (diff)
downloademacs-07d8827946f9364180f18d6842acc80f0997ed75.tar.gz
* lisp/net/tramp: Rework mutual dependencies
Functionally split tramp-loaddefs.el into two parts: one part run while loading it at the very beginning of loading tramp.el (holding plain autoloads and declarations), and another run at the very end of loading tramp.el (holding setup code). This should reduce infinite-recursion problems while loading. * lisp/net/tramp.el: Require tramp-loaddefs at beginning. Run (new and internal) tramp--startup-hook at the end. Remove all tramp-autoloads. Prefer tramp--with-startup over eval-after-load. (tramp--with-startup): New macro. (tramp-set-syntax): Show the new value rather than the old value in the error message. (tramp-syntax-values): Explicitly return 'values'. (tramp-prefix-format, tramp-prefix-regexp, tramp-method-regexp) (tramp-postfix-method-format, tramp-postfix-method-regexp) (tramp-prefix-ipv6-format, tramp-prefix-ipv6-regexp) (tramp-postfix-ipv6-format, tramp-postfix-ipv6-regexp) (tramp-postfix-host-format, tramp-postfix-host-regexp) (tramp-remote-file-name-spec-regexp, tramp-file-name-structure) (tramp-completion-file-name-regexp): Don't initialize in the declaration, since it's recomputed at the end anyway. (tramp-time-dont-know, tramp-time-doesnt-exist): Move before first use. * lisp/net/tramp-compat.el: Don't require tramp-loaddefs any more. (tramp-compat-tramp-syntax): Declare tramp-syntax. * lisp/net/tramp-smb.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-ftp.el: * lisp/net/tramp-adb.el: Wrap all autoloaded setup operations within tramp--with-startup. * lisp/net/tramp-sh.el: Wrap all autoloaded setup operations within tramp--with-startup. (tramp-display-escape-sequence-regexp) (tramp-device-escape-sequence-regexp): Don't tramp-autoload any more. (tramp-stat-marker): Use eval-and-compile rather than tramp-autoload. * lisp/net/tramp-sudoedit.el: Wrap all autoloaded setup operations within tramp--with-startup. Require tramp-sh at compile-time to precompute some regexps based on tramp-stat-marker.
Diffstat (limited to 'lisp/net/tramp-sudoedit.el')
-rw-r--r--lisp/net/tramp-sudoedit.el42
1 files changed, 21 insertions, 21 deletions
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 640fa570ff4..07ae8688dad 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -35,6 +35,7 @@
;;; Code:
(require 'tramp)
+(eval-when-compile (require 'tramp-sh)) ;For tramp-stat-marker
(require 'server)
;;;###tramp-autoload
@@ -42,18 +43,16 @@
"When this method name is used, call sudoedit for editing a file.")
;;;###tramp-autoload
-(add-to-list 'tramp-methods
- `(,tramp-sudoedit-method
- (tramp-sudo-login (("sudo") ("-u" "%u") ("-S") ("-H")
- ("-p" "Password:") ("--")))))
+(tramp--with-startup
+ (add-to-list 'tramp-methods
+ `(,tramp-sudoedit-method
+ (tramp-sudo-login (("sudo") ("-u" "%u") ("-S") ("-H")
+ ("-p" "Password:") ("--")))))
-;;;###tramp-autoload
-(add-to-list 'tramp-default-user-alist '("\\`sudoedit\\'" nil "root"))
+ (add-to-list 'tramp-default-user-alist '("\\`sudoedit\\'" nil "root"))
-;;;###tramp-autoload
-(eval-after-load 'tramp
- '(tramp-set-completion-function
- tramp-sudoedit-method tramp-completion-function-alist-su))
+ (tramp-set-completion-function
+ tramp-sudoedit-method tramp-completion-function-alist-su))
(defconst tramp-sudoedit-sudo-actions
'((tramp-password-prompt-regexp tramp-action-password)
@@ -161,8 +160,9 @@ pass to the OPERATION."
(tramp-run-real-handler operation args))))
;;;###tramp-autoload
-(tramp-register-foreign-file-name-handler
- 'tramp-sudoedit-file-name-p 'tramp-sudoedit-file-name-handler)
+(tramp--with-startup
+ (tramp-register-foreign-file-name-handler
+ #'tramp-sudoedit-file-name-p #'tramp-sudoedit-file-name-handler))
;; File name primitives.
@@ -235,7 +235,7 @@ absolute file names."
(file-modes (tramp-default-file-modes filename))
;; `file-extended-attributes' exists since Emacs 24.4.
(attributes (and preserve-extended-attributes
- (apply 'file-extended-attributes (list filename))))
+ (apply #'file-extended-attributes (list filename))))
(sudoedit-operation
(cond
((and (eq op 'copy) preserve-uid-gid) '("cp" "-f" "-p"))
@@ -288,7 +288,7 @@ absolute file names."
;; `set-file-extended-attributes' exists since Emacs 24.4.
(when attributes
(ignore-errors
- (apply 'set-file-extended-attributes (list newname attributes))))
+ (apply #'set-file-extended-attributes (list newname attributes))))
(when (and t1 (eq op 'rename))
(with-parsed-tramp-file-name filename v1
@@ -659,7 +659,7 @@ component is used as the target of the symlink."
(when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v))
;; Massage `acl-string'.
(setq acl-string
- (mapconcat 'identity (split-string acl-string "\n" 'omit) ","))
+ (mapconcat #'identity (split-string acl-string "\n" 'omit) ","))
(prog1
(tramp-sudoedit-send-command
v "setfacl" "-m"
@@ -809,17 +809,17 @@ in case of error, t otherwise."
(tramp-compat-flatten-list (delq nil args))))
(delete-exited-processes t)
(process-connection-type tramp-process-connection-type)
- (p (apply 'start-process
+ (p (apply #'start-process
(tramp-get-connection-name vec) (current-buffer) args))
;; We suppress the messages `Waiting for prompts from remote shell'.
(tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
;; We do not want to save the password.
auth-source-save-behavior)
- (tramp-message vec 6 "%s" (mapconcat 'identity (process-command p) " "))
+ (tramp-message vec 6 "%s" (mapconcat #'identity (process-command p) " "))
;; Avoid process status message in output buffer.
- (set-process-sentinel p 'ignore)
+ (set-process-sentinel p #'ignore)
(process-put p 'vector vec)
- (process-put p 'adjust-window-size-function 'ignore)
+ (process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p vec nil tramp-sudoedit-sudo-actions)
(tramp-message vec 6 "%s\n%s" (process-exit-status p) (buffer-string))
@@ -830,7 +830,7 @@ in case of error, t otherwise."
(defun tramp-sudoedit-send-command-and-read (vec &rest args)
"Run command ARGS and return the output, which must be a Lisp expression.
In case there is no valid Lisp expression, it raises an error."
- (when (apply 'tramp-sudoedit-send-command vec args)
+ (when (apply #'tramp-sudoedit-send-command vec args)
(with-current-buffer (tramp-get-connection-buffer vec)
;; Replace stat marker.
(goto-char (point-min))
@@ -856,7 +856,7 @@ In case there is no valid Lisp expression, it raises an error."
(defun tramp-sudoedit-send-command-string (vec &rest args)
"Run command ARGS and return the output as astring."
- (when (apply 'tramp-sudoedit-send-command vec args)
+ (when (apply #'tramp-sudoedit-send-command vec args)
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string))
(goto-char (point-max))