From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kLToJwrTJ2F+IQAAgWs5BA (envelope-from ) for ; Thu, 26 Aug 2021 19:44:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eIl2IwrTJ2E2agAAbx9fmQ (envelope-from ) for ; Thu, 26 Aug 2021 17:44:42 +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 E53741A603 for ; Thu, 26 Aug 2021 19:44:41 +0200 (CEST) Received: from localhost ([::1]:35292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJJQe-0003Uj-4R for larch@yhetil.org; Thu, 26 Aug 2021 13:44:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJIrm-0000C6-Bx for emacs-orgmode@gnu.org; Thu, 26 Aug 2021 13:08:38 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:41924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJIrh-0003YE-BR for emacs-orgmode@gnu.org; Thu, 26 Aug 2021 13:08:37 -0400 Received: by mail-qt1-x835.google.com with SMTP id u21so3049131qtw.8 for ; Thu, 26 Aug 2021 10:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:date:message-id:mime-version; bh=qidHiFz/YwS+EBLiYzq4+9BBSMpN5iznl33AEw6M3VQ=; b=bXT8+SqEQV6wt2y8KRsCeEmqWsP9ZEk9ConwaIXjuHS/o6iNjYdyHa/ujonDORw4Vq Z6a3UeTmPrjaz8nrjeimKCwIAibsE16oWP4qG8fYQ89V1vhYN8g+FPlRaJ6Wcy57NHST +ExpSUeYKbjUVM67QFKYksOd3G96Hk+6gaj3wIAbvjmzTSM7WqUp1RIjlxpzkXyxP4aH B+2prVTA76qOhYzB8FZZfW5aTOCBy8yZd1sYrwFjwU16+4TyBQyWsqfSBKYr8K38lgtP j5WE+MRlZHwpx0iwic84aUSc3Fl/CeKXkqxSDhn3eJwq56cNqFvgWX+LXucx631q/bKY mHAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=qidHiFz/YwS+EBLiYzq4+9BBSMpN5iznl33AEw6M3VQ=; b=l+96eUfOG/CwwsncjleCAgFvHn2J5sL+nrMJmtUnY0HBc7oZAkBQl4dKpgnVhjzZ9H pTshOtokt4ImobZfPvuQKuz1gSU0d5Nwzb2oOCaRfr48X1+1aYnoXEJnkECQ7kpomfPM Fzso75dgZfJCaTMNnjT/nI7IELo6Qnr+g5H4BN04xdUq0i7pAcuu0uf5SwlA5w2lR9hE e/N4fAif1gFkvsd1bLaoguV6kXTtZIhP/3qPeoC9KK7zOJRQBgknBjytywli2goO9133 FR6Vyx1XcNF11R3/5XU4vFfghPwZGPS86uZ+8H741z7FmBLdgmJ58oKVcutPDb0Cxjtt N+Xg== X-Gm-Message-State: AOAM532ypPkIXh0jykTxl0DX9vz2OXBGZLZoRyeLZqkUyYU+fNpISAo2 9MhbFZLyrcTSoH/WAspHb6UNBhLohF8= X-Google-Smtp-Source: ABdhPJzxRV3RrK32OFPk9cHoyWYECaZzxj3rGnI3/cxpPd59oEvmXKB+pWvXlIj9MHWsKE+PontN2w== X-Received: by 2002:a05:622a:1a8c:: with SMTP id s12mr4212534qtc.232.1629997710686; Thu, 26 Aug 2021 10:08:30 -0700 (PDT) Received: from nbook (c-69-141-33-245.hsd1.nj.comcast.net. [69.141.33.245]) by smtp.gmail.com with ESMTPSA id i67sm2833157qkd.90.2021.08.26.10.08.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 10:08:30 -0700 (PDT) User-agent: mu4e 1.6.4; emacs 28.0.50 From: No Wayman To: emacs-orgmode@gnu.org Subject: [BUG] [BUG] inconsistent behavior when reading multiple tags [9.4.6 (9.4.6-g366444 @ /home/n/.emacs.d/straight/build/org/)] Date: Thu, 26 Aug 2021 13:04:20 -0400 Message-ID: <87a6l4b0bx.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=iarchivedmywholelife@gmail.com; helo=mail-qt1-x835.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629999882; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=qidHiFz/YwS+EBLiYzq4+9BBSMpN5iznl33AEw6M3VQ=; b=l0lBRXggPGtCr4kMjoTZb6qT51AllxwzNvSsgzqC+Gh9mt4TW0BJ2ib8y5/xm5gpoSqv3d YUUn/4jrPlc6kwEMXTdvaztxGCzT1K/M2JEZwnuAK8gLK5og7lcxyxtM5274+1e+EYzwIm bKODrQbIBup2jgSZ5oiP9drIWZHGN+dYF2i7A71iOEOXGSJmo6AMYLWNS3Z1lDG5jG5sG9 r5EcGFH5b8k44FxE0xp1Nt+Fy4CvA39KaR1OdadvmNuhdkSYITPD41KLvfopbMRmKP6tOa KKiZ9YOaR0X6W2JvA4gJZZw5/l+kbVsZrn2sixr7TsE7NHb+DwgLiszUw03Jww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629999882; a=rsa-sha256; cv=none; b=RDKK5QL5EDP+DXB8UmyD2M6NfGUT2a5JVDSwX/xilVYy5AXJ7MiJhssZR8CCZZ+Q21ywcY vLc9RImKMRBczrYRMEk8GLCkhm6BG8jJCcp5fFUv0DpJb6htOHMpG7jNhZHmH4XVcF3jiW 0bDA01GGIDaZwPIgyPExg9Ws0q5z1A1FjgdHAkx+vmD4AcEMlbE7t85tg0YZ1QfwoUv82e AQqPrn454st/iCO+uLRT11Zo/6cYObS7uhxSJYhxvpwLuw3jQZflj5k7acv+JfzjppwaCi wfcPFK/hA2jQX55azIOJSuugUUzOIUE8xkXFHnKFNOX/EWujxzGZKR+BaARL5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=bXT8+SqE; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Spam-Score: -1.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=bXT8+SqE; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Queue-Id: E53741A603 X-Spam-Score: -1.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: p5+Gx6p9hbjG --=-=-= Content-Type: text/plain; format=flowed Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ 622f9fa76c8ee0766b15945c013b0950d703b955 ("org: Use crm for completing tags") lexically binds crm-separator to ":" while prompting for multiple tags in org-set-tags-command and org-capture-fill-template. org-set-tags-command correctly parses the tags when using a comma (the default crm-separator) to separate them, but completion is broken unless ":" is used as the separator. org-capture-fill-template incorrectly parses this. Reproducible from emacs -Q: org-set-tags-command: 1. Insert a new Org entry in the a buffer 2. M-x org-set-tags-command 3. At the prompt enter "one,two,three" 4. Entry's tags are correctly set to :one:two:three: org-capture-fill-template: 1. evaluate (org-capture-fill-template "%^g") 2. At the prompt enter "one,two,three" 3. String returned is incorrect: ":one,two,three:" I can think of a couple ways we could improve this and make the behavior consistent. We could introduce a defcustom which allows the user to choose whether or not Org will rebind crm-separator during commands/functions which utilize completing-read-multiple. e.g. #+begin_src emacs-lisp :lexical t (defcustom org-contextual-crm-separator t "Use contextual binding of crm-separator during Org commands. For example, when setting tags, \":\" is used as the separator. If nil, `crm-separator' is used.") #+end_src Alternatively, we could change the lexical binding we're using during these commands/functions. Instead of binding the separator explicitly to "[ \t]*:[ \t]*", we could instead use a regexp which will match any character not described by org-tag-re. The benefit of this is that completing-read-multiple completion will work for any separator that doesn't match org-tag-re transparently and the results should be consistent between org-set-tags-command and org-capture-fill-template. The attached patch implements that change, which seems to do the right thing from my testing. I can polish it, but I wanted to get opinions on the solution first. Note this does not change the case of org-todo-list, which binds crm-separator to "|". I chose not to touch that because I'm not fully aware of what the restrictions on characters for todo-keywords are, if any. org-todo-list also does the right thing by mentioning the separator in the prompt. We could also combine the approaches: - Introduce a defcustom that determines if we're going to contextually rebind crm-separator - Use a broader regexp when contextually binding crm-separator - Mention the separator in the prompt when rebound Thoughts? Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-08-02 Package: Org mode version 9.4.6 (9.4.6-g366444 @ /home/n/.emacs.d/straight/build/org/) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-RFC-broader-regexp-for-lexically-bound-crm-separator.patch Content-Description: rfc-broader-regexp-for-lexically-bound-crm-separator >From 2ec28b530eb28cf788c38556ec3cb97f3bacd4af Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Thu, 26 Aug 2021 12:51:27 -0400 Subject: [PATCH] RFC: broader regexp for lexically bound crm-separator For testing purposes. Ammended commit message pending. --- lisp/org-capture.el | 2 +- lisp/org.el | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index c51744680..47b47c3ca 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1740,7 +1740,7 @@ The template may still contain \"%?\" for cursor positioning." (org-add-colon-after-tag-completion t) (ins (mapconcat #'identity - (let ((crm-separator "[ \t]*:[ \t]*")) + (let ((crm-separator org-tag-crm-separator)) (completing-read-multiple (if prompt (concat prompt ": ") "Tags: ") org-last-tags-completion-table nil nil nil diff --git a/lisp/org.el b/lisp/org.el index ce68f4692..f5e396cba 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -602,6 +602,9 @@ not contribute to the agenda listings.") (defconst org-tag-re "[[:alnum:]_@#%]+" "Regexp matching a single tag.") +(defconst org-tag-crm-separator "[ \t]*[^[:alnum:]_@#%][ \t]*" + "Regexp used to determine `crm-separator' when reading multiple tags.") + (defconst org-tag-group-re "[ \t]+\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$" "Regexp matching the tag group at the end of a line, with leading spaces. Tags are stored in match group 1. Match group 2 stores the tags @@ -12066,7 +12069,7 @@ in Lisp code use `org-set-tags' instead." table (and org-fast-tag-selection-include-todo org-todo-key-alist)) (let ((org-add-colon-after-tag-completion (< 1 (length table))) - (crm-separator "[ \t]*:[ \t]*")) + (crm-separator org-tag-crm-separator)) (mapconcat #'identity (completing-read-multiple "Tags: " -- 2.33.0 --=-=-=--