GNU bug report logs - #14110
24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc)

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Mon, 1 Apr 2013 07:02:02 UTC

Severity: wishlist

Found in version 24.3.50

Done: Jambunathan K <kjambunathan <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14110 in the body.
You can then email your comments to 14110 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Mon, 01 Apr 2013 07:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jambunathan K <kjambunathan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Apr 2013 07:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Mon, 01 Apr 2013 12:27:58 +0530
[Message part 1 (text/plain, inline)]
Add support for opening files outside of Emacs (use xdg-open, open etc).
This is something that I sorely missed or continue to miss.

Here is an (initial) patch...

[Message part 2 (text/x-diff, inline)]
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-03-31 15:19:19 +0000
+++ lisp/ChangeLog	2013-04-01 06:50:35 +0000
@@ -1,3 +1,13 @@
+2013-04-01  Jambunathan K  <kjambunathan <at> gmail.com>
+
+	* files.el (open-file-command): New user option.
+	(open-file): New command.
+	(ctl-x-map): Bind it to `C-S-f'.
+
+	* dired-aux.el (dired-do-open): New command
+
+	* dired.el (dired-mode-map): Bind it to `C-S-f'.
+
 2013-03-31  Roland Winkler  <winkler <at> gnu.org>
 
 	* emacs-lisp/crm.el (completing-read-multiple): Doc fix.

=== modified file 'lisp/dired-aux.el'
--- lisp/dired-aux.el	2013-02-28 21:51:11 +0000
+++ lisp/dired-aux.el	2013-04-01 05:44:57 +0000
@@ -426,6 +426,18 @@ Uses the shell command coming from varia
 		   'print arg file-list)))
     (dired-run-shell-command (dired-shell-stuff-it command file-list nil))))
 
+;;;###autoload
+(defun dired-do-open (&optional arg)
+  "Open the marked (or next ARG) files (presumably) outside of Emacs.
+Use shell command coming from variable `open-file-command' to
+open the file."
+  (interactive "P")
+  (let* ((file-list (dired-get-marked-files t arg))
+	 (command (dired-mark-read-string "Open %s with: " 
+					  (eval (cadr (assq system-type open-file-command)))
+					  t arg file-list)))
+    (dired-run-shell-command (dired-shell-stuff-it command file-list t))))
+
 (defun dired-mark-read-string (prompt initial op-symbol arg files
 			       &optional default-value collection)
   "Read args for a Dired marked-files command, prompting with PROMPT.

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2013-02-28 21:51:11 +0000
+++ lisp/dired.el	2013-04-01 06:52:10 +0000
@@ -1426,6 +1426,7 @@ Do so according to the former subdir ali
     (define-key map "C" 'dired-do-copy)
     (define-key map "B" 'dired-do-byte-compile)
     (define-key map "D" 'dired-do-delete)
+    (define-key map [33554438] 'dired-do-open) ; C-S-f
     (define-key map "G" 'dired-do-chgrp)
     (define-key map "H" 'dired-do-hardlink)
     (define-key map "L" 'dired-do-load)
@@ -3958,6 +3959,13 @@ Uses the shell command coming from varia
 
 \(fn &optional ARG)" t nil)
 
+(autoload 'dired-do-open "dired-aux" "\
+Open the marked (or next ARG) files (presumably) outside of Emacs.
+Use shell command coming from variable `open-file-command' to
+open the file.
+
+\(fn &optional ARG)" t nil)
+
 (autoload 'dired-clean-directory "dired-aux" "\
 Flag numerical backups for deletion.
 Spares `dired-kept-versions' latest versions, and `kept-old-versions' oldest.

=== modified file 'lisp/files.el'
--- lisp/files.el	2013-03-24 06:42:25 +0000
+++ lisp/files.el	2013-04-01 06:05:45 +0000
@@ -6805,6 +6805,54 @@ Otherwise, trash FILENAME using the free
 		   (rename-file fn new-fn)))))))))
 
 
