* Browsing dirs from Dired with graphical explorer
@ 2008-09-22 8:31 Sébastien Vauban
2008-09-22 10:04 ` Tassilo Horn
[not found] ` <mailman.19679.1222078001.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 16+ messages in thread
From: Sébastien Vauban @ 2008-09-22 8:31 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
Hello,
I would like some help with a snippet of code I've merged from
different sources:
--8<---------------cut here---------------start------------->8---
(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))))
--8<---------------cut here---------------end--------------->8---
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?
Next question: is there somehow a way not to be forced to
explicitly give the path to all possible executables under
Linux? Some way to launch the file browser like with a `start'
or `open' command?
Best regards,
Seb
--
Sébastien Vauban
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
[not found] ` <mailman.19679.1222078001.18990.help-gnu-emacs@gnu.org>
1 sibling, 2 replies; 16+ messages in thread
From: Tassilo Horn @ 2008-09-22 10:04 UTC (permalink / raw)
To: help-gnu-emacs
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---
In should open the directory point is on. If it's on a file, it depends
on what the file manager does when it gets a file argument. Most will
open it with an appropriate application.
You might want to bind the function so some key in dired.
(define-key dired-mode-map (kbd "e") 'my-browse-dir)
> Next question: is there somehow a way not to be forced to explicitly
> give the path to all possible executables under Linux?
Normally something like (start-process "file-browser" nil "dolphin")
should work. If not, then the PATH emacs sees is not setup correctly.
> Some way to launch the file browser like with a `start' or `open'
> command?
There's `xdg-open' which given a directory or file argument should open
it with the system's default application.
Bye,
Tassilo
--
No fortunes found
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[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
` (2 more replies)
2008-09-22 12:55 ` Rupert Swarbrick
2008-09-22 13:13 ` Sébastien Vauban
2 siblings, 3 replies; 16+ messages in thread
From: Richard Riley @ 2008-09-22 12:05 UTC (permalink / raw)
To: help-gnu-emacs
Tassilo Horn <tassilo@member.fsf.org> writes:
> 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:
>
> (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)))
>
> In should open the directory point is on. If it's on a file, it depends
> on what the file manager does when it gets a file argument. Most will
> open it with an appropriate application.
>
> You might want to bind the function so some key in dired.
>
> (define-key dired-mode-map (kbd "e") 'my-browse-dir)
>
>> Next question: is there somehow a way not to be forced to explicitly
>> give the path to all possible executables under Linux?
>
> Normally something like (start-process "file-browser" nil "dolphin")
> should work. If not, then the PATH emacs sees is not setup correctly.
>
>> Some way to launch the file browser like with a `start' or `open'
>> command?
>
> There's `xdg-open' which given a directory or file argument should open
> it with the system's default application.
Where is this defined? It does not exist on my debian system.
Also would you know how to make "e" open the directory/file under the
cursor? Your comments above indicate you thought this to be the case -
it actually opens the current dir.
e.g If I am in dired in ~, and the cursor is on .adobe (a dir) then
hitting e should open .adobe in nautilus in my case
,----
| (defun my-browse-dir ()
| "Open the current directory in your OS's file manager."
| (interactive)
| (let ((dir-as-string (dired-current-directory))
| (file-manager "nautilus"))
| (message "Dir is %s" dir-as-string)
| (start-process "browse" nil file-manager dir-as-string)
| )
| )
|
| (define-key dired-mode-map (kbd "e") 'my-browse-dir)
`----
>
> Bye,
> Tassilo
--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
1 sibling, 0 replies; 16+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-22 12:45 UTC (permalink / raw)
To: Tassilo Horn; +Cc: help-gnu-emacs
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.)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[not found] ` <mailman.19679.1222078001.18990.help-gnu-emacs@gnu.org>
2008-09-22 12:05 ` Richard Riley
@ 2008-09-22 12:55 ` Rupert Swarbrick
2008-09-22 13:13 ` Sébastien Vauban
2 siblings, 0 replies; 16+ messages in thread
From: Rupert Swarbrick @ 2008-09-22 12:55 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 1109 bytes --]
Tassilo Horn <tassilo@member.fsf.org> writes:
>
> If you're inside dired, you can use `dired-current-directory'. So maybe
> this (untested) version does what you want:
>
> (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)))
>
> In should open the directory point is on. If it's on a file, it depends
> on what the file manager does when it gets a file argument. Most will
> open it with an appropriate application.
>
> You might want to bind the function so some key in dired.
>
> (define-key dired-mode-map (kbd "e") 'my-browse-dir)
Another way, that doesn't need dired to be running is to use emacs'
directory expansion. That is,
(expand-file-name ".")
gives the full pathname of the current directory. This is a bit hacky,
to be honest, but I don't know a neater solution. Tassilo's solution now
becomes:
[-- Attachment #1.2: Type: application/emacs-lisp, Size: 359 bytes --]
[-- Attachment #1.3: Type: text/plain, Size: 93 bytes --]
Personally though, I wouldn't use the let form at all, and would just
write the following:
[-- Attachment #1.4: Type: application/emacs-lisp, Size: 319 bytes --]
[-- Attachment #1.5: Type: text/plain, Size: 226 bytes --]
Finally, since this now works outside of dired, you can use a global
keybinding if you want - how about:
(global-set-key (kbd "C-<f12>") 'my-browse-dir)
(of course, C-<f12> isn't necessarily what you want to use).
Rupert
[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[not found] ` <mailman.19685.1222087548.18990.help-gnu-emacs@gnu.org>
@ 2008-09-22 12:58 ` Sébastien Vauban
0 siblings, 0 replies; 16+ messages in thread
From: Sébastien Vauban @ 2008-09-22 12:58 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
2 siblings, 0 replies; 16+ messages in thread
From: Rupert Swarbrick @ 2008-09-22 13:06 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 3359 bytes --]
Richard Riley <rileyrgdev@gmail.com> writes:
>>
>> There's `xdg-open' which given a directory or file argument should open
>> it with the system's default application.
>
> Where is this defined? It does not exist on my debian system.
This may be a trifle OT but on my system:
rupert@hake:~ dpkg -S xdg-open
xdg-utils: /usr/bin/xdg-open
xdg-utils: /usr/share/man/man1/xdg-open.1.gz
rupert@hake:~ apt-cache show xdg-utils
Package: xdg-utils
Priority: optional
Section: utils
Installed-Size: 256
Maintainer: Per Olofsson <pelle@debian.org>
Architecture: all
Version: 1.0.2-6
Recommends: iceweasel | www-browser, x11-utils, x11-xserver-utils, file, mime-support, shared-mime-info
Suggests: desktop-file-utils, libgnome2-0, exo-utils, libgnomevfs2-bin, kdelibs4c2a, konqueror, libgtk2.0-bin
Filename: pool/main/x/xdg-utils/xdg-utils_1.0.2-6_all.deb
Size: 53260
MD5sum: a7185ac590bf72ee8c490e4fd7abeb65
SHA1: 0f6be668c7a92a9da3bb2e682135cb79781ffd57
SHA256: 1786908c1abf66841f44f384fed1eb1a875f0c2d36ffb45ff4fe48ad55205e84
Description: desktop integration utilities from freedesktop.org
xdg-utils contains utilities for integrating applications with the
desktop environment, regardless of which desktop environment is used.
They are part of freedesktop.org's Portland project.
.
The following utilities are included:
.
* xdg-desktop-menu - Install desktop menu items
* xdg-desktop-icon - Install icons on the user's desktop
* xdg-icon-resource - Install icon resources
* xdg-mime - Gather MIME information about a file
* xdg-open - Open a URL in the user's preferred application that
handles the respective URL or file type
* xdg-email - Open the user's preferred email client, potentially with
subject and other info filled in
* xdg-screensaver - Enable, disable, or suspend the screensaver
Homepage: http://portland.freedesktop.org/
Tag: devel::runtime, implemented-in::shell, interface::commandline, role::program, scope::utility
Task: desktop
rupert@hake:~
>
> Also would you know how to make "e" open the directory/file under the
> cursor? Your comments above indicate you thought this to be the case -
> it actually opens the current dir.
>
> e.g If I am in dired in ~, and the cursor is on .adobe (a dir) then
> hitting e should open .adobe in nautilus in my case
>
I didn't know the answer for this either, so this is how I found out: I
knew that hitting e in dired did what I wanted normally (ie worked out
what directory to use), so first I did C-h c e when in dired and found
that e was bound to dired-find-file.
I then had a look at the source code for dired-find-file in dired.el (if
you've got the sources installed, you can find it by doing C-h f
dired-find-file and then hitting enter on the filename, otherwise try
here [1]). The code is as follows:
(defun dired-find-file ()
"In Dired, visit the file or directory named on this line."
(interactive)
;; Bind `find-file-run-dired' so that the command works on directories
;; too, independent of the user's setting.
(let ((find-file-run-dired t))
(find-file (dired-get-file-for-visit))))
So I'd go for (dired-get-file-for-visit).
Rupert
[1] http://cvs.savannah.gnu.org/viewvc/emacs/lisp/dired.el?revision=1.410&root=emacs&view=markup
[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[not found] ` <mailman.19679.1222078001.18990.help-gnu-emacs@gnu.org>
2008-09-22 12:05 ` Richard Riley
2008-09-22 12:55 ` Rupert Swarbrick
@ 2008-09-22 13:13 ` Sébastien Vauban
2 siblings, 0 replies; 16+ messages in thread
From: Sébastien Vauban @ 2008-09-22 13:13 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
Hi Tassilo,
>> 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.
>>
>> 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:
>
> (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)))
>
> In should open the directory point is on. If it's on a file, it depends
> on what the file manager does when it gets a file argument. Most will
> open it with an appropriate application.
Thanks for your answer, that (should have) filled my need.
Though...
Tested under Ubuntu: I don't know what happens, but my screen is
flickering for less than one second, and... nothing... Like if
the dolphin process was launched but stopped or crashed... No
trace in Emacs... Don't know how to see what happened.
Though, launching the command:
--8<---------------cut here---------------start------------->8---
/usr/lib/kde4/bin/dolphin "/home/sva/texmf/tex/latex"
--8<---------------cut here---------------end--------------->8---
does work... Ununderstandable (for me, at least)!
Tested under Windows: explorer is launched but opens a pop-up
saying: "The path 'z:/texmf/tex/latex' does not exist or is not
a directory". This seems (after some tests from the command
prompt) to be because of the `/' character that should have to
be translated by a `\' for Windows...
Not that fantastic yet, my snippet of code!
Seb
--
Sébastien Vauban
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
2 siblings, 0 replies; 16+ messages in thread
From: Tassilo Horn @ 2008-09-22 13:37 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
Hi Richard,
>> There's `xdg-open' which given a directory or file argument should
>> open it with the system's default application.
>
> Where is this defined? It does not exist on my debian system.
Here on Gentoo GNU/Linux it's in the xdg-utils package.
> Also would you know how to make "e" open the directory/file under the
> cursor? Your comments above indicate you thought this to be the case -
> it actually opens the current dir.
Ah, ok. I wasn't too sure what `dired-current-directory' returns.
Assuming you have xdg-open installed, something like this might do the
trick.
--8<---------------cut here---------------start------------->8---
(defun dired-open-externally ()
"Open the current directory in your OS's file manager."
(interactive)
(start-process "dired-external" nil "xdg-open" (dired-get-file-for-visit)))
--8<---------------cut here---------------end--------------->8---
Then the logic what application to use for opening the given file or
directory is inside xdg-open. On GNU/Linux it takes these informations
from /etc/mailcap and ~/.mailcap, AFAICT.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[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>
0 siblings, 2 replies; 16+ messages in thread
From: Richard Riley @ 2008-09-22 15:47 UTC (permalink / raw)
To: help-gnu-emacs
Tassilo Horn <tassilo@member.fsf.org> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
> Hi Richard,
>
>>> There's `xdg-open' which given a directory or file argument should
>>> open it with the system's default application.
>>
>> Where is this defined? It does not exist on my debian system.
>
> Here on Gentoo GNU/Linux it's in the xdg-utils package.
Yes - I was being stupid - I thought you were referring to an elisp
function! :-;
>
>> Also would you know how to make "e" open the directory/file under the
>> cursor? Your comments above indicate you thought this to be the case -
>> it actually opens the current dir.
>
> Ah, ok. I wasn't too sure what `dired-current-directory' returns.
>
> Assuming you have xdg-open installed, something like this might do the
> trick.
>
> (defun dired-open-externally ()
> "Open the current directory in your OS's file manager."
> (interactive)
> (start-process "dired-external" nil "xdg-open" (dired-get-file-for-visit)))
>
> Then the logic what application to use for opening the given file or
> directory is inside xdg-open. On GNU/Linux it takes these informations
> from /etc/mailcap and ~/.mailcap, AFAICT.
>
> Bye,
> Tassilo
If I "xdg-open ." from the command line it works great.
If I change xdg-open for nautilus in the code below it works. (Using
nautilus that is).
But using xdk-open there it does not work for me (debian). Does it work
on your Linux install?
-->-->--
(defun dired-open-externally ()
"Open the current directory in your OS's file manager."
(interactive)
(let ((fileobject (dired-get-file-for-visit)))
(start-process "dired-external" nil "xdg-open" fileobject)
(message "file is %s" fileobject)
)
)
(define-key dired-mode-map (kbd "e") 'dired-open-externally)
-->-->--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
1 sibling, 0 replies; 16+ messages in thread
From: Tassilo Horn @ 2008-09-22 19:15 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
Hi Richard,
> If I "xdg-open ." from the command line it works great.
>
> If I change xdg-open for nautilus in the code below it works. (Using
> nautilus that is).
>
> But using xdk-open there it does not work for me (debian). Does it
> work on your Linux install?
Yes, it works here (Gentoo GNU/Linux). If point is on a directory it
opens thunar (the XFCE file manager), for files it uses another
appropriate application.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[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>
0 siblings, 2 replies; 16+ messages in thread
From: Richard Riley @ 2008-09-22 22:07 UTC (permalink / raw)
To: help-gnu-emacs
Tassilo Horn <tassilo@member.fsf.org> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
> Hi Richard,
>
>> If I "xdg-open ." from the command line it works great.
>>
>> If I change xdg-open for nautilus in the code below it works. (Using
>> nautilus that is).
>>
>> But using xdk-open there it does not work for me (debian). Does it
>> work on your Linux install?
>
> Yes, it works here (Gentoo GNU/Linux). If point is on a directory it
> opens thunar (the XFCE file manager), for files it uses another
> appropriate application.
Hmm. No joy here on Debian.
shell-command worked though but only for directories. For files the
cursor sat spinning - possibly because the process was waiting for
emacsclient to respond?
(defun dired-open-externally ()
"Open the current directory in your OS's file manager."
(interactive)
(let ((fileobject (dired-get-file-for-visit)))
; (start-process "dired-external" nil "/usr/bin/xdg-open" "http://www.freedesktop.org/")
(shell-command (concat "xdg-open" " " fileobject))
; (start-process-shell-command "xdg" nil "/usr/bin/xdg-open" "www.ibm.com")
)
)
(define-key dired-mode-map (kbd "e") 'dired-open-externally)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
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>
1 sibling, 0 replies; 16+ messages in thread
From: Tassilo Horn @ 2008-09-23 7:58 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
Hi Richard,
> Hmm. No joy here on Debian.
>
> shell-command worked though but only for directories. For files the
> cursor sat spinning - possibly because the process was waiting for
> emacsclient to respond?
I don't know. What happens if you eval?
(start-process "dired-external" "*dired-external*"
"xdg-open" "http://www.freedesktop.org/")
There should be some output in the *dired-external* buffer now.
Hm, strange. This doesn't work here, too, and in *dired-external*
there's only "Process dired-external finished". If I replace "xdg-open"
with "conkeror" it'll start conkeror on freedesktop.org.
xdg-open http://www.freedesktop.org/
in a terminal starts conkeror on freedesktop.org, too. I'm totally
stunned why this doesn't work from inside emacs. But
(start-process "dired-external" "*dired-external*"
"xdg-open" (getenv "HOME"))
does work and open thunar in my HOME.
Can anyone enlighten me why the first call has no result but the second
works as expected?
Bye,
Tassilo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
[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
0 siblings, 1 reply; 16+ messages in thread
From: Richard Riley @ 2008-09-23 11:58 UTC (permalink / raw)
To: help-gnu-emacs
Tassilo Horn <tassilo@member.fsf.org> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
> Hi Richard,
>
>> Hmm. No joy here on Debian.
>>
>> shell-command worked though but only for directories. For files the
>> cursor sat spinning - possibly because the process was waiting for
>> emacsclient to respond?
>
> I don't know. What happens if you eval?
>
> (start-process "dired-external" "*dired-external*"
> "xdg-open" "http://www.freedesktop.org/")
>
> There should be some output in the *dired-external* buffer now.
Yes : "Process dired-external finished". But nothing comes up.
>
> Hm, strange. This doesn't work here, too, and in *dired-external*
> there's only "Process dired-external finished". If I replace "xdg-open"
> with "conkeror" it'll start conkeror on freedesktop.org.
>
> xdg-open http://www.freedesktop.org/
>
> in a terminal starts conkeror on freedesktop.org, too. I'm totally
> stunned why this doesn't work from inside emacs. But
its a relief you are seeing the same as me now :-;
>
> (start-process "dired-external" "*dired-external*"
> "xdg-open" (getenv "HOME"))
great! thanks!
>
> does work and open thunar in my HOME.
>
> Can anyone enlighten me why the first call has no result but the second
> works as expected?
>
> Bye,
> Tassilo
>
>
>
--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
2008-09-23 11:58 ` Richard Riley
@ 2008-09-23 12:00 ` Richard Riley
2008-09-24 17:28 ` Richard Riley
0 siblings, 1 reply; 16+ messages in thread
From: Richard Riley @ 2008-09-23 12:00 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Richard Riley <rileyrgdev@gmail.com> writes:
>>
>> Hi Richard,
>>
>>> Hmm. No joy here on Debian.
>>>
>>> shell-command worked though but only for directories. For files the
>>> cursor sat spinning - possibly because the process was waiting for
>>> emacsclient to respond?
>>
>> I don't know. What happens if you eval?
>>
>> (start-process "dired-external" "*dired-external*"
>> "xdg-open" "http://www.freedesktop.org/")
>>
>> There should be some output in the *dired-external* buffer now.
>
> Yes : "Process dired-external finished". But nothing comes up.
>
>>
>> Hm, strange. This doesn't work here, too, and in *dired-external*
>> there's only "Process dired-external finished". If I replace "xdg-open"
>> with "conkeror" it'll start conkeror on freedesktop.org.
>>
>> xdg-open http://www.freedesktop.org/
>>
>> in a terminal starts conkeror on freedesktop.org, too. I'm totally
>> stunned why this doesn't work from inside emacs. But
>
> its a relief you are seeing the same as me now :-;
>
>
>>
>> (start-process "dired-external" "*dired-external*"
>> "xdg-open" (getenv "HOME"))
>
> great! thanks!
>
>>
>> does work and open thunar in my HOME.
I spoke too soon. It does not work here... I just get
Process dired-external finished
again the buffer.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Browsing dirs from Dired with graphical explorer
2008-09-23 12:00 ` Richard Riley
@ 2008-09-24 17:28 ` Richard Riley
0 siblings, 0 replies; 16+ messages in thread
From: Richard Riley @ 2008-09-24 17:28 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>
>>> Richard Riley <rileyrgdev@gmail.com> writes:
>>>
>>> Hi Richard,
>>>
>>>> Hmm. No joy here on Debian.
>>>>
>>>> shell-command worked though but only for directories. For files the
>>>> cursor sat spinning - possibly because the process was waiting for
>>>> emacsclient to respond?
>>>
>>> I don't know. What happens if you eval?
>>>
>>> (start-process "dired-external" "*dired-external*"
>>> "xdg-open" "http://www.freedesktop.org/")
>>>
>>> There should be some output in the *dired-external* buffer now.
>>
>> Yes : "Process dired-external finished". But nothing comes up.
>>
>>>
>>> Hm, strange. This doesn't work here, too, and in *dired-external*
>>> there's only "Process dired-external finished". If I replace "xdg-open"
>>> with "conkeror" it'll start conkeror on freedesktop.org.
>>>
>>> xdg-open http://www.freedesktop.org/
>>>
>>> in a terminal starts conkeror on freedesktop.org, too. I'm totally
>>> stunned why this doesn't work from inside emacs. But
>>
>> its a relief you are seeing the same as me now :-;
>>
>>
>>>
>>> (start-process "dired-external" "*dired-external*"
>>> "xdg-open" (getenv "HOME"))
>>
>> great! thanks!
>>
>>>
>>> does work and open thunar in my HOME.
>
>
> I spoke too soon. It does not work here... I just get
>
> Process dired-external finished
>
> again the buffer.
One of the problems I had was opening files associated with emacs - it
just hung as I was using emacs client. The solution was to have a
"myedit" script:
emacsclient -n "$@"
And the code is now:
(defun dired-open-externally ()
"Open the current directory in your OS's file manager."
(interactive)
(let ((fileobject (dired-get-file-for-visit)))
; (start-process "dired-external" nil "/usr/bin/xdg-open" "http://www.freedesktop.org/")
(shell-command (concat "xdg-open" " " fileobject))
; (start-process-shell-command "xdg" nil "/usr/bin/xdg-open" "www.ibm.com")
)
)
(define-key dired-mode-map (kbd "e") 'dired-open-externally)
I still don't know why start-process should not work.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2008-09-24 17:28 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.