[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pulsar e2c077034e 01/10: Simplify the macro that define
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pulsar e2c077034e 01/10: Simplify the macro that defines pulsar-pulse-line-COLOR functions |
Date: |
Sat, 12 Aug 2023 03:58:37 -0400 (EDT) |
branch: externals/pulsar
commit e2c077034e8d007e677a59057a580ec0188a8757
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Simplify the macro that defines pulsar-pulse-line-COLOR functions
---
pulsar.el | 41 +++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/pulsar.el b/pulsar.el
index b5ec836bb4..4fe5195d57 100644
--- a/pulsar.el
+++ b/pulsar.el
@@ -306,24 +306,37 @@ default)."
;;;;; Convenience functions
+(define-obsolete-function-alias
+ 'pulsar-pulse-with-face
+ 'pulsar-define-pulse-with-face
+ "1.0.0")
+
;;;###autoload
-(defmacro pulsar-pulse-with-face (name face)
- "Produce NAME function to `pulsar--pulse' with FACE."
+(defmacro pulsar-define-pulse-with-face (face)
+ "Produce function to `pulsar--pulse' with FACE.
+If FACE starts with the `pulsar-' prefix, remove it and keep only
+the remaining text. The assumption is that something like
+`pulsar-red' will be convered to `red', thus deriving a function
+named `pulsar-pulse-line-red'. Any other FACE is taken as-is."
(declare (indent function))
- `(defun ,name ()
- ,(format "Like `pulsar-pulse-line' but uses the `%s' face.
+ (let* ((face-string (symbol-name face))
+ (face-name (if (string-prefix-p "pulsar-" face-string)
+ (replace-regexp-in-string "pulsar-" "" face-string)
+ face-string)))
+ `(defun ,(intern (format "pulsar-pulse-line-%s" face-name)) ()
+ ,(format "Like `pulsar-pulse-line' but uses the `%s' face.
The idea with this is to run it in special hooks or contexts
where you need a different color than what Pulsar normally
-uses (per `pulsar-face')" face)
- (interactive)
- (pulsar--pulse nil ',face)))
-
-(pulsar-pulse-with-face pulsar-pulse-line-red pulsar-red)
-(pulsar-pulse-with-face pulsar-pulse-line-green pulsar-green)
-(pulsar-pulse-with-face pulsar-pulse-line-yellow pulsar-yellow)
-(pulsar-pulse-with-face pulsar-pulse-line-blue pulsar-blue)
-(pulsar-pulse-with-face pulsar-pulse-line-magenta pulsar-magenta)
-(pulsar-pulse-with-face pulsar-pulse-line-cyan pulsar-cyan)
+uses (per the user option `pulsar-face')" face)
+ (interactive)
+ (pulsar--pulse nil ',face))))
+
+(pulsar-define-pulse-with-face pulsar-red)
+(pulsar-define-pulse-with-face pulsar-green)
+(pulsar-define-pulse-with-face pulsar-yellow)
+(pulsar-define-pulse-with-face pulsar-blue)
+(pulsar-define-pulse-with-face pulsar-magenta)
+(pulsar-define-pulse-with-face pulsar-cyan)
;;;;; Highlight region
- [elpa] externals/pulsar updated (aa09693018 -> 1af423199d), ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 373c5f7955 03/10: Note that next version shall be 1.0.0, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 5e5796ecd5 02/10: Make pulsar--start also return point-min in the minibuffer, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 61ceda6812 08/10: Add missing backronym, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar b80af461be 09/10: Fix docstring of 'pulsar-recenter-middle' defalias, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 9e54e24aa9 04/10: Use more precise markup for 'pulsar' symbol in the manual, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 206eece04d 07/10: Add missing metadata to CHANGELOG, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar e2c077034e 01/10: Simplify the macro that defines pulsar-pulse-line-COLOR functions,
ELPA Syncer <=
- [elpa] externals/pulsar 823969a6e8 05/10: Document how to use pulsar in the minibuffer, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 1af423199d 10/10: Update to version 1.0.0, ELPA Syncer, 2023/08/12
- [elpa] externals/pulsar 08b6936e0c 06/10: Add missing metadata about user option versions, ELPA Syncer, 2023/08/12