Am Mittwoch, 27. August 2014 16:40:41 UTC+2 schrieb Charles Campbell:
> Daniel Hahler wrote:
>
> > When there is a `kdeinit4` process, but `kfmclient` is not installed
>
> > `BrowseX` fails to open an URL (it falls through to the last else block).
>
> >
>
> > This happened on a non-KDE system, where `kdeinit4` was
>
> > installed/started for an unknown reason, but konqueror/kfmclient is not
> > available.
>
> >
>
> > This patch also makes the `system()` call only when necessary (via a
>
> > function), and will prefer `xdg-open` unconditionally also for potential
> > KDE systems.
>
> >
>
> > After all, `xdg-open` is better aware of the current desktop environment
>
> > and is designed for use cases like this.
>
> >
>
> > The old code was primarily meant to handle edge cases when `gnome-open` was
> > used.
>
> > I have left it as a fallback in case `xdg-open` might not be available.
>
> >
>
> > The patch is available in a branch at:
> > https://github.com/blueyed/vim/compare/fix-netrw-with-kdeinit (which
> > includes a commit to fix trailing whitespace).
>
> >
>
> > I am attaching the patch from the main commit
> > (https://github.com/blueyed/vim/commit/b5e13acebc11c13290d3f3dd9940b1ab181f47a3).
>
> >
>
> Thanks! I'll look into it.
There's a problem/error in the patch (`s/endif/endfun`).
I am attaching the updated patch, without whitespace changes.
Cheers,
Daniel.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index d8d1857..6f4178b 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -4680,20 +4680,23 @@ fun! netrw#NetrwBrowseX(fname,remote)
endif
" call Decho("exten<".exten.">")
- " seems kde systems often have gnome-open due to dependencies, even though
- " gnome-open's subsidiary display tools are largely absent. Kde systems
- " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
- if !exists("s:haskdeinit")
+ " Detect if KDE is running (via `kdeinit*` process).
+ " This was previously used when `gnome-open` was used instead of `xdg-open`
+ " and is being kept as fallback (tnx Mikolaj Machowski).
+ fun! s:haskdeinit()
+ if !exists('s:_haskdeinit')
if has("unix") && executable("ps") && !has("win32unix")
- let s:haskdeinit= system("ps -e") =~ 'kdeinit'
+ let s:_haskdeinit = (system("ps -e") =~ '\<kdeinit')
if v:shell_error
- let s:haskdeinit = 0
+ let s:_haskdeinit = 0
endif
else
- let s:haskdeinit= 0
+ let s:_haskdeinit= 0
endif
-" call Decho("setting s:haskdeinit=".s:haskdeinit)
+" call Decho("setting s:_haskdeinit=".s:_haskdeinit)
endif
+ return s:_haskdeinit
+ endfun
if a:remote == 1
" create a local copy
@@ -4802,13 +4805,13 @@ fun! netrw#NetrwBrowseX(fname,remote)
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let ret= v:shell_error
- elseif has("unix") && executable("xdg-open") && !s:haskdeinit
+ elseif has("unix") && executable("xdg-open")
" call Decho("unix and xdg-open")
" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir)
exe "sil !xdg-open ".shellescape(fname,1).redir
let ret= v:shell_error
- elseif has("unix") && executable("kfmclient") && s:haskdeinit
+ elseif has("unix") && executable("kfmclient") && s:haskdeinit()
" call Decho("unix and kfmclient")
" call Decho("exe sil !kfmclient exec ".shellescape(fname,1)." ".redir)
exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir