branch: externals/org-remark commit ca86e1156cf357efba0121ecd0385cd7493a93f5 Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
fix: om/list-highlights-positions It was not checking the visibility correctly. --- org-marginalia.el | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/org-marginalia.el b/org-marginalia.el index adfae9242e..94e192d139 100644 --- a/org-marginalia.el +++ b/org-marginalia.el @@ -382,20 +382,23 @@ marginalia, but will keep the headline and notes." 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.") + (if (not om/highlights) + (progn (message "No highlights present in this buffer.") nil) (if (om/find-next-highlight) - (goto-char (om/find-next-highlight)) - (message "Nothing done. No more visible highlights exist")))) + (progn (goto-char (om/find-next-highlight)) t) + (message "Nothing done. No more visible highlights exist") nil))) (defun om/prev () "Look at the current point, and move to the previous highlight, if any. 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.") + (if (not om/highlights) + (progn (message "No highlights present in this buffer.") + nil) (if (om/find-prev-highlight) - (goto-char (om/find-prev-highlight)) - (message "Nothing done. No more visible highlights exist")))) + (progn (goto-char (om/find-prev-highlight)) t) + (message "Nothing done. No more visible highlights exist") nil))) (defun om/toggle () "Toggle showing/hiding of highlighters in current buffer. @@ -481,13 +484,21 @@ visible ones. If none, return nil." (when om/highlights - (when om/highlights - (let ((list (mapcar (lambda (h) - (marker-position (car (cdr h)))) - om/highlights))) - (remove nil list) - (when list - (if reverse (reverse list) list)))))) + (let ((list om/highlights)) + (setq list (mapcar + (lambda (h) + (let ((p (marker-position (car (cdr h))))) + ;; Checking if the p is visible or not + (if (or + (> p (point-max)) + ;; When the highlight is wihtin a visible folded + ;; area, this function returns 'outline + (org-invisible-p p)) + nil p))) + list)) + (setq list (remove nil list)) + (when list + (if reverse (reverse list) list))))) (defun om/sort-highlights-list () "Utility function to sort `om/sort-highlights'."