From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Re: Jump to autoconf macro documentation Date: Mon, 31 Jan 2011 11:18:01 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296469466 11181 80.91.229.12 (31 Jan 2011 10:24:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 Jan 2011 10:24:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 31 11:24:22 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pjqvi-0000dD-FJ for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jan 2011 11:24:22 +0100 Original-Received: from localhost ([127.0.0.1]:36786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjqvh-0004Wk-6L for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jan 2011 05:24:17 -0500 Original-Received: from [140.186.70.92] (port=39206 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjqpu-0001bc-DP for help-gnu-emacs@gnu.org; Mon, 31 Jan 2011 05:18:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pjqpr-0004EJ-Un for help-gnu-emacs@gnu.org; Mon, 31 Jan 2011 05:18:17 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:55993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pjqpr-0004Dq-Gw for help-gnu-emacs@gnu.org; Mon, 31 Jan 2011 05:18:15 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pjqpp-0005y5-4r for help-gnu-emacs@gnu.org; Mon, 31 Jan 2011 11:18:13 +0100 Original-Received: from ip1-201.halifax.rwth-aachen.de ([137.226.108.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jan 2011 11:18:13 +0100 Original-Received: from andrea.crotti.0 by ip1-201.halifax.rwth-aachen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jan 2011 11:18:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 74 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip1-201.halifax.rwth-aachen.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:SASXJjgagGd1bbSgVVaQyoy8vNE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78866 Archived-At: Le Wang writes: > You haven't said why it doesn't work. Maybe you need to look into error > handling? > http://www.gnu.org/software/emacs/elisp/html_node/Handling-Errors.html > In the future, please try harder to use the built-in help system *and* > Google first before posting to this list. This list should not be your > first line of defense when you come across an issue. > Also when you post your issue, describe it in detail; and demonstrate that > you've tried the obvious avenues to resolve it yourself, i.e. describe > your attempts at solving the problem, and why you are stuck > "I thought the issue might be xxx, so I tried A, B and C. But now I'm > stuck." > Giving more details will help others in the future who Google similar > issues, It also shows people that you are sincere and willing to invest > your own time before bothering others. > People who persistently spray terse "stream of thought" style questions > into mailing lists get filtered out. I like it when people show respect > for others' time. > Please understand that I'm not trying to offend you, just trying to help > you get more answers to your questions in the future. Yes sorry you're right, I was half sleeping and I just wanted to write something but it wasn't complete. Anyway I think I added some nice features: --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)))) (or (get-autoconf-macro-local macro) (lookup-in-info "autoconf" macro) (lookup-in-info "automake" macro) (google-it macro)))) (defun lookup-in-info (section string) "lookup string in the given section" (info section (format "*%s*<%s>" section string)) (condition-case nil (Info-index string) (error nil))) (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) (condition-case nil (search-forward (format "AC_DEFUN([%s])" macro)) (error nil)) nil)))) (add-hook 'autoconf-mode-hook (lambda () (local-set-key "\C-j" 'get-autoconf-macro-definition))) --8<---------------cut here---------------end--------------->8--- So it tries before in aclocal.m4, then autoconf macros, then automake macros and then looking up with google. Not sure that using or is the best thing but it works fine in this case... But why in the "condition-case" I need to do "(error nil)" instead of just "nil" when I return false?