Permalink
Browse files

xolox#misc#open#file(): Instrument with xolox#misc#msg#debug() calls

  • Loading branch information...
1 parent 3d51983 commit b9391f4f769c59734ba56bde46ce37e22bcab035 @xolox committed Jun 19, 2013
Showing with 10 additions and 2 deletions.
  1. +1 −1 README.md
  2. +8 −0 autoload/xolox/misc/open.vim
  3. +1 −1 doc/misc.txt
View
@@ -38,7 +38,7 @@ from the source code of the miscellaneous scripts using the Python module
<!-- Start of generated documentation -->
The documentation of the 67 functions below was extracted from
-15 Vim scripts on June 19, 2013 at 20:59.
+15 Vim scripts on June 19, 2013 at 21:00.
### Handling of special buffers
@@ -30,6 +30,7 @@ function! xolox#misc#open#file(location, ...) " {{{1
endtry
return
elseif has('macunix')
+ call xolox#misc#msg#debug("vim-misc %s: Detected Mac OS X, using 'open' command to open %s ..", g:xolox#misc#version, string(a:location))
let cmd = 'open ' . shellescape(a:location) . ' 2>&1'
call s:handle_error(cmd, system(cmd))
return
@@ -57,21 +58,28 @@ function! xolox#misc#open#url(url) " {{{1
" front of Vim (temporarily suspending Vim)
let url = a:url
if url !~ '^\w\+://'
+ call xolox#misc#msg#debug("vim-misc %s: The URL %s doesn't contain a scheme, improvising ..", g:xolox#misc#version, string(url))
if url !~ '@'
+ call xolox#misc#msg#debug("vim-misc %s: Defaulting to http:// URL scheme ..", g:xolox#misc#version)
let url = 'http://' . url
elseif url !~ '^mailto:'
+ call xolox#misc#msg#debug("vim-misc %s: Defaulting to mailto: URL scheme ..", g:xolox#misc#version)
let url = 'mailto:' . url
endif
endif
if has('unix') && !has('gui_running') && $DISPLAY == ''
+ call xolox#misc#msg#debug("vim-misc %s: Using command line web browser because no GUI seems to be available ..", g:xolox#misc#version)
for browser in ['lynx', 'links', 'w3m']
+ call xolox#misc#msg#debug("vim-misc %s: Checking whether %s command line web browser is installed ..", g:xolox#misc#version, string(browser))
if executable(browser)
+ call xolox#misc#msg#debug("vim-misc %s: Found %s, using it to open %s ..", g:xolox#misc#version, string(browser), string(url))
execute '!' . browser fnameescape(url)
call s:handle_error(browser . ' ' . url, '')
return
endif
endfor
endif
+ call xolox#misc#msg#debug("vim-misc %s: Defaulting to GUI web browser to open %s ..", g:xolox#misc#version, string(url))
call xolox#misc#open#file(url, 'firefox', 'google-chrome')
endfunction
View
@@ -137,7 +137,7 @@ from the source code of the miscellaneous scripts using the Python module
'vimdoctool.py' included in vim-tools [5].
The documentation of the 67 functions below was extracted from 15 Vim scripts
-on June 19, 2013 at 20:59.
+on June 19, 2013 at 21:00.
-------------------------------------------------------------------------------
*misc-handling-of-special-buffers*

0 comments on commit b9391f4

Please sign in to comment.