aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Burkett2021-06-30 08:17:03 -0400
committerJustin Burkett2021-06-30 08:17:03 -0400
commit27d9fec33abb989b030f7677ccf5f799287d6472 (patch)
treee78c59cfa7eccaa1ce4780ed35b7bd72cca49c46
parent7abe54fa1d4aa714d9414bc6877ef2124ce126fe (diff)
downloademacs-27d9fec33abb989b030f7677ccf5f799287d6472.tar.gz
emacs-27d9fec33abb989b030f7677ccf5f799287d6472.zip
Fix compiler warnings
Fixes #312
-rw-r--r--which-key.el24
1 files changed, 13 insertions, 11 deletions
diff --git a/which-key.el b/which-key.el
index 1213d14a833..ff0db279ed7 100644
--- a/which-key.el
+++ b/which-key.el
@@ -717,9 +717,20 @@ update.")
717 (goto-char (point-max)) 717 (goto-char (point-max))
718 (insert "\n" fmt-msg "\n"))))) 718 (insert "\n" fmt-msg "\n")))))
719 719
720(defsubst which-key--safe-lookup-key (keymap key)
721 "Version of `lookup-key' that allows KEYMAP to be nil.
722Also convert numeric results of `lookup-key' to nil. KEY is not
723checked."
724 (when (keymapp keymap)
725 (let ((result (lookup-key keymap key)))
726 (when (and result (not (numberp result)))
727 result))))
728
720;;; Third-party library support 729;;; Third-party library support
721;;;; Evil 730;;;; Evil
722 731
732(defvar evil-state nil)
733
723(defcustom which-key-allow-evil-operators (boundp 'evil-this-operator) 734(defcustom which-key-allow-evil-operators (boundp 'evil-this-operator)
724 "Allow popup to show for evil operators. 735 "Allow popup to show for evil operators.
725The popup is normally inhibited in the middle of commands, but 736The popup is normally inhibited in the middle of commands, but
@@ -1440,15 +1451,6 @@ local bindings coming first. Within these categories order using
1440 "If MAYBE-STRING is a string use `which-key--string-width' o/w return 0." 1451 "If MAYBE-STRING is a string use `which-key--string-width' o/w return 0."
1441 (if (stringp maybe-string) (string-width maybe-string) 0)) 1452 (if (stringp maybe-string) (string-width maybe-string) 0))
1442 1453
1443(defsubst which-key--safe-lookup-key (keymap key)
1444 "Version of `lookup-key' that allows KEYMAP to be nil.
1445Also convert numeric results of `lookup-key' to nil. KEY is not
1446checked."
1447 (when (keymapp keymap)
1448 (let ((result (lookup-key keymap key)))
1449 (when (and result (not (numberp result)))
1450 result))))
1451
1452(defsubst which-key--butlast-string (str) 1454(defsubst which-key--butlast-string (str)
1453 (mapconcat #'identity (butlast (split-string str)) " ")) 1455 (mapconcat #'identity (butlast (split-string str)) " "))
1454 1456
@@ -1702,7 +1704,7 @@ return the docstring."
1702 (t 1704 (t
1703 (format "%s %s" current docstring))))) 1705 (format "%s %s" current docstring)))))
1704 1706
1705(defun which-key--format-and-replace (unformatted &optional prefix preserve-full-key) 1707(defun which-key--format-and-replace (unformatted &optional preserve-full-key)
1706 "Take a list of (key . desc) cons cells in UNFORMATTED, add 1708 "Take a list of (key . desc) cons cells in UNFORMATTED, add
1707faces and perform replacements according to the three replacement 1709faces and perform replacements according to the three replacement
1708alists. Returns a list (key separator description)." 1710alists. Returns a list (key separator description)."
@@ -1851,7 +1853,7 @@ non-nil, then bindings are collected recursively for all prefixes."
1851 (when which-key-sort-order 1853 (when which-key-sort-order
1852 (setq unformatted 1854 (setq unformatted
1853 (sort unformatted which-key-sort-order))) 1855 (sort unformatted which-key-sort-order)))
1854 (which-key--format-and-replace unformatted prefix recursive))) 1856 (which-key--format-and-replace unformatted recursive)))
1855 1857
1856;;; Functions for laying out which-key buffer pages 1858;;; Functions for laying out which-key buffer pages
1857 1859