mirror of
https://github.com/SqrtMinusOne/eshell-atuin.git
synced 2025-12-10 20:33:04 +03:00
eshell-atuin: support TRAMP host filtering
This commit is contained in:
parent
256982e335
commit
952e663839
1 changed files with 13 additions and 4 deletions
|
|
@ -173,7 +173,10 @@ results of the command in `eshell-atuin--post-exec'."
|
||||||
(when-let ((input (eshell-atuin--get-input)))
|
(when-let ((input (eshell-atuin--get-input)))
|
||||||
(setq eshell-atuin--history-id
|
(setq eshell-atuin--history-id
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(with-environment-variables (("ATUIN_SESSION" eshell-atuin--session-id))
|
(with-environment-variables (("ATUIN_SESSION" eshell-atuin--session-id)
|
||||||
|
("ATUIN_HOST_NAME"
|
||||||
|
(or (file-remote-p default-directory 'host)
|
||||||
|
(system-name))) )
|
||||||
(let ((ret (call-process
|
(let ((ret (call-process
|
||||||
eshell-atuin-executable nil t nil
|
eshell-atuin-executable nil t nil
|
||||||
"history" "start" "--" input)))
|
"history" "start" "--" input)))
|
||||||
|
|
@ -211,7 +214,10 @@ of the command."
|
||||||
;; work here.
|
;; work here.
|
||||||
(proc (with-environment-variables
|
(proc (with-environment-variables
|
||||||
(("ATUIN_LOG" "error")
|
(("ATUIN_LOG" "error")
|
||||||
("ATUIN_SESSION" eshell-atuin--session-id))
|
("ATUIN_SESSION" eshell-atuin--session-id)
|
||||||
|
("ATUIN_HOST_NAME"
|
||||||
|
(or (file-remote-p default-directory 'host)
|
||||||
|
(system-name))))
|
||||||
(start-process-shell-command "atuin-history-stop" buf
|
(start-process-shell-command "atuin-history-stop" buf
|
||||||
(string-join proc-args " ")))))
|
(string-join proc-args " ")))))
|
||||||
(set-process-sentinel
|
(set-process-sentinel
|
||||||
|
|
@ -318,7 +324,8 @@ This is used to speed up the lookup after `competing-read' in
|
||||||
|
|
||||||
(defun eshell-atuin--history-cache-p (filter-mode)
|
(defun eshell-atuin--history-cache-p (filter-mode)
|
||||||
"Return non-nil if atuin search with FILTER-MODE has to be cached."
|
"Return non-nil if atuin search with FILTER-MODE has to be cached."
|
||||||
(memq filter-mode '(nil global host session)))
|
(or (memq filter-mode '(nil global session))
|
||||||
|
(and (eq filter-mode 'host) (null (file-remote-p default-directory 'host)))))
|
||||||
|
|
||||||
(defun eshell-atuin--history-rotate-cache ()
|
(defun eshell-atuin--history-rotate-cache ()
|
||||||
"Rotate `eshell-atuin' history cache by filter mode.
|
"Rotate `eshell-atuin' history cache by filter mode.
|
||||||
|
|
@ -425,7 +432,9 @@ See `eshell-atuin--history-cache' on algorithm."
|
||||||
(symbol-name eshell-atuin-filter-mode)))
|
(symbol-name eshell-atuin-filter-mode)))
|
||||||
,@eshell-atuin-search-options))
|
,@eshell-atuin-search-options))
|
||||||
(ret (with-environment-variables
|
(ret (with-environment-variables
|
||||||
(("ATUIN_SESSION" eshell-atuin--session-id))
|
(("ATUIN_SESSION" eshell-atuin--session-id)
|
||||||
|
("ATUIN_HOST_NAME" (or (file-remote-p default-directory 'host)
|
||||||
|
(system-name))))
|
||||||
(apply #'call-process eshell-atuin-executable
|
(apply #'call-process eshell-atuin-executable
|
||||||
nil t nil proc-args))))
|
nil t nil proc-args))))
|
||||||
(unless (or (= 0 ret) (= 1 ret))
|
(unless (or (= 0 ret) (= 1 ret))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue