New answers tagged


This is a temporary workaround that worked for me based on @Aidan Schofield's answer. The imenu-match-insert function there had some issues working with org files. And I added a variant imenu-match-insert-text below (a thin wrapper), which switches the current buffer temporarily to text mode, does the insert and then switch back to the original mode: (defun ...


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)))) (...


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)))))...


Just because I was interested after reading Stefan's answer, I was able to create a regexp for: ^L<some-characters-but-not-EOOH>^_ This works: ^L\([^E^L]*E\([^O^L]\|O[^O^L]\|OO[^H^L]\)\)+[^E^L]*.\{0,3\}^_

Top 50 recent answers are included