all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
@ 2024-03-26 11:10 Philip Kaludercic
  2024-03-26 19:10 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-03-26 11:10 UTC (permalink / raw)
  To: 70010; +Cc: Eshel Yaron


I tried to enable `completion-preview-mode' by adding

  (setopt completion-preview-mode t)

in my init, but it had not effect.  When I check the implementation, I
noticed that it modifies `post-command-hook' locally.  I think it would
make sense to rename the current `completion-preview-mode' to
`completion-preview-local-mode', and then use
`define-globalized-minor-mode' to define `completion-preview-mode'.


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-03-14 built on peregrine
Repository revision: f68765a2ca12362f9e3971c4c743fb3dc9c3ea13
Repository branch: master
System Description: Fedora Linux 39 (Workstation Edition)

Configured using:
 'configure --with-pgtk --with-native-compilation=aot
 --with-imagemagick'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  completion-preview-mode: t
  rcirc-track-minor-mode: t
  flyspell-mode: t
  flymake-mode: t
  outline-minor-mode: t
  yas-minor-mode: t
  repeat-mode: t
  display-battery-mode: t
  rcirc-sqlite-log-mode: t
  display-time-mode: t
  diff-hl-flydiff-mode: t
  diff-hl-mode: t
  winner-mode: t
  windmove-mode: t
  electric-pair-mode: t
  recentf-mode: t
  save-place-mode: t
  savehist-mode: t
  pixel-scroll-precision-mode: t
  pixel-scroll-mode: t
  xterm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/.config/emacs/site-lisp/.auto-site hides /home/phi/.config/emacs/site-lisp/dot-mode/.auto-site
~/.config/emacs/site-lisp/.auto-site hides /home/phi/.config/emacs/site-lisp/company-coq/.auto-site
~/.config/emacs/site-lisp/.auto-site hides /home/phi/.config/emacs/site-lisp/clang-capf/.auto-site
~/.config/emacs/site-lisp/.auto-site hides /home/phi/.config/emacs/site-lisp/0x0/.auto-site
/home/phi/.config/emacs/site-lisp/package-lint/package-lint hides /home/phi/.config/emacs/elpa/package-lint-0.21/package-lint
/home/phi/.config/emacs/site-lisp/package-lint/package-lint-flymake hides /home/phi/.config/emacs/elpa/package-lint-0.21/package-lint-flymake
/home/phi/.config/emacs/site-lisp/shell-command+/shell-command+ hides /home/phi/.config/emacs/elpa/shell-command+/shell-command+
/home/phi/.config/emacs/site-lisp/shell-command+/shell-command+-tests hides /home/phi/.config/emacs/elpa/shell-command+/shell-command+-tests
~/.config/emacs/site-lisp/.auto-site hides /home/phi/.config/emacs/elpa/site-lisp/.auto-site
/home/phi/.config/emacs/elpa/ef-themes-1.6.0/theme-loaddefs hides /home/phi/.config/emacs/elpa/standard-themes-2.0.1/theme-loaddefs
/home/phi/.config/emacs/elpa/ef-themes-1.6.0/theme-loaddefs hides /home/phi/.config/emacs/elpa/sweeprolog-0.27.4/theme-loaddefs
/home/phi/.config/emacs/site-lisp/vc-backup/vc-backup hides /home/phi/.config/emacs/elpa/vc-backup-1.1.0/vc-backup
/home/phi/.config/emacs/elpa/transient-0.5.3/transient hides /home/phi/Source/emacs/lisp/transient
/home/phi/.config/emacs/elpa/ef-themes-1.6.0/theme-loaddefs hides /home/phi/Source/emacs/lisp/theme-loaddefs

