[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate e1206a8965 068/372: - fixed a bug that made 'anno
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate e1206a8965 068/372: - fixed a bug that made 'annotate-export-annotations' fails when the |
Date: |
Fri, 4 Feb 2022 16:58:19 -0500 (EST) |
branch: elpa/annotate
commit e1206a8965f2063ab703c14fcd42a9390da4abfd
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- fixed a bug that made 'annotate-export-annotations' fails when the
first line of a buffer is annotated.
- fixed a bug that made 'annotate-export-annotations' fails when a
file type have not a valid value for variable 'comment-start'
(i.e. its value is nil).
In this case the value of a customized variable:
'annotate-fallback-comment' (default: "#") is used.
---
annotate.el | 73 +++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 49 insertions(+), 24 deletions(-)
diff --git a/annotate.el b/annotate.el
index d3097a55a7..698ca3d6fd 100644
--- a/annotate.el
+++ b/annotate.el
@@ -103,6 +103,11 @@
:type 'string
:group 'annotate)
+(defcustom annotate-fallback-comment "#"
+ "When variable comment-start is nil use this string instead."
+ :type 'string
+ :group 'annotate)
+
(defun annotate-initialize ()
"Load annotations and set up save and display hooks."
(annotate-load-annotations)
@@ -197,6 +202,10 @@
(if annotate-use-messages
(message "Annotations saved."))))
+(defun actual-comment-start ()
+ (or comment-start
+ annotate-fallback-comment))
+
(defun annotate-integrate-annotations ()
"Write all annotations into the file as comments below the annotated line.
An example might look like this:"
@@ -217,8 +226,9 @@ An example might look like this:"
(eol (progn (end-of-line)
(point))))
(end-of-line)
- (insert "\n" comment-start
- (make-string (max 0 (- ov-start bol (length comment-start)))
? )
+ (insert "\n"
+ (actual-comment-start)
+ (make-string (max 0 (- ov-start bol (length
(actual-comment-start)))) ? )
(make-string (max 0 (- eol ov-start)) ?~)))
;; fully underline second to second-to-last line
(while (< (progn (forward-line)
@@ -229,30 +239,40 @@ An example might look like this:"
(eol (progn (end-of-line)
(point))))
(end-of-line)
- (insert "\n" comment-start
- (make-string (max 0 (- eol bol (length comment-start)))
?~))))
+ (insert "\n"
+ (actual-comment-start)
+ (make-string (max 0 (- eol bol (length
(actual-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 (length comment-start)))
?~)))
+ (insert "\n"
+ (actual-comment-start)
+ (make-string (max 0 (- ov-end bol (length
(actual-comment-start)))) ?~)))
;; insert actual annotation text
- (insert "\n" comment-start annotate-integrate-marker (overlay-get ov
'annotation)))
+ (insert "\n"
+ (actual-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))))
+ (let* ((ov-start (overlay-start ov))
+ (ov-end (overlay-end ov))
+ (bol (progn (beginning-of-line)
+ (point)))
+ (underline-marker (if (= bol ov-start)
+ (make-string (max 0 (- ov-end ov-start
1)) ?~)
+ (make-string (max 0 (- ov-end ov-start))
?~))))
(end-of-line)
- (insert "\n" comment-start
- (make-string (max 0 (- ov-start bol (length 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)))))
+ (insert "\n"
+ (actual-comment-start)
+ (make-string (max 0 (- ov-start bol (length
(actual-comment-start)))) ? )
+ underline-marker
+ "\n"
+ (actual-comment-start)
+ annotate-integrate-marker
+ (overlay-get ov 'annotation)))))
(remove-text-properties
(point) (1+ (point)) '(display nil)))))
@@ -326,11 +346,14 @@ annotation, and can be conveniently viewed in diff-mode."
((= (length annotation-line-list) 1)
(insert (car annotation-line-list) "\n")
(unless (string= (car annotation-line-list) "+")
- (insert "#"
+ (insert (actual-comment-start)
(make-string (- start bol) ? )
(make-string (- end start) ?~)
"\n"))
- (insert "#" (make-string (- start bol) ? ) text "\n"))
+ (insert (actual-comment-start)
+ (make-string (- start bol) ? )
+ text
+ "\n"))
;; annotation has more than one line
(t
(let ((line (car annotation-line-list))) ; first line
@@ -338,7 +361,7 @@ annotation, and can be conveniently viewed in diff-mode."
(insert line "\n")
;; underline highlight (from start to eol)
(unless (string= line "+") ; empty line
- (insert "#"
+ (insert (actual-comment-start)
(make-string (- start bol) ? )
(make-string (- (length line) (- start bol)) ?~)
"\n")))
@@ -347,17 +370,19 @@ annotation, and can be conveniently viewed in diff-mode."
(insert line "\n")
;; nth underline highlight (from bol to eol)
(unless (string= line "+")
- (insert "#" (make-string (length line) ?~) "\n")))
+ (insert (actual-comment-start) (make-string (length line)
?~) "\n")))
(let ((line (car (last annotation-line-list))))
;; last diff line
(insert line "\n")
;; last underline highlight (from bol to end)
(unless (string= line "+")
- (insert "#"
+ (insert (actual-comment-start)
(make-string (- (length line) (- eol end) 1) ?~)
"\n")))
;; annotation text
- (insert "#" text "\n"))))
+ (insert (actual-comment-start)
+ text
+ "\n"))))
(insert (annotate-prefix-lines " " following-lines))))))
(switch-to-buffer export-buffer)
(diff-mode)
@@ -540,7 +565,7 @@ an overlay and it's annotation."
(beginning-of-line)
(let ((bol (point)))
(beginning-of-line (- (1- annotate-diff-export-context)))
- (buffer-substring-no-properties (point) (1- bol)))))
+ (buffer-substring-no-properties (point) (max 1 (1- bol))))))
(defun annotate-context-after (pos)
"Context lines after POS."
- [nongnu] elpa/annotate e37820134f 332/372: - updated NEWS, Changelog and version number., (continued)
- [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, 2022/02/04
- [nongnu] elpa/annotate e1206a8965 068/372: - fixed a bug that made 'annotate-export-annotations' fails when the,
ELPA Syncer <=
- [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
- [nongnu] elpa/annotate a572602101 094/372: - use 'window-body-width' to truncate the string with an ellipse in a, ELPA Syncer, 2022/02/04