From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: dired.el Date: Wed, 2 Jun 2004 22:43:54 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200406030343.i533hsu07215@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1086234319 14624 80.91.224.253 (3 Jun 2004 03:45:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Jun 2004 03:45:19 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Jun 03 05:45:12 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVjAG-0008Mm-00 for ; Thu, 03 Jun 2004 05:45:12 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BVjAF-0002h5-00 for ; Thu, 03 Jun 2004 05:45:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVjAZ-0004H4-6C for emacs-devel@quimby.gnus.org; Wed, 02 Jun 2004 23:45:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BVjAW-0004GU-3B for emacs-devel@gnu.org; Wed, 02 Jun 2004 23:45:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BVjAU-0004Fz-Eb for emacs-devel@gnu.org; Wed, 02 Jun 2004 23:45:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BVjAU-0004Fw-98 for emacs-devel@gnu.org; Wed, 02 Jun 2004 23:45:26 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BVj9y-0004Em-77 for emacs-devel@gnu.org; Wed, 02 Jun 2004 23:44:54 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i533iruE012630 for ; Wed, 2 Jun 2004 22:44:53 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i533hsu07215; Wed, 2 Jun 2004 22:43:54 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24444 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24444 My previous patch to dired-aux.el turned out to still require several changes, for instance to be able to handle the `-R' switch to `ls'. My patches now require some changes to dired.el as well. If they look OK, I will install all four patches. The variable `dired-subdir-switches' allows to get rid of two ugly alternative functions and bindings for `dired-maybe-insert-subdir' in locate.el and find-dired.el. It allows to specify different default switches for the main directory and for inserted subdirectories. It could potentially be used for user customization as well. But I am hesitating whether that is true to a sufficient degree to use defcustom instead of defvar. The patch below uses defvar, but, of course, it would be trivial to change that. `dired-switches-alist' already occurred in my previous dired-aux.el patch. I just had to move it to dired.el. The change to `dired-insert-old-subdirs' corrects a bug when reverting buffers containing a subdirectory inserted using the "-R" switch. The previous version first correctly inserted all subdirectories using `ls -R' and then went through a lot of work getting things (sometimes) wrong, by systematically erasing every single subdirectory and re-inserting it. Subdirectories several levels down could get inserted, deleted and re-inserted countless times. My patch corrects this. In as far as the final change is concerned, it would make `dired-build-subdir-alist' only print the "Buffer includes %d directories" message when called interactively. This is yet another auto-revert noise control issue. I believe the user is only interested in the info if the function was called interactively. If it was called for internal reasons by some other command, then I believe that the message is likely to confuse the user, regardless of the auto-revert issue. It certainly is confusing when `dired-build-subdir-alist' is indirectly called by auto-revert. ===File ~/dired-diff======================================== *** dired.el 30 May 2004 15:58:40 -0500 1.286 --- dired.el 02 Jun 2004 16:01:52 -0500 *************** *** 60,65 **** --- 60,69 ---- :type 'string :group 'dired) + (defvar dired-subdir-switches nil + "If non-nil, switches passed to `ls' for inserting subdirectories. + If nil, `dired-listing-switches' is used.") + ; Don't use absolute file names as /bin should be in any PATH and people ; may prefer /usr/local/gnu/bin or whatever. However, chown is ; usually not in PATH. *************** *** 274,286 **** (defvar dired-re-perms "[-bcdlps][-r][-w].[-r][-w].[-r][-w].") (defvar dired-re-dot "^.* \\.\\.?/?$") ! ;; The subdirectory names in this list are expanded. (defvar dired-subdir-alist nil "Association list of subdirectories and their buffer positions. Each subdirectory has an element: (DIRNAME . STARTMARKER). The order of elements is the reverse of the order in the buffer. In simple cases, this list contains one element.") (defvar dired-subdir-regexp "^. \\([^\n\r]+\\)\\(:\\)[\n\r]" "Regexp matching a maybe hidden subdirectory line in `ls -lR' output. Subexpression 1 is the subdirectory proper, no trailing colon. --- 278,294 ---- (defvar dired-re-perms "[-bcdlps][-r][-w].[-r][-w].[-r][-w].") (defvar dired-re-dot "^.* \\.\\.?/?$") ! ;; The subdirectory names in the next two lists are expanded. (defvar dired-subdir-alist nil "Association list of subdirectories and their buffer positions. Each subdirectory has an element: (DIRNAME . STARTMARKER). The order of elements is the reverse of the order in the buffer. In simple cases, this list contains one element.") + (defvar dired-switches-alist nil + "Keeps track of which switches to use for inserted subdirectories. + This is an alist of the form (SUBDIR . SWITCHES).") + (defvar dired-subdir-regexp "^. \\([^\n\r]+\\)\\(:\\)[\n\r]" "Regexp matching a maybe hidden subdirectory line in `ls -lR' output. Subexpression 1 is the subdirectory proper, no trailing colon. *************** *** 961,967 **** (condition-case () (progn (dired-uncache dir) ! (dired-insert-subdir dir)) (error nil)))))) (defun dired-uncache (dir) --- 969,982 ---- (condition-case () (progn (dired-uncache dir) ! (dired-insert-subdir dir) ! (let ((switches (cdr (assoc-string dir dired-switches-alist)))) ! (and switches ! (string-match "R" switches) ! (dolist (cur-ass (copy-sequence old-subdir-alist)) ! (when (string-match (concat "\\`" dir) (car cur-ass)) ! (setq old-subdir-alist ! (delete cur-ass old-subdir-alist))))))) (error nil)))))) (defun dired-uncache (dir) *************** *** 1406,1411 **** --- 1421,1427 ---- '(dired-font-lock-keywords t nil nil beginning-of-line)) (set (make-local-variable 'desktop-save-buffer) 'dired-desktop-buffer-misc-data) + (set (make-local-variable 'dired-switches-alist) nil) (dired-sort-other dired-actual-switches t) (run-mode-hooks 'dired-mode-hook) (when (featurep 'x-dnd) *************** *** 2073,2079 **** (goto-char (match-beginning 0)) (beginning-of-line) (point-marker)))) ! (if (> count 1) (message "Buffer includes %d directories" count)) ;; We don't need to sort it because it is in buffer order per ;; constructionem. Return new alist: --- 2089,2095 ---- (goto-char (match-beginning 0)) (beginning-of-line) (point-marker)))) ! (if (and (> count 1) (interactive-p)) (message "Buffer includes %d directories" count)) ;; We don't need to sort it because it is in buffer order per ;; constructionem. Return new alist: ============================================================