emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/annotate 7531343d7b 001/372: initial prototype


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 7531343d7b 001/372: initial prototype
Date: Fri, 4 Feb 2022 16:58:14 -0500 (EST)

branch: elpa/annotate
commit 7531343d7b06c1607098619a774f2cccafc178bd
Author: Bastian Bechtold <basti@bastibe.de>
Commit: Bastian Bechtold <basti@bastibe.de>

    initial prototype
    
    can create annotations
---
 annotate.el | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/annotate.el b/annotate.el
new file mode 100644
index 0000000000..454ec84b99
--- /dev/null
+++ b/annotate.el
@@ -0,0 +1,45 @@
+(defgroup annotate nil
+  "Annotate files without changing them."
+  :version 0.1
+  :group 'text)
+
+(defcustom annotate-file "~/.file-annotations"
+  "File where annotations are stored."
+  :type 'file
+  :group 'annotate)
+
+(defcustom annotate-highlight-face 'highlight
+  "Face for annotations."
+  :type 'face
+  :group 'annotate)
+
+(defcustom annotate-annotation-face 'highlight
+  "Face for annotations."
+  :type 'face
+  :group 'annotate)
+
+(defcustom annotate-annotation-column 90
+  "Where annotations appear."
+  :type 'number
+  :group 'annotate)
+
+(defun annotate-create-annotation (start end &optional arg)
+  "Create a new annotation for selected region."
+  (interactive "r")
+  (let* ((overlay-highlight (make-overlay start end))
+         (eol (save-excursion (move-end-of-line nil) (point)))
+         (overlay-eol (make-overlay eol eol))
+         (prefix (make-string (- annotate-annotation-column 
(annotate-line-length)) ? )))
+    (overlay-put overlay-highlight 'face annotate-highlight-face)
+    (overlay-put overlay-eol 'after-string
+                 (concat prefix (propertize
+                                 (read-from-minibuffer "Annotation: ")
+                                 'face annotate-annotation-face)))))
+
+(defun annotate-line-length ()
+  "The length of the line from beginning to end."
+  (save-excursion
+    (move-end-of-line nil)
+    (let ((eol (point)))
+      (move-beginning-of-line nil)
+      (- eol (point)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]