+;; Open files outside of Emacs
+(defcustom open-file-command '((gnu "xdg-open *")
+			       (gnu/linux "xdg-open *")
+			       (gnu/kfreebsd "xdg-open *")
+			       (darwin "open *")
+			       (windows-nt "open *")
+			       (cygwin "open *")
+			       (ms-dos nil))
+  "Shell commands for opening files generically.
+
+Each element of this list looks like
+
+    (SYSTEM-TYPE COMMAND...)
+
+SYSTEM-TYPE is one of `system-type's.
+
+COMMAND can either be a string or a Lisp expression that
+evaluates to a string.  It follows the same semantics as the
+COMMAND param of `dired-do-shell-command'."
+	    :type '(alist :key-type symbol :value-type (group sexp)
+			  :options ((gnu "xdg-open &")
+				    (gnu/linux "xdg-open &")
+				    (gnu/kfreebsd "xdg-open &")
+				    (darwin "open &")
+				    (windows-nt "open &")
+				    (cygwin "open &")
+				    (ms-dos nil)))
+	    :version "24.4"
+	    :group 'file)
+
+(eval-when-compile
+  (require 'dired-aux))
+
+(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)))))
+
+
+(define-key ctl-x-map [33554438] 'open-file) ; C-x C-S-f
 (define-key ctl-x-map "\C-f" 'find-file)
 (define-key ctl-x-map "\C-r" 'find-file-read-only)
 (define-key ctl-x-map "\C-v" 'find-alternate-file)

[Message part 3 (text/plain, inline)]
In GNU Emacs 24.3.50.7 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2013-04-01 on debian-6.05
Bzr revision: 112204 jay.p.belanger <at> gmail.com-20130331202740-d1t6qedxr13vmnzc
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
  value of $LANG: en_IN
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Mon, 01 Apr 2013 07:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Mon, 01 Apr 2013 15:42:32 +0800
On 2013-04-01 14:57 +0800, Jambunathan K wrote:
> Add support for opening files outside of Emacs (use xdg-open, open etc).
> This is something that I sorely missed or continue to miss.

See dired-x

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Mon, 01 Apr 2013 08:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Mon, 01 Apr 2013 13:36:11 +0530
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2013-04-01 14:57 +0800, Jambunathan K wrote:
>> Add support for opening files outside of Emacs (use xdg-open, open etc).
>> This is something that I sorely missed or continue to miss.
>
> See dired-x

Be specific.  Where exactly?

> Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Mon, 01 Apr 2013 13:36:03 GMT) Full text and rfc822 format available.

Message #14 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Mon, 01 Apr 2013 21:31:45 +0800
On 2013-04-01 16:06 +0800, Jambunathan K wrote:
> Be specific.  Where exactly?

You can start with dired-guess-shell-alist-user

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Mon, 01 Apr 2013 20:27:01 GMT) Full text and rfc822 format available.

Message #17 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Tue, 02 Apr 2013 01:53:00 +0530
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2013-04-01 16:06 +0800, Jambunathan K wrote:
>> Be specific.  Where exactly?
>
> You can start with dired-guess-shell-alist-user

Ok, That is a variable not a command.  My patch introduces two (useful)
commands.  

I suggest that you start with looking at my patch.

> Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 01:12:02 GMT) Full text and rfc822 format available.

Message #20 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Wed, 03 Apr 2013 21:08:29 -0400
> 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.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 03:29:02 GMT) Full text and rfc822 format available.

Message #23 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: 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
Stefan Monnier <monnier <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 12:26:02 GMT) Full text and rfc822 format available.

Message #26 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Thu, 04 Apr 2013 08:22:34 -0400
> (Hint: The COMMAND is a sexp.  It can theoretically be a `cond'
> or a `case' statement.)

If you want such customizability, then please use a function:
funcall/apply is great, but eval is evil.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 14:39:02 GMT) Full text and rfc822 format available.

Message #29 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Thu, 04 Apr 2013 20:04:44 +0530
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> (Hint: The COMMAND is a sexp.  It can theoretically be a `cond'
>> or a `case' statement.)
>
> If you want such customizability, then please use a function:
> funcall/apply is great, but eval is evil.

(It will be improper for me to provide a patch.)

Leo suggests `dired-guess-shell-alist-user'.  COMMAND there is a sexp,
btw. So the above variable is also evil.

There is one another reason why `dired-guess-shell-alist-user' will be
improper to be used for Open semantics.  IIRC, running a shell command
.tex file compiles it.  So equating shell command with open is
confusing, btw.

,----[ C-h v dired-guess-shell-alist-user RET ]
| dired-guess-shell-alist-user is a variable defined in `dired-x.el'.
| Its value is nil
| 
| Documentation:
| User-defined alist of rules for suggested commands.
| These rules take precedence over the predefined rules in the variable
| `dired-guess-shell-alist-default' (to which they are prepended).
| 
| Each element of this list looks like
| 
|     (REGEXP COMMAND...)
| 
| where each COMMAND can either be a string or a Lisp expression that evaluates
| to a string.  If several COMMANDs are given, the first one will be the default
| and the rest will be added temporarily to the history and can be retrieved
| with M-x previous-history-element (M-p) .
| 
| The variable `dired-guess-shell-case-fold-search' controls whether
| REGEXP is matched case-sensitively.
| 
| You can set this variable in your ~/.emacs.  For example, to add rules for
| `.foo' and `.bar' files, write
| 
|  (setq dired-guess-shell-alist-user
|         '(("\\.foo\\'" "FOO-COMMAND")
|           ("\\.bar\\'"
|            (if condition
|               "BAR-COMMAND-1"
|             "BAR-COMMAND-2"))))
| 
| You can customize this variable.
| 
| [back]
`----


>         Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 16:29:01 GMT) Full text and rfc822 format available.

Message #32 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Thu, 04 Apr 2013 12:24:50 -0400
> Leo suggests `dired-guess-shell-alist-user'.  COMMAND there is a sexp,
> btw. So the above variable is also evil.

