Skip to content

Commit 25b339f

Browse files
committed
fix: wrap info-setup
1 parent 890eb00 commit 25b339f

File tree

3 files changed

+44
-31
lines changed

3 files changed

+44
-31
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
matrix:
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222
emacs-version:
23+
- 26.3
24+
- 27.2
25+
- 28.2
26+
- 29.4
2327
- 30.1
2428
experimental: [false]
2529
include:

Eask

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
(source 'gnu)
1414

15-
(depends-on "emacs" "30.1")
15+
(depends-on "emacs" "26.1")
1616

1717
(add-hook 'eask-before-compile-hook
1818
(lambda ()

annotate.el

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
;; URL: https://github.com/bastibe/annotate.el
99
;; Created: 2015-06-10
1010
;; Version: 2.4.1
11-
;; Package-Requires: ((emacs "30.1"))
11+
;; Package-Requires: ((emacs "26.1"))
1212

1313
;; This file is NOT part of GNU Emacs.
1414

@@ -751,24 +751,24 @@ specified by `FROM' and `TO'."
751751

752752
(defun annotate--expand-annotation-text (annotation-text)
753753
(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)))
759759
(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))))
772772

773773
(defun annotate-annotate (&optional color-index)
774774
"Create, modify, or delete annotation.
@@ -785,7 +785,7 @@ and
785785
(cl-destructuring-bind (start end)
786786
(annotate-bounds)
787787
(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)))
789789
(condition-case nil
790790
(annotate-create-annotation start end annotation-text nil color-index)
791791
(annotate-no-new-line-at-end-file-error
@@ -937,7 +937,7 @@ and
937937
(goto-char (annotate-end-of-line-pos))
938938
(annotate-annotate))))))))))))
939939
(when annotate-autosave
940-
(annotate-save-annotations)))))
940+
(annotate-save-annotations)))))
941941

942942
(defun annotate-toggle-annotation-text ()
943943
"Hide annotation's text at current cursor's point, if such annotation exists."
@@ -1546,20 +1546,20 @@ surrounded by `BEGIN' and `END'."
15461546
"Return the annotations overlays that are enclosed in the range
15471547
defined by `FROM-POSITION' and `TO-POSITION'."
15481548
(let ((annotations ())
1549-
(counter (max 0 (1- from-position))))
1549+
(counter (max 0 (1- from-position))))
15501550
(catch 'scan-loop
15511551
(while (<= counter
15521552
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)))
15551555
(if (annotationp annotation)
15561556
(let ((chain-end (overlay-end (annotate-chain-last annotation)))
15571557
(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)))))
15631563
(reverse annotations)))
15641564

15651565
(defun annotate-annotations-chain-in-range (from-position to-position)
@@ -2843,6 +2843,15 @@ sophisticated way than plain text."
28432843
'follow-link t
28442844
'help-echo "Click to replace annotation")
28452845

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+
28462855
(defun annotate-summary-show-annotation-button-pressed (button)
28472856
"Callback called when an annotate-summary-show-annotation-button is activated."
28482857
(let* ((file (button-get button 'file))
@@ -2851,7 +2860,7 @@ sophisticated way than plain text."
28512860
((eq file-type :info)
28522861
(with-current-buffer-window
28532862
"*info*" nil nil
2854-
(info-pop-to-buffer file (current-buffer))
2863+
(annotate-info-setup file (current-buffer))
28552864
(switch-to-buffer "*info*"))
28562865
(with-current-buffer "*info*"
28572866
(goto-char (button-get button 'go-to))))
@@ -3011,7 +3020,7 @@ results can be filtered with a simple query language: see
30113020
snippet)))
30123021
(build-snippet-info (filename annotation-begin annotation-end)
30133022
(with-temp-buffer
3014-
(info-pop-to-buffer filename (current-buffer))
3023+
(annotate-info-setup filename (current-buffer))
30153024
(buffer-substring-no-properties annotation-begin
30163025
annotation-end)))
30173026
(build-snippet-from-buffer (filename annotation-begin annotation-end)

0 commit comments

Comments
 (0)