* dired-aux.el (dired-query): Place cursor in echo area and allow
authorChong Yidong <cyd@stupidchicken.com>
Sun, 8 Nov 2009 00:32:18 +0000 (00:32 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 8 Nov 2009 00:32:18 +0000 (00:32 +0000)
C-g.

* dired.el (dired-mode-map): Disable dired-maybe-insert-subdir
menu item if not on a directory (Bug#4701).

lisp/ChangeLog
lisp/dired-aux.el
lisp/dired.el

index 5e6f2cc..c150a20 100644 (file)
@@ -1,3 +1,11 @@
+2009-11-08  Chong Yidong  <cyd@stupidchicken.com>
+
+       * dired-aux.el (dired-query): Place cursor in echo area and allow
+       C-g.
+
+       * dired.el (dired-mode-map): Disable dired-maybe-insert-subdir
+       menu item if not on a directory (Bug#4701).
+
 2009-11-07  Michael Albinus  <michael.albinus@gmx.de>
 
        Sync with Tramp 2.1.17.
index ce93f01..95cdc76 100644 (file)
@@ -887,25 +887,33 @@ Binding variable `help-form' will help the user who types the help key."
          ((eq 'no action)
           nil)                         ; skip, and don't ask again
          (t;; no lasting effects from last time we asked - ask now
-          (let ((qprompt (concat qs-prompt
+          (let ((cursor-in-echo-area t)
+                (executing-kbd-macro executing-kbd-macro)
+                (qprompt (concat qs-prompt
                                  (if help-form
                                      (format " [Type yn!q or %s] "
                                              (key-description
                                               (char-to-string help-char)))
                                    " [Type y, n, q or !] ")))
-                result elt)
-            ;; Actually it looks nicer without cursor-in-echo-area - you can
-            ;; look at the dired buffer instead of at the prompt to decide.
-            (apply 'message qprompt qs-args)
-            (while (progn (setq char (set qs-var (read-key)))
-                           (not (setq elt (assoc char dired-query-alist))))
-              (message "Invalid key - type %c for help." help-char)
-              (ding)
-              (sit-for 1)
-              (apply 'message qprompt qs-args))
+                done result elt)
+            (while (not done)
+              (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 kbd
+                         ;; macro and there are no more events in the
+                         ;; macro.  Attempt 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)))
+                                  (char-to-string char)))
             (memq (cdr elt) '(t y yes)))))))
 \f
 ;;;###autoload
index 14fe286..34c17ea 100644 (file)
@@ -1388,8 +1388,9 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
                  :help "Move to previous directory-file line"))
     (define-key map [menu-bar subdir insert]
       '(menu-item "Insert This Subdir" dired-maybe-insert-subdir
-                 :help "Insert contents of subdirectory"))
-
+                 :help "Insert contents of subdirectory"
+                 :enable (let ((f (dired-get-filename nil t)))
+                           (and f (file-directory-p f)))))
     (define-key map [menu-bar immediate]
       (cons "Immediate" (make-sparse-keymap "Immediate")))
 
@@ -3454,7 +3455,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 ;;;;;;  dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
 ;;;;;;  dired-clean-directory dired-do-print dired-do-touch dired-do-chown
 ;;;;;;  dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "6c7ccd455c2cd50d48164ebd5c52e216")
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "e207e02ac395d10ee4a09e208081a0ce")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\