[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate d7246d5220 006/372: implemented annotation saving
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate d7246d5220 006/372: implemented annotation saving |
Date: |
Fri, 4 Feb 2022 16:58:14 -0500 (EST) |
branch: elpa/annotate
commit d7246d5220b99499466e3b1f3068f631bbec724c
Author: Bastian Bechtold <basti@bastibe.de>
Commit: Bastian Bechtold <basti@bastibe.de>
implemented annotation saving
---
annotate.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/annotate.el b/annotate.el
index 34b269a3dc..23669b3f1b 100644
--- a/annotate.el
+++ b/annotate.el
@@ -83,3 +83,25 @@
((region-active-p) (region-end))
((thing-at-point 'symbol) (cdr (bounds-of-thing-at-point 'symbol)))
(t (1+ (point))))))
+
+(defun annotate-save-annotations ()
+ "Save all annotations to disk."
+ (interactive)
+ (let ((annotations
+ (mapcar 'annotate-describe-annotation (overlays-in 0 (buffer-size)))))
+ (append-to-file (concat (format "\n:%s\n" (buffer-file-name))
+ (apply 'concat annotations))
+ nil annotate-file)))
+
+(defun annotate-describe-annotation (highlight)
+ (save-excursion
+ (goto-char (overlay-start highlight))
+ (format "%s (line %s, %s-%s): %s\n"
+ (prin1-to-string (buffer-substring-no-properties
+ (overlay-start highlight)
+ (overlay-end highlight)))
+ (line-number-at-pos)
+ (current-column)
+ (+ (current-column) (- (overlay-end highlight)
+ (overlay-start highlight)))
+ (prin1-to-string (overlay-get highlight 'annotation)))))
- [nongnu] branch elpa/annotate created (now 0cfad246ee), ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cecb77fecc 004/372: can now edit and delete annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate d7246d5220 006/372: implemented annotation saving,
ELPA Syncer <=
- [nongnu] elpa/annotate a648cd44df 010/372: make auxiliary functions non-interactive, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f6780672bc 011/372: fix change annotation function, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f6203f0d40 012/372: improved default column, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 526ced3131 013/372: create minor mode, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 7531343d7b 001/372: initial prototype, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 6c33ac48d0 003/372: annotate without region, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 32d82c4557 018/372: no more nil annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate aa075cfe04 002/372: change annotation display from overlay to property, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 94c2a9455f 019/372: increment version number, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 530b4aa78a 022/372: increment version number, ELPA Syncer, 2022/02/04