From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Sexton Subject: Re: Integrating ctags & org mode (patch) Date: Tue, 15 Dec 2009 19:58:03 +0000 (UTC) Message-ID: References: <2AC5C31A-0ABA-4163-9F4F-9F0D26A6F538@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKdXe-0008Q1-Jx for emacs-orgmode@gnu.org; Tue, 15 Dec 2009 14:58:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKdXZ-0008Mv-5m for emacs-orgmode@gnu.org; Tue, 15 Dec 2009 14:58:42 -0500 Received: from [199.232.76.173] (port=42574 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKdXY-0008Ms-W6 for emacs-orgmode@gnu.org; Tue, 15 Dec 2009 14:58:37 -0500 Received: from lo.gmane.org ([80.91.229.12]:37700) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NKdXY-0002gg-9j for emacs-orgmode@gnu.org; Tue, 15 Dec 2009 14:58:36 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NKdXR-0002ul-E3 for emacs-orgmode@gnu.org; Tue, 15 Dec 2009 20:58:34 +0100 Received: from rp.young.med.auckland.ac.nz ([130.216.140.20]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Dec 2009 20:58:29 +0100 Received: from psexton by rp.young.med.auckland.ac.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Dec 2009 20:58:29 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Carsten Dominik 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 "^.*%s\\([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 " \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))))