 
 A non-positive prefix arg means to ignore subdir markings and act
 instead on ALL subdirs.  That is, mark all in this directory and all
-descendant directories."
-  (interactive "P")
-  (diredp-mark-recursive-1 arg "executable files" "executable file" '(diredp-looking-at-p dired-re-exe)))
-
-;;;###autoload
-(defun diredp-mark-directories-recursive (&optional arg) ; Bound to `M-+ * /'
+descendant directories.
+
+When called from Lisp, optional arg DETAILS is passed to
+`diredp-mark-recursive-1'."
+  (interactive (list current-prefix-arg diredp-list-file-attributes))
+  (diredp-mark-recursive-1 arg "executable files" "executable file" '(diredp-looking-at-p dired-re-exe) details))
+
+;;;###autoload
+(defun diredp-mark-directories-recursive (&optional arg details) ; Bound to `M-+ * /'
   "Mark all directories except `.' and `..', including in marked subdirs.
 The directories included are those that are marked in the current
 Dired buffer, or all subdirs in the directory if none are marked.

                              (diredp-fewer-than-2-files-p arg)))

(defun diredp-display-image ()
  (let ((file     (dired-get-filename 'LOCAL 'NO-ERROR))
        (failure  nil))
    (save-excursion

                               (if case-fold-search
                                   (lambda (s1 s2) (string-lessp (upcase s1) (upcase s2)))
                                 'string-lessp))))))

(when (fboundp 'read-char-choice)       ; Emacs 24+


  ;; REPLACE ORIGINAL in `dired-aux.el'
  ;;
  ;; `l' lists the files involved and prompts again.
  ;;
  (defun dired-query (sym prompt &rest args)
    "Format PROMPT with ARGS, query user, and store the result in SYM.
The return value is either nil or t.

The user can type:
 `y' or `SPC' to accept once
 `n' or `DEL' to skip once
 `!' to accept this and subsequent queries
 `l' list the files, showing details per `diredp-list-file-attributes'
 `q' or `ESC' to decline this and subsequent queries

If SYM is already bound to a non-nil value, this function may return
automatically without querying the user.  If SYM is `!', return t; if
SYM is `q' or ESC, return nil."
    (let* ((char            (symbol-value sym))
           (char-choices    '(?y ?\   ?n ?\177 ?! ?l ?q ?\e)) ; Use ?\  , not ?\s, for Emacs 20 byte-compiler.
           (list-buf        (generate-new-buffer-name "*Files*"))
           (list-was-shown  nil))
      (unwind-protect
           (cond ((eq char ?!) t)       ; Accept, and don't ask again.
                 ((memq char '(?q ?\e)) nil) ; Skip, and don't ask again.
                 (t                     ; No previous answer - ask now
                  (setq prompt  (concat (apply (if (fboundp 'format-message) #'format-message #'format)
                                               prompt
                                               args)
                                        (if help-form
                                            (format " [Type ynlq! or %s] " (key-description (vector help-char)))
                                          " [Type y, n, l, q or !] ")))
                  (set sym (setq char  (read-char-choice prompt char-choices)))
                  (when (eq char ?l)    ; List files and prompt again.
                    (diredp-list-files args nil nil nil diredp-list-file-attributes)
                    (set sym (setq char  (read-char-choice prompt char-choices))))
                  (and (memq char '(?y ?\   ?!))  t))) ; Use ?\  , not ?\s, for Emacs 20.
        (when (get-buffer list-buf)
          (save-window-excursion
            (pop-to-buffer list-buf)
            (condition-case nil         ; Ignore error if user already deleted.
                (if (one-window-p) (delete-frame) (delete-window))
              (error nil))
            (if list-was-shown (bury-buffer list-buf) (kill-buffer list-buf)))))))

  )

(unless (fboundp 'read-char-choice)     ; Emacs 20-23 (modified the Emacs 23 version).  Needs `dired-query-alist'.


  ;; REPLACE ORIGINAL in `dired-aux.el'
  ;;
  ;; 1. `l' lists the files involved and prompts again.
  ;; 2. Compatible with older Emacs versions (before Emacs 24): can use `dired-query-alist'.
  ;;
  (defun dired-query (qs-var qs-prompt &rest qs-args)
    "Query user and return nil or t.
The user can type:
 `y' or `SPC' to accept once
 `n' or `DEL' to skip once
 `!' to accept this and subsequent queries
 `l' list the files, showing details per `diredp-list-file-attributes'
 `q' or `ESC' to decline this and subsequent queries

Store answer in symbol VAR (which must initially be bound to nil).
Format PROMPT with ARGS.
Binding variable `help-form' will help the user who types the help key."
    (let* ((char               (symbol-value qs-var))
           (dired-query-alist  (cons '(?l . l) dired-query-alist))
           (action             (cdr (assoc char dired-query-alist))))
      (cond ((eq 'yes action) t)        ; Accept, and don't ask again.
            ((eq 'no action) nil)       ; Skip, and don't ask again.
            (t                          ; No lasting effects from last time we asked - ask now.
             (let ((cursor-in-echo-area  t)
                   (executing-kbd-macro  executing-kbd-macro)
                   (qprompt              (concat qs-prompt
                                                 (if help-form
                                                     (format " [Type ynl!q or %s] "
                                                             (key-description (char-to-string help-char)))
                                                   " [Type y, n, l, q or !] ")))
                   done result elt)
               (while (not done)
                 (apply #'message qprompt qs-args)
                 (setq char  (set qs-var (read-event)))
                 (when (eq char ?l)     ; List files and prompt again.
                   (diredp-list-files qs-args nil nil nil diredp-list-file-attributes)
                   (apply #'message qprompt qs-args)
                   (setq char  (set qs-var (read-event))))
                 (if (numberp char)
                     (cond ((and executing-kbd-macro (= char -1))
                            ;; `read-event' returns -1 if we are in a keyboard macro and there are no more
                            ;; events in the macro.  Try to get an event interactively.
                            (setq executing-kbd-macro  nil))
                           ((eq (key-binding (vector char)) 'keyboard-quit) (keyboard-quit))
                           (t (setq done  (setq elt  (assoc char dired-query-alist)))))))
               ;; Display the question with the answer.
               (message "%s" (concat (apply #'format qprompt qs-args) (char-to-string char)))
               (memq (cdr elt) '(t y yes)))))))

  )


;; REPLACE ORIGINAL in `dired-aux.el'.
