From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WCkHNpDvsl9tVQAA0tVLHw (envelope-from ) for ; Mon, 16 Nov 2020 21:30:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id uJ/fMZDvsl/dGAAA1q6Kng (envelope-from ) for ; Mon, 16 Nov 2020 21:30:56 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8A190940415 for ; Mon, 16 Nov 2020 21:30:56 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5FEDF28CC3; Mon, 16 Nov 2020 16:29:32 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id BFE6428C32 for ; Mon, 16 Nov 2020 16:28:46 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 41FD81625C for ; Mon, 16 Nov 2020 22:28:44 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id mz4bzH2y13EN for ; Mon, 16 Nov 2020 22:28:44 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 0EEDF1616D for ; Mon, 16 Nov 2020 22:28:44 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH v2 16/23] emacs: inline notmuch-documentation-first-line Date: Mon, 16 Nov 2020 22:28:36 +0100 Message-Id: <20201116212843.6420-17-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116212843.6420-1-jonas@bernoul.li> References: <20201108190311.1397-1-jonas@bernoul.li> <20201116212843.6420-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: X2CJD3AMPTJKAABM5MDXMAY5YDYGRM2I X-Message-ID-Hash: X2CJD3AMPTJKAABM5MDXMAY5YDYGRM2I X-MailFrom: jonas@bernoul.li X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: NG4m4DNQWmCL Inline a simplified version of `notmuch-documentation-first-line' into its only caller. The new code snippet differs from the removed function in that it returns nil instead of the empty string for symbols that have no function documentation. That value is ultimately used as an argument to `concat', which treats nil like the empty string. So we can do the logical thing without changing the behavior. --- emacs/notmuch-lib.el | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index d7c6b737..61107e38 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -287,18 +287,6 @@ (defun notmuch-bury-or-kill-this-buffer () (bury-buffer) (kill-buffer))) -(defun notmuch-documentation-first-line (symbol) - "Return the first line of the documentation string for SYMBOL." - (let ((doc (documentation symbol))) - (if doc - (with-temp-buffer - (insert (documentation symbol t)) - (goto-char (point-min)) - (let ((beg (point))) - (end-of-line) - (buffer-substring beg (point)))) - ""))) - (defun notmuch-prefix-key-description (key) "Given a prefix key code, return a human-readable string representation. @@ -331,7 +319,10 @@ (defun notmuch-describe-key (actual-key binding prefix ua-keys tail) (or (and (symbolp binding) (get binding 'notmuch-doc)) (and (functionp binding) - (notmuch-documentation-first-line binding)))) + (let ((doc (documentation binding))) + (and doc + (string-match "\\`.+" doc) + (match-string 0 doc)))))) tail))) tail) -- 2.29.1