summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorIvan Shmakov <ivan@siamics.net>2018-09-14 19:05:12 +0000
committerNoam Postavsky <npostavs@gmail.com>2019-05-16 06:54:54 -0400
commit63a71535a8998ac6e8cadb9db44cf1dca650d4cb (patch)
tree702b37a51459a9e74e8c88184cb8daab90bf88fa /lisp/net
parent04e9938350d3820648d28d7cf4aa1885a08fd9b7 (diff)
downloademacs-63a71535a8998ac6e8cadb9db44cf1dca650d4cb.tar.gz
Improve user convenience of the rcirc debug buffer
* lisp/net/rcirc.el (rcirc-debug): Ignore rcirc-debug-buffer read-only status. Restore point after insertion unless it was at the end. Ensure a newline before each [lead]. Replace %Y-%m-%d with the equivalent %F in format-time-string; remove useless concat. (Bug#32470)
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/rcirc.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index b1a6c1ce8d2..e8710becd0e 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -679,16 +679,24 @@ last ping."
"If non-nil, write information to `rcirc-debug-buffer'.")
(defun rcirc-debug (process text)
"Add an entry to the debug log including PROCESS and TEXT.
-Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag'
-is non-nil."
+Debug text is appended to `rcirc-debug-buffer' if `rcirc-debug-flag'
+is non-nil.
+
+For convenience, the read-only state of the debug buffer is ignored.
+When the point is at the end of the visible portion of the buffer, it
+is moved to after the text inserted. Otherwise the point is not moved."
(when rcirc-debug-flag
(with-current-buffer (get-buffer-create rcirc-debug-buffer)
- (goto-char (point-max))
- (insert (concat
- "["
- (format-time-string "%Y-%m-%dT%T ") (process-name process)
- "] "
- text)))))
+ (let ((old (point-marker)))
+ (set-marker-insertion-type old t)
+ (goto-char (point-max))
+ (let ((inhibit-read-only t))
+ (terpri (current-buffer) t)
+ (insert "["
+ (format-time-string "%FT%T ") (process-name process)
+ "] "
+ text))
+ (goto-char old)))))
(define-obsolete-variable-alias 'rcirc-sentinel-hooks
'rcirc-sentinel-functions "24.3")