[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 14:58:10 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux) |
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
- Browsing dirs from Dired with graphical explorer, Sébastien Vauban, 2008/09/22
- Message not available
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/22
- Re: Browsing dirs from Dired with graphical explorer, Rupert Swarbrick, 2008/09/22
- Re: Browsing dirs from Dired with graphical explorer, Tassilo Horn, 2008/09/22
- Message not available
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/22
- Re: Browsing dirs from Dired with graphical explorer, Tassilo Horn, 2008/09/22
- Message not available
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/22
- Re: Browsing dirs from Dired with graphical explorer, Tassilo Horn, 2008/09/23
- Message not available
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/23
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/23
- Re: Browsing dirs from Dired with graphical explorer, Richard Riley, 2008/09/24