Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defun dsedivec/called-via-key-binding (cmd)
"Returns non-nil if `this-command-keys' is bound to CMD."
(eq (key-binding (this-command-keys)) cmd))
(defun moose/popup-count-words-region (start end)
"Get word count for positive length active region."
(interactive "r")
(cond ((and (use-region-p)
(dsedivec/called-via-key-binding #'moose/popup-count-words-region))
(progn (let ((print-escape-newlines t))
(popup-tip (concat (number-to-string (count-words start end)) " words")))
(message "huh")))
((dsedivec/called-via-key-binding #'moose/popup-count-words-region) (insert (this-command-keys)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.