help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Browsing dirs from Dired with graphical explorer


From: Sébastien Vauban
Subject: Re: Browsing dirs from Dired with graphical explorer
Date: Mon, 22 Sep 2008 15:13:23 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux)

Hi Tassilo,

>> I would like some help with a snippet of code I've merged from
>> different sources:
>>
>> (defun my-browse-dir (dir-as-string)
>>   "Open the current directory in your OS's file manager."
>>   (interactive)
>>   (let ((file-manager
>>          (cond (running-ms-windows "explorer")
>>                (t "/usr/lib/kde4/bin/dolphin"))))
>>                   ;; `nautilus --no-desktop' or `gnome-open'
>>     (start-process-shell-command "browse"
>>                                  "*scratch*"
>>                                  (concat file-manager " " dir-as-string))))
>>
>> I'd like to use that when in Dired mode: to be able to launch
>> the graphical file browser from the underlying OS.
>>
>> How to pass the current directory argument?
>
> If you're inside dired, you can use `dired-current-directory'.
> So maybe this (untested) version does what you want:
>
> (defun my-browse-dir ()
>   "Open the current directory in your OS's file manager."
>   (interactive)
>   (let ((dir-as-string (dired-current-directory))
>         (file-manager
>          (cond (running-ms-windows "explorer")
>                (t "/usr/lib/kde4/bin/dolphin"))))
>     (start-process "browse" nil file-manager dir-as-string)))
>
> In should open the directory point is on.  If it's on a file, it depends
> on what the file manager does when it gets a file argument.  Most will
> open it with an appropriate application.

Thanks for your answer, that (should have) filled my need.
Though...

Tested under Ubuntu: I don't know what happens, but my screen is
flickering for less than one second, and... nothing... Like if
the dolphin process was launched but stopped or crashed... No
trace in Emacs... Don't know how to see what happened.

Though, launching the command:

--8<---------------cut here---------------start------------->8---
/usr/lib/kde4/bin/dolphin "/home/sva/texmf/tex/latex"
--8<---------------cut here---------------end--------------->8---

does work... Ununderstandable (for me, at least)!

Tested under Windows: explorer is launched but opens a pop-up
saying: "The path 'z:/texmf/tex/latex' does not exist or is not
a directory". This seems (after some tests from the command
prompt) to be because of the `/' character that should have to
be translated by a `\' for Windows...

Not that fantastic yet, my snippet of code!

Seb

-- 
Sébastien Vauban


reply via email to

[Prev in Thread] Current Thread [Next in Thread]