diff options
| author | Michael Albinus | 2017-10-07 20:17:32 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-10-07 20:17:32 +0200 |
| commit | bc80da5bd34ac4047e0b91c0fe3ff96020d9bb25 (patch) | |
| tree | fb38d10ab405c97c64298bb825322b099056ca69 /lisp | |
| parent | 349e0eb5ff8554947aecfed9ca43fee686712ba0 (diff) | |
| download | emacs-bc80da5bd34ac4047e0b91c0fe3ff96020d9bb25.tar.gz emacs-bc80da5bd34ac4047e0b91c0fe3ff96020d9bb25.zip | |
Support gio tool in Tramp
"gvfs-<command>" utilities have been deprecated in GVFS 1.31.1. We
must use "gio <command>" tool instead.
* lisp/net/tramp-gvfs.el (tramp-gvfs-gio-mapping): New defconst.
(tramp-gvfs-handle-file-notify-add-watch): Support also "gio monitor"
(tramp-gvfs-gio-tool-p): New defun.
(tramp-gvfs-send-command): Use it. Call gio tool if available.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 237d6896e2a..3a1c9f9b5ac 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -416,6 +416,19 @@ Every entry is a list (NAME ADDRESS).") | |||
| 416 | (defconst tramp-hal-interface-device "org.freedesktop.Hal.Device" | 416 | (defconst tramp-hal-interface-device "org.freedesktop.Hal.Device" |
| 417 | "The device interface of the HAL daemon.") | 417 | "The device interface of the HAL daemon.") |
| 418 | 418 | ||
| 419 | ;; "gvfs-<command>" utilities have been deprecated in GVFS 1.31.1. We | ||
| 420 | ;; must use "gio <command>" tool instead. | ||
| 421 | (defconst tramp-gvfs-gio-mapping | ||
| 422 | '(("gvfs-copy" . "copy") | ||
| 423 | ("gvfs-info" . "info") | ||
| 424 | ("gvfs-ls" . "list") | ||
| 425 | ("gvfs-mkdir" . "mkdir") | ||
| 426 | ("gvfs-monitor-file" . "monitor") | ||
| 427 | ("gvfs-move" . "move") | ||
| 428 | ("gvfs-rm" . "remove") | ||
| 429 | ("gvfs-trash" . "trash")) | ||
| 430 | "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".") | ||
| 431 | |||
| 419 | (defconst tramp-gvfs-file-attributes | 432 | (defconst tramp-gvfs-file-attributes |
| 420 | '("name" | 433 | '("name" |
| 421 | "type" | 434 | "type" |
| @@ -1078,9 +1091,12 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1078 | ((memq 'change flags) | 1091 | ((memq 'change flags) |
| 1079 | '(created changed changes-done-hint moved deleted)) | 1092 | '(created changed changes-done-hint moved deleted)) |
| 1080 | ((memq 'attribute-change flags) '(attribute-changed)))) | 1093 | ((memq 'attribute-change flags) '(attribute-changed)))) |
| 1081 | (p (start-process | 1094 | (p (apply |
| 1082 | "gvfs-monitor-file" (generate-new-buffer " *gvfs-monitor-file*") | 1095 | 'start-process |
| 1083 | "gvfs-monitor-file" (tramp-gvfs-url-file-name file-name)))) | 1096 | "gvfs-monitor" (generate-new-buffer " *gvfs-monitor*") |
| 1097 | (if (tramp-gvfs-gio-tool-p v) | ||
| 1098 | `("gio" "monitor" ,(tramp-gvfs-url-file-name file-name))) | ||
| 1099 | `("gvfs-monitor-file" (tramp-gvfs-url-file-name file-name))))) | ||
| 1084 | (if (not (processp p)) | 1100 | (if (not (processp p)) |
| 1085 | (tramp-error | 1101 | (tramp-error |
| 1086 | v 'file-notify-error "Monitoring not supported for `%s'" file-name) | 1102 | v 'file-notify-error "Monitoring not supported for `%s'" file-name) |
| @@ -1785,10 +1801,16 @@ connection if a previous connection has died for some reason." | |||
| 1785 | (tramp-gvfs-get-remote-uid vec 'string) | 1801 | (tramp-gvfs-get-remote-uid vec 'string) |
| 1786 | (tramp-gvfs-get-remote-gid vec 'string)))) | 1802 | (tramp-gvfs-get-remote-gid vec 'string)))) |
| 1787 | 1803 | ||
| 1804 | (defun tramp-gvfs-gio-tool-p (vec) | ||
| 1805 | "Check, whether the gio tool is available." | ||
| 1806 | (with-tramp-connection-property vec "gio-tool" | ||
| 1807 | (zerop (tramp-call-process vec "gio" nil nil nil "version")))) | ||
| 1808 | |||
| 1788 | (defun tramp-gvfs-send-command (vec command &rest args) | 1809 | (defun tramp-gvfs-send-command (vec command &rest args) |
| 1789 | "Send the COMMAND with its ARGS to connection VEC. | 1810 | "Send the COMMAND with its ARGS to connection VEC. |
| 1790 | COMMAND is usually a command from the gvfs-* utilities. | 1811 | COMMAND is a command from the gvfs-* utilities. It is replaced |
| 1791 | `call-process' is applied, and it returns t if the return code is zero." | 1812 | by the corresponding gio tool call if available. `call-process' |
| 1813 | is applied, and it returns t if the return code is zero." | ||
| 1792 | (let* ((locale (tramp-get-local-locale vec)) | 1814 | (let* ((locale (tramp-get-local-locale vec)) |
| 1793 | (process-environment | 1815 | (process-environment |
| 1794 | (append | 1816 | (append |
| @@ -1796,6 +1818,11 @@ COMMAND is usually a command from the gvfs-* utilities. | |||
| 1796 | ,(format "LANGUAGE=%s" locale) | 1818 | ,(format "LANGUAGE=%s" locale) |
| 1797 | ,(format "LC_ALL=%s" locale)) | 1819 | ,(format "LC_ALL=%s" locale)) |
| 1798 | process-environment))) | 1820 | process-environment))) |
| 1821 | (when (tramp-gvfs-gio-tool-p vec) | ||
| 1822 | ;; Use gio tool. | ||
| 1823 | (setq args (cons (cdr (assoc command tramp-gvfs-gio-mapping)) args) | ||
| 1824 | command "gio")) | ||
| 1825 | |||
| 1799 | (with-current-buffer (tramp-get-connection-buffer vec) | 1826 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 1800 | (tramp-gvfs-maybe-open-connection vec) | 1827 | (tramp-gvfs-maybe-open-connection vec) |
| 1801 | (erase-buffer) | 1828 | (erase-buffer) |