Just type a prefix of the defined name, and let completion do the work for you. Why? Because you don’t have to read down a long list of menu items, many of which look similar. It can often be quicker to access an Imenu menu from the keyboard, using completion: M-x imenu (add-hook 'font-lock-mode-hook 'try-to-add-imenu) Imenu from the Keyboard, with Completion ( condition-case nil (imenu-add-to-menubar "yourFancyName") ( error nil))) You can make use of this to add an Imenu index to the menu bar in any mode that supports Imenu: ( defun try-to-add-imenu () ‘font-lock-mode-hook’ is run after entering a major mode. To automatically add an Imenu menu to the menu bar for a given mode, do something like this: (add-hook 'my-mode-hook 'imenu-add-menubar-index) You can use an EmacsLisp marker as a target destination, so that targets need not be limited to the current buffer. LaTeX) the locations might be section headings. See variable ‘imenu-create-index-function’.įor a source-code buffer the locations to index are typically definitions of functions, variables, and so on. Provide a function that generates the index.Provide regexps that match the locations to index.There are two ways to generate an Imenu menu (index): If there is no Imenu support for your context, you can add it using EmacsLisp and the constructs provided in library imenu.el. You can use Imenu with any major mode and any programming language or document type. For a source-code buffer it is typical to index definitions of functions, variables, and so on. You can access the locations using an ordinary menu ( menu bar or other) or using minibuffer completion.Ī typical use of Imenu shows a menu-bar menu that is an index or table of contents for the current buffer. Imenu produces menus for accessing locations in documents, typically in the current buffer.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |