[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Jump to autoconf macro documentation
From: |
Andrea Crotti |
Subject: |
Re: Jump to autoconf macro documentation |
Date: |
Mon, 31 Jan 2011 01:02:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) |
To be more complete I thought that I could do the following thing, first I try
to look for the macro definition in aclocal.m4, and if it's not there I try in
the Info page.
So I came up with something like
--8<---------------cut here---------------start------------->8---
(setq autoconf-macro-syntax-table (make-syntax-table))
(modify-syntax-entry ?_ "w" autoconf-macro-syntax-table)
(defun get-autoconf-macro-definition ()
"jump to the definition of a macro"
(interactive)
(let
((macro (with-syntax-table autoconf-macro-syntax-table (thing-at-point
'word))))
(unless (get-autoconf-macro-local macro)
(info "autoconf" (concat "*autconf*<" macro ">"))
(Info-index macro))))
(defun get-autoconf-macro-local (macro)
"Look for the definition of the macro in aclocal.m4 before"
(let
((local-macro-file "aclocal.m4"))
(if (file-exists-p local-macro-file)
(save-excursion
(find-file local-macro-file)
(search-forward (format "AC_DEFUN([%s])" macro)))
nil)))
(add-hook 'autoconf-mode-hook
(lambda ()
(local-set-key "\C-j" 'get-autoconf-macro-definition)))
--8<---------------cut here---------------end--------------->8---
What doesn't work yet is how to return false (and thus return to the previous
state in case
the macro is not found anywhere.
And I should give an error message if I don't find the macro with Info-index as
well, any idea?