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: Re: autorevert.el Date: Thu, 25 Mar 2004 00:20:20 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403250620.i2P6KKE12816@raven.dms.auburn.edu> References: <200403022319.i22NJbG01259@raven.dms.auburn.edu> <200403040508.i2458W811551@raven.dms.auburn.edu> <200403050400.i2540VQ21715@raven.dms.auburn.edu> <200403130310.i2D3A8w28676@raven.dms.auburn.edu> <200403150008.i2F083x04382@raven.dms.auburn.edu> <200403160456.i2G4uVL14097@raven.dms.auburn.edu> <2427-Tue16Mar2004214034+0200-eliz@elta.co.il> <8011-Fri19Mar2004164602+0200-eliz@elta.co.il> <200403210326.i2L3QpF29260@raven.dms.auburn.edu> <200403220244.i2M2ikR07506@raven.dms.auburn.edu> <200403221939.i2MJd8116508@raven.dms.auburn.edu> <8296-Tue23Mar2004214028+0200-eliz@elta.co.il> <2004032404 NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1080196449 18630 80.91.224.253 (25 Mar 2004 06:34:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2004 06:34:09 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Mar 25 07:33:55 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 1B6OR8-0004pe-00 for ; Thu, 25 Mar 2004 07:33:54 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6OR8-0007w3-00 for ; Thu, 25 Mar 2004 07:33:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6OMM-0002p2-If for emacs-devel@quimby.gnus.org; Thu, 25 Mar 2004 01:28:58 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6OLy-0002oG-4H for emacs-devel@gnu.org; Thu, 25 Mar 2004 01:28:34 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6OI3-0001zp-4o for emacs-devel@gnu.org; Thu, 25 Mar 2004 01:25:02 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6OFu-0001m8-UE; Thu, 25 Mar 2004 01:22:19 -0500 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 i2P6MDKt027836; Thu, 25 Mar 2004 00:22:14 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i2P6KKE12816; Thu, 25 Mar 2004 00:20:20 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: eliz@gnu.org In-reply-to: (message from Eli Zaretskii on 24 Mar 2004 08:58:56 +0200) 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:20870 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20870 Eli Zaretskii wrote: > When renaming a file to a name with the same length (common when one > made a typo, when updating a version number, changing a suffix and > so on), dired would not get notified. So who is talking about almost-zero probability cases now? ;-) It is definitely not almost-zero probability in my usage. But more importantly (from `(libc.info.gz)Attribute Meanings'): `off_t st_size' This specifies the size of a regular file in bytes. For files that are really devices this field isn't usually meaningful. For symbolic links this specifies the length of the file name the link refers to. Note that apparently, stat is only supposed to return a well defined value for st_size for regular files and for symbolic links, not for directories. You told me it returns a meaningful value on ms-dos. Why would that lead us to assume that it returns a meaningful value on all operating systems? It definitely does not return something terribly useful on GNU/Linux. Maybe on other operating systems it returns garbage that changes on every call regardless of whether there was any change in the directory. (In general, I'm opposed to planting into Emacs user-level features implicit assumptions about Posix-specific behavior, in this case, that a directory is just another file. Yes, I know: Emacs is being developed primarily for Posix-compliant platforms, bla, bla...) And I'm opposed to planting into Emacs user-level features implicit assumptions about MS-DOS-port-specific behavior, in this case, that st_size is useful to reliably determine the directory size. If you want to do this for ms-dos, then that is your prerogative as a maintainer (the patch below would do that), but I do not believe that one can just blindly do this for any operating system without knowing what stat is going to do on that system. I don't see how adding a call to file-attributes is a big deal that needs a call for volunteers, It is not. See the patch below. I already explained in a previous message what I really meant. I do not have access to a machine with an MS operating system and Emacs CVS installed. Hence I can not test the patch below. It compiles without warnings. To test the patch below, set global-auto-revert-non-file-buffers to t. I just noticed that there are bad bugs in the vc-part of the original autorevert patch (not my patch, the prior one). These are not yet taken care of. If you do not want to be confronted with these bugs while testing the patch, just do not visit any CVS buffer with uncommitted changes while testing. ===File ~/dired-diff======================================== diff -c /home/teirllm/dired.old.el /home/teirllm/emacscvsdir/emacs/lisp/dired.el *** /home/teirllm/dired.old.el Wed Mar 24 22:07:09 2004 --- /home/teirllm/emacscvsdir/emacs/lisp/dired.el Wed Mar 24 23:46:37 2004 *************** *** 525,530 **** --- 525,538 ---- (setq dir-or-list dirname)) (dired-internal-noselect dir-or-list switches))) + (defvar dired-directory-size nil + "Internal variable used by dired on certain operating systems. + On ms-dos, the value is the sum of all file lenghts in the directory. + On other operating systems, the value may have a different meaning + or be meaningless.") + + (put 'dired-directory-size 'permanent-local t) + ;; The following is an internal dired function. It returns non-nil if ;; the directory visited by the current dired buffer has changed on ;; disk. DIRNAME should be the directory name of that directory. *************** *** 534,540 **** (or (eq modtime 0) (not (eq (car attributes) t)) (and (= (car (nth 5 attributes)) (car modtime)) ! (= (nth 1 (nth 5 attributes)) (cdr modtime))))))) (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current dired buffer needs updating. --- 542,552 ---- (or (eq modtime 0) (not (eq (car attributes) t)) (and (= (car (nth 5 attributes)) (car modtime)) ! (= (nth 1 (nth 5 attributes)) (cdr modtime)) ! (if (eq system-type 'ms-dos) ! ;; This does not work perfectly. ! (= dired-directory-size (nth 7 attributes)) ! t)))))) (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current dired buffer needs updating. *************** *** 677,682 **** --- 689,696 ---- ;; dired-build-subdir-alist will call dired-clear-alist first (set (make-local-variable 'dired-subdir-alist) nil) (dired-build-subdir-alist) + (set (make-local-variable 'dired-directory-size) + (nth 7 (file-attributes dirname))) (let ((attributes (file-attributes dirname))) (if (eq (car attributes) t) (set-visited-file-modtime (nth 5 attributes)))) Diff finished. Wed Mar 24 23:49:01 2004 ============================================================