changeset 105904:f49caf3c20c7

* 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).
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 08 Nov 2009 00:32:18 +0000
parents 28d5dd02302d
children 57dbd4754360
files lisp/ChangeLog lisp/dired-aux.el lisp/dired.el
diffstat 3 files changed, 32 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 08 00:14:30 2009 +0000
+++ b/lisp/ChangeLog	Sun Nov 08 00:32:18 2009 +0000
@@ -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.
--- a/lisp/dired-aux.el	Sun Nov 08 00:14:30 2009 +0000
+++ b/lisp/dired-aux.el	Sun Nov 08 00:32:18 2009 +0000
@@ -887,25 +887,33 @@
 	  ((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)))))))
 
 ;;;###autoload
--- a/lisp/dired.el	Sun Nov 08 00:14:30 2009 +0000
+++ b/lisp/dired.el	Sun Nov 08 00:32:18 2009 +0000
@@ -1388,8 +1388,9 @@
 		  :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 @@
 ;;;;;;  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" "\