emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/git-commit efe590bb4f 3/3: Move face utilities to magit-se


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit efe590bb4f 3/3: Move face utilities to magit-section
Date: Wed, 16 Feb 2022 13:58:04 -0500 (EST)

branch: elpa/git-commit
commit efe590bb4f1020cf8e9503e564a84f569f5ba82e
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Move face utilities to magit-section
    
    Other packages that use magit-section should also use these functions.
---
 lisp/magit-section.el | 32 ++++++++++++++++++++++++++++++++
 lisp/magit-utils.el   | 32 --------------------------------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 8842aeed3a..33c3b1052f 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1791,6 +1791,38 @@ Configuration'."
                                     val)))))
               (overlays-at pos t)))
 
+(defun magit-face-property-all (face string)
+  "Return non-nil if FACE is present in all of STRING."
+  (catch 'missing
+    (let ((pos 0))
+      (while (setq pos (next-single-property-change pos 'font-lock-face 
string))
+        (let ((val (get-text-property pos 'font-lock-face string)))
+          (unless (if (consp val)
+                      (memq face val)
+                    (eq face val))
+            (throw 'missing nil))))
+      (not pos))))
+
+(defun magit--add-face-text-property (beg end face &optional append object)
+  "Like `add-face-text-property' but for `font-lock-face'."
+  (while (< beg end)
+    (let* ((pos (next-single-property-change beg 'font-lock-face object end))
+           (val (get-text-property beg 'font-lock-face object))
+           (val (if (listp val) val (list val))))
+      (put-text-property beg pos 'font-lock-face
+                         (if append
+                             (append val (list face))
+                           (cons face val))
+                         object)
+      (setq beg pos))))
+
+(defun magit--propertize-face (string face)
+  (propertize string 'face face 'font-lock-face face))
+
+(defun magit--put-face (beg end face string)
+  (put-text-property beg end 'face face string)
+  (put-text-property beg end 'font-lock-face face string))
+
 ;;; Bitmaps
 
 (when (fboundp 'define-fringe-bitmap)
diff --git a/lisp/magit-utils.el b/lisp/magit-utils.el
index d028dd4a5e..1afb2402dd 100644
--- a/lisp/magit-utils.el
+++ b/lisp/magit-utils.el
@@ -910,38 +910,6 @@ with the text area."
         (concat (propertize " " 'display '(space :align-to 0))
                 string)))
 
-(defun magit-face-property-all (face string)
-  "Return non-nil if FACE is present in all of STRING."
-  (catch 'missing
-    (let ((pos 0))
-      (while (setq pos (next-single-property-change pos 'font-lock-face 
string))
-        (let ((val (get-text-property pos 'font-lock-face string)))
-          (unless (if (consp val)
-                      (memq face val)
-                    (eq face val))
-            (throw 'missing nil))))
-      (not pos))))
-
-(defun magit--add-face-text-property (beg end face &optional append object)
-  "Like `add-face-text-property' but for `font-lock-face'."
-  (while (< beg end)
-    (let* ((pos (next-single-property-change beg 'font-lock-face object end))
-           (val (get-text-property beg 'font-lock-face object))
-           (val (if (listp val) val (list val))))
-      (put-text-property beg pos 'font-lock-face
-                         (if append
-                             (append val (list face))
-                           (cons face val))
-                         object)
-      (setq beg pos))))
-
-(defun magit--propertize-face (string face)
-  (propertize string 'face face 'font-lock-face face))
-
-(defun magit--put-face (beg end face string)
-  (put-text-property beg end 'face face string)
-  (put-text-property beg end 'font-lock-face face string))
-
 (defun magit--format-spec (format specification)
   "Like `format-spec' but preserve text properties in SPECIFICATION."
   (with-temp-buffer



reply via email to

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