[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this aa15ec4fcd 29/59: Add support for minimum column
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this aa15ec4fcd 29/59: Add support for minimum column of message |
Date: |
Sun, 27 Nov 2022 16:02:51 -0500 (EST) |
branch: elpa/why-this
commit aa15ec4fcd6e8d67423c7b51a6b54199c329eb4a
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Add support for minimum column of message
---
why-this.el | 92 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 69 insertions(+), 23 deletions(-)
diff --git a/why-this.el b/why-this.el
index 3c8da57a8f..c6111f4360 100644
--- a/why-this.el
+++ b/why-this.el
@@ -87,6 +87,14 @@ is the backend which generated the plist."
:package-version '(why-this "1.0")
:group 'why-this)
+(defcustom why-this-minimum-column 55
+ "Minimum column for displaying message.
+
+Messages are never shown before this column. Set to 0 to disable."
+ :type 'integer
+ :package-version '(why-this "1.0")
+ :group 'why-this)
+
(defcustom why-this-echo-format "%A, %t * %i"
"Format string for formatting echo area message.
@@ -305,24 +313,39 @@ When EXACT is non-nil, be as exact as possible."
(backend why-this--backend)
(data (funcall backend 'line-data begin end)))
(dolist (i (number-sequence 0 (- end begin 1)))
- (let ((pos (save-excursion
- (goto-char (point-min))
- (line-end-position (+ begin i)))))
- (let ((ov (make-overlay pos pos))
- (type (why-this--overlay-bg-type pos)))
+ (let (line-begin
+ line-end)
+ (save-excursion
+ (goto-char (point-min))
+ (setq line-begin (line-beginning-position (+ begin i)))
+ (setq line-end (line-end-position (+ begin i))))
+ (let ((ov (make-overlay line-end line-end))
+ (type (why-this--overlay-bg-type line-end))
+ (column (- line-end line-begin)))
+ (overlay-put ov 'why-this-message (why-this-format-data
+ why-this-message-format
+ (append `(:backend ,backend)
+ (nth i data))))
+ (overlay-put ov 'why-this-props
+ (list 'cursor t
+ 'face (why-this--get-face type)
+ 'help-echo
+ (when why-this-enable-tooltip
+ (why-this-format-data
+ why-this-echo-format
+ (append `(:backend ,backend)
+ (nth i data))))))
(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--get-face type)
- 'help-echo
- (when why-this-enable-tooltip
- (why-this-format-data
- why-this-echo-format
- (append `(:backend ,backend)
- (nth i data))))))
+ (apply
+ #'propertize
+ (concat
+ (make-string (max (- why-this-minimum-column
+ column)
+ 0)
+ ? )
+ (overlay-get ov 'why-this-message))
+ (overlay-get ov 'why-this-props)))
+ (overlay-put ov 'why-this-column column)
(overlay-put ov 'why-this-line (+ begin i))
(overlay-put ov 'why-this-bg-type type)
(push (cons ov (current-buffer)) why-this--overlays)))))))
@@ -333,7 +356,7 @@ When EXACT is non-nil, be as exact as possible."
(why-this--render)))
(defun why-this--update-overlays ()
- "Update overlays."
+ "Update all overlays."
(let ((begin (line-number-at-pos (if (use-region-p)
(region-beginning)
(point))))
@@ -354,16 +377,39 @@ When EXACT is non-nil, be as exact as possible."
(eq line (overlay-get (car ov) 'why-this-line)))))
(progn
(let* ((ov-start (overlay-start (car ov)))
- (pos (save-excursion
- (goto-char ov-start)
- (line-end-position))))
- (unless (eq ov-start pos)
- (move-overlay (car ov) pos pos)))
+ line-begin
+ line-end
+ column)
+ (save-excursion
+ (goto-char ov-start)
+ (setq line-begin (line-beginning-position))
+ (setq line-end (line-end-position))
+ (setq column (- line-end line-begin)))
+ (unless (eq ov-start line-end)
+ (move-overlay (car ov) line-end line-end))
+ (unless (eq (overlay-get (car ov) 'why-this-column)
+ column)
+ (overlay-put (car ov) 'after-string
+ (apply
+ #'propertize
+ (concat
+ (make-string
+ (max (- why-this-minimum-column column)
+ 0)
+ ? )
+ (overlay-get (car ov) 'why-this-message))
+ (overlay-get (car ov) 'why-this-props)))
+ (overlay-put (car ov) 'why-this-column column)))
(when why-this-calculate-background
(let ((type (why-this--overlay-bg-type
(overlay-start (car ov)))))
(unless (eq (overlay-get (car ov) 'why-this-bg-type)
type)
+ (overlay-put (car ov) 'why-this-props
+ (plist-put (overlay-get (car ov)
+ 'why-this-props)
+ 'face (why-this--get-face
+ type)))
(overlay-put (car ov) 'after-string
(propertize
(overlay-get (car ov) 'after-string)
- [nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing, (continued)
- [nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2093cadb03 06/59: Add relative time support and fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c2a21ca13d 01/59: Core implementation without any backends, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this b26fca274d 21/59: Add COPYING, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 88ee5f9746 27/59: Add Mercurial backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 624e98bc78 23/59: Fix relative time calculation, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 45dc65ccb1 26/59: Fix timezone problem in Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 236f8fd225 09/59: Fix problem when enabled on multiple buffers, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this dc5fc19b75 30/59: Allow changing time format, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this b8e612d4cb 20/59: Show tooltip on hover, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this aa15ec4fcd 29/59: Add support for minimum column of message,
ELPA Syncer <=
- [nongnu] elpa/why-this 3e3f852835 38/59: Fix README, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 357cfa7e1e 34/59: Ensure that temporary file created by Git backend is deleted, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this f3d1e47b80 37/59: Fix indentation, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 1c8a4fbfd5 31/59: Update screenshots, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 37f3842f5e 32/59: Improve why-this-relative-time, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this bc063e0b9a 16/59: Change heat map colors for matching with light theme, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 6631186733 18/59: Remove screenshot captions, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this d8db9e63e0 14/59: Fix overlay moving code and a typo in global-why-this-mode, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9f8c0d4e09 11/59: Fix annonating last part when heat map disabled, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c914584833 59/59: Use cond instead of nested if in why-this--get-face, ELPA Syncer, 2022/11/27