8
8
; ; URL: https://github.com/bastibe/annotate.el
9
9
; ; Created: 2015-06-10
10
10
; ; Version: 2.4.1
11
- ; ; Package-Requires: ((emacs "30 .1"))
11
+ ; ; Package-Requires: ((emacs "26 .1"))
12
12
13
13
; ; This file is NOT part of GNU Emacs.
14
14
@@ -751,24 +751,24 @@ specified by `FROM' and `TO'."
751
751
752
752
(defun annotate--expand-annotation-text (annotation-text )
753
753
(cl-flet ((regex (expansion-item)
754
- (cl-first expansion-item))
755
- (trimp (expansion-item)
756
- (cl-third expansion-item))
757
- (command (expansion-item)
758
- (cl-second expansion-item)))
754
+ (cl-first expansion-item))
755
+ (trimp (expansion-item)
756
+ (cl-third expansion-item))
757
+ (command (expansion-item)
758
+ (cl-second expansion-item)))
759
759
(cl-loop with results = annotation-text
760
- for expansion in annotate-annotation-expansion-map
761
- when (string-match-p (regex expansion) results)
762
- do (let ((expansion-results (shell-command-to-string (command expansion))))
763
- (when (trimp expansion)
764
- (setf expansion-results (string-trim expansion-results)))
765
- (setf results
766
- (replace-regexp-in-string (regex expansion)
767
- expansion-results
768
- results
769
- t
770
- t )))
771
- finally (return results))))
760
+ for expansion in annotate-annotation-expansion-map
761
+ when (string-match-p (regex expansion) results)
762
+ do (let ((expansion-results (shell-command-to-string (command expansion))))
763
+ (when (trimp expansion)
764
+ (setf expansion-results (string-trim expansion-results)))
765
+ (setf results
766
+ (replace-regexp-in-string (regex expansion)
767
+ expansion-results
768
+ results
769
+ t
770
+ t )))
771
+ finally (return results))))
772
772
773
773
(defun annotate-annotate (&optional color-index )
774
774
" Create, modify, or delete annotation.
785
785
(cl-destructuring-bind (start end)
786
786
(annotate-bounds)
787
787
(let* ((raw-text (read-from-minibuffer annotate-annotation-prompt))
788
- (annotation-text (annotate--expand-annotation-text raw-text)))
788
+ (annotation-text (annotate--expand-annotation-text raw-text)))
789
789
(condition-case nil
790
790
(annotate-create-annotation start end annotation-text nil color-index)
791
791
(annotate-no-new-line-at-end-file-error
937
937
(goto-char (annotate-end-of-line-pos))
938
938
(annotate-annotate))))))))))))
939
939
(when annotate-autosave
940
- (annotate-save-annotations)))))
940
+ (annotate-save-annotations)))))
941
941
942
942
(defun annotate-toggle-annotation-text ()
943
943
" Hide annotation's text at current cursor's point, if such annotation exists."
@@ -1546,20 +1546,20 @@ surrounded by `BEGIN' and `END'."
1546
1546
" Return the annotations overlays that are enclosed in the range
1547
1547
defined by `FROM-POSITION' and `TO-POSITION' ."
1548
1548
(let ((annotations ())
1549
- (counter (max 0 (1- from-position))))
1549
+ (counter (max 0 (1- from-position))))
1550
1550
(catch 'scan-loop
1551
1551
(while (<= counter
1552
1552
to-position)
1553
- (cl-incf counter)
1554
- (let ((annotation (annotate-next-annotation-starts counter)))
1553
+ (cl-incf counter)
1554
+ (let ((annotation (annotate-next-annotation-starts counter)))
1555
1555
(if (annotationp annotation)
1556
1556
(let ((chain-end (overlay-end (annotate-chain-last annotation)))
1557
1557
(chain-start (overlay-start (annotate-chain-first annotation))))
1558
- (setf counter chain-end)
1559
- (when (and (>= chain-start from-position)
1560
- (<= chain-end to-position))
1561
- (cl-pushnew annotation annotations)))
1562
- (throw 'scan-loop t )))))
1558
+ (setf counter chain-end)
1559
+ (when (and (>= chain-start from-position)
1560
+ (<= chain-end to-position))
1561
+ (cl-pushnew annotation annotations)))
1562
+ (throw 'scan-loop t )))))
1563
1563
(reverse annotations)))
1564
1564
1565
1565
(defun annotate-annotations-chain-in-range (from-position to-position )
@@ -2843,6 +2843,15 @@ sophisticated way than plain text."
2843
2843
'follow-link t
2844
2844
'help-echo " Click to replace annotation" )
2845
2845
2846
+ (defun annotate-info-setup (file-or-node buffer )
2847
+ " Display Info node FILE-OR-NODE in BUFFER.
2848
+
2849
+ Compatibility wrapper for the function `info-setup' and `info-pop-to-buffer' ."
2850
+ (if (version< " 30" emacs-version)
2851
+ (info-pop-to-buffer file-or-node buffer)
2852
+ (with-no-warnings
2853
+ (info-setup file-or-node buffer))))
2854
+
2846
2855
(defun annotate-summary-show-annotation-button-pressed (button )
2847
2856
" Callback called when an annotate-summary-show-annotation-button is activated."
2848
2857
(let* ((file (button-get button 'file ))
@@ -2851,7 +2860,7 @@ sophisticated way than plain text."
2851
2860
((eq file-type :info )
2852
2861
(with-current-buffer-window
2853
2862
" *info*" nil nil
2854
- (info-pop-to-buffer file (current-buffer ))
2863
+ (annotate- info-setup file (current-buffer ))
2855
2864
(switch-to-buffer " *info*" ))
2856
2865
(with-current-buffer " *info*"
2857
2866
(goto-char (button-get button 'go-to ))))
@@ -3011,7 +3020,7 @@ results can be filtered with a simple query language: see
3011
3020
snippet)))
3012
3021
(build-snippet-info (filename annotation-begin annotation-end)
3013
3022
(with-temp-buffer
3014
- (info-pop-to-buffer filename (current-buffer ))
3023
+ (annotate- info-setup filename (current-buffer ))
3015
3024
(buffer-substring-no-properties annotation-begin
3016
3025
annotation-end)))
3017
3026
(build-snippet-from-buffer (filename annotation-begin annotation-end)
0 commit comments