From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Newsgroups: gmane.emacs.help Subject: Re: Browsing dirs from Dired with graphical explorer Date: Mon, 22 Sep 2008 14:58:10 +0200 Organization: Sebastien Vauban Message-ID: <87skrsibh9.fsf@mundaneum.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=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1222090883 32443 80.91.229.12 (22 Sep 2008 13:41:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Sep 2008 13:41:23 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Mon Sep 22 15:42:20 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 1KhlgB-0002jL-5N for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Sep 2008 15:42:19 +0200 Original-Received: from localhost ([127.0.0.1]:56493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Khlf9-0004F6-EO for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Sep 2008 09:41:15 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.k-dsl.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!aotearoa.belnet.be!news.belnet.be!feed1.news.be.easynet.net!reader0.news.be.easynet.net!not-for-mail Original-Newsgroups: gnu.emacs.help X-Www-site: Under construction... X-Archive: encrypt User-Agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:GsUDFGw2OzQkoFZPTy0gA+D2Y5I= Original-Lines: 76 Original-NNTP-Posting-Date: 22 Sep 2008 12:58:11 GMT Original-NNTP-Posting-Host: 81.188.7.152 Original-X-Trace: 1222088291 reader0.news.be.easynet.net 1614 [::ffff:81.188.7.152]:27297 Original-X-Complaints-To: abuse-sq41lydJq48WI+UwmH2aBQ@public.gmane.org Original-Xref: news.stanford.edu gnu.emacs.help:162553 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.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-mXXj517/zsQ@public.gmane.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:57895 Archived-At: Hi Lennart, >> --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. What do you mean exactly? > 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.) I'm a convicted user of EmacsW32 when on Windows since a long time. So, I could effectively (now that I know about it) easily find your functions: --8<---------------cut here---------------start------------->8--- (defun w32shell-explorer-file (file) "Open Windows Explorer with file FILE selected." (interactive "fFile to focus in Explorer: ") (let ((full-file (expand-file-name file))) (setq full-file (replace-regexp-in-string "/" "\\" full-file t t)) (w32-shell-execute nil (concat (getenv "SystemRoot") "\\explorer.exe") (concat "/n,/select," full-file)))) (defun w32shell-explorer-current-file () "Open Windows Explorer with current file selected." (interactive) (if buffer-file-name (w32shell-explorer-file buffer-file-name) (message "Buffer has no file name"))) (defun w32shell-explorer-old (dir) "Open Windows Explorer in directory DIR. For some reason with this function Explorer does not get focus. Use the new version instead." (interactive "DStart in directory: ") (setq dir (expand-file-name dir)) (w32-shell-execute nil dir)) (defun w32shell-explorer (dir) "Open Windows Explorer in directory DIR." (interactive "DStart in directory: ") (setq dir (expand-file-name dir)) ;;(setq dir (directory-file-name dir)) (message "dir=3D%s" dir) (sit-for 2) (w32-shell-execute "explore" ;;nil "" ;(concat (getenv "SystemRoot") "\\explorer.exe") (concat "/n," dir) )) (defun w32shell-explorer-here () "Open Windows Explorer in current directory." (interactive) (w32shell-explorer default-directory)) --8<---------------cut here---------------end--------------->8--- These look great, but the problem is I'd like to be able to use the described functionality both under Ubuntu and Windows... Best regards, Seb --=20 S=C3=A9bastien=C2=A0Vauban