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 uCYiBG3B/l8sRwAA0tVLHw (envelope-from ) for ; Wed, 13 Jan 2021 09:46:21 +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 iPyAO2zB/l9fRwAAB5/wlQ (envelope-from ) for ; Wed, 13 Jan 2021 09:46: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 D1BA39402D4 for ; Wed, 13 Jan 2021 09:46:20 +0000 (UTC) Received: from localhost ([::1]:59544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzcjL-0005cj-LB for larch@yhetil.org; Wed, 13 Jan 2021 04:46:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzcdI-0008UF-A5 for emacs-orgmode@gnu.org; Wed, 13 Jan 2021 04:40:04 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:38162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzcdF-0006cf-KT for emacs-orgmode@gnu.org; Wed, 13 Jan 2021 04:40:04 -0500 Received: by mail-ej1-x635.google.com with SMTP id 6so2124053ejz.5 for ; Wed, 13 Jan 2021 01:40:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:reply-to:accept-language:content-language :mime-version; bh=vSdH3L5HAdJuwHZPjHGeiuNUOr59KHEMKTaIWErbkLA=; b=O1EjaKPpQ3jog21CTVcTaSa9lNhbranqQgf2UzTQoijJhQq+dq4DMU5KA4qjlSMeio +fokU9shMFC6DvlA/+xdaF9Oi1JztIlbdybhLhzYSbOwJF/HVnUiJwUT7SnoHKaUlpwz XSe3zacqdH4Sqqzxt1DZWdHIovO+z7Kf2VWZckoLNQkbziQj6aUfOyRXNiEPDzwQ0I2B LCm35/fUKaYsBDjqAEHv3VC2vLwlaKouWs49fP33vYdXkJzYUVKe9Ag7/twjW0Tewkjz cE94Z/HhlhSFZ+nryt5tIkXpdCe5ZygLFkhmbMYAthwehNuZpzpimaYZFsXm951ydRiU roGA== 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:thread-topic:thread-index :date:message-id:references:in-reply-to:reply-to:accept-language :content-language:mime-version; bh=vSdH3L5HAdJuwHZPjHGeiuNUOr59KHEMKTaIWErbkLA=; b=GxMViVLH+Q4Tyt2ZPU01bm9AFYJgFH9/saY2s+BFRQSw+MP6fgMxVGaB0tLJYnrtK7 huU/WXFGgP8+OlBAD7qmhO8ZBcNFSjGZ+4q46Y+KhmcyXLiStZnxLM4RPbWHcD6hNa4J L79jA13Sxfegz/Ewq+9aiXTM6vLiNhD70i8usCZKhsMXLW6viHOKRL06ndx0wiia9Lh8 QfjHZUWUxLGlAWgwDU/lsvB/Ijnljy9KbYLbHTl/jw4+vtaTO0jfTkZN+0T9bMoVDdl6 3I7O1sHggOTSAg2axfKUqiVA6vxcCs6wLn5dEZYELupuspSlaBaH8K6uKm74DxforOG6 kIRQ== X-Gm-Message-State: AOAM530Jb1+HG2sXwEE++iOG519/sXYyQmWjuYxBxysu4V3AmH6GQUq3 PEx/CJknQmyruciNke6diQ== X-Google-Smtp-Source: ABdhPJx4MGgfATPn1Z8DRYbXm/OAjTSwwULYzGlcLjp6rYaZeFeFs7Dl9E1XJ4Io4rl9LROzTELiyQ== X-Received: by 2002:a17:906:fb1a:: with SMTP id lz26mr953600ejb.194.1610530800028; Wed, 13 Jan 2021 01:40:00 -0800 (PST) Received: from VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM ([2603:1026:300:5a::5]) by smtp.gmail.com with ESMTPSA id fi12sm400942ejb.49.2021.01.13.01.39.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jan 2021 01:39:58 -0800 (PST) Received: from dark (183.246.145.17) by TY2PR0101CA0034.apcprd01.prod.exchangelabs.com (2603:1096:404:8000::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9 via Frontend Transport; Wed, 13 Jan 2021 09:30:52 +0000 From: Christopher Miles To: Kyle Meyer Subject: Re: [PATCH] I updated patch by deleteing duplicate tags Thread-Topic: [PATCH] I updated patch by deleteing duplicate tags Thread-Index: AQHW1cT5VlMPkqXw50ywC2Yyyw2F3aohj12AgAA7O4CAA0G1AIAAZLIA X-MS-Exchange-MessageSentRepresentingType: 1 Date: Wed, 13 Jan 2021 09:30:56 +0000 Message-ID: References: <87sg78phnc.fsf@kyleam.com> <87sg7534az.fsf@kyleam.com> In-Reply-To: <87sg7534az.fsf@kyleam.com> Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Exchange-Organization-AuthAs: Internal X-MS-Exchange-Organization-AuthMechanism: 06 X-MS-Exchange-Organization-AuthSource: VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM X-MS-Has-Attach: yes X-MS-Exchange-Organization-Network-Message-Id: 79e1405e-90bd-4fb1-3088-08d8b7a5ed60 X-MS-Exchange-Organization-SCL: -1 X-MS-TNEF-Correlator: X-MS-Exchange-Organization-RecordReviewCfmType: 0 x-clientproxiedby: TY2PR0101CA0034.apcprd01.prod.exchangelabs.com (2603:1096:404:8000::20) To VI1PR1001MB1070.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:69::18) Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=numbchild@gmail.com; helo=mail-ej1-x635.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: , Reply-To: Christopher Miles Cc: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: D1BA39402D4 X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: oSk+Of5tAv6I --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Kyle Meyer writes: > Christopher Miles writes: > >> Kyle Meyer writes: >> >>> stardiviner writes: >>>>> By this patch, will merge both buffer-local tags and user defined glo= bal >>>>> `org-tags-alist`. >>> >>> It does a bit more than that. It uses org-global-tags-completion-table, >>> which considers tags in all agenda files by default and takes into >>> account org-tag-alist (as well as org-tag-persistent-alist) via the use >>> of the org-current-tag-alist variable. >> >> That's what I want. Why obviously user pre-defined tags can't be used gl= obally. >> Right? It should be. > > My point was that it's not just adding these pre-defined lists (#1); > it's also adding tags from agenda files (#2). I think we certainly > don't want to do #2 unconditionally. On the other hand, #1 is probably > okay, but as I said in my last email, I could see not wanting that > either. > > Anyway, the patch I proposed (which you've adapted for your latest > round), avoids #2 by guarding the behavior behind the existing > org-complete-tags-always-offer-all-agenda-tags option, and I think > that's a good path forward. > >> Subject: [PATCH] org.el: Complete tags from both global and buffer local >> >> * lisp/org.el (org-fast-tag-selection): Merge buffer local tags with >> global alist of tags. And it obey the option >> org-complete-tags-always-offer-all-agenda-tags. > > s/obey/&s/ Applied. > >> * doc/org-manual.org: Update the TAB key doc in tags selection UI. >> >> * etc/ORG-NEWS: Mention the change in org-set-tags-command. >> --- >> doc/org-manual.org | 6 +++--- >> etc/ORG-NEWS | 5 +++++ >> lisp/org.el | 24 ++++++++++++++---------- >> 3 files changed, 22 insertions(+), 13 deletions(-) >> >> diff --git a/doc/org-manual.org b/doc/org-manual.org >> index b015b502c..01cec4b8d 100644 >> --- a/doc/org-manual.org >> +++ b/doc/org-manual.org >> @@ -4860,9 +4860,9 @@ In this interface, you can also use the following = special keys: >>=20=20 >> #+kindex: TAB >> Enter a tag in the minibuffer, even if the tag is not in the >> - predefined list. You can complete on all tags present in the >> - buffer. You can also add several tags: just separate them with >> - a comma. >> + predefined list. You can complete on all tags present in the buffer >> + and globally pre-defined tags from ~org-tag{-persistent}-alist~. > > Please spell these two options out: ~org-tag-alist~ and > ~org-tag-persistent-alist~. Applied. > >> + You can also add several tags: just separate them with a comma. >>=20=20 >> - {{{kbd(SPC)}}} :: >>=20=20 >> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS >> index 5e5f1954d..5e68d27c0 100644 >> --- a/etc/ORG-NEWS >> +++ b/etc/ORG-NEWS >> @@ -149,6 +149,11 @@ Example: >> A new =3Du=3D mode flag for Calc formulas in Org tables has been added = to >> enable Calc units simplification mode. >>=20=20 >> +*** =3Dorg-set-tags-command=3D select tags from ~org-global-tags-comple= tion-table~ >> + >> +Let =3Dorg-set-tags-command=3D complete tags from global tags list (both >> +buffer-local tags and ~org-tag{-persistent}-alist~). > > Same note about avoiding shorthand for the option names. Applied. > > Also, please rewrite this to make it clear that this is relevant for TAB > in the fast completion interface. It's probably also worth mentioning > that org-complete-tags-always-offer-all-agenda-tags is now honored. > > And, very minor, but any reason for the mix of =3D...=3D and ~...~ markup > here? Maybe our recognition is different I personally like to markup command as verbatim, and option as code to display as two different face color. I forg= et to drop my habit.... Now fixed to use "~code~". > >> diff --git a/lisp/org.el b/lisp/org.el >> index 5b0ae389c..ba816dfa6 100644 >> --- a/lisp/org.el >> +++ b/lisp/org.el >> @@ -12139,7 +12139,7 @@ (defun org-fast-tag-selection (current inherited= table &optional todo-table) >> fulltable)))) >> (buf (current-buffer)) >> (expert (eq org-fast-tag-selection-single-key 'expert)) >> - (buffer-tags nil) >> + (tab-tags nil) >> (fwidth (+ maxlen 3 1 3)) >> (ncol (/ (- (window-width) 4) fwidth)) >> (i-face 'org-done) >> @@ -12274,16 +12274,20 @@ (defun org-fast-tag-selection (current inherit= ed table &optional todo-table) >> (setq current nil) >> (when exit-after-next (setq exit-after-next 'now))) >> ((=3D c ?\t) >> - (condition-case nil > > Unlike the patch I sent, you've dropped the condition-case here, which I > don't think was intentional. > Added back now. > Thanks. =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org.el-Complete-tags-from-both-global-and-buffer-loc.patch Content-Transfer-Encoding: quoted-printable Content-Description: latest patch From=204bb6ca19ceb8dbd8f827e4df2d7cc4ec7c7a931b Mon Sep 17 00:00:00 2001 From: stardiviner Date: Wed, 2 Dec 2020 17:24:29 +0800 Subject: [PATCH] org.el: Complete tags from both global and buffer local * lisp/org.el (org-fast-tag-selection): Merge buffer local tags with global alist of tags. And it obeys the option org-complete-tags-always-offer-all-agenda-tags. * doc/org-manual.org: Update the TAB key doc in tags selection UI. * etc/ORG-NEWS: Mention the change in org-set-tags-command. =2D-- doc/org-manual.org | 7 ++++--- etc/ORG-NEWS | 7 +++++++ lisp/org.el | 25 +++++++++++++++---------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index b015b502c..e717f9261 100644 =2D-- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -4860,9 +4860,10 @@ In this interface, you can also use the following sp= ecial keys: =20 #+kindex: TAB Enter a tag in the minibuffer, even if the tag is not in the =2D predefined list. You can complete on all tags present in the =2D buffer. You can also add several tags: just separate them with =2D a comma. + predefined list. You can complete on all tags present in the buffer + and globally pre-defined tags from ~org-tag-alist~ and + ~org-tag-persistent-alist~. You can also add several tags: just + separate them with a comma. =20 - {{{kbd(SPC)}}} :: =20 diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 5e5f1954d..0c9bb99d3 100644 =2D-- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -149,6 +149,13 @@ Example: A new =3Du=3D mode flag for Calc formulas in Org tables has been added to enable Calc units simplification mode. =20 +*** =3Dorg-set-tags-command=3D select tags from ~org-global-tags-completio= n-table~ + +Let ~org-set-tags-command~ TAB fast tag completion interface complete +tags including from both buffer local and user defined persistent +global list (~org-tag-alist~ and ~org-tag-persistent-alist~). Now +option ~org-complete-tags-always-offer-all-agenda-tags~ is horored. + ** Miscellaneous *** =3Dorg-goto-first-child=3D now works before first heading =20 diff --git a/lisp/org.el b/lisp/org.el index 5b0ae389c..5b1443c4e 100644 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -12139,7 +12139,7 @@ (defun org-fast-tag-selection (current inherited ta= ble &optional todo-table) fulltable)))) (buf (current-buffer)) (expert (eq org-fast-tag-selection-single-key 'expert)) =2D (buffer-tags nil) + (tab-tags nil) (fwidth (+ maxlen 3 1 3)) (ncol (/ (- (window-width) 4) fwidth)) (i-face 'org-done) @@ -12274,16 +12274,21 @@ (defun org-fast-tag-selection (current inherited = table &optional todo-table) (setq current nil) (when exit-after-next (setq exit-after-next 'now))) ((=3D c ?\t) =2D (condition-case nil =2D (setq tg (completing-read =2D "Tag: " =2D (or buffer-tags =2D (with-current-buffer buf =2D (setq buffer-tags =2D (org-get-buffer-tags)))))) =2D (quit (setq tg ""))) + (condition-case nil + (unless tab-tags + (setq tab-tags + (delq nil + (mapcar (lambda (x) + (let ((item (car-safe x))) + (and (stringp item) + (list item)))) + (org--tag-add-to-alist + (with-current-buffer buf + (org-get-buffer-tags)) + table)))))) + (setq tg (completing-read "Tag: " tab-tags)) (when (string-match "\\S-" tg) =2D (cl-pushnew (list tg) buffer-tags :test #'equal) + (cl-pushnew (list tg) tab-tags :test #'equal) (if (member tg current) (setq current (delete tg current)) (push tg current))) =2D-=20 2.29.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl/+vcEACgkQG13xyVro msPDJwgAuFnu5ztAo3TXeYBB1gCgBbEe5CbK45OgCYfo22fG6TlP/fohGv35Gf41 4f7El7FjcFWLy8Jz/XjzOSo/zcfNy3Rp+CCsPnG31tKdbTHlt5sG31IjuLKtOfva GdHFPpzoRdK538R25G4PbVbjJU1ncuXbt35th24P9QPzjTyisGV1OrYewdciPhJQ YiibI8b20SECf64EXYQnGNLwo1Xz2gkeGeJje8LJSMdf0pZzxT7gHhmqglLPbQBh qLdXEOGdIFupMLRGVIL5GtOXuDrOCGw2M6k1v3Tc/kVQvHtydGZtCm7eMiLo7h5/ +/eA0d+jpYyQYf79nsBE+ikd5ul10Q== =LmtD -----END PGP SIGNATURE----- --==-=-=--