Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Trust search-notes.py when it says there are no matches

  • Loading branch information...
commit 78c4cd76d6b0f7fb4b33825d75c1409fe5952007 1 parent 576333a
@xolox authored
Showing with 12 additions and 9 deletions.
  1. +10 −8 autoload/xolox/notes.vim
  2. +2 −1  misc/notes/search-notes.py
View
18 autoload/xolox/notes.vim
@@ -6,7 +6,7 @@
" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.
-let g:xolox#notes#version = '0.16'
+let g:xolox#notes#version = '0.16.1'
function! xolox#notes#shortcut() " {{{1
" The "note:" pseudo protocol is just a shortcut for the :Note command.
@@ -553,9 +553,9 @@ endfunction
function! s:run_scanner(keywords, matches) " {{{2
" Try to run scanner.py script to find notes matching {keywords}.
- let output = s:python_command(a:keywords)
- if !empty(output)
- call extend(a:matches, split(output, '\n'))
+ let lines = s:python_command(a:keywords)
+ if type(lines) == type([])
+ call extend(a:matches, lines)
return 1
endif
endfunction
@@ -563,9 +563,9 @@ endfunction
function! xolox#notes#keyword_complete(arglead, cmdline, cursorpos) " {{{2
let first_run = !filereadable(g:notes_indexfile)
if first_run | call inputsave() | endif
- let keywords = split(s:python_command('--list=' . a:arglead), '\n')
+ let keywords = s:python_command('--list=' . a:arglead)
if first_run | call inputrestore() | endif
- return keywords
+ return type(keywords) == type([]) ? keywords : []
endfunction
function! s:python_command(...) " {{{2
@@ -585,10 +585,12 @@ function! s:python_command(...) " {{{2
if v:shell_error
call xolox#misc#msg#warn("notes.vim %s: Search script failed with output: %s", g:xolox#notes#version, output)
else
- return output
+ let lines = split(output, "\n")
+ if !empty(lines) && lines[0] == 'Python works fine!'
+ return lines[1:]
+ endif
endif
endif
- return ''
endfunction
" Getters for filenames & titles of existing notes. {{{2
View
3  misc/notes/search-notes.py
@@ -3,7 +3,7 @@
# Python script for fast text file searching using keyword index on disk.
#
# Author: Peter Odding <peter@peterodding.com>
-# Last Change: November 24, 2011
+# Last Change: November 25, 2011
# URL: http://peterodding.com/code/vim/notes/
# License: MIT
#
@@ -39,6 +39,7 @@ def __init__(self):
self.update_index()
if self.dirty:
self.save_index()
+ print "Python works fine!"
if self.keyword_filter is not None:
self.list_keywords(self.keyword_filter)
else:
Please sign in to comment.
Something went wrong with that request. Please try again.