[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing |
Date: |
Sun, 27 Nov 2022 16:02:46 -0500 (EST) |
branch: elpa/why-this
commit 73398fb7cb0028f80fe869796c6474328e1c1ad4
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Don't interfere with writing
---
why-this.el | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/why-this.el b/why-this.el
index 86287579e8..bd323ed35b 100644
--- a/why-this.el
+++ b/why-this.el
@@ -2,6 +2,12 @@
;; Copyright (C) 2021 Akib Azmain Turja.
+;; Author: Akib Azmain Turja <akib@disroot.org>
+;; Version: 1.0
+;; Package-Requires: ((emacs "27.2"))
+;; Keywords: tools, convenience, vc
+;; URL: https://codeberg.org/akib/emacs-why-this
+
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
@@ -26,6 +32,7 @@
(defgroup why-this nil
"Show why the current line was changed."
:group 'tools
+ :link '(url-link "https://codeberg.org/akib/emacs-why-this")
:prefix "why-this-")
(defcustom why-this-backends nil
@@ -134,6 +141,7 @@ NICK."
(append `(:backend ,backend)
(nth i data)))
'cursor t 'face 'why-this-face))
+ (overlay-put ov 'why-this-line (+ begin i))
(push (cons ov (current-buffer)) why-this--overlays)))))))
(defun why-this--render-non-blocking ()
@@ -141,8 +149,8 @@ NICK."
(while-no-input
(why-this--render)))
-(defun why-this--delete-overlays ()
- "Delete all overlays unneeded overlays."
+(defun why-this--update-overlays ()
+ "Update overlays."
(let ((begin (line-number-at-pos (if (use-region-p)
(region-beginning)
(point))))
@@ -159,8 +167,18 @@ NICK."
(let ((line (line-number-at-pos
(overlay-start (car ov)))))
(and (>= line begin)
- (< line end))))
- ov
+ (< line end)
+ (eq line (overlay-get (car ov) 'why-this-line)))))
+ (progn
+ (let ((ov-start (overlay-start (car ov))))
+ (when (and (eq (line-number-at-pos)
+ (line-number-at-pos ov-start))
+ (> (point) ov-start))
+ (let ((pos (save-excursion
+ (goto-char ov-start)
+ (line-end-position))))
+ (move-overlay (car ov) pos pos))))
+ ov)
(delete-overlay (car ov))
nil))
why-this--overlays)))))
@@ -186,14 +204,14 @@ Actually the supported backend is returned."
(setq why-this-mode nil)
(if why-this-mode
(progn
- (add-hook 'post-command-hook #'why-this--delete-overlays nil t)
+ (add-hook 'post-command-hook #'why-this--update-overlays nil t)
(when why-this--idle-timer
(cancel-timer why-this--idle-timer)
(setq why-this--idle-timer nil))
(setq why-this--idle-timer
(run-with-idle-timer why-this-idle-delay t
#'why-this--render-non-blocking)))
- (remove-hook 'post-command-hook #'why-this--delete-overlays t)
+ (remove-hook 'post-command-hook #'why-this--update-overlays t)
(cancel-timer why-this--idle-timer)
(setq why-this--idle-timer nil))))
- [nongnu] elpa/why-this 9c0daa799c 28/59: Rename a variable, change backend API and update docs, (continued)
- [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
- [nongnu] elpa/why-this 41fe21da73 15/59: Fontify before annotate, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 006ea3864a 13/59: Fix Git backend 'supported-p command, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 0c1686d8d3 12/59: Fix misspelled word "annonate", ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing,
ELPA Syncer <=
- [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, 2022/11/27