unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: philipk@posteo.net, 70010@debbugs.gnu.org
Subject: bug#70010: 30.0.50; completion-preview-mode behaves mode-local, but is global
Date: Wed, 27 Mar 2024 17:05:29 +0100	[thread overview]
Message-ID: <m1le63ek3a.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <86msqjj2q2.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 27 Mar 2024 14:09:25 +0200")

[-- 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


  reply	other threads:[~2024-03-27 16:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-03-31  7:38           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m1le63ek3a.fsf@dazzs-mbp.kpn \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70010@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=me@eshelyaron.com \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this 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).