emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Marshall <law@martinmarshall.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-ctags: Fix regexp to not break radio targets
Date: Sun, 11 Feb 2024 13:00:48 -0500	[thread overview]
Message-ID: <87frxylw33.fsf@martinmarshall.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Fix regexp for radio targets --]
[-- Type: text/x-diff, Size: 920 bytes --]

From 9b9e8ead6c175c76e4f37273a4e4f29b8e41b4f9 Mon Sep 17 00:00:00 2001
From: Martin Marshall <law@martinmarshall.com>
Date: Sun, 11 Feb 2024 12:36:46 -0500
Subject: [PATCH] org-ctags: Fix regexp to not break radio-target links

* org-ctags.el (org-ctags-tag-regexp): Add left angle-bracket to
excluded characters for tag text.
---
 lisp/org-ctags.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-ctags.el b/lisp/org-ctags.el
index e56ed9cd8..6431a2765 100644
--- a/lisp/org-ctags.el
+++ b/lisp/org-ctags.el
@@ -149,7 +149,7 @@
 (defvar org-ctags-enabled-p t
   "Activate ctags support in org mode?")
 
-(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/"
+(defvar org-ctags-tag-regexp "/<<([^<>]+)>>/\\1/d,definition/"
   "Regexp expression used by ctags external program.
 The regexp matches tag destinations in Org files.
 Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/
-- 
2.39.2


[-- Attachment #2: Type: text/plain, Size: 995 bytes --]

This updates `org-ctags-tag-regexp' to avoid adding broken entries for
radio targets in the TAGS file.

With the old regexp, org-ctags would add radio targets to the TAGS file
with an extra angle bracket at the beginning.  So a target of
"<<<radio target>>>" would be entered in the TAGS file as
"<radio target", instead of just "radio target".

This meant that when you click on the linked text "radio target", the
link wouldn't match any of the TAGS file entries.  So org-ctags would
inquire about rebuilding the TAGS file.  Then, when it still couldn't
match the target, it would attempt to be helpful and ask about adding a
new target to the end of your org file.  Only after you declined that,
it would finally allow Org-mode to move point to the radio target as
intended.

This patch allows radio targets to coexist with org-ctags and to even
use them with org-ctags in external files, in the same manner as
dedicated targets.

-- 
Best regards,
Martin Marshall

             reply	other threads:[~2024-02-11 18:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 18:00 Martin Marshall [this message]
2024-02-12 14:05 ` [PATCH] org-ctags: Fix regexp to not break radio targets Ihor Radchenko
2024-02-12 17:19   ` Martin Marshall
2024-02-12 18:32     ` Ihor Radchenko
2024-02-12 19:19       ` Martin Marshall
2024-02-12 19:53         ` Ihor Radchenko
2024-02-12 21:35           ` Martin Marshall
2024-02-24 10:49           ` Bastien Guerry
2024-02-24 13:04             ` 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=87frxylw33.fsf@martinmarshall.com \
    --to=law@martinmarshall.com \
    --cc=emacs-orgmode@gnu.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).