From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Grant Rettke <gcr@wisdomandwonder.com>
Newsgroups: gmane.emacs.help
Subject: Re: How properly utilize the minibuffer and inactive minibuffer
	startup hooks?
Date: Thu, 10 Jul 2014 19:51:11 -0500
Message-ID: <CAAjq1mfeOTEG8h=QENa3uK_xi6o=EyPKvUvW0Xn3xW-3H_ZqDw@mail.gmail.com>
References: <CAAjq1mf6RnCKKnnGjm4BvtSvU4=AfEFnbVytiZYXUVDOUwrq9Q@mail.gmail.com>
	<87pphexk1n.fsf@web.de>
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1405039900 27597 80.91.229.3 (11 Jul 2014 00:51:40 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 11 Jul 2014 00:51:40 +0000 (UTC)
Cc: Emacs Help <help-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 11 02:51:31 2014
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1X5P3i-00069Z-NU
	for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jul 2014 02:51:30 +0200
Original-Received: from localhost ([::1]:41437 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1X5P3i-0005Vz-AH
	for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 20:51:30 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44667)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grettke@gmail.com>) id 1X5P3R-0005Ss-8h
	for help-gnu-emacs@gnu.org; Thu, 10 Jul 2014 20:51:14 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grettke@gmail.com>) id 1X5P3Q-0004b7-8w
	for help-gnu-emacs@gnu.org; Thu, 10 Jul 2014 20:51:13 -0400
Original-Received: from mail-oa0-x233.google.com ([2607:f8b0:4003:c02::233]:52455)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grettke@gmail.com>) id 1X5P3Q-0004b3-41
	for help-gnu-emacs@gnu.org; Thu, 10 Jul 2014 20:51:12 -0400
Original-Received: by mail-oa0-f51.google.com with SMTP id j17so415786oag.38
	for <help-gnu-emacs@gnu.org>; Thu, 10 Jul 2014 17:51:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:in-reply-to:references:date:message-id:subject
	:from:to:cc:content-type:content-transfer-encoding;
	bh=N8KmiCqDGRqMygLVZZXFfH7GRJDkOwmxw0ibemCYedE=;
	b=eCTDAdAUAM2Hd3RR9o4l/YZtrUUjXAtnDC8w5mInSjBIgMNEzvxXSXvkj3V2Bredp3
	T2hZxAQCO0Gm5iI7pPYG/ZLfgqiFHfFDKRPv6XIihjtal4fwuR4l/8swZzI7YLpA0oVB
	nCB3VzlvZdomOb8CMS7KrojG9wSpl0UrhUlkrFwGr8vkVV2YevhI2eOw2Qdu1cVmmWdD
	mmZfXMu0QIng6ApzHw7kFijvrkquUNJ6GdjSHKI9LL8ksfq+2RiikVfsSFJQWLZDF6HL
	6pLsmmsHKSJtFv33erBEdPFB4hZqCxk/oPj/OmDqA3fTepGPiKxL8W1THaDBgIoRYK6w
	ChmA==
X-Received: by 10.60.220.163 with SMTP id px3mr59886076oec.35.1405039871587;
	Thu, 10 Jul 2014 17:51:11 -0700 (PDT)
Original-Received: by 10.182.77.39 with HTTP; Thu, 10 Jul 2014 17:51:11 -0700 (PDT)
In-Reply-To: <87pphexk1n.fsf@web.de>
X-Google-Sender-Auth: MYjGA0x6jwumC4f2eteGcvX_xuE
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Received-From: 2607:f8b0:4003:c02::233
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.help:98640
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/98640>

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/
=E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates
((=CE=BB (x) (x x)) (=CE=BB (x) (x x)))
=E2=80=9CLife has become immeasurably better since I have been forced to st=
op
taking it seriously.=E2=80=9D --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.
>
>