]> git.eshelyaron.com Git - emacs.git/commitdiff
(uniquify-rationalize-file-buffer-names): Reshuffled the code for
authorFrancesco Potortì <pot@gnu.org>
Wed, 1 Aug 2001 14:39:56 +0000 (14:39 +0000)
committerFrancesco Potortì <pot@gnu.org>
Wed, 1 Aug 2001 14:39:56 +0000 (14:39 +0000)
clarity and speed (maybe).

lisp/uniquify.el

index 4d393b963b101d1657dc6828afbe7dae1dcd13b0..4159151e4586ebfcc1d5023fa81e0221938d3653 100644 (file)
@@ -194,32 +194,29 @@ file name elements.  Arguments cause only a subset of buffers to be renamed."
        (newbuffile-nd (and newbuffile
                            (uniquify-file-name-nondirectory newbuffile))))
     (dolist (buffer (buffer-list))
-      (let* ((bfn (if (eq buffer newbuf)
-                     (and newbuffile
-                          (expand-file-name
-                           (if (file-directory-p newbuffile)
-                               (directory-file-name newbuffile)
-                             newbuffile)))
-                   (uniquify-buffer-file-name buffer)))
-            (rawname (and bfn (uniquify-file-name-nondirectory bfn)))
-            (bufname (buffer-name buffer))
-            (deserving (and rawname
-                            (not (string= bufname " **lose**"))
-                            (not (and uniquify-ignore-buffers-re
-                                      (string-match uniquify-ignore-buffers-re
-                                                    bufname)))
-                            (or (not newbuffile)
-                                (equal rawname newbuffile-nd))))
-            (min-proposed (if deserving
-                              (uniquify-get-proposed-name
-                               rawname bfn uniquify-min-dir-content))))
-       (if deserving
+      (let ((bufname (buffer-name buffer))
+           bfn rawname min-proposed)
+       (if (and (not (string= " **lose**" bufname))
+                (not (and uniquify-ignore-buffers-re
+                          (string-match uniquify-ignore-buffers-re
+                                        bufname)))
+                (setq bfn (if (eq buffer newbuf)
+                              (when newbuffile
+                                (expand-file-name
+                                 (if (file-directory-p newbuffile)
+                                     (directory-file-name newbuffile)
+                                   newbuffile)))
+                            (uniquify-buffer-file-name buffer)))
+                (setq rawname (uniquify-file-name-nondirectory bfn))
+                (or (not newbuffile)
+                    (equal rawname newbuffile-nd))
+                (setq min-proposed (uniquify-get-proposed-name
+                                    rawname bfn uniquify-min-dir-content)))
            (push (list rawname bfn buffer min-proposed) fix-list)
          (push (list bufname) uniquify-non-file-buffer-names))))
     ;; selects buffers whose names may need changing, and others that
     ;; may conflict.
-    (setq fix-list
-         (sort fix-list 'uniquify-item-lessp))
+    (setq fix-list (sort fix-list 'uniquify-item-lessp))
     ;; bringing conflicting names together
     (uniquify-rationalize-a-list fix-list uniquify-min-dir-content)))