all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* find-dired.el
@ 2004-06-01  2:43 Luc Teirlinck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Teirlinck @ 2004-06-01  2:43 UTC (permalink / raw)


Below is the latest version of my patch to find-dired.el.  It needs
the patch to dired-aux.el, that I will send somewhat later, to
function properly.

One remaining problem with *Locate* and *Find* buffers is that if one
does `l' _on the very first line_, the directory will update in a
way that makes sense for Dired, but not for *Locate* or *Find*
buffers.  The effect can easily be undone using dired-undo, usually
bound to C-_ and C-x u.  Everything continues to work after that.
Doing `l' on the main directory is not a very usual thing to do.
After my patch to dired-aux, `l' and `C-u l' seem to work perfectly
on subdirectories.  The "l in the first line problem" already occurred
prior to my patch for *Locate* buffers.  It did not occur for *Find*
buffers, but the only reason for that is that neither `i' nor `l'
worked at all for *Find* buffers due to a bug I fixed.
 
The only solution around the "l on the first line problem" seems to be
to define separate `locate-do-redisplay' and `find-dired-do-redisplay'
functions, whose only difference with `dired-do-redisplay' would be
that they throw an error on the first line.  I do not believe that is
worth the trouble, since an inadvertent `l' on the first line, can
easily be undone with dired-undo.

===File ~/find-dired-diff===================================
diff -c /home/teirllm/stored/find-dired.old.el /home/teirllm/emacscvsdir/emacs/lisp/find-dired.el
*** /home/teirllm/stored/find-dired.old.el	Sat May 29 15:55:43 2004
--- /home/teirllm/emacscvsdir/emacs/lisp/find-dired.el	Fri May 28 11:38:32 2004
***************
*** 54,59 ****
--- 54,67 ----
  	       (string :tag "Ls Switches"))
    :group 'find-dired)
  
