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: insert-directory Date: Sun, 23 May 2004 17:18:58 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200405232218.i4NMIw307789@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1085351809 25056 80.91.224.253 (23 May 2004 22:36:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 23 May 2004 22:36:49 +0000 (UTC) Cc: Peter Breton , pete_lee@swbell.net, Eli Zaretskii Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 24 00:36:41 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 1BS1aD-0004f6-00 for ; Mon, 24 May 2004 00:36:41 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BS1aD-0004Yb-00 for ; Mon, 24 May 2004 00:36:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BS1LN-0001nQ-Hc for emacs-devel@quimby.gnus.org; Sun, 23 May 2004 18:21:21 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BS1Ke-0001Jq-6K for emacs-devel@gnu.org; Sun, 23 May 2004 18:20:36 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BS1Jh-000072-UY for emacs-devel@gnu.org; Sun, 23 May 2004 18:20:11 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BS1Jb-0008N2-Rh; Sun, 23 May 2004 18:19:32 -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 i4NMJUuE013012; Sun, 23 May 2004 17:19:31 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i4NMIw307789; Sun, 23 May 2004 17:18:58 -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:23864 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23864 Using the 'i' command in the *Locate* buffer one gets after `m-x locate' currently does not work, because `insert-directory' mistakenly believes that the last two lines of the buffer are: //DIRED// 69 75 134 141 200 207 266 273 332 335 //DIRED-OPTIONS// --quoting-style=(null) They are not, because locate.el sets dired-actual-switches to "". `insert-directory' at present is not able to handle values of dired-actual-switches that do not contain "-l". The patch below tries to support modes like locate-mode that, for some reason or another need to set dired-actual-switches to a value not containing "-l". I have the impression that it actually makes `insert-directory' safer anyway, because, if for some reason these last two lines are not what they are supposed to be, they should probably not be erased. This is what the patch does: check whether the last two lines are what we think they are and not erase them otherwise. After applying my patch, `i' in the *Locate* buffer seems to work perfectly. I will wait for a couple of days before installing the patch, to see whether there are any objections and to check for possible problems in my own usage. ===File ~/files-diff======================================== *** files.el 22 May 2004 14:29:26 -0500 1.695 --- files.el 23 May 2004 16:40:13 -0500 *************** *** 4336,4356 **** (when (looking-at "//SUBDIRED//") (delete-region (point) (progn (forward-line 1) (point))) (forward-line -1)) ! (let ((end (line-end-position))) ! (forward-word 1) ! (forward-char 3) ! (while (< (point) end) ! (let ((start (+ beg (read (current-buffer)))) ! (end (+ beg (read (current-buffer))))) ! (if (= (char-after end) ?\n) ! (put-text-property start end 'dired-filename t) ! ;; It seems that we can't trust ls's output as to ! ;; byte positions of filenames. ! (put-text-property beg (point) 'dired-filename nil) ! (end-of-line)))) ! (goto-char end) ! (beginning-of-line) ! (delete-region (point) (progn (forward-line 2) (point))))) ;; Now decode what read if necessary. (let ((coding (or coding-system-for-read --- 4336,4358 ---- (when (looking-at "//SUBDIRED//") (delete-region (point) (progn (forward-line 1) (point))) (forward-line -1)) ! (if (looking-at "//DIRED//") ! (let ((end (line-end-position))) ! (forward-word 1) ! (forward-char 3) ! (while (< (point) end) ! (let ((start (+ beg (read (current-buffer)))) ! (end (+ beg (read (current-buffer))))) ! (if (= (char-after end) ?\n) ! (put-text-property start end 'dired-filename t) ! ;; It seems that we can't trust ls's output as to ! ;; byte positions of filenames. ! (put-text-property beg (point) 'dired-filename nil) ! (end-of-line)))) ! (goto-char end) ! (beginning-of-line) ! (delete-region (point) (progn (forward-line 2) (point)))) ! (forward-line 2))) ;; Now decode what read if necessary. (let ((coding (or coding-system-for-read ============================================================