unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How properly utilize the minibuffer and inactive minibuffer startup hooks?
@ 2014-07-08 20:07 Grant Rettke
  2014-07-09 22:08 ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Rettke @ 2014-07-08 20:07 UTC (permalink / raw)
  To: Emacs Help

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-11  0:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5105.1404869933.1147.help-gnu-emacs@gnu.org>
2014-07-10 12:46 ` How properly utilize the minibuffer and inactive minibuffer startup hooks? jduthen
2014-07-10 15:08   ` Grant Rettke
2014-07-10 16:09     ` Drew Adams
2014-07-08 20:07 Grant Rettke
2014-07-09 22:08 ` Michael Heerdegen
2014-07-11  0:51   ` Grant Rettke

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).