From: Jeremie Juste <jeremiejuste@gmail.com>
To: Sharon Kimble <boudiccas@skimble.plus.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: setting up 'imenu'
Date: Fri, 11 Sep 2020 11:33:48 +0200 [thread overview]
Message-ID: <87imckhd37.fsf@gmail.com> (raw)
In-Reply-To: 87wo104rfi.fsf@skimble.plus.com
Hello Sharon,
I must have failed to grasp the subtleties of your workflow. And my
explanation was surely not very friendly. I apologize for that.
If your workflow works for you this is what matters.
> Sorry, but I just feel that your system is over-complicated as compared
> to my simplistic way!
I cannot reproduce your error right now. But I would suggest a test.
If you start emacs without any configuration, on the command line
> emacs -Q
Then execute the code below. Does ido-goto-symbol work as you expect?
#+begin_src emacs-lisp
(defun ido-goto-symbol (&optional symbol-list)
"Refresh imenu and jump to a place in the buffer using Ido."
(interactive)
(unless (featurep 'imenu)
(require 'imenu nil t))
(cond
((not symbol-list)
(let ((ido-mode ido-mode)
(ido-enable-flex-matching
(if (boundp 'ido-enable-flex-matching)
ido-enable-flex-matching t))
name-and-pos symbol-names position)
(unless ido-mode
(ido-mode 1)
(setq ido-enable-flex-matching t))
(while (progn
(imenu--cleanup)
(setq imenu--index-alist nil)
(ido-goto-symbol (imenu--make-index-alist))
(setq selected-symbol
(ido-completing-read "Symbol? " symbol-names))
(string= (car imenu--rescan-item) selected-symbol)))
(unless (and (boundp 'mark-active) mark-active)
(push-mark nil t nil))
(setq position (cdr (assoc selected-symbol name-and-pos)))
(cond
((overlayp position)
(goto-char (overlay-start position)))
(t
(goto-char position)))))
((listp symbol-list)
(dolist (symbol symbol-list)
(let (name position)
(cond
((and (listp symbol) (imenu--subalist-p symbol))
(ido-goto-symbol symbol))
((listp symbol)
(setq name (car symbol))
(setq position (cdr symbol)))
((stringp symbol)
(setq name symbol)
(setq position
(get-text-property 1 'org-imenu-marker symbol))))
(unless (or (null position) (null name)
(string= (car imenu--rescan-item) name))
(add-to-list 'symbol-names name)
(add-to-list 'name-and-pos (cons name position))))))))
(global-set-key (kbd "C-c i") 'ido-goto-symbol) ; or any key you see fit
#+end_src
Best regards,
Jeremie
prev parent reply other threads:[~2020-09-11 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 10:28 setting up 'imenu' Sharon Kimble
2020-09-10 12:01 ` Jeremie Juste
2020-09-11 9:02 ` Sharon Kimble
2020-09-11 9:33 ` Jeremie Juste [this message]
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87imckhd37.fsf@gmail.com \
--to=jeremiejuste@gmail.com \
--cc=boudiccas@skimble.plus.com \
--cc=emacs-orgmode@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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).