emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-store-link and help for a key
@ 2020-09-09 14:54 Maxim Nikulin
  2020-09-10  3:32 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Nikulin @ 2020-09-09 14:54 UTC (permalink / raw)
  To: emacs-orgmode

Either I missed something obvious or org-store-link from a help page for 
a keystroke works incorrectly

Let's try to save a link to the *keystroke* help for e.g. org-insert-link:

1. Open help page with =C-h k C-c C-l=
2. Switch to the help buffer =C-x o=
3. Store link =M-x org-store-link RET=
4. Switch back to the org file =C-x o=
5. Insert link =C-c C-l RET RET=

I get =[[help:C-c]]= and an error if I try to follow the link with =C-c C-o=

     user-error: Unknown function or variable: C-c

If I ask a help page for the *function*

1b, =C-h f org-insert-link RET=

I get the working link =[[help:org-inser-link]]=. I expect the similar 
result for the keystroke help link or maybe something special that leads 
to the description of the current keystroke binding.

Such behavior exists for ages, at least since 8.2.10 till current master.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2020-09-09 14:54 org-store-link and help for a key Maxim Nikulin
@ 2020-09-10  3:32 ` Ihor Radchenko
  2020-09-13 20:01   ` Bastien
  2021-04-27 14:25   ` Bastien
  0 siblings, 2 replies; 9+ messages in thread
From: Ihor Radchenko @ 2020-09-10  3:32 UTC (permalink / raw)
  To: Maxim Nikulin, emacs-orgmode

> Such behavior exists for ages, at least since 8.2.10 till current master.

I can reproduce this.

The reason of error is simple: help buffers for key combinations where
not considered when writing help: link type.
Current code does not even store the link to such help buffers correctly
- when the key sequence has more than a single key only the first key
will be stored (tested in <f1> k <f1> k help buffer).
The code to open help: link type also does not know that help: link can
point to anything other than function or variable.

I can see two solutions:

1. Avoid storing links to help buffers describing key sequences. Show
   error when trying to store such link instead
2. Write proper handlers for storing and following links to help buffers
   other than just function/variable help (in addition to key sequence
   help buffers, org-store/follow-link also fails to work with
   describe-face buffers at least)
   To do this, one need to change org-link--open-help and org-store-link
   (see "(eq major-mode 'help-mode)" line).

Patches are welcome.

P.S. Would it be cleaner to have separate :store link properties for
standard link types instead of hard-coding them into org-store-link?

Best,
Ihor


Maxim Nikulin <manikulin@gmail.com> writes:

> Either I missed something obvious or org-store-link from a help page for 
> a keystroke works incorrectly
>
> Let's try to save a link to the *keystroke* help for e.g. org-insert-link:
>
> 1. Open help page with =C-h k C-c C-l=
> 2. Switch to the help buffer =C-x o=
> 3. Store link =M-x org-store-link RET=
> 4. Switch back to the org file =C-x o=
> 5. Insert link =C-c C-l RET RET=
>
> I get =[[help:C-c]]= and an error if I try to follow the link with =C-c C-o=
>
>      user-error: Unknown function or variable: C-c
>
> If I ask a help page for the *function*
>
> 1b, =C-h f org-insert-link RET=
>
> I get the working link =[[help:org-inser-link]]=. I expect the similar 
> result for the keystroke help link or maybe something special that leads 
> to the description of the current keystroke binding.
>
> Such behavior exists for ages, at least since 8.2.10 till current master.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2020-09-10  3:32 ` Ihor Radchenko
@ 2020-09-13 20:01   ` Bastien
  2020-09-14  7:21     ` Ihor Radchenko
  2021-04-27 14:25   ` Bastien
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2020-09-13 20:01 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Maxim Nikulin, emacs-orgmode

Thanks Maxim for reporting this...

Ihor Radchenko <yantar92@gmail.com> writes:

>> Such behavior exists for ages, at least since 8.2.10 till current master.
>
> I can reproduce this.

... and Ihor for reproducing/confirming the bug.

Ihor, if you add a "X-Woof-Bug: confirmed" header to your reply, your
message will make it through https://updates.orgmode.org - I'm adding
this header to this very message as an example.

Best,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2020-09-13 20:01   ` Bastien
@ 2020-09-14  7:21     ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2020-09-14  7:21 UTC (permalink / raw)
  To: Bastien; +Cc: Maxim Nikulin, emacs-orgmode

> Ihor, if you add a "X-Woof-Bug: confirmed" header to your reply, your
> message will make it through https://updates.orgmode.org - I'm adding
> this header to this very message as an example.

Noted.



Bastien <bzg@gnu.org> writes:

> Thanks Maxim for reporting this...
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>>> Such behavior exists for ages, at least since 8.2.10 till current master.
>>
>> I can reproduce this.
>
> ... and Ihor for reproducing/confirming the bug.
>
> Ihor, if you add a "X-Woof-Bug: confirmed" header to your reply, your
> message will make it through https://updates.orgmode.org - I'm adding
> this header to this very message as an example.
>
> Best,
>
> -- 
>  Bastien


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2020-09-10  3:32 ` Ihor Radchenko
  2020-09-13 20:01   ` Bastien
@ 2021-04-27 14:25   ` Bastien
  2021-04-27 14:44     ` Maxim Nikulin
  1 sibling, 1 reply; 9+ messages in thread
From: Bastien @ 2021-04-27 14:25 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Maxim Nikulin, emacs-orgmode

Hi Maxim and Ihor,

