branch: externals/dtache
commit 02b93a3778fc7679a35f321fda7586530023b254
Author: Niklas Eklund <[email protected]>
Commit: Niklas Eklund <[email protected]>
Minor cleanup
---
dtache-shell.el | 10 +++-------
dtache.el | 34 +++++++++++++++++-----------------
2 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/dtache-shell.el b/dtache-shell.el
index 945ffeffdb..9607761ab4 100644
--- a/dtache-shell.el
+++ b/dtache-shell.el
@@ -41,9 +41,6 @@
"A list of regexps to block non-supported input.")
(defvar dtache-shell-new-block-list '("^sudo.*")
"A list of regexps to block from creating a session without attaching.")
-(defvar dtache-shell-silence-dtach-messages t
- "Filter out messages from the `dtach' program.")
-
(defconst dtache-shell-detach-character "\C-\\"
"Character used to detach from a session.")
@@ -187,12 +184,11 @@ cluttering the comint-history with dtach commands."
map)
(with-connection-local-variables
(if dtache-shell-mode
- (when dtache-shell-silence-dtach-messages
+ (progn
(add-hook 'comint-preoutput-filter-functions
#'dtache--dtache-env-message-filter 0 t)
(add-hook 'comint-preoutput-filter-functions
#'dtache--dtach-eof-message-filter 0 t))
- (when dtache-shell-silence-dtach-messages
- (remove-hook 'comint-preoutput-filter-functions
#'dtache--dtache-env-message-filter t)
- (remove-hook 'comint-preoutput-filter-functions
#'dtache--dtach-eof-message-filter t)))))
+ (remove-hook 'comint-preoutput-filter-functions
#'dtache--dtache-env-message-filter t)
+ (remove-hook 'comint-preoutput-filter-functions
#'dtache--dtach-eof-message-filter t))))
(provide 'dtache-shell)
diff --git a/dtache.el b/dtache.el
index 9725af6eb5..7553bef577 100644
--- a/dtache.el
+++ b/dtache.el
@@ -162,9 +162,9 @@
(defvar dtache--session-candidates nil
"An alist of session candidates.")
(defconst dtache--dtach-eof-message "\\[EOF - dtach terminating\\]\^M"
- "Message printed when `dtach' finishes.")
+ "Message printed when `dtach' terminates.")
(defconst dtache--dtach-detached-message "\\[detached\\]\^M"
- "Message printed when `dtach' finishes.")
+ "Message printed when detaching from `dtach'.")
;;;; Data structures
@@ -439,21 +439,6 @@ Optionally make the path LOCAL to host."
(setcar it (truncate-string-to-width (car it)
(+ 3 6 dtache-max-command-length) 0 ?\s))
it)))))
-(defun dtache--session-deduplicate (sessions)
- "Make car of SESSIONS unique by adding an identifier to it."
- (let* ((ht (make-hash-table :test #'equal :size (length sessions)))
- (identifier-width 6)
- (reverse-sessions (seq-reverse sessions)))
- (dolist (session reverse-sessions)
- (if-let (count (gethash (car session) ht))
- (setcar session (format "%s%s" (car session)
- (truncate-string-to-width
- (propertize (format " (%s)" (puthash (car
session) (1+ count) ht)) 'face 'dtache-identifier-face)
- identifier-width 0 ?\s)))
- (puthash (car session) 0 ht)
- (setcar session (format "%s%s" (car session) (make-string
identifier-width ?\s)))))
- (seq-reverse reverse-sessions)))
-
(defun dtache-session-annotation (item)
"Associate ITEM to a session and return ts annotation."
(let ((session (cdr (assoc item dtache--session-candidates))))
@@ -736,6 +721,21 @@ Optionally make the path LOCAL to host."
(when (eq action 'deleted)
(dtache--session-final-update session))))))
+(defun dtache--session-deduplicate (sessions)
+ "Make car of SESSIONS unique by adding an identifier to it."
+ (let* ((ht (make-hash-table :test #'equal :size (length sessions)))
+ (identifier-width 6)
+ (reverse-sessions (seq-reverse sessions)))
+ (dolist (session reverse-sessions)
+ (if-let (count (gethash (car session) ht))
+ (setcar session (format "%s%s" (car session)
+ (truncate-string-to-width
+ (propertize (format " (%s)" (puthash (car
session) (1+ count) ht)) 'face 'dtache-identifier-face)
+ identifier-width 0 ?\s)))
+ (puthash (car session) 0 ht)
+ (setcar session (format "%s%s" (car session) (make-string
identifier-width ?\s)))))
+ (seq-reverse reverse-sessions)))
+
(defun dtache--session-macos-monitor (session)
"Configure a timer to monitor SESSION activity on macOS."
(let ((dtache-timer-configuration