[Mit-cadr-cvs] r365 - trunk/lisp/zwei

ggilley at common-lisp.net ggilley at common-lisp.net
Wed Nov 28 02:43:29 UTC 2012


Author: ggilley
Date: Tue Nov 27 18:43:29 2012
New Revision: 365

Log:
E on a directory opens it

Modified:
   trunk/lisp/zwei/dired.lisp

Modified: trunk/lisp/zwei/dired.lisp
==============================================================================
--- trunk/lisp/zwei/dired.lisp	Tue Nov 27 18:41:28 2012	(r364)
+++ trunk/lisp/zwei/dired.lisp	Tue Nov 27 18:43:29 2012	(r365)
@@ -269,19 +269,28 @@
      (VIEW-FILE PATHNAME))
    DIS-NONE)
 
-(DEFCOM COM-DIRED-EDIT-FILE "Edit the current file" ()
+(DEFCOM COM-DIRED-EDIT-FILE "Edit the current file; or DIRED it if it's a directory" ()
   (OR (TYPEP *INTERVAL* 'BUFFER) (BARF))
+  (WHEN (GET (LOCF (LINE-PLIST (BP-LINE (POINT)))) ':DELETED)
+    (BARF))
   (LET* ((LINE (BP-LINE (POINT)))
+	 (DIR-P (GET (LOCF (LINE-PLIST LINE)) ':DIRECTORY))
 	 (PATHNAME (DIRED-LINE-PATHNAME LINE)))
-    (AND (GET (LOCF (LINE-PLIST LINE)) ':NEWEST)
-	 (SETQ PATHNAME (FUNCALL PATHNAME ':NEW-VERSION ':NEWEST)))
-    (FIND-FILE PATHNAME))
-  (LET ((BLURB (KEY-FOR-COMMAND 'COM-SELECT-PREVIOUS-BUFFER)))
-    (AND (NULL BLURB) (SETQ BLURB (KEY-FOR-COMMAND 'COM-SELECT-BUFFER))
-	 (SETQ BLURB (STRING-APPEND BLURB " Return")))
-    (AND BLURB
-	 (TYPEIN-LINE "Type ~A to return to DIRED" BLURB)))
-  DIS-TEXT)
+    (AND (NOT DIR-P) ; Reversion doesn't make sense for recursive Dired
+	 (GET (LOCF (LINE-PLIST LINE)) ':NEWEST)
+	 (IF (NULL (SETQ PATHNAME (FUNCALL PATHNAME ':NEW-VERSION ':NEWEST)))
+	     (BARF "Re-enter edit command")))
+    (IF DIR-P
+	(DIRECTORY-EDIT (FUNCALL (FUNCALL PATHNAME ':PATHNAME-AS-DIRECTORY)
+				 ':NEW-PATHNAME ':NAME ':WILD ':TYPE ':WILD ':VERSION ':WILD))
+      
+          (FIND-FILE PATHNAME)
+      (LET ((BLURB (KEY-FOR-COMMAND 'COM-SELECT-PREVIOUS-BUFFER)))
+	(AND (NULL BLURB) (SETQ BLURB (KEY-FOR-COMMAND 'COM-SELECT-BUFFER))
+	     (SETQ BLURB (STRING-APPEND BLURB " Return")))
+	(AND BLURB
+	     (FORMAT QUERY-IO "~&Type ~A to return to DIRED" BLURB))
+	DIS-TEXT))))
 
 ;;; This goes through a sorted list of files and puts :NEWEST properties on files
 (DEFUN DIRED-COMPUTE-GREATER-THANS (DIRECTORY)




More information about the mit-cadr-cvs mailing list