Closed glortho closed 9 years ago
Search seems to be failing for me, too. I am running on Windows.
When I run ":SearchNotes posit", I see that python is launched. However, in Vim, I get "notes.vim 0.023.4: No matches"
When I run the same python command line, I get the following output:
C:\Users\Bart\vimfiles\bundle\notes\autoload\xolox [(unknown)]> python "C:\Users\Bart\vimfiles\bundle\notes\misc\notes\search-notes.py" "--database" "C:\Users\Bart\vimfiles\bundle\notes\misc\notes\index.pickle" "--ignore-case" "--notes" C:\Users\Bart\vimfiles\bundle\notes\misc\notes\user" "posit"
Found 1 notes in C:\Users\Bart\vimfiles\bundle\notes\misc\notes\user ..
Python works fine!
C:\Users\Bart\vimfiles\bundle\notes\misc\notes\user\test
jedverity, it sounds like you have a workaround. I couldn't see the workaround in your vim-notes fork - are you able to push it up?
Here's the commit – https://github.com/jedverity/vim-notes/commit/6c49d3610db435e0226fad77b8ea59889d3b9047 – or you can just use this fork, though it's a bad and temporary fix for sure! https://github.com/jedverity/vim-notes/tree/search-fix
Unfortunately, that doesn't seem to fix the problem for me. Back to the drawing board - but thanks for taking the time to push your fix up!
Note: I get identical behaviour on Debian testing.
This fixes it for me though! Thanks @jedverity
works for me too, thanks
Can this be pulled please?
Can one of you run the Vim command :verbose SearchNotes whatever
, capture the verbose messages emitted by my plug-ins and post those messages here? Please run the command twice:
Hopefully the verbose messages will tell me / us what is going wrong here. Thanks!
existing keyword:
notes.vim 0.23.7: Searching notes using keyword index ..
notes.vim 0.23.7: Executing external command python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/ownCloud/notes'
'@pacman'
im 'runtimepath' nicht gefunden: "autoload/xolox/shell.vim"
vim-misc 1.8.5: Generated shell expression: (python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/ownCloud/notes'
'@pacman') 1>'/tmp/vLrtfx9/39' 2>'/tmp/vLrtfx9/40'
vim-misc 1.8.5: Executing external command using system() function: sh -c '(python2 '\''/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py'\'' '\''--database'\'' '\''/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle'\'' '\'
'--ignore-case'\'' '\''--notes'\'' '\''/home/svh/ownCloud/notes'\'' '\''@pacman'\'') 1>'\''/tmp/vLrtfx9/39'\'' 2>'\''/tmp/vLrtfx9/40'\'''
notes.vim 0.23.7: Search script output (raw): ['Python works fine!', '/home/svh/ownCloud/notes/pacman']
notes.vim 0.23.7: Search script output (processed): ['/home/svh/ownCloud/notes/pacman']
notes.vim 0.23.7: Search script reported 1 matching note.
notes.vim 0.23.7: Populated quick-fix window in 0.00029 seconds.
notes.vim 0.23.7: Searched notes in 0.063 seconds.
Non-existing keyword:
notes.vim 0.23.7: Searching notes using keyword index ..
notes.vim 0.23.7: Executing external command python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/ownCloud/notes'
'xxxRRRBBBJJUJ'
im 'runtimepath' nicht gefunden: "autoload/xolox/shell.vim"
vim-misc 1.8.5: Generated shell expression: (python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/ownCloud/notes'
'xxxRRRBBBJJUJ') 1>'/tmp/vLrtfx9/42' 2>'/tmp/vLrtfx9/43'
vim-misc 1.8.5: Executing external command using system() function: sh -c '(python2 '\''/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py'\'' '\''--database'\'' '\''/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle'\'' '\'
'--ignore-case'\'' '\''--notes'\'' '\''/home/svh/ownCloud/notes'\'' '\''xxxRRRBBBJJUJ'\'') 1>'\''/tmp/vLrtfx9/42'\'' 2>'\''/tmp/vLrtfx9/43'\'''
notes.vim 0.23.7: Search script output (raw): ['Python works fine!']
notes.vim 0.23.7: Search script output (processed): []
notes.vim 0.23.7: Search script reported 0 matching notes.
notes.vim 0.23.7: No matches
notes.vim 0.23.7: Searched notes in 0.063 seconds.
From the error message, I assume something with loading autoload/xolox/shell.vim fails, in fact, I don't have it at all.
I'm using Vundle here.
Does that help you?
Thanks for picking it up, Sven
OK, installing xolox/vim-shell fixed it for me. If it is required, you should probably add this to README.md in vim-notes.
Cheers, Sven
Hey Sven,
The dependency on vim-shell is supposed to be optional. Thanks for the feedback. Now I have something concrete to look into. Will (hopefully) report back here soon.
@svenXY: Going by the first fragment you posted it seems like everything works fine... I suppose that despite these messages:
notes.vim 0.23.7: Search script reported 1 matching note.
notes.vim 0.23.7: Populated quick-fix window in 0.00029 seconds.
notes.vim 0.23.7: Searched notes in 0.063 seconds.
It really doesn't work? (just trying to make sure I understand the full situation).
Correct, it does seem to find something, but then does not populate quickfix (it seems to keep the old quickfix instead, but I'm not sure about that)
Long story short: I just pushed a small change to GitHub which includes some additional logging. Can someone who can reproduce the problem rerun the two tests I previously asked for with this 'new version' of the vim-notes plug-in?
Now for the long story:
I thought this might be a problem with Windows support but judging by the pathnames in the vim-notes output quoted by @svenXY he appears to be running UNIX so that rules that out. Then I thought it might be a problem with case sensitivity, because search-notes.py
finds something but then :vimgrep
loses the search results. However try as I might I can't reproduce it. Then I thought of something else, which requires a bit of explaining:
:vimgrep
on them to populate the quick-fix window (because doing this programatically appeared to be a non trivial undertaking).I can see the potential for inconsistent behavior here when the keyword search in the Python script and the :vimgrep
command don't agree about which files match. It could cause the behavior reported here.
Assuming this hypothesis is correct, the next useful question to ask is why all of you are consistently hitting this inconsistency (no pun intended ;-) while this has never happened for me. I can think of a couple of reasons, all having to do with how a keyword search is translated into a Vim regular expression pattern by the vim-notes plug-in. Hence the opening question :-).
With existing keyword (and after having removed vim-shell):
notes.vim 0.23.10: Searching notes using keyword index ..
notes.vim 0.23.10: Executing external command python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/somepath/notes'
'@diy'
im 'runtimepath' nicht gefunden: "autoload/xolox/shell.vim"
vim-misc 1.11: Generated shell expression: (python2 '/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py' '--database' '/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle' '--ignore-case' '--notes' '/home/svh/somepath/notes' '@
diy') 1>'/tmp/vfhPp9X/7' 2>'/tmp/vfhPp9X/8'
vim-misc 1.11: Executing external command using system() function: sh -c '(python2 '\''/home/svh/.vim/bundle/vim-notes/misc/notes/search-notes.py'\'' '\''--database'\'' '\''/home/svh/.vim/bundle/vim-notes/misc/notes/index.pickle'\'' '\''--
ignore-case'\'' '\''--notes'\'' '\''/home/svh/somepath/notes'\'' '\''@diy'\'') 1>'\''/tmp/vfhPp9X/7'\'' 2>'\''/tmp/vfhPp9X/8'\'''
notes.vim 0.23.10: Search script output (raw): ['Python works fine!', '/home/svh/somepath/notes/LVM', '/home/svh/somepath/notes/diy misc', '/home/svh/somepath/notes/diy version control', '/home/svh/somepath/notes/diypuppet']
notes.vim 0.23.10: Search script output (processed): ['/home/svh/somepath/notes/LVM', '/home/svh/somepath/notes/diy misc', '/home/svh/somepath/notes/diy version control', '/home/svh/somepath/notes/diypuppet']
notes.vim 0.23.10: Search script reported 4 matching notes.
notes.vim 0.23.10: Populating quick-fix window using command: vimgrep /@diy/j /home/svh/somepath/notes/LVM /home/svh/somepath/notes/diy\ misc /home/svh/somepath/notes/diy\ version\ control /home/svh/somepath/notes/diypuppet
notes.vim 0.23.10: Populated quick-fix window in 0.0011 seconds.
notes.vim 0.23.10: Searched notes in 0.066 seconds.
@svenXY: Thanks for the feedback. The potential issue I saw is not relevant apparently (judging by the messages you posted).
My next suspect: Somewhere in the integration between vim-notes, vim-misc and vim-shell something is broken. The thing is, I can't seem to reproduce it. From some issues on GitHub I get the impression that it's a Windows only thing, but @svenXY is clearly running UNIX, so that surprises me.
Nevertheless, yesterday evening I revived an old Windows XP virtual machine from backups so that I can at least try to test this myself on multiple operating systems.
@xolox FYI I'm also on unix.
FWIW - I am running Ubuntu 14.04. Had the same problem. Installing xolox/vim-shell fixed it.
Same here. Ubuntu 14.04, didn't work before I installed vim-shell, but worked after.
I also had this problem on my Linux machine and installing vim-shell solved the problem. @xolox, if you need any logs, please let me know and I'll try to reproduce it by uninstalling vim-shell. For the time being adding a note to README may be worthwhile for those users who may have problems with the search function.
Edit: I use Pathogen.
I'm having this issue as well. Running on OSX and using vundle. I see that it's searching, but nothing comes up. I get the correct alert if I search using a keyword that doesn't exist, but on searches that should easily succeed I get: Searching notes using keyword index..
and then it disappears and nothing happens
Linux, Vundle, Vim 7.4. :verbose shows me that the Python script does find the correct matching notes (if any), but the quickfix window does not appear. However, if I specifically search with a pattern (:SearchNotes /foo/), then searching works as expected. Installing vim-shell fixes normal search for me as well, so I can do ":SearchNotes foo" and the quickfix appears containing correct results.
I am having the same problem. Running OSX Yosemite, with VIM 7.4. I have installed vim-shell as suggested above, and the search works, but only with tags; every other search is unreliable. By the way, thank you for the plugin, it is allowing me to implement zettelkasten in VIM.
Having the same problem here running OS X Yosemite. I have installed VIm-Shell, as per other commenters and still no luck. However if I search via regexp it returns expected results.
Having same issue in Win7, known existing text string existing in several files. I have also manually installed vim-shell, but search still not working for me. Thanks for a fantastic plug-in!
Before installing vim-shell:
notes.vim 0.31.1: Searching notes using keyword index ..
notes.vim 0.31.1: Executing external command python "c:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\search-notes.py" "--database" "c:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\index.pickle" "--ignore-case" "--notes" "X:\notes" "tystad"
not found in 'runtimepath': "autoload/xolox/shell.vim"
vim-misc 1.17.1: Executing external command using system() function: python "c:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\search-notes.py" "--database" "c:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\index.pickle" "--ignore-case" "--notes" "X:\notes" "tystad"
notes.vim 0.31.1: Search script output (raw): ['Found 27 notes in X:\notes ..', 'Python works fine!', 'X:\notes\Ethernet Phase 1B.md', 'X:\notes\eWFM.md']
notes.vim 0.31.1: Search script returned invalid output :-(
notes.vim 0.31.1: Populating quick-fix window using command: vimgrep /\_^\_.*tystad/j X:\notes\amo-rfa-legacy-bpms.md X:\notes\cybd-irthnet-gis-fiber.md X:\notes\EMEA-Offnet-Jennifer.md X:\notes\EMEA-VC-Albert.md X:\notes\ESRI-Portal.md X:\notes\Ethernet\ Phase\ 1B.md X:\notes\eWFM.md X:\notes\FederatedInventory.md X:\notes\FieldRequired-GCR-Steve-Leveck.md X:\notes\FirstTestNote.md X:\notes\GFS-Region-Division-Market-GIS-pointInPoly.md X:\notes\GLM-OperationalMarket-OpsServingMarket.md X:\notes\Globalization.md X:\notes\GTMI.md X:\notes\MINTj-Diego.md X:\notes\NC\ Automated\ Test.md X:\notes\PitneyBowes-UK.md X:\notes\RowPhase2.md X:\notes\SchedulerHandoff.md X:\notes\SecondTestNote.md X:\notes\SEO-MetaStorm.md X:\notes\spatialAnalyst-Fendry.md X:\notes\Tibco-OE-Pipeline-getCustomerOrder.md X:\notes\Transport-Enhancements-Donna.md X:\notes\TW-ramp-Roman.md X:\notes\VoiceAutoAssignOrders.md X:\notes\WorkVu.md
notes.vim 0.31.1: Populated quick-fix window in 0.0046 seconds.
notes.vim 0.31.1: No matches
notes.vim 0.31.1: Searched notes in 0.77 seconds.
After vim-shell installed:
notes.vim 0.31.1: Searching notes using keyword index ..
notes.vim 0.31.1: Executing external command python "C:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\search-notes.py" "--database" "C:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\index.pickle" "--ignore-case" "--notes" "X:\notes" "tystad"
shell.vim 0.13.6: Checking if compiled DDL is supported ..
shell.vim 0.13.6: Looks like the DDL is not working! (Vim raised an exception: Vim(let):E364: Library call failed for "libversion()")
vim-misc 1.17.1: Executing external command using system() function: python "C:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\search-notes.py" "--database" "C:\cygwin64\home\me\\.vim_runtime\sources_non_forked\vim-notes\misc\notes\index.pickle" "--ignore-case" "--notes" "X:\notes" "tystad"
notes.vim 0.31.1: Search script output (raw): ['Found 27 notes in X:\notes ..', 'Python works fine!', 'X:\notes\Ethernet Phase 1B.md', 'X:\notes\eWFM.md']
notes.vim 0.31.1: Search script returned invalid output :-(
notes.vim 0.31.1: Populating quick-fix window using command: vimgrep /\_^\_.*tystad/j X:\notes\amo-rfa-legacy-bpms.md X:\notes\cybd-irthnet-gis-fiber.md X:\notes\EMEA-Offnet-Jennifer.md X:\notes\EMEA-VC-Albert.md X:\notes\ESRI-Portal.md X:\notes\Ethernet\ Phase\ 1B.md X:\notes\eWFM.md X:\notes\FederatedInventory.md X:\notes\FieldRequired-GCR-Steve-Leveck.md X:\notes\FirstTestNote.md X:\notes\GFS-Region-Division-Market-GIS-pointInPoly.md X:\notes\GLM-OperationalMarket-OpsServingMarket.md X:\notes\Globalization.md X:\notes\GTMI.md X:\notes\MINTj-Diego.md X:\notes\NC\ Automated\ Test.md X:\notes\PitneyBowes-UK.md X:\notes\RowPhase2.md X:\notes\SchedulerHandoff.md X:\notes\SecondTestNote.md X:\notes\SEO-MetaStorm.md X:\notes\spatialAnalyst-Fendry.md X:\notes\Tibco-OE-Pipeline-getCustomerOrder.md X:\notes\Transport-Enhancements-Donna.md X:\notes\TW-ramp-Roman.md X:\notes\VoiceAutoAssignOrders.md X:\notes\WorkVu.md
notes.vim 0.31.1: Populated quick-fix window in 0.0034 seconds.
notes.vim 0.31.1: No matches
notes.vim 0.31.1: Searched notes in 0.69 seconds.
The output that @cahartm quoted shows a different issue then previously discussed here. I'm specifically referring to the following line in the output:
notes.vim 0.31.1: Search script output (raw): ['Found 27 notes in X:\notes ..', 'Python works fine!', 'X:\notes\Ethernet Phase 1B.md', 'X:\notes\eWFM.md']
The "Found 27 notes ..." message is not supposed to be there; it's printed on standard error and shouldn't be captured as standard output. Not sure whether Windows, Vim or Cygwin is to blame there but I think I just fixed that issue, so the latest version of vim-notes should work for @cahartm unless he's also affected by the other bug discussed here...
The good news is that I'm able to reproduce this issue now. The bad news is that Vim and I have been butting heads for the better part of my afternoon now and I'm not winning :-(. I'm absolutely flabbergasted by the behavior I'm seeing:
:vimgrep
in order to populate the quick-fix list.:vimgrep
command (logged when you do :verbose SearchNotes ...
) reports no errors but also doesn't populate the quick-fix list.:vimgrep
command and execute it, then it correctly populates the quick-fix list! ಠ_ಠ:vimgrep
call down to the bare minimum (e.g. removing the swap hack and &eventignore
stuff) but that didn't change anything in the observed behavior.try
/ catch
/ finally
seems to have some weird interaction in all of this, however then I would expect the :vimgrep
command to report an error, but it doesn't do that, it's just completely silent and the commands after it are also executed (so program flow doesn't change).I've tried adding a lot more logging in my local checkout and gradually raising the &verbose
option just before the call to :vimgrep
is made (I ended up with &verbose
set to 15) to see what the hell is going on inside Vim, but even that doesn't help to clarify anything. As expected some automatic commands trigger but I don't see how those would influence the functionality of :vimgrep
.
notes.vim 0.33.2: Performing keyword search (booyah) ..
notes.vim 0.33.2: Searching notes using keyword index ..
notes.vim 0.33.2: Executing external command python2 '/home/peter/projects/vim/notes/misc/notes/search-notes.py' '--database' '~/.local/vim/notes/index.pickle' '--ignore-case' '--notes' '/home/peter/projects/dotfiles/docs/notes' 'booyah'
not found in 'runtimepath': "autoload/xolox/shell.vim"
vim-misc 1.17.6: Generated shell expression: (python2 '/home/peter/projects/vim/notes/misc/notes/search-notes.py' '--database' '~/.local/vim/notes/index.pickle' '--ignore-case' '--notes' '/home/peter/projects/dotfiles/docs/notes' 'booyah') 1>'/tmp/vWAWNVr/10' 2>'/tmp/vWAWNVr/11'
vim-misc 1.17.6: Executing external command using system() function: sh -c '(python2 '\''/home/peter/projects/vim/notes/misc/notes/search-notes.py'\'' '\''--database'\'' '\''~/.local/vim/notes/index.pickle'\'' '\''--ignore-case'\'' '\''--notes'\'' '\''/home/peter/projects/dotfiles/docs/notes'\'' '\''booyah'\'') 1>'\''/tmp/vWAWNVr/10'\'' 2>'\''/tmp/vWAWNVr/11'\'''
notes.vim 0.33.2: Search script output (raw): ['Python works fine!', '/home/peter/projects/dotfiles/docs/notes/2014-04-03']
notes.vim 0.33.2: Search script output (processed): ['/home/peter/projects/dotfiles/docs/notes/2014-04-03']
notes.vim 0.33.2: Search script reported 1 matching note.
notes.vim 0.33.2: Skipping phase 1 search (performed using Python script) ..
notes.vim 0.33.2: Performing phase 2 search to populate quick-fix window ..
notes.vim 0.33.2: Populating quick-fix window using command: vimgrep /\cbooyah/j /home/peter/projects/dotfiles/docs/notes/2014-04-03
line 15: vimgrep /\cbooyah/j /home/peter/projects/dotfiles/docs/notes/2014-04-03
Executing QuickFixCmdPre Auto commands for "*vimgrep*"
autocommand let g:startify_locked = 1
line 0: let g:startify_locked = 1
Executing QuickFixCmdPre Auto commands for "*vimgrep*"
autocommand call xolox#easytags#disable_automatic_updates()
line 0: call xolox#easytags#disable_automatic_updates()
calling function xolox#easytags#disable_automatic_updates
line 1: let s:easytags_auto_update_save = xolox#misc#option#get('easytags_auto_update', 1)
calling function xolox#easytags#disable_automatic_updates..xolox#misc#option#get
line 1: " Expects one or two arguments: 1. The name of a variable and 2. the default
line 2: " value if the variable does not exist.
line 4: " Returns the value of the variable from a buffer local variable, global
line 5: " variable or the default value, depending on which is defined.
line 7: " This is used by some of my Vim plug-ins for option handling, so that users
line 8: " can customize options for specific buffers.
line 9: if exists('b:' . a:name)
line 12: elseif exists('g:' . a:name)
line 15: elseif exists('a:1')
function xolox#easytags#disable_automatic_updates..xolox#misc#option#get returning #1
continuing in function xolox#easytags#disable_automatic_updates
line 2: let g:easytags_auto_update = 0
function xolox#easytags#disable_automatic_updates returning #0
continuing in QuickFixCmdPre Auto commands for "*vimgrep*"
line 16: let &verbose = vbs_save
notes.vim 0.33.2: Populated quick-fix window in 0.058 seconds.
notes.vim 0.33.2: Encountered error during search: No matches found or :vimgrep command failed to populate the quick-fix list! (function xolox#notes#search..<SNR>61_internal_search..<SNR>61_vimgrep_wrapper, line 20)
As can be seen in the log above I tried prefixing the pattern given to :vimgrep
with \c
but that also doesn't change the results. The last line shows an error that is not normally reported, I added it in my local checkout for instant feedback when :vimgrep
behaves in an unexpected way.
I just committed and released 08b974712b5ea97e3dba0dc81c4560da794eab80 which at the very least recognizes the buggy situation and alerts the user about it instead of keeping silent and provoking frustration all around. At this point I'm gravitating between two expectations:
The new version indeed consistently reports the new error when performing a keyword search without vim-shell installed and consistently doesn't report the error (i.e. works fine) when vim-shell is installed.
The thing that I don't understand is that the Python script works fine in either case, and this is the only part which has interaction with vim-shell.
So either the mere presence of vim-shell changes global state which hides the bug, or the detection of whether vim-shell is installed somehow causes these obscure problems?
Okay I'm sick of fighting obscure Vim script 'features' so have now decided to go with the flow, remove the try/catch construct, forget this issue ever happened and get on with my life (doing more productive things than fighting obscure corners of Vim [script] for hours on end ;-).
Thanks for the copious amounts of feedback on this issue and sorry for dragging this out for so long, I usually try to understand what I'm doing, even if that takes a lot of time (because one can usually learn from obscure bugs like these).
In my testing :SearchNotes
now works fine with and without vim-shell installed, so I'm assuming this issue is indeed resolved. If not then feel free to reopen this issue or create a new one.
Happy Vimming all!
:SearchNotes
works fine without vim-shell, but trying to use :RelatedNotes
results in an alert about this issue.
Every search I performed would show that it was searching keyword index (0.23.4), but it would just go away errorlessly after a few seconds yielding no results, even when searching for tags or other keywords that I could see existed in the index.pickle and tags.txt files.
Commenting out the try block in autoload/xolox/notes.vim#search solved the problem, however. Surely it's not a good idea to keep it this way. How can I assist in the resolution of this?
Awesome plugin otherwise!