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 ms0.migadu.com with LMTPS id GEn8ATuyMmGGqAAAgWs5BA (envelope-from ) for ; Sat, 04 Sep 2021 01:39:39 +0200 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 2OE0OTqyMmF9QQAAB5/wlQ (envelope-from ) for ; Fri, 03 Sep 2021 23:39:38 +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 303C5AE6D for ; Sat, 4 Sep 2021 01:39:38 +0200 (CEST) Received: from localhost ([::1]:44320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMImW-0000P5-Dh for larch@yhetil.org; Fri, 03 Sep 2021 19:39:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMIlN-0000Ow-BA for emacs-orgmode@gnu.org; Fri, 03 Sep 2021 19:38:26 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:40887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMIlL-0000Pn-4b for emacs-orgmode@gnu.org; Fri, 03 Sep 2021 19:38:24 -0400 Received: by mail-qk1-x72f.google.com with SMTP id t190so752745qke.7 for ; Fri, 03 Sep 2021 16:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=K1Q7aSveFzdQ56uXeY+ePTJuYAeAQaG8fl3xQO7Z8XI=; b=aFR3SA4acO5JwX6jR22YBtKHBpBBhReTxFoNKmwocN57BnXq2YsP2dpM46AMA93FrJ EKP+MX+zaBiL5fGQJNoFhpQJ6nRpJ1oOteGN3oS190uhvSiQzRkzmlevqLfmrjmLJcC8 8M2HXAeUWsd+baNkhfsFTBaA8oEHIfYniUX0u8uZkEq8R8/Y6w520NXYZzqfxrauOyIT xhzyPDatYcojFtrbnDYM4Ct/Ge/KnsdLFRASoQOcbcaB/nbSIX5EpCuN1gmDpLn6snBy Q4PnGPW2C2RJsmj3YB2w+0xWC1SVBd33ZVr7lEWWjNGP6tZ+Tf7lWBVH6yCz6I46RrDw c0lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=K1Q7aSveFzdQ56uXeY+ePTJuYAeAQaG8fl3xQO7Z8XI=; b=E/DfOESrZX2vX70UVLAAbX+xcFJztGVtQ8b7vyQL4jtRh4k2tcX5dst+8w2+C21I+q pG3ewHaX+w2bgVWEhxB4RqjhM3fi3yO4LP89Dbt9iQYn/AE+jFXSo88mTA022xor7e69 joGo4/rKOAHQuN3BMAymjXq/DseU7e/yv8lY9/MENv/jPHPiZXKEaHH1F84989Nz3/1n i8PZR47v5MxCl5EiKiBkxjjzaam0BI309DtS3+amUhMkvk21MU2J/8io4auG8126SIjN tZf8ozRIBnqRYYIf9rEMdPtsaEgz6aGB/JKG0dPFWKHcpOpsHJCeyLNlnbRA48MuJBg1 h8bQ== X-Gm-Message-State: AOAM531z3zMZ/zoOVrKU+0wDAY059QNQ9xBWfJnLFX7H9HUlj/2AYzBf andXSuUOKXWLJvMX9OtXXA41tDjLqOQ= X-Google-Smtp-Source: ABdhPJyGdLLXmvlHnC5flXHidOXNU+9skOHnau8f9ek2I/69XerJ/iqj8ru/TMlZ3KZEuNM7bXqPlw== X-Received: by 2002:a37:f515:: with SMTP id l21mr1296411qkk.234.1630712301328; Fri, 03 Sep 2021 16:38:21 -0700 (PDT) Received: from nbook ([2601:82:c200:166d:2866:4a5e:aa1f:64c5]) by smtp.gmail.com with ESMTPSA id j23sm533774qkl.65.2021.09.03.16.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 16:38:20 -0700 (PDT) References: <87a6l4b0bx.fsf@gmail.com> <80pmtqp2wx.fsf@felesatra.moe> <87ilzhjwkk.fsf@gmail.com> <87mtotcuf5.fsf@gmail.com> User-agent: mu4e 1.6.4; emacs 28.0.50 From: No Wayman To: Allen Li Subject: Re: [BUG] [BUG] inconsistent behavior when reading multiple tags [9.4.6 (9.4.6-g366444 @ /home/n/.emacs.d/straight/build/org/)] Date: Fri, 03 Sep 2021 19:37:10 -0400 In-reply-to: <87mtotcuf5.fsf@gmail.com> Message-ID: <87y28ddyby.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=iarchivedmywholelife@gmail.com; helo=mail-qk1-x72f.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: , Cc: emacs-orgmode@gnu.org 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=1630712378; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=K1Q7aSveFzdQ56uXeY+ePTJuYAeAQaG8fl3xQO7Z8XI=; b=ZxkSgXXJNP6yHqsIZEvei/dHuN34lsLkF5DEoVE/XdN0swA33GIRC/JWezHihX//tx7OIm nHJXDMFUOfUVMV9N7JodqFEAV95nCojyNDVaX3DVCVepdwJR5fpG20c5eepafrBTwmk96k ayJvWwRBjj2dhrKpF9P0XPRGKze4duiJ/gBEDLNZ/ZqERQcVVZkqlmTn2xxAMSL/TvLg+X mh/Lo+Z8G0VYQMkvRFjC2lyVHNdR9mFH4T0c19sZae+mr299RhJxCmOAWp3/1vxYu9lgRU TKJT4AjpfwoEhFCEfm2JdlAyIvzUP3JHJbbm2yRJ//ha8D2E76WjBD6mHAPyfQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630712378; a=rsa-sha256; cv=none; b=jxe8KSfCvTOFzbgMnFO2ZclLYLYWGcbsLs8g86eowBngf8JeiR3qmvEeUwWNqhU7dqcNn9 GsN1zhCjuYhBquFFxtplWRK6P/p5Jq+KBmLIig1Fs/1xnwUFJGs/Hus+ngeF6VV/G9h2sy ucO4d7sPWojj4iNRP6B4FC6BY6q7sXn88RD5XdZ0ly9GZuSdsGj52ax5Vp9Yhf/qxXDNMk /7dXX7XiNU1gb4LUW0HgJZHFmDAhk07tYoX7duOF8hrKnahTk6BmSdf1uGXuJw89Vw8qgY yye5Qo/MvdTnRsZyJsQ4ep3L3ywppxujR9l+h1GKIoXjShb+70LrdM83T+fQWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aFR3SA4a; 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: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aFR3SA4a; 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: 303C5AE6D X-Spam-Score: -3.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: Q0lHr2WF9gMQ --=-=-= Content-Type: text/plain; format=flowed No Wayman writes: > No Wayman writes: > >> See the attached patch for a first draft implementation. > > Attached is a second draft which compiles cleanly and makes use > of mapconcat > where appropriate. > > [2. org-tags-crm-separators-2 --- text/x-patch; > 0001-Add-org-tags-crm-separators.patch]... See attached with amended commit message. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-org-tags-crm-separators.patch Content-Description: org-tags-crm-separators-3 >From d059c4369ac17fcba885adf87c95c6797894d230 Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Fri, 3 Sep 2021 14:50:48 -0400 Subject: [PATCH] Add org-tags-crm-separators * org.el (org-tags-crm-separators): Defcustom controlling which characters are used to delimit tags in commands which utilize `completing-read-multiple'. (org-set-tags-command, org-capture-fill-template): Make use of org-tags-crm-separators; Show delimiters in tag prompt. --- lisp/org-capture.el | 7 +++++-- lisp/org.el | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index c51744680..e51d039d5 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1740,9 +1740,12 @@ The template may still contain \"%?\" for cursor positioning." (org-add-colon-after-tag-completion t) (ins (mapconcat #'identity - (let ((crm-separator "[ \t]*:[ \t]*")) + (let* ((separators (or org-tags-crm-separators '(?: ?,))) + (crm-separator (org-tags-crm-regexp separators))) (completing-read-multiple - (if prompt (concat prompt ": ") "Tags: ") + (if prompt (concat prompt ": ") + (format "Tags (%s to delimit): " + (mapconcat #'char-to-string separators " "))) org-last-tags-completion-table nil nil nil 'org-tags-history)) ":"))) diff --git a/lisp/org.el b/lisp/org.el index ce68f4692..4cd173c99 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2980,6 +2980,11 @@ is better to limit inheritance to certain tags using the variables (const :tag "Reverse alphabetical" org-string-collate-greaterp) (function :tag "Custom function" nil))) +(defcustom org-tags-crm-separators '(?: ?,) + "List of tag delimiting characters used when reading multiple tags." + :type 'list + :group 'org-tags) + (defvar org-tags-history nil "History of minibuffer reads for tags.") (defvar org-last-tags-completion-table nil @@ -12007,6 +12012,10 @@ tags." ;; it now points to BLANK-START. Use COLUMN instead. (if in-blank? (org-move-to-column column) (goto-char origin)))))) +(defun org-tags-crm-regexp (chars) + "Return `crm-separator' regexp using CHARS as separators." + (format "[ \t]*%s[ \t]*" (regexp-opt (mapcar #'char-to-string chars)))) + (defun org-set-tags-command (&optional arg) "Set the tags for the current visible entry. @@ -12065,11 +12074,13 @@ in Lisp code use `org-set-tags' instead." inherited-tags 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]*")) + (let* ((org-add-colon-after-tag-completion (< 1 (length table))) + (separators (or org-tags-crm-separators '(?: ?,))) + (crm-separator (org-tags-crm-regexp separators))) (mapconcat #'identity (completing-read-multiple - "Tags: " + (format "Tags (%s to delimit): " + (mapconcat #'char-to-string separators " ")) org-last-tags-completion-table nil nil (org-make-tag-string current-tags) 'org-tags-history) -- 2.33.0 --=-=-=--