From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joel Reicher Newsgroups: gmane.emacs.help Subject: Re: imenu rescan automatically Date: Mon, 12 Aug 2024 21:57:52 +1000 Message-ID: <86sevaymv3.fsf@gmail.com> References: <864j7q4ohe.fsf@gmail.com> <86ikw6dp6g.fsf@gmail.com> <86cymedngq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31649"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 12 13:58:51 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sdThK-0007zF-A9 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 12 Aug 2024 13:58:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdTgf-0000c8-Ab; Mon, 12 Aug 2024 07:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdTgb-0000bO-Pp for help-gnu-emacs@gnu.org; Mon, 12 Aug 2024 07:58:06 -0400 Original-Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdTgY-0000uE-4d for help-gnu-emacs@gnu.org; Mon, 12 Aug 2024 07:58:05 -0400 Original-Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7c691c8f8dcso155926a12.1 for ; Mon, 12 Aug 2024 04:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723463880; x=1724068680; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vv606ILa7Dv2UT9e+9M39ISh01YDUNHG0IuCLT3qXls=; b=OcaOJSMHPpcc+0M1HQR2eULk1paOGQ3S/wYVrako/TXGKWT5WpgDfVKc4k/NwueV/f lDKvjAcyngCYqLSnXdWfwVD9rDiTNNGT4/fBpk3OqaA0YHzQgf5NdLrmNqAW5gFmJCec KxDfnhdXlS/43gMtLJEOD8TR5gtmP2BYHjQdpIBTidBHWHwsXlJxFvVTQhLbWMuPH4v5 zvTFkDdhokw6FZj1f8tCRioE5aOBwz4yyx8/bUoCvWLbdSWrYB92tvzoK9CwO8nprR25 kGBGZOr4ImsXUjUnK1Qq0IRSJnAwLVe2SAVSJrQEC49lRXpN3d1MleVXhRrPTJuuo/DS S5iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723463880; x=1724068680; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Vv606ILa7Dv2UT9e+9M39ISh01YDUNHG0IuCLT3qXls=; b=EpqqDes6ZceOZgBMDhfaJar/hkLfFCSh8rFPz3appwb9Cj2DNvwfAVyQkWolCnt8Ma R4juzu6Ih/ATQu3UP/c/eKUjSS13D6Yd/v9GFNS2AiGgXfnX7gdOZ6deLyJwLRay2sPk c5iIVo1xb81nPd7DdkUcHdy7uSgtVuxKMZZsAY4Msaw93CsLyN3doTq+JXDaV/CUN3bZ ESlmKNZaWfBjYnbqxOi5s8b4hM/sfRdDYXsTEoYSbKE3D/a7aFcjKAW/9LvDM7Baol9T TAiD6UMmQiwYWUBQK+GTdimig8j2qKcXf42kLKJXOrbf5CC0vOwOPcyGYlmBti4Ltu1P D1Bg== X-Gm-Message-State: AOJu0Yyk2Hg4Yh/Zzy9p/Jrq1W3bqUMd3sKBvYGokV06pdt0wNKBn32c yIySLtgMk/hyWKYfxLZgk7nQrK8oNX2+UdZVjFdLzIuP4ToFmsDMUnKxk0dM X-Google-Smtp-Source: AGHT+IH7Li5B3cAL97GEWqjSlEuUXVTUxUJ/9E9vUnEwF41NNFM4OUvSkmw8whEr1S1kjWgl21aTlQ== X-Received: by 2002:a05:6a20:c709:b0:1c4:230b:5ec7 with SMTP id adf61e73a8af0-1c8d749d270mr147075637.15.1723463880044; Mon, 12 Aug 2024 04:58:00 -0700 (PDT) Original-Received: from LAPTOP-ACR66VVN (139-218-25-158.sta.wbroadband.net.au. [139.218.25.158]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d1c9db44e5sm8063216a91.46.2024.08.12.04.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 04:57:59 -0700 (PDT) In-Reply-To: (Heime's message of "Mon, 12 Aug 2024 11:27:26 +0000") Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=joel.reicher@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147631 Archived-At: Heime writes: > On Monday, August 12th, 2024 at 10:50 PM, Joel Reicher=20 > wrote: > >> (imenu-flush-cache) >> >> Flush the current imenu cache. >> This forces a full rescan of the buffer to recreate the index=20 >> alist next time =A1=AEimenu=A1=AF is invoked. >> >> I think that will do what you want. > > When exactly should I call it ? I want the imenu menubar to be=20 > automatically updated. Currently I have to press rescan on the=20 > imenu menubar to update it. I think for the kinds of things you are doing you need to get used=20 to reading existing code. For example pressing rescan in the imenu=20 does this... ... (and (equal result imenu--rescan-item) (imenu--cleanup) (setq result t imenu--index-alist nil)) ... And to explain my suggestion above, imenu-flush-cache is defined=20 like so (defun imenu-flush-cache () ... (imenu--cleanup) (setq imenu--index-alist nil)) Cheers, - Joel