diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-15 02:22:06 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-15 02:22:06 -0500 |
| commit | b4039017e468f310c99c04810f010b5ceada07e1 (patch) | |
| tree | 7bd669e00d504753c9a87b471fa594ee338c623b /tests/test-custom-buffer-file-copy-buffer-source.el | |
| parent | c551230df1cb644d1d97c34a7fbdf9e3d8ca8c78 (diff) | |
| download | dotemacs-b4039017e468f310c99c04810f010b5ceada07e1.tar.gz dotemacs-b4039017e468f310c99c04810f010b5ceada07e1.zip | |
fix(custom-buffer-file): Info dispatcher returns full org bracket link
The Info-mode entry in cj/buffer-source-functions copied the bare
target string info:(manual)Node. Per the task body that introduced
the dispatcher, the intended output is the labeled org-link form
[[info:(manual)Node][(manual) Node]] -- a paste into notes lands as
a clickable link with a human-readable label, not a bare URI.
The label uses (manual) Node so the manual name and node name are
both grep-friendly in note files.
Existing test on a compressed .info.gz file now asserts the bracket
form. Added a boundary test for an uncompressed .info file (the
other branch of the suffix-stripping logic) so both compression
shapes are locked in.
Diffstat (limited to 'tests/test-custom-buffer-file-copy-buffer-source.el')
| -rw-r--r-- | tests/test-custom-buffer-file-copy-buffer-source.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/test-custom-buffer-file-copy-buffer-source.el b/tests/test-custom-buffer-file-copy-buffer-source.el index f4afd109..1a8c0c3d 100644 --- a/tests/test-custom-buffer-file-copy-buffer-source.el +++ b/tests/test-custom-buffer-file-copy-buffer-source.el @@ -157,9 +157,10 @@ isn't on a real message), the dispatcher falls back to ;;; Info-mode dispatch (ert-deftest test-copy-buffer-source-info-mode-formats-as-org-info-link () - "Normal: in Info-mode, return `info:(manual)node' -- the form -`org-info-store-link' produces, which org renders as a clickable -link target." + "Normal: in Info-mode on a compressed manual, return the org +bracket link form `[[info:(manual)node][(manual) node]]'. Pasting +into notes lands a labeled, clickable link rather than a bare +target string." (let (kill-ring) (with-temp-buffer (setq major-mode 'Info-mode) @@ -167,7 +168,22 @@ link target." (setq-local Info-current-node "Buffers") (cl-letf (((symbol-function 'message) #'ignore)) (cj/copy-buffer-source-as-kill)) - (should (equal (car kill-ring) "info:(emacs)Buffers"))))) + (should (equal (car kill-ring) + "[[info:(emacs)Buffers][(emacs) Buffers]]"))))) + +(ert-deftest test-copy-buffer-source-info-mode-handles-uncompressed-info-file () + "Boundary: uncompressed `.info' files still strip the suffix and +emit the same bracket link form. Guards the `string-suffix-p +\".info\"' branch in the dispatcher." + (let (kill-ring) + (with-temp-buffer + (setq major-mode 'Info-mode) + (setq-local Info-current-file "/usr/local/share/info/elisp.info") + (setq-local Info-current-node "Functions") + (cl-letf (((symbol-function 'message) #'ignore)) + (cj/copy-buffer-source-as-kill)) + (should (equal (car kill-ring) + "[[info:(elisp)Functions][(elisp) Functions]]"))))) (ert-deftest test-copy-buffer-source-info-mode-without-context-falls-through () "Boundary: when Info hasn't populated `Info-current-file' or |
