Subject: RE: bug#17251: 24.4.50; `dired-guess-default': wrong logic

From: Drew Adams <[email-masked]>
Date: Sat, 12 Apr 2014 09:28:34 -0700 (PDT)

In fact, at the top of the section of `dired-x.el' which implements this,
you will find an English description of the overly restrictive logic:

;;; GUESS SHELL COMMAND.

;; Brief Description:
;;;
;; * `dired-do-shell-command' is bound to `!' by dired.el.
;;;
;; * `dired-guess-shell-command' provides smarter defaults for
;;;    dired-aux.el's `dired-read-shell-command'.
;;;
;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
;;;    marked files.
;;;
;; * Parse `dired-guess-shell-alist-user' and
;;;   `dired-guess-shell-alist-default' (in that order) for the first REGEXP
;;;   that matches the first file in the file list.
;;;
;; * If the REGEXP matches all the entries of the file list then evaluate
;;;   COMMAND, which is either a string or a Lisp expression returning a
;;;   string.  COMMAND may be a list of commands.
;;;
;; * Return this command to `dired-guess-shell-command' which prompts user
;;;   with it.  The list of commands is put into the list of default values.
;;;   If a command is used successfully then it is stored permanently in
;;;   `dired-shell-command-history'.

The inappropriate part of the logic is described in the 5th bullet.
The logic should not be to require that a single REGEXP (the first regexp)
"matches all the entries of the file list" in order to find the appropriate
COMMAND.  It should be to require that all files in the file list are
associated with the same COMMAND.  Individual files in the list should be
able to be associated with the COMMAND in different ways (i.e., using
different regexps).