emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ignacio Casso <ignaciocasso@hotmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [BUG] C-c C-o on headline evaluates source code blocks with links inside [9.5.2 (release_9.5.2-25-gaf6f12 @ /home/ignacio/repos/emacs/lisp/org/)]
Date: Thu, 24 Mar 2022 09:02:09 +0100	[thread overview]
Message-ID: <PAXPR06MB77609E8C8E769CD7D769FA4BC6199@PAXPR06MB7760.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <878rt019jq.fsf@hotmail.com>


> The following patch should fix it:
>
> [4. patch --- text/x-diff; 0001-fixed-bug.patch]
> From bc5092fdef512280b7d7d3aa04f1ba887360a759 Mon Sep 17 00:00:00 2001
> From: Ignacio <ignacio.decasso@imdea.org>
> Date: Thu, 24 Mar 2022 01:15:44 +0100
> Subject: [PATCH] fixed bug
>
> ---
>  lisp/org/org.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org/org.el b/lisp/org/org.el
> index 67c8f1cedf..0fff28af81 100644
> --- a/lisp/org/org.el
> +++ b/lisp/org/org.el
> @@ -9063,7 +9063,8 @@ org-offer-links-in-entry
>  	 (org-back-to-heading t)
>  	 (setq end (save-excursion (outline-next-heading) (point)))
>  	 (while (re-search-forward org-link-any-re end t)
> -	   (push (match-string 0) links))
> +           (when (eq (org-element-type (org-element-context)) 'link)
> +	     (push (match-string 0) links)))
>  	 (setq links (org-uniquify (reverse links))))
>         (cond
>  	((null links)

Actually, this fix would suffer from the same problem as the fix for the
issue of org-agenda recognizing timestamps inside source code blocks,
and now links inside property drawers would no longer be opened using
C-c C-o with point on the headline.

So if we want to preserve that behavior the new lines should probably
be

 (when (memq (org-element-type (org-element-context)) '(link node-property))
   (push (match-string 0) links))

or something like that, with probably more element types in the list
beside link and node-property.


       reply	other threads:[~2022-03-24  8:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878rt019jq.fsf@hotmail.com>
2022-03-24  8:02 ` Ignacio Casso [this message]
2022-03-23 23:15 Ignacio Casso
2022-03-26  8:15 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXPR06MB77609E8C8E769CD7D769FA4BC6199@PAXPR06MB7760.eurprd06.prod.outlook.com \
    --to=ignaciocasso@hotmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [BUG] C-c C-o on headline evaluates source code blocks with links inside [9.5.2 (release_9.5.2-25-gaf6f12 @ /home/ignacio/repos/emacs/lisp/org/)]' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).