Don't pre-load facemenu

* lisp/facemenu.el (facemenu-add-face-function): Move to avoid a
compilation warning.
(facemenu-color-alist): Made obsolete.

* lisp/faces.el (read-color): Don't use it.

* lisp/loadup.el ("emacs-lisp/syntax"): Don't load facemenu.

* lisp/wid-edit.el (color): Don't use facemenu-color-alist.
(widget-color--choose-action): Require facemenu.
(widget-color-action): Ditto.

* lisp/progmodes/cperl-mode.el (facemenu): Require.

* lisp/textmodes/sgml-mode.el (facemenu): Require.
This commit is contained in:
Lars Ingebrigtsen 2021-03-18 05:55:16 +01:00
parent 1e9c9ebee3
commit 6a75b6fcb1
7 changed files with 29 additions and 16 deletions

View file

@ -2278,6 +2278,12 @@ directory instead of the default directory.
* Incompatible Lisp Changes in Emacs 28.1
** 'facemenu-color-alist' is now obsolete, and is not used.
** 'facemenu.el' is no longer preloaded.
To use functions/variables from the package, you now have to say
'(require 'facemenu)' or similar.
** 'pcomplete-ignore-case' is now an obsolete alias of 'completion-ignore-case'.
** 'completions-annotations' face is not used when the caller puts own face.

View file

@ -169,6 +169,14 @@ it will remove any faces not explicitly in the list."
(defalias 'facemenu-background-menu facemenu-background-menu)
(put 'facemenu-background-menu 'menu-enable '(facemenu-enable-faces-p))
(defcustom facemenu-add-face-function nil
"Function called at beginning of text to change or nil.
This function is passed the FACE to set and END of text to change, and must
return a string which is inserted. It may set `facemenu-end-add-face'."
:type '(choice (const :tag "None" nil)
function)
:group 'facemenu)
;;; Condition for enabling menu items that set faces.
(defun facemenu-enable-faces-p ()
;; Enable the facemenu if facemenu-add-face-function is defined
@ -260,14 +268,6 @@ requested in `facemenu-keybindings'.")
(defalias 'facemenu-keymap facemenu-keymap)
(defcustom facemenu-add-face-function nil
"Function called at beginning of text to change or nil.
This function is passed the FACE to set and END of text to change, and must
return a string which is inserted. It may set `facemenu-end-add-face'."
:type '(choice (const :tag "None" nil)
function)
:group 'facemenu)
(defcustom facemenu-end-add-face nil
"String to insert or function called at end of text to change or nil.
This function is passed the FACE to set, and must return a string which is
@ -291,6 +291,7 @@ May also be t meaning to use `facemenu-add-face-function'."
(defvar facemenu-color-alist nil
"Alist of colors, used for completion.
If this is nil, then the value of (defined-colors) is used.")
(make-obsolete-variable 'facemenu-color-alist nil "28.1")
(defun facemenu-update ()
"Add or update the \"Face\" menu in the menu bar.

View file

@ -1917,12 +1917,11 @@ Interactively, or with optional arg MSG non-nil, print the
resulting color name in the echo area."
(interactive "i\np\ni\np") ; Always convert to RGB interactively.
(let* ((completion-ignore-case t)
(colors (or facemenu-color-alist
(append '("foreground at point" "background at point")
(if allow-empty-name '(""))
(if (display-color-p)
(defined-colors-with-face-attributes)
(defined-colors)))))
(colors (append '("foreground at point" "background at point")
(if allow-empty-name '(""))
(if (display-color-p)
(defined-colors-with-face-attributes)
(defined-colors))))
(color (completing-read
(or prompt "Color (name or #RGB triplet): ")
;; Completing function for reading colors, accepting

View file

@ -253,7 +253,6 @@
(load "startup")
(load "term/tty-colors")
(load "font-core")
(load "facemenu")
(load "emacs-lisp/syntax")
(load "font-lock")
(load "jit-lock")

View file

@ -92,6 +92,7 @@
(concat msg ": ")))))
(eval-when-compile (require 'cl-lib))
(require 'facemenu)
(defvar msb-menu-cond)
(defvar gud-perldb-history)

View file

@ -34,6 +34,7 @@
(require 'dom)
(require 'seq)
(require 'facemenu)
(eval-when-compile (require 'subr-x))
(eval-when-compile
(require 'skeleton)

View file

@ -4034,7 +4034,7 @@ is inline."
(mapcar #'length (defined-colors))))
:tag "Color"
:value "black"
:completions (or facemenu-color-alist (defined-colors))
:completions (defined-colors)
:sample-face-get 'widget-color-sample-face-get
:notify 'widget-color-notify
:match #'widget-color-match
@ -4049,7 +4049,10 @@ is inline."
:tag " Choose " :action 'widget-color--choose-action)
(widget-insert " "))
(declare-function list-colors-display "facemenu")
(defun widget-color--choose-action (widget &optional _event)
(require 'facemenu)
(list-colors-display
nil nil
(let ((cbuf (current-buffer))
@ -4072,8 +4075,11 @@ is inline."
(list (cons 'foreground-color value))
'default)))
(declare-function facemenu-read-color "facemenu")
(defun widget-color-action (widget &optional event)
"Prompt for a color."
(require 'facemenu)
(let* ((tag (widget-apply widget :menu-tag-get))
(prompt (concat tag ": "))
(answer (facemenu-read-color prompt)))