Indenting.

Pascal J. Bourguignon [2015-04-03 06:17]
Indenting.
Filename
filenames.lisp
diff --git a/filenames.lisp b/filenames.lisp
index 30e63a0..f090662 100644
--- a/filenames.lisp
+++ b/filenames.lisp
@@ -118,17 +118,17 @@
                               (make-list totlen))
                              (t (error "Invalid sequence type: ~S" type)))))
              (loop
-                :for item :in list
-                :and start = 0 :then (+ start (length item))
-                :do (replace result item :start1 start)
-                :finally (return result)))))
+               :for item :in list
+               :and start = 0 :then (+ start (length item))
+               :do (replace result item :start1 start)
+               :finally (return result)))))
     (re-match
      (concat 'string
              (cons "^"
                    (nconc
                     (loop
-                       :for chunks :on (split-sequence #\* wild)
-                       :collect (car chunks) :when (cdr chunks) :collect ".*")
+                      :for chunks :on (split-sequence #\* wild)
+                      :collect (car chunks) :when (cdr chunks) :collect ".*")
                     (list "$"))))
      item)))

@@ -184,37 +184,37 @@



-
+#+emacs (put 'define-pathname-attribute 'lisp-indent-function 1)
 (defmacro define-pathname-attribute (name &optional docstring)
   `(defun ,(intern (format nil "PATHNAME-~A" name)) (pathname &key (case :local))
      ,@(when docstring (list docstring))
      (,(intern (format nil "%PATHNAME-~A" name)) (pathname pathname))))

 (define-pathname-attribute host
-    "Pathname Host Component: The name of the file system on which the
+  "Pathname Host Component: The name of the file system on which the
 file resides, or the name of a logical host.")

 (define-pathname-attribute device
-    "Pathname Device Component: Corresponds to the ``device'' or ``file
+  "Pathname Device Component: Corresponds to the ``device'' or ``file
 structure'' concept in many host file systems: the name of a logical
 or physical device containing files.")

 (define-pathname-attribute directory
-    "Pathname Directory Component: Corresponds to the ``directory'' concept
+  "Pathname Directory Component: Corresponds to the ``directory'' concept
 in many host file systems: the name of a group of related files. ")

 (define-pathname-attribute name
-    "Pathname Name Component: The ``name'' part of a group of files that
+  "Pathname Name Component: The ``name'' part of a group of files that
 can be thought of as conceptually related.")

 (define-pathname-attribute type
-    "Pathname Type Component: Corresponds to the ``filetype'' or
+  "Pathname Type Component: Corresponds to the ``filetype'' or
 ``extension'' concept in many host file systems. This says what kind
 of file this is. This component is always a string, nil, :wild, or
 :unspecific.")

 (define-pathname-attribute version
-    "Pathname Version Component: Corresponds to the ``version number''
+  "Pathname Version Component: Corresponds to the ``version number''
 concept in many host file systems.  The version is either a positive
 integer or a symbol from the following list: nil, :wild, :unspecific,
 or :newest (refers to the largest version number that already exists
@@ -235,12 +235,12 @@ file). Implementations can define other special version symbols.")
                ~&~}"
           (class-name (class-of path))
           (mapcar (lambda (f) (funcall f path :case :common))
-                             (list (function pathname-host)
-                                   (function pathname-device)
-                                   (function pathname-directory)
-                                   (function pathname-name)
-                                   (function pathname-type)
-                                   (function pathname-version)))))
+                  (list (function pathname-host)
+                        (function pathname-device)
+                        (function pathname-directory)
+                        (function pathname-name)
+                        (function pathname-type)
+                        (function pathname-version)))))



@@ -294,34 +294,34 @@ file). Implementations can define other special version symbols.")

 (defun namestring (pathname)
   (let ((pathname (pathname pathname)))
-   (format nil "~A:~:[~;;~]~{~A;~}~:[~;~:*~A~]~
+    (format nil "~A:~:[~;;~]~{~A;~}~:[~;~:*~A~]~
                     ~:[~;.~:*~A~:[~;.~:*~A~]~]"
-           (pathname-host pathname)
-           (eq :relative (first (pathname-directory pathname)))
-           (mapcar (function present-item) (rest (pathname-directory pathname)))
-           (present-item (pathname-name pathname))
-           (present-item (pathname-type pathname))
-           (present-item (pathname-version pathname)))))
+            (pathname-host pathname)
+            (eq :relative (first (pathname-directory pathname)))
+            (mapcar (function present-item) (rest (pathname-directory pathname)))
+            (present-item (pathname-name pathname))
+            (present-item (pathname-type pathname))
+            (present-item (pathname-version pathname)))))


 (defun file-namestring (pathname)
   (let ((pathname (pathname pathname)))
-   (format nil "~:[~;~:*~A~]~:[~;.~:*~A~:[~;.~:*~A~]~]"
-           (present-item (pathname-name pathname))
-           (present-item (pathname-type pathname))
-           (present-item (pathname-version pathname)))))
+    (format nil "~:[~;~:*~A~]~:[~;.~:*~A~:[~;.~:*~A~]~]"
+            (present-item (pathname-name pathname))
+            (present-item (pathname-type pathname))
+            (present-item (pathname-version pathname)))))


 (defun directory-namestring (pathname)
   (let ((pathname (pathname pathname)))
-   (format nil "~:[~;;~]~{~A;~}"
-           (eq :relative (first (pathname-directory pathname)))
-           (mapcar (function present-item) (rest (pathname-directory pathname))))))
+    (format nil "~:[~;;~]~{~A;~}"
+            (eq :relative (first (pathname-directory pathname)))
+            (mapcar (function present-item) (rest (pathname-directory pathname))))))


 (defun host-namestring (pathname)
   (let ((pathname (pathname pathname)))
-   (format nil "~@[~A~]" (pathname-host pathname))))
+    (format nil "~@[~A~]" (pathname-host pathname))))


 (defun enough-namestring (pathname &optional defaults)
@@ -340,7 +340,7 @@ file). Implementations can define other special version symbols.")


 (defun make-pathname (&key host device directory name type version (case :local)
-                      (defaults nil defaults-p))
+                        (defaults nil defaults-p))
   (cond ((stringp directory)  (setf directory (list :absolute directory)))
         ((eq :wild directory) (setf directory (list :absolute :wild-inferiors))))
   (let ((host (check-host (or host (if defaults-p
@@ -416,7 +416,7 @@ RETURN: The logical pathname translations for the HOST.


 (defun parse-namestring (thing &optional host
-                         (default-pathname *default-pathname-defaults*)
+                                 (default-pathname *default-pathname-defaults*)
                          &key (start 0) (end nil) (junk-allowed nil))
   (let ((default-host (and host (check-host host))))
     (etypecase thing
@@ -496,8 +496,8 @@ RETURN: The logical pathname translations for the HOST.
   (or (null item wild)
       (if (eq (first wild) :wild-inferiors)
           (loop
-             :for rest :on item
-             :thereis (match-directory-items-p rest (rest wild)))
+            :for rest :on item
+            :thereis (match-directory-items-p rest (rest wild)))
           (and (match-item-p (first item) (first wild) t)
                (match-directory-items-p (rest item) (rest wild))))))

@@ -550,14 +550,14 @@ RETURN: The logical pathname translations for the HOST.
         (from-wildcard (pathname-components (pathname from-wildcard)))
         (to-wildcard   (pathname-components (pathname to-wildcard))))
     (loop
-       :for dirp    :in '(nil nil t nil nil nil)
-       :for s-compo :in source
-       :for f-compo :in from-wildcard
-       :for t-compo :in to-wildcard
-       :collect (if dirp
-
-
-                    ))))
+      :for dirp    :in '(nil nil t nil nil nil)
+      :for s-compo :in source
+      :for f-compo :in from-wildcard
+      :for t-compo :in to-wildcard
+      :collect (if dirp
+
+
+                   ))))



@@ -593,21 +593,21 @@ RETURN: The logical pathname translations for the HOST.

 (defun delete-back (dir)
   (loop
-     :with changed = t
-     :while changed
-     :do (loop
-            :for cur = dir :then (cdr cur)
-            :initially (setf changed nil)
-            :do (when (and (or (stringp (cadr cur)) (eq :wild (cadr cur)))
-                           (eq :back (caddr cur)))
-                  (setf (cdr cur) (cdddr cur)
-                        changed t)))
-     :finally (return dir)))
+    :with changed = t
+    :while changed
+    :do (loop
+          :for cur = dir :then (cdr cur)
+          :initially (setf changed nil)
+          :do (when (and (or (stringp (cadr cur)) (eq :wild (cadr cur)))
+                         (eq :back (caddr cur)))
+                (setf (cdr cur) (cdddr cur)
+                      changed t)))
+    :finally (return dir)))


 (defun merge-pathnames (pathname
                         &optional (default-pathname *default-pathname-defaults*)
-                        (default-version :newest))
+                          (default-version :newest))
   (let ((pathname (pathname pathname)))
     (make-pathname
      :host    (or (pathname-host pathname) (pathname-host default-pathname))
ViewGit