emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6a75b6f: Don't pre-load facemenu


From: Lars Ingebrigtsen
Subject: master 6a75b6f: Don't pre-load facemenu
Date: Thu, 18 Mar 2021 00:55:25 -0400 (EDT)

branch: master
commit 6a75b6fcb10725fb1e352dec506b84e795baa7c8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 etc/NEWS                     |  6 ++++++
 lisp/facemenu.el             | 17 +++++++++--------
 lisp/faces.el                | 11 +++++------
 lisp/loadup.el               |  1 -
 lisp/progmodes/cperl-mode.el |  1 +
 lisp/textmodes/sgml-mode.el  |  1 +
 lisp/wid-edit.el             |  8 +++++++-
 7 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ba82174..20407db 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 6290b02..2d06658 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -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.
diff --git a/lisp/faces.el b/lisp/faces.el
index 573428f..7c6d749 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -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
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 863afe4..4a0b8f5 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -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")
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 734797b..cc7614d 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -92,6 +92,7 @@
        (concat msg ": ")))))
 
 (eval-when-compile (require 'cl-lib))
+(require 'facemenu)
 
 (defvar msb-menu-cond)
 (defvar gud-perldb-history)
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 876347b..7de5317 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -34,6 +34,7 @@
 
 (require 'dom)
 (require 'seq)
+(require 'facemenu)
 (eval-when-compile (require 'subr-x))
 (eval-when-compile
   (require 'skeleton)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 35e7b9c..e71290c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]