diff options
| author | K. Handa <handa@gnu.org> | 2015-09-27 17:06:12 +0900 |
|---|---|---|
| committer | K. Handa <handa@gnu.org> | 2015-09-27 17:06:12 +0900 |
| commit | 52beda922d2cb523a03661bf74b8678c8b45e440 (patch) | |
| tree | 04617b37298746a61d5324a5b35c9b71f439d762 /lisp/net | |
| parent | 94ed5167557112fb00eeca05e62589db744206de (diff) | |
| parent | 1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff) | |
| download | emacs-52beda922d2cb523a03661bf74b8678c8b45e440.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/ange-ftp.el | 8 | ||||
| -rw-r--r-- | lisp/net/dbus.el | 40 | ||||
| -rw-r--r-- | lisp/net/eww.el | 2 | ||||
| -rw-r--r-- | lisp/net/gnutls.el | 6 | ||||
| -rw-r--r-- | lisp/net/net-utils.el | 2 | ||||
| -rw-r--r-- | lisp/net/newst-backend.el | 6 | ||||
| -rw-r--r-- | lisp/net/newst-reader.el | 2 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 2 | ||||
| -rw-r--r-- | lisp/net/rlogin.el | 2 | ||||
| -rw-r--r-- | lisp/net/secrets.el | 6 | ||||
| -rw-r--r-- | lisp/net/shr-color.el | 4 | ||||
| -rw-r--r-- | lisp/net/soap-client.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 50 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 88 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 1 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 44 | ||||
| -rw-r--r-- | lisp/net/zeroconf.el | 10 |
18 files changed, 174 insertions, 104 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index bb8351437d7..4f7fa3b8f39 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -681,7 +681,7 @@ '("\\`/\\(\\([^/:]*\\)@\\)?\\([^@/:]*[^@/:.]\\):\\(.*\\)" . (3 2 4)) "Format of a fully expanded remote file name. -This is a list of the form \(REGEXP HOST USER NAME\), +This is a list of the form \(REGEXP HOST USER NAME), where REGEXP is a regular expression matching the full remote name, and HOST, USER, and NAME are the numbers of parenthesized expressions in REGEXP for the components (in that order)." @@ -1366,8 +1366,8 @@ only return the directory part of FILE." (goto-char end))) ;; Read in ~/.netrc, if one exists. If ~/.netrc file exists and has -;; the correct permissions then extract the \`machine\', \`login\', -;; \`password\' and \`account\' information from within. +;; the correct permissions then extract the machine, login, +;; password and account information from within. (defun ange-ftp-parse-netrc () ;; We set this before actually doing it to avoid the possibility @@ -2511,7 +2511,7 @@ Works by doing a pwd and examining the directory syntax." ;;;; Remote file and directory listing support. ;;;; ------------------------------------------------------------ -;; Returns whether HOST's FTP server doesn't like \'ls\' or \'dir\' commands +;; Returns whether HOST's FTP server doesn't like 'ls' or 'dir' commands ;; to take switch arguments. (defun ange-ftp-dumb-unix-host (host) (and host ange-ftp-dumb-unix-host-regexp diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index a7efaf81dbc..e8e6bc0cb6a 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -380,7 +380,7 @@ Example: \"org.freedesktop.Hal.Device\" \"GetPropertyString\" \\='message \"system.kernel.machine\") - => \(:serial :system 2) + => (:serial :system 2) -| i686" @@ -656,8 +656,8 @@ Example: :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" \\='my-signal-handler) - => \(\(:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\") - \(\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler)) + => ((:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\") + (\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler)) `dbus-register-signal' returns an object, which can be used in `dbus-unregister-object' for removing the registration." @@ -1143,7 +1143,7 @@ Note, that this autoloads SERVICE if it is not running yet. If it shall be checked whether SERVICE is already running, one shall apply - \(member service \(dbus-list-known-names bus))" + (member service \(dbus-list-known-names bus))" ;; "Ping" raises a D-Bus error if SERVICE does not exist. ;; Otherwise, it returns silently with nil. (condition-case nil @@ -1631,22 +1631,22 @@ name, and the cdr is the list of properties as returned by \(dbus-get-all-managed-objects :session \"org.gnome.SettingsDaemon\" \"/\") - => \(\(\"/org/gnome/SettingsDaemon/MediaKeys\" - \(\"org.gnome.SettingsDaemon.MediaKeys\") - \(\"org.freedesktop.DBus.Peer\") - \(\"org.freedesktop.DBus.Introspectable\") - \(\"org.freedesktop.DBus.Properties\") - \(\"org.freedesktop.DBus.ObjectManager\")) - \(\"/org/gnome/SettingsDaemon/Power\" - \(\"org.gnome.SettingsDaemon.Power.Keyboard\") - \(\"org.gnome.SettingsDaemon.Power.Screen\") - \(\"org.gnome.SettingsDaemon.Power\" - \(\"Icon\" . \". GThemedIcon battery-full-charged-symbolic \") - \(\"Tooltip\" . \"Laptop battery is charged\")) - \(\"org.freedesktop.DBus.Peer\") - \(\"org.freedesktop.DBus.Introspectable\") - \(\"org.freedesktop.DBus.Properties\") - \(\"org.freedesktop.DBus.ObjectManager\")) + => ((\"/org/gnome/SettingsDaemon/MediaKeys\" + (\"org.gnome.SettingsDaemon.MediaKeys\") + (\"org.freedesktop.DBus.Peer\") + (\"org.freedesktop.DBus.Introspectable\") + (\"org.freedesktop.DBus.Properties\") + (\"org.freedesktop.DBus.ObjectManager\")) + (\"/org/gnome/SettingsDaemon/Power\" + (\"org.gnome.SettingsDaemon.Power.Keyboard\") + (\"org.gnome.SettingsDaemon.Power.Screen\") + (\"org.gnome.SettingsDaemon.Power\" + (\"Icon\" . \". GThemedIcon battery-full-charged-symbolic \") + (\"Tooltip\" . \"Laptop battery is charged\")) + (\"org.freedesktop.DBus.Peer\") + (\"org.freedesktop.DBus.Introspectable\") + (\"org.freedesktop.DBus.Properties\") + (\"org.freedesktop.DBus.ObjectManager\")) ...) If possible, \"org.freedesktop.DBus.ObjectManager.GetManagedObjects\" diff --git a/lisp/net/eww.el b/lisp/net/eww.el index f2f5ecb8e88..d44890f1b09 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -263,7 +263,7 @@ word(s) will be searched for via `eww-search-prefix'." ;; en.wikipedia.org/wiki/Free software (string-match "\\`[A-Za-z_]+\\.[A-Za-z._]+/" url) (and (= (length (split-string url)) 1) - (or (and (not (string-match-p "\\`[\"\'].*[\"\']\\'" url)) + (or (and (not (string-match-p "\\`[\"'].*[\"']\\'" url)) (> (length (split-string url "[.:]")) 1)) (string-match eww-local-regex url)))) (progn diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 418796a89c9..479c9a579f3 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -111,9 +111,9 @@ specifying a port number to connect to. Usage example: - \(with-temp-buffer - \(open-gnutls-stream \"tls\" - \(current-buffer) + (with-temp-buffer + (open-gnutls-stream \"tls\" + (current-buffer) \"your server goes here\" \"imaps\")) diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index eaf1d7e22c4..c6d40b62415 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -204,7 +204,7 @@ This variable is only used if the variable :group 'net-utils :type '(repeat string)) -(defcustom smbclient-prompt-regexp "^smb: \>" +(defcustom smbclient-prompt-regexp "^smb: >" "Regexp which matches the smbclient program's prompt. This variable is only used if the variable diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 6c80e627477..072fd015b60 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -343,8 +343,8 @@ pattern-list is checked: The new headline will be marked as AGE if REGEXP matches the headline's TITLE-OR-DESCRIPTION. If, for example, `newsticker-auto-mark-filter-list' looks like - \((slashdot (\\='old \\='title \"^Forget me!$\") (\\='immortal \\='title \"Read me\") - \(\\='immortal \\='all \"important\")))) + ((slashdot (\\='old \\='title \"^Forget me!$\") (\\='immortal \\='title \"Read me\") + (\\='immortal \\='all \"important\")))) then all articles from slashdot are marked as old if they have the title \"Forget me!\". All articles with a title containing @@ -562,7 +562,7 @@ If non-nil only the current headline is visible.") "Return guid of ITEM." (newsticker--guid-to-string (assoc 'guid (newsticker--extra item)))) (defsubst newsticker--enclosure (item) - "Return enclosure element of ITEM in the form \(...FIXME...\) or nil." + "Return enclosure element of ITEM in the form (...FIXME...) or nil." (let ((enclosure (assoc 'enclosure (newsticker--extra item)))) (if enclosure (xml-node-attributes enclosure)))) diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el index be4179e4b11..105b36e14a3 100644 --- a/lisp/net/newst-reader.el +++ b/lisp/net/newst-reader.el @@ -258,7 +258,7 @@ for formatting." (defun newsticker--image-read (feed-name-symbol disabled &optional max-height) "Read the cached image for FEED-NAME-SYMBOL from disk. If DISABLED is non-nil the image will be converted to a disabled look -\(unless `newsticker-enable-logo-manipulations' is not t\). +\(unless `newsticker-enable-logo-manipulations' is not t). Optional argument MAX-HEIGHT specifies the maximal image height. Return the image." (let ((image-name (concat (newsticker--images-dir) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index df0635066cc..d58f3ebd4ea 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2600,7 +2600,7 @@ If ARG is given, opens the URL in a new browser window." (cond ((rcirc-channel-p target) target) ;;; -ChanServ- [#gnu] Welcome... - ((string-match "\\[\\(#[^\] ]+\\)\\]" message) + ((string-match "\\[\\(#[^] ]+\\)\\]" message) (match-string 1 message)) (sender (if (string= sender (rcirc-server-name process)) diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index da46ec3f670..fead60eb8ab 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el @@ -145,7 +145,7 @@ other arguments for `rlogin'. Input is sent line-at-a-time to the remote connection. Communication with the remote host is recorded in a buffer `*rlogin-HOST*' -\(or `*rlogin-USER@HOST*' if the remote username differs\). +\(or `*rlogin-USER@HOST*' if the remote username differs). If a prefix argument is given and the buffer `*rlogin-HOST*' already exists, a new buffer with a different connection will be made. diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index c4102a18cef..5e0274029f1 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -598,7 +598,7 @@ If successful, return the object path of the collection." ATTRIBUTES are key-value pairs. The keys are keyword symbols, starting with a colon. Example: - \(secrets-search-items \"Tramp collection\" :user \"joe\") + (secrets-search-items \"Tramp collection\" :user \"joe\") The object labels of the found items are returned as list." (let ((collection-path (secrets-unlock-collection collection)) @@ -635,8 +635,8 @@ The object labels of the found items are returned as list." ATTRIBUTES are key-value pairs set for the created item. The keys are keyword symbols, starting with a colon. Example: - \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\" - :method \"sudo\" :user \"joe\" :host \"remote-host\"\) + (secrets-create-item \"Tramp collection\" \"item\" \"geheim\" + :method \"sudo\" :user \"joe\" :host \"remote-host\") The object path of the created item is returned." (unless (member item (secrets-list-items collection)) diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el index 433254db929..482f829707d 100644 --- a/lisp/net/shr-color.el +++ b/lisp/net/shr-color.el @@ -242,7 +242,7 @@ Like rgb() or hsl()." "rgb(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*)" color) (string-match - "rgba(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)" + "rgba(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*[0-9]*\\.?[0-9]+\s*%?\s*)" color)) (format "#%02X%02X%02X" (shr-color-relative-to-absolute (match-string-no-properties 1 color)) @@ -253,7 +253,7 @@ Like rgb() or hsl()." "hsl(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*)" color) (string-match - "hsla(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)" + "hsla(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*[0-9]*\\.?[0-9]+\s*%?\s*)" color)) (let ((h (/ (string-to-number (match-string-no-properties 1 color)) 360.0)) (s (/ (string-to-number (match-string-no-properties 2 color)) 100.0)) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index ada2767a4d1..509c021c644 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -167,7 +167,7 @@ namespace of LOCAL-NAME." "Convert LOCAL-NAME into a fully qualified name. A fully qualified name is a cons of the namespace name and the name of the element itself. For example \"xsd:string\" is -converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\"\). +converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\"). The USE-TNS argument specifies what to do when LOCAL-NAME has no namespace tag. If USE-TNS is non-nil, the `soap-target-xmlns' diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index f818fcd61d6..595e0ef6722 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -59,7 +59,7 @@ It is used for TCP/IP devices." ;;;###tramp-autoload (defcustom tramp-adb-prompt - "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;\[]*@[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" + "^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]" "Regexp used as prompt in almquist shell." :type 'string :version "24.4" @@ -132,6 +132,7 @@ It is used for TCP/IP devices." (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-handle-file-notify-add-watch) (file-notify-rm-watch . tramp-handle-file-notify-rm-watch) + (file-notify-valid-p . tramp-handle-file-notify-valid-p) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 4dfdcd76e66..b7b0a1c016f 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -443,6 +443,7 @@ Every entry is a list (NAME ADDRESS).") (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-gvfs-handle-file-notify-add-watch) (file-notify-rm-watch . tramp-handle-file-notify-rm-watch) + (file-notify-valid-p . tramp-handle-file-notify-valid-p) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-gvfs-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) @@ -1002,27 +1003,48 @@ file names." v (concat localname filename) "file-name-all-completions" result)))))))) -(defun tramp-gvfs-handle-file-notify-add-watch (file-name _flags _callback) +(defun tramp-gvfs-handle-file-notify-add-watch (file-name flags _callback) "Like `file-notify-add-watch' for Tramp files." (setq file-name (expand-file-name file-name)) (with-parsed-tramp-file-name file-name nil - (let ((p (start-process - "gvfs-monitor-file" (generate-new-buffer " *gvfs-monitor-file*") - "gvfs-monitor-file" (tramp-gvfs-url-file-name file-name)))) + ;; We cannot watch directories, because `gvfs-monitor-dir' is not + ;; supported for gvfs-mounted directories. + (when (file-directory-p file-name) + (tramp-error + v 'file-notify-error "Monitoring not supported for `%s'" file-name)) + (let* ((default-directory (file-name-directory file-name)) + (events + (cond + ((and (memq 'change flags) (memq 'attribute-change flags)) + '(created changed changes-done-hint moved deleted + attribute-changed)) + ((memq 'change flags) + '(created changed changes-done-hint moved deleted)) + ((memq 'attribute-change flags) '(attribute-changed)))) + (p (start-process + "gvfs-monitor-file" (generate-new-buffer " *gvfs-monitor-file*") + "gvfs-monitor-file" (tramp-gvfs-url-file-name file-name)))) (if (not (processp p)) (tramp-error - v 'file-notify-error "gvfs-monitor-file failed to start") + v 'file-notify-error "Monitoring not supported for `%s'" file-name) (tramp-message v 6 "Run `%s', %S" (mapconcat 'identity (process-command p) " ") p) (tramp-set-connection-property p "vector" v) + (tramp-compat-process-put p 'events events) + (tramp-compat-process-put p 'watch-name localname) (tramp-compat-set-process-query-on-exit-flag p nil) - (set-process-filter p 'tramp-gvfs-file-gvfs-monitor-file-process-filter) - (with-current-buffer (process-buffer p) - (setq default-directory (file-name-directory file-name))) + (set-process-filter p 'tramp-gvfs-monitor-file-process-filter) + ;; There might be an error if the monitor is not supported. + ;; Give the filter a chance to read the output. + (tramp-accept-process-output p 1) + (unless (memq (process-status p) '(run open)) + (tramp-error + v 'file-notify-error "Monitoring not supported for `%s'" file-name)) p)))) -(defun tramp-gvfs-file-gvfs-monitor-file-process-filter (proc string) - "Read output from \"gvfs-monitor-file\" and add corresponding file-notify events." +(defun tramp-gvfs-monitor-file-process-filter (proc string) + "Read output from \"gvfs-monitor-file\" and add corresponding \ +file-notify events." (let* ((rest-string (tramp-compat-process-get proc 'rest-string)) (dd (with-current-buffer (process-buffer proc) default-directory)) (ddu (regexp-quote (tramp-gvfs-url-file-name dd)))) @@ -1033,6 +1055,8 @@ file names." ;; Attribute change is returned in unused wording. string (tramp-compat-replace-regexp-in-string "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) + (when (string-match "Monitoring not supported" string) + (delete-process proc)) (while (string-match (concat "^[\n\r]*" @@ -1040,10 +1064,10 @@ file names." "File = \\([^\n\r]+\\)[\n\r]+" "Event = \\([^[:blank:]]+\\)[\n\r]+") string) - (let ((action (intern-soft + (let ((file (match-string 1 string)) + (action (intern-soft (tramp-compat-replace-regexp-in-string - "_" "-" (downcase (match-string 2 string))))) - (file (match-string 1 string))) + "_" "-" (downcase (match-string 2 string)))))) (setq string (replace-match "" nil nil string)) ;; File names are returned as URL paths. We must convert them. (when (string-match ddu file) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 79b024e8310..433b2ba09c7 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1008,6 +1008,7 @@ of command line.") (file-newer-than-file-p . tramp-sh-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch) (file-notify-rm-watch . tramp-handle-file-notify-rm-watch) + (file-notify-valid-p . tramp-handle-file-notify-valid-p) (file-ownership-preserved-p . tramp-sh-handle-file-ownership-preserved-p) (file-readable-p . tramp-sh-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) @@ -3721,22 +3722,33 @@ Fall back to normal file name handler if no Tramp handler exists." "Like `file-notify-add-watch' for Tramp files." (setq file-name (expand-file-name file-name)) (with-parsed-tramp-file-name file-name nil - (let* ((default-directory (file-name-directory file-name)) - command events filter p sequence) + (let ((default-directory (file-name-directory file-name)) + command events filter p sequence) (cond ;; gvfs-monitor-dir. ((setq command (tramp-get-remote-gvfs-monitor-dir v)) - (setq filter 'tramp-sh-file-gvfs-monitor-dir-process-filter + (setq filter 'tramp-sh-gvfs-monitor-dir-process-filter + events + (cond + ((and (memq 'change flags) (memq 'attribute-change flags)) + '(created changed changes-done-hint moved deleted + attribute-changed)) + ((memq 'change flags) + '(created changed changes-done-hint moved deleted)) + ((memq 'attribute-change flags) '(attribute-changed))) sequence `(,command ,localname))) ;; inotifywait. ((setq command (tramp-get-remote-inotifywait v)) - (setq filter 'tramp-sh-file-inotifywait-process-filter + (setq filter 'tramp-sh-inotifywait-process-filter events (cond ((and (memq 'change flags) (memq 'attribute-change flags)) - "create,modify,move,delete,attrib") - ((memq 'change flags) "create,modify,move,delete") - ((memq 'attribute-change flags) "attrib")) + (concat "create,modify,move,moved_from,moved_to,move_self," + "delete,delete_self,attrib,ignored")) + ((memq 'change flags) + (concat "create,modify,move,moved_from,moved_to,move_self," + "delete,delete_self,ignored")) + ((memq 'attribute-change flags) "attrib,ignored")) sequence `(,command "-mq" "-e" ,events ,localname))) ;; None. (t (tramp-error @@ -3758,12 +3770,22 @@ Fall back to normal file name handler if no Tramp handler exists." (mapconcat 'identity sequence " ")) (tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p) (tramp-set-connection-property p "vector" v) + ;; Needed for `tramp-sh-gvfs-monitor-dir-process-filter'. + (tramp-compat-process-put p 'events events) + (tramp-compat-process-put p 'watch-name localname) (tramp-compat-set-process-query-on-exit-flag p nil) (set-process-filter p filter) + ;; There might be an error if the monitor is not supported. + ;; Give the filter a chance to read the output. + (tramp-accept-process-output p 1) + (unless (memq (process-status p) '(run open)) + (tramp-error + v 'file-notify-error "Monitoring not supported for `%s'" file-name)) p)))) -(defun tramp-sh-file-gvfs-monitor-dir-process-filter (proc string) - "Read output from \"gvfs-monitor-dir\" and add corresponding file-notify events." +(defun tramp-sh-gvfs-monitor-dir-process-filter (proc string) + "Read output from \"gvfs-monitor-dir\" and add corresponding \ +file-notify events." (let ((remote-prefix (with-current-buffer (process-buffer proc) (file-remote-p default-directory))) @@ -3775,6 +3797,8 @@ Fall back to normal file name handler if no Tramp handler exists." ;; Attribute change is returned in unused wording. string (tramp-compat-replace-regexp-in-string "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) + (when (string-match "Monitoring not supported" string) + (delete-process proc)) (while (string-match (concat "^[\n\r]*" @@ -3783,29 +3807,36 @@ Fall back to normal file name handler if no Tramp handler exists." "\\(Other = \\([^\n\r]+\\)[\n\r]+\\)?" "Event = \\([^[:blank:]]+\\)[\n\r]+") string) - (let ((object - (list - proc - (intern-soft - (tramp-compat-replace-regexp-in-string - "_" "-" (downcase (match-string 4 string)))) - ;; File names are returned as absolute paths. We must - ;; add the remote prefix. - (concat remote-prefix (match-string 1 string)) - (when (match-string 3 string) - (concat remote-prefix (match-string 3 string)))))) + (let* ((file (match-string 1 string)) + (file1 (match-string 3 string)) + (object + (list + proc + (intern-soft + (tramp-compat-replace-regexp-in-string + "_" "-" (downcase (match-string 4 string)))) + ;; File names are returned as absolute paths. We must + ;; add the remote prefix. + (concat remote-prefix file) + (when file1 (concat remote-prefix file1))))) (setq string (replace-match "" nil nil string)) + ;; Remove watch when file or directory to be watched is deleted. + (when (and (member (cadr object) '(moved deleted)) + (string-equal + file (tramp-compat-process-get proc 'watch-name))) + (delete-process proc)) ;; Usually, we would add an Emacs event now. Unfortunately, ;; `unread-command-events' does not accept several events at ;; once. Therefore, we apply the callback directly. - (tramp-compat-funcall 'file-notify-callback object))) + (when (member (cadr object) (tramp-compat-process-get proc 'events)) + (tramp-compat-funcall 'file-notify-callback object)))) ;; Save rest of the string. (when (zerop (length string)) (setq string nil)) (when string (tramp-message proc 10 "Rest string:\n%s" string)) (tramp-compat-process-put proc 'rest-string string))) -(defun tramp-sh-file-inotifywait-process-filter (proc string) +(defun tramp-sh-inotifywait-process-filter (proc string) "Read output from \"inotifywait\" and add corresponding file-notify events." (tramp-message proc 6 "%S\n%s" proc string) (dolist (line (split-string string "[\n\r]+" 'omit-nulls)) @@ -3827,6 +3858,9 @@ Fall back to normal file name handler if no Tramp handler exists." (tramp-compat-replace-regexp-in-string "_" "-" (downcase x)))) (split-string (match-string 1 line) "," 'omit-nulls)) (match-string 3 line)))) + ;; Remove watch when file or directory to be watched is deleted. + (when (equal (cadr object) 'ignored) + (delete-process proc)) ;; Usually, we would add an Emacs event now. Unfortunately, ;; `unread-command-events' does not accept several events at ;; once. Therefore, we apply the callback directly. @@ -4297,7 +4331,7 @@ process to set up. VEC specifies the connection." "List of local coding commands for inline transfer. Each item is a list that looks like this: -\(FORMAT ENCODING DECODING\) +\(FORMAT ENCODING DECODING) FORMAT is symbol describing the encoding/decoding format. It can be `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing. @@ -4335,7 +4369,7 @@ with the encoded or decoded results, respectively.") "List of remote coding commands for inline transfer. Each item is a list that looks like this: -\(FORMAT ENCODING DECODING [TEST]\) +\(FORMAT ENCODING DECODING [TEST]) FORMAT is a symbol describing the encoding/decoding format. It can be `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing. @@ -4508,7 +4542,7 @@ means discard it)." "List of compress and decompress commands for inline transfer. Each item is a list that looks like this: -\(COMPRESS DECOMPRESS\) +\(COMPRESS DECOMPRESS) COMPRESS or DECOMPRESS are strings with the respective commands.") @@ -5519,7 +5553,7 @@ Return ATTR." (tramp-get-remote-id vec) (if (equal id-format 'integer) "" "n") (if (equal id-format 'integer) - "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))) + "" "| sed -e s/^/\\\"/ -e s/\\$/\\\"/")))) (defun tramp-get-remote-uid-with-perl (vec id-format) (tramp-send-command-and-read @@ -5570,7 +5604,7 @@ Return ATTR." (tramp-get-remote-id vec) (if (equal id-format 'integer) "" "n") (if (equal id-format 'integer) - "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))) + "" "| sed -e s/^/\\\"/ -e s/\\$/\\\"/")))) (defun tramp-get-remote-gid-with-perl (vec id-format) (tramp-send-command-and-read diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index c4f0f1f500a..5910d1fd3a4 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -247,6 +247,7 @@ See `tramp-actions-before-shell' for more info.") (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-handle-file-notify-add-watch) (file-notify-rm-watch . tramp-handle-file-notify-rm-watch) + (file-notify-valid-p . tramp-handle-file-notify-valid-p) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0969048c433..fbb8c8a349e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -110,9 +110,9 @@ Any level x includes messages for all levels 1 .. x-1. The levels are Each element looks like (REGEXP . DIRECTORY), with the same meaning like in `backup-directory-alist'. If a Tramp file is backed up, and DIRECTORY is a local file name, the backup directory is prepended with Tramp file -name prefix \(method, user, host\) of file. +name prefix \(method, user, host) of file. -\(setq tramp-backup-directory-alist backup-directory-alist\) +\(setq tramp-backup-directory-alist backup-directory-alist) gives the same backup policy for Tramp files on their hosts like the policy for local files." @@ -129,9 +129,9 @@ policy for local files." It has the same meaning like `bkup-backup-directory-info' from package `backup-dir'. If a Tramp file is backed up, and BACKUP-DIR is a local file name, the backup directory is prepended with Tramp file name prefix -\(method, user, host\) of file. +\(method, user, host) of file. -\(setq tramp-bkup-backup-directory-info bkup-backup-directory-info\) +\(setq tramp-bkup-backup-directory-info bkup-backup-directory-info) gives the same backup policy for Tramp files on their hosts like the policy for local files." @@ -464,15 +464,15 @@ host runs a registered shell, it shall be added to this list, too." (concat "\\`" (regexp-opt - (list "localhost" "localhost6" (system-name) "127\.0\.0\.1" "::1") t) + (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t) "\\'") "Host names which are regarded as local host.") (defvar tramp-completion-function-alist nil "Alist of methods for remote files. -This is a list of entries of the form \(NAME PAIR1 PAIR2 ...\). +This is a list of entries of the form \(NAME PAIR1 PAIR2 ...). Each NAME stands for a remote access method. Each PAIR is of the form -\(FUNCTION FILE\). FUNCTION is responsible to extract user names and host +\(FUNCTION FILE). FUNCTION is responsible to extract user names and host names from FILE for completion. The following predefined FUNCTIONs exists: * `tramp-parse-rhosts' for \"~/.rhosts\" like files, @@ -908,7 +908,7 @@ and is a bit too general, then some files might be considered Tramp files which are not really Tramp files. Please note that the entry in `file-name-handler-alist' is made when -this file \(tramp.el\) is loaded. This means that this variable must be set +this file \(tramp.el) is loaded. This means that this variable must be set before loading tramp.el. Alternatively, `file-name-handler-alist' can be updated after changing this variable. @@ -940,7 +940,7 @@ See `tramp-file-name-structure' for more explanations.") This regexp should match partial Tramp file names only. Please note that the entry in `file-name-handler-alist' is made when -this file \(tramp.el\) is loaded. This means that this variable must be set +this file \(tramp.el) is loaded. This means that this variable must be set before loading tramp.el. Alternatively, `file-name-handler-alist' can be updated after changing this variable. @@ -993,18 +993,18 @@ checked via the following code: In the Emacs normally running Tramp, evaluate the above code \(replace \"xxx\" and \"yyy\" by the remote user and host name, -respectively\). You can do this, for example, by pasting it into +respectively). You can do this, for example, by pasting it into the `*scratch*' buffer and then hitting C-j with the cursor after the last closing parenthesis. Note that it works only if you have configured -\"ssh\" to run without password query, see ssh-agent\(1\). +\"ssh\" to run without password query, see ssh-agent(1). You will see the number of bytes sent successfully to the remote host. If that number exceeds 1000, you can stop the execution by hitting C-g, because your Emacs is likely clean. When it is necessary to set `tramp-chunksize', you might consider to -use an out-of-the-band method \(like \"scp\"\) instead of an internal one -\(like \"ssh\"\), because setting `tramp-chunksize' to non-nil decreases +use an out-of-the-band method \(like \"scp\") instead of an internal one +\(like \"ssh\"), because setting `tramp-chunksize' to non-nil decreases performance. If your Emacs is buggy, the code stops and gives you an indication @@ -2070,7 +2070,7 @@ ARGS are the arguments OPERATION has been called with." 'dired-print-file 'dired-shell-call-process)) default-directory) ;; PROC. - ((eq operation 'file-notify-rm-watch) + ((member operation (list 'file-notify-rm-watch 'file-notify-valid-p)) (when (processp (nth 0 args)) (with-current-buffer (process-buffer (nth 0 args)) default-directory))) @@ -3407,7 +3407,7 @@ of." (defun tramp-handle-file-notify-add-watch (filename _flags _callback) "Like `file-notify-add-watch' for Tramp files." ;; This is the default handler. tramp-gvfs.el and tramp-sh.el have - ;; its own one. + ;; their own one. (setq filename (expand-file-name filename)) (with-parsed-tramp-file-name filename nil (tramp-error @@ -3419,7 +3419,17 @@ of." (unless (processp proc) (tramp-error proc 'file-notify-error "Not a valid descriptor %S" proc)) (tramp-message proc 6 "Kill %S" proc) - (kill-process proc)) + (delete-process proc)) + +(defun tramp-handle-file-notify-valid-p (proc) + "Like `file-notify-valid-p' for Tramp files." + (and proc (processp proc) (memq (process-status proc) '(run open)) + ;; Sometimes, the process is still in status `run' when the + ;; file or directory to be watched is deleted already. + (with-current-buffer (process-buffer proc) + (file-exists-p + (concat (file-remote-p default-directory) + (tramp-compat-process-get proc 'watch-name)))))) ;;; Functions for establishing connection: @@ -3615,7 +3625,7 @@ This is needed in order to hide `last-coding-system-used', which is set for process communication also." (with-current-buffer (process-buffer proc) ;; FIXME: If there is a gateway process, we need communication - ;; between several processes. Too complicated to implement, so we + ;; between several processes. Too complicate to implement, so we ;; read output from all processes. (let ((p (if (tramp-get-connection-property proc "gateway" nil) nil proc)) buffer-read-only last-coding-system-used) diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el index 7fae9e6acc6..794a4676a5e 100644 --- a/lisp/net/zeroconf.el +++ b/lisp/net/zeroconf.el @@ -197,7 +197,7 @@ The key of an entry is the concatenation of the service name and service type of a discovered service. The value is the service itself. The format of a service is - \(INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS\) + \(INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS) The INTERFACE is a number, which represents the network interface the service is located at. The corresponding network interface @@ -233,7 +233,7 @@ The key of an entry is the concatenation of the service name and service type of a resolved service. The value is the service itself. The format of a service is - \(INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS\) + (INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS) INTERFACE, PROTOCOL, NAME, TYPE, DOMAIN and FLAGS have the same meaning as in `zeroconf-services-hash'. @@ -275,7 +275,7 @@ supported keys depend on the service type.") "Returns all discovered Avahi services for a given service type TYPE. The service type is one of the returned values of `zeroconf-list-service-types'. The return value is a list -\(SERVICE1 SERVICE2 ...\). See `zeroconf-services-hash' for the +\(SERVICE1 SERVICE2 ...). See `zeroconf-services-hash' for the format of SERVICE." (let (result) (maphash @@ -385,7 +385,7 @@ type used when registering FUNCTION." NAME must be a string. The service must be of service type TYPE. The resulting list has the format - \(INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS\)." + (INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS)." ;; Due to the service browser, all known services are kept in ;; `zeroconf-services-hash'. (gethash (concat name "/" type) zeroconf-services-hash nil)) @@ -395,7 +395,7 @@ TYPE. The resulting list has the format NAME must be a string. The service must be of service type TYPE. The resulting list has the format - \(INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS\)." + (INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS)." (let* ((name (zeroconf-service-name service)) (type (zeroconf-service-type service)) (key (concat name "/" type))) |
