Hot answers tagged

4

Instead of using imenu, you can use org-goto with the following settings: (setq org-goto-interface 'outline-path-completionp) (setq org-outline-path-complete-in-steps nil) ,----[ C-h v org-goto-interface RET ] | org-goto-interface is a variable defined in ‘org.el’. | Its value is ‘outline-path-completionp’ | Original value was outline | | Documentation: | ...


3

You need to make AUCTeX aware of the frame environment, i.e., \frametitle: (add-to-list 'TeX-outline-extra '("\\\\frametitle\\b" 4)) From the documentation on Tex-outline-extra: List of extra TeX outline levels. Each element is a list with two entries. The first entry is the regular expression matching a header, and the second is the level of ...


3

You can use imenu-mode for that purpose. It comes shipped with emacs and most programming modes support it. EDIT2: You could simply start it with this: (add-hook 'prog-mode-hook (lambda () (imenu-add-to-menubar "Imenu"))) EDIT: I activate it by this code: (defun my-try-to-add-imenu () (unless (my-is-buffer-file-temp) (condition-case nil (imenu-add-...


2

The interesting function here is imenu--generic-function which by skips comments and string by inspecting the value of syntax-ppss. So it should have worked out of the box for you. Looking at the code it seems to jumps to the start of the before checking for output of syntax-ppss, I guess that is screwing up things for you (since it might move out the ...


2

You don't have to create a one-liner. The following list of definitions should create an imenu items: (setq less-imenu-generic-expression '((nil "\\(^@font-face\\)" 1) (nil "\\(^body\\)" 1) (nil "\\(^#foo\\)" 1) (nil "\\(^h[123]\\)" 1) (nil "\\(^\.CheltenhamBT-BoldHeadline\\)" 1) (nil "\\(^.ClarendonText-Bold\\)...


2

Vanilla imenu presents things hierarchically, so you'd first have to choose between Public/Private/All functions, before you actually chose from a list of actual function. However, this is confusing with other imenu frontends that show them all at the same time. There are distinct entries in the imenu-generic-expression value that php-mode defines for ...


2

ESS now recognizes = as an assignment operator for imenu's purposes. You can get this using MELPA or wait for the next official release.


2

I copied over the definition of the variable cc-imenu-c++-generic-expression and patched the regular expressions that included ^ to ^[ \t]*. Eval the setq (maybe put it in your init.el, then open the test file. (setq cc-imenu-c++-generic-expression `( ;; Try to match ::operator definitions first. Otherwise `X::operator new ()' ;; will be incorrectly ...


2

I think you're looking for which-function-mode (which is indeed a standard feature).


2

In a buffer with only the line const char* fileName as above, running (semantic-fetch-tags) returns this tag that gives back char as type: (("filename" variable (:pointer 1 :constant-flag t :type "char") nil #<overlay from 1 to 22 in 03-095759.c>)) The type is "char", although it has the attribute :pointer 1 to denote the level of pointer. helm-...


2

(defun my-imenu-goto--closest-dir (direction) "Jump to the closest imenu item on the current buffer. If direction is 1, jump to next imenu item. If direction is -1, jump to previous imenu item. See https://emacs.stackexchange.com/questions/30673 Adapted from `which-function' in:: https://github.com/typester/emacs/blob/master/lisp/progmodes/which-func.el" ...


2

Try this (push '("frametitle" 2) TeX-outline-extra) See the documentation for TeX-outline-extra. The first element of the list being added is a regexp and the second is the imenu level. You can also see LaTeX-section-list for the default levels that imenu uses for latex. Update: As suggested in the comments, it might be a little safer to use the ...


1

It is possible to represent structured menu with imenu. A valid alist shape could be: (list (list "Title 1" (list "Title 11" '("Index Name 1" . 1) '("Index Name 2" . 1))) (list "Title 2" '("Index Name 21" . 1) '("Index Name 22" . 1))) The error was caused by quoting of '(("sub-item" . 1)) form.


1

I think that I misunderstood what the OP asked for. He wished to search for matches to arbitrary regexps not simply within the matches found by the usual imenu. This can be done. (defun imenu-match-insert (s) (interactive "sRegexp to search with: ") (let ((imenu--index-alist nil) (imenu-generic-expression (list (list nil s 0)))) (...


1

This does what you ask for. (defun imenu-insert-label (s) (interactive "sRegexp to search with: ") (insert (completing-read "Choose a target: " (seq-filter (lambda (z) (string-match s (car z))) (cdr (imenu--make-index-alist)))))...


1

My solution is way too hacky: A file that you want to have Imenu to access is likely to be tracked by Git. Use find-file-noselect on all those files (I don't know how to detect binary files with Emacs so limiting on VCS-tracked files is better), and accept the risk of hooks and advices, auto-loading functions, etc. ;;;###autoload (defun open-project-files-in-...


1

Look up emacs keyboard macros You will record a sequence, save it resulting in a function, then bind that function to your f6 key.


1

I'm not really sure what you're trying to do, but maybe this will help: (defun foo () "..." (interactive) (minibuffer-with-setup-hook #'minibuffer-complete (call-interactively #'imenu))) (global-set-key (kbd "<f4>") 'foo)


1

This makes the rescan item an empty string, maybe that's good enough. (setq imenu-auto-rescan t imenu-auto-rescan-maxout (* 1024 1024) imenu--rescan-item '("" . -99)) Here's some advice on some internal imenu functions that actually removes the rescan item. I think I got the corner cases, but it might break in the future. (defun jpk/imenu-no-...


1

The comment of user poliza provided the following solution based on pdf-outline--imenu--split-menu from pdf-tools. ;; See http://emacs.stackexchange.com/questions/31791/order-of-items-in-imenu?noredirect=1#comment48799_31791 (advice-add #'imenu--split-menu :around #'reftex-outline-imenu--split-menu) (defun reftex-outline-imenu--split-menu (oldfun menulist ...


1

Fixed it by changing the value of imenu-generic-expression to '(("type" "^[ \t]*type *\\([^ \t\n\r\f]*[ \t]*\\(struct\\|interface\\)\\)" 1) ("func" "^func *\\(.*\\)" 1))) Which has two advantages over the original value. it recognizes split-line functions, and it notices embedded types. I'll probably submit a PR to go-mode, but until then to get this ...


1

Put this in your .emacs (setq helm-follow-mode-persistent t) and whenever you enter helm-imenu or helm-mark-ring, press C-<up> or C-<down> to follow to that line in helm.


1

Hoping below function would help ;;; add func to perform imenu for all headings at one level (defun org-imenu-get-heading () "Produce the index for Imenu." (mapc (lambda (x) (move-marker x nil)) org-imenu-markers) (setq org-imenu-markers nil) (let* ((n org-imenu-depth) (re (concat "^" (org-get-limited-outline-regexp))) (subs (make-...


1

It turned out that I have installed a package called lispy and that this package seems to change imenu-create-index-functions value. Answering my own question gives me the impression that doing "emacs -Q" should have been my pre-post action... Since I had not time to get used to lispy I just removed the package and now i can imenu through my init.el again!


1

Load the source file imenu.el, then use M-x debug-on-entry RET imenu-choose-buffer-index. Open file imenu.el in a separate frame (C-x 5 f), and move to the definition of imenu-choose-buffer-index, so you can see what it does. Then, when you try to invoke imenu the debugger will open. You can walk through the debugger using d (or c to skip through an ...


1

I've just patched moo-jump-local to properly handle const char* fileName. It seems that semantic can't currently parse top-level references. Although it parses them in the arguments lists, as you can see here:


Only top voted, non community-wiki answers of a minimum length are eligible