emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: imenu support for babel blocks


From: Sébastien Vauban
Subject: [Orgmode] Re: imenu support for babel blocks
Date: Wed, 01 Dec 2010 17:17:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Hi Eric and David,

"Eric Schulte" wrote:
> Hi David,
>
> I've never used imenu myself, but that sounds useful. I'd recommend using
> the following rather than building your own regexp
>
> (push (list "Source code chunks"
>             org-babel-src-name-w-name-regexp 2)
>       imenu-generic-expression)
>
> You're right that the Org-mode imenu setup looks fairly complex, and is
> probably overwriting your simple expression above. Unfortunately I don't
> know much about imenu and I'm now sure how a code block menu fits into the
> existing Org-mode imenu support.

I've written the following in my .emacs file:

#+begin_src emacs-lisp
  ;; extension of Imenu
  (when (and
         ;; `org-babel' has been loaded
         (fboundp 'org-babel-execute-src-block)

         ;; `imenu' has been loaded
         (fboundp 'try-to-add-imenu))

    (setq org-src-blocks-imenu-generic-expression
          `(("Snippets" ,org-babel-src-name-w-name-regexp 2)))

    (add-hook 'org-mode-hook
              (lambda ()
                (setq imenu-generic-expression
                      org-src-blocks-imenu-generic-expression))))
#+end_src

... but I never see any name of code chunk in the "IMenu" menu.
I only see the headings of my current Org file.

Any idea what I'm doing wrong?

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

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