Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make auto_tags preserve existing tag section structure #1353

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

jiamingc
Copy link
Contributor

@jiamingc jiamingc commented Jul 4, 2023

Currently, auto_tags will delete sections from "Generated Tags" for tags that aren't used in any pages. This PR makes auto_tags preserve the subsections for unused tags, making auto_tags more usable for tags that are regularly removed (for example a "todo" tag).

Additionally, I made auto_tags preserve the existing order of subsections under "Generated Tags" instead of alphabetizing it.

Steps for submitting a pull request:

somewhat related issue: #724

  • ALL pull requests should be made against the dev branch!
  • Take a look at CONTRIBUTING.MD
  • Reference any related issues.
  • Provide a description of the proposed changes.
  • PRs must pass Vint tests and add new Vader tests as applicable.
  • Make sure to update the documentation in doc/vimwiki.txt if applicable,
    including the Changelog and Contributors sections.

@tinmarino
Copy link
Member

Hi @jiamingc,

Thank you for the PR, I like the idea to preserve the previous Generated tags structure (otherwise the "create" boolean is kind of useless).

I understand that you can trigger your feature calling call vimwiki#tags#generate_tags(0).

But in that case, the new tags are not appended either, the tag headers remains the same.

It seems that you new feature is safe (conservative) in case of tag removal but do not help in case of tag appending.

Is that the desired behaviour? Otherwise, could you update it so that it does not remove any header (tag name) but yes it appends the new tags in user's wiki.

@jiamingc
Copy link
Contributor Author

Hi, thanks for taking a look at my PR. Not adding new tags to an existing "Generated Tags" section is the current behavior on dev:

if need_all_tags || index(self.specific_tags, tagname) != -1

This is also the desired behavior to me, since I'm using auto_tags for fixed sets of tags only.

@tinmarino
Copy link
Member

Hi @jiamingc, Thank you for the quick and clear answer.

Accepted <= do not change existing behaviour and adds feature usefull for many and in vimwiki scope (i.e. hard to put in vimrc).

@tinmarino tinmarino merged commit acc92fb into vimwiki:dev Jul 10, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants