jceb / vim-orgmode

Text outlining and task management for Vim based on Emacs' Org-Mode
http://www.vim.org/scripts/script.php?script_id=3642
Other
3.1k stars 266 forks source link

Org agenda works on a single org file, but pops error when using wildcard for DIR #293

Open biffbaxter opened 6 years ago

biffbaxter commented 6 years ago

Could be wrong, but thought this was possible based upon docs...Here is the command I did (both single file and wildcard) - "This works --- let g:org_agenda_files=['~/Documents/emacs/2018-Worklog.org'] This does not --- :let g:org_agenda_files=['~/Documents/emacs/*.org']"

It is a large legacy group of emacs org mode files, but the individual ones seem to work fine with TODO's in them, etc...I am wondering if its size or potentially a bad file amongst the 120+ org mode files...etc...any tips appreciated. Thanks for the work!

Running Neovim 0.2.2 both commandline and nvim-qt on Arch Linux Python 3.6.4

CAA and CAT generates this error with the wildcard, but not single file..

Error detected while processing function provider#python3#Call:                                                                                                                          
line   18:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/biff/.local/share/nvim/plugged/vim-orgmode/ftplugin/orgmode/plugins/Agenda.py", line 226, in list_all_todos
    loaded_agendafiles = cls._get_agendadocuments()
  File "/home/biff/.local/share/nvim/plugged/vim-orgmode/ftplugin/orgmode/plugins/Agenda.py", line 83, in _get_agendadocuments
    return self._load_agendafiles(agenda_files)
  File "/home/biff/.local/share/nvim/plugged/vim-orgmode/ftplugin/orgmode/plugins/Agenda.py", line 99, in _load_agendafiles
    vim.command(u_encode(u'badd %s' % agenda_file.replace(" ", "\ ")))
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 217, in command
    return self.request('nvim_command', string, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/api/nvim.py", line 130, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 97, in request
    raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim(badd):E37: No write since last change (add ! to override)'
biffbaxter commented 6 years ago

Appears this may be an non-issue after some sleuthing...interesting however. When you put the string in the init.vim it seems to work fine. When you enter it as a command to set the current session value is when it "breaks". Also interesting... When I enter this at command prompt (in VIM): then CAT and CAA fail. let g:org_agenda_files=['~/Documents/emacs/*.org']

If I rename the folder and run this: (same files and rights and user) it works...ha let g:org_agenda_files=['~/Documents/emacs2/*.org']

In any case...I have the basics...It is slow as you noted as I have over 120 org files....I am using rgrep instead for this one thing and it probably fits the bill for my purposes and is super fast. Not a huge deal as I am just trying to clean up my TODO's from 2017 and into 2018 and as you have noted in the other docs, TODO's can live all over the place (as mine do in my various project docs, meeting notes, worklogs that I do by month, etc.

I do appreciate the excellent work however and when I get a bit deeper may try to help out a bit as I am trying to wean myself off a couple of years of emacs org mode.

thanks!

nikisix commented 6 years ago

My week list view (local-leader+caa) does nothing (wild-card or not), but my :OrgAgendaTimeline command runs fine on a single file...?

pheraph commented 5 years ago

My week list view (local-leader+caa) does nothing (wild-card or not), but my :OrgAgendaTimeline command runs fine on a single file...?

I wonder why this doesn't attract any attention. For the current buffer I can also use any agenda view, but for multiple files I don't get a result either. I am also totally lost, where I can start at all with the troubleshooting.

mrloop commented 3 years ago

While trying to get the wildcard g:org_agenda_files to work I observed

In the vim -o *.org all the org files are loaded, in the vim *.org case all the org files are in buffers but not all loaded, you can check the buffer load state with :ls. Unfortunately vim -o *.org opens a window for each file, so not very good if you have many files.

Workaround

The best workaround I came up with is

mrloop commented 3 years ago

My guess is vim-orgmode presumes a buffer to be loaded, but instead it needs to check and load if necessary.

mrloop commented 3 years ago

I'm not a regular python user, but doesn't look like the python vim interface lets you explicitly load a buffer. You could use vim.command and issue commands like :args *.org then :argsd e but that has the side effect of the last file becoming the current file. So in that case if you ordered the list you passed to :args with the current file last it'd work. Ideally there would be a better way to load a buffers without changing the current file. That way you could isolate any change to vim-orgmode to the VimBuffer class, that is explicitly load buffer there. Does anybody know of vim command to load a buffer without making it the current file?

mrloop commented 3 years ago

Or maybe this is an upstream issue and the python vim interface should return the contents of a buffer even if it's not loaded?

mrloop commented 3 years ago

Here's my attempt, which doesn't work :(, to fix issue https://github.com/mrloop/vim-orgmode/commit/a1be62e7529815f920396174f326d659a2e4ccb6