Subject: Re: bug#14110: 24.3.50; Add command to open files outside of Emacs (use xdg-open, open etc)

From: Jambunathan K <[email-masked]>
Date: Thu, 04 Apr 2013 20:04:44 +0530

Stefan Monnier <[email-masked]> 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