[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 41b0997c3f 151/173: fix: remove/delete remov
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 41b0997c3f 151/173: fix: remove/delete remove only one highlihgt at a time |
Date: |
Fri, 28 Jan 2022 16:58:10 -0500 (EST) |
branch: externals/org-remark
commit 41b0997c3f30ab24ada7445e2cca6093b227e9ca
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
fix: remove/delete remove only one highlihgt at a time
It was removing all higlights at point. The program issue was it removed
only
one from the marginal notes, causing inconsistency.
It should be only one at a time, especially when delete is used.
---
NEWS | 5 ++++-
org-remark.el | 27 +++++++++++++++++----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/NEWS b/NEWS
index c3aa1201a0..c285823547 100644
--- a/NEWS
+++ b/NEWS
@@ -26,8 +26,11 @@
* Changes
+ - chg: `remove' (and delete) only removes one highlight at a time instead of
+ remove all at point
+
- chg: Save marginal notes on `mark' instead of wainting for `save'
-
+
- chg: define org-remark-mark explicitly for autoload cookie
- chg: `org-remark-visit' and `org-remark-open'. Visit will stay in the
diff --git a/org-remark.el b/org-remark.el
index d706491d16..d1a154c580 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -28,7 +28,7 @@
;;; Commentary:
;; This package lets you highlight and annotate any text file with using Org
-;; mode. Refer to README.org and docstring for detail.
+;; mode.
;;; Code:
@@ -499,18 +499,25 @@ If you have done so by error, you could still `undo' it
in the
marginal notes buffer, but not in the current buffer as adding
and removing overlays are not part of the undo tree."
(interactive "d\nP")
- ;; TODO There may be multiple overlays
(when-let* ((id (get-char-property point 'org-remark-id)))
;; Remove the highlight overlay and id
- (dolist (ov (overlays-at (point)))
- ;; Remove the element in the variable org-remark-highlights
- (when (overlay-get ov 'org-remark-id)
- (delete ov org-remark-highlights)
- (delete-overlay ov)))
+ ;; Where there is more than one, remove only one
+ ;; It should be last-in-first-out
+ (let ((deleted)
+ ;; reverse the order so that pop returns the last one
+ ;; for last-in-first-out
+ (ovs (reverse (overlays-at (point)))))
+ (while (not deleted)
+ (let ((ov (pop ovs)))
+ ;; Remove the element in the variable org-remark-highlights
+ (when (overlay-get ov 'org-remark-id)
+ (delete ov org-remark-highlights)
+ (delete-overlay ov)
+ ;; Update the notes file accordingly
+ (org-remark-single-highlight-remove id delete)
+ (setq deleted t)))))
(org-remark-housekeep)
(org-remark-highlights-sort)
- ;; Update the notes file accordingly
- (org-remark-single-highlight-remove id delete)
t))
@@ -786,6 +793,7 @@ Each highlight is a list in the following structure:
(when-let ((notes-buf (find-file-noselect org-remark-notes-file-path))
(source-path (org-remark-source-path (buffer-file-name))))
;; TODO check if there is any relevant notes for the current file
+ ;; This can be used for adding icon to the highlight
(let ((highlights))
(with-current-buffer notes-buf
(when (featurep 'org-remark-convert-legacy)
@@ -898,7 +906,6 @@ the show/hide state."
(when-let ((highlights org-remark-highlights))
(dolist (highlight highlights)
(overlay-put highlight 'org-remark-hidden nil)
- ;; TODO it does not work with new pens
(overlay-put highlight 'face (overlay-get highlight 'org-remark-face)))
t))
- [elpa] externals/org-remark 9fd5ef5b74 105/173: doc: NOTICE on name change proposal, (continued)
- [elpa] externals/org-remark 9fd5ef5b74 105/173: doc: NOTICE on name change proposal, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 3bb5f40e59 121/173: intrnl: refactor. mark saves; load only loads with no save, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark c03ce7b590 123/173: fix: save and line-num for ID., ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark d07f158dfe 125/173: add:refactor: org-remark-source-path, org-remark-notes-track-file, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 1b2482cf7c 133/173: fix:org-remark-mark API; refactor org-remark-load, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 76e5a4f915 136/173: docs: WIP, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 6aaba8acdb 142/173: docs: resolving custom_id link, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 2e14b95d65 147/173: feat: minor-mode menu & mouse context-menu (>= Emacs 28), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark d9e305837b 149/173: docs: README update for ascii output used by ELPA, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 2b4692abbf 150/173: docs: NEWS for v0.1.0, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 41b0997c3f 151/173: fix: remove/delete remove only one highlihgt at a time,
ELPA Syncer <=
- [elpa] externals/org-remark 84d50976df 156/173: chg: Menu label from "Remark" to "Org-remark", ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 697a990a34 158/173: revert f6c3f36 The screen jerking was not OS or version; setup issue, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 5e55f8757d 159/173: chg: menu squence; docs: add menu and context menu to user manual, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 0db912919a 163/173: docs: update Makefile, README and user manual, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 82a4afbee0 169/173: add: delete with confirmation promt etc., ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a1ff9033c1 170/173: add: org-remark-delete, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark dc162bc8ec 172/173: fix: window management for open and remove/delete, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 91d7583495 065/173: add: mark deactivate-mark & set-buffer-modified-p, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark bd01afe043 068/173: add tracking: customizing subgroup, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 0e2a215c40 079/173: readme, ELPA Syncer, 2022/01/28