+ (defcustom find-ls-subdir-switches "-al"
+   "`ls' switches for inserting subdirectories in *Find* buffers.
+ This should contain the \"-l\" switch.
+ Use the \"-F\" switch if and only if you also use it for `find-ls-option'."
+   :type 'string
+   :group 'find-dired
+   :version "21.4")
+ 
  ;;;###autoload
  (defcustom find-grep-options
    (if (or (eq system-type 'berkeley-unix)
***************
*** 89,96 ****
    (let ((dired-buffers dired-buffers))
      ;; Expand DIR ("" means default-directory), and make sure it has a
      ;; trailing slash.
!     (setq dir (abbreviate-file-name
! 	       (file-name-as-directory (expand-file-name dir))))
      ;; Check that it's really a directory.
      (or (file-directory-p dir)
  	(error "find-dired needs a directory: %s" dir))
--- 97,103 ----
    (let ((dired-buffers dired-buffers))
      ;; Expand DIR ("" means default-directory), and make sure it has a
      ;; trailing slash.
!     (setq dir (file-name-as-directory (expand-file-name dir)))
      ;; Check that it's really a directory.
      (or (file-directory-p dir)
  	(error "find-dired needs a directory: %s" dir))
***************
*** 115,121 ****
      (setq buffer-read-only nil)
      (erase-buffer)
      (setq default-directory dir
! 	  find-args args		; save for next interactive call
  	  args (concat find-dired-find-program " . "
  		       (if (string= args "")
  			   ""
--- 122,128 ----
      (setq buffer-read-only nil)
      (erase-buffer)
      (setq default-directory dir
! 	  find-args args	      ; save for next interactive call
  	  args (concat find-dired-find-program " . "
  		       (if (string= args "")
  			   ""
***************
*** 128,133 ****
--- 135,141 ----
      (let ((map (make-sparse-keymap)))
        (set-keymap-parent map (current-local-map))
        (define-key map "\C-c\C-k" 'kill-find)
+       (define-key map "i" 'find-dired-maybe-insert-subdir)
        (use-local-map map))
      (make-local-variable 'dired-sort-inhibit)
      (setq dired-sort-inhibit t)
***************
*** 267,272 ****
--- 275,302 ----
  	      (delete-process proc)
  	      (force-mode-line-update)))
  	  (message "find-dired %s finished." (current-buffer))))))
+ 
+ (defun find-dired-maybe-insert-subdir (dirname &optional
+ 					       switches no-error-if-not-dir-p)
+   "Like `dired-maybe-insert-subdir', but works with `find-dired'.
+ The difference is that this command uses `find-ls-subdir-switches'
+ as default switches passed to ls. As with `dired-maybe-insert-subdir',
+ you can specify other switches by providing a numeric prefix argument."
+   ;; Code adapted from dired-maybe-insert-subdir
+   (interactive
+    (list (dired-get-filename)
+ 	 (if current-prefix-arg
+ 	     (read-string "Switches for listing: "
+ 			  find-ls-subdir-switches))))
+   (let ((opoint (point)))
+     (setq dirname (file-name-as-directory dirname))
+     (or (and (not switches)
+ 	     (dired-goto-subdir dirname))
+ 	(dired-insert-subdir dirname
+ 			     (or switches find-ls-subdir-switches)
+ 			     no-error-if-not-dir-p))
+     (push-mark opoint)))
+ 
  \f
  (provide 'find-dired)
  

Diff finished.  Mon May 31 20:44:52 2004
============================================================

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

* find-dired.el
@ 2004-06-03  3:11 Luc Teirlinck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Teirlinck @ 2004-06-03  3:11 UTC (permalink / raw)


Below is my latest and probably final patch to find-dired.el.  It is a
simplified and corrected version of my previous patch.  I will install
it when I install the other patches, since it requires the updated
patches for dired.el and dired-aux.el, which I will submit shortly.

===File ~/find-dired-diff===================================
diff -c /home/teirllm/stored/find-dired.old.el /home/teirllm/emacscvsdir/emacs/lisp/find-dired.el
*** /home/teirllm/stored/find-dired.old.el	Sat May 29 15:55:43 2004
--- /home/teirllm/emacscvsdir/emacs/lisp/find-dired.el	Wed Jun  2 21:58:45 2004
***************
*** 55,60 ****
--- 55,70 ----
    :group 'find-dired)
  
  ;;;###autoload
+ (defcustom find-ls-subdir-switches "-al"
+   "`ls' switches for inserting subdirectories in *Find* buffers.
+ This should contain the \"-l\" switch.
+ Use the \"-F\" or \"-b\" switches if and only if you also use
+ them for `find-ls-option'."
+   :type 'string
+   :group 'find-dired
+   :version "21.4")
+ 
+ ;;;###autoload
  (defcustom find-grep-options
    (if (or (eq system-type 'berkeley-unix)
  	  (string-match "solaris2" system-configuration)
***************
*** 89,96 ****
    (let ((dired-buffers dired-buffers))
      ;; Expand DIR ("" means default-directory), and make sure it has a
      ;; trailing slash.
!     (setq dir (abbreviate-file-name
! 	       (file-name-as-directory (expand-file-name dir))))
      ;; Check that it's really a directory.
      (or (file-directory-p dir)
  	(error "find-dired needs a directory: %s" dir))
--- 99,105 ----
    (let ((dired-buffers dired-buffers))
      ;; Expand DIR ("" means default-directory), and make sure it has a
      ;; trailing slash.
!     (setq dir (file-name-as-directory (expand-file-name dir)))
      ;; Check that it's really a directory.
      (or (file-directory-p dir)
  	(error "find-dired needs a directory: %s" dir))
***************
*** 115,121 ****
      (setq buffer-read-only nil)
      (erase-buffer)
      (setq default-directory dir
! 	  find-args args		; save for next interactive call
  	  args (concat find-dired-find-program " . "
  		       (if (string= args "")
  			   ""
--- 124,130 ----
      (setq buffer-read-only nil)
      (erase-buffer)
      (setq default-directory dir
! 	  find-args args	      ; save for next interactive call
  	  args (concat find-dired-find-program " . "
  		       (if (string= args "")
  			   ""
***************
*** 143,148 ****
--- 152,158 ----
        ;; this does no harm)
        (set (make-local-variable 'dired-subdir-alist)
  	   (list (cons default-directory (point-min-marker)))))
+     (set (make-local-variable 'dired-subdir-switches) find-ls-subdir-switches)
      (setq buffer-read-only nil)
      ;; Subdir headlerline must come first because the first marker in
      ;; subdir-alist points there.
***************
*** 267,272 ****
--- 277,283 ----
  	      (delete-process proc)
  	      (force-mode-line-update)))
  	  (message "find-dired %s finished." (current-buffer))))))
+ 
  \f
  (provide 'find-dired)
  

Diff finished.  Wed Jun  2 21:59:26 2004
============================================================

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03  3:11 find-dired.el Luc Teirlinck
  -- strict thread matches above, loose matches on Subject: below --
2004-06-01  2:43 find-dired.el Luc Teirlinck

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.