From bedd8a58d891cda65802614838c353c0dbbc9900 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 8 Nov 2009 00:32:18 +0000 Subject: [PATCH] * 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). --- lisp/ChangeLog | 8 ++++++++ lisp/dired-aux.el | 32 ++++++++++++++++++++------------ lisp/dired.el | 7 ++++--- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5e6f2cc1ecc..c150a2084d8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2009-11-08 Chong Yidong + + * 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 Sync with Tramp 2.1.17. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index ce93f01d6ca..95cdc7669bf 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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))))))) ;;;###autoload diff --git a/lisp/dired.el b/lisp/dired.el index 14fe286c82f..34c17ea4f5d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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" "\ -- 2.39.2