jrnl-org / jrnl

Collect your thoughts and notes without leaving the command line.
https://jrnl.sh
GNU General Public License v3.0
6.48k stars 523 forks source link

Clarify difference between editor and cli entries in docs #1072

Closed mandarvaze closed 1 year ago

mandarvaze commented 3 years ago

Bug Report

Environment

Current Behavior

I have multiple journals configured, like work and diary.

I've defined a template in my ~/.config/jrnl/jrnl.yaml for diary work does not use template.

Whenever I create an entry like jrnl diary the template is copied just fine, as expected. But when I create a backdated entry like jrnl diary yesterday at 10pm: backdated entry here the entry starts out blank i.e. without the contents of the template.

Expected Behavior

Template should be used for normal entry as well as for backdated entry.

Repro Steps

  1. define multiple journals
  2. define template for one of the journal
  3. Create "normal" entry (works fine, uses template)
  4. Create backdated entry - the entry starts out blank, without the content of the template

Other Information

None.

wren commented 3 years ago

Hi! Thanks for filing an issue.

From what you're describing, it sounds to me like this is what templates are supposed to do.

If you write an entry, then the template is ignored in favor of that entry.

Maybe they could work a bit differently, but I'm unclear what a template would be expected to do is there's already an entry.

Can you please explain in more detail where you expect a template to go if you've already entered jrnl diary yesterday at 10pm: backdated entry in the terminal? Currently, that means your entry is "backdated entry" and we don't know where the template would go.

mandarvaze commented 3 years ago

When you put it like that, it makes sense 😄

So is there a way to add older timestamp and add the entry via an editor ? e.g. When I just enter jrnl diary - an editor is launched and I start typing. The editor already contains the text from the template. The current timestamp is then added when saving the file. (I assume)

I want similar behavior except I specify older timestamp

Is that possible ?

My current workaround :

But this kinda defeats the purpose of using jrnl altogether.

wren commented 3 years ago

Ah, I think I see what you're saying.

So, adding new entries in an editor works the same way as adding entries via the command line (only without your shell getting in the way). So, on new entries, jrnl looks for a timestamp as the very first part of the entry for a timestamp.

How this would work in your example is this:

That's it! jrnl will look for a timestamp as the first part of your entry the same way it does on the command line. There are some examples in the documentation, but the gist of it is that you if you add a timestamp on the first line followed by a colon (e.g. yesterday: rest of first line), jrnl will find it and use that (if it doesn't find one, then it defaults to now, which is the behavior you are describing in your comment).

wren commented 3 years ago

To clarify, this is what if would look like after editing your entry:

timestamp goes here: Template Title

Some text here or anything else in your template.

So, the timestamp should be the very first thing in your entry.

mandarvaze commented 3 years ago

@wren The documentation always refers to the timestamp only when the entry is entered on the command line.

It did not occur to me that in editor, I can use timestamp on the first line (I understand that the first line is title. But I never used timestamp: title format. Just title

My workaround was similar but when I manually edit diary.txt - I use to copy the timestamp from previous entry and make changes (So that timestamp format is not broken)

Using timestamp format like yesterday at 10pm in an editor is going to make my life easier.

wren commented 3 years ago

@mandarvaze You're absolutely right.

To resolve this ticket, we'll need to update the docs to clarify how new entries in an editor are or aren't different from cli entries.

Thank you for pointing this out!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.