* [bug] error on RET in read-only buffer with org-return-follows-link set to t
@ 2020-05-14 19:40 Gregor Zattler
2020-05-14 21:28 ` Nicolas Goaziou
2020-05-14 21:32 ` Kévin Le Gouguec
0 siblings, 2 replies; 6+ messages in thread
From: Gregor Zattler @ 2020-05-14 19:40 UTC (permalink / raw)
To: emacs-orgmode, Kévin Le Gouguec
Dear Kévin, org-mode developers,
with `org-return-follows-link` set to `t` in a read-only
buffer I now get a `Buffer is read-only: #<buffer
notmuch-startpage.org>` error when pressing ENTER/RETURN
with point on an org-mode link.
This used to work (opening the org-mode link) till
d3e6b58004997c5a9eeea82f96723c0f74480ab8 is the first bad commit
commit d3e6b58004997c5a9eeea82f96723c0f74480ab8
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Tue May 5 19:01:07 2020 +0200
Make RET and C-j obey `electric-indent-mode'
* lisp/org-compat.el (org-return-indent): Deprecate this command.
* lisp/org-keys.el (org-mode-map): Rebind C-j to a command emulating
`electric-newline-and-maybe-indent'.
* lisp/org.el (org-cdlatex-environment-indent): Stop using the now
obsolete function.
(org--newline): New helper function.
(org-return): Use it to transparently handle `electric-indent-mode'.
(org-return-and-maybe-indent): New command to emulate
`electric-newline-and-maybe-indent' while taking care of Org special
cases (tables, links, timestamps).
* testing/lisp/test-org.el (test-org/with-electric-indent,
test-org/without-electric-indent): New tests.
* testing/org-test.el (org-test-with-minor-mode): New helper to set a
minor mode to a specific state, and reset it afterward.
:040000 040000 85f261b701133d4be047c1a2e8872b25f3e0c7e7 21fe88d69e48ac3d24d233cbf07fe0084cde853e M etc
:040000 040000 a677d2134361d2b023f252c188aebdeef9826896 4bdbb34abe7eaad343932d33a03c823b2cae0e24 M lisp
:040000 040000 9ecba96d2748f0e7ff5430ec0fcf8c175875621f f6e7b54445ac19d1b7c59d4d54bd9b4a19126245 M testing
I use this dozens of times a day and it would be convenient
if it was possible to resurrect the old behaviour.
Thanks for your attention and for developing org-mode,
Gregor
--
-... --- .-. . -.. ..--.. ...-.-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t
2020-05-14 19:40 [bug] error on RET in read-only buffer with org-return-follows-link set to t Gregor Zattler
@ 2020-05-14 21:28 ` Nicolas Goaziou
2020-05-14 21:57 ` Kévin Le Gouguec
2020-05-14 21:32 ` Kévin Le Gouguec
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2020-05-14 21:28 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Kévin Le Gouguec
Hello,
Gregor Zattler <telegraph@gmx.net> writes:
> with `org-return-follows-link` set to `t` in a read-only
> buffer I now get a `Buffer is read-only: #<buffer
> notmuch-startpage.org>` error when pressing ENTER/RETURN
> with point on an org-mode link.
Fixed. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t
2020-05-14 21:28 ` Nicolas Goaziou
@ 2020-05-14 21:57 ` Kévin Le Gouguec
2020-05-14 22:49 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Kévin Le Gouguec @ 2020-05-14 21:57 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Gregor Zattler <telegraph@gmx.net> writes:
>
>> with `org-return-follows-link` set to `t` in a read-only
>> buffer I now get a `Buffer is read-only: #<buffer
>> notmuch-startpage.org>` error when pressing ENTER/RETURN
>> with point on an org-mode link.
>
> Fixed. Thank you.
Thanks for fixing this Nicolas, and for adding a unit test.
Shouldn't the call to org-return be wrapped in (call-interactively …)
though? Since the problem was with the interactive spec, org-return
will work (i.e. follow links) in read-only buffers if called
programmatically, so the test will fail to catch a regression if I'm not
mistaken.
IOW: if I revert the fix, the new test still passes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t
2020-05-14 19:40 [bug] error on RET in read-only buffer with org-return-follows-link set to t Gregor Zattler
2020-05-14 21:28 ` Nicolas Goaziou
@ 2020-05-14 21:32 ` Kévin Le Gouguec
1 sibling, 0 replies; 6+ messages in thread
From: Kévin Le Gouguec @ 2020-05-14 21:32 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
Gregor Zattler <telegraph@gmx.net> writes:
> Dear Kévin, org-mode developers,
>
> with `org-return-follows-link` set to `t` in a read-only
> buffer I now get a `Buffer is read-only: #<buffer
> notmuch-startpage.org>` error when pressing ENTER/RETURN
> with point on an org-mode link.
Oh, right, I added '*' to org-return's interactive spec because I was
mimicking newline's; I had not considered the link-following case.
Should be a simple matter of removing this '*' if I'm not mistaken:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-ret-link.patch --]
[-- Type: text/x-patch, Size: 516 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
> I use this dozens of times a day and it would be convenient
> if it was possible to resurrect the old behaviour.
Right, terribly sorry for this blunder. I'll try to followup with a
unit test to make sure such a regression doesn't creep in again.
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-15 13:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-14 19:40 [bug] error on RET in read-only buffer with org-return-follows-link set to t Gregor Zattler
2020-05-14 21:28 ` Nicolas Goaziou
2020-05-14 21:57 ` Kévin Le Gouguec
2020-05-14 22:49 ` Nicolas Goaziou
[not found] ` <87a72a6sj6.fsf@nicolasgoaziou.Freitag>
2020-05-15 12:54 ` Gregor Zattler
2020-05-14 21:32 ` Kévin Le Gouguec
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.