[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 0bbdbea410 095/372: - improved appereance of summ
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 0bbdbea410 095/372: - improved appereance of summary window |
Date: |
Fri, 4 Feb 2022 16:58:21 -0500 (EST) |
branch: elpa/annotate
commit 0bbdbea410c8efb35fc06a01a2e02809568572c8
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- improved appereance of summary window
Using outline major mode and fixed text ellipse;
- removed 'with-current-buffer' in 'annotate-show-annotation-summary'.
---
annotate.el | 120 +++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 79 insertions(+), 41 deletions(-)
diff --git a/annotate.el b/annotate.el
index f5b95bf268..84a72027ee 100644
--- a/annotate.el
+++ b/annotate.el
@@ -117,6 +117,12 @@
:type 'string
:group 'annotate)
+(defcustom annotate-blacklist-major-mode '(org-mode)
+ "Prevent loading of annotate-mode When the visited file's
+major mode is a member of this list (space separated entries)."
+ :type '(repeat symbol)
+ :group 'annotate)
+
(defconst annotate-warn-file-changed-control-string
(concat "The file '%s' has changed on disk "
"from the last time the annotations were saved.\n"
@@ -124,15 +130,15 @@
"The message to warn the user that file has been modified and
annotations positions could be outdated")
-(defcustom annotate-blacklist-major-mode '(org-mode)
- "Prevent loading of annotate-mode When the visited file's
-major mode is a member of this list (space separated entries)."
- :type '(repeat symbol)
- :group 'annotate)
-
-(defconst annotate-summary-list-prefix "- "
+(defconst annotate-summary-list-prefix " - "
"The string used as prefix for each text annotation item in summary window")
+(defconst annotate-summary-list-prefix-file "* File: "
+ "The string used as prefix for each annotated file item in summary window")
+
+(defconst annotate-summary-list-prefix-snippet "** Annotated text: "
+ "The string used as prefix for each annotation snippet item in summary
window")
+
(defconst annotate-ellipse-text-marker "..."
"The string used when a string is truncated with an ellipse")
@@ -750,6 +756,13 @@ essentially what you get from:
(annotate-annotations-from-dump (annotate-load-annotations))). "
(cl-first annotation))
+(defun annotate-ending-of-annotation (annotation)
+ "Get the ending point of an annotation. The arg 'annotation' must be a single
+annotation field got from a file dump of all annotated buffers,
+essentially what you get from:
+(annotate-annotations-from-dump (annotate-load-annotations))). "
+ (cl-second annotation))
+
(defun annotate-text-of-annotation (annotation)
"Get the text of an annotation. The arg 'annotation' must be a single
annotation field got from a file dump of all annotated buffers,
@@ -936,42 +949,67 @@ essentially what you get from:
(defun annotate-show-annotation-summary ()
"Show a summary of all the annotations in a temp buffer"
(interactive)
- (cl-labels ((ellipsize (text)
- (let ((prefix-length (string-width
annotate-summary-list-prefix))
+ (cl-labels ((ellipsize (text prefix-string)
+ (let ((prefix-length (string-width prefix-string))
(ellipse-length (string-width
annotate-ellipse-text-marker)))
- (if (> (string-width text)
- (+ (window-body-width)
- prefix-length
- ellipse-length))
- (concat (subseq text 0
- (- (window-body-width)
- prefix-length
- ellipse-length))
- annotate-ellipse-text-marker)
- text))))
- (with-temp-buffer-window
+ (if (> (string-width text)
+ (+ (window-body-width)
+ prefix-length
+ ellipse-length))
+ (concat (substring text
+ 0
+ (- (window-body-width)
+ prefix-length
+ ellipse-length))
+ annotate-ellipse-text-marker)
+ text)))
+ (wrap (text)
+ (concat "\"" text "\""))
+ (insert-item-summary (snippet-text button-text)
+ (insert
annotate-summary-list-prefix-snippet)
+ (insert (ellipsize (wrap snippet-text)
+
annotate-summary-list-prefix-snippet))
+ (insert "\n")
+ (insert annotate-summary-list-prefix)
+ (insert-button (propertize (ellipsize
button-text
+
annotate-summary-list-prefix)
+ 'face
+ 'bold)
+ 'file filename
+ 'go-to annotation-begin
+ 'action
'annotate-summary-button-pressed
+ 'type
'annotate-summary-button)
+ (insert "\n\n"))
+ (build-snippet ()
+ (with-temp-buffer
+ (insert-file-contents filename
+ nil
+ (1- annotation-begin)
+ (1- annotation-end))
+ (buffer-string))))
+ (with-current-buffer-window
"*annotations*" nil nil
- (with-current-buffer "*annotations*"
- (use-local-map nil)
- (local-set-key "q" (lambda ()
- (interactive)
- (kill-buffer "*annotations*")))
- (let ((dump (annotate-load-annotation-data)))
- (dolist (annotation dump)
- (let ((all-annotations (annotate-annotations-from-dump annotation))
- (filename (annotate-filename-from-dump annotation)))
- (when (not (null all-annotations))
- (insert (format "%s\n\n" filename))
- (dolist (annotation-field all-annotations)
- (let ((button-text (format "%s"
- (annotate-text-of-annotation
annotation-field))))
- (insert "- ")
- (insert-button (propertize (ellipsize button-text) 'face
'bold)
- 'file filename
- 'go-to (annotate-beginning-of-annotation
annotation-field)
- 'action 'annotate-summary-button-pressed
- 'type 'annotate-summary-button)
- (insert "\n\n")))))))))))
+ (display-buffer "*annotations*")
+ (select-window (get-buffer-window "*annotations*" t))
+ (use-local-map nil)
+ (local-set-key "q" (lambda ()
+ (interactive)
+ (kill-buffer "*annotations*")))
+ (outline-mode)
+ (let ((dump (annotate-load-annotation-data)))
+ (dolist (annotation dump)
+ (let ((all-annotations (annotate-annotations-from-dump annotation))
+ (filename (annotate-filename-from-dump annotation)))
+ (when (not (null all-annotations))
+ (insert (format (concat annotate-summary-list-prefix-file
"%s\n\n")
+ filename))
+ (dolist (annotation-field all-annotations)
+ (let* ((button-text (format "%s"
+ (annotate-text-of-annotation
annotation-field)))
+ (annotation-begin (annotate-beginning-of-annotation
annotation-field))
+ (annotation-end (annotate-ending-of-annotation
annotation-field))
+ (snippet-text (build-snippet)))
+ (insert-item-summary snippet-text button-text))))))))))
(provide 'annotate)
;;; annotate.el ends here
- [nongnu] elpa/annotate 0901aa52bc 367/372: - added the others procedures to import an annotation database., (continued)
- [nongnu] elpa/annotate 0901aa52bc 367/372: - added the others procedures to import an annotation database., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f08923762f 063/372: fix typo in documentation, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 16f7202d7c 091/372: - fixed docstring., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 7c759ba9eb 082/372: - fixed english language error., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 47dba946e8 075/372: - removed spurious newline character at the end of annotation text;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 91f1d49368 087/372: - squeezed contiguous spaces in docstring., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f85f8e00a1 088/372: - remove file size limit for hash calculation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate bf80059e7a 071/372: - use comment ends string in modes that allow it (e.g. html-mode);, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f01b98de03 096/372: - restored the kill buffer key command., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1313777f03 098/372: - added args to local function., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 0bbdbea410 095/372: - improved appereance of summary window,
ELPA Syncer <=
- [nongnu] elpa/annotate edaafc69a9 052/372: no more broken annotations with umlauts, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c42db2cdf9 034/372: don't mark buffer as modified on load or clear, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 38eb69da8b 107/372: - added a secondary color for highlight and annotation text, the two, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate af6d1bd39a 055/372: tiny bugfix, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e77fc74bd2 036/372: change key binding to be more standard, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b032d2afe0 116/372: - changed function name: 'move-lines' -> 'beginning-of-nth-line'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ce8dfa5ae9 110/372: - added docstrings., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 584f27cd7a 120/372: - fixed region's limit to break an annotation;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate d97139b566 121/372: - changed two function names and reworded 'annotate-create-annotation' docstring, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 8e8d5d125e 130/372: - fixed macro: "annotate-with-inhibit-modification-hooks"., ELPA Syncer, 2022/02/04