[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 922d78fbd3 032/173: fix: out of bound for in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 922d78fbd3 032/173: fix: out of bound for invisible regions |
Date: |
Fri, 28 Jan 2022 16:57:56 -0500 (EST) |
branch: externals/org-remark
commit 922d78fbd34c1b1db780a7c00cc3f6d7a5b0bb73
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
fix: out of bound for invisible regions
---
org-marginalia.el | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/org-marginalia.el b/org-marginalia.el
index 745c0c6ceb..1338db4577 100644
--- a/org-marginalia.el
+++ b/org-marginalia.el
@@ -5,7 +5,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; URL: https://github.com/nobiot/org-marginalia
;; Version: 0.0.3
-;; Last modified: 2020-12-24T140044
+;; Last modified: 2020-12-24T152945
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, writing, note-taking, margin-notes
@@ -254,8 +254,9 @@ and `om/prev'."
;; UUID is too long; does not have to be the full length
(when (not id) (setq id (substring (org-id-uuid) 0 8)))
;; Add highlight to the text
- (add-text-properties beg end '(font-lock-face om/highlighter))
- (add-text-properties beg end (list 'om/id id))
+ (org-with-wide-buffer
+ (add-text-properties beg end '(font-lock-face om/highlighter))
+ (add-text-properties beg end (list 'om/id id)))
;; Keep track in a local variable It's alist; don't forget the dot
;; (beg . end)
;; The dot "." is imporant to make the car/cdr "getter" interface clean.
@@ -382,7 +383,9 @@ If there is none below the point, but there is a highlight
in the
buffer, go back to the first one."
(interactive)
(if (not om/highlights) (message "No highlights present in this buffer.")
- (goto-char (om/find-next-highlight))))
+ (if (om/find-next-highlight)
+ (goto-char (om/find-next-highlight))
+ (message "Nothing done. No more visible highlights exist"))))
(defun om/prev ()
"Look at the current point, and move to the previous highlight, if any.
@@ -390,7 +393,9 @@ If there is none above the point, but there is a highlight
in the
buffer, go back to the last one."
(interactive)
(if (not om/highlights) (message "No highlights present in this buffer.")
- (goto-char (om/find-prev-highlight))))
+ (if (om/find-prev-highlight)
+ (goto-char (om/find-prev-highlight))
+ (message "Nothing done. No more visible highlights exist"))))
(defun om/toggle ()
"Toggle showing/hiding of highlighters in current buffer.
@@ -469,13 +474,21 @@ properties."
(defun om/list-highlights-positions (&optional reverse)
"Return list of beg points of highlights in this buffer.
By default, the list is in ascending order.
-If none, return nil.
-If REVERSE is non-nil, return list in the descending order."
+If REVERSE is non-nil, return list in the descending order.
+
+It also checks if the position is visible or not. Returns only
+visible ones.
+
+If none, return nil."
(when om/highlights
- (let ((list (mapcar (lambda (h)
- (marker-position (car (cdr h))))
- om/highlights)))
- (if reverse (reverse list) list))))
+ (let ((list '()))
+ (dolist (h om/highlights)
+ (org-with-wide-buffer
+ (let ((p (marker-position (car (cdr h)))))
+ (unless (car (get-char-property-and-overlay p 'invisible))
+ (push p list)))))
+ (when list
+ (if reverse (reverse list) list)))))
(defun om/sort-highlights-list ()
"Utility function to sort `om/sort-highlights'."
- [elpa] externals/org-remark b60992beb5 053/173: doc: Update comments and readme, (continued)
- [elpa] externals/org-remark b60992beb5 053/173: doc: Update comments and readme, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 7534424f4d 055/173: break: Replace prefix "om/" with "org-marginalia";, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark c7a5ba5e3b 057/173: Merge branch 'main' of https://github.com/nobiot/org-marginalia, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 020c862da7 007/173: doc: Fix the badge display, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 04124b352e 015/173: doc: Minor update readme, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 3cc500cb4a 018/173: internal: private fn first to avoid macro error, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 46d3722ea1 017/173: feat: Add om/next and /prev, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 3a5076b8ef 019/173: internal: Update program header, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark c8bbe51411 021/173: doc: Fix some documentation errors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 2687b8eabf 031/173: admin: merging two machines on my end, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 922d78fbd3 032/173: fix: out of bound for invisible regions,
ELPA Syncer <=
- [elpa] externals/org-remark 022f067983 035/173: doc: Change modified date to be manual, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 447edb9d6d 037/173: intrnl: Add file var to make README as marginalia, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 840381a503 040/173: doc: Correct some program comments, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a2fa4f9955 043/173: fix: om/list-highlights-positions, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 048c0e806e 044/173: intrnl: Update most functions to return t/nil, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 22eed1f5c2 042/173: fix: om/list-highlights-positions, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark ce1fd7bb23 048/173: doc: Update for transient navigation (next/prev), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark e2524f1663 056/173: Remove default keybindings; add examples in readme, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 045b7593f5 059/173: doc: Update README according to the fix and some, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 6f1a13dbf1 062/173: doc: om-remove, C-u option, ELPA Syncer, 2022/01/28