Add custom variables to ignore and protect tags.
This commit is contained in:
parent
4403cb17f1
commit
06a8cdccf6
1 changed files with 16 additions and 2 deletions
|
@ -93,6 +93,16 @@ See https://apps.ankiweb.net/docs/manual.html#latex-conflicts.")
|
||||||
t
|
t
|
||||||
"If nil, tags of entries wont't be counted as Anki tags.")
|
"If nil, tags of entries wont't be counted as Anki tags.")
|
||||||
|
|
||||||
|
(defcustom anki-editor-protected-tags
|
||||||
|
'("marked" "leech")
|
||||||
|
"A list of tags that won't be deleted from Anki even though they're absent in Org entries, such as special tags `marked', `leech'."
|
||||||
|
:type '(repeat string))
|
||||||
|
|
||||||
|
(defcustom anki-editor-ignored-org-tags
|
||||||
|
(append org-export-select-tags org-export-exclude-tags)
|
||||||
|
"A list of Org tags that are ignored when constructing notes form entries."
|
||||||
|
:type '(repeat string))
|
||||||
|
|
||||||
(defcustom anki-editor-anki-connect-listening-address
|
(defcustom anki-editor-anki-connect-listening-address
|
||||||
"127.0.0.1"
|
"127.0.0.1"
|
||||||
"The network address AnkiConnect is listening.")
|
"The network address AnkiConnect is listening.")
|
||||||
|
@ -392,8 +402,12 @@ Where the subtree is created depends on PREFIX."
|
||||||
(lambda (result)
|
(lambda (result)
|
||||||
;; update tags
|
;; update tags
|
||||||
(let* ((existing-note (car result))
|
(let* ((existing-note (car result))
|
||||||
(tags-to-add (-difference (alist-get 'tags note) (alist-get 'tags existing-note)))
|
(tags-to-add (-difference (-difference (alist-get 'tags note)
|
||||||
(tags-to-remove (-difference (alist-get 'tags existing-note) (alist-get 'tags note)))
|
(alist-get 'tags existing-note))
|
||||||
|
anki-editor-ignored-org-tags))
|
||||||
|
(tags-to-remove (-difference (-difference (alist-get 'tags existing-note)
|
||||||
|
(alist-get 'tags note))
|
||||||
|
anki-editor-protected-tags))
|
||||||
(tag-queue (anki-editor--anki-connect-invoke-queue)))
|
(tag-queue (anki-editor--anki-connect-invoke-queue)))
|
||||||
|
|
||||||
(when tags-to-add
|
(when tags-to-add
|
||||||
|
|
Loading…
Reference in a new issue