Abe Itani <[email protected]> writes:

> Here is a patch implementing the long-standing FIXME in 
> org-set-tags-command: calling the command before the first heading now 
> sets #+FILETAGS instead of signaling a user-error.
>
> The patch also fixes a latent buffer-boundary crash in 
> org-fast-tag-selection that only surfaces in the file-tags context, and 
> adds a new ert test (test-org/set-file-tags) with seven assertions.
>
> Manually tested: insert with no existing #+FILETAGS line, in-place 
> update of an existing line, org-file-tags variable refresh after write.

Thanks a lot for implementing this long-standing missing feature!

> Subject: [PATCH] lisp, testing: Implement #+FILETAGS support in
>  org-set-tags-command
>
> Calling org-set-tags-command before the first heading previously
> signaled a user-error with "Setting file tags is not supported yet".
> This commit implements the feature properly.

Nit: Please 'quote' Elisp symbols in the commit message. See
https://orgmode.org/worg/org-contribute.html

I also tested the patch manually, and found several issues:

1. #+filetags may not be before first heading

* Heading
#+filetags: ...
is a completely valid tag definition, although somewhat uncommon

2. Not everything matching #+filetags: ... is a keyword. Consider

#+begin_comment
#+filetags: :foo:bar:
#+end_comment

* first heading
This file does not have any tags set, just a comment.
You need to consult org-element-at-point to confirm that regexp match
hits a real tag keyword.

3. When I use fast tag selection, the overlay for filetags is displayed like

#+tags: one(o) two(t)
#+filetags: :test:ew:ew2: :test:ew:ew2:
^ Note that the overlay is appended to the filetags; it does not replace
#the tag list.

4. It is allowed to have multiple #+filetags: in Org buffers

#+tags: one(o) two(t)
#+filetags: :test:ew:ew2:
#+filetags: :one:

* This

All the tags will be combined.

This makes things complicated when we also want overlay feature for fast
tag selection.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to