From: Grant Rettke <gcr@wisdomandwonder.com>
To: Emacs Help <help-gnu-emacs@gnu.org>
Subject: How properly utilize the minibuffer and inactive minibuffer startup hooks?
Date: Tue, 8 Jul 2014 15:07:59 -0500 [thread overview]
Message-ID: <CAAjq1mf6RnCKKnnGjm4BvtSvU4=AfEFnbVytiZYXUVDOUwrq9Q@mail.gmail.com> (raw)
Good morning,
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)
│ (turn-on-smartparens-strict-mode)))
│
│ (defun gcr/minibuffer-setup-hook ()
│ "Personal setup."
│ (local-set-key "ESC y" 'gcr/paste-from-x-clipboard)
│ (gcr/smartparens-if-eval-expr))
│
│ (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.
[smartparens] https://github.com/Fuco1/smartparens
2 Issue and questions
═════════════════════
Instead:
• It is only turned on inside of the minibuffer on the first call to
`eval-expression'
• 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
Smartparens-Strict'
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
════════════════
My environment:
╭────
│ (print (format "%s" emacs-version))
╰────
╭────
│ =24.3.1
│ ="
│ \"24.3.1\"
│ "
╰────
╭────
│ 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
╰────
Kind regards,
gcr
next reply other threads:[~2014-07-08 20:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 20:07 Grant Rettke [this message]
2014-07-09 22:08 ` How properly utilize the minibuffer and inactive minibuffer startup hooks? Michael Heerdegen
2014-07-11 0:51 ` Grant Rettke
[not found] <mailman.5105.1404869933.1147.help-gnu-emacs@gnu.org>
2014-07-10 12:46 ` jduthen
2014-07-10 15:08 ` Grant Rettke
2014-07-10 16:09 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAjq1mf6RnCKKnnGjm4BvtSvU4=AfEFnbVytiZYXUVDOUwrq9Q@mail.gmail.com' \
--to=gcr@wisdomandwonder.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).