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 <telegraph@gmx.net>
<http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00247.html>
This commit is contained in:
Nicolas Goaziou 2020-05-14 23:23:28 +02:00
parent 37a5020bbe
commit 99bb514f7f
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -1216,6 +1216,15 @@
(org-link-search-must-match-exact-headline nil))
(org-return))
(looking-at-p "<<target>>")))
;; Non-nil `org-return-follows-link' ignores read-only state of
;; a buffer.
(should
(org-test-with-temp-text "Link [[target<point>]] <<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 "<<target>>")))
;; `org-return-follows-link' handle multi-line lines.
(should
(org-test-with-temp-text