Skip to content

Instantly share code, notes, and snippets.

@gexplorer
Last active May 20, 2021 11:54
Show Gist options
  • Save gexplorer/2e69d19d2ee3aa893b3a277f5ed77823 to your computer and use it in GitHub Desktop.
Save gexplorer/2e69d19d2ee3aa893b3a277f5ed77823 to your computer and use it in GitHub Desktop.
counsel-M-x: this-command is incorrect in minibuffer-setup-hook
(require 'counsel)
(defun gx-setup-hook ()
(message "\n- minibuffer-setup-hook\n")
(message "command | value | real value")
(message "------- | ----- | ----------")
(message " this | %s | %s" this-command real-this-command)
(message " last | %s | %s" last-command real-last-command))
(add-hook 'minibuffer-setup-hook #'gx-setup-hook)
(defun gx-debug-commands ()
"Print this and last comments."
(interactive)
(message "\n- gx-debug-commands\n")
(message "command | value | real value")
(message "------- | ----- | ----------")
(message " this | %s | %s" this-command real-this-command)
(message " last | %s | %s" last-command real-last-command))
(defun gx-test-M-x ()
"Test basic M-x."
(message "### When executing `execute-extended-command`")
(funcall-interactively #'execute-extended-command ""))
(defun gx-test-counsel-M-x ()
"Test basic counsel-M-x."
(message "### When executing `counsel-M-x`")
(funcall-interactively #'counsel-M-x ""))
(gx-test-M-x)
(gx-test-counsel-M-x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment