From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +AFnK1CT0F8hfwAA0tVLHw (envelope-from ) for ; Wed, 09 Dec 2020 09:05:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AJM2J1CT0F+GOwAAB5/wlQ (envelope-from ) for ; Wed, 09 Dec 2020 09:05:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 76652940148 for ; Wed, 9 Dec 2020 09:05:20 +0000 (UTC) Received: from localhost ([::1]:59022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmvPR-0005nE-Kh for larch@yhetil.org; Wed, 09 Dec 2020 04:05:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmvOE-0005mm-3c for emacs-orgmode@gnu.org; Wed, 09 Dec 2020 04:04:02 -0500 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:40562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmvOC-0000RK-Bs for emacs-orgmode@gnu.org; Wed, 09 Dec 2020 04:04:01 -0500 Received: by mail-pj1-x1042.google.com with SMTP id m5so548975pjv.5 for ; Wed, 09 Dec 2020 01:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version:content-disposition; bh=eHvJdt1MDBiZLGEYxrRi1mUJ15yhThgYtH56Yo1sZik=; b=WzNr1uWeSOC7zqGp/2s8MJ+6IEZMPuPm5NP7e2K/bzwCuQa/KLwzb6qGmp6CaKUlLj Oapu5cF31EcJ2/w9M+6ghNLXm3CPZrXRsN5Itq8x6gNcVxteH+6Dy1NAtfW9A9Zk4Rv/ M3twhfqw+i14DhZI+dO3uK//KHRmmfhIpfoaluOUqygZ1efRaIc6XP+1alcPS9X6lacQ bRQ4ER5+hV20FUGiE4uPYHTA/bKXgV0Fw16ICOtJCe0i2Ns0+7l/6QJKQKQzYkj+aFsf FWHAJdZ1/nqQho9h4rQXe2Xyz7PpzU9i4wxLC/Sh/amamb6//J7NUhsygdktNA90zMXR bOBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-disposition; bh=eHvJdt1MDBiZLGEYxrRi1mUJ15yhThgYtH56Yo1sZik=; b=iKR+zjzZf4LJCp7UkYTZI8317F3+96v8JDjycnmI0Tf9a56sljrvwt5W9HfbILHRGT gogvSL2C7vHjBQ46uocj0BEgg/MpRIIgrwRfHUrrJkwJOB1vOVeRAzivDdIAPno0lWdb c9ep9KSTghQxMJ2wiz2qN+wZD3hhAAUbDdButRAzwtwmcW/qhhJ5vliaKjA9OEHl0veU a8OxrdK7ARF5jbO3ZVSMw1D8Oa7x2jrfWFn4S1iKMCZ3fzDISLAcg/+l3odaD53/eq8n YhcK2QN4dMLudq8M00XcKx1HiKwnwJbpQyhiXyBNT6wf+R7+vjQPqp7jxSyOtqqE83jd AEIw== X-Gm-Message-State: AOAM531aCAYNFK/iqQ9Kg5u9Pktq3UOx2Lzq2diucAJcFAyiSrwFOyXQ zeVc4vghXw1psi1+hejcZ8joaV8oh57I9Q== X-Google-Smtp-Source: ABdhPJwKD98yCokhUwXQY9HQsSfTQZFS/0u7tVnYRBo57vlzbWurgknCul6Nmjb9Lxey4991fwe4wQ== X-Received: by 2002:a17:902:b08d:b029:da:a92b:7449 with SMTP id p13-20020a170902b08db02900daa92b7449mr1416907plr.64.1607504636380; Wed, 09 Dec 2020 01:03:56 -0800 (PST) Received: from localhost ([23.27.206.160]) by smtp.gmail.com with ESMTPSA id k23sm1643251pfk.50.2020.12.09.01.03.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 01:03:55 -0800 (PST) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH] Fix org-in-archived-heading-p when tag contains ARCHIVE as a substring X-Woof-Patch: t Date: Wed, 09 Dec 2020 17:07:44 +0800 Message-ID: <87o8j3e49r.fsf@localhost> MIME-Version: 1.0 Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-org-in-archived-heading-p.patch Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1042.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-TUID: FiIP4OvNiHSt >From c62cbd6ac6cf6a845703b3f7cfb64fa68e39079a Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Wed, 9 Dec 2020 16:59:58 +0800 Subject: [PATCH] Fix org-in-archived-heading-p * lisp/org.el (org-in-archived-heading-p): When called on a heading with a tag containing org-archive-tag string as a substring, that heading was incorrectly recognised as archived. Changed matching against the whole :tag1:tag2:...: string to matching against tag list as returned by `org-get-tags'. * testing/lisp/test-org.el (test-org/in-archived-heading-p): Add test when one of the heading tags contains org-archive-tag as a substring. --- Range-diff: 1: c62cbd6ac = 1: c62cbd6ac Fix org-in-archived-heading-p lisp/org.el | 5 ++--- testing/lisp/test-org.el | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d4fb18465..e44cdf1ca 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19285,10 +19285,9 @@ This function also checks ancestors of the current headline, unless optional argument NO-INHERITANCE is non-nil." (cond ((org-before-first-heading-p) nil) - ((let ((tags (nth 5 (org-heading-components)))) + ((let ((tags (org-get-tags nil 'local))) (and tags - (let ((case-fold-search nil)) - (string-match-p org-archive-tag tags))))) + (cl-some (apply-partially #'string= org-archive-tag) tags)))) (no-inheritance nil) (t (save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 5172afeec..a18d42a98 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -2103,7 +2103,12 @@ (should-not (org-test-with-temp-text "* Headline :ARCHIVE:\n** Level 2\nBody" (goto-char (point-max)) - (org-in-archived-heading-p t)))) + (org-in-archived-heading-p t))) + ;; Archive tag containing ARCHIVE as substring + (should-not + (org-test-with-temp-text "* Headline :NOARCHIVE:\n** Level 2\nBody" + (goto-char (point-max)) + (org-in-archived-heading-p)))) (ert-deftest test-org/entry-blocked-p () ;; Check other dependencies. -- 2.26.2