Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-15 Thread Gregor Zattler
Hi Nicolas, Kévin,

thanks to both of you: It works again for me.

Ciao; Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-
* Nicolas Goaziou  [2020-05-15; 00:49]:
> Kévin Le Gouguec  writes:
>
>> Shouldn't the call to org-return be wrapped in (call-interactively …)
>> though?
>
> Indeed. Done. Thank you.




Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-14 Thread Nicolas Goaziou
Hello,

Kévin Le Gouguec  writes:

> Shouldn't the call to org-return be wrapped in (call-interactively …)
> though?

Indeed. Done. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-14 Thread Kévin Le Gouguec
Nicolas Goaziou  writes:

> Hello,
>
> Gregor Zattler  writes:
>
>> with `org-return-follows-link` set to `t` in a read-only
>> buffer I now get a `Buffer is read-only: #> 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.



Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-14 Thread Kévin Le Gouguec
Gregor Zattler  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: # 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:

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

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


Re: [bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-14 Thread Nicolas Goaziou
Hello,

Gregor Zattler  writes:

> with `org-return-follows-link` set to `t` in a read-only
> buffer I now get a `Buffer is read-only: # notmuch-startpage.org>` error when pressing ENTER/RETURN
> with point on an org-mode link.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[bug] error on RET in read-only buffer with org-return-follows-link set to t

2020-05-14 Thread Gregor Zattler
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: #` 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 
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.

:04 04 85f261b701133d4be047c1a2e8872b25f3e0c7e7 
21fe88d69e48ac3d24d233cbf07fe0084cde853e M  etc
:04 04 a677d2134361d2b023f252c188aebdeef9826896 
4bdbb34abe7eaad343932d33a03c823b2cae0e24 M  lisp
:04 04 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 
-- 
 -... --- .-. . -.. ..--.. ...-.-