Ihor Radchenko <yantar92@gmail.com> writes:

>> Such behavior exists for ages, at least since 8.2.10 till current master.
>
> I can reproduce this.
>
> The reason of error is simple: help buffers for key combinations where
> not considered when writing help: link type.
> Current code does not even store the link to such help buffers correctly
> - when the key sequence has more than a single key only the first key
> will be stored (tested in <f1> k <f1> k help buffer).
> The code to open help: link type also does not know that help: link can
> point to anything other than function or variable.
>
> I can see two solutions:
>
> 1. Avoid storing links to help buffers describing key sequences. Show
>    error when trying to store such link instead

Even though storing links to help buffers describing key bindings is
tempting, there is no way to recreate such buffers only based on the
key string, because keys are contextual.

In org-mode, C-h k C-a will describe org-beginning-of-line while in
other modes it will probably describe beginning-of-line.

So we cannot really write a proper handler for these links and the
user error is correct here.

I'm closing this bug report now.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2021-04-27 14:25   ` Bastien
@ 2021-04-27 14:44     ` Maxim Nikulin
  2021-04-27 15:52       ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Nikulin @ 2021-04-27 14:44 UTC (permalink / raw)
  To: emacs-orgmode

On 27/04/2021 21:25, Bastien wrote:
> 
> Even though storing links to help buffers describing key bindings is
> tempting, there is no way to recreate such buffers only based on the
> key string, because keys are contextual.
> 
> In org-mode, C-h k C-a will describe org-beginning-of-line while in
> other modes it will probably describe beginning-of-line.
> 
> So we cannot really write a proper handler for these links and the
> user error is correct here.
> 
> I'm closing this bug report now.

I have looked into the code storing and handling links yet, so I am 
unaware what is possible and what is not. My expectation is to get link 
to org-beginning-of-line if help is invoked from an org buffer and link 
to beginning-of-line if I came to the help page from some other file. I 
do not know whether associated function may be obtained for a help 
buffer opened for keystroke.

Maybe I will look at this issue later, so I do not mind that the bug is 
closed.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2021-04-27 14:44     ` Maxim Nikulin
@ 2021-04-27 15:52       ` Nicolas Goaziou
  2021-04-27 16:41         ` Maxim Nikulin
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-04-27 15:52 UTC (permalink / raw)
  To: Maxim Nikulin; +Cc: emacs-orgmode

Hello,

Maxim Nikulin <manikulin@gmail.com> writes:

> On 27/04/2021 21:25, Bastien wrote:
>> Even though storing links to help buffers describing key bindings is
>> tempting, there is no way to recreate such buffers only based on the
>> key string, because keys are contextual.
>> In org-mode, C-h k C-a will describe org-beginning-of-line while in
>> other modes it will probably describe beginning-of-line.
>> So we cannot really write a proper handler for these links and the
>> user error is correct here.
>> I'm closing this bug report now.
>
> I have looked into the code storing and handling links yet, so I am
> unaware what is possible and what is not. My expectation is to get
> link to org-beginning-of-line if help is invoked from an org buffer
> and link to beginning-of-line if I came to the help page from some
> other file. I do not know whether associated function may be obtained
> for a help buffer opened for keystroke.

I did this on master. I only tested it lightly.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2021-04-27 15:52       ` Nicolas Goaziou
@ 2021-04-27 16:41         ` Maxim Nikulin
  2021-04-27 20:01           ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Nikulin @ 2021-04-27 16:41 UTC (permalink / raw)
  To: emacs-orgmode

On 27/04/2021 22:52, Nicolas Goaziou wrote:
> Maxim Nikulin <manikulin@gmail.com> writes:
>> My expectation is to get
>> link to org-beginning-of-line if help is invoked from an org buffer
>> and link to beginning-of-line if I came to the help page from some
>> other file.
> 
> I did this on master. I only tested it lightly.

Thank you for the fix. Function name is stored for keys as I expected.

Behavior is changed however. Inserting link to a function help page 
previously caused a prompt for description, new version inserts

     [[help:org-refile][help:org-refile]]

without additional query.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-store-link and help for a key
  2021-04-27 16:41         ` Maxim Nikulin
@ 2021-04-27 20:01           ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2021-04-27 20:01 UTC (permalink / raw)
  To: Maxim Nikulin; +Cc: emacs-orgmode

Maxim Nikulin <manikulin@gmail.com> writes:

> On 27/04/2021 22:52, Nicolas Goaziou wrote:
>> Maxim Nikulin <manikulin@gmail.com> writes:
>>> My expectation is to get
>>> link to org-beginning-of-line if help is invoked from an org buffer
>>> and link to beginning-of-line if I came to the help page from some
>>> other file.
>> I did this on master. I only tested it lightly.
>
> Thank you for the fix. Function name is stored for keys as I expected.
>
> Behavior is changed however. Inserting link to a function help page
> previously caused a prompt for description, new version inserts
>
>     [[help:org-refile][help:org-refile]]
>
> without additional query.

This is now fixed. Thanks.

Regards,


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-27 20:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 14:54 org-store-link and help for a key Maxim Nikulin
2020-09-10  3:32 ` Ihor Radchenko
2020-09-13 20:01   ` Bastien
2020-09-14  7:21     ` Ihor Radchenko
2021-04-27 14:25   ` Bastien
2021-04-27 14:44     ` Maxim Nikulin
2021-04-27 15:52       ` Nicolas Goaziou
2021-04-27 16:41         ` Maxim Nikulin
2021-04-27 20:01           ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).