* browser for bash scripts?
@ 2012-06-04 3:07 Tom Roche
2012-11-29 6:26 ` Easior
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tom Roche @ 2012-06-04 3:07 UTC (permalink / raw)
To: help-gnu-emacs
Does anyone have code to make speedbar, ECB, or other code browser
display/navigate bash scripts? I'd like, e.g., to easily navigate
between variable and function definitions and calls/uses. Currently,
for the latter, I'm `find-grep`ing '^function ': that works, but is
not nearly so pleasant as was speedbar in JDEE (back when I did mostly
java, several years ago).
TIA, Tom Roche <Tom_Roche@pobox.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: browser for bash scripts?
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-12-03 14:26 ` Doug Lewan
2 siblings, 0 replies; 7+ messages in thread
From: Easior @ 2012-11-29 6:26 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: Tom Roche
>>>>> "TR" == Tom Roche <<Tom_Roche@pobox.com>,> writes:
TR> Does anyone have code to make speedbar, ECB, or other code browser
TR> display/navigate bash scripts? I'd like, e.g., to easily navigate
TR> between variable and function definitions and calls/uses. Currently,
TR> for the latter, I'm `find-grep`ing '^function ': that works, but is
TR> not nearly so pleasant as was speedbar in JDEE (back when I did mostly
TR> java, several years ago).
TR> TIA, Tom Roche <Tom_Roche@pobox.com>
It sounds a nice idea. When I read ebuilds which are written by bash
scripts in gentoo linux, I always feel trouble in finding which
function is called in those scripts. If someone could implement it,
the life would be easy for me.
Best regards,
Easior
-----
Ich bin von heute und ehedam, aber etwas ist in mir, das ist vor
morgen und übermorgen und einstmal.
Friedrich Wilhelm Nietzsche
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: browser for bash scripts?
[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
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2012-11-30 17:47 UTC (permalink / raw)
To: help-gnu-emacs
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.
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.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: browser for bash scripts?
2012-11-30 17:47 ` Stefan Monnier
@ 2012-11-30 23:02 ` Thorsten Bonow
2012-12-01 11:28 ` Oleksandr Gavenko
1 sibling, 0 replies; 7+ messages in thread
From: Thorsten Bonow @ 2012-11-30 23:02 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
TR> Does anyone have code to make speedbar, ECB, or other code browser
TR> display/navigate bash scripts?
Stefan> `sh-script.el' already provides support for `imenu', so Speedbar
Stefan> should already find the functions in the bash scripts, or at least
Stefan> there should be very little preventing it from happening.
TR> I'd like, e.g., to easily navigate between variable and function
TR> definitions and calls/uses.
Stefan> I guess we could add variables to sh-mode's `imenu' support.
Stefan> Stefan
Hi,
I use the skeleton added below for my scripts. Via imenu I can jump to the
beginning of all the "##### XXX #####" blocks and to every function.
Toto
#!/bin/bash
##### Preamble #####
...
##### Functions #####
function dummy_function() {
...
return
} # end of dummy_function
...
##### Initialization And Setup #####
...
##### Command Line Processing #####
...
##### Main Logic #####
...
# Local Variables:
# mode: outline-minor
# outline-regexp: "\\(function\\)\\|\\(##### \\)"
# outline-heading-end-regexp: "\\(() {\n\\)\\|\\( #####\n\\)"
# fill-column: 70
# End:
--
This twinkie thing---it ain't over yet.
Tallahassee (Woody Harrelson): Zombieland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: browser for bash scripts?
2012-11-30 17:47 ` Stefan Monnier
2012-11-30 23:02 ` Thorsten Bonow
@ 2012-12-01 11:28 ` Oleksandr Gavenko
1 sibling, 0 replies; 7+ messages in thread
From: Oleksandr Gavenko @ 2012-12-01 11:28 UTC (permalink / raw)
To: help-gnu-emacs
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!
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: browser for bash scripts?
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-12-03 14:26 ` Doug Lewan
2012-12-03 14:43 ` Doug Lewan
2 siblings, 1 reply; 7+ messages in thread
From: Doug Lewan @ 2012-12-03 14:26 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org, Tom Roche
I use exuberant ctags. (CYGWIN delivers it. You can also get it here: http://ctags.sourceforge.net/.)
The following lines let me find shell functions as tags.
etags --langdef=shell --regex-shell='/function [_[:alnum:]]+/[_[:alnum:]]+/' --language-force=shell files
# etags might pick up tag-like things in comments. Get rid of them.
sed -n -e '/#/d' -ep < TAGS > TTT && mv TTT TAGS
It has changed my life. (Perhaps I need a better life....)
,Doug
> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Tom Roche
> Sent: Sunday, 2012 June 03 23:07
> To: help-gnu-emacs@gnu.org
> Subject: browser for bash scripts?
>
>
> Does anyone have code to make speedbar, ECB, or other code browser
> display/navigate bash scripts? I'd like, e.g., to easily navigate
> between variable and function definitions and calls/uses. Currently,
> for the latter, I'm `find-grep`ing '^function ': that works, but is
> not nearly so pleasant as was speedbar in JDEE (back when I did mostly
> java, several years ago).
>
> TIA, Tom Roche <Tom_Roche@pobox.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: browser for bash scripts?
2012-12-03 14:26 ` Doug Lewan
@ 2012-12-03 14:43 ` Doug Lewan
0 siblings, 0 replies; 7+ messages in thread
From: Doug Lewan @ 2012-12-03 14:43 UTC (permalink / raw)
To: Doug Lewan, help-gnu-emacs@gnu.org, Tom Roche
Ignore my last comment. It turns out Exuberant ctags supports shell directly (and I assume it's better than my code). The problem for me (besides my own ignorance) had been that I wasn't using an extension to indicate the language.
Simply the following should work.
etags --language-force=sh files...
,Doug
> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Doug Lewan
> Sent: Monday, 2012 December 03 09:26
> To: help-gnu-emacs@gnu.org; Tom Roche
> Subject: RE: browser for bash scripts?
>
> I use exuberant ctags. (CYGWIN delivers it. You can also get it here:
> http://ctags.sourceforge.net/.)
>
> The following lines let me find shell functions as tags.
>
> etags --langdef=shell --regex-shell='/function
> [_[:alnum:]]+/[_[:alnum:]]+/' --language-force=shell files
> # etags might pick up tag-like things in comments. Get rid of
> them.
> sed -n -e '/#/d' -ep < TAGS > TTT && mv TTT TAGS
>
> It has changed my life. (Perhaps I need a better life....)
>
> ,Doug
>
> > -----Original Message-----
> > From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> > [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> > Behalf Of Tom Roche
> > Sent: Sunday, 2012 June 03 23:07
> > To: help-gnu-emacs@gnu.org
> > Subject: browser for bash scripts?
> >
> >
> > Does anyone have code to make speedbar, ECB, or other code browser
> > display/navigate bash scripts? I'd like, e.g., to easily navigate
> > between variable and function definitions and calls/uses. Currently,
> > for the latter, I'm `find-grep`ing '^function ': that works, but is
> > not nearly so pleasant as was speedbar in JDEE (back when I did
> mostly
> > java, several years ago).
> >
> > TIA, Tom Roche <Tom_Roche@pobox.com>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-12-03 14:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-12-03 14:26 ` Doug Lewan
2012-12-03 14:43 ` Doug Lewan
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).