unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ken Goldman <kgoldman@us.ibm.com>
To: help-gnu-emacs@gnu.org
Subject: Re: shell-script mode index
Date: Thu, 26 Jun 2014 16:20:43 -0400	[thread overview]
Message-ID: <lohvas$diu$1@ger.gmane.org> (raw)
In-Reply-To: <c917a973-2d86-4686-8abc-420a5818fec7@default>

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.





  reply	other threads:[~2014-06-26 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 14:56 shell-script mode index Ken Goldman
2014-06-25 20:20 ` W. Greenhouse
2014-06-26 16:45   ` Ken Goldman
2014-06-26 17:05     ` Drew Adams
2014-06-26 20:20       ` Ken Goldman [this message]
2014-06-26 20:38         ` Drew Adams
2014-06-27 14:38           ` Sharon Kimble
2014-06-27 15:00             ` Drew Adams
2014-06-26  1:14 ` William Xu

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='lohvas$diu$1@ger.gmane.org' \
    --to=kgoldman@us.ibm.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).