From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Goldman Newsgroups: gmane.emacs.help Subject: Re: shell-script mode index Date: Thu, 26 Jun 2014 16:20:43 -0400 Message-ID: References: <87y4wkyc50.fsf@motoko.kusanagi> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1403814096 14649 80.91.229.3 (26 Jun 2014 20:21:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Jun 2014 20:21:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 26 22:21:29 2014 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 1X0GAi-0004Gu-Nl for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Jun 2014 22:21:28 +0200 Original-Received: from localhost ([::1]:46783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0GAi-0005cl-1L for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Jun 2014 16:21:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0GAP-0005bp-J4 for help-gnu-emacs@gnu.org; Thu, 26 Jun 2014 16:21:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0GAH-00014h-6d for help-gnu-emacs@gnu.org; Thu, 26 Jun 2014 16:21:09 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:52095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0GAG-00014d-W6 for help-gnu-emacs@gnu.org; Thu, 26 Jun 2014 16:21:01 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X0GAF-0003xF-MA for help-gnu-emacs@gnu.org; Thu, 26 Jun 2014 22:20:59 +0200 Original-Received: from 75-17-109-153.lightspeed.nrwlct.sbcglobal.net ([75.17.109.153]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 26 Jun 2014 22:20:59 +0200 Original-Received: from kgoldman by 75-17-109-153.lightspeed.nrwlct.sbcglobal.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 26 Jun 2014 22:20:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 20 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-17-109-153.lightspeed.nrwlct.sbcglobal.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: 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:98424 Archived-At: On 6/26/2014 1:05 PM, Drew Adams wrote: > `M-x imenu-add-menu-bar-index', then `M-x imenu'. Thanks. That worked. I put this in .emacs: (add-hook 'sh-mode-hook (function (lambda () (setq imenu-sort-function 'imenu--sort-by-name) (setq imenu-max-items 40) (imenu buffer-file-name) (imenu-add-to-menubar "index") ))) I now have this (and lots of other code repeated) for a few hooks. Is there a way to put this in some elisp code that says, 'Do this for any mode that supports it?" When I tried to do it outside a hook, I got an error for fundamental-mode.