[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/keycast b3c15c3b45 3/3: keycast-log-update-buffer: Only de
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/keycast b3c15c3b45 3/3: keycast-log-update-buffer: Only delete if also inserting |
Date: |
Sat, 15 Jan 2022 10:58:31 -0500 (EST) |
branch: elpa/keycast
commit b3c15c3b4564a2b23025e9ee97e7634a6c17b053
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
keycast-log-update-buffer: Only delete if also inserting
Otherwise commands that are ignored using `keycast-substitute-alist'
would cause older entries to be eaten. Move the `when-let' even
further up to avoid some other unnecessary work when appropriate.
---
keycast.el | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/keycast.el b/keycast.el
index f0c3565cca..ec76933648 100644
--- a/keycast.el
+++ b/keycast.el
@@ -353,18 +353,18 @@ instead."
(setq mode-line-format nil)
(let ((default-frame-alist keycast-log-frame-alist))
(switch-to-buffer-other-frame (current-buffer)))))
- (with-current-buffer buf
- (goto-char (if keycast-log-newest-first (point-min) (point-max)))
- (let ((inhibit-read-only t))
- (when (and (> keycast--command-repetitions 0)
- (string-match-p "%[rR]" keycast-log-format))
- (unless keycast-log-newest-first
- (backward-char))
- (delete-region (line-beginning-position)
- (1+ (line-end-position))))
- (when-let ((output (keycast--format keycast-log-format)))
- (insert output)))
- (goto-char (if keycast-log-newest-first (point-min) (point-max)))))))
+ (when-let ((output (keycast--format keycast-log-format)))
+ (with-current-buffer buf
+ (goto-char (if keycast-log-newest-first (point-min) (point-max)))
+ (let ((inhibit-read-only t))
+ (when (and (> keycast--command-repetitions 0)
+ (string-match-p "%[rR]" keycast-log-format))
+ (unless keycast-log-newest-first
+ (backward-char))
+ (delete-region (line-beginning-position)
+ (1+ (line-end-position))))
+ (insert output))
+ (goto-char (if keycast-log-newest-first (point-min)
(point-max))))))))
(defun keycast-log-erase-buffer ()
"Erase the contents of `keycast-log-mode's buffer."