Yes.  I also plead guilty of doing that a few times in the past.
It's still evil.

> There is one another reason why `dired-guess-shell-alist-user' will be
> improper to be used for Open semantics.  IIRC, running a shell command
> .tex file compiles it.  So equating shell command with open is
> confusing, btw.

I tend to agree, but:
- I can't think of anything useful "open" could do with a .tex file
  other than pass it back to Emacs (which you can already do better by
  opening the file in Emacs without going through "open").
  While this might not apply to all cases, I suspect that most cases are
  like that.
- That doesn't preclude using dired-guess-shell.  It might just mean
  that we should have maybe an alist for "run command" and another alist
  for "open command" (and maybe a third alist to share the many common
  cases between the two).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 17:57:02 GMT) Full text and rfc822 format available.

Message #35 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Thu, 04 Apr 2013 23:22:37 +0530
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Leo suggests `dired-guess-shell-alist-user'.  COMMAND there is a sexp,
>> btw. So the above variable is also evil.
>
> Yes.  I also plead guilty of doing that a few times in the past.
> It's still evil.
>
>> There is one another reason why `dired-guess-shell-alist-user' will be
>> improper to be used for Open semantics.  IIRC, running a shell command
>> .tex file compiles it.  So equating shell command with open is
>> confusing, btw.
>
> I tend to agree, but:
> - I can't think of anything useful "open" could do with a .tex file
>   other than pass it back to Emacs (which you can already do better by
>   opening the file in Emacs without going through "open").
>   While this might not apply to all cases, I suspect that most cases are
>   like that.

`open-file' command (as I see it) will do what a "double click" in
Windows Explorer or Thunar will do.  Note that each popular
`system-type' already has a open command.

In Windows + MikTex, double-clicking on a .tex will open a specialized
viewer (IIRC, it is called yap).  

More importantly, `open-file' on a directory will launch Windows
explorer or Thunar or Nautilus.

> - That doesn't preclude using dired-guess-shell.  It might just mean
>   that we should have maybe an alist for "run command" and another alist
>   for "open command" (and maybe a third alist to share the many common
>   cases between the two).

Big NO for having an alist (within Emacs) for the open command.

The alist is already maintained by the user's desktop (likely via
Explore->`Open with' -> `Always use this application for these files').
Emacs should at no point in time have any knowledge of this association.

To accommodate other systems which are non-desktopy (DOS?), we can
enhance the shell-command history var to be a (cons FILE-EXTENSION
VIEWER).  This will be an exception rather than the norm.

>         Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Thu, 04 Apr 2013 18:24:01 GMT) Full text and rfc822 format available.

Message #38 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Thu, 04 Apr 2013 21:20:41 +0300
> From: Jambunathan K <kjambunathan <at> gmail.com>
> Date: Thu, 04 Apr 2013 23:22:37 +0530
> Cc: 14110 <at> debbugs.gnu.org
> 
> The alist is already maintained by the user's desktop (likely via
> Explore->`Open with' -> `Always use this application for these files').
> Emacs should at no point in time have any knowledge of this association.

Emacs can easily know about the associations, at least on Windows.

> To accommodate other systems which are non-desktopy (DOS?), we can
> enhance the shell-command history var to be a (cons FILE-EXTENSION
> VIEWER).  This will be an exception rather than the norm.

That's meaningless on DOS, which is a single-process system.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Fri, 05 Apr 2013 05:02:02 GMT) Full text and rfc822 format available.

Message #41 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14110 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Fri, 05 Apr 2013 10:28:01 +0530
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Jambunathan K <kjambunathan <at> gmail.com>
>> Date: Thu, 04 Apr 2013 23:22:37 +0530
>> Cc: 14110 <at> debbugs.gnu.org
>> 
>> The alist is already maintained by the user's desktop (likely via
>> Explore->`Open with' -> `Always use this application for these files').
>> Emacs should at no point in time have any knowledge of this association.
>
> Emacs can easily know about the associations, at least on Windows.

