unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Sébastien Vauban" <zthjwsqqafhv-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: Browsing dirs from Dired with graphical explorer
Date: Mon, 22 Sep 2008 14:58:10 +0200	[thread overview]
Message-ID: <87skrsibh9.fsf@mundaneum.com> (raw)
In-Reply-To: mailman.19685.1222087548.18990.help-gnu-emacs@gnu.org

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=%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

-- 
Sébastien Vauban


  parent reply	other threads:[~2008-09-22 12:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  8:31 Browsing dirs from Dired with graphical explorer Sébastien Vauban
2008-09-22 10:04 ` Tassilo Horn
2008-09-22 12:45   ` Lennart Borgman (gmail)
     [not found]   ` <mailman.19685.1222087548.18990.help-gnu-emacs@gnu.org>
2008-09-22 12:58     ` Sébastien Vauban [this message]
     [not found] ` <mailman.19679.1222078001.18990.help-gnu-emacs@gnu.org>
2008-09-22 12:05   ` Richard Riley
2008-09-22 13:06     ` Rupert Swarbrick
2008-09-22 13:37     ` Tassilo Horn
     [not found]     ` <mailman.19686.1222090826.18990.help-gnu-emacs@gnu.org>
2008-09-22 15:47       ` Richard Riley
2008-09-22 19:15         ` Tassilo Horn
     [not found]         ` <mailman.19711.1222111115.18990.help-gnu-emacs@gnu.org>
2008-09-22 22:07           ` Richard Riley
2008-09-23  7:58             ` Tassilo Horn
     [not found]             ` <mailman.19745.1222156700.18990.help-gnu-emacs@gnu.org>
2008-09-23 11:58               ` Richard Riley
2008-09-23 12:00                 ` Richard Riley
2008-09-24 17:28                   ` Richard Riley
2008-09-22 12:55   ` Rupert Swarbrick
2008-09-22 13:13   ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skrsibh9.fsf@mundaneum.com \
    --to=zthjwsqqafhv-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).