From 48eefe094f3cfdd7135b1fb2a98f0699a4fb777e Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 7 Nov 2024 12:44:50 +0100 Subject: Do not enable 'package-autosuggest-mode' by default As the feature is intrusive and can slow down startup time it is safer to disable the feature by default. * doc/emacs/package.texi (Package Installation): Explicitly mention the minor mode in the manual. * etc/NEWS: Document it here as well. * lisp/emacs-lisp/package.el (package-autosuggest-mode): Change default value to nil and autoload it. --- doc/emacs/package.texi | 6 ++++-- etc/NEWS | 6 ++++++ lisp/emacs-lisp/package.el | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index b91a49cbf2e..7f8b199c9f3 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -410,11 +410,13 @@ and use only third parties that you think you can trust! @cindex suggestions @findex package-autosuggest +@findex package-autosuggest-mode Emacs has a built-in database of suggested packages for certain file types. If Emacs opens a file with no specific mode, you can use the @code{package-autosuggest} command to install the recommended packages -from ELPA. By default, Emacs will display a clickable hint in the -mode-line if it there is a suggested package. +from ELPA. After enabling @code{package-autosuggest-mode}, Emacs will +display a clickable hint in the mode-line if it there is a suggested +package. @anchor{Package Signing} @cindex package security diff --git a/etc/NEWS b/etc/NEWS index a808cc30b58..dcbe75b6b8b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -666,6 +666,12 @@ the directory into which the repository was cloned. Using a built-in database of package suggestions from ELPA, this command will install viable packages if no specific major mode is available. ++++ +*** New minor mode 'package-autosuggest-mode' +When enabled, this displays a hint in the mode line indicating the +availability of a suggested package. You can customise the presentation +of these hints using 'package-autosuggest-style'. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2849c05fa41..b5c48928fc5 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4567,9 +4567,10 @@ the existence of a suggestion." (const :tag "Prompt only once" once) (const :tag "Indicate with message" message))) +;;;###autoload (define-minor-mode package-autosuggest-mode "Enable the automatic suggestion and installation of packages." - :init-value t :global t + :global t (funcall (if package-autosuggest-mode #'add-hook #'remove-hook) 'after-change-major-mode-hook #'package--autosuggest-after-change-mode)) -- cgit v1.2.1