[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] open link in source code block

From: Win Treese
Subject: Re: [O] open link in source code block
Date: Sat, 5 Jan 2019 10:41:20 -0500

> On Jan 5, 2019, at 5:25 AM, Eric S Fraga <address@hidden> wrote:
> On Friday,  4 Jan 2019 at 19:38, Win Treese wrote:
>> Suppose I have the following Org file contents:
>> * test
>> #+BEGIN_SRC emacs-lisp
>> (setq yyy 3)
>> ;; See https://www.gnu.org
>> #+END_SRC
>> The URL for gnu.org is highlighted as a clickable link. But if I click
>> it, the source block is evaluated. This seems rather unexpected,
>> especially since my intention was to open the link.
> Probably expected albeit maybe not your preferred behaviour; all about
> precedence.  In any case, I would suggest that the easy solution would
> be to move such links out of the src block.  I usually put these as org
> comments, along the lines of
> # See https://www.gnu.org
> #+BEGIN_SRC emacs-lisp
> (setq yyy 3)
> My approach to literate programming is to have no (significant) comments
> in the code segments themselves.  Each code block is small and has all
> commentary in the text, not the code.

Thanks for the note, Eric.

I think the style you describe is good in most cases. I stumbled over this in a
more complicated situation in which rearranging things doesn’t work.

This seems like a slightly bigger problem, though: clicking on a highlighted
link doesn’t just fail to open the link, it executes the source block, which can
have very unintended side effects.

I wonder if the issue is an artifact of implementation rather than intentional
design: org-open-at-mouse sets point to the location of the click and then
calls org-open-at-point. The documentation at points says that C-c C-o in 
a source block opens the results of evaluation (fair enough, although the
docstring does not).

So the problem seems to be about the mouse click behavior, not the basic
function of org-open-at-point.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]