On my Debian/Squeeze, this is what I have ended up with.

,----
| $ xdg-mime query filetype images/vanilla-emacs.png 
| image/png; charset=binary
`----

,----
| $ xdg-mime query default image/png
| gimp.desktop
`----

,----
| $ dpkg -L gimp | grep desktop
| /usr/lib/gimp/2.0/plug-ins/file-desktop-link
| /usr/share/applications/gimp.desktop
`----

,----
| $ cat /usr/share/applications/gimp.desktop | grep Exec
| Exec=gimp-2.6 %U
| TryExec=gimp-2.6
`----

,----
| $ gimp-
| gimp-2.6          gimp-console      gimp-console-2.6 
`----

There should be a way to go directly from *.desktop file to Exec entry.
I haven't figured it out or it is in the works.

Surprisingly, the above sequence fails for ODT files.

,----
| $ xdg-mime query filetype book.odt
| application/vnd.oasis.opendocument.text; charset=binary
`----

,----
| $ xdg-mime query default application/vnd.oasis.opendocument.text
| <NOTHING WHATSOEVER>
`----

I believe xdg-stuff is in it's initial stages and not so reliable at
this moment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Fri, 05 Apr 2013 06:08:02 GMT) Full text and rfc822 format available.

Message #44 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Fri, 05 Apr 2013 08:03:59 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Jambunathan K <kjambunathan <at> gmail.com>
>> Date: Thu, 04 Apr 2013 23:22:37 +0530
>> Cc: 14110 <at> debbugs.gnu.org
>> 
>> The alist is already maintained by the user's desktop (likely via
>> Explore->`Open with' -> `Always use this application for these files').
>> Emacs should at no point in time have any knowledge of this association.
>
> Emacs can easily know about the associations, at least on Windows.

Here what I do in helm:

Default action to open a file is always edit the file in emacs with the
right mode.

Use another command to open file externally (async).
This command can use a prefix to choose program to use (with
completion).
Once you choose this program your choice is stored in an alist with
customize. (So no need for user to customize complex alist)
Each time you want to change, you can press C-u to make another choice.
If you answer yes, this new program will replace the precedent in alist,
no will use the new program without storing it.
If you don't press C-u the last program used for this kind of file is
used.
If the command is called with no choice (not C-u) and nothing for this
file extension is found in alist helm looks for mailcap entries.

It is good to be able to change program at any time, e.g for foo.jpg,
you may use sometimes imagemagick, ristretto, or gimp etc....

I also have a command that use default tool with no choice (xdg-open)
but I don't like it.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Fri, 05 Apr 2013 06:57:02 GMT) Full text and rfc822 format available.

Message #47 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Fri, 05 Apr 2013 14:53:06 +0800
On 2013-04-04 22:34 +0800, Jambunathan K wrote:
> Leo suggests `dired-guess-shell-alist-user'.  COMMAND there is a sexp,
> btw. So the above variable is also evil.

dired-x provides a general way for doing these sorts of things including
those you try to achieve in your patches. I merely point you to the
entry. It has a few glitches such as using eval and maybe others but
nothing major.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Wed, 10 Apr 2013 04:35:02 GMT) Full text and rfc822 format available.

Message #50 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Wed, 10 Apr 2013 10:00:45 +0530

> I also have a command that use default tool with no choice (xdg-open)
> but I don't like it.

What are the problems with `xdg-open'?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14110; Package emacs. (Wed, 10 Apr 2013 05:44:02 GMT) Full text and rfc822 format available.

Message #53 received at 14110 <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14110 <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
	Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Wed, 10 Apr 2013 07:39:40 +0200
Jambunathan K <kjambunathan <at> gmail.com> writes:

>> I also have a command that use default tool with no choice (xdg-open)
>> but I don't like it.
>
> What are the problems with `xdg-open'?

Less flexibility, no choice.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




Reply sent to Jambunathan K <kjambunathan <at> gmail.com>:
You have taken responsibility. (Fri, 15 Nov 2013 03:56:01 GMT) Full text and rfc822 format available.

Notification sent to Jambunathan K <kjambunathan <at> gmail.com>:
bug acknowledged by developer. (Fri, 15 Nov 2013 03:56:02 GMT) Full text and rfc822 format available.

Message #58 received at 14110-done <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: 14110-done <at> debbugs.gnu.org
Subject: Re: bug#14110: 24.3.50;
 Add command to open files outside of Emacs (use xdg-open, open etc)
Date: Tue, 01 Jan 2002 05:58:09 +0530
OP here.  I have a local fix that works for me.  Closing it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Dec 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.