From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.help Subject: Re: Jump to autoconf macro documentation Date: Mon, 31 Jan 2011 08:46:59 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba6150a8e19d92049b19c0bf X-Trace: dough.gmane.org 1296436533 11871 80.91.229.12 (31 Jan 2011 01:15:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 Jan 2011 01:15:33 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Andrea Crotti Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 31 02:15:29 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 1PjiMX-0005V7-Ja for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Jan 2011 02:15:27 +0100 Original-Received: from localhost ([127.0.0.1]:51404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjhzu-0005Py-PU for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Jan 2011 19:52:02 -0500 Original-Received: from [140.186.70.92] (port=36088 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjhvA-00036M-Rj for help-gnu-emacs@gnu.org; Sun, 30 Jan 2011 19:47:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pjhv6-0005xa-CB for help-gnu-emacs@gnu.org; Sun, 30 Jan 2011 19:47:05 -0500 Original-Received: from mail-ey0-f169.google.com ([209.85.215.169]:50224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pjhv6-0005xQ-4D for help-gnu-emacs@gnu.org; Sun, 30 Jan 2011 19:47:04 -0500 Original-Received: by eyh6 with SMTP id 6so2220901eyh.0 for ; Sun, 30 Jan 2011 16:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=VlQfutCNupkc5luB/mZU1Bxgh9+DQXcd6qesJQ6L5gs=; b=DCGmHSg+2vtFa/Rljcmgbua1j9a7bHvKoMAkJOG4dPta9V03vmCl8sALpnylSq3FYv OuLl8KYo3BpUeG0h2x7B2WiIu4kg6urt6KLRkTu/H9hS9tNW3fCztZtlqfuZdo2jq6gk exWqLF27MSjGKvGCIBGB0do8nWa7SnY2l3s/w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Z14qu0rY2OLEDZTqO6yE0ALN8r8mLzNng1EVgpYBnk3l3PS3hptWfxMbBzEfIuIAp4 7YpYs4jifuCRhZLoqYN8sqVWYgyo0uOQSQU7wqLn+ydDIOiZMEOZoycM4hc9YgPqe8c6 V1GnvqyI7qlMoqBCmDJsCm7cbZnvqJQZE25VU= Original-Received: by 10.14.37.134 with SMTP id y6mr5813755eea.45.1296434819341; Sun, 30 Jan 2011 16:46:59 -0800 (PST) Original-Received: by 10.14.119.11 with HTTP; Sun, 30 Jan 2011 16:46:59 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.215.169 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:78863 Archived-At: --90e6ba6150a8e19d92049b19c0bf Content-Type: text/plain; charset=ISO-8859-1 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. On Mon, Jan 31, 2011 at 8:02 AM, Andrea Crotti wrote: > 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? > > > -- Le --90e6ba6150a8e19d92049b19c0bf Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You haven't said why it doesn't work. =A0Maybe you need to loo= k into error handling?

http://www.gnu.org/softw= are/emacs/elisp/html_node/Handling-Errors.html

In the future, please try harder to use the buil= t-in help system *and* Google first before posting to this list. =A0This li= st should not be your first line of defense when you come across an issue.<= /div>

Also when you post your issue, describe it in detail; a= nd demonstrate that you've tried the obvious avenues to resolve it your= self, i.e. describe your attempts at solving the problem, and why you are s= tuck

"I thought the issue might be xxx, so I tried A, B= and C. =A0But now I'm stuck."=A0

Giving = more details will help others in the future who Google similar issues, It a= lso shows people that you are sincere and willing to invest your own time b= efore bothering others.

People who persistently spray terse "stream of tho= ught" style questions into mailing lists get filtered out. =A0I like i= t when people show respect for others' time.

Please understand that I'm not trying to offend you, just trying to hel= p you get more answers to your questions in the future.


On Mon, Jan 31, 2011 at 8:02 AM, Andre= a Crotti <andrea.crotti.0@gmail.com> wrote:
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---

=A0(setq autoconf-macro-syntax-table (make-syntax-table))
=A0(modify-syntax-entry ?_ "w" autoconf-macro-syntax-table)

=A0(defun get-autoconf-macro-definition ()
=A0 =A0"jump to the definition of a macro"
=A0 =A0(interactive)
=A0 =A0(let
=A0 =A0 =A0 =A0((macro (with-syntax-table autoconf-macro-syntax-table (thi= ng-at-point 'word))))
=A0 =A0 =A0(unless (get-autoconf-macro-local macro)
=A0 =A0 =A0 =A0(info "autoconf" (concat "= *autconf*<" macro ">"))
=A0 =A0 =A0 =A0(Info-index macro))))

=A0(defun get-autoconf-macro-local (macro)
=A0 =A0"Look for the definition of the macro in aclocal.m4 before&quo= t;
=A0 =A0(let
=A0 =A0 =A0 =A0((local-macro-file "aclocal.m4"))
=A0 =A0 =A0(if (file-exists-p local-macro-file)
=A0 =A0 =A0 =A0 =A0(save-excursion
=A0 =A0 =A0 =A0 =A0 =A0(find-file local-macro-file)
=A0 =A0 =A0 =A0 =A0 =A0(search-forward (format "AC_DEFUN([%s])" = macro)))
=A0 =A0 =A0 =A0nil)))

=A0(add-hook 'autoconf-mode-hook
=A0 =A0 =A0 =A0 =A0 =A0(lambda ()
=A0 =A0 =A0 =A0 =A0 =A0 =A0(local-set-key "\C-j" 'get-autoco= nf-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?





--
Le
--90e6ba6150a8e19d92049b19c0bf--