[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this c5d192cfee 56/59: Some cleanup
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this c5d192cfee 56/59: Some cleanup |
Date: |
Sun, 27 Nov 2022 16:02:54 -0500 (EST) |
branch: elpa/why-this
commit c5d192cfee0423d31e5396e8df1bbed6bb898f33
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Some cleanup
---
why-this.el | 56 +++++++++++++++++++++-----------------------------------
1 file changed, 21 insertions(+), 35 deletions(-)
diff --git a/why-this.el b/why-this.el
index 287ee99921..b4e0f153f6 100644
--- a/why-this.el
+++ b/why-this.el
@@ -320,29 +320,17 @@ When EXACT is non-nil, be as exact as possible."
TIME-FORMAT is used to format data."
(if (functionp format)
(funcall format data)
- (let ((alist
- `((?a . (plist-get data :author))
- (?A . (why-this-nick-name (plist-get data :author)))
- (?t . (why-this-format-time
- time-format (plist-get data :time)))
- (?i . (plist-get data :desc)))))
- (replace-regexp-in-string
- "%."
- (lambda (str)
- (let ((char (aref str 1)))
- (if (eq char ?%)
- "%"
- (let ((sexp (cdr (assoc char alist))))
- (if sexp
- (eval sexp `((data . ,data)
- (time-format . ,time-format)))
- str)))))
- format t t))))
+ (format-spec
+ format `((?a . ,(plist-get data :author))
+ (?A . ,(why-this-nick-name (plist-get data :author)))
+ (?t . ,(why-this-format-time
+ time-format (plist-get data :time)))
+ (?i . ,(plist-get data :desc))))))
(defun why-this--overlay-bg-type (pos)
"Return the background type for overlay at POS."
(cond
- ((and (use-region-p)
+ ((and (region-active-p)
(>= pos (region-beginning))
(< pos (region-end)))
'region)
@@ -382,12 +370,11 @@ TIME-FORMAT is used to format data."
(while why-this--overlays
(delete-overlay (pop why-this--overlays)))
(when why-this-mode
- (let* ((begin (line-number-at-pos (if (use-region-p)
- (region-beginning)
- (point))))
- (end (1+ (line-number-at-pos (if (use-region-p)
- (region-end)
- (point)))))
+ (let* ((line (line-number-at-pos (if (use-region-p)
+ (region-end)
+ (point))))
+ (begin line)
+ (end (1+ line))
(backend why-this--backend)
(data (funcall backend 'line-data begin end)))
(dolist (i (number-sequence 0 (- end begin 1)))
@@ -445,10 +432,8 @@ TIME-FORMAT is used to format data."
(end (1+ (line-number-at-pos (if (use-region-p)
(region-end)
(point))))))
- (setq
- why-this--overlays
- (delq
- nil
+ (thread-last
+ why-this--overlays
(mapcar
(lambda (ov)
(if (and (eq (overlay-buffer ov) (current-buffer))
@@ -458,10 +443,10 @@ TIME-FORMAT is used to format data."
(< line end)
(eq line (overlay-get ov 'why-this-line)))))
(progn
- (let* ((ov-start (overlay-start ov))
- line-begin
- line-end
- column)
+ (let ((ov-start (overlay-start ov))
+ line-begin
+ line-end
+ column)
(save-excursion
(goto-char ov-start)
(setq line-begin (line-beginning-position))
@@ -498,8 +483,9 @@ TIME-FORMAT is used to format data."
(overlay-put ov 'why-this-bg-type type))))
ov)
(delete-overlay ov)
- nil))
- why-this--overlays)))))
+ nil)))
+ (delq nil)
+ (setq why-this--overlays))))
;;;###autoload
(defun why-this-supported-p ()
- [nongnu] elpa/why-this 17f7963cfc 46/59: Use faces instead of variables for colors, (continued)
- [nongnu] elpa/why-this 17f7963cfc 46/59: Use faces instead of variables for colors, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this b3a7f874b8 53/59: Don't error on binary files, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this bca895def5 55/59: Add .elpaignore, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c7f771736c 44/59: Remove obsolete use of define-minor-mode, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2c8c35ca10 57/59: Bump version to 2.0.3, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 258f010001 54/59: Bump version to 2.0.2, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 0975f5b57f 48/59: Fix #2: Truncate long lines in annotation buffer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this da0fa6da7e 52/59: Bump version to 2.0.1, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this f0ef9e3730 51/59: Show overlay only on selected window, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this f18b8d8d18 43/59: Lower required Emacs version, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c5d192cfee 56/59: Some cleanup,
ELPA Syncer <=
- [nongnu] elpa/why-this 4552587fd4 49/59: Determine line width correctly, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this ca4cf46d6e 40/59: Don't error on nonexistant parent directory, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 066786ede1 17/59: Add README, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this a4e7a1a126 47/59: Bump version to 2.0, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 71baf80f9a 42/59: Don't use overlays while annonating, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this a706d26b7c 45/59: Fix wrong face in annonate buffer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this b69263c66b 41/59: Fix "Invalid face attribute :background nil", ELPA Syncer, 2022/11/27