emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-ctags: Fix regexp to not break radio targets
@ 2024-02-11 18:00 Martin Marshall
  2024-02-12 14:05 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Marshall @ 2024-02-11 18:00 UTC (permalink / raw)
  To: emacs-orgmode

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

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

end of thread, other threads:[~2024-02-24 13:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 18:00 [PATCH] org-ctags: Fix regexp to not break radio targets Martin Marshall
2024-02-12 14:05 ` 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

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