Use insert-special-event in Tramp
* lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter): * lisp/net/tramp-sh.el (tramp-sh-gio-monitor-process-filter) (tramp-sh-inotifywait-process-filter): Use `insert-special-event' if possible.
This commit is contained in:
parent
1ef9de69b3
commit
8be3be7330
2 changed files with 20 additions and 14 deletions
|
@ -1569,11 +1569,15 @@ If FILE-SYSTEM is non-nil, return file system attributes."
|
|||
(when (and (member action '(moved deleted))
|
||||
(string-equal file (process-get proc 'tramp-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.
|
||||
;; Add an Emacs event now.
|
||||
;; `insert-special-event' exists since Emacs 31.
|
||||
(when (member action events)
|
||||
(file-notify-callback (list proc action file file1)))))
|
||||
(tramp-compat-funcall
|
||||
(if (fboundp 'insert-special-event)
|
||||
'insert-special-event
|
||||
(lookup-key special-event-map [file-notify]))
|
||||
`(file-notify
|
||||
,(list proc action file file1) file-notify-callback)))))
|
||||
|
||||
;; Save rest of the string.
|
||||
(when (string-empty-p string) (setq string nil))
|
||||
|
|
|
@ -3898,13 +3898,14 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
(concat remote-prefix file)
|
||||
(when file1 (concat remote-prefix file1)))))
|
||||
(setq string (replace-match "" nil nil string))
|
||||
;; Usually, we would add an Emacs event now. Unfortunately,
|
||||
;; `unread-command-events' does not accept several events at
|
||||
;; once. Therefore, we apply the handler directly.
|
||||
;; Add an Emacs event now.
|
||||
;; `insert-special-event' exists since Emacs 31.
|
||||
(when (member (cl-caadr object) events)
|
||||
(tramp-compat-funcall
|
||||
(lookup-key special-event-map [file-notify])
|
||||
`(file-notify ,object file-notify-callback))))))
|
||||
(if (fboundp 'insert-special-event)
|
||||
'insert-special-event
|
||||
(lookup-key special-event-map [file-notify]))
|
||||
`(file-notify ,object file-notify-callback))))))
|
||||
|
||||
;; Save rest of the string.
|
||||
(while (string-match (rx bol "\n") string)
|
||||
|
@ -3934,13 +3935,14 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
(or (match-string 2 line)
|
||||
(file-name-nondirectory
|
||||
(process-get proc 'tramp-watch-name))))))
|
||||
;; Usually, we would add an Emacs event now. Unfortunately,
|
||||
;; `unread-command-events' does not accept several events at
|
||||
;; once. Therefore, we apply the handler directly.
|
||||
;; Add an Emacs event now.
|
||||
;; `insert-special-event' exists since Emacs 31.
|
||||
(when (member (cl-caadr object) events)
|
||||
(tramp-compat-funcall
|
||||
(lookup-key special-event-map [file-notify])
|
||||
`(file-notify ,object file-notify-callback)))))))
|
||||
(if (fboundp 'insert-special-event)
|
||||
'insert-special-event
|
||||
(lookup-key special-event-map [file-notify]))
|
||||
`(file-notify ,object file-notify-callback)))))))
|
||||
|
||||
(defun tramp-sh-handle-file-system-info (filename)
|
||||
"Like `file-system-info' for Tramp files."
|
||||
|
|
Loading…
Add table
Reference in a new issue