[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How properly utilize the minibuffer and inactive minibuffer startup hook
How properly utilize the minibuffer and inactive minibuffer startup hooks?
Tue, 8 Jul 2014 15:07:59 -0500
1 My goal
My goal is to enable [smartparens] in the minibuffer but only when
calling `eval-expression'. That includes the inactive minibuffer. My
attempt to do so looks like this:
│ (defun gcr/smartparens-if-eval-expr ()
│ "Enable Smartparens in the mini-buffer but only when eval'ing expressions"
│ (if (eq this-command 'eval-expression)
│ (defun gcr/minibuffer-setup-hook ()
│ "Personal setup."
│ (local-set-key "ESC y" 'gcr/paste-from-x-clipboard)
│ (add-hook 'minibuffer-setup-hook 'gcr/minibuffer-setup-hook)
│ (add-hook 'minibuffer-inactive-mode-hook 'gcr/minibuffer-setup-hook)
What I expected is that `smartparens' would be enabled every time I
enter the minibuffer. The problem I am facing is that it is not.
2 Issue and questions
• It is only turned on inside of the minibuffer on the first call to
• Every call after that to `eval-expression' does not result in
`smartparens' being enabled
"Being enabled" means that:
• After starting Emacs
• After typing `M-:', entering a open round bracket, and I will see
the right balanced bracket inserted, too.
• While in that minibuffer, doing a `C-h m' shows the list of modes
and Smartparen is in there. It looks like this:
• `Show-Smartparens-Global Size-Indication Smartparens
Following those steps, within the same Emacs session, the 2nd time
that I try to perform those steps it is no longer true in that:
1. Smartparens is not turned on.
One thing that I did check for is that I am in the correct mode and
command added in the hook this:
│ (print (format "%s %s" mode-name this-command))
And got what I expected 3 times:
│ InactiveMinibuffer eval-expression
Clearly, *I* am doing something wrong, not the modeline or
Smartparens. I am looking for thoughts on what I am doing wrong, and
wondering what I may do different to investigate and discover the
nature my error since:
• Smartparens works fine
• Modeline works fine
• What am I doing wrong?
3 My environment
│ (print (format "%s" emacs-version))
│ uname -a
│ Darwin orion 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17
23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
- How properly utilize the minibuffer and inactive minibuffer startup hooks?,
Grant Rettke <=