branch: elpa/subed commit bf3e832fbb29582c9bbddebea6582bc635b7f752 Author: Sacha Chua <sa...@sachachua.com> Commit: Random User <rnd...@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