all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Grant Rettke <gcr@wisdomandwonder.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Emacs Help <help-gnu-emacs@gnu.org>
Subject: Re: How properly utilize the minibuffer and inactive minibuffer startup hooks?
Date: Thu, 10 Jul 2014 19:51:11 -0500	[thread overview]
Message-ID: <CAAjq1mfeOTEG8h=QENa3uK_xi6o=EyPKvUvW0Xn3xW-3H_ZqDw@mail.gmail.com> (raw)
In-Reply-To: <87pphexk1n.fsf@web.de>

Thank you everyone.

Michael, that R advice looks like it is for Emacs 24.4, and I look
forward to using it.
Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Wed, Jul 9, 2014 at 5:08 PM, Michael Heerdegen
<michael_heerdegen@web.de> wrote:
> Hi Grant,
>
>
> No, it's not your fault.
>
> As you presumably already found out, the first time you enter a
> minibuffer and minibuffer-setup-hook is run, the minibuffer is in
> fundamental-mode.  The second time, however, it is in
> minibuffer-inactive-mode.
>
> `smartparens-mode` silently fails when the current major mode is in
> `sp-ignore-modes-list`.  The default-value of `sp-ignore-modes-list` is
> '(minibuffer-inactive-mode) -- but I don't know why the smartparens
> developer decided to do so.
>
> So, you should get it work when you remove `minibuffer-inactive-mode`
> from `sp-ignore-modes-list` - at your own risk.
>
> Adding to minibuffer-setup-hook is enough, btw, pushing your setup
> function to minibuffer-inactive-mode-hook as well is not necessary.
>
>
> BTW, another, maybe a bit saner, approach is to write your own
> implementation of eval-expression.  This is what I use, for example:
>
> ,----------------------------------------------------------------------
> | (progn
> |
> |   (defvar my-read-expression-map
> |     (let ((map (make-sparse-keymap)))
> |       (set-keymap-parent map read-expression-map)
> |       (define-key map [(control ?g)] #'minibuffer-keyboard-quit)
> |       (define-key map [up]   nil)
> |       (define-key map [down] nil)
> |       map))
> |
> |   (defun my-read--expression (prompt &optional initial-contents)
> |     (let ((minibuffer-completing-symbol t))
> |       (minibuffer-with-setup-hook
> |           (lambda ()
> |             (emacs-lisp-mode)
> |             (use-local-map my-read-expression-map)
> |             (setq font-lock-mode t)
> |             (funcall font-lock-function 1))
> |         (read-from-minibuffer prompt initial-contents
> |                               my-read-expression-map nil
> |                               'read-expression-history))))
> |
> |   (defun my-eval-expression (expression &optional arg)
> |     (interactive (list (read (my-read--expression ""))
> |                        current-prefix-arg))
> |     (if arg
> |         (insert (pp-to-string (eval expression lexical-binding)))
> |       (pp-display-expression (eval expression lexical-binding)
> |                              "*Pp Eval Output*"))))
> `----------------------------------------------------------------------
>
> smartparens-mode is enabled automatically via emacs-lisp-mode.
>
> I also want to make the R command in the debugger behave the same
> way:
>
> ,----------------------------------------------------------------------
> | (advice-add
> |  'debugger-record-expression :around
> |  (lambda (f exp) (interactive
> |              (list (read (my-read--expression "Record Eval: "))))
> |    (funcall f exp))
> |  '((name . use-my-read--expression)))
> `----------------------------------------------------------------------
>
>
> HTH,
>
> Michael.
>
>



  reply	other threads:[~2014-07-11  0:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 20:07 How properly utilize the minibuffer and inactive minibuffer startup hooks? Grant Rettke
2014-07-09 22:08 ` Michael Heerdegen
2014-07-11  0:51   ` Grant Rettke [this message]
     [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAjq1mfeOTEG8h=QENa3uK_xi6o=EyPKvUvW0Xn3xW-3H_ZqDw@mail.gmail.com' \
    --to=gcr@wisdomandwonder.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.