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

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

[nongnu] elpa/subed bf3e832 382/389: Check if subed--cps-overlay exists


From: ELPA Syncer
Subject: [nongnu] elpa/subed bf3e832 382/389: Check if subed--cps-overlay exists before trying to update it
Date: Fri, 3 Dec 2021 11:01:03 -0500 (EST)

branch: elpa/subed
commit bf3e832fbb29582c9bbddebea6582bc635b7f752
Author: Sacha Chua <sacha@sachachua.com>
Commit: Random User <rndusr@posteo.de>

    Check if subed--cps-overlay exists before trying to update it
    
    * subed/subed-common.el (subed--update-cps-overlay): Do this only if
      the overlay exists. This makes code work even if the overlay has not
      been created, as in the case of non-interactive use.
---
 subed/subed-common.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index ebe6795..e53d98e 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -1286,12 +1286,13 @@ attribute(s)."
   "Update the CPS overlay.
 This accepts and ignores any number of arguments so that it can
 be run in `after-change-functions'."
-  (let ((cps (subed-calculate-cps)))
-    (when (numberp cps)
-      (overlay-put
-       subed--cps-overlay
-       'after-string
-       (propertize (format " %.1f CPS" cps) 'face 'shadow 'display '(height 
0.9))))))
+  (when (overlayp subed--cps-overlay)
+    (let ((cps (subed-calculate-cps)))
+      (when (numberp cps)
+        (overlay-put
+         subed--cps-overlay
+         'after-string
+         (propertize (format " %.1f CPS" cps) 'face 'shadow 'display '(height 
0.9)))))))
 
 (provide 'subed-common)
 ;;; subed-common.el ends here



reply via email to

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