branch: elpa/annotate commit 9616c55812c4b6f11365e0f4e90f9357c95280ff Author: Bastian Bechtold <ba...@bastibe.de> Commit: Bastian Bechtold <ba...@bastibe.de>
fix for annotations ending on an empty line annotations are saved in overlays, and overlays are searched within the current line. If the line is empty, no overlays can be found. This special-cases the search to include the previous character in the search if the current line is empty. fixes #23 --- README.md | 3 +++ annotate.el | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 271f6d8e75..b0b5d1731d 100644 --- a/README.md +++ b/README.md @@ -84,3 +84,6 @@ This package is released under the MIT license. - **2016-08-25 V0.4.5 Bastian Bechtold** Bugfix release for unicode annotations and multiline annotations. + +- **2016-09-07 V0.4.6 Bastian Bechtold** + Bugfix release for annotations ending on an empty line. diff --git a/annotate.el b/annotate.el index d90cbcdc71..42ad579947 100644 --- a/annotate.el +++ b/annotate.el @@ -5,7 +5,7 @@ ;; Maintainer: Bastian Bechtold ;; URL: https://github.com/bastibe/annotate.el ;; Created: 2015-06-10 -;; Version: 0.4.5 +;; Version: 0.4.6 ;; This file is NOT part of GNU Emacs. @@ -442,13 +442,18 @@ annotation plus the newline." (text "") (bol (progn (beginning-of-line) (point))) (eol (progn (end-of-line) (point))) - (overlays (sort (overlays-in bol eol) + ;; include line break if on empty line: + (bol* (if (= bol eol) (1- bol) bol)) + (overlays (sort (overlays-in bol* eol) (lambda (x y) (< (overlay-end x) (overlay-end y)))))) ;; put each annotation on its own line (dolist (ov overlays) (if (overlay-get ov 'annotation) - (dolist (l (save-match-data (split-string (annotate-lineate (overlay-get ov 'annotation) (- eol bol)) "\n"))) + (dolist (l (save-match-data + (split-string + (annotate-lineate (overlay-get ov 'annotation) + (- eol bol)) "\n"))) (setq text (concat text prefix (propertize l 'face 'annotate-annotation)