From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.help Subject: Re: browser for bash scripts? Date: Sat, 01 Dec 2012 13:28:16 +0200 Organization: Oleksandr Gavenko , http://gavenkoa.users.sf.net Message-ID: <87txs6106n.fsf@gavenkoa.example.com> References: <87vcj7bwrs.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354361319 9835 80.91.229.3 (1 Dec 2012 11:28:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2012 11:28:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 01 12:28:49 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TelFZ-00072K-Hg for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2012 12:28:49 +0100 Original-Received: from localhost ([::1]:42266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TelFN-0001ND-M4 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2012 06:28:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TelFI-0001Mv-3Y for help-gnu-emacs@gnu.org; Sat, 01 Dec 2012 06:28:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TelFG-0008Df-83 for help-gnu-emacs@gnu.org; Sat, 01 Dec 2012 06:28:32 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TelFG-0008DQ-1a for help-gnu-emacs@gnu.org; Sat, 01 Dec 2012 06:28:30 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TelFN-0006px-Td for help-gnu-emacs@gnu.org; Sat, 01 Dec 2012 12:28:37 +0100 Original-Received: from 37.229.16.202 ([37.229.16.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Dec 2012 12:28:37 +0100 Original-Received: from gavenkoa by 37.229.16.202 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Dec 2012 12:28:37 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 37.229.16.202 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:1FOHwDbXcPRRFGHS5BhwODRa4go= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87995 Archived-At: 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!