From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Jump to autoconf macro documentation
Date: Mon, 31 Jan 2011 11:18:01 +0100 [thread overview]
Message-ID: <m1lj21z89y.fsf@82-089.eduroam.rwth-aachen.de> (raw)
In-Reply-To: AANLkTikRyLQYWFGvJGyQeYVipVr8Odq+n8-ne-uoxJi6@mail.gmail.com
Le Wang <l26wang@gmail.com> 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?
next prev parent reply other threads:[~2011-01-31 10:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-30 10:47 Jump to autoconf macro documentation Andrea Crotti
2011-01-30 15:09 ` Le Wang
2011-01-30 16:03 ` Andrea Crotti
2011-01-30 16:09 ` Thien-Thi Nguyen
2011-01-30 16:16 ` Kevin Rodgers
2011-01-30 17:31 ` Andrea Crotti
2011-01-31 0:02 ` Andrea Crotti
2011-01-31 0:46 ` Le Wang
2011-01-31 10:18 ` Andrea Crotti [this message]
2011-01-31 10:31 ` Thien-Thi Nguyen
2011-01-31 22:11 ` Kevin Rodgers
[not found] <mailman.1.1296384469.21090.help-gnu-emacs@gnu.org>
2011-01-31 16:14 ` Stefan Monnier
2011-01-31 23:19 ` Andrea Crotti
2011-02-01 15:24 ` Oleksandr Gavenko
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1lj21z89y.fsf@82-089.eduroam.rwth-aachen.de \
--to=andrea.crotti.0@gmail.com \
--cc=help-gnu-emacs@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.
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).