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 IL7bCUaIP1+pcAAA0tVLHw (envelope-from ) for ; Fri, 21 Aug 2020 08:39:34 +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 wEG3BUaIP1/4FgAA1q6Kng (envelope-from ) for ; Fri, 21 Aug 2020 08:39:34 +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 294AB940656 for ; Fri, 21 Aug 2020 08:39:33 +0000 (UTC) Received: from localhost ([::1]:41558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k92aA-000873-MG for larch@yhetil.org; Fri, 21 Aug 2020 04:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k92Zn-00086t-6h for emacs-orgmode@gnu.org; Fri, 21 Aug 2020 04:39:07 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:33496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k92Zl-0005sO-BR for emacs-orgmode@gnu.org; Fri, 21 Aug 2020 04:39:06 -0400 Received: by mail-pj1-x1041.google.com with SMTP id q93so650145pjq.0 for ; Fri, 21 Aug 2020 01:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=felesatra-moe.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Tv4SqBdVFQTffUXtngniAVrkW8sBKVqM5Ug0phtR0iA=; b=ulRu6gIVYpbrHz0HvpsLfGY/j1iXfhJmrkhCJEF/GumTmLV6n9SJi/BHsK28Qj4wE4 J6vKJkXEbN7woOMxb7IGrR5QGJIVfyP8HxElwG5cpyVq8quvGzi6416BierxAI/Eqbsg XPNnq4h1O4y0mbwGrKGS3wO+cX1Xq90ELEa5DcZiiBcacZk/+UYYQzRkylLv/fnVnJWD SfpWl4TQuHC4BFv62QsaCH4whk6LobF3IA115qU3OvihG6hs+f7+bjg/NuXFr4btpSJb C+ZZ2FLes10qlNhDTQWnWQjSKHAoqUJBCDhG289hoFgl64JO4mkQ9DePCjRX7cRTBRjK Bvgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Tv4SqBdVFQTffUXtngniAVrkW8sBKVqM5Ug0phtR0iA=; b=jh7vvWk9rZ6PmYKChCd5P09DnJYaPToYuvZgZHZEuAARLqjtpdEXIr/TmMmznJZqYV E6LYy1WU7cbhOh7bjEss9sxLLr6ISyYo3T66/b/mgTjJ2XLTBeRcX5oSd3clIhN/NKyi 5ovxz3tG2Le+/bDIUq2sJ8yVP/U4DhpmvcRWFVnaymtvHpGTNrBS4bAWcWyVkngA8Yh4 I37vRwJGNgM93ZzVbdtEUQ1tGwKbIMNrIIusCRbJpqO9UTNsa7J++v1hsJRcsIeBelnW gN1O2Ph9KRlrJrHe0jpAj0BHnHmkVpV+DTi6NbNBslgj69rJT/mjfWbQ9BEl4Kr3wML9 UUgQ== X-Gm-Message-State: AOAM531Uv6/AhcvnOc492jhcpi/AHJsbHlDKYZpzSDo8p0CHjTI02QER AS17+BAhTI94f7bZc1Ja391niHnFB7GDArx7 X-Google-Smtp-Source: ABdhPJwzfNsEJdCiPP4CceCbyO92Y5mc1G2vfxIbZZ83XGIjXfMSzZOnE15qgOkHzuCyevMsVitE0A== X-Received: by 2002:a17:90a:d504:: with SMTP id t4mr1668355pju.58.1597999143201; Fri, 21 Aug 2020 01:39:03 -0700 (PDT) Received: from localhost ([2600:1700:7270:7d1f:fa59:71ff:fe00:10cc]) by smtp.gmail.com with ESMTPSA id c27sm1413221pgn.86.2020.08.21.01.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 01:39:02 -0700 (PDT) From: Allen Li To: Kyle Meyer Subject: Re: Bug: org-set-tags-command deletes inherited tags [9.3.7 (9.3.7-18-g093b47-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20200810/)] References: <80a6yry3sg.fsf@felesatra.moe> <87o8n7w8i7.fsf@kyleam.com> Date: Fri, 21 Aug 2020 01:39:01 -0700 In-Reply-To: <87o8n7w8i7.fsf@kyleam.com> (Kyle Meyer's message of "Wed, 19 Aug 2020 00:43:28 -0400") Message-ID: <805z9cxuje.fsf@felesatra.moe> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=darkfeline@felesatra.moe; helo=mail-pj1-x1041.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=felesatra-moe.20150623.gappssmtp.com header.s=20150623 header.b=ulRu6gIV; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: xfOHVha+XuYZ Kyle Meyer writes: > That looks good as far as fixing the misbehavior you report. I wonder > though whether there's a deeper org-get-tags issue here worth > considering. Its documentation says > > ... the returned list of tags contains tags in this order: file > tags, tags inherited from parent headlines, local tags. > > But it's not specified what happens when a tag is both local and > inherited. The current implementation drops the local tag variant > through its delete-dups call: > > (delete-dups > (append (org-remove-uninherited-tags itags) ltags)) > > I would have expected the local tag to get priority here. If that were > the case (e.g., something like below), that would also solve the issue > you describe. > > Thoughts? That sounds reasonable, let me prepare a new patch. > > -- >8 -- > diff --git a/lisp/org.el b/lisp/org.el > index fb95590fc..3dac42b7b 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -12310,8 +12310,10 @@ (defun org-get-tags (&optional pos local) > (org--get-local-tags)) > itags))) > (setq itags (append org-file-tags itags)) > - (delete-dups > - (append (org-remove-uninherited-tags itags) ltags)))))))) > + (nreverse > + (delete-dups > + (nreverse (nconc (org-remove-uninherited-tags itags) > + ltags)))))))))) > > (defun org-get-buffer-tags () > "Get a table of all tags used in the buffer, for completion."