unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer
@ 2014-01-23  4:52 Keith David Bershatsky
  2014-01-23  5:15 ` Drew Adams
  2021-05-30  5:08 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Keith David Bershatsky @ 2014-01-23  4:52 UTC (permalink / raw)
  To: 16524

I started a thread on Stackoverflow thinking there was something I'm missing, but I'm pretty sure it's a bug:

http://stackoverflow.com/questions/21299074/how-to-use-a-minibuffer-exit-hook-with-read-string

The documentation for the minibuffer-exit-hook says it runs *after* exiting the minibuffer.  However, the function `minibufferp` reveals that this is not true with read-string.  It should be possible to use `minibufferp` and it should not return as positive when exiting the read-string function.

Essentially, I have one function that I'd like to use for a variety of situations that looks like this -- however, I would need to add it manually after every appearance of `read-string` in my setup unless this particular issue is resolved:

(defun lawlist-modeline-setup-two ()
  (cond
    ((minibufferp)
      (set-face-attribute 'mode-line nil :height 160 :foreground "gray70" :background "black" :box '(:line-width 1 :color "black"))
      (set-face-attribute 'minibuffer-prompt nil :background "black" :foreground "cyan")
      (set (make-local-variable 'face-remapping-alist) '((default :background "black" :foreground "yellow"))))
    ((or save-as-variable multi-extract-variable multi-attach-variable)
      (set-face-attribute 'mode-line nil :height 160 :foreground "black" :background "#eab700" :box nil))
    ((and (featurep 'multiple-cursors) multiple-cursors-mode)
      (set-face-attribute 'mode-line nil :height 160 :foreground "black" :background "cyan" :box nil))
    ((eq major-mode 'lawlist-calculator-mode)
      (set-face-attribute 'mode-line nil :height 160 :foreground "black" :background "firebrick" :box nil))
    (t
      (set-face-attribute 'mode-line nil :height 160 :foreground "black" :background "gray70" :box nil)
      (set-face-attribute 'minibuffer-prompt nil :background "black" :foreground "gray70")) ))

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




In GNU Emacs 24.3.50.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
 of 2014-01-19 on MP.local
Repository revision: 116074 rudalics@gmx.at-20140119165951-u43soyrpvzsqubr1
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure --with-ns'

Important settings:
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  hl-line-mode: t
  global-lawlist-scroll-bar-mode: t
  lawlist-scroll-bar-mode: t
  delete-selection-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  tabbar-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  buffer-read-only: t
  transient-mark-mode: t

Recent input:
r y SPC 2 6 , SPC 2 0 1 4 <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <down> <left> <up> <s-right> <left> <right> 
<right> <S-down> b l a n k SPC a n d <s-left> c o m 
p e l t e d <backspace> <backspace> <backspace> <backspace> 
<backspace> l e t e d SPC a n d SPC <s-right> <backspace> 
<backspace> <backspace> I n c o m SPC <backspace> e 
SPC a n d SPC E x p e n s e SPC D e c l a r a t i o 
n SPC [ F L - 1 5 0 ] <up> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <M-right> 
<M-right> <M-right> <M-right> <M-right> <M-right> <S-s-right> 
s-x <kp-delete> <s-right> ; SPC s-v <up> <s-right> 
<M-left> <M-left> <M-left> <M-left> <M-left> <M-left> 
<M-left> D e c l a r a t i o n SPC o f SPC J i z SPC 
P e n g SPC F e i ; SPC <down> SPC <backspace> <s-left> 
<M-left> <M-left> <M-left> <M-left> <M-left> <M-left> 
<M-right> e x h i b i t s ; SPC s-z s-o <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <return> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<return> <escape> x e m a c s - r e p o r t - b u g 
<return> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> r e p o r t - e m a c s - b 
u g <return>

Recent messages:
Saving file /Users/HOME/.0.data/.0.emacs/.scratch...
Wrote /Users/HOME/.0.data/.0.emacs/.scratch
Saving file /Users/HOME/.0.data/.0.emacs/.scratch...
Wrote /Users/HOME/.0.data/.0.emacs/.scratch
Undo...
Undo!
Saving file /Users/HOME/.0.data/.0.emacs/.scratch...
Wrote /Users/HOME/.0.data/.0.emacs/.scratch
*beep*
Focus is still in the minibuffer:   *Minibuf-1* [2 times]

Load-path shadows:
/Users/HOME/.0.data/.0.emacs/elpa/flim/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/md4
/Users/HOME/.0.data/.0.emacs/elpa/flim/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/hex-util
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/sasl
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/sasl-ntlm
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/sasl-digest
/Users/HOME/.0.data/.0.emacs/elpa/flim/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/sasl-cram
/Users/HOME/.0.data/.0.emacs/elpa/flim/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/ntlm
/Users/HOME/.0.data/.0.emacs/elpa/flim/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/hmac-md5
/Users/HOME/.0.data/.0.emacs/elpa/flim/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/net/hmac-def
/Users/HOME/.0.data/.0.emacs/elpa/wanderlust/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/mail/rfc2368
/Users/HOME/.0.data/.0.emacs/elpa/wanderlust/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/gnus/utf7
/Users/HOME/.0.data/.0.emacs/elpa/semi/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/gnus/smime
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp5
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg-parse
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg-gpg
/Users/HOME/.0.data/.0.emacs/elpa/semi/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/pgg-def
/Users/HOME/.0.data/.0.emacs/elpa/utilities/longlines hides /Users/HOME/.0.data/.0.emacs/Emacs_01_19_2014.app/Contents/Resources/lisp/obsolete/longlines

Features:
(shadow wl-mime mime-edit pgg-parse pccl pccl-20 signature mime-setup
mail-mime-setup semi-setup mime-pgp pgg-def mime-play filename
mime-image modb-standard elmo-imap4 time-stamp emacsbug server init-wl
wl-demo wl-draft eword-encode wl-template sendmail elmo-net elmo-cache
elmo-map elmo-dop wl-news wl-address wl-thread wl-folder wl wl-e21
wl-spam wl-action wl-summary wl-refile wl-util pp elmo-flag
elmo-localdir wl-message elmo-mime mmelmo-buffer mmelmo-imap mime-view
mime-conf calist semi-def mmimap mime-parse mmbuffer mmgeneric
elmo-multi elmo-spam elsp-header elsp-generic elmo elmo-signal
wl-highlight wl-vars wl-version epg-config elmo-msgdb modb
modb-generic modb-entity luna mime elmo-util emu invisible inv-23 poem
poem-e20 poem-e20_3 utf7 eword-decode mel mime-def alist std11
mcharset mcs-20 mcs-e20 pces pces-e20 pces-20 broken pcustom elmo-date
elmo-vars elmo-version path-util poe pym static apel-ver product
w3m-load mime-w3m w3m browse-url doc-view jka-compr image-mode
w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image
w3m-proc w3m-util disp-table whitespace linum hl-line
multiple-cursors-autoloads package bbdb-autoloads delsel savehist
lawlist-calculator ps-print ps-def lpr flyspell ispell
auto-save-buffers-enhanced bbdb timezone dired-aux dired yasnippet
help-mode multiple-cursors mc-separate-operations
rectangular-region-mode mc-mark-more thingatpt mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect saveplace lawlist-tex-mode
pcase compile shell pcomplete comint ansi-color ring skeleton
compare-w desktop frameset init-tabbar tabbar lawlist-org
lawlist-calendar advice edmacro kmacro derived org-toodledo
mailcap-toodledo lawlist-tls http-post-simple url-http tls url-auth
url-gw url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio byte-opt
bytecomp byte-compile cconv eieio-core password-cache url-vars mailcap
json xml w3mexcerpt noutline outline easy-mmode find-func gnus-sum
nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec
gnus-int gnus-range message cl-macs gv format-spec rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus
gnus-ems nnheader gnus-util mail-utils mm-util help-fns mail-prsvr
wid-edit cl cl-loaddefs cl-lib highlight-parentheses redo time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process cocoa ns multi-tty emacs)





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

* bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer
  2014-01-23  4:52 bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer Keith David Bershatsky
@ 2014-01-23  5:15 ` Drew Adams
  2021-05-30  5:08 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2014-01-23  5:15 UTC (permalink / raw)
  To: Keith David Bershatsky, 16524

See my reply on SO:
http://stackoverflow.com/a/21299834/729907

IMO, this is not a bug, unless it is to say that the doc should
more precisely specify when the hook is run.  IOW, doc bug, yes;
the behavior could be described better.





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

* bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer
  2014-01-23  4:52 bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer Keith David Bershatsky
  2014-01-23  5:15 ` Drew Adams
@ 2021-05-30  5:08 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-30  5:08 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 16524

Keith David Bershatsky <esq@lawlist.com> writes:

> The documentation for the minibuffer-exit-hook says it runs *after*
> exiting the minibuffer.

Simpler test case for the problem:

(push (lambda ()
	(message "exiting %s" (minibufferp)))
      minibuffer-exit-hook)

(read-string "foo")

It turns out that `minibuffer-exit-hook' is usually (always?) run in the
minibuffer, so "Normal hook run just after exit from minibuffer." is
misleading.  I've instead copied the text from the manual, which says
"Normal hook run whenever a minibuffer is exited." in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-05-30  5:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23  4:52 bug#16524: 24.3.50; read-string executes minibuffer-exit-hook *before* exiting minibuffer Keith David Bershatsky
2014-01-23  5:15 ` Drew Adams
2021-05-30  5:08 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

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