emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* setting up 'imenu'
@ 2020-09-10 10:28 Sharon Kimble
  2020-09-10 12:01 ` Jeremie Juste
  0 siblings, 1 reply; 4+ messages in thread
From: Sharon Kimble @ 2020-09-10 10:28 UTC (permalink / raw)
  To: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


I'm having major problems with my imenu setup, and its like this.

- --8<---------------code one---------------start------------->8---
* Outlining and Plotting
  ** Level 2 heading
  ** etc and onwards
- --8<---------------cut here---------------end--------------->8---
  
- - 'Outlining and Plotting' is a level one header

- - 'Level 2 heading' is, not surprisingly, a level 2 header

Now, if the 'level 2 heading' has 50 items, it only actually shows 46
and does not show the remaining 4!

- --8<---------------code two---------------start------------->8---
* Outlining and Plotting
  ** Level 2 heading
  ** TODO * etc and onwards
  ** TODO * and another one
  ** Still a sample
- --8<---------------cut here---------------end--------------->8---

In the code snippet shown as 'code two', those showing as a 'TODO *
item' are articles that are unwritten, and all other items are written.

- - In the imenu it is very easy to see what articles are unwritten due to
  them showing with a beginning ' * '.

- - In the imenu unwritten articles show as 'From: * etc and onwards'
  where there are 10 or more items, they are folded.

So how can I get the imenu to show *all* the imenu items of written
articles please?

I've been looking in all the 'Customize group: imenu' buffers, but I
can't see where I can set it up as I want. Any ideas please?

Thanks
  Sharon.  
- -- 
Debian 10.5, fluxbox 1.3.7, emacs 27.1.50, org 9.3.7
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl9Z/+gbHGJvdWRpY2Nh
c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbiJsQAMP33tO8LSDTi/4/bxVb
rjA/eInifeHdgHGv10Jc+3/X4xzIGadv5JpN9ZtKEju1yp5PXcJWSQftnQSxqIQU
lLLx5uyMDZC7ZI2476aZZl3+KYhPaFaWnFs9JaPP+8zxff0WMrofw+YIGUzDdk4J
O9JIDNLH8/Lwsi7aNWdgM2guL3RlLuTsZzHaDPeC1dlp2zKEJY7/cA15EFp2MqGa
+RRbUYcGNUZLLqiLtZYdhIWzbEJNirj4ZuOQEKAYrfd3gChsILflwlwtwrCnDX/L
m4T62oftYC9a1xY8dS9G9rrJ9hn2Cy7fDV2vLK3q8gH4CrS66TTsiITv5rkYd2oR
frmncOM9dYwxjHvdpzA7/97NZkbsffNHvgolqLoUJDOZpA3/2N956OE+ewL8ZxFF
SzrH9ms4/XUcg2rHZizCNpovFmlJiyHFNEVBHg9iMe9FKFVvkXioEEY2Bt7ZEjvG
eg4G82OgP9INTspBVeMKl/j48iYP5Y6CqZvnzcKBxaqMfBIHlLDEs1s+wZERt9Ri
IEwQfO+/zU46dPQ4Ekf0vRxs5kp9ydSaF6H3zkn3yhpk0j5a+6JYOVvrEOvl0Vfb
iN8OoxkMMiCKXo5tSCXkV0pKt1HJm3RV8PFmK/GjLh39ePGA+nVZcUzXp4VwbM8H
QA1lWiy3oBWklRwnJKvpG/46
=oaoQ
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setting up 'imenu'
  2020-09-10 10:28 setting up 'imenu' Sharon Kimble
@ 2020-09-10 12:01 ` Jeremie Juste
  2020-09-11  9:02   ` Sharon Kimble
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremie Juste @ 2020-09-10 12:01 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: emacs-orgmode


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







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setting up 'imenu'
  2020-09-10 12:01 ` Jeremie Juste
@ 2020-09-11  9:02   ` Sharon Kimble
  2020-09-11  9:33     ` Jeremie Juste
  0 siblings, 1 reply; 4+ messages in thread
From: Sharon Kimble @ 2020-09-11  9:02 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Jeremie Juste <jeremiejuste@gmail.com> writes:

> Hello Sharon,

Hi Jeremie.
  
> 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.

This is my imenu setup from my config file -

- --8<---------------clip one---------------start------------->8---
** Imenu

#+BEGIN_SRC emacs-lisp
(require 'imenu+)
(global-set-key (kbd "C-x 2") 'imenu-add-to-menubar)
#+END_SRC
[2020-09-10 Thu 18:29]

Make sure auto automatically rescan for imenu changes

#+BEGIN_SRC emacs-lisp
(set-default 'imenu-auto-rescan t)
#+END_SRC
[2015-12-19 Sat 04:55]
[2017-01-16 Mon 23:39]

#+BEGIN_SRC emacs-lisp
;; Jump to a definition in the current file. (This is awesome.)
;; (global-set-key (kbd "M-i") 'prelude-ido-goto-symbol)
;; (require 'imenu)
;; (set-default 'imenu-auto-rescan t)
;; (defun prelude-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)
    ;;             (prelude-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))
    ;;        (prelude-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))))))))
#+END_SRC
[2014-11-16 Sun 16:09]
[2017-01-16 Mon 23:49]
[2020-09-10 Thu 18:35]

