From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Jumping to message by ID Date: Fri, 20 Oct 2023 13:26:19 +0300 Message-ID: <83sf65si7o.fsf@gnu.org> References: <87bkctiujw.fsf@autistici.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25474"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Andrea Monaco Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 20 12:28:01 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qtmjZ-0006LD-2O for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Oct 2023 12:28:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtmiq-0005Et-B5; Fri, 20 Oct 2023 06:27:17 -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 1qtmiG-0005Bh-2e for emacs-devel@gnu.org; Fri, 20 Oct 2023 06:26:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtmiE-00053r-W5; Fri, 20 Oct 2023 06:26:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iiTcD7VLrq8ghJh/N0+fTgLtUCBVXXBVa/N73ifmxwg=; b=Be4EmsG1wnDW bqYgKn9hn2uzHW7Dp5eT2n7Kir6R21YSYIsgDShureLESpv6nN+a9meF3UyX7LRvrJ7cgGtvXvu9W 20FA6JIkxK9iOGaP5xB57eJzy4SwvSDiR8huKFBBNFDmRbEAVL3HVeLNMCFBv/3bh+EcV3z3o1Wbi K5JpfJjHfa/eNBtw5Zv2uen9uT3nQoTSIWLnEZsoKf1c8IBzBgtF5Mjzq3t9Fw4SVF0v9QsWx9egM i/3mR60kWIm2ItgU/jgHI+3eNAZEHHkDr+Ha5HFL+LElWOOvu/djAOzp6ywqomDAyo/mles5L007c UZ84p9XK56ok9joOZIeWVA==; In-Reply-To: <87bkctiujw.fsf@autistici.org> (message from Andrea Monaco on Fri, 20 Oct 2023 10:09:55 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311622 Archived-At: > From: Andrea Monaco > Cc: emacs-devel@gnu.org > Date: Fri, 20 Oct 2023 10:09:55 +0200 > > > +(defun rmail-get-email-address-at-point () > + "Return the email address or message id around point, or nil if none is present." The name of the function doesn't seem to reflect what it does. Can you come up with a better name? > +(defun rmail-show-message-by-id (&optional id) > + "Show message with given Message ID, defaulting to the id around point." > + (interactive > + (list (rmail-get-email-address-at-point))) > + (unless id > + (error "No message ID around point")) > + (let ((id (rmail-get-email-address-at-point))) > + (when id > + (unless (and rmail-summary-message-parents-vector > + (= (length rmail-summary-message-parents-vector) > + (1+ rmail-total-messages))) > + (rmail-summary-fill-message-parents-and-descs-vectors)) > + (let ((entry (assoc id (gethash id rmail-summary-message-ids-hash-table)))) > + (if entry > + (rmail-show-message (cdr entry)) > + (error (concat "No message with ID " id " found"))))))) > + If I have many hundreds of messages in my INBOX (e.g., I have almost 2100 now where I'm typing this, and this number is not an anomaly in my Rmail use patterns), wouldn't rmail-summary-fill-message-parents-and-descs-vectors take a significant time? If so, perhaps it would make sense to update the data each time we update the summary, instead of punishing the first call after getting new email? Thanks.