From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: browser for bash scripts?
Date: Sat, 01 Dec 2012 13:28:16 +0200 [thread overview]
Message-ID: <87txs6106n.fsf@gavenkoa.example.com> (raw)
In-Reply-To: jwvobifugrm.fsf-monnier+gnu.emacs.help@gnu.org
On 2012-11-30, Stefan Monnier wrote:
> TR> Does anyone have code to make speedbar, ECB, or other code browser
> TR> display/navigate bash scripts?
>
> `sh-script.el' already provides support for `imenu', so Speedbar should
> already find the functions in the bash scripts, or at least there should
> be very little preventing it from happening.
>
I found imenu very useful. Especially when it driven by keyboard instead of
mouse:
(defun my-popup-menu ()
"Menu from keyboard by emulating mouse event."
(interactive)
(mouse-popup-menubar
(list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
nil)
)
(global-set-key [f10] 'my-popup-menu)
(global-set-key [apps] 'my-popup-menu)
(global-set-key [menu] 'my-popup-menu)
(require 'imenu)
(defun my-imenu-to-menubar ()
"Force imenu building when (menu-bar-mode -1)."
(when imenu-generic-expression
(imenu-add-menubar-index)
(run-hooks 'menu-bar-update-hook) ))
(mapc (lambda (hook) (add-hook hook 'my-imenu-to-menubar))
my-devel-mode-hook-list)
> TR> I'd like, e.g., to easily navigate between variable and function
> TR> definitions and calls/uses.
>
> I guess we could add variables to sh-mode's `imenu' support.
>
I think this is useless as bash (and sh) allow local variables.
It will be useful to teach 'semantic-ia-*-jump' jump to definition.
Also modular bash scripts include common parts so definition may come from
another files...
For variable I can suggest to use 'occur' or 'lgrep/rgrep':
(defun my-sh-var-occur ()
(interactive)
(let ( (name (thing-at-point 'symbol)) )
(when name
(occur (concat name "="))) ))
--
Best regards!
next prev parent reply other threads:[~2012-12-01 11:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-04 3:07 browser for bash scripts? Tom Roche
2012-11-29 6:26 ` Easior
[not found] ` <mailman.14117.1354247749.855.help-gnu-emacs@gnu.org>
2012-11-30 17:47 ` Stefan Monnier
2012-11-30 23:02 ` Thorsten Bonow
2012-12-01 11:28 ` Oleksandr Gavenko [this message]
2012-12-03 14:26 ` Doug Lewan
2012-12-03 14:43 ` Doug Lewan
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87txs6106n.fsf@gavenkoa.example.com \
--to=gavenkoa@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.