branch: externals/colorful-mode
commit 7f3f7295998b709ddc6933bb9727bf1b7000be03
Author: Elias G. Perez <eg642...@gmail.com>
Commit: Elias G. Perez <eg642...@gmail.com>

    Fix global-colorful-mode not using colorful-mode-map github#4
    
    * colorful-mode.el (colorful-mode-map): Move keymap definition.
    (turn-on-colorful-mode): New function.
    (global-colorful-mode): Use turn-on-colorful-mode instead
    colorful--turn-on.
---
 colorful-mode.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/colorful-mode.el b/colorful-mode.el
index b12b45f32e..07b69b6452 100644
--- a/colorful-mode.el
+++ b/colorful-mode.el
@@ -278,15 +278,6 @@ mode is derived from `prog-mode'."
   :type '(choice boolean (const :tag "Only in prog-modes" only-prog)))
 
 
-;;;; Keymaps
-
-(defvar-keymap colorful-mode-map
-  :doc "Keymap for `colorful-mode'."
-  "C-x c x" #'colorful-change-or-copy-color
-  "C-x c c" #'colorful-convert-and-copy-color
-  "C-x c r" #'colorful-convert-and-change-color)
-
-
 ;;;; Internal variables
 
 (defvar-local colorful-color-keywords nil
@@ -750,6 +741,14 @@ This is intended to be used with 
`colorful-extra-color-keyword-functions'."
   (font-lock-remove-keywords nil `(,@colorful-color-keywords))
   (remove-overlays nil nil 'colorful--overlay t))
 
+;;;; Keymap
+
+(defvar-keymap colorful-mode-map
+  :doc "Keymap for `colorful-mode'."
+  "C-x c x" #'colorful-change-or-copy-color
+  "C-x c c" #'colorful-convert-and-copy-color
+  "C-x c r" #'colorful-convert-and-change-color)
+
 ;;;###autoload
 (define-minor-mode colorful-mode
   "Preview any color in your buffer such as hex, color names, CSS rgb in real 
time."
@@ -765,9 +764,15 @@ This is intended to be used with 
`colorful-extra-color-keyword-functions'."
 ;; patch.
 (defvar global-colorful-modes)
 
+;;;###autoload
+(defun turn-on-colorful-mode ()
+  "Turn on `colorful-mode' mode if the current buffer."
+  (unless colorful-mode
+    (colorful-mode t)))
+
 ;;;###autoload
 (define-globalized-minor-mode global-colorful-mode
-  colorful-mode colorful--turn-on
+  colorful-mode turn-on-colorful-mode
   :predicate '(mhtml-mode html-ts-mode latex-mode prog-mode))
 
 

Reply via email to