diff --git a/lisp/org-info.el b/lisp/org-info.el
index 79b9bcc3d..a13903a94 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -129,15 +129,19 @@ See `org-info-emacs-documents' and `org-info-other-documents' for details."
(defun org-info-export (path desc format)
"Export an info link.
See `org-link-parameters' for details about PATH, DESC and FORMAT."
- (when (eq format 'html)
- (or (string-match "\\(.*\\)[#:]:?\\(.*\\)" path)
- (string-match "\\(.*\\)" path))
- (let ((filename (match-string 1 path))
- (node (or (match-string 2 path) "Top")))
- (format "%s"
- (org-info-map-html-url filename)
- (org-info--expand-node-name node)
- (or desc path)))))
+ (let* ((parts (split-string path "[#:]:?"))
+ (manual (car parts))
+ (node (or (nth 1 parts) "Top")))
+ (pcase format
+ (`html
+ (format "%s"
+ (org-info-map-html-url manual)
+ (org-info--expand-node-name node)
+ (or desc path)))
+ (`texinfo
+ (let ((title (or desc "")))
+ (format "@ref{%s,%s,,%s,}" node title manual)))
+ (_ nil))))
(provide 'org-info)
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index e6f8d7337..45c019ecb 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -1004,12 +1004,6 @@ INFO is a plist holding contextual information. See
;; Eventually, just return "Top" to refer to the
;; beginning of the info file.
(t "Top")))))))
- ((equal type "info")
- (let* ((info-path (split-string path "[:#]"))
- (info-manual (car info-path))
- (info-node (or (cadr info-path) "Top"))
- (title (or desc "")))
- (format "@ref{%s,%s,,%s,}" info-node title info-manual)))
((string= type "mailto")
(format "@email{%s}"
(concat (org-texinfo--sanitize-content path)
diff --git a/testing/lisp/test-org-info.el b/testing/lisp/test-org-info.el
index df0ef3195..47dbaa1d9 100644
--- a/testing/lisp/test-org-info.el
+++ b/testing/lisp/test-org-info.el
@@ -21,7 +21,7 @@
(ert-deftest test-org-info/export ()
"Test `org-info-export' specifications."
- ;; Regular export to HTML, with node. Without node, refer to "Top".
+ ;; Export to HTML. Without node, refer to "Top".
(should
(equal (org-info-export "filename#node" nil 'html)
"filename#node"))
@@ -49,7 +49,14 @@
(equal "A-node-_002d_002d_002d-with-_005f_0027_0025"
(let ((name (org-info-export "#A node --- with _'%" nil 'html)))
(and (string-match "#\\(.*\\)\"" name)
- (match-string 1 name))))))
+ (match-string 1 name)))))
+ ;; Export to Texinfo. Without a node name, refer to "Top".
+ (should
+ (equal (org-info-export "filename" nil 'texinfo)
+ "@ref{Top,,,filename,}"))
+ (should
+ (equal (org-info-export "filename#node" nil 'texinfo)
+ "@ref{node,,,filename,}")))