#+begin_src emacs-lisp
(require 'popup-imenu)
#+end_src
[2015-12-29 Tue 13:37]
[2017-01-17 Tue 10:39]

**** imenu

#+BEGIN_SRC emacs-lisp
;; setting up 'imenu'
;; (local-set-key "\C-x\C-a" 'show-all)
(add-hook 'org-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq org-imenu-depth 6)

(add-hook 'rst-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq adoc-imenu-depth 6)

(add-hook 'markdown-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq adoc-imenu-depth 6)

(add-hook 'LaTeX-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq latex-imenu-depth 6)
#+END_SRC
[2015-04-08 Wed 23:54]
[2017-01-17 Tue 11:04]

**** FIXIT imenu-anywhere

#+BEGIN_SRC emacs-lisp
(require 'imenu-anywhere)
(global-set-key (kbd "C-+") 'imenu-anywhere)
#+END_SRC
[2014-11-14 Fri 11:15]
[2015-05-23 Sat 02:34]
[2017-01-17 Tue 11:05]
fails with - helm-build-sync-source is void
[2020-09-10 Thu 18:37]

**** dired-imenu

#+begin_src emacs-lisp
;;(require 'dired-imenu)
#+end_src
[2015-05-04 Mon 13:54]
[2017-01-17 Tue 13:24]
[2020-09-10 Thu 18:38]

**** FIXIT imenu-list

#+BEGIN_SRC emacs-lisp
(require 'imenu-list)
(global-set-key (kbd "M-g 1") #'imenu-list-smart-toggle)
(setq imenu-list-focus-after-activation t)
(setq imenu-list-auto-resize t)
#+END_SRC
[2017-08-10 Thu 12:07]
https://github.com/bmag/imenu-list


#+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
https://www.emacswiki.org/emacs/ImenuMode
[2020-09-10 Thu 18:27]
- --8<---------------cut here---------------end--------------->8---

And this is whats showing for imenu in my 'custom.el' -

- --8<---------------custom.el---------------start------------->8---
 '(imenu-auto-rescan t)
 '(imenu-auto-rescan-maxout 600000000)
 '(imenu-list-auto-resize t)
 '(imenu-list-focus-after-activation t)
 '(imenu-list-position 'left)
 '(imenu-list-size 35)
 '(imenu-max-item-length nil)
 '(imenu-max-items 15)
 '(imenu-sort-function 'imenu--sort-by-name)
- --8<---------------cut here---------------end--------------->8---

And with that setup my imenu is still failing, but I can't work out why
or where its wrong!

And I've discovered that the 'level 2 headings' extend to the bottom of
the screen and to the screen top as well, minus the status bar! But its
just not folding, which is what I'm trying to achieve.
  
>
> 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.

The reason why I use 'TODO * foo ...' is because when I look at the
relevant section in the imenu the articles that have a TODO item
outstanding show up with a '* ' before the heading proper. When the
article is written and exported into latex and then a pdf, I remove the
TODO item and its relevant '* '.
>
> 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.

Sorry, but I just feel that your system is over-complicated as compared
to my simplistic way!
  
>
> Hope this help,
> Jeremie
>

  Thanks
  Sharon.
- -- 
Debian 10.5, fluxbox 1.3.7, emacs 27.1.50, org 9.3.7
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl9bPTAbHGJvdWRpY2Nh
c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INb3JMP/18+Q5wwR4GWuikT5b9G
FXstCkQSEIGGJX6vwoEbhcc0uJIy+41FnLDzDp3Tu4TsJaHE4DkROmEbokFwtfYo
Fe+BfaVIfvE69RCmBZoVodEIj9CTxL9yq/9Y+foUYCHb8clWSj+Po9bGc1Bszgfm
36z4XUya3RigGo0IZs10na6wY2Mi+JpKXv3HR1aakZVvR1AjTfEdj1d3fmRsgwTs
tpPDOCDzWRwsCNjS9ujUt5EhftRaxGy43pV2aUtWZaN3UHJi4iov4GbjSui8hITQ
E7NoZSiDlIq46xoC+69Yi4wK9OVdX9CSN45oqB23ARXdW4jqsYou5ksNbh2I7RFt
5YlMgEYiFSbjo5tL8GARU2oryZt/hbw3yq6fBpwdncJDwXJLDdP9z/hzHWnu+2JO
2b6ATFlfmFccJdPKvTUlpAHFHV0xAJOGWIGuXQ7lZS8MW7BEodoBNdQxiBRledXL
ejhL6MWV3xqs5vweRCgRGLFoO9B9NwCWWdeesjHqghw+0byxtheWp0hQfyShH5za
/8myqtVu+n3E3Ip5qrtvfhvxBBPVOkXQZjRzeQ9c2i1bzW+FbpyMCRS6E86jHr1b
Ros5Z1hcuNfrL+1NXpqWmPcnJUIhbPaoazvBgLDBa5BCIfuPPWHbFIh2LyB0xlk5
vkyAr1kYTOcnlLuxBIRGg3zN
=REaL
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setting up 'imenu'
  2020-09-11  9:02   ` Sharon Kimble
@ 2020-09-11  9:33     ` Jeremie Juste
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremie Juste @ 2020-09-11  9:33 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: emacs-orgmode

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-11  9:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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