emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/undo-fu-session 56cdd3538a 16/53: Don't show common-place


From: ELPA Syncer
Subject: [nongnu] elpa/undo-fu-session 56cdd3538a 16/53: Don't show common-place messages in the echo area
Date: Thu, 7 Jul 2022 12:05:16 -0400 (EDT)

branch: elpa/undo-fu-session
commit 56cdd3538a058c6916bdf2d9010c2179f2505829
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Don't show common-place messages in the echo area
    
    These are distracting and not very useful,
    the messages are still logged so users can check if the file change
    causing undo-data to fail to load.
---
 undo-fu-session.el | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/undo-fu-session.el b/undo-fu-session.el
index 4cf9173143..cbc191683c 100644
--- a/undo-fu-session.el
+++ b/undo-fu-session.el
@@ -96,6 +96,17 @@ Enforcing removes the oldest files."
   :type 'integer
   :group 'undo-fu-session)
 
+
+;; ---------------------------------------------------------------------------
+;; Utility Functions
+;;
+
+(defmacro undo-fu-session--message-without-echo (str &rest args)
+  "Wrap `message' passing in STR and ARGS, without showing in the echo area."
+  `
+  (let ((inhibit-message t))
+    (message ,str ,@args)))
+
 ;; ---------------------------------------------------------------------------
 ;; Undo List Make Linear
 ;;
@@ -485,12 +496,22 @@ Argument PENDING-LIST an `pending-undo-list'. compatible 
list."
           (goto-char (point-min))
           (setq content-header (read (current-buffer)))
 
+          ;; Use `undo-fu-session--message-without-echo' to avoid distracting 
the user
+          ;; when a common-place reason for failing to load is hit.
+          ;;
+          ;; These issues are common when working with others on documents.
+          ;; This way users may find out why undo didn't load if they need,
+          ;; without distracting them with noisy info.
           (unless (eq (buffer-size buffer) (assoc-default 'buffer-size 
content-header))
-            (message "Undo-Fu-Session discarding undo data: file length 
mismatch")
+            (undo-fu-session--message-without-echo
+              "Undo-Fu-Session discarding undo data: file length mismatch for 
%S"
+              filename)
             (throw 'exit nil))
 
           (unless (string-equal (sha1 buffer) (assoc-default 'buffer-checksum 
content-header))
-            (message "Undo-Fu-Session discarding undo data: file checksum 
mismatch")
+            (undo-fu-session--message-without-echo
+              "Undo-Fu-Session discarding undo data: file checksum mismatch 
for %S"
+              filename)
             (throw 'exit nil))
 
           ;; No errors... decode all undo data.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]