unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
@ 2019-08-01 10:30 Sanel Zukan
  2019-08-01 11:37 ` Basil L. Contovounesios
  2019-08-02  6:35 ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Sanel Zukan @ 2019-08-01 10:30 UTC (permalink / raw)
  To: 36886

When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
disabled because it will show function arguments inside mode-line.

I believe intention behind (global-eldoc-mode -1) should be that all
eldoc facility gets disabled. Right now, the only way to stop poping
stuff in mode-line is this:

 (setq-default eldoc-message-function 'ignore)

Best,
Sanel




In GNU Emacs 26.2 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.18.9)
 of 2019-07-17 built on hive64.slackware.lan
Recent messages:
Saving file /home/sanel/.emacs.d/init.el...
Wrote /home/sanel/.emacs.d/init.el
Quit
Mark set
No completions of 2-
Hit space to flush
No completions of ../../../sta
Hit space to flush
GNU Emacs 26.2 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.18.9) of 2019-07-17 [2 times]
Making completion list... [3 times]

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
 --program-prefix= --program-suffix= --mandir=/usr/man
 --infodir=/usr/info --without-gconf --without-gsettings --with-x
 --with-x-toolkit=gtk3 --build=x86_64-slackware-linux 'CFLAGS=-O2
 -fPIC''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GLIB NOTIFY ACL
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM
THREADS LCMS2

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_US.utf8
  value of $LC_MESSAGES: en_US.utf8
  value of $LC_MONETARY: en_US.utf8
  value of $LC_NUMERIC: en_US.utf8
  value of $LC_TIME: en_US.utf8
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Eshell

Minor modes in effect:
  imenu-list-minor-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  evil-mode: t
  evil-local-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/evil/lib/ert hides /usr/share/emacs/26.2/lisp/emacs-lisp/ert

Features:
(shadow emacsbug zeal-at-point chistory hideshow imenu-list wttrin
xterm-color ol-notmuch etags xref project nroff-mode calc-undo calc-misc
org-notmuch ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff face-remap linum fzf subr-x log-view
vc-annotate vc vc-dispatcher idomenu log4j-mode tramp-cmds
ido-select-window dired-aux declutter json map skeleton ack pcase
files-x tramp-cache tramp-sh pcmpl-gnu m4-mode make-mode markdown-mode
tabify cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew
holidays hol-loaddefs cal-iso mm-archive debug conf-mode shr-color color
network-stream starttls url-http url-gw nsm url-cache url-auth woman man
timezone ibuf-ext ibuffer ibuffer-loaddefs flyspell sendmail ispell sort
gnus-alias mail-extr pcmpl-unix ffap em-unix em-term term ehelp
em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl
em-basic em-banner em-alias tex-mode latexenc ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii
ox-publish ox magit-key-mode magit view grep compile autorevert
filenotify git-rebase-mode git-commit-mode log-edit pcvs-util add-log
ido cal-move dabbrev cua-base calc-alg calc-ext calc-menu calc
calc-loaddefs calc-macs cl-print eieio-opt speedbar sb-image ezimage
dframe ob-ditaa ob-plantuml org-archive org-capture org-colview
org-crypt org-indent help-fns radix-tree org-table org-duration
org-clock elfeed-show elfeed-search elfeed-csv elfeed elfeed-curl
elfeed-log elfeed-db elfeed-lib xml-query bookmark pp eww mm-url
url-queue url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util shr svg xml dom browse-url sh-script smie
executable ledger-mode ledger-check ledger-schedule ledger-xact
ledger-texi ledger-test ledger-sort ledger-report ledger-reconcile
ledger-post ledger-occur ledger-init ledger-fontify ledger-state
ledger-navigate ledger-fonts ledger-exec ledger-context ledger-complete
ledger-commodities esh-var esh-io esh-cmd esh-opt esh-ext esh-proc
esh-groups eshell esh-module esh-mode esh-arg esh-util cus-edit
cus-start cus-load ledger-regex cpp cc-mode cc-fonts cc-guess cc-menus
cc-cmds yaml-mode monroe clojure-mode rx imenu inf-lisp tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell vc-git
org-habit org-agenda org-rmail org-mhe org-irc org-info org-gnus nnir
gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls gnutls utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range gnus-win gnus nnheader org-docview doc-view jka-compr
image-mode org-bibtex bibtex org-bbdb org-w3m org-element avl-tree
generator org org-macro org-footnote org-pcomplete pcomplete org-list
org-faces org-entities noutline outline org-version ob-emacs-lisp ob
ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint comint
ansi-color ob-core ob-eval org-compat org-macs org-loaddefs find-func
desktop frameset term/rxvt term/xterm xterm server elec-pair notmuch
hl-line notmuch-message notmuch-hello wid-edit notmuch-tree notmuch-show
notmuch-print notmuch-crypto notmuch-mua notmuch-draft
notmuch-maildir-fcc notmuch-address notmuch-company notmuch-parser
notmuch-wash diff-mode coolj notmuch-query goto-addr icalendar diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs notmuch-tag crm
notmuch-lib notmuch-version notmuch-compat message rmc puny dired
dired-loaddefs format-spec rfc822 mml mailabbrev gmm-utils mailheader
mm-view mml-smime mml-sec epa epg gnus-util rmail rmail-loaddefs
mail-utils time-date smime dig mm-decode mm-bodies mm-encode mailcap
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr evil
evil-integration undo-tree derived easy-mmode cl-extra help-mode diff cl
evil-maps evil-commands evil-jumps evil-command-window evil-types
evil-search evil-ex evil-macros evil-repeat evil-states evil-core advice
evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro
kmacro cc-styles cc-align cc-engine cc-vars cc-defs disp-table
finder-inf dash-functional-autoloads f-autoloads dash-autoloads info
magit-autoloads git-rebase-mode-autoloads git-commit-mode-autoloads
php-mode-autoloads request-deferred-autoloads request-autoloads
deferred-autoloads s-autoloads yaml-mode-autoloads package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded 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 threads dbusbind inotify lcms2 dynamic-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 2917359 906660)
 (symbols 48 65421 3)
 (miscs 40 14616 29680)
 (strings 32 2687160 124540)
 (string-bytes 1 112066300)
 (vectors 16 700294)
 (vector-slots 8 7705491 218730)
 (floats 8 201985 20921)
 (intervals 56 52031 12167)
 (buffers 992 223)
 (heap 1024 402497 19420))





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-01 10:30 bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely Sanel Zukan
@ 2019-08-01 11:37 ` Basil L. Contovounesios
  2019-08-01 12:29   ` Sanel Zukan
  2019-08-01 13:38   ` Dmitry Gutov
  2019-08-02  6:35 ` Eli Zaretskii
  1 sibling, 2 replies; 22+ messages in thread
From: Basil L. Contovounesios @ 2019-08-01 11:37 UTC (permalink / raw)
  To: Sanel Zukan; +Cc: 36886, Dmitry Gutov

Sanel Zukan <sanelz@gmail.com> writes:

> When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
> disabled because it will show function arguments inside mode-line.
>
> I believe intention behind (global-eldoc-mode -1) should be that all
> eldoc facility gets disabled. Right now, the only way to stop poping
> stuff in mode-line is this:
>
>  (setq-default eldoc-message-function 'ignore)

CCing Dmitry, who explicitly enabled eldoc-mode in read--expression as
part of bug#27202: https://debbugs.gnu.org/27202.

My gut says that bug should be fixable within eldoc.el, without having
to tweak read--expression, but I'm not familiar with eldoc.

Thanks,

-- 
Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-01 11:37 ` Basil L. Contovounesios
@ 2019-08-01 12:29   ` Sanel Zukan
  2019-08-01 13:38   ` Dmitry Gutov
  1 sibling, 0 replies; 22+ messages in thread
