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 KE6JI1OS119RagAA0tVLHw (envelope-from ) for ; Mon, 14 Dec 2020 16:26:59 +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 OHhiH1OS11/5PwAA1q6Kng (envelope-from ) for ; Mon, 14 Dec 2020 16:26:59 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 1DB1E940111 for ; Mon, 14 Dec 2020 16:26:59 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7BF2529D21; Mon, 14 Dec 2020 11:25:22 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 7C5D529C87 for ; Mon, 14 Dec 2020 11:24:08 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 0E67716668 for ; Mon, 14 Dec 2020 17:24:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1607963043; bh=CAIart/VCiUIxa9 Xc6ZI+sS9QpeLIlQS2nYalrgsejo=; b=QdfarYNhajAbmk1T5LE2P/vmm6RIW2x gQpmKPzUlIpWfms0pAgMX23ltcdXrNBFsUZTwS9qmmJRgK3dxKyXORQfv9zlaP/q 49BqXEAxRnW+wtX10xt3LSHQ0AgeNeIpv6qkao/WLKOTOU/9VJkh5aw4x8l7M1zS ykhK0QO6yaGk= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id FeqCjR5x5sF2 for ; Mon, 14 Dec 2020 17:24:03 +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 CA6D716692 for ; Mon, 14 Dec 2020 17:24:03 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH 31/32] emacs: use string-empty-p Date: Mon, 14 Dec 2020 17:24:00 +0100 Message-Id: <20201214162401.19569-32-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201214162401.19569-1-jonas@bernoul.li> References: <20201214162401.19569-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: YOFEEWW4CSOF3SDFJA7SQWGGF3A6G4LT X-Message-ID-Hash: YOFEEWW4CSOF3SDFJA7SQWGGF3A6G4LT 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-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.73 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=bernoul.li header.s=sel2011a header.b=QdfarYNh; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 1DB1E940111 X-Spam-Score: 1.73 X-Migadu-Scanner: scn0.migadu.com X-TUID: dNIKpMIwbIB3 Unfortunately that means we have to explicitly require subr-x, which arguably should always be loaded without packages having to require it, but the Emacs developers decided otherwise. Loading it explicitly most likely comes without any additional cost because almost certainly some other packages would load it anyway--the functions it defines are that popular. And we are likely to use other functions from subr-x in the future. --- emacs/notmuch-lib.el | 3 ++- emacs/notmuch-mua.el | 3 ++- emacs/notmuch-show.el | 5 +++-- emacs/notmuch-tag.el | 3 ++- emacs/notmuch.el | 5 +++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index cbac8859..7a64e728 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -22,6 +22,7 @@ ;;; Code: (require 'cl-lib) +(require 'subr-x) (require 'mm-util) (require 'mm-view) @@ -283,7 +284,7 @@ (defun notmuch-poll () (interactive) (message "Polling mail...") (if (stringp notmuch-poll-script) - (unless (string= notmuch-poll-script "") + (unless (string-empty-p notmuch-poll-script) (unless (equal (call-process notmuch-poll-script nil nil) 0) (error "Notmuch: poll script `%s' failed!" notmuch-poll-script))) (notmuch-call-notmuch-process "new")) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 2e4dc71a..a8643522 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -22,6 +22,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'subr-x) (require 'message) (require 'mm-view) @@ -390,7 +391,7 @@ (defun notmuch-mua-mail (&optional to subject other-headers _continue (interactive) (when notmuch-mua-user-agent-function (let ((user-agent (funcall notmuch-mua-user-agent-function))) - (unless (string= "" user-agent) + (unless (string-empty-p user-agent) (push (cons 'User-Agent user-agent) other-headers)))) (unless (assq 'From other-headers) (push (cons 'From (message-make-from diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 27925669..13d08b62 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -26,6 +26,7 @@ (eval-when-compile (require 'cl-lib) (require 'pcase)) +(require 'subr-x) (require 'mm-view) (require 'message) @@ -337,7 +338,7 @@ (defun notmuch-show-with-message-as-text (fn) (header (concat "Subject: " subject "\n" "To: " to "\n" - (if (not (string= cc "")) + (if (not (string-empty-p cc)) (concat "Cc: " cc "\n") "") "From: " from "\n" @@ -1794,7 +1795,7 @@ (defun notmuch-show-filter-thread (query) Reshows the current thread with matches defined by the new query-string." (interactive (list (notmuch-read-query "Filter thread: "))) (let ((msg-id (notmuch-show-get-message-id))) - (setq notmuch-show-query-context (if (string= query "") nil query)) + (setq notmuch-show-query-context (if (string-empty-p query) nil query)) (notmuch-show-refresh-view t) (notmuch-show-goto-message msg-id))) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 3c958dd4..1e8f7d4d 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -26,6 +26,7 @@ (require 'cl-lib) (eval-when-compile (require 'pcase)) +(require 'subr-x) (require 'crm) @@ -456,7 +457,7 @@ (defun notmuch-update-tags (tags tag-changes) from TAGS if present." (let ((result-tags (copy-sequence tags))) (dolist (tag-change tag-changes) - (let ((tag (and (not (string= tag-change "")) + (let ((tag (and (not (string-empty-p tag-change)) (substring tag-change 1)))) (cl-case (aref tag-change 0) (?+ (unless (member tag result-tags) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6553893b..860b3d6a 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -66,6 +66,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'subr-x) (require 'mm-view) (require 'message) @@ -816,13 +817,13 @@ (defun notmuch-search-insert-authors (format-string authors) (setq invisible-string (notmuch-search-author-propertize invisible-string))) ;; If there is any invisible text, add it as a tooltip to the ;; visible text. - (unless (string= invisible-string "") + (unless (string-empty-p invisible-string) (setq visible-string (propertize visible-string 'help-echo (concat "..." invisible-string)))) ;; Insert the visible and, if present, invisible author strings. (insert visible-string) - (unless (string= invisible-string "") + (unless (string-empty-p invisible-string) (let ((start (point)) overlay) (insert invisible-string) -- 2.29.1