Skip to content

Commit

Permalink
Bug fix: Don't search shadow notes in scanner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Nov 3, 2011
1 parent 273aa01 commit bb627d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions autoload/xolox/notes.vim
@@ -1,12 +1,12 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: October 23, 2011
" Last Change: November 3, 2011
" URL: http://peterodding.com/code/vim/notes/

" 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.12.2'
let g:xolox#notes#version = '0.12.3'

function! xolox#notes#shortcut() " {{{1
" The "note:" pseudo protocol is just a shortcut for the :Note command.
Expand Down Expand Up @@ -552,7 +552,7 @@ function! s:run_scanner(keywords, matches) " {{{2
if !(executable(python) && filereadable(scanner))
call xolox#misc#msg#debug("notes.vim %s: The %s script isn't executable.", g:xolox#notes#version, scanner)
else
let arguments = [scanner, g:notes_indexfile, g:notes_directory, g:notes_shadowdir, a:keywords]
let arguments = [scanner, g:notes_indexfile, g:notes_directory, a:keywords]
call map(arguments, 'shellescape(v:val)')
let output = xolox#misc#str#trim(system(join([python] + arguments)))
if !v:shell_error
Expand Down
12 changes: 5 additions & 7 deletions misc/notes/scanner.py
Expand Up @@ -36,8 +36,7 @@ def decodestr(s):

database_file = mungepath(sys.argv[1])
user_directory = mungepath(sys.argv[2])
shadow_directory = mungepath(sys.argv[3])
keywords = decodestr(' '.join(sys.argv[4:]))
keywords = decodestr(' '.join(sys.argv[3:]))

# Create or open SQLite database. {{{1

Expand Down Expand Up @@ -93,11 +92,10 @@ def tokenize(text):
# Find filenames & last modified times of existing notes. {{{1

notes_on_disk = {}
for directory in user_directory, shadow_directory:
for filename in os.listdir(directory):
if filename != '.swp' and not fnmatch.fnmatch(filename, '.*.sw?'): # (Vim swap files are ignored)
filename = os.path.join(directory, filename)
notes_on_disk[filename] = dict(filename=filename, last_modified=os.path.getmtime(filename))
for filename in os.listdir(user_directory):
if filename != '.swp' and not fnmatch.fnmatch(filename, '.*.sw?'): # (Vim swap files are ignored)
filename = os.path.join(user_directory, filename)
notes_on_disk[filename] = dict(filename=filename, last_modified=os.path.getmtime(filename))
if first_use:
for note in notes_on_disk.itervalues():
scan_note(note)
Expand Down

0 comments on commit bb627d5

Please sign in to comment.