Features:
(shadow emacsbug whitespace smerge-mode avy dictionary
dictionary-connection url-http url-gw url-cache url-auth eww url-queue
mm-url magit-utils crm dash nnselect gnus-search eieio-opt speedbar
ezimage dframe eglot external-completion jsonrpc compat ert imenu
sml-mode smie thai-util thai-word mule-util cl-print debug backtrace
pulse color help-fns bug-reference vc-git find-func typo mailalias
smtpmail quail writegood-mode ecomplete flow-fill slime apropos etags
fileloop generator xref arc-mode archive-mode hyperspec flymake-cc
macrostep-c cmacexp macrostep cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs dired-aux autorevert
filenotify gnus-dired mm-archive sort smiley gnus-cite mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
gnus-async gnus-bcklg qp gnus-ml char-fold misearch multi-isearch
do-at-point hi-lock face-remap disp-table rcirc vc-backup copyright
nndraft nnmh utf-7 nnfolder epa-file network-stream nsm gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig nntp gnus-cache gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec
gnus-int gnus-range message yank-media puny dired-x dired dired-loaddefs
rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win
flyspell ispell checkdoc flymake yasnippet-snippets yasnippet noutline
outline init repeat battery dbus xml shell-command+ thingatpt
rcirc-sqlite derived time sendmail rfc2047 rfc2045 ietf-drums gnus
nnheader gnus-util mail-utils range mm-util mail-prsvr diff-hl-flydiff
diff diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode
hippie-exp winner windmove project finder-inf elec-pair tramp-cache
time-stamp recentf tree-widget saveplace tramp-sh tramp trampver
tramp-integration files-x tramp-message tramp-compat xdg shell pcomplete
parse-time iso8601 time-date format-spec tramp-loaddefs savehist
pixel-scroll cua-base xt-mouse cus-edit pp cus-load wid-edit .auto-site
compile text-property-search comint ansi-osc ansi-color ring easy-mmode
loaddefs-gen lisp-mnt radix-tree site-lisp setup ada-mode-autoloads
agda2-mode-autoloads auctex-autoloads tex-site autocrypt-autoloads
avy-autoloads bash-completion-autoloads buffer-env-autoloads
debbugs-autoloads diff-hl-autoloads do-at-point-autoloads
ef-themes-autoloads ellama-autoloads erlang-autoloads
flymake-proselint-autoloads focus-autoloads forth-mode-autoloads
geiser-gauche-autoloads geiser-autoloads gnat-compiler-autoloads
gnu-apl-mode-autoloads go-mode-autoloads haskell-mode-autoloads
htmlize-autoloads llm-autoloads lua-mode-autoloads magit-autoloads
git-commit-autoloads magit-section-autoloads dash-autoloads
markdown-mode-autoloads package-lint-autoloads proof-general-autoloads
proof-site proof-autoloads rcirc-sqlite-autoloads rust-mode-autoloads
setup-autoloads shell-command+-autoloads site-lisp-autoloads
slime-autoloads macrostep-autoloads sml-mode-autoloads spinner-autoloads
standard-themes-autoloads sweeprolog-autoloads transient-autoloads
tuareg-autoloads caml-autoloads typo-autoloads uniquify-files-autoloads
vc-backup-autoloads vc-fossil-autoloads wisi-autoloads info
with-editor-autoloads writegood-mode-autoloads
yasnippet-snippets-autoloads yasnippet-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source eieio eieio-core password-cache json map byte-opt comp
cl-seq comp-cstr warnings comp-run comp-common rx cl-macs pcase subr-x
gv bytecomp byte-compile url-vars cl-extra help-mode icons cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 1037371 161354) (symbols 48 35127 55)
 (strings 32 193482 17814) (string-bytes 1 5647670) (vectors 16 97175)
 (vector-slots 8 2053839 201081) (floats 8 802 7911)
 (intervals 56 37770 4439) (buffers 984 63))

-- 
	Philip Kaludercic on peregrine





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-26 11:10 bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global Philip Kaludercic
@ 2024-03-26 19:10 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-26 19:49   ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-26 19:10 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 70010

Hello Philip,

Philip Kaludercic <philipk@posteo.net> writes:

