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: Lennart Borgman (gmail)
Subject: Re: Browsing dirs from Dired with graphical explorer
Date: Mon, 22 Sep 2008 14:45:37 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Tassilo Horn wrote:
> Sébastien Vauban <zthjwsqqafhv@spammotel.com>
> writes:
> 
> Hi Sébastien,
> 
>> 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.
>>
>> My problem is: 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:
> 
> --8<---------------cut here---------------start------------->8---
> (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)))
> --8<---------------cut here---------------end--------------->8---


I think there are better ways to do this. I have implemented this for MS
Windows in EmacsW32. It is in the file w32shell. (Unfortunately there is
no easy way to get that file, you have to install EmacsW32+Emacs.)




reply via email to

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