[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-
From: |
Jambunathan K |
Subject: |
bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc) |
Date: |
Thu, 04 Apr 2013 08:55:12 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Add support for opening files outside of Emacs (use xdg-open, open etc).
>> This is something that I sorely missed or continue to miss.
>
> For those people who find xdg-open not customizable enough, I think
> open-file deserves an alist associating different commands to different
> file kinds.
> I guess in this sense I agree with Leo, that it should probably use
> dired-guess-shell or something like that.
I have looked at the variable that Leo mentions, prior to preparting the
patch. (Hint: The COMMAND is a sexp. It can theoretically be a `cond'
or a `case' statement.) I want the new customization to be simple and
not over-engineered and in a way that is welcoming of the new user while
giving power to the more experienced.
To allow for a possibility that a generic open command may not be
available, I have arranged for a `read-shell-command' and remembering
the command name so entered in `dired-shell-command-history'.
Furthermore, the open command need not be xdg-open, it could be
gnome-open or kde-open. (If you look xdg-open you will see that it
internally checks for desktop open and calls the native open method.)
(defun open-file (filename)
"Open FILENAME (presumably) outside of Emacs.
Use shell command from `open-file-command' to open the file."
(interactive "fOpen file:")
(require 'dired-aux)
(let* ((default-directory (file-name-directory filename))
(filename (file-name-nondirectory filename))
| (command (or (eval (cadr (assq system-type open-file-command)))
| (read-shell-command (format "Open %s with: "
filename) nil
| 'dired-shell-command-history))))
(when (and command (string-match "\\S-" command))
(dired-run-shell-command (dired-shell-stuff-it command (list
filename) t)))))
> Stefan
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Jambunathan K, 2013/04/01
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Stefan Monnier, 2013/04/03
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc),
Jambunathan K <=
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Stefan Monnier, 2013/04/04
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Jambunathan K, 2013/04/04
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Stefan Monnier, 2013/04/04
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Jambunathan K, 2013/04/04
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Eli Zaretskii, 2013/04/04
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Jambunathan K, 2013/04/05
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Thierry Volpiatto, 2013/04/05
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Jambunathan K, 2013/04/10
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Thierry Volpiatto, 2013/04/10
- bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc), Leo Liu, 2013/04/05