unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* insert-directory
@ 2004-05-23 22:18 Luc Teirlinck
  2004-05-24  0:00 ` insert-directory Luc Teirlinck
  0 siblings, 1 reply; 17+ messages in thread
From: Luc Teirlinck @ 2004-05-23 22:18 UTC (permalink / raw)
  Cc: Peter Breton, pete_lee, Eli Zaretskii

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
============================================================

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2004-06-07 11:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-23 22:18 insert-directory Luc Teirlinck
2004-05-24  0:00 ` insert-directory Luc Teirlinck
2004-05-24  3:29   ` insert-directory Luc Teirlinck
2004-05-24  3:55     ` insert-directory Luc Teirlinck
2004-05-24  3:55     ` insert-directory Luc Teirlinck
2004-05-24  4:16     ` insert-directory Luc Teirlinck
2004-05-25  0:11       ` insert-directory Luc Teirlinck
2004-05-25  2:16         ` insert-directory Luc Teirlinck
2004-05-26 20:26           ` insert-directory Luc Teirlinck
2004-05-26 20:35             ` insert-directory David Kastrup
2004-05-26 20:42               ` insert-directory Luc Teirlinck
2004-05-27  7:01             ` insert-directory Kai Grossjohann
2004-05-27 15:51               ` insert-directory Luc Teirlinck
2004-06-07  9:59               ` locate and find-dired (was: insert-directory) Juri Linkov
2004-06-07 11:17                 ` locate and find-dired Kai Grossjohann
2004-06-07 11:59                   ` Juri Linkov
2004-05-25 16:06   ` insert-directory Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).