aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2010-09-13 16:40:48 +0200
committerStefan Monnier <[email protected]>2010-09-13 16:40:48 +0200
commitcc390e46c7ba95b76ea133d98fd386214cd01709 (patch)
treeead4400d22bd07214b782ff7e46e79d473fac419 /lisp/net
parentc566235d981eba73c88bbff00b6a1d88360b6e9f (diff)
parentc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff)
Merge from trunk
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/browse-url.el36
-rw-r--r--lisp/net/dbus.el59
-rw-r--r--lisp/net/dig.el1
-rw-r--r--lisp/net/dns.el3
-rw-r--r--lisp/net/eudc-bob.el1
-rw-r--r--lisp/net/eudc-export.el1
-rw-r--r--lisp/net/eudc-hotlist.el1
-rw-r--r--lisp/net/eudc-vars.el1
-rw-r--r--lisp/net/eudcb-bbdb.el1
-rw-r--r--lisp/net/eudcb-ldap.el1
-rw-r--r--lisp/net/eudcb-mab.el1
-rw-r--r--lisp/net/eudcb-ph.el1
-rw-r--r--lisp/net/hmac-def.el1
-rw-r--r--lisp/net/hmac-md5.el1
-rw-r--r--lisp/net/imap.el324
-rw-r--r--lisp/net/netrc.el29
-rw-r--r--lisp/net/newst-backend.el1
-rw-r--r--lisp/net/newst-plainview.el1
-rw-r--r--lisp/net/newst-reader.el1
-rw-r--r--lisp/net/newst-ticker.el1
-rw-r--r--lisp/net/newst-treeview.el1
-rw-r--r--lisp/net/newsticker.el1
-rw-r--r--lisp/net/ntlm.el7
-rw-r--r--lisp/net/rcirc.el161
-rw-r--r--lisp/net/sasl-cram.el2
-rw-r--r--lisp/net/sasl-digest.el6
-rw-r--r--lisp/net/sasl-ntlm.el2
-rw-r--r--lisp/net/sasl.el1
-rw-r--r--lisp/net/tls.el1
-rw-r--r--lisp/net/tramp-cache.el75
-rw-r--r--lisp/net/tramp-cmds.el9
-rw-r--r--lisp/net/tramp-compat.el58
-rw-r--r--lisp/net/tramp-fish.el22
-rw-r--r--lisp/net/tramp-ftp.el27
-rw-r--r--lisp/net/tramp-gvfs.el43
-rw-r--r--lisp/net/tramp-gw.el26
-rw-r--r--lisp/net/tramp-imap.el28
-rw-r--r--lisp/net/tramp-smb.el31
-rw-r--r--lisp/net/tramp-uu.el10
-rw-r--r--lisp/net/tramp.el770
-rw-r--r--lisp/net/trampver.el18
41 files changed, 854 insertions, 911 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 420381cf43..fb9b57b724 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -892,6 +892,7 @@ The order attempted is gnome-moz-remote, Mozilla, Firefox,
Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
(apply
(cond
+ ((browse-url-can-use-xdg-open) 'browse-url-xdg-open)
((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
((executable-find browse-url-mozilla-program) 'browse-url-mozilla)
((executable-find browse-url-firefox-program) 'browse-url-firefox)
@@ -905,6 +906,41 @@ Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
(lambda (&rest ignore) (error "No usable browser found"))))
url args))
+(defun browse-url-can-use-xdg-open ()
+ "Check if xdg-open can be used, i.e. we are on Gnome, KDE or xfce4."
+ (and (getenv "DISPLAY")
+ (executable-find "xdg-open")
+ ;; xdg-open may call gnome-open and that does not wait for its child
+ ;; to finish. This child may then be killed when the parent dies.
+ ;; Use nohup to work around.
+ (executable-find "nohup")
+ (or (getenv "GNOME_DESKTOP_SESSION_ID")
+ ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also.
+ (condition-case nil
+ (eq 0 (call-process
+ "dbus-send" nil nil nil
+ "--dest=org.gnome.SessionManager"
+ "--print-reply"
+ "/org/gnome/SessionManager"
+ "org.gnome.SessionManager.CanShutdown"))
+ (error nil))
+ (equal (getenv "KDE_FULL_SESSION") "true")
+ (condition-case nil
+ (eq 0 (call-process
+ "/bin/sh" nil nil nil
+ "-c"
+ "xprop -root _DT_SAVE_MODE|grep xfce4"))
+ (error nil)))))
+
+
+;;;###autoload
+(defun browse-url-xdg-open (url &optional new-window)
+ (interactive (browse-url-interactive-arg "URL: "))
+ (call-process "/bin/sh" nil nil nil
+ "-c"
+ (concat "nohup xdg-open " url
+ ">/dev/null 2>&1 </dev/null")))
+
;;;###autoload
(defun browse-url-netscape (url &optional new-window)
"Ask the Netscape WWW browser to load URL.
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 870bd2e313..8d9512d6f9 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -92,12 +92,10 @@
(defmacro dbus-ignore-errors (&rest body)
"Execute BODY; signal D-Bus error when `dbus-debug' is non-nil.
Otherwise, return result of last form in BODY, or all other errors."
+ (declare (indent 0) (debug t))
`(condition-case err
(progn ,@body)
(dbus-error (when dbus-debug (signal (car err) (cdr err))))))
-
-(put 'dbus-ignore-errors 'lisp-indent-function 0)
-(put 'dbus-ignore-errors 'edebug-form-spec '(form body))
(font-lock-add-keywords 'emacs-lisp-mode '("\\<dbus-ignore-errors\\>"))
(defvar dbus-event-error-hooks nil
@@ -108,15 +106,12 @@ catched in `condition-case' by `dbus-error'.")
;;; Hash table of registered functions.
-;; We create it here. So we have a simple test in dbusbind.c, whether
-;; the Lisp code has been loaded.
-(setq dbus-registered-objects-table (make-hash-table :test 'equal))
-
(defvar dbus-return-values-table (make-hash-table :test 'equal)
"Hash table for temporary storing arguments of reply messages.
-A key in this hash table is a list (BUS SERIAL). BUS is either the
-symbol `:system' or the symbol `:session'. SERIAL is the serial number
-of the reply message. See `dbus-call-method-non-blocking-handler' and
+A key in this hash table is a list (BUS SERIAL). BUS is either a
+Lisp symbol, `:system' or `:session', or a string denoting the
+bus address. SERIAL is the serial number of the reply message.
+See `dbus-call-method-non-blocking-handler' and
`dbus-call-method-non-blocking'.")
(defun dbus-list-hash-table ()
@@ -187,8 +182,8 @@ association to the service from D-Bus."
(defun dbus-unregister-service (bus service)
"Unregister all objects related to SERVICE from D-Bus BUS.
-BUS must be either the symbol `:system' or the symbol `:session'.
-SERVICE must be a known service name."
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address. SERVICE must be a known service name."
(maphash
(lambda (key value)
(dolist (elt value)
@@ -353,15 +348,15 @@ EVENT is a list which starts with symbol `dbus-event':
(dbus-event BUS TYPE SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS)
BUS identifies the D-Bus the message is coming from. It is
-either the symbol `:system' or the symbol `:session'. TYPE is
-the D-Bus message type which has caused the event, SERIAL is the
-serial number of the received D-Bus message. SERVICE and PATH
-are the unique name and the object path of the D-Bus object
-emitting the message. INTERFACE and MEMBER denote the message
-which has been sent. HANDLER is the function which has been
-registered for this message. ARGS are the arguments passed to
-HANDLER, when it is called during event handling in
-`dbus-handle-event'.
+either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address. TYPE is the D-Bus message type which
+has caused the event, SERIAL is the serial number of the received
+D-Bus message. SERVICE and PATH are the unique name and the
+object path of the D-Bus object emitting the message. INTERFACE
+and MEMBER denote the message which has been sent. HANDLER is
+the function which has been registered for this message. ARGS
+are the arguments passed to HANDLER, when it is called during
+event handling in `dbus-handle-event'.
This function raises a `dbus-error' signal in case the event is
not well formed."
@@ -369,7 +364,8 @@ not well formed."
(unless (and (listp event)
(eq (car event) 'dbus-event)
;; Bus symbol.
- (symbolp (nth 1 event))
+ (or (symbolp (nth 1 event))
+ (stringp (nth 1 event)))
;; Type.
(and (natnump (nth 2 event))
(< dbus-message-type-invalid (nth 2 event)))
@@ -434,9 +430,10 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
(defun dbus-event-bus-name (event)
"Return the bus name the event is coming from.
-The result is either the symbol `:system' or the symbol `:session'.
-EVENT is a D-Bus event, see `dbus-check-event'. This function
-raises a `dbus-error' signal in case the event is not well formed."
+The result is either a Lisp symbol, `:system' or `:session', or a
+string denoting the bus address. EVENT is a D-Bus event, see
+`dbus-check-event'. This function raises a `dbus-error' signal
+in case the event is not well formed."
(dbus-check-event event)
(nth 1 event))
@@ -566,10 +563,11 @@ apply
"Return all interfaces and sub-nodes of SERVICE,
registered at object path PATH at bus BUS.
-BUS must be either the symbol `:system' or the symbol `:session'.
-SERVICE must be a known service name, and PATH must be a valid
-object path. The last two parameters are strings. The result,
-the introspection data, is a string in XML format."
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address. SERVICE must be a known service name,
+and PATH must be a valid object path. The last two parameters
+are strings. The result, the introspection data, is a string in
+XML format."
;; We don't want to raise errors. `dbus-call-method-non-blocking'
;; is used, because the handler can be registered in our Emacs
;; instance; caller an callee would block each other.
@@ -873,7 +871,8 @@ name of the property, and its value. If there are no properties,
(bus service path interface property access value &optional emits-signal)
"Register property PROPERTY on the D-Bus BUS.
-BUS is either the symbol `:system' or the symbol `:session'.
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
SERVICE is the D-Bus service name of the D-Bus. It must be a
known name.
diff --git a/lisp/net/dig.el b/lisp/net/dig.el
index add3c2f7a0..9392c73855 100644
--- a/lisp/net/dig.el
+++ b/lisp/net/dig.el
@@ -184,5 +184,4 @@ Returns nil for domain/class/type queries that result in no data."
(provide 'dig)
-;; arch-tag: 1d61726e-9400-4013-9ae7-4035e0c7f7d6
;;; dig.el ends here
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index d371737192..2d4c2d8cd8 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -151,7 +151,7 @@ If TCP-P, the first two bytes of the package with be the length field."
(lsh (if (dns-get 'truncated-p spec) 1 0) -1)
(lsh (if (dns-get 'recursion-desired-p spec) 1 0) 0)))
(dns-write-bytes
- (cond
+ (cond
((eq (dns-get 'response-code spec) 'no-error) 0)
((eq (dns-get 'response-code spec) 'format-error) 1)
((eq (dns-get 'response-code spec) 'server-failure) 2)
@@ -438,5 +438,4 @@ If REVERSEP, look up an IP address."
(provide 'dns)
-;; arch-tag: d0edd0c4-4cce-4538-ae92-06c3356ee80a
;;; dns.el ends here
diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el
index fe41d70a09..962020f2b3 100644
--- a/lisp/net/eudc-bob.el
+++ b/lisp/net/eudc-bob.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el
index 7aa30cfcb6..91abac571b 100644
--- a/lisp/net/eudc-export.el
+++ b/lisp/net/eudc-export.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index 5f165ad2e2..7798fa43d9 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el
index 5f8de5ec75..3f82816fab 100644
--- a/lisp/net/eudc-vars.el
+++ b/lisp/net/eudc-vars.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0ddfa81a50..aa4315077e 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el
index fc90be96b5..e2ca2acadd 100644
--- a/lisp/net/eudcb-ldap.el
+++ b/lisp/net/eudcb-ldap.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudcb-mab.el b/lisp/net/eudcb-mab.el
index 8705be81b0..d848b9953a 100644
--- a/lisp/net/eudcb-mab.el
+++ b/lisp/net/eudcb-mab.el
@@ -6,6 +6,7 @@
;; Author: John Wiegley <[email protected]>
;; Maintainer: FSF
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/eudcb-ph.el b/lisp/net/eudcb-ph.el
index bd2e75ced0..c0e4f81d31 100644
--- a/lisp/net/eudcb-ph.el
+++ b/lisp/net/eudcb-ph.el
@@ -6,6 +6,7 @@
;; Author: Oscar Figueiredo <[email protected]>
;; Maintainer: Pavel Jan�k <[email protected]>
;; Keywords: comm
+;; Package: eudc
;; This file is part of GNU Emacs.
diff --git a/lisp/net/hmac-def.el b/lisp/net/hmac-def.el
index 5f57ea617b..c16fffc8de 100644
--- a/lisp/net/hmac-def.el
+++ b/lisp/net/hmac-def.el
@@ -80,5 +80,4 @@ If BIT is non-nil, truncate output to specified bits."
(provide 'hmac-def)
-;; arch-tag: 645adcef-b835-4900-a10a-11f636c982b9
;;; hmac-def.el ends here
diff --git a/lisp/net/hmac-md5.el b/lisp/net/hmac-md5.el
index 045a12520a..a0bfd36ea6 100644
--- a/lisp/net/hmac-md5.el
+++ b/lisp/net/hmac-md5.el
@@ -79,5 +79,4 @@
(provide 'hmac-md5)
-;; arch-tag: 0ab3f4f6-3d4b-4167-a9fa-635b7fed7f27
;;; hmac-md5.el ends here
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index f9c89cd816..e286a14a0e 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -267,7 +267,7 @@ See also `imap-log'."
:type 'string)
(defcustom imap-read-timeout (if (string-match
- "windows-nt\\|os/2\\|emx\\|cygwin"
+ "windows-nt\\|os/2\\|cygwin"
(symbol-name system-type))
1.0
0.1)
@@ -448,18 +448,6 @@ The actual value is really the text on the continuation line.")
The function should take two arguments, the first the IMAP tag and the
second the status (OK, NO, BAD etc) of the command.")
-(defvar imap-enable-exchange-bug-workaround nil
- "Send FETCH UID commands as *:* instead of *.
-
-When non-nil, use an alternative UIDS form. Enabling appears to
-be required for some servers (e.g., Microsoft Exchange 2007)
-which otherwise would trigger a response 'BAD The specified
-message set is invalid.'. We don't unconditionally use this
-form, since this is said to be significantly inefficient.
-
-This variable is set to t automatically per server if the
-canonical form fails.")
-
;; Utility functions:
@@ -515,6 +503,16 @@ sure of changing the value of `foo'."
;; Server functions; stream stuff:
+(defun imap-log (string-or-buffer)
+ (when imap-log
+ (with-current-buffer (get-buffer-create imap-log-buffer)
+ (imap-disable-multibyte)
+ (buffer-disable-undo)
+ (goto-char (point-max))
+ (if (bufferp string-or-buffer)
+ (insert-buffer-substring string-or-buffer)
+ (insert string-or-buffer)))))
+
(defun imap-kerberos4-stream-p (buffer)
(imap-capability 'AUTH=KERBEROS_V4 buffer))
@@ -569,12 +567,6 @@ sure of changing the value of `foo'."
(setq response (match-string 1)))))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
(erase-buffer)
(message "Opening Kerberos 4 IMAP connection with `%s'...%s" cmd
(if response (concat "done, " response) "failed"))
@@ -645,12 +637,7 @@ sure of changing the value of `foo'."
(setq response (match-string 1)))))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(erase-buffer)
(message "GSSAPI IMAP connection: %s" (or response "failed"))
(if (and response (let ((case-fold-search nil))
@@ -701,12 +688,7 @@ sure of changing the value of `foo'."
(not (imap-parse-greeting)))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(erase-buffer)
(when (memq (process-status process) '(open run))
(setq done process))))))
@@ -740,12 +722,7 @@ sure of changing the value of `foo'."
(not (imap-parse-greeting)))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(when (memq (process-status process) '(open run))
process))))
@@ -764,12 +741,7 @@ sure of changing the value of `foo'."
(not (imap-parse-greeting)))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(when (memq (process-status process) '(open run))
process))))
@@ -803,12 +775,7 @@ sure of changing the value of `foo'."
(not (imap-parse-greeting)))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(erase-buffer)
(when (memq (process-status process) '(open run))
(setq done process)))))
@@ -845,11 +812,7 @@ sure of changing the value of `foo'."
(not (re-search-forward "[0-9]+ OK.*\r?\n" nil t)))
(accept-process-output process 1)
(sit-for 1))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring buffer)))
+ (imap-log buffer)
(when (and (setq tls-info (starttls-negotiate process))
(memq (process-status process) '(open run)))
(setq done process)))
@@ -1227,7 +1190,7 @@ password is remembered in the buffer."
(when user (setq imap-username user))
(when passwd (setq imap-password passwd))
(if imap-auth
- (and (setq imap-last-authenticator
+ (and (setq imap-last-authenticator
(assq imap-auth imap-authenticator-alist))
(funcall (nth 2 imap-last-authenticator) (current-buffer))
(setq imap-state 'auth))
@@ -1340,40 +1303,38 @@ If BUFFER is nil, the current buffer is assumed."
;; Mailbox functions:
-(defun imap-mailbox-put (propname value &optional mailbox buffer)
- (with-current-buffer (or buffer (current-buffer))
- (if imap-mailbox-data
- (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
- propname value)
- (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s"
- propname value mailbox (current-buffer)))
- t))
+(defun imap-mailbox-put (propname value &optional mailbox)
+ (if imap-mailbox-data
+ (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
+ propname value)
+ (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s"
+ propname value mailbox (current-buffer)))
+ t)
(defsubst imap-mailbox-get-1 (propname &optional mailbox)
(get (intern-soft (or mailbox imap-current-mailbox) imap-mailbox-data)
propname))
(defun imap-mailbox-get (propname &optional mailbox buffer)
- (let ((mailbox (imap-utf7-encode mailbox)))
- (with-current-buffer (or buffer (current-buffer))
- (imap-mailbox-get-1 propname (or mailbox imap-current-mailbox)))))
-
-(defun imap-mailbox-map-1 (func &optional mailbox-decoder buffer)
(with-current-buffer (or buffer (current-buffer))
- (let (result)
- (mapatoms
- (lambda (s)
- (push (funcall func (if mailbox-decoder
- (funcall mailbox-decoder (symbol-name s))
- (symbol-name s))) result))
- imap-mailbox-data)
- result)))
-
-(defun imap-mailbox-map (func &optional buffer)
+ (imap-mailbox-get-1 propname (or (imap-utf7-encode mailbox)
+ imap-current-mailbox))))
+
+(defun imap-mailbox-map-1 (func &optional mailbox-decoder)
+ (let (result)
+ (mapatoms
+ (lambda (s)
+ (push (funcall func (if mailbox-decoder
+ (funcall mailbox-decoder (symbol-name s))
+ (symbol-name s))) result))
+ imap-mailbox-data)
+ result))
+
+(defun imap-mailbox-map (func)
"Map a function across each mailbox in `imap-mailbox-data', returning a list.
Function should take a mailbox name (a string) as
the only argument."
- (imap-mailbox-map-1 func 'imap-utf7-decode buffer))
+ (imap-mailbox-map-1 func 'imap-utf7-decode))
(defun imap-current-mailbox (&optional buffer)
(with-current-buffer (or buffer (current-buffer))
@@ -1687,29 +1648,26 @@ is non-nil return these properties."
uids)
(imap-message-get uids receive))))))
-(defun imap-message-put (uid propname value &optional buffer)
- (with-current-buffer (or buffer (current-buffer))
- (if imap-message-data
- (put (intern (number-to-string uid) imap-message-data)
- propname value)
- (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s"
- uid propname value (current-buffer)))
- t))
+(defun imap-message-put (uid propname value)
+ (if imap-message-data
+ (put (intern (number-to-string uid) imap-message-data)
+ propname value)
+ (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s"
+ uid propname value (current-buffer)))
+ t)
-(defun imap-message-get (uid propname &optional buffer)
- (with-current-buffer (or buffer (current-buffer))
- (get (intern-soft (number-to-string uid) imap-message-data)
- propname)))
+(defun imap-message-get (uid propname)
+ (get (intern-soft (number-to-string uid) imap-message-data)
+ propname))
-(defun imap-message-map (func propname &optional buffer)
+(defun imap-message-map (func propname)
"Map a function across each message in `imap-message-data', returning a list."
- (with-current-buffer (or buffer (current-buffer))
- (let (result)
- (mapatoms
- (lambda (s)
- (push (funcall func (get s 'UID) (get s propname)) result))
- imap-message-data)
- result)))
+ (let (result)
+ (mapatoms
+ (lambda (s)
+ (push (funcall func (get s 'UID) (get s propname)) result))
+ imap-message-data)
+ result))
(defmacro imap-message-envelope-date (uid &optional buffer)
`(with-current-buffer (or ,buffer (current-buffer))
@@ -1805,48 +1763,6 @@ is non-nil return these properties."
(format "String %s cannot be converted to a Lisp integer" number))
number)))
-(defun imap-fetch-safe (uids props &optional receive nouidfetch buffer)
- "Like `imap-fetch', but DTRT with Exchange 2007 bug.
-However, UIDS here is a cons, where the car is the canonical form
-of the UIDS specification, and the cdr is the one which works with
-Exchange 2007 or, potentially, other buggy servers.
-See `imap-enable-exchange-bug-workaround'."
- ;; The first time we get here for a given, we'll try the canonical
- ;; form. If we get the known error from the buggy server, set the
- ;; flag buffer-locally (to account for connections to multiple
- ;; servers), then re-try with the alternative UIDS spec. We don't
- ;; unconditionally use the alternative form, since the
- ;; currently-used alternatives are seriously inefficient with some
- ;; servers (although they are valid).
- ;;
- ;; FIXME: Maybe it would be cleaner to have a flag to not signal
- ;; the error (which otherwise gives a message), and test
- ;; `imap-failed-tags'. Also, Other IMAP clients use other forms of
- ;; request which work with Exchange, e.g. Claws does "UID FETCH 1:*
- ;; (UID)" rather than "FETCH UID 1,*". Is there a good reason not
- ;; to do the same?
- (condition-case data
- ;; Binding `debug-on-error' allows us to get the error from
- ;; `imap-parse-response' -- it's normally caught by Emacs around
- ;; execution of a process filter.
- (let ((debug-on-error t))
- (imap-fetch (if imap-enable-exchange-bug-workaround
- (cdr uids)
- (car uids))
- props receive nouidfetch buffer))
- (error
- (if (and (not imap-enable-exchange-bug-workaround)
- ;; This is the Exchange 2007 response. It may be more
- ;; robust just to check for a BAD response to the
- ;; attempted fetch.
- (string-match "The specified message set is invalid"
- (cadr data)))
- (with-current-buffer (or buffer (current-buffer))
- (set (make-local-variable 'imap-enable-exchange-bug-workaround)
- t)
- (imap-fetch (cdr uids) props receive nouidfetch))
- (signal (car data) (cdr data))))))
-
(defun imap-message-copyuid-1 (mailbox)
(if (imap-capability 'UIDPLUS)
(list (nth 0 (imap-mailbox-get-1 'copyuid mailbox))
@@ -1856,7 +1772,7 @@ See `imap-enable-exchange-bug-workaround'."
(imap-message-data (make-vector 2 0)))
(when (imap-mailbox-examine-1 mailbox)
(prog1
- (and (imap-fetch-safe '("*" . "*:*") "UID")
+ (and (imap-fetch "*:*" "UID")
(list (imap-mailbox-get-1 'uidvalidity mailbox)
(apply 'max (imap-message-map
(lambda (uid prop) uid) 'UID))))
@@ -1902,7 +1818,7 @@ first element. The rest of list contains the saved articles' UIDs."
(imap-message-data (make-vector 2 0)))
(when (imap-mailbox-examine-1 mailbox)
(prog1
- (and (imap-fetch-safe '("*" . "*:*") "UID")
+ (and (imap-fetch "*:*" "UID")
(list (imap-mailbox-get-1 'uidvalidity mailbox)
(apply 'max (imap-message-map
(lambda (uid prop) uid) 'UID))))
@@ -1959,12 +1875,7 @@ on failure."
(defun imap-send-command-1 (cmdstr)
(setq cmdstr (concat cmdstr imap-client-eol))
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert cmdstr)))
+ (imap-log cmdstr)
(process-send-string imap-process cmdstr))
(defun imap-send-command (command &optional buffer)
@@ -2002,13 +1913,7 @@ on failure."
(stream imap-stream)
(eol imap-client-eol))
(with-current-buffer cmd
- (and imap-log
- (with-current-buffer (get-buffer-create
- imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert-buffer-substring cmd)))
+ (imap-log cmd)
(process-send-region process (point-min)
(point-max)))
(process-send-string process imap-client-eol))))
@@ -2084,12 +1989,7 @@ Return nil if no complete line has arrived."
(with-current-buffer (process-buffer proc)
(goto-char (point-max))
(insert string)
- (and imap-log
- (with-current-buffer (get-buffer-create imap-log-buffer)
- (imap-disable-multibyte)
- (buffer-disable-undo)
- (goto-char (point-max))
- (insert string)))
+ (imap-log string)
(let (end)
(goto-char (point-min))
(while (setq end (imap-find-next-line))
@@ -2992,106 +2892,6 @@ Return nil if no complete line has arrived."
(imap-forward)
(nreverse body)))))
-(when imap-debug ; (untrace-all)
- (require 'trace)
- (buffer-disable-undo (get-buffer-create imap-debug-buffer))
- (mapc (lambda (f) (trace-function-background f imap-debug-buffer))
- '(
- imap-utf7-encode
- imap-utf7-decode
- imap-error-text
- imap-kerberos4s-p
- imap-kerberos4-open
- imap-ssl-p
- imap-ssl-open
- imap-network-p
- imap-network-open
- imap-interactive-login
- imap-kerberos4a-p
- imap-kerberos4-auth
- imap-cram-md5-p
- imap-cram-md5-auth
- imap-login-p
- imap-login-auth
- imap-anonymous-p
- imap-anonymous-auth
- imap-open-1
- imap-open
- imap-opened
- imap-ping-server
- imap-authenticate
- imap-close
- imap-capability
- imap-namespace
- imap-send-command-wait
- imap-mailbox-put
- imap-mailbox-get
- imap-mailbox-map-1
- imap-mailbox-map
- imap-current-mailbox
- imap-current-mailbox-p-1
- imap-current-mailbox-p
- imap-mailbox-select-1
- imap-mailbox-select
- imap-mailbox-examine-1
- imap-mailbox-examine
- imap-mailbox-unselect
- imap-mailbox-expunge
- imap-mailbox-close
- imap-mailbox-create-1
- imap-mailbox-create
- imap-mailbox-delete
- imap-mailbox-rename
- imap-mailbox-lsub
- imap-mailbox-list
- imap-mailbox-subscribe
- imap-mailbox-unsubscribe
- imap-mailbox-status
- imap-mailbox-acl-get
- imap-mailbox-acl-set
- imap-mailbox-acl-delete
- imap-current-message
- imap-list-to-message-set
- imap-fetch-asynch
- imap-fetch
- imap-fetch-safe
- imap-message-put
- imap-message-get
- imap-message-map
- imap-search
- imap-message-flag-permanent-p
- imap-message-flags-set
- imap-message-flags-del
- imap-message-flags-add
- imap-message-copyuid-1
- imap-message-copyuid
- imap-message-copy
- imap-message-appenduid-1
- imap-message-appenduid
- imap-message-append
- imap-body-lines
- imap-envelope-from
- imap-send-command-1
- imap-send-command
- imap-wait-for-tag
- imap-sentinel
- imap-find-next-line
- imap-arrival-filter
- imap-parse-greeting
- imap-parse-response
- imap-parse-resp-text
- imap-parse-resp-text-code
- imap-parse-data-list
- imap-parse-fetch
- imap-parse-status
- imap-parse-acl
- imap-parse-flag-list
- imap-parse-envelope
- imap-parse-body-extension
- imap-parse-body
- )))
-
(provide 'imap)
-;; arch-tag: 27369ed6-33e4-482f-96f1-8bb906ba70f7
;;; imap.el ends here
diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el
index 99278d9ee2..408eca9bac 100644
--- a/lisp/net/netrc.el
+++ b/lisp/net/netrc.el
@@ -54,12 +54,19 @@
"Netrc configuration."
:group 'comm)
+(defcustom netrc-file "~/.authinfo"
+ "File where user credentials are stored."
+ :type 'file
+ :group 'netrc)
+
(defvar netrc-services-file "/etc/services"
"The name of the services file.")
-(defun netrc-parse (file)
+(defun netrc-parse (&optional file)
(interactive "fFile to Parse: ")
"Parse FILE and return a list of all entries in the file."
+ (unless file
+ (setq file netrc-file))
(if (listp file)
file
(when (file-exists-p file)
@@ -160,9 +167,9 @@ MODE can be \"login\" or \"password\", suitable for passing to
(defaults (or defaults '(nil)))
info)
(if (listp mode)
- (setq info
- (mapcar
- (lambda (mode-element)
+ (setq info
+ (mapcar
+ (lambda (mode-element)
(netrc-machine-user-or-password
mode-element
authinfo-list
@@ -221,7 +228,19 @@ MODE can be \"login\" or \"password\", suitable for passing to
(eq type (car (cddr service)))))))
(cadr service)))
+(defun netrc-credentials (machine &rest ports)
+ "Return a user name/password pair.
+Port specifications will be prioritised in the order they are
+listed in the PORTS list."
+ (let ((list (netrc-parse))
+ found)
+ (while (and ports
+ (not found))
+ (setq found (netrc-machine list machine (pop ports))))
+ (when found
+ (list (cdr (assoc "login" found))
+ (cdr (assoc "password" found))))))
+
(provide 'netrc)
-;; arch-tag: af9929cc-2d12-482f-936e-eb4366f9fa55
;;; netrc.el ends here
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 5a8f1dff5c..590363a1f6 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -8,6 +8,7 @@
;; URL: http://www.nongnu.org/newsticker
;; Keywords: News, RSS, Atom
;; Time-stamp: "6. Dezember 2009, 19:15:32 (ulf)"
+;; Package: newsticker
;; ======================================================================
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index e1bdc2cade..a6629a4072 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -7,6 +7,7 @@
;; Filename: newst-plainview.el
;; URL: http://www.nongnu.org/newsticker
;; Time-stamp: "6. Dezember 2009, 19:17:02 (ulf)"
+;; Package: newsticker
;; ======================================================================
diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el
index ce468235b4..25ed65d04a 100644
--- a/lisp/net/newst-reader.el
+++ b/lisp/net/newst-reader.el
@@ -7,6 +7,7 @@
;; Filename: newst-reader.el
;; URL: http://www.nongnu.org/newsticker
;; Time-stamp: "6. Dezember 2009, 19:16:38 (ulf)"
+;; Package: newsticker
;; ======================================================================
diff --git a/lisp/net/newst-ticker.el b/lisp/net/newst-ticker.el
index 694d2cbc20..80df1a14f2 100644
--- a/lisp/net/newst-ticker.el
+++ b/lisp/net/newst-ticker.el
@@ -8,6 +8,7 @@
;; URL: http://www.nongnu.org/newsticker
;; Keywords: News, RSS, Atom
;; Time-stamp: "6. Dezember 2009, 19:16:00 (ulf)"
+;; Package: newsticker
;; ======================================================================
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index 80bc2c70a1..6bf0b593de 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -8,6 +8,7 @@
;; Created: 2007
;; Keywords: News, RSS, Atom
;; Time-stamp: "6. Dezember 2009, 19:17:28 (ulf)"
+;; Package: newsticker
;; ======================================================================
diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el
index 1d4b35bb61..2566529d42 100644
--- a/lisp/net/newsticker.el
+++ b/lisp/net/newsticker.el
@@ -9,6 +9,7 @@
;; Created: 17. June 2003
;; Keywords: News, RSS, Atom
;; Time-stamp: "6. Dezember 2009, 19:15:18 (ulf)"
+;; Version: 1.99
;; ======================================================================
diff --git a/lisp/net/ntlm.el b/lisp/net/ntlm.el
index 91e40e3d01..517e97efe6 100644
--- a/lisp/net/ntlm.el
+++ b/lisp/net/ntlm.el
@@ -27,9 +27,9 @@
;; This library is a direct translation of the Samba release 2.2.0
;; implementation of Windows NT and LanManager compatible password
;; encryption.
-;;
+;;
;; Interface functions:
-;;
+;;
;; ntlm-build-auth-request
;; This will return a binary string, which should be used in the
;; base64 encoded form and it is the caller's responsibility to encode
@@ -40,7 +40,7 @@
;; (which will be a binary string) as the first argument and to
;; encode the returned string with base64. The second argument user
;; should be given in user@domain format.
-;;
+;;
;; ntlm-get-password-hashes
;;
;;
@@ -534,5 +534,4 @@ into a Unicode string. PASSWD is truncated to 128 bytes if longer."
(provide 'ntlm)
-;; arch-tag: 348ace18-f8e2-4176-8fe9-d9ab4e96f296
;;; ntlm.el ends here
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 76fc1cd72d..093892a110 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -774,42 +774,64 @@ If SILENT is non-nil, do not print the message in any irc buffer."
(setq rcirc-input-ring-index (1- rcirc-input-ring-index))
(insert (rcirc-prev-input-string -1))))
-(defvar rcirc-nick-completions nil)
-(defvar rcirc-nick-completion-start-offset nil)
-
-(defun rcirc-complete-nick ()
- "Cycle through nick completions from list of nicks in channel."
+(defvar rcirc-server-commands
+ '("/admin" "/away" "/connect" "/die" "/error" "/info"
+ "/invite" "/ison" "/join" "/kick" "/kill" "/links"
+ "/list" "/lusers" "/mode" "/motd" "/names" "/nick"
+ "/notice" "/oper" "/part" "/pass" "/ping" "/pong"
+ "/privmsg" "/quit" "/rehash" "/restart" "/service" "/servlist"
+ "/server" "/squery" "/squit" "/stats" "/summon" "/time"
+ "/topic" "/trace" "/user" "/userhost" "/users" "/version"
+ "/wallops" "/who" "/whois" "/whowas")
+ "A list of user commands by IRC server.
+The value defaults to RFCs 1459 and 2812.")
+
+;; /me and /ctcp are not defined by `defun-rcirc-command'.
+(defvar rcirc-client-commands '("/me" "/ctcp")
+ "A list of user commands defined by IRC client rcirc.
+The list is updated automatically by `defun-rcirc-command'.")
+
+(defun rcirc-completion-at-point ()
+ "Function used for `completion-at-point-functions' in `rcirc-mode'."
+ (let* ((beg (save-excursion
+ (if (re-search-backward " " rcirc-prompt-end-marker t)
+ (1+ (point))
+ rcirc-prompt-end-marker)))
+ (table (if (and (= beg rcirc-prompt-end-marker)
+ (eq (char-after beg) ?/))
+ (delete-dups
+ (nconc
+ (sort (copy-sequence rcirc-client-commands) 'string-lessp)
+ (sort (copy-sequence rcirc-server-commands) 'string-lessp)))
+ (rcirc-channel-nicks (rcirc-buffer-process) rcirc-target))))
+ (list beg (point) table)))
+
+(defvar rcirc-completions nil)
+(defvar rcirc-completion-start nil)
+
+(defun rcirc-complete ()
+ "Cycle through completions from list of nicks in channel or IRC commands.
+IRC command completion is performed only if '/' is the first input char."
(interactive)
(if (eq last-command this-command)
- (setq rcirc-nick-completions
- (append (cdr rcirc-nick-completions)
- (list (car rcirc-nick-completions))))
- (setq rcirc-nick-completion-start-offset
- (- (save-excursion
- (if (re-search-backward " " rcirc-prompt-end-marker t)
- (1+ (point))
- rcirc-prompt-end-marker))
- rcirc-prompt-end-marker))
- (setq rcirc-nick-completions
- (let ((completion-ignore-case t))
- (all-completions
- (buffer-substring
- (+ rcirc-prompt-end-marker
- rcirc-nick-completion-start-offset)
- (point))
- (mapcar (lambda (x) (cons x nil))
- (rcirc-channel-nicks (rcirc-buffer-process)
- rcirc-target))))))
- (let ((completion (car rcirc-nick-completions)))
+ (setq rcirc-completions
+ (append (cdr rcirc-completions) (list (car rcirc-completions))))
+ (let ((completion-ignore-case t)
+ (table (rcirc-completion-at-point)))
+ (setq rcirc-completion-start (car table))
+ (setq rcirc-completions
+ (all-completions (buffer-substring rcirc-completion-start
+ (cadr table))
+ (nth 2 table)))))
+ (let ((completion (car rcirc-completions)))
(when completion
- (delete-region (+ rcirc-prompt-end-marker
- rcirc-nick-completion-start-offset)
- (point))
- (insert (concat completion
- (if (= (+ rcirc-prompt-end-marker
- rcirc-nick-completion-start-offset)
- rcirc-prompt-end-marker)
- ": "))))))
+ (delete-region rcirc-completion-start (point))
+ (insert
+ (concat completion
+ (cond
+ ((= (aref completion 0) ?/) " ")
+ ((= rcirc-completion-start rcirc-prompt-end-marker) ": ")
+ (t "")))))))
(defun set-rcirc-decode-coding-system (coding-system)
"Set the decode coding system used in this channel."
@@ -827,7 +849,7 @@ If SILENT is non-nil, do not print the message in any irc buffer."
(define-key rcirc-mode-map (kbd "RET") 'rcirc-send-input)
(define-key rcirc-mode-map (kbd "M-p") 'rcirc-insert-prev-input)
(define-key rcirc-mode-map (kbd "M-n") 'rcirc-insert-next-input)
-(define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete-nick)
+(define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete)
(define-key rcirc-mode-map (kbd "C-c C-b") 'rcirc-browse-url)
(define-key rcirc-mode-map (kbd "C-c C-c") 'rcirc-edit-multiline)
(define-key rcirc-mode-map (kbd "C-c C-j") 'rcirc-cmd-join)
@@ -948,6 +970,9 @@ This number is independent of the number of lines in the buffer.")
rcirc-buffer-alist))))
(rcirc-update-short-buffer-names))
+ (add-hook 'completion-at-point-functions
+ 'rcirc-completion-at-point nil 'local)
+
(run-hooks 'rcirc-mode-hook))
(defun rcirc-update-prompt (&optional all)
@@ -1085,7 +1110,7 @@ Create the buffer if it doesn't exist."
(goto-char (point-max))
(when (not (equal 0 (- (point) rcirc-prompt-end-marker)))
;; delete a trailing newline
- (when (bolp)
+ (when (eq (point) (point-at-bol))
(delete-char -1))
(let ((input (buffer-substring-no-properties
rcirc-prompt-end-marker (point))))
@@ -1342,6 +1367,12 @@ Logfiles are kept in `rcirc-log-directory'."
:type 'integer
:group 'rcirc)
+(defcustom rcirc-log-process-buffers nil
+ "Non-nil if rcirc process buffers should be logged to disk."
+ :group 'rcirc
+ :type 'boolean
+ :version "24.1")
+
(defun rcirc-last-quit-line (process nick target)
"Return the line number where NICK left TARGET.
Returns nil if the information is not recorded."
@@ -1507,14 +1538,21 @@ record activity."
(when (not (rcirc-channel-p rcirc-target))
'nick)))
- (when rcirc-log-flag
+ (when (and rcirc-log-flag
+ (or target
+ rcirc-log-process-buffers))
(rcirc-log process sender response target text))
(sit-for 0) ; displayed text before hook
(run-hook-with-args 'rcirc-print-hooks
process sender response target text)))))
-(defcustom rcirc-log-filename-function 'rcirc-generate-new-buffer-name
+(defun rcirc-generate-log-filename (process target)
+ (if target
+ (rcirc-generate-new-buffer-name process target)
+ (process-name process)))
+
+(defcustom rcirc-log-filename-function 'rcirc-generate-log-filename
"A function to generate the filename used by rcirc's logging facility.
It is called with two arguments, PROCESS and TARGET (see
@@ -1991,16 +2029,18 @@ activity. Only run if the buffer is not visible and
;; containing the text following the /cmd.
(defmacro defun-rcirc-command (command argument docstring interactive-form
- &rest body)
+ &rest body)
"Define a command."
- `(defun ,(intern (concat "rcirc-cmd-" (symbol-name command)))
- (,@argument &optional process target)
- ,(concat docstring "\n\nNote: If PROCESS or TARGET are nil, the values given"
- "\nby `rcirc-buffer-process' and `rcirc-target' will be used.")
- ,interactive-form
- (let ((process (or process (rcirc-buffer-process)))
- (target (or target rcirc-target)))
- ,@body)))
+ `(progn
+ (add-to-list 'rcirc-client-commands ,(concat "/" (symbol-name command)))
+ (defun ,(intern (concat "rcirc-cmd-" (symbol-name command)))
+ (,@argument &optional process target)
+ ,(concat docstring "\n\nNote: If PROCESS or TARGET are nil, the values given"
+ "\nby `rcirc-buffer-process' and `rcirc-target' will be used.")
+ ,interactive-form
+ (let ((process (or process (rcirc-buffer-process)))
+ (target (or target rcirc-target)))
+ ,@body))))
(defun-rcirc-command msg (message)
"Send private MESSAGE to TARGET."
@@ -2138,12 +2178,13 @@ With a prefix arg, prompt for new topic."
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))
-(defun rcirc-add-or-remove (set &optional elt)
- (if (and elt (not (string= "" elt)))
- (if (member-ignore-case elt set)
- (delete elt set)
- (cons elt set))
- set))
+(defun rcirc-add-or-remove (set &rest elements)
+ (dolist (elt elements)
+ (if (and elt (not (string= "" elt)))
+ (setq set (if (member-ignore-case elt set)
+ (delete elt set)
+ (cons elt set)))))
+ set)
(defun-rcirc-command ignore (nick)
"Manage the ignore list.
@@ -2151,7 +2192,9 @@ Ignore NICK, unignore NICK if already ignored, or list ignored
nicks when no NICK is given. When listing ignored nicks, the
ones added to the list automatically are marked with an asterisk."
(interactive "sToggle ignoring of nick: ")
- (setq rcirc-ignore-list (rcirc-add-or-remove rcirc-ignore-list nick))
+ (setq rcirc-ignore-list
+ (apply #'rcirc-add-or-remove rcirc-ignore-list
+ (split-string nick nil t)))
(rcirc-print process nil "IGNORE" target
(mapconcat
(lambda (nick)
@@ -2163,14 +2206,18 @@ ones added to the list automatically are marked with an asterisk."
(defun-rcirc-command bright (nick)
"Manage the bright nick list."
(interactive "sToggle emphasis of nick: ")
- (setq rcirc-bright-nicks (rcirc-add-or-remove rcirc-bright-nicks nick))
+ (setq rcirc-bright-nicks
+ (apply #'rcirc-add-or-remove rcirc-bright-nicks
+ (split-string nick nil t)))
(rcirc-print process nil "BRIGHT" target
(mapconcat 'identity rcirc-bright-nicks " ")))
(defun-rcirc-command dim (nick)
"Manage the dim nick list."
(interactive "sToggle deemphasis of nick: ")
- (setq rcirc-dim-nicks (rcirc-add-or-remove rcirc-dim-nicks nick))
+ (setq rcirc-dim-nicks
+ (apply #'rcirc-add-or-remove rcirc-dim-nicks
+ (split-string nick nil t)))
(rcirc-print process nil "DIM" target
(mapconcat 'identity rcirc-dim-nicks " ")))
@@ -2179,7 +2226,9 @@ ones added to the list automatically are marked with an asterisk."
Mark KEYWORD, unmark KEYWORD if already marked, or list marked
keywords when no KEYWORD is given."
(interactive "sToggle highlighting of keyword: ")
- (setq rcirc-keywords (rcirc-add-or-remove rcirc-keywords keyword))
+ (setq rcirc-keywords
+ (apply #'rcirc-add-or-remove rcirc-keywords
+ (split-string keyword nil t)))
(rcirc-print process nil "KEYWORD" target
(mapconcat 'identity rcirc-keywords " ")))
diff --git a/lisp/net/sasl-cram.el b/lisp/net/sasl-cram.el
index 9faeded5c3..38d7ff4e11 100644
--- a/lisp/net/sasl-cram.el
+++ b/lisp/net/sasl-cram.el
@@ -5,6 +5,7 @@
;; Author: Daiki Ueno <[email protected]>
;; Kenichi OKADA <[email protected]>
;; Keywords: SASL, CRAM-MD5
+;; Package: sasl
;; This file is part of GNU Emacs.
@@ -46,5 +47,4 @@
(provide 'sasl-cram)
-;; arch-tag: 46cb281b-975a-4fe0-a39f-3018691b1b05
;;; sasl-cram.el ends here
diff --git a/lisp/net/sasl-digest.el b/lisp/net/sasl-digest.el
index 4d839296c9..8559c8f3fa 100644
--- a/lisp/net/sasl-digest.el
+++ b/lisp/net/sasl-digest.el
@@ -5,6 +5,7 @@
;; Author: Daiki Ueno <[email protected]>
;; Kenichi OKADA <[email protected]>
;; Keywords: SASL, DIGEST-MD5
+;; Package: sasl
;; This file is part of GNU Emacs.
@@ -94,10 +95,10 @@ charset algorithm cipher-opts auth-param)."
(md5-binary
(concat
(encode-hex-string
- (md5-binary (concat (md5-binary
+ (md5-binary (concat (md5-binary
(concat username ":" realm ":" passphrase))
":" nonce ":" cnonce
- (if authzid
+ (if authzid
(concat ":" authzid)))))
":" nonce
":" (format "%08x" nonce-count) ":" cnonce ":" qop ":"
@@ -153,5 +154,4 @@ charset algorithm cipher-opts auth-param)."
(provide 'sasl-digest)
-;; arch-tag: 786e02ed-1bc4-4b3c-bf34-96c27e31084d
;;; sasl-digest.el ends here
diff --git a/lisp/net/sasl-ntlm.el b/lisp/net/sasl-ntlm.el
index 94366f1a52..ace50528ac 100644
--- a/lisp/net/sasl-ntlm.el
+++ b/lisp/net/sasl-ntlm.el
@@ -6,6 +6,7 @@
;; Keywords: SASL, NTLM
;; Version: 1.00
;; Created: February 2001
+;; Package: sasl
;; This file is part of GNU Emacs.
@@ -62,5 +63,4 @@ challenge stored in the 2nd element of STEP. Called from `sasl-next-step'."
(provide 'sasl-ntlm)
-;; arch-tag: 1d9164c1-1df0-418f-b7ab-360157fd05dc
;;; sasl-ntlm.el ends here
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el
index c2a3f10e3d..7f864390a5 100644
--- a/lisp/net/sasl.el
+++ b/lisp/net/sasl.el
@@ -267,5 +267,4 @@ It contain at least 64 bits of entropy."
(provide 'sasl)
-;; arch-tag: 8b3326fa-4978-4fda-93e2-cb2c6255f887
;;; sasl.el ends here
diff --git a/lisp/net/tls.el b/lisp/net/tls.el
index 9a1b0bb661..821daba6f6 100644
--- a/lisp/net/tls.el
+++ b/lisp/net/tls.el
@@ -298,5 +298,4 @@ match `%s'. Connect anyway? " host))))))
(provide 'tls)
-;; arch-tag: 5596d1c4-facc-4bc4-94a9-9863b928d7ac
;;; tls.el ends here
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index ac86fabe3a..8241c04882 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -1,3 +1,5 @@
+(setq tramp-version 24)
+
;;; tramp-cache.el --- file information caching for Tramp
;; Copyright (C) 2000, 2005, 2006, 2007, 2008, 2009,
@@ -6,6 +8,7 @@
;; Author: Daniel Pittman <[email protected]>
;; Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -49,24 +52,14 @@
;;; Code:
-;; Pacify byte-compiler.
-(eval-when-compile
- (require 'cl)
- (autoload 'tramp-message "tramp")
- (autoload 'tramp-tramp-file-p "tramp")
- ;; We cannot autoload macro `with-parsed-tramp-file-name', it
- ;; results in problems of byte-compiled code.
- (autoload 'tramp-dissect-file-name "tramp")
- (autoload 'tramp-file-name-method "tramp")
- (autoload 'tramp-file-name-user "tramp")
- (autoload 'tramp-file-name-host "tramp")
- (autoload 'tramp-file-name-localname "tramp")
- (autoload 'tramp-run-real-handler "tramp")
- (autoload 'tramp-time-less-p "tramp")
- (autoload 'time-stamp-string "time-stamp"))
+(require 'tramp)
+; bob, 2010 Sep 11
+; (require 'trampver.el)
+(autoload 'time-stamp-string "time-stamp")
;;; -- Cache --
+;;;###tramp-autoload
(defvar tramp-cache-data (make-hash-table :test 'equal)
"Hash table for remote files properties.")
@@ -102,6 +95,7 @@ time.")
(defvar tramp-cache-data-changed nil
"Whether persistent cache data have been changed.")
+;;;###tramp-autoload
(defun tramp-get-file-property (vec file property default)
"Get the PROPERTY of FILE from the cache context of VEC.
Returns DEFAULT if not set."
@@ -129,6 +123,7 @@ Returns DEFAULT if not set."
(tramp-message vec 8 "%s %s %s" file property value)
value))
+;;;###tramp-autoload
(defun tramp-set-file-property (vec file property value)
"Set the PROPERTY of FILE to VALUE, in the cache context of VEC.
Returns VALUE."
@@ -143,6 +138,26 @@ Returns VALUE."
(tramp-message vec 8 "%s %s %s" file property value)
value))
+;;;###tramp-autoload
+(defmacro with-file-property (vec file property &rest body)
+ "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
+FILE must be a local file name on a connection identified via VEC."
+ `(if (file-name-absolute-p ,file)
+ (let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
+ (when (eq value 'undef)
+ ;; We cannot pass @body as parameter to
+ ;; `tramp-set-file-property' because it mangles our
+ ;; debug messages.
+ (setq value (progn ,@body))
+ (tramp-set-file-property ,vec ,file ,property value))
+ value)
+ ,@body))
+
+(put 'with-file-property 'lisp-indent-function 3)
+(put 'with-file-property 'edebug-form-spec t)
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>"))
+
+;;;###tramp-autoload
(defun tramp-flush-file-property (vec file)
"Remove all properties of FILE in the cache context of VEC."
;; Unify localname.
@@ -151,6 +166,7 @@ Returns VALUE."
(tramp-message vec 8 "%s" file)
(remhash vec tramp-cache-data))
+;;;###tramp-autoload
(defun tramp-flush-directory-property (vec directory)
"Remove all properties of DIRECTORY in the cache context of VEC.
Remove also properties of all files in subdirectories."
@@ -174,8 +190,7 @@ Remove also properties of all files in subdirectories."
(buffer-file-name)
default-directory)))
(when (tramp-tramp-file-p bfn)
- (let* ((v (tramp-dissect-file-name bfn))
- (localname (tramp-file-name-localname v)))
+ (with-parsed-tramp-file-name bfn nil
(tramp-flush-file-property v localname)))))
(add-hook 'before-revert-hook 'tramp-flush-file-function)
@@ -192,6 +207,7 @@ Remove also properties of all files in subdirectories."
;;; -- Properties --
+;;;###tramp-autoload
(defun tramp-get-connection-property (key property default)
"Get the named PROPERTY for the connection.
KEY identifies the connection, it is either a process or a vector.
@@ -208,6 +224,7 @@ If the value is not set for the connection, returns DEFAULT."
(tramp-message key 7 "%s %s" property value)
value))
+;;;###tramp-autoload
(defun tramp-set-connection-property (key property value)
"Set the named PROPERTY of a connection to VALUE.
KEY identifies the connection, it is either a process or a vector.
@@ -230,6 +247,23 @@ PROPERTY is set persistent when KEY is a vector."
(error nil))
value))
+;;;###tramp-autoload
+(defmacro with-connection-property (key property &rest body)
+ "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
+ `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
+ (when (eq value 'undef)
+ ;; We cannot pass ,@body as parameter to
+ ;; `tramp-set-connection-property' because it mangles our debug
+ ;; messages.
+ (setq value (progn ,@body))
+ (tramp-set-connection-property ,key ,property value))
+ value))
+
+(put 'with-connection-property 'lisp-indent-function 2)
+(put 'with-connection-property 'edebug-form-spec t)
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
+
+;;;###tramp-autoload
(defun tramp-flush-connection-property (key)
"Remove all properties identified by KEY.
KEY identifies the connection, it is either a process or a vector."
@@ -250,6 +284,7 @@ KEY identifies the connection, it is either a process or a vector."
(setq tramp-cache-data-changed t)
(remhash key tramp-cache-data))
+;;;###tramp-autoload
(defun tramp-cache-print (table)
"Print hash table TABLE."
(when (hash-table-p table)
@@ -270,6 +305,7 @@ KEY identifies the connection, it is either a process or a vector."
table)
result)))
+;;;###tramp-autoload
(defun tramp-list-connections ()
"Return a list of all known connection vectors according to `tramp-cache'."
(let (result)
@@ -325,6 +361,7 @@ KEY identifies the connection, it is either a process or a vector."
(remove-hook 'kill-emacs-hook
'tramp-dump-connection-properties)))
+;;;###tramp-autoload
(defun tramp-parse-connection-properties (method)
"Return a list of (user host) tuples allowed to access for METHOD.
This function is added always in `tramp-get-completion-function'
@@ -363,6 +400,10 @@ for all methods. Resulting data are derived from connection history."
tramp-persistency-file-name (error-message-string err))
(clrhash tramp-cache-data))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-cache 'force)))
+
(provide 'tramp-cache)
;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 0e31360a41..32cbb16b9e 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -4,6 +4,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -128,6 +129,7 @@ This includes password cache, file cache, connection cache, buffers."
;; Tramp version is useful in a number of situations.
+;;;###tramp-autoload
(defun tramp-version (arg)
"Print version number of tramp.el in minibuffer or current buffer."
(interactive "P")
@@ -386,6 +388,9 @@ please ensure that the buffers are attached to your email.\n\n")
(defalias 'tramp-submit-bug 'tramp-bug)
+(add-hook 'tramp-unload-hook
+ (lambda () (unload-feature 'tramp-cmds 'force)))
+
(provide 'tramp-cmds)
;;; TODO:
@@ -394,7 +399,7 @@ please ensure that the buffers are attached to your email.\n\n")
;; * WIBNI there was an interactive command prompting for Tramp
;; method, hostname, username and filename and translates the user
;; input into the correct filename syntax (depending on the Emacs
-;; flavor) (Reiner Steib)
+;; flavor) (Reiner Steib)
;; * Let the user edit the connection properties interactively.
;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
;; * It's just that when I come to Customize `tramp-default-user-alist'
@@ -403,7 +408,7 @@ please ensure that the buffers are attached to your email.\n\n")
;; Option and should not be modified by the code. add-to-list is
;; called in several places. One way to handle that is to have a new
;; ordinary variable that gets its initial value from
-;; tramp-default-user-alist and then is added to. (Pete Forman)
+;; tramp-default-user-alist and then is added to. (Pete Forman)
;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c
;;; tramp-cmds.el ends here
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 484d2be7ab..d5884574cb 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -4,6 +4,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -30,6 +31,10 @@
(eval-when-compile
+ (require 'tramp-loaddefs))
+
+(eval-when-compile
+
;; Pacify byte-compiler.
(require 'cl))
@@ -42,33 +47,20 @@
(require 'timer-funcs)
(require 'timer))
- (autoload 'tramp-tramp-file-p "tramp")
- (autoload 'tramp-file-name-handler "tramp")
-
;; We check whether `start-file-process' is bound.
(unless (fboundp 'start-file-process)
;; tramp-util offers integration into other (X)Emacs packages like
;; compile.el, gud.el etc. Not necessary in Emacs 23.
(eval-after-load "tramp"
- '(progn
- (require 'tramp-util)
- (add-hook 'tramp-unload-hook
- '(lambda ()
- (when (featurep 'tramp-util)
- (unload-feature 'tramp-util 'force))))))
+ '(require 'tramp-util))
;; Make sure that we get integration with the VC package. When it
;; is loaded, we need to pull in the integration module. Not
;; necessary in Emacs 23.
(eval-after-load "vc"
(eval-after-load "tramp"
- '(progn
- (require 'tramp-vc)
- (add-hook 'tramp-unload-hook
- '(lambda ()
- (when (featurep 'tramp-vc)
- (unload-feature 'tramp-vc 'force))))))))
+ '(require 'tramp-vc))))
;; Avoid byte-compiler warnings if the byte-compiler supports this.
;; Currently, XEmacs supports this.
@@ -262,6 +254,24 @@ Add the extension of FILENAME, if existing."
;; Default value in XEmacs.
(t 134217727)))
+(defun tramp-compat-decimal-to-octal (i)
+ "Return a string consisting of the octal digits of I.
+Not actually used. Use `(format \"%o\" i)' instead?"
+ (cond ((< i 0) (error "Cannot convert negative number to octal"))
+ ((not (integerp i)) (error "Cannot convert non-integer to octal"))
+ ((zerop i) "0")
+ (t (concat (tramp-compat-decimal-to-octal (/ i 8))
+ (number-to-string (% i 8))))))
+
+;; Kudos to Gerd Moellmann for this suggestion.
+(defun tramp-compat-octal-to-decimal (ostr)
+ "Given a string of octal digits, return a decimal number."
+ (let ((x (or ostr "")))
+ ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
+ (unless (string-match "\\`[0-7]*\\'" x)
+ (error "Non-octal junk in string `%s'" x))
+ (string-to-number ostr 8)))
+
;; ID-FORMAT does not exists in XEmacs.
(defun tramp-compat-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files (compat function)."
@@ -396,6 +406,20 @@ This is, the first, empty, element is omitted. In XEmacs, the first
element is not omitted."
(delete "" (split-string string pattern)))
+(defun tramp-compat-call-process
+ (program &optional infile destination display &rest args)
+ "Calls `call-process' on the local host.
+This is needed because for some Emacs flavors Tramp has
+defadviced `call-process' to behave like `process-file'. The
+Lisp error raised when PROGRAM is nil is trapped also, returning 1."
+ (let ((default-directory
+ (if (file-remote-p default-directory)
+ (tramp-compat-temporary-file-directory)
+ default-directory)))
+ (if (executable-find program)
+ (apply 'call-process program infile destination display args)
+ 1)))
+
(defun tramp-compat-process-running-p (process-name)
"Returns `t' if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
@@ -438,6 +462,10 @@ element is not omitted."
(setenv "UNIX95" unix95)
result)))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-compat 'force)))
+
(provide 'tramp-compat)
;;; TODO:
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el
index 632b400e2b..e5d0ffd336 100644
--- a/lisp/net/tramp-fish.el
+++ b/lisp/net/tramp-fish.el
@@ -4,6 +4,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -156,16 +157,14 @@
(require 'cl))
(require 'tramp)
-(require 'tramp-cache)
-(require 'tramp-compat)
;; Define FISH method ...
-(defcustom tramp-fish-method "fish"
- "*Method to connect via FISH protocol."
- :group 'tramp
- :type 'string)
+;;;###tramp-autoload
+(defconst tramp-fish-method "fish"
+ "*Method to connect via FISH protocol.")
;; ... and add it to the method list.
+;;;###tramp-autoload
(add-to-list 'tramp-methods (cons tramp-fish-method nil))
;; Add a default for `tramp-default-user-alist'. Default is the local user.
@@ -263,11 +262,13 @@ Used instead of analyzing error codes of commands.")
"Alist of handler functions for Tramp FISH method.
Operations not mentioned here will be handled by the default Emacs primitives.")
-(defun tramp-fish-file-name-p (filename)
+;;;###tramp-autoload
+(defsubst tramp-fish-file-name-p (filename)
"Check if it's a filename for FISH protocol."
(let ((v (tramp-dissect-file-name filename)))
(string= (tramp-file-name-method v) tramp-fish-method)))
+;;;###tramp-autoload
(defun tramp-fish-file-name-handler (operation &rest args)
"Invoke the FISH related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
@@ -277,6 +278,7 @@ pass to the OPERATION."
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args))))
+;;;###tramp-autoload
(add-to-list 'tramp-foreign-file-name-handler-alist
(cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler))
@@ -687,7 +689,7 @@ target of the symlink differ."
(tramp-flush-file-property v localname)
(unless (tramp-fish-send-command-and-check
v (format "#CHMOD %s %s"
- (tramp-decimal-to-octal mode)
+ (tramp-compat-decimal-to-octal mode)
(tramp-shell-quote-argument localname)))
(tramp-error
v 'file-error "Error while changing file's mode %s" filename))))
@@ -1169,6 +1171,10 @@ Returns nil if there has been an error message."
(goto-char (point-min))
(looking-at tramp-fish-ok-prompt-regexp)))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-fish 'force)))
+
(provide 'tramp-fish)
;
;;;; TODO:
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 4c373cbcd8..799b974bd0 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -5,6 +5,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -29,7 +30,6 @@
;;; Code:
(require 'tramp)
-(autoload 'tramp-set-connection-property "tramp-cache")
(eval-when-compile
@@ -98,13 +98,14 @@ present for backward compatibility."
(add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp)
;; Define FTP method ...
-(defcustom tramp-ftp-method "ftp"
- "*When this method name is used, forward all calls to Ange-FTP."
- :group 'tramp
- :type 'string)
+;;;###tramp-autoload
+(defconst tramp-ftp-method "ftp"
+ "*When this method name is used, forward all calls to Ange-FTP.")
;; ... and add it to the method list.
-(add-to-list 'tramp-methods (cons tramp-ftp-method nil))
+;;;###tramp-autoload
+(unless (featurep 'xemacs)
+ (add-to-list 'tramp-methods (cons tramp-ftp-method nil)))
;; Add some defaults for `tramp-default-method-alist'
(add-to-list 'tramp-default-method-alist
@@ -128,6 +129,7 @@ present for backward compatibility."
(symbol-plist
'substitute-in-file-name))))))
+;;;###tramp-autoload
(defun tramp-ftp-file-name-handler (operation &rest args)
"Invoke the Ange-FTP handler for OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
@@ -198,13 +200,20 @@ pass to the OPERATION."
(inhibit-file-name-operation operation))
(apply 'ange-ftp-hook-function operation args)))))))
-(defun tramp-ftp-file-name-p (filename)
+;;;###tramp-autoload
+(defsubst tramp-ftp-file-name-p (filename)
"Check if it's a filename that should be forwarded to Ange-FTP."
(let ((v (tramp-dissect-file-name filename)))
(string= (tramp-file-name-method v) tramp-ftp-method)))
-(add-to-list 'tramp-foreign-file-name-handler-alist
- (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))
+;;;###tramp-autoload
+(unless (featurep 'xemacs)
+ (add-to-list 'tramp-foreign-file-name-handler-alist
+ (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)))
+
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-ftp 'force)))
(provide 'tramp-ftp)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 202eaf5983..6e07ec1902 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -4,6 +4,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -107,6 +108,7 @@
(require 'url-util)
(require 'zeroconf)
+;;;###tramp-autoload
(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
"*List of methods for remote files, accessed with GVFS."
:group 'tramp
@@ -132,11 +134,11 @@
;; Add the methods to `tramp-methods', in order to allow minibuffer
;; completion.
-(eval-after-load "tramp-gvfs"
- '(when (featurep 'tramp-gvfs)
- (dolist (elt tramp-gvfs-methods)
- (unless (assoc elt tramp-methods)
- (add-to-list 'tramp-methods (cons elt nil))))))
+;;;###tramp-autoload
+(when (featurep 'dbusbind)
+ (dolist (elt tramp-gvfs-methods)
+ (unless (assoc elt tramp-methods)
+ (add-to-list 'tramp-methods (cons elt nil)))))
(defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp")
"The preceeding object path for own objects.")
@@ -144,9 +146,12 @@
(defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon"
"The well known name of the GVFS daemon.")
-;; Check that GVFS is available.
-(unless (dbus-ping :session tramp-gvfs-service-daemon 100)
- (throw 'tramp-loading nil))
+;; Check that GVFS is available. D-Bus integration is available since
+;; Emacs 23 on some system types. We don't call `dbus-ping', because
+;; this would load dbus.el.
+(unless (and (tramp-compat-funcall 'dbus-get-unique-name :session)
+ (tramp-compat-process-running-p "gvfs-fuse-daemon"))
+ (error "Package `tramp-gvfs' not supported"))
(defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker"
"The object path of the GVFS daemon.")
@@ -384,7 +389,7 @@ Every entry is a list (NAME ADDRESS).")
(expand-file-name . tramp-gvfs-handle-expand-file-name)
;; `file-accessible-directory-p' performed by default handler.
(file-attributes . tramp-gvfs-handle-file-attributes)
- (file-directory-p . tramp-smb-handle-file-directory-p)
+ (file-directory-p . tramp-gvfs-handle-file-directory-p)
(file-executable-p . tramp-gvfs-handle-file-executable-p)
(file-exists-p . tramp-gvfs-handle-file-exists-p)
(file-local-copy . tramp-gvfs-handle-file-local-copy)
@@ -430,13 +435,15 @@ Every entry is a list (NAME ADDRESS).")
"Alist of handler functions for Tramp GVFS method.
Operations not mentioned here will be handled by the default Emacs primitives.")
-(defun tramp-gvfs-file-name-p (filename)
+;;;###tramp-autoload
+(defsubst tramp-gvfs-file-name-p (filename)
"Check if it's a filename handled by the GVFS daemon."
(and (tramp-tramp-file-p filename)
(let ((method
(tramp-file-name-method (tramp-dissect-file-name filename))))
(and (stringp method) (member method tramp-gvfs-methods)))))
+;;;###tramp-autoload
(defun tramp-gvfs-file-name-handler (operation &rest args)
"Invoke the GVFS related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
@@ -448,8 +455,10 @@ pass to the OPERATION."
;; This might be moved to tramp.el. It shall be the first file name
;; handler.
-(add-to-list 'tramp-foreign-file-name-handler-alist
- (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))
+;;;###tramp-autoload
+(when (featurep 'dbusbind)
+ (add-to-list 'tramp-foreign-file-name-handler-alist
+ (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)))
(defun tramp-gvfs-stringify-dbus-message (message)
"Convert a D-Bus message into readable UTF8 strings, used for traces."
@@ -493,7 +502,7 @@ In case of an error, modify the error message by replacing
`(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename)))
elt)
(condition-case err
- (funcall ,handler ,@args)
+ (tramp-compat-funcall ,handler ,@args)
(error
(setq elt (cdr err))
(while elt
@@ -646,6 +655,10 @@ is no information where to trace the message.")
"Like `file-attributes' for Tramp files."
(file-attributes (tramp-gvfs-fuse-file-name filename) id-format))
+(defun tramp-gvfs-handle-file-directory-p (filename)
+ "Like `file-directory-p' for Tramp files."
+ (file-directory-p (tramp-gvfs-fuse-file-name filename)))
+
(defun tramp-gvfs-handle-file-executable-p (filename)
"Like `file-executable-p' for Tramp files."
(file-executable-p (tramp-gvfs-fuse-file-name filename)))
@@ -1402,6 +1415,10 @@ They are retrieved from the hal daemon."
(tramp-set-completion-function
"synce" '((tramp-synce-parse-device-names "")))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-gvfs 'force)))
+
(provide 'tramp-gvfs)
;;; TODO:
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el
index d76cd3b3bc..63dfd105f1 100644
--- a/lisp/net/tramp-gw.el
+++ b/lisp/net/tramp-gw.el
@@ -4,6 +4,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -37,11 +38,6 @@
(require 'cl)
(require 'custom))
-;; Autoload the socks library. It is used only when we access a SOCKS server.
-(autoload 'socks-open-network-stream "socks")
-(defvar socks-username (user-login-name))
-(defvar socks-server (list "Default server" "socks" 1080 5))
-
;; Avoid byte-compiler warnings if the byte-compiler supports this.
;; Currently, XEmacs supports this.
(eval-when-compile
@@ -49,21 +45,29 @@
(byte-compiler-options (warnings (- unused-vars)))))
;; Define HTTP tunnel method ...
-(defvar tramp-gw-tunnel-method "tunnel"
+;;;###tramp-autoload
+(defconst tramp-gw-tunnel-method "tunnel"
"*Method to connect HTTP gateways.")
;; ... and port.
-(defvar tramp-gw-default-tunnel-port 8080
+(defconst tramp-gw-default-tunnel-port 8080
"*Default port for HTTP gateways.")
;; Define SOCKS method ...
-(defvar tramp-gw-socks-method "socks"
+;;;###tramp-autoload
+(defconst tramp-gw-socks-method "socks"
"*Method to connect SOCKS servers.")
;; ... and port.
-(defvar tramp-gw-default-socks-port 1080
+(defconst tramp-gw-default-socks-port 1080
"*Default port for SOCKS servers.")
+;; Autoload the socks library. It is used only when we access a SOCKS server.
+(autoload 'socks-open-network-stream "socks")
+(defvar socks-username (user-login-name))
+(defvar socks-server
+ (list "Default server" "socks" tramp-gw-default-socks-port 5))
+
;; Add a default for `tramp-default-user-alist'. Default is the local user.
(add-to-list 'tramp-default-user-alist
`(,tramp-gw-tunnel-method nil ,(user-login-name)))
@@ -124,6 +128,7 @@
(process-send-string
(tramp-get-connection-property proc "process" nil) string)))
+;;;###tramp-autoload
(defun tramp-gw-open-connection (vec gw-vec target-vec)
"Open a remote connection to VEC (see `tramp-file-name' structure).
Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a
@@ -309,6 +314,9 @@ password in password cache. This is done for the first try only."
(format
"Password for %s@[%s]: " socks-username (read (current-buffer)))))))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-gw 'force)))
(provide 'tramp-gw)
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
index 3e8883d2e0..4a5e2418cf 100644
--- a/lisp/net/tramp-imap.el
+++ b/lisp/net/tramp-imap.el
@@ -4,6 +4,7 @@
;; Author: Teodor Zlatanov <[email protected]>
;; Keywords: mail, comm
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -54,7 +55,6 @@
(require 'assoc)
(require 'tramp)
-(require 'tramp-compat)
(autoload 'auth-source-user-or-password "auth-source")
(autoload 'epg-context-operation "epg")
@@ -75,21 +75,29 @@
'(add-to-list 'imap-hash-headers 'X-Size 'append))
;; Define Tramp IMAP method ...
+;;;###tramp-autoload
(defconst tramp-imap-method "imap"
"*Method to connect via IMAP protocol.")
-(add-to-list 'tramp-methods (list tramp-imap-method '(tramp-default-port 143)))
+;;;###tramp-autoload
+(when (and (locate-library "epa") (locate-library "imap-hash"))
+ (add-to-list 'tramp-methods
+ (list tramp-imap-method '(tramp-default-port 143))))
;; Add a default for `tramp-default-user-alist'. Default is the local user.
(add-to-list 'tramp-default-user-alist
`(,tramp-imap-method nil ,(user-login-name)))
;; Define Tramp IMAPS method ...
+;;;###tramp-autoload
(defconst tramp-imaps-method "imaps"
"*Method to connect via secure IMAP protocol.")
;; ... and add it to the method list.
-(add-to-list 'tramp-methods (list tramp-imaps-method '(tramp-default-port 993)))
+;;;###tramp-autoload
+(when (and (locate-library "epa") (locate-library "imap-hash"))
+ (add-to-list 'tramp-methods
+ (list tramp-imaps-method '(tramp-default-port 993))))
;; Add a default for `tramp-default-user-alist'. Default is the local user.
(add-to-list 'tramp-default-user-alist
@@ -183,13 +191,15 @@ Operations not mentioned here will be handled by the default Emacs primitives.")
(defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never
(defvar tramp-imap-passphrase nil)
-(defun tramp-imap-file-name-p (filename)
+;;;###tramp-autoload
+(defsubst tramp-imap-file-name-p (filename)
"Check if it's a filename for IMAP protocol."
(let ((v (tramp-dissect-file-name filename)))
(or
(string= (tramp-file-name-method v) tramp-imap-method)
(string= (tramp-file-name-method v) tramp-imaps-method))))
+;;;###tramp-autoload
(defun tramp-imap-file-name-handler (operation &rest args)
"Invoke the IMAP related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
@@ -199,8 +209,10 @@ pass to the OPERATION."
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args))))
-(add-to-list 'tramp-foreign-file-name-handler-alist
- (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler))
+;;;###tramp-autoload
+(when (and (locate-library "epa") (locate-library "imap-hash"))
+ (add-to-list 'tramp-foreign-file-name-handler-alist
+ (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler)))
(defun tramp-imap-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date
@@ -775,6 +787,10 @@ With NEEDED-SUBJECT, alters the imap-hash test accordingly."
tramp-imap-subject-marker
(if needed-subject needed-subject "")))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-imap 'force)))
+
;;; TODO:
;; * Implement `tramp-imap-handle-delete-directory',
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index f1ec7a9b81..84d1197211 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -5,6 +5,7 @@
;; Author: Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -29,17 +30,16 @@
(eval-when-compile (require 'cl)) ; block, return
(require 'tramp)
-(require 'tramp-cache)
-(require 'tramp-compat)
;; Define SMB method ...
-(defcustom tramp-smb-method "smb"
- "*Method to connect SAMBA and M$ SMB servers."
- :group 'tramp
- :type 'string)
+;;;###tramp-autoload
+(defconst tramp-smb-method "smb"
+ "*Method to connect SAMBA and M$ SMB servers.")
;; ... and add it to the method list.
-(add-to-list 'tramp-methods (cons tramp-smb-method nil))
+;;;###tramp-autoload
+(unless (memq system-type '(cygwin windows-nt))
+ (add-to-list 'tramp-methods (cons tramp-smb-method nil)))
;; Add a default for `tramp-default-method-alist'. Rule: If there is
;; a domain in USER, it must be the SMB method.
@@ -204,11 +204,13 @@ See `tramp-actions-before-shell' for more info.")
"Alist of handler functions for Tramp SMB method.
Operations not mentioned here will be handled by the default Emacs primitives.")
-(defun tramp-smb-file-name-p (filename)
+;;;###tramp-autoload
+(defsubst tramp-smb-file-name-p (filename)
"Check if it's a filename for SMB servers."
(let ((v (tramp-dissect-file-name filename)))
(string= (tramp-file-name-method v) tramp-smb-method)))
+;;;###tramp-autoload
(defun tramp-smb-file-name-handler (operation &rest args)
"Invoke the SMB related OPERATION.
First arg specifies the OPERATION, second arg is a list of arguments to
@@ -218,8 +220,10 @@ pass to the OPERATION."
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args))))
-(add-to-list 'tramp-foreign-file-name-handler-alist
- (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))
+;;;###tramp-autoload
+(unless (memq system-type '(cygwin windows-nt))
+ (add-to-list 'tramp-foreign-file-name-handler-alist
+ (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)))
;; File name primitives.
@@ -783,7 +787,7 @@ PRESERVE-UID-GID is completely ignored."
(if (tramp-smb-get-cifs-capabilities v)
(format
"posix_mkdir \"%s\" %s"
- file (tramp-decimal-to-octal (default-file-modes)))
+ file (tramp-compat-decimal-to-octal (default-file-modes)))
(format "mkdir \"%s\"" file)))
;; We must also flush the cache of the directory, because
;; `file-attributes' reads the values from there.
@@ -892,7 +896,7 @@ target of the symlink differ."
(unless (tramp-smb-send-command
v (format "chmod \"%s\" %s"
(tramp-smb-get-localname v)
- (tramp-decimal-to-octal mode)))
+ (tramp-compat-decimal-to-octal mode)))
(tramp-error
v 'file-error "Error while changing file's mode %s" filename)))))
@@ -1396,6 +1400,9 @@ Returns nil if an error message has appeared."
(tramp-message vec 6 "\n%s" (buffer-string))
(not err))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-smb 'force)))
(provide 'tramp-smb)
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 4b64387a8b..fe6862c924 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,10 +1,11 @@
;;; tramp-uu.el --- uuencode in Lisp
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;; 2009, 2010 Free Software Foundation, Inc.
;; Author: Kai Großjohann <[email protected]>
;; Keywords: comm, terminals
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -49,6 +50,7 @@
"Return the byte that is encoded as CHAR."
(cdr (assq char tramp-uu-b64-char-to-byte)))
+;;;###tramp-autoload
(defun tramp-uuencode-region (beg end)
"UU-encode the region between BEG and END."
;; First we base64 encode the region, then we transmogrify that into
@@ -86,6 +88,10 @@
(goto-char beg)
(insert "begin 600 xxx\n"))))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-uu 'force)))
+
(provide 'tramp-uu)
;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e715ef596d..86ece233fa 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1,3 +1,4 @@
+(setq tramp-version 24)
;;; tramp.el --- Transparent Remote Access, Multiple Protocol
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
@@ -8,6 +9,7 @@
;; Author: Kai Großjohann <[email protected]>
;; Michael Albinus <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -66,18 +68,7 @@
(when (and load-in-progress (null (current-message)))
(message "Loading tramp..."))
-;; The Tramp version number and bug report address, as prepared by configure.
-(require 'trampver)
-(add-hook 'tramp-unload-hook
- (lambda ()
- (when (featurep 'trampver)
- (unload-feature 'trampver 'force))))
-
(require 'tramp-compat)
-(add-hook 'tramp-unload-hook
- (lambda ()
- (when (featurep 'tramp-compat)
- (unload-feature 'tramp-compat 'force))))
(require 'format-spec)
;; As long as password.el is not part of (X)Emacs, it shouldn't
@@ -95,82 +86,8 @@
(load "auth-source" 'noerror)
(require 'auth-source nil 'noerror)))
-;; Requiring 'tramp-cache results in an endless loop.
-(autoload 'tramp-get-file-property "tramp-cache")
-(autoload 'tramp-set-file-property "tramp-cache")
-(autoload 'tramp-flush-file-property "tramp-cache")
-(autoload 'tramp-flush-directory-property "tramp-cache")
-(autoload 'tramp-get-connection-property "tramp-cache")
-(autoload 'tramp-set-connection-property "tramp-cache")
-(autoload 'tramp-flush-connection-property "tramp-cache")
-(autoload 'tramp-parse-connection-properties "tramp-cache")
-(add-hook 'tramp-unload-hook
- (lambda ()
- (when (featurep 'tramp-cache)
- (unload-feature 'tramp-cache 'force))))
-
-(autoload 'tramp-uuencode-region "tramp-uu"
- "Implementation of `uuencode' in Lisp.")
-(add-hook 'tramp-unload-hook
- (lambda ()
- (when (featurep 'tramp-uu)
- (unload-feature 'tramp-uu 'force))))
-
(autoload 'uudecode-decode-region "uudecode")
-;; The following Tramp packages must be loaded after tramp.el, because
-;; they require it as well.
-(eval-after-load "tramp"
- '(dolist
- (feature
- (list
-
- ;; Tramp interactive commands.
- 'tramp-cmds
-
- ;; Load foreign FTP method.
- (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp)
-
- ;; tramp-smb uses "smbclient" from Samba. Not available
- ;; under Cygwin and Windows, because they don't offer
- ;; "smbclient". And even not necessary there, because Emacs
- ;; supports UNC file names like "//host/share/localname".
- (unless (memq system-type '(cygwin windows-nt)) 'tramp-smb)
-
- ;; Load foreign FISH method.
- 'tramp-fish
-
- ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23
- ;; on some system types. We don't call `dbus-ping', because
- ;; this would load dbus.el.
- (when (and (featurep 'dbusbind)
- (condition-case nil
- (tramp-compat-funcall 'dbus-get-unique-name :session)
- (error nil))
- (tramp-compat-process-running-p "gvfs-fuse-daemon"))
- 'tramp-gvfs)
-
- ;; Load gateways. It needs `make-network-process' from Emacs 22.
- (when (functionp 'make-network-process) 'tramp-gw)
-
- ;; tramp-imap needs both epa (from Emacs 23.1) and imap-hash
- ;; (from Emacs 23.2).
- (when (and (locate-library "epa") (locate-library "imap-hash"))
- 'tramp-imap)))
-
- (when feature
- ;; We have used just some basic tests, whether a package shall
- ;; be added. There might still be other errors during loading,
- ;; which we will catch here.
- (catch 'tramp-loading
- (require feature)
- (add-hook 'tramp-unload-hook
- `(lambda ()
- (when (featurep (quote ,feature))
- (unload-feature (quote ,feature) 'force)))))
- (unless (featurep feature)
- (message "Loading %s failed, ignoring this package" feature)))))
-
;;; User Customizable Internal Variables:
(defgroup tramp nil
@@ -300,6 +217,7 @@ If it is nil, inline out-of-the-band copy will be used without a check."
:group 'tramp
:type '(choice (const nil) integer))
+;;;###tramp-autoload
(defcustom tramp-terminal-type "dumb"
"*Value of TERM environment variable for logging in to remote host.
Because Tramp wants to parse the output of the remote shell, it is easily
@@ -320,9 +238,11 @@ files conditionalize this setup based on the TERM environment variable."
The '$' character at the end is quoted; the string cannot be
detected as prompt when being sent on echoing hosts, therefore.")
+;;;###tramp-autoload
(defconst tramp-initial-end-of-output "#$ "
"Prompt when establishing a connection.")
+;;;###tramp-autoload
(defvar tramp-methods
`(("rcp" (tramp-login-program "rsh")
(tramp-login-args (("%h") ("-l" "%u")))
@@ -2097,6 +2017,7 @@ mentioned here will be handled by `tramp-file-name-handler-alist' or the
normal Emacs functions.")
;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
+;;;###tramp-autoload
(defvar tramp-foreign-file-name-handler-alist
;; (identity . tramp-sh-file-name-handler) should always be the last
;; entry, because `identity' always matches.
@@ -2107,6 +2028,257 @@ calling HANDLER.")
;;; Internal functions which must come first:
+
+;; ------------------------------------------------------------
+;; -- Tramp file names --
+;; ------------------------------------------------------------
+;; Conversion functions between external representation and
+;; internal data structure. Convenience functions for internal
+;; data structure.
+
+(defun tramp-file-name-p (vec)
+ "Check, whether VEC is a Tramp object."
+ (and (vectorp vec) (= 4 (length vec))))
+
+(defun tramp-file-name-method (vec)
+ "Return method component of VEC."
+ (and (tramp-file-name-p vec) (aref vec 0)))
+
+(defun tramp-file-name-user (vec)
+ "Return user component of VEC."
+ (and (tramp-file-name-p vec) (aref vec 1)))
+
+(defun tramp-file-name-host (vec)
+ "Return host component of VEC."
+ (and (tramp-file-name-p vec) (aref vec 2)))
+
+(defun tramp-file-name-localname (vec)
+ "Return localname component of VEC."
+ (and (tramp-file-name-p vec) (aref vec 3)))
+
+;; The user part of a Tramp file name vector can be of kind
+;; "user%domain". Sometimes, we must extract these parts.
+(defun tramp-file-name-real-user (vec)
+ "Return the user name of VEC without domain."
+ (save-match-data
+ (let ((user (tramp-file-name-user vec)))
+ (if (and (stringp user)
+ (string-match tramp-user-with-domain-regexp user))
+ (match-string 1 user)
+ user))))
+
+(defun tramp-file-name-domain (vec)
+ "Return the domain name of VEC."
+ (save-match-data
+ (let ((user (tramp-file-name-user vec)))
+ (and (stringp user)
+ (string-match tramp-user-with-domain-regexp user)
+ (match-string 2 user)))))
+
+;; The host part of a Tramp file name vector can be of kind
+;; "host#port". Sometimes, we must extract these parts.
+(defun tramp-file-name-real-host (vec)
+ "Return the host name of VEC without port."
+ (save-match-data
+ (let ((host (tramp-file-name-host vec)))
+ (if (and (stringp host)
+ (string-match tramp-host-with-port-regexp host))
+ (match-string 1 host)
+ host))))
+
+(defun tramp-file-name-port (vec)
+ "Return the port number of VEC."
+ (save-match-data
+ (let ((host (tramp-file-name-host vec)))
+ (and (stringp host)
+ (string-match tramp-host-with-port-regexp host)
+ (string-to-number (match-string 2 host))))))
+
+;;;###tramp-autoload
+(defun tramp-tramp-file-p (name)
+ "Return t if NAME is a string with Tramp file name syntax."
+ (save-match-data
+ (and (stringp name) (string-match tramp-file-name-regexp name))))
+
+(defun tramp-find-method (method user host)
+ "Return the right method string to use.
+This is METHOD, if non-nil. Otherwise, do a lookup in
+`tramp-default-method-alist'."
+ (or method
+ (let ((choices tramp-default-method-alist)
+ lmethod item)
+ (while choices
+ (setq item (pop choices))
+ (when (and (string-match (or (nth 0 item) "") (or host ""))
+ (string-match (or (nth 1 item) "") (or user "")))
+ (setq lmethod (nth 2 item))
+ (setq choices nil)))
+ lmethod)
+ tramp-default-method))
+
+(defun tramp-find-user (method user host)
+ "Return the right user string to use.
+This is USER, if non-nil. Otherwise, do a lookup in
+`tramp-default-user-alist'."
+ (or user
+ (let ((choices tramp-default-user-alist)
+ luser item)
+ (while choices
+ (setq item (pop choices))
+ (when (and (string-match (or (nth 0 item) "") (or method ""))
+ (string-match (or (nth 1 item) "") (or host "")))
+ (setq luser (nth 2 item))
+ (setq choices nil)))
+ luser)
+ tramp-default-user))
+
+(defun tramp-find-host (method user host)
+ "Return the right host string to use.
+This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
+ (or (and (> (length host) 0) host)
+ tramp-default-host))
+
+(defun tramp-dissect-file-name (name &optional nodefault)
+ "Return a `tramp-file-name' structure.
+The structure consists of remote method, remote user, remote host
+and localname (file name on remote host). If NODEFAULT is
+non-nil, the file name parts are not expanded to their default
+values."
+ (save-match-data
+ (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
+ (unless match (error "Not a Tramp file name: %s" name))
+ (let ((method (match-string (nth 1 tramp-file-name-structure) name))
+ (user (match-string (nth 2 tramp-file-name-structure) name))
+ (host (match-string (nth 3 tramp-file-name-structure) name))
+ (localname (match-string (nth 4 tramp-file-name-structure) name)))
+ (when (member method '("multi" "multiu"))
+ (error
+ "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")"
+ method))
+ (when host
+ (when (string-match tramp-prefix-ipv6-regexp host)
+ (setq host (replace-match "" nil t host)))
+ (when (string-match tramp-postfix-ipv6-regexp host)
+ (setq host (replace-match "" nil t host))))
+ (if nodefault
+ (vector method user host localname)
+ (vector
+ (tramp-find-method method user host)
+ (tramp-find-user method user host)
+ (tramp-find-host method user host)
+ localname))))))
+
+(defun tramp-buffer-name (vec)
+ "A name for the connection buffer VEC."
+ ;; We must use `tramp-file-name-real-host', because for gateway
+ ;; methods the default port will be expanded later on, which would
+ ;; tamper the name.
+ (let ((method (tramp-file-name-method vec))
+ (user (tramp-file-name-user vec))
+ (host (tramp-file-name-real-host vec)))
+ (if (not (zerop (length user)))
+ (format "*tramp/%s %s@%s*" method user host)
+ (format "*tramp/%s %s*" method host))))
+
+(defun tramp-make-tramp-file-name (method user host localname)
+ "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME."
+ (concat tramp-prefix-format
+ (when (not (zerop (length method)))
+ (concat method tramp-postfix-method-format))
+ (when (not (zerop (length user)))
+ (concat user tramp-postfix-user-format))
+ (when host
+ (if (string-match tramp-ipv6-regexp host)
+ (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
+ host))
+ tramp-postfix-host-format
+ (when localname localname)))
+
+(defun tramp-completion-make-tramp-file-name (method user host localname)
+ "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
+It must not be a complete Tramp file name, but as long as there are
+necessary only. This function will be used in file name completion."
+ (concat tramp-prefix-format
+ (when (not (zerop (length method)))
+ (concat method tramp-postfix-method-format))
+ (when (not (zerop (length user)))
+ (concat user tramp-postfix-user-format))
+ (when (not (zerop (length host)))
+ (concat
+ (if (string-match tramp-ipv6-regexp host)
+ (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
+ host)
+ tramp-postfix-host-format))
+ (when localname localname)))
+
+(defun tramp-get-buffer (vec)
+ "Get the connection buffer to be used for VEC."
+ (or (get-buffer (tramp-buffer-name vec))
+ (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
+ (setq buffer-undo-list t)
+ (setq default-directory
+ (tramp-make-tramp-file-name
+ (tramp-file-name-method vec)
+ (tramp-file-name-user vec)
+ (tramp-file-name-host vec)
+ "/"))
+ (current-buffer))))
+
+(defun tramp-get-connection-buffer (vec)
+ "Get the connection buffer to be used for VEC.
+In case a second asynchronous communication has been started, it is different
+from `tramp-get-buffer'."
+ (or (tramp-get-connection-property vec "process-buffer" nil)
+ (tramp-get-buffer vec)))
+
+(defun tramp-get-connection-process (vec)
+ "Get the connection process to be used for VEC.
+In case a second asynchronous communication has been started, it is different
+from the default one."
+ (get-process
+ (or (tramp-get-connection-property vec "process-name" nil)
+ (tramp-buffer-name vec))))
+
+(defun tramp-debug-buffer-name (vec)
+ "A name for the debug buffer for VEC."
+ ;; We must use `tramp-file-name-real-host', because for gateway
+ ;; methods the default port will be expanded later on, which would
+ ;; tamper the name.
+ (let ((method (tramp-file-name-method vec))
+ (user (tramp-file-name-user vec))
+ (host (tramp-file-name-real-host vec)))
+ (if (not (zerop (length user)))
+ (format "*debug tramp/%s %s@%s*" method user host)
+ (format "*debug tramp/%s %s*" method host))))
+
+(defconst tramp-debug-outline-regexp
+ "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
+
+(defun tramp-get-debug-buffer (vec)
+ "Get the debug buffer for VEC."
+ (with-current-buffer
+ (get-buffer-create (tramp-debug-buffer-name vec))
+ (when (bobp)
+ (setq buffer-undo-list t)
+ ;; Activate `outline-mode'. This runs `text-mode-hook' and
+ ;; `outline-mode-hook'. We must prevent that local processes
+ ;; die. Yes: I've seen `flyspell-mode', which starts "ispell".
+ ;; Furthermore, `outline-regexp' must have the correct value
+ ;; already, because it is used by `font-lock-compile-keywords'.
+ (let ((default-directory (tramp-compat-temporary-file-directory))
+ (outline-regexp tramp-debug-outline-regexp))
+ (outline-mode))
+ (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp)
+ (set (make-local-variable 'outline-level) 'tramp-outline-level))
+ (current-buffer)))
+
+(defun tramp-outline-level ()
+ "Return the depth to which a statement is nested in the outline.
+Point must be at the beginning of a header line.
+
+The outline level is equal to the verbosity of the Tramp message."
+ (1+ (string-to-number (match-string 1))))
+
(defsubst tramp-debug-message (vec fmt-string &rest args)
"Append message to debug buffer.
Message is formatted with FMT-STRING as control string and the remaining
@@ -2266,39 +2438,6 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
(put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body))
(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
-(defmacro with-file-property (vec file property &rest body)
- "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
-FILE must be a local file name on a connection identified via VEC."
- `(if (file-name-absolute-p ,file)
- (let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
- (when (eq value 'undef)
- ;; We cannot pass @body as parameter to
- ;; `tramp-set-file-property' because it mangles our
- ;; debug messages.
- (setq value (progn ,@body))
- (tramp-set-file-property ,vec ,file ,property value))
- value)
- ,@body))
-
-(put 'with-file-property 'lisp-indent-function 3)
-(put 'with-file-property 'edebug-form-spec t)
-(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>"))
-
-(defmacro with-connection-property (key property &rest body)
- "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
- `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
- (when (eq value 'undef)
- ;; We cannot pass ,@body as parameter to
- ;; `tramp-set-connection-property' because it mangles our debug
- ;; messages.
- (setq value (progn ,@body))
- (tramp-set-connection-property ,key ,property value))
- value))
-
-(put 'with-connection-property 'lisp-indent-function 2)
-(put 'with-connection-property 'edebug-form-spec t)
-(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
-
(defun tramp-progress-reporter-update (reporter &optional value)
(let* ((parameters (cdr reporter))
(message (aref parameters 3)))
@@ -2374,7 +2513,7 @@ Return the local name of the temporary file."
(setq result nil)
;; This creates the file by side effect.
(set-file-times result)
- (set-file-modes result (tramp-octal-to-decimal "0700"))))
+ (set-file-modes result (tramp-compat-octal-to-decimal "0700"))))
;; Return the local part.
(with-parsed-tramp-file-name result nil localname)))
@@ -2414,7 +2553,7 @@ Example:
;; Windows registry.
(and (memq system-type '(cygwin windows-nt))
(zerop
- (tramp-local-call-process
+ (tramp-compat-call-process
"reg" nil nil nil "query" (nth 1 (car v)))))
;; Configuration file.
(file-exists-p (nth 1 (car v)))))
@@ -2552,7 +2691,7 @@ target of the symlink differ."
(unless ln
(tramp-error
l 'file-error
- "Making a symbolic link. ln(1) does not exist on the remote host."))
+ "Making a symbolic link. ln(1) does not exist on the remote host."))
;; Do the 'confirm if exists' thing.
(when (file-exists-p linkname)
@@ -2573,6 +2712,9 @@ target of the symlink differ."
(tramp-file-name-localname
(tramp-dissect-file-name (expand-file-name filename)))))
+ (tramp-flush-file-property l (file-name-directory l-localname))
+ (tramp-flush-file-property l l-localname)
+
;; Right, they are on the same host, regardless of user, method, etc.
;; We now make the link on the remote machine. This will occur as the user
;; that FILENAME belongs to.
@@ -3023,7 +3165,7 @@ of."
(unless (zerop (tramp-send-command-and-check
v
(format "chmod %s %s"
- (tramp-decimal-to-octal mode)
+ (tramp-compat-decimal-to-octal mode)
(tramp-shell-quote-argument localname))))
;; FIXME: extract the proper text from chmod's stderr.
(tramp-error
@@ -3054,7 +3196,7 @@ of."
;; We handle also the local part, because in older Emacsen,
;; without `set-file-times', this function is an alias for this.
;; We are local, so we don't need the UTC settings.
- (tramp-local-call-process
+ (tramp-compat-call-process
"touch" nil nil nil "-t"
(format-time-string "%Y%m%d%H%M.%S" time)
(tramp-shell-quote-argument filename)))))
@@ -3087,7 +3229,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
;; `set-file-uid-gid'. On W32 "chown" might not work.
(let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer)))
(gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer))))
- (tramp-local-call-process
+ (tramp-compat-call-process
"chown" nil nil nil
(format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))
@@ -3215,7 +3357,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
If the file modes of FILENAME cannot be determined, return the
value of `default-file-modes', without execute permissions."
(or (file-modes filename)
- (logand (default-file-modes) (tramp-octal-to-decimal "0666"))))
+ (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666"))))
(defun tramp-handle-file-directory-p (filename)
"Like `file-directory-p' for Tramp files."
@@ -3902,7 +4044,8 @@ the uid and gid from FILENAME."
;; Since this does not work reliable, we also
;; give read permissions.
(set-file-modes
- (concat prefix tmpfile) (tramp-octal-to-decimal "0777"))
+ (concat prefix tmpfile)
+ (tramp-compat-octal-to-decimal "0777"))
(tramp-set-file-uid-gid
(concat prefix tmpfile)
(tramp-get-local-uid 'integer)
@@ -3918,7 +4061,8 @@ the uid and gid from FILENAME."
;; We must change the ownership as local user.
;; Since this does not work reliable, we also
;; give read permissions.
- (set-file-modes tmpfile (tramp-octal-to-decimal "0777"))
+ (set-file-modes
+ tmpfile (tramp-compat-octal-to-decimal "0777"))
(tramp-set-file-uid-gid
tmpfile
(tramp-get-remote-uid v 'integer)
@@ -4638,7 +4782,9 @@ beginning of local filename are not substituted."
(setq outbuf (current-buffer))))
(when stderr (setq command (format "%s 2>%s" command stderr)))
- ;; Send the command. It might not return in time, so we protect it.
+ ;; Send the command. It might not return in time, so we protect
+ ;; it. Call it in a subshell, in order to preserve working
+ ;; directory.
(condition-case nil
(unwind-protect
(setq ret
@@ -4646,7 +4792,7 @@ beginning of local filename are not substituted."
v (format "\\cd %s; %s"
(tramp-shell-quote-argument localname)
command)
- nil t))
+ t t))
;; We should show the output anyway.
(when outbuf
(with-current-buffer outbuf
@@ -4684,20 +4830,6 @@ beginning of local filename are not substituted."
(keyboard-quit)
ret))))
-(defun tramp-local-call-process
- (program &optional infile destination display &rest args)
- "Calls `call-process' on the local host.
-This is needed because for some Emacs flavors Tramp has
-defadviced `call-process' to behave like `process-file'. The
-Lisp error raised when PROGRAM is nil is trapped also, returning 1."
- (let ((default-directory
- (if (file-remote-p default-directory)
- (tramp-compat-temporary-file-directory)
- default-directory)))
- (if (executable-find program)
- (apply 'call-process program infile destination display args)
- 1)))
-
(defun tramp-handle-call-process-region
(start end program &optional delete buffer display &rest args)
"Like `call-process-region' for Tramp files."
@@ -4767,7 +4899,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
;; Display output.
(pop-to-buffer output-buffer)
(setq mode-line-process '(":%s"))
- (require 'shell) (shell-mode))
+ (shell-mode))
(prog1
;; Run the process.
@@ -4976,7 +5108,7 @@ coding system might not be determined. This function repairs it."
;; When the file is not readable for the owner, it
;; cannot be inserted, even it is redable for the group
;; or for everybody.
- (set-file-modes local-copy (tramp-octal-to-decimal "0600"))
+ (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600"))
(when (and (null remote-copy)
(tramp-get-method-parameter
@@ -5214,7 +5346,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
;; Ensure, that it is still readable.
(when modes
(set-file-modes
- tmpfile (logior (or modes 0) (tramp-octal-to-decimal "0400"))))
+ tmpfile
+ (logior (or modes 0) (tramp-compat-octal-to-decimal "0400"))))
;; This is a bit lengthy due to the different methods
;; possible for file transfer. First, we check whether the
@@ -5313,7 +5446,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
(erase-buffer)
(and
;; cksum runs locally, if possible.
- (zerop (tramp-local-call-process "cksum" tmpfile t))
+ (zerop (tramp-compat-call-process "cksum" tmpfile t))
;; cksum runs remotely.
(zerop
(tramp-send-command-and-check
@@ -5790,6 +5923,7 @@ should never be set globally, the intention is to let-bind it.")
;; Tramp file name syntax. Maybe another variable should be introduced
;; overwriting this check in such cases. Or we change Tramp file name
;; syntax in order to avoid ambiguities, like in XEmacs ...
+;;;###tramp-autoload
(defun tramp-completion-mode-p ()
"Check, whether method / user name / host name completion is active."
(or
@@ -6339,7 +6473,7 @@ User is always nil."
(let ((default-directory (tramp-compat-temporary-file-directory))
res)
(with-temp-buffer
- (when (zerop (tramp-local-call-process "reg" nil t nil "query" registry))
+ (when (zerop (tramp-compat-call-process "reg" nil t nil "query" registry))
(goto-char (point-min))
(while (not (eobp))
(push (tramp-parse-putty-group registry) res))))
@@ -6414,18 +6548,6 @@ hosts, or files, disagree."
(tramp-shell-quote-argument v1-localname)
(tramp-shell-quote-argument v2-localname))))))
-(defun tramp-buffer-name (vec)
- "A name for the connection buffer VEC."
- ;; We must use `tramp-file-name-real-host', because for gateway
- ;; methods the default port will be expanded later on, which would
- ;; tamper the name.
- (let ((method (tramp-file-name-method vec))
- (user (tramp-file-name-user vec))
- (host (tramp-file-name-real-host vec)))
- (if (not (zerop (length user)))
- (format "*tramp/%s %s@%s*" method user host)
- (format "*tramp/%s %s*" method host))))
-
(defun tramp-delete-temp-file-function ()
"Remove temporary files related to current buffer."
(when (stringp tramp-temp-buffer-file-name)
@@ -6439,74 +6561,6 @@ hosts, or files, disagree."
(remove-hook 'kill-buffer-hook
'tramp-delete-temp-file-function)))
-(defun tramp-get-buffer (vec)
- "Get the connection buffer to be used for VEC."
- (or (get-buffer (tramp-buffer-name vec))
- (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
- (setq buffer-undo-list t)
- (setq default-directory
- (tramp-make-tramp-file-name
- (tramp-file-name-method vec)
- (tramp-file-name-user vec)
- (tramp-file-name-host vec)
- "/"))
- (current-buffer))))
-
-(defun tramp-get-connection-buffer (vec)
- "Get the connection buffer to be used for VEC.
-In case a second asynchronous communication has been started, it is different
-from `tramp-get-buffer'."
- (or (tramp-get-connection-property vec "process-buffer" nil)
- (tramp-get-buffer vec)))
-
-(defun tramp-get-connection-process (vec)
- "Get the connection process to be used for VEC.
-In case a second asynchronous communication has been started, it is different
-from the default one."
- (get-process
- (or (tramp-get-connection-property vec "process-name" nil)
- (tramp-buffer-name vec))))
-
-(defun tramp-debug-buffer-name (vec)
- "A name for the debug buffer for VEC."
- ;; We must use `tramp-file-name-real-host', because for gateway
- ;; methods the default port will be expanded later on, which would
- ;; tamper the name.
- (let ((method (tramp-file-name-method vec))
- (user (tramp-file-name-user vec))
- (host (tramp-file-name-real-host vec)))
- (if (not (zerop (length user)))
- (format "*debug tramp/%s %s@%s*" method user host)
- (format "*debug tramp/%s %s*" method host))))
-
-(defconst tramp-debug-outline-regexp
- "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
-
-(defun tramp-get-debug-buffer (vec)
- "Get the debug buffer for VEC."
- (with-current-buffer
- (get-buffer-create (tramp-debug-buffer-name vec))
- (when (bobp)
- (setq buffer-undo-list t)
- ;; Activate `outline-mode'. This runs `text-mode-hook' and
- ;; `outline-mode-hook'. We must prevent that local processes
- ;; die. Yes: I've seen `flyspell-mode', which starts "ispell".
- ;; Furthermore, `outline-regexp' must have the correct value
- ;; already, because it is used by `font-lock-compile-keywords'.
- (let ((default-directory (tramp-compat-temporary-file-directory))
- (outline-regexp tramp-debug-outline-regexp))
- (outline-mode))
- (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp)
- (set (make-local-variable 'outline-level) 'tramp-outline-level))
- (current-buffer)))
-
-(defun tramp-outline-level ()
- "Return the depth to which a statement is nested in the outline.
-Point must be at the beginning of a header line.
-
-The outline level is equal to the verbosity of the Tramp message."
- (1+ (string-to-number (match-string 1))))
-
(defun tramp-find-executable
(vec progname dirlist &optional ignore-tilde ignore-path)
"Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST.
@@ -6698,8 +6752,10 @@ file exists and nonzero exit status otherwise."
"Query the user for a password."
(with-current-buffer (process-buffer proc)
(tramp-check-for-regexp proc tramp-password-prompt-regexp)
- (tramp-message vec 3 "Sending %s" (match-string 1)))
- (tramp-enter-password proc))
+ (tramp-message vec 3 "Sending %s" (match-string 1))
+ (tramp-enter-password proc)
+ ;; Hide password prompt.
+ (narrow-to-region (point-max) (point-max))))
(defun tramp-action-succeed (proc vec)
"Signal success in finding shell prompt."
@@ -6810,6 +6866,7 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-process-one-action proc vec actions))
(tramp-process-one-action proc vec actions)))))
(with-current-buffer (tramp-get-connection-buffer vec)
+ (widen)
(tramp-message vec 6 "\n%s" (buffer-string)))
(unless (eq exit 'ok)
(tramp-clear-passwd vec)
@@ -7286,7 +7343,7 @@ INPUT can also be nil which means `/dev/null'.
OUTPUT can be a string (which specifies a filename), or t (which
means standard output and thus the current buffer), or nil (which
means discard it)."
- (tramp-local-call-process
+ (tramp-compat-call-process
tramp-encoding-shell
(when (and input (not (string-match "%s" cmd))) input)
(if (eq output t) t nil)
@@ -7389,12 +7446,10 @@ Gateway hops are already opened."
(setq choices tramp-default-proxies-alist)))))
;; Handle gateways.
- (when (and (boundp 'tramp-gw-tunnel-method)
- (string-match (format
- "^\\(%s\\|%s\\)$"
- (symbol-value 'tramp-gw-tunnel-method)
- (symbol-value 'tramp-gw-socks-method))
- (tramp-file-name-method (car target-alist))))
+ (when (string-match
+ (format
+ "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method)
+ (tramp-file-name-method (car target-alist)))
(let ((gw (pop target-alist))
(hop (pop target-alist)))
;; Is the method prepared for gateways?
@@ -7691,6 +7746,7 @@ function waits for output unless NOOUTPUT is set."
;; Return value is whether end-of-output sentinel was found.
found)))
+;;;###tramp-autoload
(defun tramp-send-command-and-check
(vec command &optional subshell dont-suppress-err)
"Run COMMAND and check its exit status.
@@ -7799,57 +7855,57 @@ the remote host use line-endings as defined in the variable
(save-match-data
(logior
(cond
- ((char-equal owner-read ?r) (tramp-octal-to-decimal "00400"))
+ ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400"))
((char-equal owner-read ?-) 0)
(t (error "Second char `%c' must be one of `r-'" owner-read)))
(cond
- ((char-equal owner-write ?w) (tramp-octal-to-decimal "00200"))
+ ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200"))
((char-equal owner-write ?-) 0)
(t (error "Third char `%c' must be one of `w-'" owner-write)))
(cond
((char-equal owner-execute-or-setid ?x)
- (tramp-octal-to-decimal "00100"))
+ (tramp-compat-octal-to-decimal "00100"))
((char-equal owner-execute-or-setid ?S)
- (tramp-octal-to-decimal "04000"))
+ (tramp-compat-octal-to-decimal "04000"))
((char-equal owner-execute-or-setid ?s)
- (tramp-octal-to-decimal "04100"))
+ (tramp-compat-octal-to-decimal "04100"))
((char-equal owner-execute-or-setid ?-) 0)
(t (error "Fourth char `%c' must be one of `xsS-'"
owner-execute-or-setid)))
(cond
- ((char-equal group-read ?r) (tramp-octal-to-decimal "00040"))
+ ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040"))
((char-equal group-read ?-) 0)
(t (error "Fifth char `%c' must be one of `r-'" group-read)))
(cond
- ((char-equal group-write ?w) (tramp-octal-to-decimal "00020"))
+ ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020"))
((char-equal group-write ?-) 0)
(t (error "Sixth char `%c' must be one of `w-'" group-write)))
(cond
((char-equal group-execute-or-setid ?x)
- (tramp-octal-to-decimal "00010"))
+ (tramp-compat-octal-to-decimal "00010"))
((char-equal group-execute-or-setid ?S)
- (tramp-octal-to-decimal "02000"))
+ (tramp-compat-octal-to-decimal "02000"))
((char-equal group-execute-or-setid ?s)
- (tramp-octal-to-decimal "02010"))
+ (tramp-compat-octal-to-decimal "02010"))
((char-equal group-execute-or-setid ?-) 0)
(t (error "Seventh char `%c' must be one of `xsS-'"
group-execute-or-setid)))
(cond
((char-equal other-read ?r)
- (tramp-octal-to-decimal "00004"))
+ (tramp-compat-octal-to-decimal "00004"))
((char-equal other-read ?-) 0)
(t (error "Eighth char `%c' must be one of `r-'" other-read)))
(cond
- ((char-equal other-write ?w) (tramp-octal-to-decimal "00002"))
+ ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002"))
((char-equal other-write ?-) 0)
(t (error "Nineth char `%c' must be one of `w-'" other-write)))
(cond
((char-equal other-execute-or-sticky ?x)
- (tramp-octal-to-decimal "00001"))
+ (tramp-compat-octal-to-decimal "00001"))
((char-equal other-execute-or-sticky ?T)
- (tramp-octal-to-decimal "01000"))
+ (tramp-compat-octal-to-decimal "01000"))
((char-equal other-execute-or-sticky ?t)
- (tramp-octal-to-decimal "01001"))
+ (tramp-compat-octal-to-decimal "01001"))
((char-equal other-execute-or-sticky ?-) 0)
(t (error "Tenth char `%c' must be one of `xtT-'"
other-execute-or-sticky)))))))
@@ -8010,24 +8066,6 @@ This is used internally by `tramp-file-mode-from-int'."
(and suid (upcase suid-text)) ; suid, !execute
(and x "x") "-")))) ; !suid
-(defun tramp-decimal-to-octal (i)
- "Return a string consisting of the octal digits of I.
-Not actually used. Use `(format \"%o\" i)' instead?"
- (cond ((< i 0) (error "Cannot convert negative number to octal"))
- ((not (integerp i)) (error "Cannot convert non-integer to octal"))
- ((zerop i) "0")
- (t (concat (tramp-decimal-to-octal (/ i 8))
- (number-to-string (% i 8))))))
-
-;; Kudos to Gerd Moellmann for this suggestion.
-(defun tramp-octal-to-decimal (ostr)
- "Given a string of octal digits, return a decimal number."
- (let ((x (or ostr "")))
- ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
- (unless (string-match "\\`[0-7]*\\'" x)
- (error "Non-octal junk in string `%s'" x))
- (string-to-number ostr 8)))
-
(defun tramp-shell-case-fold (string)
"Converts STRING to shell glob pattern which ignores case."
(mapconcat
@@ -8038,145 +8076,6 @@ Not actually used. Use `(format \"%o\" i)' instead?"
string
""))
-
-;; ------------------------------------------------------------
-;; -- Tramp file names --
-;; ------------------------------------------------------------
-;; Conversion functions between external representation and
-;; internal data structure. Convenience functions for internal
-;; data structure.
-
-(defun tramp-file-name-p (vec)
- "Check, whether VEC is a Tramp object."
- (and (vectorp vec) (= 4 (length vec))))
-
-(defun tramp-file-name-method (vec)
- "Return method component of VEC."
- (and (tramp-file-name-p vec) (aref vec 0)))
-
-(defun tramp-file-name-user (vec)
- "Return user component of VEC."
- (and (tramp-file-name-p vec) (aref vec 1)))
-
-(defun tramp-file-name-host (vec)
- "Return host component of VEC."
- (and (tramp-file-name-p vec) (aref vec 2)))
-
-(defun tramp-file-name-localname (vec)
- "Return localname component of VEC."
- (and (tramp-file-name-p vec) (aref vec 3)))
-
-;; The user part of a Tramp file name vector can be of kind
-;; "user%domain". Sometimes, we must extract these parts.
-(defun tramp-file-name-real-user (vec)
- "Return the user name of VEC without domain."
- (save-match-data
- (let ((user (tramp-file-name-user vec)))
- (if (and (stringp user)
- (string-match tramp-user-with-domain-regexp user))
- (match-string 1 user)
- user))))
-
-(defun tramp-file-name-domain (vec)
- "Return the domain name of VEC."
- (save-match-data
- (let ((user (tramp-file-name-user vec)))
- (and (stringp user)
- (string-match tramp-user-with-domain-regexp user)
- (match-string 2 user)))))
-
-;; The host part of a Tramp file name vector can be of kind
-;; "host#port". Sometimes, we must extract these parts.
-(defun tramp-file-name-real-host (vec)
- "Return the host name of VEC without port."
- (save-match-data
- (let ((host (tramp-file-name-host vec)))
- (if (and (stringp host)
- (string-match tramp-host-with-port-regexp host))
- (match-string 1 host)
- host))))
-
-(defun tramp-file-name-port (vec)
- "Return the port number of VEC."
- (save-match-data
- (let ((host (tramp-file-name-host vec)))
- (and (stringp host)
- (string-match tramp-host-with-port-regexp host)
- (string-to-number (match-string 2 host))))))
-
-(defun tramp-tramp-file-p (name)
- "Return t if NAME is a string with Tramp file name syntax."
- (save-match-data
- (and (stringp name) (string-match tramp-file-name-regexp name))))
-
-(defun tramp-find-method (method user host)
- "Return the right method string to use.
-This is METHOD, if non-nil. Otherwise, do a lookup in
-`tramp-default-method-alist'."
- (or method
- (let ((choices tramp-default-method-alist)
- lmethod item)
- (while choices
- (setq item (pop choices))
- (when (and (string-match (or (nth 0 item) "") (or host ""))
- (string-match (or (nth 1 item) "") (or user "")))
- (setq lmethod (nth 2 item))
- (setq choices nil)))
- lmethod)
- tramp-default-method))
-
-(defun tramp-find-user (method user host)
- "Return the right user string to use.
-This is USER, if non-nil. Otherwise, do a lookup in
-`tramp-default-user-alist'."
- (or user
- (let ((choices tramp-default-user-alist)
- luser item)
- (while choices
- (setq item (pop choices))
- (when (and (string-match (or (nth 0 item) "") (or method ""))
- (string-match (or (nth 1 item) "") (or host "")))
- (setq luser (nth 2 item))
- (setq choices nil)))
- luser)
- tramp-default-user))
-
-(defun tramp-find-host (method user host)
- "Return the right host string to use.
-This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
- (or (and (> (length host) 0) host)
- tramp-default-host))
-
-(defun tramp-dissect-file-name (name &optional nodefault)
- "Return a `tramp-file-name' structure.
-The structure consists of remote method, remote user, remote host
-and localname (file name on remote host). If NODEFAULT is
-non-nil, the file name parts are not expanded to their default
-values."
- (save-match-data
- (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
- (unless match (error "Not a Tramp file name: %s" name))
- (let ((method (match-string (nth 1 tramp-file-name-structure) name))
- (user (match-string (nth 2 tramp-file-name-structure) name))
- (host (match-string (nth 3 tramp-file-name-structure) name))
- (localname (match-string (nth 4 tramp-file-name-structure) name)))
- (when (member method '("multi" "multiu"))
- (error
- "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")"
- method))
- (when host
- (when (string-match tramp-prefix-ipv6-regexp host)
- (setq host (replace-match "" nil t host)))
- (when (string-match tramp-postfix-ipv6-regexp host)
- (setq host (replace-match "" nil t host))))
- (if nodefault
- (vector method user host localname)
- (vector
- (tramp-find-method method user host)
- (tramp-find-user method user host)
- (tramp-find-host method user host)
- localname))))))
-
(defun tramp-equal-remote (file1 file2)
"Check, whether the remote parts of FILE1 and FILE2 are identical.
The check depends on method, user and host name of the files. If
@@ -8195,37 +8094,6 @@ would yield `t'. On the other hand, the following check results in nil:
(stringp (file-remote-p file2))
(string-equal (file-remote-p file1) (file-remote-p file2))))
-(defun tramp-make-tramp-file-name (method user host localname)
- "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME."
- (concat tramp-prefix-format
- (when (not (zerop (length method)))
- (concat method tramp-postfix-method-format))
- (when (not (zerop (length user)))
- (concat user tramp-postfix-user-format))
- (when host
- (if (string-match tramp-ipv6-regexp host)
- (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
- host))
- tramp-postfix-host-format
- (when localname localname)))
-
-(defun tramp-completion-make-tramp-file-name (method user host localname)
- "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
-It must not be a complete Tramp file name, but as long as there are
-necessary only. This function will be used in file name completion."
- (concat tramp-prefix-format
- (when (not (zerop (length method)))
- (concat method tramp-postfix-method-format))
- (when (not (zerop (length user)))
- (concat user tramp-postfix-user-format))
- (when (not (zerop (length host)))
- (concat
- (if (string-match tramp-ipv6-regexp host)
- (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
- host)
- tramp-postfix-host-format))
- (when localname localname)))
-
(defun tramp-make-copy-program-file-name (vec)
"Create a file name suitable to be passed to `rcp' and workalikes."
(let ((user (tramp-file-name-user vec))
@@ -8273,6 +8141,7 @@ necessary only. This function will be used in file name completion."
;; Variables local to connection.
+;;;###tramp-autoload
(defun tramp-get-remote-path (vec)
(with-connection-property
;; When `tramp-own-remote-path' is in `tramp-remote-path', we
@@ -8346,6 +8215,7 @@ necessary only. This function will be used in file name completion."
x))
remote-path)))))
+;;;###tramp-autoload
(defun tramp-get-remote-tmpdir (vec)
(with-connection-property vec "tmp-directory"
(let ((dir (tramp-shell-quote-argument "/tmp")))
@@ -8427,6 +8297,7 @@ necessary only. This function will be used in file name completion."
(tramp-message vec 5 "Finding command to check if file exists")
(tramp-find-file-exists-command vec)))
+;;;###tramp-autoload
(defun tramp-get-remote-ln (vec)
(with-connection-property vec "ln"
(tramp-message vec 5 "Finding a suitable `ln' command")
@@ -8674,8 +8545,9 @@ If the `tramp-methods' entry does not exist, return nil."
;; Permissions should be set always, because there might be an old
;; auto-saved file belonging to another original file. This could
;; be a security threat.
- (set-file-modes buffer-auto-save-file-name
- (or (file-modes bfn) (tramp-octal-to-decimal "0600"))))))
+ (set-file-modes
+ buffer-auto-save-file-name
+ (or (file-modes bfn) (tramp-compat-octal-to-decimal "0600"))))))
(unless (and (featurep 'xemacs)
(= emacs-major-version 21)
@@ -8779,7 +8651,6 @@ Return the difference in the format of a time value."
(defun tramp-time-diff (t1 t2)
"Return the difference between the two times, in seconds.
T1 and T2 are time values (as returned by `current-time' for example)."
- ;; Pacify byte-compiler with `symbol-function'.
(cond ((and (fboundp 'subtract-time)
(fboundp 'float-time))
(tramp-compat-funcall
@@ -8855,6 +8726,7 @@ exiting if process is running."
;; CCC: This function should be rewritten so that
;; `shell-quote-argument' is not used. This way, we are safe from
;; changes in `shell-quote-argument'.
+;;;###tramp-autoload
(defun tramp-shell-quote-argument (s)
"Similar to `shell-quote-argument', but groks newlines.
Only works for Bourne-like shells."
@@ -8880,11 +8752,9 @@ Only works for Bourne-like shells."
(defun tramp-unload-tramp ()
"Discard Tramp from loading remote files."
(interactive)
- ;; When Tramp is not loaded yet, its autoloads are still active.
- (tramp-unload-file-name-handlers)
;; ange-ftp settings must be enabled.
(tramp-compat-funcall 'tramp-ftp-enable-ange-ftp)
- ;; Maybe its not loaded yet.
+ ;; Maybe it's not loaded yet.
(condition-case nil
(unload-feature 'tramp 'force)
(error nil)))
@@ -8983,10 +8853,16 @@ Only works for Bourne-like shells."
;; expects English? Or just to set LC_MESSAGES to "C" if Tramp
;; expects only English messages? (Juri Linkov)
;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846)
-;; * Load Tramp subpackages only when needed. (Bug#1529, Bug#5448, Bug#5705)
;; * Try telnet+curl as new method. It might be useful for busybox,
;; without built-in uuencode/uudecode.
;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'.
+;; * I was wondering it it would be possible to use tramp even if I'm
+;; actually using sshfs. But when I launch a command I would like
+;; to get it executed on the remote machine where the files really
+;; are. (Andrea Crotti)
+;; * Run emerge on two remote files. Bug is described here:
+;; <http://www.mail-archive.com/[email protected]/msg01041.html>.
+;; (Bug#6850)
;; Functions for file-name-handler-alist:
;; diff-latest-backup-file -- in diff.el
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 471a344b86..7690e85931 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -6,6 +6,7 @@
;; Author: Kai Großjohann <[email protected]>
;; Keywords: comm, processes
+;; Package: tramp
;; This file is part of GNU Emacs.
@@ -30,16 +31,29 @@
;; version check is defined in macro AC_EMACS_INFO of aclocal.m4;
;; should be changed only there.
-(defconst tramp-version "2.1.19-pre"
+;;;###tramp-autoload
+(defconst tramp-version "2.2.0-pre"
"This version of Tramp.")
+;;;###tramp-autoload
(defconst tramp-bug-report-address "[email protected]"
"Email address to send bug reports to.")
;; Check for (X)Emacs version.
-(let ((x (if (or (>= emacs-major-version 22) (and (featurep 'xemacs) (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" (format "Tramp 2.1.19-pre is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version)))))))
+(let ((x (if (or (>= emacs-major-version 22)
+ (and (featurep 'xemacs)
+ (= emacs-major-version 21)
+ (>= emacs-minor-version 4)))
+ "ok"
+ (format "Tramp 2.2.0-pre is not fit for %s"
+ (when (string-match "^.*$" (emacs-version))
+ (match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'trampver 'force)))
+
(provide 'trampver)
;; arch-tag: 443576ca-f8f1-4bb1-addc-5c70861e93b1