[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate a169038431 050/372: new export option
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate a169038431 050/372: new export option |
Date: |
Fri, 4 Feb 2022 16:58:18 -0500 (EST) |
branch: elpa/annotate
commit a1690384317ce366e5a33aec916949e3328a0117
Author: Bastian Bechtold <bb@Mr-Bigglesworth.local>
Commit: Bastian Bechtold <bb@Mr-Bigglesworth.local>
new export option
---
README.md | 3 +++
annotate.el | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 1527b8d8c7..c0f5e140f7 100644
--- a/README.md
+++ b/README.md
@@ -74,3 +74,6 @@ This package is released under the MIT license.
- **2015-10-06 V0.4.3 Bastian Bechtold**
Bugfixes. No more hidden newlines, no more annotations in undo-list, no more
error messages with annotations at bol, mark deactivated after creating
annotation, annotations auto-reflow on frame size change.
+
+- **2015-10-06 V0.4.4 Bastian Bechtold**
+ Added a new export system. Let's see if it turns out to be more useful than
the previous one.
diff --git a/annotate.el b/annotate.el
index 192fa02c87..8f45823aab 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.3
+;; Version: 0.4.4
;; This file is NOT part of GNU Emacs.
@@ -50,7 +50,7 @@
;;;###autoload
(defgroup annotate nil
"Annotate files without changing them."
- :version "0.4.3"
+ :version "0.4.4"
:group 'text)
;;;###autoload
@@ -104,6 +104,12 @@
:type 'boolean
:group 'annotate)
+;;;###autoload
+(defcustom annotate-integrate-marker " ANNOTATION: "
+ "Marker that is written before every integrated annotation."
+ :type 'string
+ :group 'annotate)
+
(defun annotate-initialize ()
"Load annotations and set up save and display hooks."
(annotate-load-annotations)
@@ -202,6 +208,66 @@
(if annotate-use-messages
(message "Annotations saved."))))
+;;;###autoload
+(defun annotate-integrate-annotations ()
+ "Write all annotations into the file as comments below the annotated line.
+An example might look like this:"
+ (interactive)
+ (save-excursion
+ (dolist (ov (sort (overlays-in 0 (buffer-size))
+ (lambda (o1 o2)
+ (< (overlay-start o1) (overlay-start o2)))))
+ (goto-char (overlay-start ov))
+ (cond
+ ;; overlay spans more than one line
+ ((string-match "\n" (buffer-substring (overlay-start ov)
+ (overlay-end ov)))
+ ;; partially underline first line
+ (let ((ov-start (point))
+ (bol (progn (beginning-of-line)
+ (point)))
+ (eol (progn (end-of-line)
+ (point))))
+ (end-of-line)
+ (insert "\n" comment-start
+ (make-string (max 0 (- ov-start bol (string-width
comment-start))) ? )
+ (make-string (max 0 (- eol ov-start)) ?~)))
+ ;; fully underline second to second-to-last line
+ (while (< (progn (next-line)
+ (end-of-line)
+ (point)) (overlay-end ov))
+ (let ((bol (progn (beginning-of-line)
+ (point)))
+ (eol (progn (end-of-line)
+ (point))))
+ (end-of-line)
+ (insert "\n" comment-start
+ (make-string (max 0 (- eol bol (string-width
comment-start))) ?~))))
+ ;; partially underline last line
+ (let ((bol (progn (beginning-of-line)
+ (point)))
+ (ov-end (overlay-end ov)))
+ (end-of-line)
+ (insert "\n" comment-start
+ (make-string (max 0 (- ov-end bol (string-width
comment-start))) ?~)))
+ ;; insert actual annotation text
+ (insert "\n" comment-start annotate-integrate-marker (overlay-get ov
'annotation)))
+ ;; overlay is within one line
+ (t
+ (let ((ov-start (overlay-start ov))
+ (ov-end (overlay-end ov))
+ (bol (progn (beginning-of-line)
+ (point))))
+ (end-of-line)
+ (insert "\n" comment-start
+ (make-string (max 0 (- ov-start bol (string-width
comment-start))) ? )
+ (if (= bol ov-start)
+ (make-string (max 0 (- ov-end ov-start 1)) ?~)
+ (make-string (max 0 (- ov-end ov-start)) ?~))
+ "\n" comment-start annotate-integrate-marker (overlay-get
ov 'annotation)))))
+ (remove-text-properties
+ (point) (1+ (point)) '(display nil)))))
+
;;;###autoload
(defun annotate-export-annotations ()
"Export all annotations as a unified diff file.
@@ -335,7 +401,7 @@ annotation plus the newline."
(goto-char (overlay-end (car overlays)))))
;; capture the area from the overlay to EOL for the modification guard
;; and the newline itself for the annotation.
- (re-search-forward "\\(.*\\)\\(\n\\)")
+ (re-search-forward "\\(.*\\(\n\\)\\)")
t)))
(defun annotate-lineate (text)
@@ -411,7 +477,7 @@ that strips dangling `display` properties of text
insertions if
text is inserted. This cleans up after newline insertions between
an overlay and it's annotation."
(list 'face nil
- 'insert-behind-hooks '(annotate--remove-annotation-property)))
+ 'insert-in-front-hooks '(annotate--remove-annotation-property)))
(defun annotate-context-before (pos)
"Context lines before POS."
- [nongnu] elpa/annotate eaf96d584f 349/372: - added confirmation prompt before delete an annotation., (continued)
- [nongnu] elpa/annotate eaf96d584f 349/372: - added confirmation prompt before delete an annotation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e37820134f 332/372: - updated NEWS, Changelog and version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2f4cbcdb3d 324/372: - fixed indentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c737b516b8 361/372: Merge pull request #114 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f65d10ac99 008/372: improve faces, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f31eddb523 044/372: fixed bug with annotation on bol, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 32e7d85fa2 039/372: don't save files with no annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e45381249f 046/372: fix bug that sometimes hid newlines, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f1ca2b15a3 043/372: add changelog to README, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 832091a37d 040/372: don't save duplicate annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a169038431 050/372: new export option,
ELPA Syncer <=
- [nongnu] elpa/annotate e1206a8965 068/372: - fixed a bug that made 'annotate-export-annotations' fails when the, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate dedbd9e5d5 064/372: removes unnecessary autoloads, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c9ba9d82f2 041/372: strip properties whenever file name is used, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 9616c55812 057/372: fix for annotations ending on an empty line, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 09d0cd89e4 066/372: Merge pull request #41 from conao3/change-save-file-path, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 475cc56ec6 079/372: - added checksum for files to check if annotations could be updated;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 8937294206 083/372: - better naming a function., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a1c55fc98a 085/372: - added more docstrings., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 64bf3dfc8f 089/372: Merge pull request #43 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 7908f0b114 092/372: - renamed function 'annotate-start-annotation-dump' to, ELPA Syncer, 2022/02/04