From: Paul Sexton <psexton@xnet.co.nz>
To: emacs-orgmode@gnu.org
Subject: Re: Integrating ctags & org mode (patch)
Date: Tue, 15 Dec 2009 19:58:03 +0000 (UTC) [thread overview]
Message-ID: <loom.20091215T205247-286@post.gmane.org> (raw)
In-Reply-To: 2AC5C31A-0ABA-4163-9F4F-9F0D26A6F538@gmail.com
Carsten Dominik <carsten.dominik <at> gmail.com> writes:
>
> Hi Paul,
>
> I like this very much. But I would like to change the implementation
> so that
> there will be a hook. Then people can do different things, including
> matching tags in source code files etc.
>
> Would you be interested to turn your way of doing things into a little
> add-on
> that people could load? I realize that it would be a very small file
> because the heavy lifting is done by the tags creating file and Emacs
> ctags searches. But it would keep the way open for other ideas.
>
> If you agree I will make a new hook and interface for this.
>
> I would be very interested to include the new module (if you write it)
> at least as a contributed package, or, if you are willing
> to sign the papers with the FSF, in the core.
>
I'm glad you like it. I would be happy for it to be included in the core.
Re your followup to this post: I have written a function which takes a tag name
and returns the file where it is found:
(defun get-filename-for-tag (tag)
"TAG is a string. Search the active TAGS file for a matching tag,
and if found, return a list containing the filename, line number, and
buffer position where the tag is found."
(unless tags-file-name
(visit-tags-file-buffer))
(with-current-buffer (get-file-buffer tags-file-name)
(beginning-of-buffer)
(cond
;; In the following line, the special characters on either side of
;; the %s should be ASCII 127 (^?) and ASCII 1 (^A)
((re-search-forward (format "^.*\x7f%s\x01\\([0-9]+\\),\\([0-9]+\\)$"
(regexp-quote tag)) nil t)
(let ((line (string-to-number (match-string 1)))
(pos (string-to-number (match-string 2))))
(cond
((re-search-backward "\f\n\\(.*\\),[0-9]+\n")
(list (match-string 1) line pos))
(t ; can't find a file name preceding the matched tag??
(error "Malformed TAGS file: %s" (buffer-name))))))
(t ; tag not found
nil))))
next prev parent reply other threads:[~2009-12-15 19:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 3:02 Integrating ctags & org mode (patch) Paul Sexton
2009-12-15 3:41 ` Bill Powell
2009-12-15 7:20 ` Carsten Dominik
2009-12-15 14:29 ` Carsten Dominik
2009-12-15 19:58 ` Paul Sexton [this message]
2009-12-15 20:36 ` Paul Sexton
2009-12-15 21:08 ` Paul Sexton
2009-12-15 21:33 ` Nick Dokos
2009-12-15 22:06 ` Óscar Fuentes
2009-12-18 16:00 ` Carsten Dominik
2010-02-06 0:10 ` Samuel Wales
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=loom.20091215T205247-286@post.gmane.org \
--to=psexton@xnet.co.nz \
--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).