Coder Social home page Coder Social logo

Comments (13)

lervag avatar lervag commented on July 29, 2024 1

Great, happy to hear it! :)

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Thanks. The problem is most likely due to external calls to the date utilitity. Which system are you on? Linux, BSD, MacOS, ...? What's the output of date --version in a terminal?

from wiki.vim.

skervim avatar skervim commented on July 29, 2024

Thanks for the prompt answer. The output of date --version is:

date (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

My system is Linux (Ubuntu 18.04).

from wiki.vim.

skervim avatar skervim commented on July 29, 2024

Suddenly it works. Strangely, I cannot reproduce the error anymore, although it occured consistently over the last three days when I tried.

Now, I tested creating a weekly summary of daily entries from a couple of months ago to test whether it only doesn't work for me to create a weekly summary when i'm inside the journal entry of "today". That worked and suddenly it also works from within the journal entry from "today".

Update: I could reproduce the error now. It only occurs when I got to the daily entry with

   `n`     <leader>w<leader>w  |<plug>(wiki-journal)|             [GLOBAL]

and then try :WikiJournalToWeek. It does not occur when I directly open a diary entry via the terminal vim 2020-04-02.md and than try the creation.

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Ok, so, the following steps reproduce the issue for you?

  1. start Vim/neovim
  2. do <leader>w<leader>w to open todays journal entry
  3. type :WikiJournalToWeek

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Do you get any error messages? If so, could you copy them here?

from wiki.vim.

skervim avatar skervim commented on July 29, 2024

Yes, those 3 steps reproduce the issue. Then an empty file opens and I just noticed an error message for the first time (the error does not appear immediately but only after clicking the enter key):

Error detected while processing function wiki#link#open:
line    4:                                                                                            
E716: Key not present in Dictionary: open, a:000, l:link)
E116: Invalid arguments for function call
E488: Trailing characters

And I realize that after :WikiJournalToWeek the file name changes from 2020-04-02.md to 2020-04-02’.md .

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

That does help somewhat, but not enough. It is difficult to debug without actually seeing what is happening on my end. Would you be able to add some debug code?

diff --git a/autoload/wiki/journal.vim b/autoload/wiki/journal.vim
index 6b2a973..483d88d 100644
--- a/autoload/wiki/journal.vim
+++ b/autoload/wiki/journal.vim
@@ -53,9 +53,12 @@ function! wiki#journal#freq(frq) abort " {{{1
   let l:fmt = g:wiki_journal.date_format.daily
   let l:rx = wiki#date#format_to_regex(l:fmt)
   let l:date = l:filedate =~# l:rx ? l:filedate : strftime(l:fmt)
+  unsilent echom 'date' l:date "\n"
 
-  call wiki#url#parse('journal:'
-        \ . wiki#date#format(l:date, g:wiki_journal.date_format[a:frq])).open()
+  let l:newdate = wiki#date#format(l:date, g:wiki_journal.date_format[a:frq])
+  unsilent echom 'newdate' l:newdate "\n"
+
+  call wiki#url#parse('journal:' . l:newdate).open()
 endfunction
 
 " }}}1

If you apply the above patch, it should show some relevant output, I think. You might need to do :messages after running the command to see the output. Could you report the output here?

from wiki.vim.

skervim avatar skervim commented on July 29, 2024

The output after applying the patch is:

date /home/skervim/wiki/journal/2020-04-02
newdate date: invalid date ‘/home/skervim/wiki/journal/2020-04-02’

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Next patch:

diff --git a/autoload/wiki/date.vim b/autoload/wiki/date.vim
index 2dba81a..28a216a 100644
--- a/autoload/wiki/date.vim
+++ b/autoload/wiki/date.vim
@@ -153,6 +153,8 @@ endfunction
 " Utility functions for running GNU date or similar shell commands
 "
 function! s:date(date, format) abort " {{{1
+  unsilent echom 'gnudate' s:gnu_date
+  unsilent echom a:date '|' a:format "\n"
   if s:gnu_date
     return systemlist(printf('date +"%s" -d "%s"', a:format, a:date))[0]
   else

This should show which parameters are passed to the date utility.

from wiki.vim.

skervim avatar skervim commented on July 29, 2024
gnudate 1                                                                                       
/home/skervim/wiki/journal/2020-04-02 | %Y_w%V

from wiki.vim.

lervag avatar lervag commented on July 29, 2024

Ah, ok. I think I see now. Can you test latest version?

from wiki.vim.

skervim avatar skervim commented on July 29, 2024

It works! Thank you very much for the quick and successful fix!

from wiki.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.