From: Francesco Potortì Date: Wed, 1 Aug 2001 14:39:56 +0000 (+0000) Subject: (uniquify-rationalize-file-buffer-names): Reshuffled the code for X-Git-Tag: emacs-pretest-21.0.105~324 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7ca0c5bc001d288709288b7ca01099bf9911852d;p=emacs.git (uniquify-rationalize-file-buffer-names): Reshuffled the code for clarity and speed (maybe). --- diff --git a/lisp/uniquify.el b/lisp/uniquify.el index 4d393b963b1..4159151e458 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -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)))