> I tried to enable `completion-preview-mode' by adding
>
>   (setopt completion-preview-mode t)
>
> in my init, but it had not effect.

Indeed, it is a minor mode, so one normally enables it by calling the
function completion-preview-mode, perhaps interactively via M-x.

> When I check the implementation, I noticed that it modifies
> `post-command-hook' locally.  I think it would make sense to rename
> the current `completion-preview-mode' to
> `completion-preview-local-mode', and then use
> `define-globalized-minor-mode' to define `completion-preview-mode'.

We can add a global variant, although IMO the natural scope for
completion-preview-mode is per major mode: for some kinds of content you
want to have completion preview, and for others you may want it off.
Note that a necessary condition for completion-preview-mode to be useful
in a certain context is that completion-at-point is useful in that
context, since otherwise there's nothing to preview.

Therefore, I recommend enabling completion-preview-mode by adding it to
major mode hooks, such as prog-mode-hook or comint-mode-hook.
Admittedly, if you do want to enable it for all buffers, the major mode
hook approach would require adding it to four or five hooks, which is a
bit less elegant than enabling a global minor mode once.

So I suggest we keep completion-preview-mode local and add a global
variant, say, completion-preview-global-mode, for enabling it globally.
WDYT?


Best,

Eshel





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-26 19:10 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-26 19:49   ` Philip Kaludercic
  2024-03-26 21:49     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2024-03-26 19:49 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 70010

Eshel Yaron <me@eshelyaron.com> writes:

> Hello Philip,
>
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> I tried to enable `completion-preview-mode' by adding
>>
>>   (setopt completion-preview-mode t)
>>
>> in my init, but it had not effect.
>
> Indeed, it is a minor mode, so one normally enables it by calling the
> function completion-preview-mode, perhaps interactively via M-x.

I enable all minor modes as user options, so I'd disagree that using a
function or invoking the command are the only ways to expect a minor
mode to be enabled.

>> When I check the implementation, I noticed that it modifies
>> `post-command-hook' locally.  I think it would make sense to rename
>> the current `completion-preview-mode' to
>> `completion-preview-local-mode', and then use
>> `define-globalized-minor-mode' to define `completion-preview-mode'.
>
> We can add a global variant, although IMO the natural scope for
> completion-preview-mode is per major mode: for some kinds of content you
> want to have completion preview, and for others you may want it off.
> Note that a necessary condition for completion-preview-mode to be useful
> in a certain context is that completion-at-point is useful in that
> context, since otherwise there's nothing to preview.
>
> Therefore, I recommend enabling completion-preview-mode by adding it to
> major mode hooks, such as prog-mode-hook or comint-mode-hook.
> Admittedly, if you do want to enable it for all buffers, the major mode
> hook approach would require adding it to four or five hooks, which is a
> bit less elegant than enabling a global minor mode once.
>
> So I suggest we keep completion-preview-mode local and add a global
> variant, say, completion-preview-global-mode, for enabling it globally.
> WDYT?

That seems fine as well.

-- 
	Philip Kaludercic on peregrine





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-26 19:49   ` Philip Kaludercic
@ 2024-03-26 21:49     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-27  7:07       ` Juri Linkov
  2024-03-27 12:09       ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-26 21:49 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 70010

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

Philip Kaludercic <philipk@posteo.net> writes:

> Eshel Yaron <me@eshelyaron.com> writes:
>
>> Hello Philip,
>>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> I tried to enable `completion-preview-mode' by adding
>>>
>>>   (setopt completion-preview-mode t)
>>>
>>> in my init, but it had not effect.
>>
>> Indeed, it is a minor mode, so one normally enables it by calling the
>> function completion-preview-mode, perhaps interactively via M-x.
>
> I enable all minor modes as user options, so I'd disagree that using a
> function or invoking the command are the only ways to expect a minor
> mode to be enabled.

Fair enough :)

>>> When I check the implementation, I noticed that it modifies
>>> `post-command-hook' locally.  I think it would make sense to rename
>>> the current `completion-preview-mode' to
>>> `completion-preview-local-mode', and then use
>>> `define-globalized-minor-mode' to define `completion-preview-mode'.
>>
>> We can add a global variant, although IMO the natural scope for
>> completion-preview-mode is per major mode: for some kinds of content you
>> want to have completion preview, and for others you may want it off.
>> Note that a necessary condition for completion-preview-mode to be useful
>> in a certain context is that completion-at-point is useful in that
>> context, since otherwise there's nothing to preview.
>>
>> Therefore, I recommend enabling completion-preview-mode by adding it to
>> major mode hooks, such as prog-mode-hook or comint-mode-hook.
>> Admittedly, if you do want to enable it for all buffers, the major mode
>> hook approach would require adding it to four or five hooks, which is a
>> bit less elegant than enabling a global minor mode once.
>>
>> So I suggest we keep completion-preview-mode local and add a global
>> variant, say, completion-preview-global-mode, for enabling it globally.
>> WDYT?
>
> That seems fine as well.

