summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-11-02 21:01:04 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-11-02 21:01:04 -0700
commitc66a3944edca6150c9252e15a0ea75c96225481b (patch)
tree888bfa31967a17c174ba61d0a8547dd64658060a /lisp/net
parent770f245cdf2cf9e74e49bb32afb77562d9b1ad6d (diff)
parent7f089aa5f6d208209b2cfef8e0d3d9530e191248 (diff)
downloademacs-c66a3944edca6150c9252e15a0ea75c96225481b.tar.gz
Merge from origin/emacs-26
7f089aa5f6 Require seq in rmc.el 53aaad1dfc Make an example code introduced in the Gnus info work (bug... 7b29db222f Enable gnus-read-ephemeral-* to run multiple times (bug#29... 015f0bb2d8 Port thread.c to OpenBSD ARM ad68bbd0da Fix another "wrong side of point" error in CC Mode. 646e56e150 Fix Bug#28959 685fd77959 Fix duplicate .o file on QNX e562356c3f Fix two js indentation problems b8cf159bbc Update documentation for windows build 46540a1c7a Fix a "wrong side of point" error in CC Mode. Fixes bug #... 57ca409111 Fix autoload of flymake from elisp-mode during bootstrap (... aee0bc8775 Fix non-native fullscreen on NS (bug#28872) d6c1a9cb8a ; Fix author email address in test/lisp/url/url-tramp-test... 761c630766 Fix Bug#28982 628b653209 Fix windows build errors e8a06a5f9a Fix compile warning for non-w32 builds 0c536a20fb Display commit in package description, if available (Bug#2... 1d83257a1d Port to QNX 19667f44ef * configure.ac: Tweak libcurses diagnostic. 3fc05cfaec Scripts to automate windows binary distribution 928a106939 Fix Edebug specs for map-let and with-maps-do 46f2ee0d4c * test/lisp/net/tramp-tests.el (tramp-test41-delay-load): ... b51009d7f0 * admin/authors.el (authors-canonical-author-name): Ignore... a015db90e3 * test/lisp/progmodes/sql-tests.el (sql-tests-postgres-lis... 529a9c09d3 Further work on Bug#28889 c6deabaf4d Improve Tramp backward compatibility 8093e82e42 Improve backward compatibility of tramp-tests.el 46cdc01daa Fix some ‘window-normalize-’ prefixed functions (Bug#28947) 6360611457 Port to OpenIndiana a012ec766c Don't fill keywords after Emacs Lisp docstring b7c4aa951c Refactor c-forward-token-2 with new function c-forward-ove... 3aee7be62e Avoid unnecessary rounding errors in timestamps 2bfa42855b Fix xdg timestamp error on 32-bit Emacs 237e96bc52 Test that advice doesn't trigger bytecomp warnings (Bug#28... d719ea6ad5 Another fix for unsafe directory error message (Bug#865) b060e091c3 Handle https url for debbugs mbox (Bug#28831) 9e4265ef91 Ignore string properties when saving eshell history (Bug#2... 0f286ca85a Fix Bug#28889
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/ange-ftp.el4
-rw-r--r--lisp/net/rcirc.el2
-rw-r--r--lisp/net/tramp-compat.el6
-rw-r--r--lisp/net/tramp.el127
4 files changed, 75 insertions, 64 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 73f62c85519..cf65e10e510 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3479,7 +3479,7 @@ system TYPE.")
(f2-mt (nth 5 (file-attributes f2))))
(cond ((null f1-mt) nil)
((null f2-mt) t)
- (t (> (float-time f1-mt) (float-time f2-mt)))))
+ (t (time-less-p f2-mt f1-mt))))
(ange-ftp-real-file-newer-than-file-p f1 f2))))
(defun ange-ftp-file-writable-p (file)
@@ -3561,7 +3561,7 @@ Value is (0 0) if the modification time cannot be determined."
(let ((file-mdtm (ange-ftp-file-modtime name))
(buf-mdtm (with-current-buffer buf (visited-file-modtime))))
(or (zerop (car file-mdtm))
- (<= (float-time file-mdtm) (float-time buf-mdtm))))
+ (not (time-less-p buf-mdtm file-mdtm))))
(ange-ftp-real-verify-visited-file-modtime buf))))
(defun ange-ftp-file-size (file &optional ascii-mode)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 5c785daa8a2..3b6b6c8c807 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2333,7 +2333,7 @@ With a prefix arg, prompt for new topic."
(defun rcirc-ctcp-sender-PING (process target _request)
"Send a CTCP PING message to TARGET."
- (let ((timestamp (format "%.0f" (float-time))))
+ (let ((timestamp (format-time-string "%s")))
(rcirc-send-ctcp process target "PING" timestamp)))
(defun rcirc-cmd-me (args &optional process target)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 214ad040a17..9326f7b1864 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -235,6 +235,12 @@ If NAME is a remote file name, the local part of NAME is unquoted."
((eq tramp-syntax 'sep) 'separate)
(t tramp-syntax)))
+;; `cl-struct-slot-info' has been introduced with Emacs 25.
+(defmacro tramp-compat-tramp-file-name-slots ()
+ (if (fboundp 'cl-struct-slot-info)
+ `(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))
+ `(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots)))))
+
(provide 'tramp-compat)
;;; TODO:
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c8b6e68f719..e300b3a58ed 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -660,7 +660,7 @@ Useful for \"rsync\" like methods.")
(make-variable-buffer-local 'tramp-temp-buffer-file-name)
(put 'tramp-temp-buffer-file-name 'permanent-local t)
-;;;###autoload
+;;;###tramp-autoload
(defcustom tramp-syntax 'default
"Tramp filename syntax to be used.
@@ -674,48 +674,54 @@ Do not change the value by `setq', it must be changed only by
`custom-set-variables'. See also `tramp-change-syntax'."
:group 'tramp
:version "26.1"
- :package-version '(Tramp . "2.3.2")
+ :package-version '(Tramp . "2.3.3")
:type '(choice (const :tag "Default" default)
(const :tag "Ange-FTP" simplified)
(const :tag "XEmacs" separate))
:require 'tramp
:initialize 'custom-initialize-set
- :set (lambda (symbol value)
- ;; Check allowed values.
- (unless (memq value (tramp-syntax-values))
- (tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
- ;; Cleanup existing buffers.
- (unless (eq (symbol-value symbol) value)
- (tramp-cleanup-all-buffers))
- ;; Set the value:
- (set-default symbol value)
- ;; Reset the depending variables.
- (with-no-warnings
- (setq tramp-prefix-format (tramp-build-prefix-format)
- tramp-prefix-regexp (tramp-build-prefix-regexp)
- tramp-method-regexp (tramp-build-method-regexp)
- tramp-postfix-method-format (tramp-build-postfix-method-format)
- tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
- tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
- tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
- tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
- tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
- tramp-postfix-host-format (tramp-build-postfix-host-format)
- tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
- tramp-remote-file-name-spec-regexp
- (tramp-build-remote-file-name-spec-regexp)
- tramp-file-name-structure (tramp-build-file-name-structure)
- tramp-file-name-regexp (tramp-build-file-name-regexp)
- tramp-completion-file-name-regexp
- (tramp-build-completion-file-name-regexp)))
- ;; Rearrange file name handlers.
- (tramp-register-file-name-handlers)))
+ :set 'tramp-set-syntax)
+
+(defun tramp-set-syntax (symbol value)
+ "Set SYMBOL to value VALUE.
+Used in user option `tramp-syntax'. There are further variables
+to be set, depending on VALUE."
+ ;; Check allowed values.
+ (unless (memq value (tramp-syntax-values))
+ (tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
+ ;; Cleanup existing buffers.
+ (unless (eq (symbol-value symbol) value)
+ (tramp-cleanup-all-buffers))
+ ;; Set the value:
+ (set-default symbol value)
+ ;; Reset the depending variables.
+ (with-no-warnings
+ (setq tramp-prefix-format (tramp-build-prefix-format)
+ tramp-prefix-regexp (tramp-build-prefix-regexp)
+ tramp-method-regexp (tramp-build-method-regexp)
+ tramp-postfix-method-format (tramp-build-postfix-method-format)
+ tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
+ tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
+ tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
+ tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
+ tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
+ tramp-postfix-host-format (tramp-build-postfix-host-format)
+ tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
+ tramp-remote-file-name-spec-regexp
+ (tramp-build-remote-file-name-spec-regexp)
+ tramp-file-name-structure (tramp-build-file-name-structure)
+ tramp-file-name-regexp (tramp-build-file-name-regexp)
+ tramp-completion-file-name-regexp
+ (tramp-build-completion-file-name-regexp)))
+ ;; Rearrange file name handlers.
+ (tramp-register-file-name-handlers))
;; Initialize the Tramp syntax variables. We want to override initial
-;; values of `tramp-file-name-regexp' and
-;; `tramp-completion-file-name-regexp'.
+;; value of `tramp-file-name-regexp'. Other Tramp syntax variables
+;; must be initialized as well to proper values. We do not call
+;; `custom-set-variable', this would load Tramp via custom.el.
(eval-after-load 'tramp
- '(custom-set-variables `(tramp-syntax ',(tramp-compat-tramp-syntax))))
+ '(tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
(defun tramp-syntax-values ()
"Return possible values of `tramp-syntax', a list"
@@ -978,7 +984,6 @@ This regexp should match Tramp file names but no other file
names. When calling `tramp-register-file-name-handlers', the
initial value is overwritten by the car of `tramp-file-name-structure'.")
-;;;###autoload
(defconst tramp-completion-file-name-regexp-default
(concat
"\\`/\\("
@@ -1042,10 +1047,19 @@ updated after changing this variable.
Also see `tramp-file-name-structure'.")
;;;###autoload
-(defconst tramp-initial-completion-file-name-regexp
- tramp-completion-file-name-regexp-default
- "Value for `tramp-completion-file-name-regexp' for autoload.
-It must match the initial `tramp-syntax' settings.")
+(defconst tramp-autoload-file-name-regexp
+ (concat
+ "\\`/"
+ (if (memq system-type '(cygwin windows-nt))
+ ;; The method is either "-", or at least two characters.
+ "\\(-\\|[^/|:]\\{2,\\}\\)"
+ ;; At least one character for method.
+ "[^/|:]+")
+ ":\\'")
+ "Regular expression matching file names handled by Tramp autoload.
+It must match the initial `tramp-syntax' settings. It should not
+match file names at root of the underlying local file system,
+like \"/sys\" or \"/C:\".")
;; Chunked sending kludge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
@@ -1186,7 +1200,6 @@ means to use always cached values for the directory contents."
(defvar tramp-current-connection nil
"Last connection timestamp.")
-;;;###autoload
(defconst tramp-completion-file-name-handler-alist
'((file-name-all-completions
. tramp-completion-handle-file-name-all-completions)
@@ -1740,20 +1753,20 @@ Second arg VAR is a symbol. It is used as a variable name to hold
the filename structure. It is also used as a prefix for the variables
holding the components. For example, if VAR is the symbol `foo', then
`foo' will be bound to the whole structure, `foo-method' will be bound to
-the method component, and so on for `foo-user', `foo-host', `foo-localname',
-`foo-hop'.
+the method component, and so on for `foo-user', `foo-domain', `foo-host',
+`foo-port', `foo-localname', `foo-hop'.
Remaining args are Lisp expressions to be evaluated (inside an implicit
`progn').
If VAR is nil, then we bind `v' to the structure and `method', `user',
-`host', `localname', `hop' to the components."
+`domain', `host', `port', `localname', `hop' to the components."
(let ((bindings
(mapcar (lambda (elem)
`(,(if var (intern (format "%s-%s" var elem)) elem)
(,(intern (format "tramp-file-name-%s" elem))
,(or var 'v))))
- '(method user domain host port localname hop))))
+ `,(tramp-compat-tramp-file-name-slots))))
`(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
,@bindings)
;; We don't know which of those vars will be used, so we bind them all,
@@ -2281,7 +2294,6 @@ Falls back to normal file name handler if no Tramp file name handler exists."
;; we don't do anything.
(tramp-run-real-handler operation args))))
-;;;###autoload
(defun tramp-completion-file-name-handler (operation &rest args)
"Invoke Tramp file name completion handler.
Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2304,17 +2316,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
(progn (defun tramp-register-autoload-file-name-handlers ()
"Add Tramp file name handlers to `file-name-handler-alist' during autoload."
(add-to-list 'file-name-handler-alist
- (cons tramp-initial-file-name-regexp
+ (cons tramp-autoload-file-name-regexp
'tramp-autoload-file-name-handler))
- (put 'tramp-autoload-file-name-handler 'safe-magic t)
-
- (add-to-list 'file-name-handler-alist
- (cons tramp-initial-completion-file-name-regexp
- 'tramp-completion-file-name-handler))
- (put 'tramp-completion-file-name-handler 'safe-magic t)
- ;; Mark `operations' the handler is responsible for.
- (put 'tramp-completion-file-name-handler 'operations
- (mapcar 'car tramp-completion-file-name-handler-alist))))
+ (put 'tramp-autoload-file-name-handler 'safe-magic t)))
;;;###autoload
(tramp-register-autoload-file-name-handlers)
@@ -2455,7 +2459,8 @@ not in completion mode."
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
-;; tramp-file-name structures. For all of them we return possible completions.
+;; `tramp-file-name' structures. For all of them we return possible
+;; completions.
(defun tramp-completion-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for partial Tramp files."
@@ -2536,9 +2541,9 @@ not in completion mode."
(tramp-connectable-p (expand-file-name filename directory)))
(lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
-;; I misuse a little bit the tramp-file-name structure in order to
+;; I misuse a little bit the `tramp-file-name' structure in order to
;; handle completion possibilities for partial methods / user names /
-;; host names. Return value is a list of tramp-file-name structures
+;; host names. Return value is a list of `tramp-file-name' structures
;; according to possible completions. If "localname" is non-nil it
;; means there shouldn't be a completion anymore.
@@ -3221,9 +3226,9 @@ User is always nil."
(car x)
(if (and (stringp (cdr x))
(file-name-absolute-p (cdr x))
- (not (tramp-file-name-p (cdr x))))
+ (not (tramp-tramp-file-p (cdr x))))
(tramp-make-tramp-file-name
- method user domain host port (cdr x))
+ method user domain host port (cdr x) hop)
(cdr x))))
tramp-backup-directory-alist)
backup-directory-alist)))