From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.help Subject: Re: Browsing dirs from Dired with graphical explorer Date: Mon, 22 Sep 2008 14:45:37 +0200 Message-ID: <48D79371.8080406@gmail.com> References: <87tzc8k2eq.fsf@mundaneum.com> <8763oo1oq7.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1222087640 21001 80.91.229.12 (22 Sep 2008 12:47:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Sep 2008 12:47:20 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 22 14:48:17 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Khkpi-0002M8-Tl for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Sep 2008 14:48:07 +0200 Original-Received: from localhost ([127.0.0.1]:54862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Khkoh-0000Wy-6i for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Sep 2008 08:47:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KhknS-0000Bf-DC for help-gnu-emacs@gnu.org; Mon, 22 Sep 2008 08:45:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KhknQ-0000Aw-Uu for help-gnu-emacs@gnu.org; Mon, 22 Sep 2008 08:45:46 -0400 Original-Received: from [199.232.76.173] (port=49161 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KhknQ-0000Ao-I9 for help-gnu-emacs@gnu.org; Mon, 22 Sep 2008 08:45:44 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:36705) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KhknP-0002IL-NO for help-gnu-emacs@gnu.org; Mon, 22 Sep 2008 08:45:44 -0400 Original-Received: from c83-254-151-87.bredband.comhem.se ([83.254.151.87]:59829 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1KhknO-0004kq-6r; Mon, 22 Sep 2008 14:45:42 +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 In-Reply-To: <8763oo1oq7.fsf@thinkpad.tsdh.de> X-Enigmail-Version: 0.95.7 X-Antivirus: avast! (VPS 080921-0, 2008-09-21), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.151.87 X-Scan-Result: No virus found in message 1KhknO-0004kq-6r. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1KhknO-0004kq-6r 77749fe3e9215204669615c9fed9f39b X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57893 Archived-At: Tassilo Horn wrote: > Sébastien Vauban > 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.)