unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: imenu rescan automatically
Date: Sun, 11 Aug 2024 16:51:24 +0000	[thread overview]
Message-ID: <Esz0xcBaIOhwWffVSERSVV0tiJS-zFDtowXFV4mxK_5CDeAoMHonuBdkzecRn-yLf5J-GQwBJJX7UbTIkXmJVjrA2WiAPdmcbqlKcRAw7P0=@protonmail.com> (raw)

I made this interactive function that adds items to imenu menubar.

But I want a rescan to happen automatically rather than having to
do it after I call the function.

(defun lumin-expr-elisp (actm)

  (interactive
   (list
     (let ( (cseq '("Declarations")) )
       (completing-read "ACTM: " cseq nil t "Declarations"))))

   (cond
     
     ((equal actm "Declarations")
        (setq imenu-generic-expression
          `( ("defconst"
                ,(concat "^\\s-*"
                         "(defconst\\s-+"
                         "\\(\\(\\sw\\|\\s_\\)+\\)") 1)

             ("defvar"
                ,(concat "^\\s-*"
                         "(\\(defvar\\|defvar-local\\)\\s-+"
                         "\\(\\(\\sw\\|\\s_\\)+\\)") 2)

             ("defcustom"
                ,(concat "^\\s-*"
                         "(defcustom\\s-+"
                         "\\(\\(\\sw\\|\\s_\\)+\\)") 1)

             ("defun"
                ,(concat "^\\s-*"
                         "(\\(defun\\|define-minor-mode\\)\\s-+"
                         "\\(\\(\\sw\\|\\s_\\)+\\)") 2) ))) )

   (when imenu-generic-expression
     (imenu--make-index-alist t)
     (imenu-add-to-menubar "Lumi")
     (call-interactively 'imenu)) )






             reply	other threads:[~2024-08-11 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11 16:51 Heime [this message]
2024-08-11 23:41 ` imenu rescan automatically Joel Reicher
2024-08-12  9:34   ` Heime
2024-08-12 10:13     ` Joel Reicher
2024-08-12 10:21       ` Heime
2024-08-12 10:50         ` Joel Reicher
2024-08-12 11:27           ` Heime
2024-08-12 11:57             ` Joel Reicher
2024-08-12 12:14               ` Heime
2024-08-12 12:20                 ` Joel Reicher
2024-08-12 12:32                   ` Christopher Dimech
2024-08-12 13:02                     ` Joel Reicher

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='Esz0xcBaIOhwWffVSERSVV0tiJS-zFDtowXFV4mxK_5CDeAoMHonuBdkzecRn-yLf5J-GQwBJJX7UbTIkXmJVjrA2WiAPdmcbqlKcRAw7P0=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@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.
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).