All right, here's a patch that adds such a global variant.  I find the
:predicate argument of define-globalized-minor-mode pretty neat, it adds
a user option that lets users choose in which major modes the minor mode
should take effect, and we can provide a sane default:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-global-minor-mode-completion-preview-global-mode.patch --]
[-- Type: text/x-patch, Size: 1037 bytes --]

From caca8078f95b8e2d6c67ada1da6fdb024262c5bc Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Tue, 26 Mar 2024 22:34:51 +0100
Subject: [PATCH] Add global minor mode 'completion-preview-global-mode'

This is a global variant of 'completion-preview-mode'.

* lisp/completion-preview.el (completion-preview-global-mode): New
global minor mode.  (Bug#70010)
---
 lisp/completion-preview.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index 75386f96429..f8a3c5ac4a2 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -414,5 +414,9 @@ completion-preview-mode
     (remove-hook 'post-command-hook #'completion-preview--post-command t)
     (completion-preview-active-mode -1)))
 
+(define-globalized-minor-mode completion-preview-global-mode
+  completion-preview-mode completion-preview-mode
+  :predicate '((not minibuffer-mode special-mode) t))
+
 (provide 'completion-preview)
 ;;; completion-preview.el ends here
-- 
2.44.0


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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-26 21:49     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-27  7:07       ` Juri Linkov
  2024-03-27  9:24         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-27 12:09       ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2024-03-27  7:07 UTC (permalink / raw)
  To: 70010; +Cc: philipk, me

> +(define-globalized-minor-mode completion-preview-global-mode
> +  completion-preview-mode completion-preview-mode
> +  :predicate '((not minibuffer-mode special-mode) t))

The naming convention for globalized minor modes suggests
'global-completion-preview-mode'.





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-27  7:07       ` Juri Linkov
@ 2024-03-27  9:24         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 9+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-27  9:24 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 70010, philipk

Juri Linkov <juri@linkov.net> writes:

>> +(define-globalized-minor-mode completion-preview-global-mode
>> +  completion-preview-mode completion-preview-mode
>> +  :predicate '((not minibuffer-mode special-mode) t))
>
> The naming convention for globalized minor modes suggests
> 'global-completion-preview-mode'.

Indeed.  I'm not a big fan of this convention as it violates the
symbol-prefix-as-a-namespace convention, but it does seem prevalent.

So if that's all right with everyone, I'll change the name to
global-completion-preview-mode and push in a day or two.


Best,

Eshel





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-26 21:49     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-27  7:07       ` Juri Linkov
@ 2024-03-27 12:09       ` Eli Zaretskii
  2024-03-27 16:05         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-03-27 12:09 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: philipk, 70010

> Cc: 70010@debbugs.gnu.org
> Date: Tue, 26 Mar 2024 22:49:04 +0100
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> All right, here's a patch that adds such a global variant.

Thanks, but please add a NEWS entry announcing this, and also mention
this variant in the user manual, where completion-preview-mode is
documented.





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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-27 12:09       ` Eli Zaretskii
@ 2024-03-27 16:05         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-31  7:38           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-27 16:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: philipk, 70010

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

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, but please add a NEWS entry announcing this, and also mention
> this variant in the user manual, where completion-preview-mode is
> documented.

All right, I'm attaching an updated patch below.  Since
'completion-preview-mode' is new in Emacs 30, I extended the existing
NEWS entry with a mention of the global variant, instead of adding
another entry.  I've also renamed the global variant per Juri's comment:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-Add-global-minor-mode-global-completion-preview-m.patch --]
[-- Type: text/x-patch, Size: 2840 bytes --]

From 828544ab372d5e7731772b9854732c9373497903 Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Tue, 26 Mar 2024 22:34:51 +0100
Subject: [PATCH v2] Add global minor mode 'global-completion-preview-mode'

This is a global variant of 'completion-preview-mode'.

* lisp/completion-preview.el (global-completion-preview-mode): New
global minor mode.

* doc/emacs/programs.texi (Symbol Completion): Document it.

* etc/NEWS: Announce it.  (Bug#70010)
---
 doc/emacs/programs.texi    | 11 +++++++----
 etc/NEWS                   |  2 ++
 lisp/completion-preview.el |  4 ++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 1627e7e6cb7..de28a9f1dd4 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1706,11 +1706,14 @@ Symbol Completion
 @cindex suggestion preview
 @cindex Completion Preview mode
 @findex completion-preview-mode
+@findex global-completion-preview-mode
   Completion Preview mode is a minor mode that shows completion
-suggestions as you type.  When you enable this mode (with @kbd{M-x
-completion-preview-mode}), Emacs automatically displays the
-suggested completion for text around point as an in-line preview
-right after point; type @key{TAB} to accept the suggestion.
+suggestions as you type.  You can enable it for the current buffer with
+@kbd{M-x completion-preview-mode}, or globally with @w{@kbd{M-x
+global-completion-preview-mode}}.  When Completion Preview mode is on,
+Emacs automatically displays the suggested completion for text around
+point as an in-line preview right after point; type @key{TAB} to accept
+the suggestion.
 
 @node MixedCase Words
 @section MixedCase Words
diff --git a/etc/NEWS b/etc/NEWS
index 60fe75fc340..906bf5a9c3c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1644,6 +1644,8 @@ sexp navigation more intuitive.
 This minor mode shows you symbol completion suggestions as you type,
 using an inline preview.  New user options in the 'completion-preview'
 customization group control exactly when Emacs displays this preview.
+'completion-preview-mode' is buffer-local, to enable it globally use
+'global-completion-preview-mode'.
 
 +++
 *** New user option 'extended-command-dim-hyphens'.
diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index 75386f96429..c9f3a81b879 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -414,5 +414,9 @@ completion-preview-mode
     (remove-hook 'post-command-hook #'completion-preview--post-command t)
     (completion-preview-active-mode -1)))
 
+(define-globalized-minor-mode global-completion-preview-mode
+  completion-preview-mode completion-preview-mode
+  :predicate '((not minibuffer-mode special-mode) t))
+
 (provide 'completion-preview)
 ;;; completion-preview.el ends here
-- 
2.44.0


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

* bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
  2024-03-27 16:05         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-31  7:38           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 9+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-31  7:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: philipk, 70010, juri

close 70010 30.1
quit

Eshel Yaron <me@eshelyaron.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Thanks, but please add a NEWS entry announcing this, and also mention
>> this variant in the user manual, where completion-preview-mode is
>> documented.
>
> All right, I'm attaching an updated patch below.  Since
> 'completion-preview-mode' is new in Emacs 30, I extended the existing
> NEWS entry with a mention of the global variant, instead of adding
> another entry.  I've also renamed the global variant per Juri's comment:

Now pushed to master (de8cae30bcf), and closing the bug.


Best,

Eshel





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

end of thread, other threads:[~2024-03-31  7:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 11:10 bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global Philip Kaludercic
2024-03-26 19:10 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-26 19:49   ` Philip Kaludercic
2024-03-26 21:49     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-27  7:07       ` Juri Linkov
2024-03-27  9:24         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-27 12:09       ` Eli Zaretskii
2024-03-27 16:05         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-31  7:38           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

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.