Browse files

Add compatibility with command-frequency

Set `real-last-command' like in `execute-extended-command'.
This allows command-frequency to pick up the command.
  • Loading branch information...
1 parent 068339e commit cfb8c036ae4f650ab1ce90a5ca586e468f90633d @gvol gvol committed with Oct 13, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 smex.el
4 smex.el
@@ -108,12 +108,16 @@ Set this to nil to disable fuzzy matching."
(funcall action chosen-item))
(progn (setq prefix-arg current-prefix-arg)
+ ;; Set the chosen command as the current command, like in
+ ;; `execute-extended-command'
(setq this-command chosen-item)
+ (setq real-this-command chosen-item)
(command-execute chosen-item 'record))
(smex-rank chosen-item)
(smex-show-key-advice chosen-item)
;; Todo: Is there a better way to manipulate 'last-repeatable-command'
;; from the inside of an interactively called function?
+ ;; (This is unneeded in Emacs >=24.3 when `real-this-command' has been set.)
(run-at-time 0.01 nil (lambda (cmd) (setq last-repeatable-command cmd))

0 comments on commit cfb8c03

Please sign in to comment.