From: Sanel Zukan @ 2019-08-01 12:29 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 36886, Dmitry Gutov

Thanks!

Best,
Sanel

"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> Sanel Zukan <sanelz@gmail.com> writes:
>
>> When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
>> disabled because it will show function arguments inside mode-line.
>>
>> I believe intention behind (global-eldoc-mode -1) should be that all
>> eldoc facility gets disabled. Right now, the only way to stop poping
>> stuff in mode-line is this:
>>
>>  (setq-default eldoc-message-function 'ignore)
>
> CCing Dmitry, who explicitly enabled eldoc-mode in read--expression as
> part of bug#27202: https://debbugs.gnu.org/27202.
>
> My gut says that bug should be fixable within eldoc.el, without having
> to tweak read--expression, but I'm not familiar with eldoc.
>
> Thanks,
>
> -- 
> Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-01 11:37 ` Basil L. Contovounesios
  2019-08-01 12:29   ` Sanel Zukan
@ 2019-08-01 13:38   ` Dmitry Gutov
  1 sibling, 0 replies; 22+ messages in thread
From: Dmitry Gutov @ 2019-08-01 13:38 UTC (permalink / raw)
  To: Basil L. Contovounesios, Sanel Zukan; +Cc: 36886

On 01.08.2019 14:37, Basil L. Contovounesios wrote:
> Sanel Zukan <sanelz@gmail.com> writes:
> 
>> When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
>> disabled because it will show function arguments inside mode-line.
>>
>> I believe intention behind (global-eldoc-mode -1) should be that all
>> eldoc facility gets disabled. Right now, the only way to stop poping
>> stuff in mode-line is this:
>>
>>   (setq-default eldoc-message-function 'ignore)
> 
> CCing Dmitry, who explicitly enabled eldoc-mode in read--expression as
> part of bug#27202: https://debbugs.gnu.org/27202.
> 
> My gut says that bug should be fixable within eldoc.el, without having
> to tweak read--expression, but I'm not familiar with eldoc.

I'm not sure what's the best way. But this should help:

diff --git a/lisp/simple.el b/lisp/simple.el
index 0bc39f08c0..4eec9e732d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1583,7 +1583,8 @@ read--expression
            ;; FIXME: call emacs-lisp-mode?
            (add-function :before-until (local 
'eldoc-documentation-function)
                          #'elisp-eldoc-documentation-function)
-          (eldoc-mode 1)
+          (when global-eldoc-mode
+            (eldoc-mode 1))
            (add-hook 'completion-at-point-functions
                      #'elisp-completion-at-point nil t)
            (run-hooks 'eval-expression-minibuffer-setup-hook))





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-01 10:30 bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely Sanel Zukan
  2019-08-01 11:37 ` Basil L. Contovounesios
@ 2019-08-02  6:35 ` Eli Zaretskii
  2019-08-02  9:35   ` Sanel Zukan
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-02  6:35 UTC (permalink / raw)
  To: Sanel Zukan; +Cc: 36886

> From: Sanel Zukan <sanelz@gmail.com>
> Date: Thu, 01 Aug 2019 12:30:38 +0200
> 
> When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
> disabled because it will show function arguments inside mode-line.

I don't think I can reproduce this here.  Can you show a complete
recipe, starting from "emacs -Q"?

Thanks.





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02  6:35 ` Eli Zaretskii
@ 2019-08-02  9:35   ` Sanel Zukan
  2019-08-02 11:44     ` Basil L. Contovounesios
  2019-08-02 11:50     ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Sanel Zukan @ 2019-08-02  9:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36886

Here is how to reproduce it with emacs -Q:

1. $ emacs -Q
2. M-x (global-eldoc-mode -1)
;; by not it should be disabled in mode-line, but if you do this:
3. M-: (fboundp '    <-- after entering apostrophe, eldoc will show
'fboundp' protoype in mode-line.

Also after (global-eldoc-mode -1), I don't see anwyhere in eldoc.el code
that eldoc-message-function is changed.

Emacs version: GNU Emacs 26.2 (build 1, x86_64-slackware-linux-gnu, GTK+
Version 3.18.9) of 2019-07-17

Best,
Sanel


Eli Zaretskii <eliz@gnu.org> writes:
>> From: Sanel Zukan <sanelz@gmail.com>
>> Date: Thu, 01 Aug 2019 12:30:38 +0200
>> 
>> When Emacs is run with (global-eldoc-mode -1), eldoc is not completely
>> disabled because it will show function arguments inside mode-line.
>
> I don't think I can reproduce this here.  Can you show a complete
> recipe, starting from "emacs -Q"?
>
> Thanks.





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02  9:35   ` Sanel Zukan
@ 2019-08-02 11:44     ` Basil L. Contovounesios
  2019-08-02 12:00       ` Eli Zaretskii
  2019-08-02 12:36       ` Sanel Zukan
  2019-08-02 11:50     ` Eli Zaretskii
  1 sibling, 2 replies; 22+ messages in thread
From: Basil L. Contovounesios @ 2019-08-02 11:44 UTC (permalink / raw)
  To: Sanel Zukan; +Cc: 36886

Sanel Zukan <sanelz@gmail.com> writes:

> Here is how to reproduce it with emacs -Q:
>
> 1. $ emacs -Q
> 2. M-x (global-eldoc-mode -1)
> ;; by not it should be disabled in mode-line, but if you do this:
> 3. M-: (fboundp '    <-- after entering apostrophe, eldoc will show
> 'fboundp' protoype in mode-line.
>
> Also after (global-eldoc-mode -1), I don't see anwyhere in eldoc.el code
> that eldoc-message-function is changed.

AFAICT eldoc-message-function doesn't need to be changed because it
isn't called when eldoc-mode is disabled.

The reason it ends up being called in your example is that M-:
explicitly and unconditionally enables eldoc-mode in the minibuffer.

Dmitry suggested making this behaviour conditional as a workaround, but
ultimately it would probably be best to try fixing bug#27202 without
messing with eldoc-mode in read--expression.

Thanks,

-- 
Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02  9:35   ` Sanel Zukan
  2019-08-02 11:44     ` Basil L. Contovounesios
@ 2019-08-02 11:50     ` Eli Zaretskii
  2019-08-02 12:51       ` Sanel Zukan
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-02 11:50 UTC (permalink / raw)
  To: Sanel Zukan; +Cc: 36886

> From: Sanel Zukan <sanelz@gmail.com>
> Cc: 36886@debbugs.gnu.org
> Date: Fri, 02 Aug 2019 11:35:29 +0200
> 
> 1. $ emacs -Q
> 2. M-x (global-eldoc-mode -1)
> ;; by not it should be disabled in mode-line, but if you do this:
> 3. M-: (fboundp '    <-- after entering apostrophe, eldoc will show
> 'fboundp' protoype in mode-line.

So this only happens in M-:.  That wasn't evident from your original
report.  global-eldoc-mode generally shows the signatures when point
is inside any defun or other def* forms, not only in the minibuffer.

Thanks.





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 11:44     ` Basil L. Contovounesios
@ 2019-08-02 12:00       ` Eli Zaretskii
  2019-08-02 13:19         ` Basil L. Contovounesios
  2019-08-02 12:36       ` Sanel Zukan
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-02 12:00 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: sanelz, 36886

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Cc: Eli Zaretskii <eliz@gnu.org>,  36886@debbugs.gnu.org
> Date: Fri, 02 Aug 2019 14:44:33 +0300
> 
> The reason it ends up being called in your example is that M-:
> explicitly and unconditionally enables eldoc-mode in the minibuffer.
> 
> Dmitry suggested making this behaviour conditional as a workaround, but
> ultimately it would probably be best to try fixing bug#27202 without
> messing with eldoc-mode in read--expression.

I agree.  Any suggestions?





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 11:44     ` Basil L. Contovounesios
  2019-08-02 12:00       ` Eli Zaretskii
@ 2019-08-02 12:36       ` Sanel Zukan
  1 sibling, 0 replies; 22+ messages in thread
From: Sanel Zukan @ 2019-08-02 12:36 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 36886

Thanks for detail explanation Basil!

"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> Sanel Zukan <sanelz@gmail.com> writes:
>
>> Here is how to reproduce it with emacs -Q:
>>
>> 1. $ emacs -Q
>> 2. M-x (global-eldoc-mode -1)
>> ;; by not it should be disabled in mode-line, but if you do this:
>> 3. M-: (fboundp '    <-- after entering apostrophe, eldoc will show
>> 'fboundp' protoype in mode-line.
>>
>> Also after (global-eldoc-mode -1), I don't see anwyhere in eldoc.el code
>> that eldoc-message-function is changed.
>
> AFAICT eldoc-message-function doesn't need to be changed because it
> isn't called when eldoc-mode is disabled.
>
> The reason it ends up being called in your example is that M-:
> explicitly and unconditionally enables eldoc-mode in the minibuffer.
>
> Dmitry suggested making this behaviour conditional as a workaround, but
> ultimately it would probably be best to try fixing bug#27202 without
> messing with eldoc-mode in read--expression.
>
> Thanks,
>
> -- 
> Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 11:50     ` Eli Zaretskii
@ 2019-08-02 12:51       ` Sanel Zukan
  2019-08-02 14:33         ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Sanel Zukan @ 2019-08-02 12:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36886

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Sanel Zukan <sanelz@gmail.com>
>> Cc: 36886@debbugs.gnu.org
>> Date: Fri, 02 Aug 2019 11:35:29 +0200
>> 
>> 1. $ emacs -Q
>> 2. M-x (global-eldoc-mode -1)
>> ;; by not it should be disabled in mode-line, but if you do this:
>> 3. M-: (fboundp '    <-- after entering apostrophe, eldoc will show
>> 'fboundp' protoype in mode-line.
>
> So this only happens in M-:.  That wasn't evident from your original
> report.  global-eldoc-mode generally shows the signatures when point
> is inside any defun or other def* forms, not only in the minibuffer.

Hm... eldoc-message-function is part of eldoc package and I was hoping
that, by completely disabling eldoc-mode, it will revert whatever is
enabled when mode is initialized from that package. I guess different
views from user and developer points.

But I'm happy we are on the same page regarding this ticket.

> Thanks.

Thanks!
Sanel





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 12:00       ` Eli Zaretskii
@ 2019-08-02 13:19         ` Basil L. Contovounesios
  2019-08-02 14:28           ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Basil L. Contovounesios @ 2019-08-02 13:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sanelz, 36886

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Basil L. Contovounesios" <contovob@tcd.ie>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  36886@debbugs.gnu.org
>> Date: Fri, 02 Aug 2019 14:44:33 +0300
>> 
>> The reason it ends up being called in your example is that M-:
>> explicitly and unconditionally enables eldoc-mode in the minibuffer.
>> 
>> Dmitry suggested making this behaviour conditional as a workaround, but
>> ultimately it would probably be best to try fixing bug#27202 without
>> messing with eldoc-mode in read--expression.
>
> I agree.  Any suggestions?

Not off the top of my head, as I'm not familiar with eldoc-mode or
bug#27202, but I can try to take a look in the coming days if no-one
does so first.

-- 
Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 13:19         ` Basil L. Contovounesios
@ 2019-08-02 14:28           ` Eli Zaretskii
  2019-08-04  0:35             ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-02 14:28 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: sanelz, 36886

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Cc: sanelz@gmail.com,  36886@debbugs.gnu.org
> Date: Fri, 02 Aug 2019 16:19:13 +0300
> 
> >> Dmitry suggested making this behaviour conditional as a workaround, but
> >> ultimately it would probably be best to try fixing bug#27202 without
> >> messing with eldoc-mode in read--expression.
> >
> > I agree.  Any suggestions?
> 
> Not off the top of my head, as I'm not familiar with eldoc-mode or
> bug#27202, but I can try to take a look in the coming days if no-one
> does so first.

I actually don't understand why, when the globalized mode is ON, it
doesn't work in the minibuffer.  What am I missing?





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 12:51       ` Sanel Zukan
@ 2019-08-02 14:33         ` Eli Zaretskii
  0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-02 14:33 UTC (permalink / raw)
  To: Sanel Zukan; +Cc: 36886

> From: Sanel Zukan <sanelz@gmail.com>
> Cc: 36886@debbugs.gnu.org
> Date: Fri, 02 Aug 2019 14:51:04 +0200
> 
> > So this only happens in M-:.  That wasn't evident from your original
> > report.  global-eldoc-mode generally shows the signatures when point
> > is inside any defun or other def* forms, not only in the minibuffer.
> 
> Hm... eldoc-message-function is part of eldoc package and I was hoping
> that, by completely disabling eldoc-mode, it will revert whatever is
> enabled when mode is initialized from that package. I guess different
> views from user and developer points.

I don't think this is about the differences in our views: I didn't say
I considered the behavior you described correct (it isn't).

My point was that your original report lacked some details, which
caused me to think the problem was not reproducible, because my naïve
attempt to reproduce it didn't use M-:.  It is important to describe
the recipe in enough detail to avoid that; please do that in the
future.





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-02 14:28           ` Eli Zaretskii
@ 2019-08-04  0:35             ` Noam Postavsky
  2019-08-04  7:51               ` Basil L. Contovounesios
  2019-08-04 16:27               ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Noam Postavsky @ 2019-08-04  0:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Basil L. Contovounesios, sanelz, 36886

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> I actually don't understand why, when the globalized mode is ON, it
> doesn't work in the minibuffer.  What am I missing?

define-globalized-minor-mode only adds after-change-major-mode-hook,
find-file-hook, and change-major-mode-hook.  AFAICT, the minibuffer
stays in fundamental-mode, and doesn't visit a file so none of those are
triggered.  Possible patch attached (some additional manual updates +
NEWS would be needed for define-globalized-minor-mode change).


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5495 bytes --]

From d16b9c5dffb84c53bc6f55c4ca74fc8135d48d7f Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Aug 2019 20:19:31 -0400
Subject: [PATCH] Respect global-eldoc-mode in minibuffers (Bug#36886)

* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Accept
a BODY parameter.
* lisp/emacs-lisp/eldoc.el (global-eldoc-mode): Add or remove
eldoc-mode to eval-expression-minibuffer-setup-hook when enabling or
disabling global-eldoc-mode.
* lisp/simple.el (read--expression): Remove the no-longer-needed
unconditional call to eldoc-mode.
---
 lisp/emacs-lisp/easy-mmode.el | 38 ++++++++++++++++++++++----------------
 lisp/emacs-lisp/eldoc.el      |  5 ++++-
 lisp/simple.el                |  1 -
 3 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index be531aab84..fcbddc8629 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -363,18 +363,21 @@ 'easy-mmode-define-global-mode
 ;;;###autoload
 (defalias 'define-global-minor-mode 'define-globalized-minor-mode)
 ;;;###autoload
-(defmacro define-globalized-minor-mode (global-mode mode turn-on &rest keys)
+(defmacro define-globalized-minor-mode (global-mode mode turn-on &rest body)
   "Make a global mode GLOBAL-MODE corresponding to buffer-local minor MODE.
 TURN-ON is a function that will be called with no args in every buffer
   and that should try to turn MODE on if applicable for that buffer.
-KEYS is a list of CL-style keyword arguments.  As the minor mode
-  defined by this function is always global, any :global keyword is
-  ignored.  Other keywords have the same meaning as in `define-minor-mode',
-  which see.  In particular, :group specifies the custom group.
-  The most useful keywords are those that are passed on to the
-  `defcustom'.  It normally makes no sense to pass the :lighter
-  or :keymap keywords to `define-globalized-minor-mode', since these
-  are usually passed to the buffer-local version of the minor mode.
+Each of KEY VALUE is a pair of CL-style keyword arguments.  As
+  the minor mode defined by this function is always global, any
+  :global keyword is ignored.  Other keywords have the same
+  meaning as in `define-minor-mode', which see.  In particular,
+  :group specifies the custom group.  The most useful keywords
+  are those that are passed on to the `defcustom'.  It normally
+  makes no sense to pass the :lighter or :keymap keywords to
+  `define-globalized-minor-mode', since these are usually passed
+  to the buffer-local version of the minor mode.
+BODY contains code to execute each time the mode is enabled or disabled.
+  It is executed after toggling the mode, and before running GLOBAL-MODE-hook.
 
 If MODE's set-up depends on the major mode in effect when it was
 enabled, then disabling and reenabling MODE should make MODE work
@@ -384,7 +387,9 @@ define-globalized-minor-mode
 
 When a major mode is initialized, MODE is actually turned on just
 after running the major mode's hook.  However, MODE is not turned
-on if the hook has explicitly disabled it."
+on if the hook has explicitly disabled it.
+
+\(fn GLOBAL-MODE MODE TURN-ON [KEY VALUE]... BODY)"
   (declare (doc-string 2))
   (let* ((global-mode-name (symbol-name global-mode))
 	 (mode-name (symbol-name mode))
@@ -404,12 +409,12 @@ define-globalized-minor-mode
 	 keyw)
 
     ;; Check keys.
-    (while (keywordp (setq keyw (car keys)))
-      (setq keys (cdr keys))
+    (while (keywordp (setq keyw (car body)))
+      (pop body)
       (pcase keyw
-	(:group (setq group (nconc group (list :group (pop keys)))))
-	(:global (setq keys (cdr keys)))
-	(_ (push keyw extra-keywords) (push (pop keys) extra-keywords))))
+        (:group (setq group (nconc group (list :group (pop body)))))
+        (:global (pop body))
+        (_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
 
     `(progn
        (progn
@@ -446,7 +451,8 @@ define-globalized-minor-mode
 	 ;; Go through existing buffers.
 	 (dolist (buf (buffer-list))
 	   (with-current-buffer buf
-	     (if ,global-mode (funcall #',turn-on) (when ,mode (,mode -1))))))
+             (if ,global-mode (funcall #',turn-on) (when ,mode (,mode -1)))))
+         ,@body)
 
        ;; Autoloading define-globalized-minor-mode autoloads everything
        ;; up-to-here.
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 16b5863209..e5f1832de6 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -207,7 +207,10 @@ eldoc-mode
 (define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
   :group 'eldoc
   :initialize 'custom-initialize-delay
-  :init-value t)
+  :init-value t
+  (if global-eldoc-mode
+      (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)
+    (remove-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)))
 
 ;;;###autoload
 (defun turn-on-eldoc-mode ()
diff --git a/lisp/simple.el b/lisp/simple.el
index e33709e8ad..f81400c073 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1583,7 +1583,6 @@ read--expression
           ;; FIXME: call emacs-lisp-mode?
           (add-function :before-until (local 'eldoc-documentation-function)
                         #'elisp-eldoc-documentation-function)
-          (eldoc-mode 1)
           (add-hook 'completion-at-point-functions
                     #'elisp-completion-at-point nil t)
           (run-hooks 'eval-expression-minibuffer-setup-hook))
-- 
2.11.0


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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-04  0:35             ` Noam Postavsky
@ 2019-08-04  7:51               ` Basil L. Contovounesios
  2019-08-04  9:00                 ` Štěpán Němec
  2019-08-04 14:34                 ` Noam Postavsky
  2019-08-04 16:27               ` Eli Zaretskii
  1 sibling, 2 replies; 22+ messages in thread
From: Basil L. Contovounesios @ 2019-08-04  7:51 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 36886, sanelz

Noam Postavsky <npostavs@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> I actually don't understand why, when the globalized mode is ON, it
>> doesn't work in the minibuffer.  What am I missing?
>
> define-globalized-minor-mode only adds after-change-major-mode-hook,
> find-file-hook, and change-major-mode-hook.  AFAICT, the minibuffer
> stays in fundamental-mode, and doesn't visit a file so none of those are
> triggered.

The call to read-from-minibuffer in read--expression triggers
change-major-mode-hook and after-change-major-mode-hook.

These in turn call turn-on-eldoc-mode, which calls eldoc--supported-p,
which checks the value of eldoc-documentation-function.

The problem is that minibuffer-setup-hook, which sets
eldoc-documentation-function, has not yet run at this stage, so the
minibuffer is not yet considered suitable for enabling eldoc-mode.

> Possible patch attached (some additional manual updates +
> NEWS would be needed for define-globalized-minor-mode change).
>
> From d16b9c5dffb84c53bc6f55c4ca74fc8135d48d7f Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Sat, 3 Aug 2019 20:19:31 -0400
> Subject: [PATCH] Respect global-eldoc-mode in minibuffers (Bug#36886)
>
> * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Accept
> a BODY parameter.
> * lisp/emacs-lisp/eldoc.el (global-eldoc-mode): Add or remove
> eldoc-mode to eval-expression-minibuffer-setup-hook when enabling or
> disabling global-eldoc-mode.
> * lisp/simple.el (read--expression): Remove the no-longer-needed
> unconditional call to eldoc-mode.

Should this log entry mention bug#27202 as well?

[...]

> diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
> index 16b5863209..e5f1832de6 100644
> --- a/lisp/emacs-lisp/eldoc.el
> +++ b/lisp/emacs-lisp/eldoc.el
> @@ -207,7 +207,10 @@ eldoc-mode
>  (define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
>    :group 'eldoc
>    :initialize 'custom-initialize-delay
> -  :init-value t)
> +  :init-value t
> +  (if global-eldoc-mode
> +      (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)
> +    (remove-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)))

This looks fine to me (the only alternative I can think of is creating a
new major mode specifically for read--expression), but shouldn't this
call to eldoc-mode be bundled in the same hook function with...

>  ;;;###autoload
>  (defun turn-on-eldoc-mode ()
> diff --git a/lisp/simple.el b/lisp/simple.el
> index e33709e8ad..f81400c073 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -1583,7 +1583,6 @@ read--expression
>            ;; FIXME: call emacs-lisp-mode?
>            (add-function :before-until (local 'eldoc-documentation-function)
>                          #'elisp-eldoc-documentation-function)

...this advice?

> -          (eldoc-mode 1)
>            (add-hook 'completion-at-point-functions
>                      #'elisp-completion-at-point nil t)
>            (run-hooks 'eval-expression-minibuffer-setup-hook))

Thanks,

-- 
Basil





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-04  7:51               ` Basil L. Contovounesios
@ 2019-08-04  9:00                 ` Štěpán Němec
  2019-08-04 14:34                 ` Noam Postavsky
  1 sibling, 0 replies; 22+ messages in thread
From: Štěpán Němec @ 2019-08-04  9:00 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: sanelz, 36886, Noam Postavsky

On Sun, 04 Aug 2019 10:51:08 +0300
Basil L. Contovounesios wrote:

>> +  (if global-eldoc-mode
>> +      (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)
>> +    (remove-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)))
>
> This looks fine to me (the only alternative I can think of is creating a
> new major mode specifically for read--expression) [...]

...which actually sounds like it could be a real improvement in other
respects, too: many users seem to be trying to make M-: more convenient
(better completion, possibly syntax highlighting, paredit etc.); this
looks like a good way to make that easier or even unnecessary by default
(deriving from emacs-lisp-mode).

-- 
Štěpán





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-04  7:51               ` Basil L. Contovounesios
  2019-08-04  9:00                 ` Štěpán Němec
@ 2019-08-04 14:34                 ` Noam Postavsky
  2019-08-15  0:58                   ` Noam Postavsky
  1 sibling, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2019-08-04 14:34 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 36886, sanelz

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> The problem is that minibuffer-setup-hook, which sets
> eldoc-documentation-function, has not yet run at this stage, so the
> minibuffer is not yet considered suitable for enabling eldoc-mode.

Ah, tricky, we should probably put this in a comment somewhere.

>> Subject: [PATCH] Respect global-eldoc-mode in minibuffers (Bug#36886)

> Should this log entry mention bug#27202 as well?

Sure, can't hurt.

> shouldn't this call to eldoc-mode be bundled in the same hook function
> with...

>> @@ -1583,7 +1583,6 @@ read--expression
>>            ;; FIXME: call emacs-lisp-mode?
>>            (add-function :before-until (local 'eldoc-documentation-function)
>>                          #'elisp-eldoc-documentation-function)
>
> ...this advice?

Oh yeah, that would make sense.

Štěpán Němec <stepnem@gmail.com> writes:

> On Sun, 04 Aug 2019 10:51:08 +0300
> Basil L. Contovounesios wrote:
>
>> This looks fine to me (the only alternative I can think of is creating a
>> new major mode specifically for read--expression) [...]
>
> ...which actually sounds like it could be a real improvement in other
> respects, too: many users seem to be trying to make M-: more convenient
> (better completion, possibly syntax highlighting, paredit etc.); this
> looks like a good way to make that easier or even unnecessary by default
> (deriving from emacs-lisp-mode).

I tried calling emacs-lisp-mode as the FIXME suggests, but it results in
a minibuffer that can't be C-g'd out of.  I guess it destroys or misses
some minibuffer-specific setup?  So if someone can figure out how to do
that properly it does sound like a good solution.






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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-04  0:35             ` Noam Postavsky
  2019-08-04  7:51               ` Basil L. Contovounesios
@ 2019-08-04 16:27               ` Eli Zaretskii
  1 sibling, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2019-08-04 16:27 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: contovob, sanelz, 36886

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,  sanelz@gmail.com,  36886@debbugs.gnu.org
> Date: Sat, 03 Aug 2019 20:35:23 -0400
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I actually don't understand why, when the globalized mode is ON, it
> > doesn't work in the minibuffer.  What am I missing?
> 
> define-globalized-minor-mode only adds after-change-major-mode-hook,
> find-file-hook, and change-major-mode-hook.  AFAICT, the minibuffer
> stays in fundamental-mode, and doesn't visit a file so none of those are
> triggered.  Possible patch attached (some additional manual updates +
> NEWS would be needed for define-globalized-minor-mode change).

Thanks.





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-04 14:34                 ` Noam Postavsky
@ 2019-08-15  0:58                   ` Noam Postavsky
  2019-08-15  8:31                     ` Štěpán Němec
  0 siblings, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2019-08-15  0:58 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 36886, sanelz

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

Updated patch attached.  I'll push in a few days, assuming nothing else
turns up.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 8139 bytes --]

From d2557c135a83eda9e1c5347850669c195ae588b4 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Aug 2019 20:19:31 -0400
Subject: [PATCH] Respect global-eldoc-mode in minibuffers (Bug#36886)

* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Accept
a BODY parameter.
* doc/lispref/modes.texi (Defining Minor Modes): Document new
parameter.
* etc/NEWS: Announce it.

* lisp/simple.el (read--expression): Move eldoc-mode setup to...
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): ... here,
new function.
(global-eldoc-mode): Add or remove it to
eval-expression-minibuffer-setup-hook when enabling or disabling
global-eldoc-mode.  This enables eldoc in the minibuffer (solving
Bug#27202), only when global-eldoc-mode is enabled.
---
 doc/lispref/modes.texi        |  8 ++++----
 etc/NEWS                      |  3 +++
 lisp/emacs-lisp/easy-mmode.el | 38 ++++++++++++++++++++++----------------
 lisp/emacs-lisp/eldoc.el      | 19 ++++++++++++++++++-
 lisp/simple.el                |  6 ++----
 5 files changed, 49 insertions(+), 25 deletions(-)

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index d12f241424..d7e1213ea9 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1783,12 +1783,12 @@ Defining Minor Modes
         (hungry-electric-delete t)))))
 @end smallexample
 
-@defmac define-globalized-minor-mode global-mode mode turn-on keyword-args@dots{}
+@defmac define-globalized-minor-mode global-mode mode turn-on keyword-args@dots{} body@dots{}
 This defines a global toggle named @var{global-mode} whose meaning is
 to enable or disable the buffer-local minor mode @var{mode} in all
-buffers.  To turn on the minor mode in a buffer, it uses the function
-@var{turn-on}; to turn off the minor mode, it calls @var{mode} with
-@minus{}1 as argument.
+buffers.  It also executes the @var{body} forms.  To turn on the minor
+mode in a buffer, it uses the function @var{turn-on}; to turn off the
+minor mode, it calls @var{mode} with @minus{}1 as argument.
 
 Globally enabling the mode also affects buffers subsequently created
 by visiting files, and buffers that use a major mode other than
diff --git a/etc/NEWS b/etc/NEWS
index 13de6bb0f8..318bfe4259 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2378,6 +2378,9 @@ the Emacs Lisp manual.
 ** `directory-files-recursively' can now take an optional PREDICATE
 parameter to control descending into subdirectories.
 
++++
+** 'define-globalized-minor-mode' now takes BODY forms.
+
 \f
 * Changes in Emacs 27.1 on Non-Free Operating Systems
 
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index be531aab84..fcbddc8629 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -363,18 +363,21 @@ 'easy-mmode-define-global-mode
 ;;;###autoload
 (defalias 'define-global-minor-mode 'define-globalized-minor-mode)
 ;;;###autoload
-(defmacro define-globalized-minor-mode (global-mode mode turn-on &rest keys)
+(defmacro define-globalized-minor-mode (global-mode mode turn-on &rest body)
   "Make a global mode GLOBAL-MODE corresponding to buffer-local minor MODE.
 TURN-ON is a function that will be called with no args in every buffer
   and that should try to turn MODE on if applicable for that buffer.
-KEYS is a list of CL-style keyword arguments.  As the minor mode
-  defined by this function is always global, any :global keyword is
-  ignored.  Other keywords have the same meaning as in `define-minor-mode',
-  which see.  In particular, :group specifies the custom group.
-  The most useful keywords are those that are passed on to the
-  `defcustom'.  It normally makes no sense to pass the :lighter
-  or :keymap keywords to `define-globalized-minor-mode', since these
-  are usually passed to the buffer-local version of the minor mode.
+Each of KEY VALUE is a pair of CL-style keyword arguments.  As
+  the minor mode defined by this function is always global, any
+  :global keyword is ignored.  Other keywords have the same
+  meaning as in `define-minor-mode', which see.  In particular,
+  :group specifies the custom group.  The most useful keywords
+  are those that are passed on to the `defcustom'.  It normally
+  makes no sense to pass the :lighter or :keymap keywords to
+  `define-globalized-minor-mode', since these are usually passed
+  to the buffer-local version of the minor mode.
+BODY contains code to execute each time the mode is enabled or disabled.
+  It is executed after toggling the mode, and before running GLOBAL-MODE-hook.
 
 If MODE's set-up depends on the major mode in effect when it was
 enabled, then disabling and reenabling MODE should make MODE work
@@ -384,7 +387,9 @@ define-globalized-minor-mode
 
 When a major mode is initialized, MODE is actually turned on just
 after running the major mode's hook.  However, MODE is not turned
-on if the hook has explicitly disabled it."
+on if the hook has explicitly disabled it.
+
+\(fn GLOBAL-MODE MODE TURN-ON [KEY VALUE]... BODY)"
   (declare (doc-string 2))
   (let* ((global-mode-name (symbol-name global-mode))
 	 (mode-name (symbol-name mode))
@@ -404,12 +409,12 @@ define-globalized-minor-mode
 	 keyw)
 
     ;; Check keys.
-    (while (keywordp (setq keyw (car keys)))
-      (setq keys (cdr keys))
+    (while (keywordp (setq keyw (car body)))
+      (pop body)
       (pcase keyw
-	(:group (setq group (nconc group (list :group (pop keys)))))
-	(:global (setq keys (cdr keys)))
-	(_ (push keyw extra-keywords) (push (pop keys) extra-keywords))))
+        (:group (setq group (nconc group (list :group (pop body)))))
+        (:global (pop body))
+        (_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
 
     `(progn
        (progn
@@ -446,7 +451,8 @@ define-globalized-minor-mode
 	 ;; Go through existing buffers.
 	 (dolist (buf (buffer-list))
 	   (with-current-buffer buf
-	     (if ,global-mode (funcall #',turn-on) (when ,mode (,mode -1))))))
+             (if ,global-mode (funcall #',turn-on) (when ,mode (,mode -1)))))
+         ,@body)
 
        ;; Autoloading define-globalized-minor-mode autoloads everything
        ;; up-to-here.
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 16b5863209..2892faae21 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -207,7 +207,24 @@ eldoc-mode
 (define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
   :group 'eldoc
   :initialize 'custom-initialize-delay
-  :init-value t)
+  :init-value t
+  ;; For `read--expression', the usual global mode mechanism of
+  ;; `change-major-mode-hook' runs in the minibuffer before
+  ;; `eldoc-documentation-function' is set, so `turn-on-eldoc-mode'
+  ;; does nothing.  Configure and enable eldoc from
+  ;; `eval-expression-minibuffer-setup-hook' instead.
+  (if global-eldoc-mode
+      (add-hook 'eval-expression-minibuffer-setup-hook
+                #'eldoc--eval-expression-setup)
+    (remove-hook 'eval-expression-minibuffer-setup-hook
+                 #'eldoc--eval-expression-setup)))
+
+(defun eldoc--eval-expression-setup ()
+  ;; Setup `eldoc', similar to `emacs-lisp-mode'.  FIXME: Call
+  ;; `emacs-lisp-mode' itself?
+  (add-function :before-until (local 'eldoc-documentation-function)
+                #'elisp-eldoc-documentation-function)
+  (eldoc-mode +1))
 
 ;;;###autoload
 (defun turn-on-eldoc-mode ()
diff --git a/lisp/simple.el b/lisp/simple.el
index e33709e8ad..479c2d38fd 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1580,10 +1580,8 @@ read--expression
   (let ((minibuffer-completing-symbol t))
     (minibuffer-with-setup-hook
         (lambda ()
-          ;; FIXME: call emacs-lisp-mode?
-          (add-function :before-until (local 'eldoc-documentation-function)
-                        #'elisp-eldoc-documentation-function)
-          (eldoc-mode 1)
+          ;; FIXME: call emacs-lisp-mode (see also
+          ;; `eldoc--eval-expression-setup')?
           (add-hook 'completion-at-point-functions
                     #'elisp-completion-at-point nil t)
           (run-hooks 'eval-expression-minibuffer-setup-hook))
-- 
2.11.0


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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-15  0:58                   ` Noam Postavsky
@ 2019-08-15  8:31                     ` Štěpán Němec
  2019-08-21  0:24                       ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Štěpán Němec @ 2019-08-15  8:31 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Basil L. Contovounesios, sanelz, 36886

On Wed, 14 Aug 2019 20:58:12 -0400
Noam Postavsky wrote:

> Updated patch attached.  I'll push in a few days, assuming nothing else
> turns up.

[snip]

> @@ -384,7 +387,9 @@ define-globalized-minor-mode
>  

[...]

> +
> +\(fn GLOBAL-MODE MODE TURN-ON [KEY VALUE]... BODY)"

I think this should read "BODY..." to indicate zero or more body forms?

Thanks,

  Štěpán





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

* bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely
  2019-08-15  8:31                     ` Štěpán Němec
@ 2019-08-21  0:24                       ` Noam Postavsky
  0 siblings, 0 replies; 22+ messages in thread
From: Noam Postavsky @ 2019-08-21  0:24 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: Basil L. Contovounesios, sanelz, 36886

tags 36886 fixed
close 36886 27.1
quit

Štěpán Němec <stepnem@gmail.com> writes:

>> +\(fn GLOBAL-MODE MODE TURN-ON [KEY VALUE]... BODY)"
>
> I think this should read "BODY..." to indicate zero or more body forms?

Thanks for catching that.  Fixed and pushed to master.

7e2090ee80 2019-08-20T20:20:52-04:00 "Respect global-eldoc-mode in minibuffers (Bug#36886)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=7e2090ee80c9099ee953392444e1d73d10e973d4






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

end of thread, other threads:[~2019-08-21  0:24 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 10:30 bug#36886: 26.2; (global-eldoc-mode -1) should disable eldoc completely Sanel Zukan
2019-08-01 11:37 ` Basil L. Contovounesios
2019-08-01 12:29   ` Sanel Zukan
2019-08-01 13:38   ` Dmitry Gutov
2019-08-02  6:35 ` Eli Zaretskii
2019-08-02  9:35   ` Sanel Zukan
2019-08-02 11:44     ` Basil L. Contovounesios
2019-08-02 12:00       ` Eli Zaretskii
2019-08-02 13:19         ` Basil L. Contovounesios
2019-08-02 14:28           ` Eli Zaretskii
2019-08-04  0:35             ` Noam Postavsky
2019-08-04  7:51               ` Basil L. Contovounesios
2019-08-04  9:00                 ` Štěpán Němec
2019-08-04 14:34                 ` Noam Postavsky
2019-08-15  0:58                   ` Noam Postavsky
2019-08-15  8:31                     ` Štěpán Němec
2019-08-21  0:24                       ` Noam Postavsky
2019-08-04 16:27               ` Eli Zaretskii
2019-08-02 12:36       ` Sanel Zukan
2019-08-02 11:50     ` Eli Zaretskii
2019-08-02 12:51       ` Sanel Zukan
2019-08-02 14:33         ` Eli Zaretskii

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