From 99bb514f7fce8aade73fed257417575a5121299e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 14 May 2020 23:23:28 +0200 Subject: [PATCH] Follow links with RET even in read-only buffers * lisp/org.el (org-return): Fix `interactive' arguments. * testing/lisp/test-org.el (test-org/return): Add test. Reported-by: Gregor Zattler --- lisp/org.el | 2 +- testing/lisp/test-org.el | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index be1d1c701..339418314 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17702,7 +17702,7 @@ a timestamp or a link, call `org-open-at-point'. However, it will not happen if point is in a table or on a \"dead\" object (e.g., within a comment). In these case, you need to use `org-open-at-point' directly." - (interactive "*i\nP\np") + (interactive "i\nP\np") (let ((context (if org-return-follows-link (org-element-context) (org-element-at-point)))) (cond diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index a0f505cbc..98d7abf4a 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -1216,6 +1216,15 @@ (org-link-search-must-match-exact-headline nil)) (org-return)) (looking-at-p "<>"))) + ;; Non-nil `org-return-follows-link' ignores read-only state of + ;; a buffer. + (should + (org-test-with-temp-text "Link [[target]] <>" + (let ((org-return-follows-link t) + (org-link-search-must-match-exact-headline nil)) + (setq buffer-read-only t) + (org-return)) + (looking-at-p "<>"))) ;; `org-return-follows-link' handle multi-line lines. (should (org-test-with-temp-text