Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
Created May 13, 2019 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paxperscientiam/013b4cdb855dcf695a2c50e8bd89049a to your computer and use it in GitHub Desktop.
Save paxperscientiam/013b4cdb855dcf695a2c50e8bd89049a to your computer and use it in GitHub Desktop.
(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