diff options
| author | Michael Albinus | 2018-01-04 12:48:07 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-01-04 12:48:07 +0100 |
| commit | 13d384820d820d76702ca4a5152011006d1a57a0 (patch) | |
| tree | 1554866b194005d23937573ac5b0890b9b6e347c /lisp | |
| parent | ce48658191befb7734a7af484e368af5ed8b9447 (diff) | |
| download | emacs-13d384820d820d76702ca4a5152011006d1a57a0.tar.gz emacs-13d384820d820d76702ca4a5152011006d1a57a0.zip | |
Write proper `write-region' message in Tramp backends
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
Write proper message.
* lisp/net/tramp.el (tramp-message-show-message): Change default.
* test/lisp/net/tramp-tests.el (ert-x): Require it.
(tramp-test10-write-region): Extend test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-adb.el | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 12 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 13 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 11 |
5 files changed, 41 insertions, 17 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 052ee838e47..aa71effdd92 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -681,13 +681,22 @@ But handle the case, if the \"test\" command is not available." | |||
| 681 | (tramp-error v 'file-error "Cannot write: `%s'" filename)) | 681 | (tramp-error v 'file-error "Cannot write: `%s'" filename)) |
| 682 | (delete-file tmpfile))) | 682 | (delete-file tmpfile))) |
| 683 | 683 | ||
| 684 | (when (or (eq visit t) (stringp visit)) | ||
| 685 | (set-visited-file-modtime)) | ||
| 686 | |||
| 687 | (unless (equal curbuf (current-buffer)) | 684 | (unless (equal curbuf (current-buffer)) |
| 688 | (tramp-error | 685 | (tramp-error |
| 689 | v 'file-error | 686 | v 'file-error |
| 690 | "Buffer has changed from `%s' to `%s'" curbuf (current-buffer)))))) | 687 | "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) |
| 688 | |||
| 689 | ;; Set file modification time. | ||
| 690 | (when (or (eq visit t) (stringp visit)) | ||
| 691 | (set-visited-file-modtime | ||
| 692 | (tramp-compat-file-attribute-modification-time | ||
| 693 | (file-attributes filename)))) | ||
| 694 | |||
| 695 | ;; The end. | ||
| 696 | (when (and (null noninteractive) | ||
| 697 | (or (eq visit t) (null visit) (stringp visit))) | ||
| 698 | (tramp-message v 0 "Wrote %s" filename)) | ||
| 699 | (run-hooks 'tramp-handle-write-region-hook)))) | ||
| 691 | 700 | ||
| 692 | (defun tramp-adb-handle-set-file-modes (filename mode) | 701 | (defun tramp-adb-handle-set-file-modes (filename mode) |
| 693 | "Like `set-file-modes' for Tramp files." | 702 | "Like `set-file-modes' for Tramp files." |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index f1863677447..ef354b68950 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -71,7 +71,7 @@ | |||
| 71 | ;; 'car | 71 | ;; 'car |
| 72 | ;; (dbus-call-method | 72 | ;; (dbus-call-method |
| 73 | ;; :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker | 73 | ;; :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker |
| 74 | ;; tramp-gvfs-interface-mounttracker "listMountableInfo"))) | 74 | ;; tramp-gvfs-interface-mounttracker "ListMountableInfo"))) |
| 75 | 75 | ||
| 76 | ;; Note that all other connection methods are not tested, beside the | 76 | ;; Note that all other connection methods are not tested, beside the |
| 77 | ;; ones offered for customization in `tramp-gvfs-methods'. If you | 77 | ;; ones offered for customization in `tramp-gvfs-methods'. If you |
| @@ -1272,7 +1272,8 @@ file-notify events." | |||
| 1272 | (file-attributes filename)))) | 1272 | (file-attributes filename)))) |
| 1273 | 1273 | ||
| 1274 | ;; The end. | 1274 | ;; The end. |
| 1275 | (when (or (eq visit t) (null visit) (stringp visit)) | 1275 | (when (and (null noninteractive) |
| 1276 | (or (eq visit t) (null visit) (stringp visit))) | ||
| 1276 | (tramp-message v 0 "Wrote %s" filename)) | 1277 | (tramp-message v 0 "Wrote %s" filename)) |
| 1277 | (run-hooks 'tramp-handle-write-region-hook))) | 1278 | (run-hooks 'tramp-handle-write-region-hook))) |
| 1278 | 1279 | ||
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 05553ccefa3..b7693f8edb5 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3410,7 +3410,8 @@ the result will be a local, non-Tramp, file name." | |||
| 3410 | ;; Set the ownership. | 3410 | ;; Set the ownership. |
| 3411 | (when need-chown | 3411 | (when need-chown |
| 3412 | (tramp-set-file-uid-gid filename uid gid)) | 3412 | (tramp-set-file-uid-gid filename uid gid)) |
| 3413 | (when (or (eq visit t) (null visit) (stringp visit)) | 3413 | (when (and (null noninteractive) |
| 3414 | (or (eq visit t) (null visit) (stringp visit))) | ||
| 3414 | (tramp-message v 0 "Wrote %s" filename)) | 3415 | (tramp-message v 0 "Wrote %s" filename)) |
| 3415 | (run-hooks 'tramp-handle-write-region-hook))))) | 3416 | (run-hooks 'tramp-handle-write-region-hook))))) |
| 3416 | 3417 | ||
| @@ -4717,7 +4718,8 @@ connection if a previous connection has died for some reason." | |||
| 4717 | (setenv "PS1" tramp-initial-end-of-output) | 4718 | (setenv "PS1" tramp-initial-end-of-output) |
| 4718 | (unless (stringp tramp-encoding-shell) | 4719 | (unless (stringp tramp-encoding-shell) |
| 4719 | (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) | 4720 | (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) |
| 4720 | (let* ((target-alist (tramp-compute-multi-hops vec)) | 4721 | (let* ((current-host (system-name)) |
| 4722 | (target-alist (tramp-compute-multi-hops vec)) | ||
| 4721 | ;; We will apply `tramp-ssh-controlmaster-options' | 4723 | ;; We will apply `tramp-ssh-controlmaster-options' |
| 4722 | ;; only for the first hop. | 4724 | ;; only for the first hop. |
| 4723 | (options (tramp-ssh-controlmaster-options vec)) | 4725 | (options (tramp-ssh-controlmaster-options vec)) |
| @@ -4738,16 +4740,14 @@ connection if a previous connection has died for some reason." | |||
| 4738 | (if tramp-encoding-command-interactive | 4740 | (if tramp-encoding-command-interactive |
| 4739 | (list tramp-encoding-shell | 4741 | (list tramp-encoding-shell |
| 4740 | tramp-encoding-command-interactive) | 4742 | tramp-encoding-command-interactive) |
| 4741 | (list tramp-encoding-shell))))) | 4743 | (list tramp-encoding-shell)))))) |
| 4742 | current-host) | ||
| 4743 | 4744 | ||
| 4744 | ;; Set sentinel and query flag. Initialize variables. | 4745 | ;; Set sentinel and query flag. Initialize variables. |
| 4745 | (tramp-set-connection-property p "vector" vec) | 4746 | (tramp-set-connection-property p "vector" vec) |
| 4746 | (set-process-sentinel p 'tramp-process-sentinel) | 4747 | (set-process-sentinel p 'tramp-process-sentinel) |
| 4747 | (process-put p 'adjust-window-size-function 'ignore) | 4748 | (process-put p 'adjust-window-size-function 'ignore) |
| 4748 | (set-process-query-on-exit-flag p nil) | 4749 | (set-process-query-on-exit-flag p nil) |
| 4749 | (setq tramp-current-connection (cons vec (current-time)) | 4750 | (setq tramp-current-connection (cons vec (current-time))) |
| 4750 | current-host (system-name)) | ||
| 4751 | 4751 | ||
| 4752 | (tramp-message | 4752 | (tramp-message |
| 4753 | vec 6 "%s" (mapconcat 'identity (process-command p) " ")) | 4753 | vec 6 "%s" (mapconcat 'identity (process-command p) " ")) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 544f3f8d759..c8697285360 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1573,9 +1573,18 @@ errors for shares like \"C$/\", which are common in Microsoft Windows." | |||
| 1573 | (tramp-error | 1573 | (tramp-error |
| 1574 | v 'file-error | 1574 | v 'file-error |
| 1575 | "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) | 1575 | "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) |
| 1576 | (when (eq visit t) | ||
| 1577 | (set-visited-file-modtime))))) | ||
| 1578 | 1576 | ||
| 1577 | ;; Set file modification time. | ||
| 1578 | (when (or (eq visit t) (stringp visit)) | ||
| 1579 | (set-visited-file-modtime | ||
| 1580 | (tramp-compat-file-attribute-modification-time | ||
| 1581 | (file-attributes filename)))) | ||
| 1582 | |||
| 1583 | ;; The end. | ||
| 1584 | (when (and (null noninteractive) | ||
| 1585 | (or (eq visit t) (null visit) (stringp visit))) | ||
| 1586 | (tramp-message v 0 "Wrote %s" filename)) | ||
| 1587 | (run-hooks 'tramp-handle-write-region-hook)))) | ||
| 1579 | 1588 | ||
| 1580 | ;; Internal file name functions. | 1589 | ;; Internal file name functions. |
| 1581 | 1590 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index cf72f5225a7..1a8265200cb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1626,10 +1626,11 @@ ARGUMENTS to actually emit the message (if applicable)." | |||
| 1626 | ;; The message. | 1626 | ;; The message. |
| 1627 | (insert (apply #'format-message fmt-string arguments)))) | 1627 | (insert (apply #'format-message fmt-string arguments)))) |
| 1628 | 1628 | ||
| 1629 | (defvar tramp-message-show-message t | 1629 | (defvar tramp-message-show-message (null noninteractive) |
| 1630 | "Show Tramp message in the minibuffer. | 1630 | "Show Tramp message in the minibuffer. |
| 1631 | This variable is used to disable messages from `tramp-error'. | 1631 | This variable is used to suppress progress reporter output, and |
| 1632 | The messages are visible anyway, because an error is raised.") | 1632 | to disable messages from `tramp-error'. Those messages are |
| 1633 | visible anyway, because an error is raised.") | ||
| 1633 | 1634 | ||
| 1634 | (defsubst tramp-message (vec-or-proc level fmt-string &rest arguments) | 1635 | (defsubst tramp-message (vec-or-proc level fmt-string &rest arguments) |
| 1635 | "Emit a message depending on verbosity level. | 1636 | "Emit a message depending on verbosity level. |
| @@ -2230,6 +2231,8 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2230 | (let ((default-directory | 2231 | (let ((default-directory |
| 2231 | (tramp-compat-temporary-file-directory))) | 2232 | (tramp-compat-temporary-file-directory))) |
| 2232 | (load (cadr sf) 'noerror 'nomessage))) | 2233 | (load (cadr sf) 'noerror 'nomessage))) |
| 2234 | ;; (tramp-message | ||
| 2235 | ;; v 4 "Running `%s'..." (cons operation args)) | ||
| 2233 | ;; If `non-essential' is non-nil, Tramp shall | 2236 | ;; If `non-essential' is non-nil, Tramp shall |
| 2234 | ;; not open a new connection. | 2237 | ;; not open a new connection. |
| 2235 | ;; If Tramp detects that it shouldn't continue | 2238 | ;; If Tramp detects that it shouldn't continue |
| @@ -2253,6 +2256,8 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2253 | (let ((tramp-locker t)) | 2256 | (let ((tramp-locker t)) |
| 2254 | (apply foreign operation args)) | 2257 | (apply foreign operation args)) |
| 2255 | (setq tramp-locked tl)))))) | 2258 | (setq tramp-locked tl)))))) |
| 2259 | ;; (tramp-message | ||
| 2260 | ;; v 4 "Running `%s'...`%s'" (cons operation args) result) | ||
| 2256 | (cond | 2261 | (cond |
| 2257 | ((eq result 'non-essential) | 2262 | ((eq result 'non-essential) |
| 2258 | (tramp-message | 2263 | (tramp-message |