aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGemini Lasswell2018-08-01 09:25:28 -0700
committerGemini Lasswell2018-09-09 07:41:49 -0700
commitea1ec0ed2e6ebbd4650aa5a7d662f2568f1d858f (patch)
treeef29d0634794cd5e26db01785ac4fc7466ae1a20
parent3ca82c59de839f9c10318438ecc87f931b8a0208 (diff)
downloademacs-ea1ec0ed2e6ebbd4650aa5a7d662f2568f1d858f.tar.gz
emacs-ea1ec0ed2e6ebbd4650aa5a7d662f2568f1d858f.zip
Improve docstrings of thread-list functions
* lisp/thread.el (thread-list--timer-func): Change argument from 'buf' to 'buffer'. (thread-list--get-entries, thread-list--get-status): Improve docstring. (thread-list--send-signal): Change argument from 'sgnl' to 'signal'. Tell the user when the thread is no longer alive.
-rw-r--r--lisp/thread.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/thread.el b/lisp/thread.el
index cb1e7721de9..c4a4c113570 100644
--- a/lisp/thread.el
+++ b/lisp/thread.el
@@ -90,16 +90,16 @@ An EVENT has the format
90;; doing. Kids, don't try this at home! 90;; doing. Kids, don't try this at home!
91;;;###autoload (put 'list-threads 'disabled "Beware: manually canceling threads can ruin your Emacs session.") 91;;;###autoload (put 'list-threads 'disabled "Beware: manually canceling threads can ruin your Emacs session.")
92 92
93(defun thread-list--timer-func (buf) 93(defun thread-list--timer-func (buffer)
94 "Revert BUF and set a timer to do it again." 94 "Revert BUFFER and set a timer to do it again."
95 (when (buffer-live-p buf) 95 (when (buffer-live-p buffer)
96 (with-current-buffer buf 96 (with-current-buffer buffer
97 (revert-buffer)) 97 (revert-buffer))
98 (run-at-time thread-list-refresh-seconds nil 98 (run-at-time thread-list-refresh-seconds nil
99 #'thread-list--timer-func buf))) 99 #'thread-list--timer-func buffer)))
100 100
101(defun thread-list--get-entries () 101(defun thread-list--get-entries ()
102 "Return tabulated list entries for the threads currently active." 102 "Return tabulated list entries for the currently live threads."
103 (let (entries) 103 (let (entries)
104 (dolist (thread (all-threads)) 104 (dolist (thread (all-threads))
105 (pcase-let ((`(,status ,blocker) (thread-list--get-status thread))) 105 (pcase-let ((`(,status ,blocker) (thread-list--get-status thread)))
@@ -112,9 +112,8 @@ An EVENT has the format
112 112
113(defun thread-list--get-status (thread) 113(defun thread-list--get-status (thread)
114 "Describe the status of THREAD. 114 "Describe the status of THREAD.
115Return a list of two strings, the first describing THREAD's 115Return a list of two strings, one describing THREAD's status, the
116status and the second describing what it is blocked on if it is 116other describing THREAD's blocker, if any."
117blocked."
118 (cond 117 (cond
119 ((not (thread-alive-p thread)) '("Finished" "")) 118 ((not (thread-alive-p thread)) '("Finished" ""))
120 ((eq thread (current-thread)) '("Running" "")) 119 ((eq thread (current-thread)) '("Running" ""))
@@ -132,14 +131,16 @@ blocked."
132 (interactive) 131 (interactive)
133 (thread-list--send-signal 'error)) 132 (thread-list--send-signal 'error))
134 133
135(defun thread-list--send-signal (sgnl) 134(defun thread-list--send-signal (signal)
136 "Send the signal SGNL to the thread at point. 135 "Send the specified SIGNAL to the thread at point.
137Confirm with the user first." 136Ask for user confirmation before signaling the thread."
138 (let ((thread (tabulated-list-get-id))) 137 (let ((thread (tabulated-list-get-id)))
139 (when (and (threadp thread) (thread-alive-p thread)) 138 (if (and (threadp thread) (thread-alive-p thread))
140 (when (y-or-n-p (format "Send %s signal to %s? " sgnl thread)) 139 (when (y-or-n-p (format "Send %s signal to %s? " signal thread))
141 (when (and (threadp thread) (thread-alive-p thread)) 140 (if (and (threadp thread) (thread-alive-p thread))
142 (thread-signal thread sgnl nil)))))) 141 (thread-signal thread signal nil)
142 (message "This thread is no longer alive")))
143 (message "This thread is no longer alive"))))
143 144
144(provide 'thread) 145(provide 'thread)
145;;; thread.el ends here 146;;; thread.el ends here