From e5ef4c660c191223912b15ebfa3b61a058221992 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 21 Jan 2019 09:48:55 +0100 Subject: [PATCH] Use `inhibit-read-only' in Tramp * lisp/net/tramp.el (tramp-process-actions, tramp-accept-process-output) (tramp-send-string): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process) (tramp-adb-send-command-and-check, tramp-adb-wait-for-output): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process) (tramp-wait-for-output, tramp-send-command-and-check): * lisp/net/tramp-smb.el (tramp-smb-wait-for-output): Use `inhibit-read-only'. --- lisp/net/tramp-adb.el | 6 +++--- lisp/net/tramp-sh.el | 6 +++--- lisp/net/tramp-smb.el | 2 +- lisp/net/tramp.el | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 0a357e1ae2f..73774dbc444 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1091,7 +1091,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; otherwise we might be interrupted by ;; `verify-visited-file-modtime'. (let ((buffer-undo-list t) - (buffer-read-only nil) + (inhibit-read-only t) (mark (point))) (clear-visited-file-modtime) (narrow-to-region (point-max) (point-max)) @@ -1242,7 +1242,7 @@ the exit status is not equal 0, and t otherwise." (skip-chars-forward "^ ") (prog1 (zerop (read (current-buffer))) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (delete-region (match-beginning 0) (point-max)))))) (defun tramp-adb-barf-unless-okay (vec command fmt &rest args) @@ -1260,7 +1260,7 @@ FMT and ARGS are passed to `error'." (if (tramp-wait-for-regexp proc timeout (tramp-get-connection-property proc "prompt" tramp-adb-prompt)) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (goto-char (point-min)) ;; ADB terminal sends "^H" sequences. (when (re-search-forward "<\b+" (point-at-eol) t) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5c9c568545c..4fa8b3fa3f1 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2906,7 +2906,7 @@ the result will be a local, non-Tramp, file name." ;; otherwise we might be interrupted by ;; `verify-visited-file-modtime'. (let ((buffer-undo-list t) - (buffer-read-only nil) + (inhibit-read-only t) (mark (point-max))) (clear-visited-file-modtime) (narrow-to-region (point-max) (point-max)) @@ -5081,7 +5081,7 @@ function waits for output unless NOOUTPUT is set." (regexp1 (format "\\(^\\|\000\\)%s" regexp)) (found (tramp-wait-for-regexp proc timeout regexp1))) (if found - (let (buffer-read-only) + (let ((inhibit-read-only t)) ;; A simple-minded busybox has sent " ^H" sequences. ;; Delete them. (goto-char (point-min)) @@ -5128,7 +5128,7 @@ DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null." (skip-chars-forward "^ ") (prog1 (zerop (read (current-buffer))) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (delete-region (match-beginning 0) (point-max)))))) (defun tramp-barf-unless-okay (vec command fmt &rest args) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 8198930abc6..08f2f30747a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -2029,7 +2029,7 @@ If ARGUMENT is non-nil, use it as argument for Removes smb prompt. Returns nil if an error message has appeared." (with-current-buffer (tramp-get-connection-buffer vec) (let ((p (get-buffer-process (current-buffer))) - buffer-read-only) + (inhibit-read-only t)) ;; Read pending output. (while (tramp-accept-process-output p 0.1)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3b235095d37..a65094f811f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4074,7 +4074,7 @@ connection buffer." (t "Login failed"))))) (when (numberp pos) (with-current-buffer (tramp-get-connection-buffer vec) - (let (buffer-read-only) (delete-region pos (point)))))))) + (let ((inhibit-read-only t)) (delete-region pos (point)))))))) ;;; Utility functions: @@ -4083,7 +4083,8 @@ connection buffer." This is needed in order to hide `last-coding-system-used', which is set for process communication also." (with-current-buffer (process-buffer proc) - (let (buffer-read-only last-coding-system-used + (let ((inhibit-read-only t) + last-coding-system-used ;; We do not want to run timers. timer-list timer-idle-list result) @@ -4186,7 +4187,7 @@ the remote host use line-endings as defined in the variable (with-current-buffer (tramp-get-connection-buffer vec) ;; Clean up the buffer. We cannot call `erase-buffer' because ;; narrowing might be in effect. - (let (buffer-read-only) (delete-region (point-min) (point-max))) + (let ((inhibit-read-only t)) (delete-region (point-min) (point-max))) ;; Replace "\n" by `tramp-rsh-end-of-line'. (setq string (mapconcat -- 2.39.2