emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting up 'imenu'


From: Jeremie Juste
Subject: Re: setting up 'imenu'
Date: Thu, 10 Sep 2020 14:01:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hello Sharon,

Unfortunately I cannot reproduce your issue. I created a list of 56 sub heading 
and I
can view the heading Still a sample 0 until Still a sample 56.


** TODO * etc and onwards
** TODO * and another one
** Still a sample 0
** Still a sample 1
** Still a sample 2
** Still a sample 3
** Still a sample 4

It might be because I am using [1] this  modification from  emacswiki
https://www.emacswiki.org/emacs/ImenuMode.

I another workflow comes to my mind when reading yours.
Instead of using "TODO * ..." I would use the TODO keywords and tell org-mode to
list all the todos.

For instance with the command M-x org-show-todo-tree.

A another way of working might be the following.

--- file - writings.org
#+TODO: TODO(t) TOWRITE(w) | DONE(d)

* TOWRITE This is article 1
* TOWRITE This is article 2
* DONE This is  article 2

#+begin_src elisp
   (org-agenda-file-to-front)
#+end_src
--- EOF

Add the file to the agenda ( by default C-[ ), or execute the lisp chunk
in the file writings.org. Then you can M-x org-todo-list. To view all
your todo|towrite|done articles.


Hope this help,
Jeremie

[1] ;; * imenu

    (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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]