Created
May 13, 2019 17:01
-
-
Save paxperscientiam/013b4cdb855dcf695a2c50e8bd89049a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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