[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this 3c252a6621 07/59: Allow showing last change manua
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this 3c252a6621 07/59: Allow showing last change manually |
Date: |
Sun, 27 Nov 2022 16:02:48 -0500 (EST) |
branch: elpa/why-this
commit 3c252a6621f32387c8d94f934a2a4f16e29948f6
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Allow showing last change manually
---
why-this.el | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/why-this.el b/why-this.el
index 077ebc2db2..cfd9ee4182 100644
--- a/why-this.el
+++ b/why-this.el
@@ -63,6 +63,15 @@ The value can also be a function to do the formatting
itself."
:package-version '(why-this "1.0")
:group 'why-this)
+(defcustom why-this-echo-format "%A, t * %i"
+ "Format string for formatting echo area message.
+
+See `why-this-message-format'."
+ :type '(choice (string :tag "Format string")
+ (function :tag "Formatter function"))
+ :package-version '(why-this "1.0")
+ :group 'why-this)
+
(defcustom why-this-nick-name-alist nil
"Alist of nick name of authors.
@@ -143,10 +152,10 @@ When EXACT is non-nil, be as exact as possible."
(funcall calc-time "second" 1))))))
(concat str "ago"))))
-(defun why-this-format-data (data)
- "Format DATA."
- (if (functionp why-this-message-format)
- (funcall why-this-message-format data)
+(defun why-this-format-data (format data)
+ "Format DATA using FORMAT."
+ (if (functionp format)
+ (funcall format data)
(let ((alist `((?a . (plist-get data :author))
(?A . (why-this-nick-name (plist-get data :author)))
(?T . (format-time-string "%d %B %Y"
@@ -163,7 +172,7 @@ When EXACT is non-nil, be as exact as possible."
(if sexp
(eval sexp `((data . ,data)))
str)))))
- why-this-message-format t t))))
+ format t t))))
(defvar why-this-mode)
@@ -187,6 +196,7 @@ When EXACT is non-nil, be as exact as possible."
(let ((ov (make-overlay pos pos)))
(overlay-put ov 'after-string
(propertize (why-this-format-data
+ why-this-message-format
(append `(:backend ,backend)
(nth i data)))
'cursor t 'face 'why-this-face))
@@ -244,6 +254,20 @@ Actually the supported backend is returned."
(throw 'yes backend))))
nil))
+;;;###autoload
+(defun why-this ()
+ "Show why the current line contains this."
+ (interactive)
+ (let ((backend (why-this-supported-p)))
+ (if backend
+ (message "%s" (why-this-format-data
+ why-this-echo-format
+ (append
+ `(:backend ,backend)
+ (car (funcall backend 'line-data
+ (line-number-at-pos)
+ (1+ (line-number-at-pos))))))))))
+
;;;###autoload
(define-minor-mode why-this-mode
"Toggle showing why the current line was changed."
- [nongnu] branch elpa/why-this created (now c914584833), ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this e89aabc765 02/59: (provide 'why-this), ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 961f84afc6 08/59: Fixed typo in the value of why-this-echo-format, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2f714a9820 05/59: Add Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 82397f6a45 03/59: Add support for nick names, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3c252a6621 07/59: Allow showing last change manually,
ELPA Syncer <=
- [nongnu] elpa/why-this f62dccdd90 10/59: Add annonation support, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 340194b6d2 24/59: Calculate background for message, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 167397e7ad 25/59: Fix copyright year, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9c0daa799c 28/59: Rename a variable, change backend API and update docs, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 53b2b803f0 22/59: Update commentary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this d47f547250 39/59: Allow customization of executable paths, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 7f1ae28159 36/59: Fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9f656b59dd 33/59: Change package summary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3497115c2b 35/59: Don't store unnecessary data, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 7a2e4af450 19/59: Rewrite Git backend, ELPA Syncer, 2022/11/27