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

Is it possible to not replace tags when renaming from dired? #87

Closed
atanasj opened this issue Aug 11, 2022 · 15 comments
Closed

Is it possible to not replace tags when renaming from dired? #87

atanasj opened this issue Aug 11, 2022 · 15 comments

Comments

@atanasj
Copy link

atanasj commented Aug 11, 2022

I have a number of notes that I have migrated from evernote and have reformatted the yaml header to be as close as possible to the denote format. However, I do not want to change the existing tags in the yaml. Can I skip over them without changing or manually selecting them from the minibuffer?

Ideally, I would want these tags to persist… Is this possible?

@atanasj atanasj changed the title Is it possible not replace tags when renaming from dired? Is it possible to not replace tags when renaming from dired? Aug 11, 2022
@protesilaos
Copy link
Owner

Hello @atanasj!

If I understand this correctly: you want the front matter to stay as-is and have the file name be renamed according to that data, right?

If so, check the command denote-rename-file-using-front-matter. Documented here: https://protesilaos.com/emacs/denote#h:3ab08ff4-81fa-4d24-99cb-79f97c13a373

[ Try it with a test file before operating on your actual data. ]

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

Thanks for that, I did try that, but it did not work. I get the message:

denote-rename-file-using-front-matter: No front matter for title and/or keywords

The format of the yaml front matter looks like below:

---
date: 2017-07-25T05:38:27+0000
identifier: "20170725T053827"

title: "IASP - Special Interest Group: Suicidal Behaviour in Adolescents"
tags: ["Treatment"]
url: https://iasp.info/suicidal_behaviour_in_adolescents.php
source: web.clip

---

@protesilaos
Copy link
Owner

Yes, I forgot to mention that the file name must already have an identifier. It should, at the very least, be named 20170725T053827.md.

We will need to update the command to work on any file that ends with one of our supported extensions. Will look into it now.

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

Okay… that worked after I renamed the file to that. I could probably fudge something on the command line to rename using the identifier, but if it is built in, all the better! Thanks for being so responsive!

@protesilaos
Copy link
Owner

Yes, it should be provided by Denote. There is no reason to keep the current restriction.

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

That would be awesome!

@protesilaos
Copy link
Owner

@atanasj You are pulling directly from git, right? If so, please check the latest commit 1bdd0eb. I just tried it with sample.md and valid front matter and got the expected renamed name.

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

@protesilaos, yes! That works as expected. 😄

@protesilaos
Copy link
Owner

Very well! Let's keep this open for a while longer. There may be some more refinements to be made. Will keep you posted.

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

Okay… I seem to be having problems in marking and bulk renaming in dired.... I have ranger installed, so not sure if this is causing an issue... However, I disabled the ranger and it still did not work. The message I get is:

No marked files; aborting

Could it be something with my setup? I am also using evil, however the problem persists in emacs-mode within doomemacs.

@protesilaos
Copy link
Owner

Which command did you use? The error most likely is internal to Denote.

@atanasj
Copy link
Author

atanasj commented Aug 11, 2022

I am using denote-dired-rename-marked-files-using-front-matter

protesilaos added a commit that referenced this issue Aug 12, 2022
This is the same idea as with commit 64c5b74.  Thanks to atanasj for the
feedback in issue 87 on the GitHub mirror:
<#87>.
@protesilaos
Copy link
Owner

I just pushed a change. It basically relaxes the condition of what counts as a writable file. Same idea with what I did for the single file renaming. Please try commit 46f123c.

@atanasj
Copy link
Author

atanasj commented Aug 12, 2022

WORKING! Nice job! This solves the issue for me, so I'll gratefully close! 😄

@atanasj atanasj closed this as completed Aug 12, 2022
@protesilaos
Copy link
Owner

Very well! Thanks again for your feedback!

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

No branches or pull requests

2 participants