diff options
| author | Francesco Potortì | 2001-08-01 14:39:56 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2001-08-01 14:39:56 +0000 |
| commit | 7ca0c5bc001d288709288b7ca01099bf9911852d (patch) | |
| tree | 03dfe6922f3c3563b96d3395c741bb16bf836f42 | |
| parent | 0ceb61f2164af04f7f97fc1c536af03fc4537037 (diff) | |
| download | emacs-7ca0c5bc001d288709288b7ca01099bf9911852d.tar.gz emacs-7ca0c5bc001d288709288b7ca01099bf9911852d.zip | |
(uniquify-rationalize-file-buffer-names): Reshuffled the code for
clarity and speed (maybe).
| -rw-r--r-- | lisp/uniquify.el | 41 |
1 files changed, 19 insertions, 22 deletions
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." | |||
| 194 | (newbuffile-nd (and newbuffile | 194 | (newbuffile-nd (and newbuffile |
| 195 | (uniquify-file-name-nondirectory newbuffile)))) | 195 | (uniquify-file-name-nondirectory newbuffile)))) |
| 196 | (dolist (buffer (buffer-list)) | 196 | (dolist (buffer (buffer-list)) |
| 197 | (let* ((bfn (if (eq buffer newbuf) | 197 | (let ((bufname (buffer-name buffer)) |
| 198 | (and newbuffile | 198 | bfn rawname min-proposed) |
| 199 | (expand-file-name | 199 | (if (and (not (string= " **lose**" bufname)) |
| 200 | (if (file-directory-p newbuffile) | 200 | (not (and uniquify-ignore-buffers-re |
| 201 | (directory-file-name newbuffile) | 201 | (string-match uniquify-ignore-buffers-re |
| 202 | newbuffile))) | 202 | bufname))) |
| 203 | (uniquify-buffer-file-name buffer))) | 203 | (setq bfn (if (eq buffer newbuf) |
| 204 | (rawname (and bfn (uniquify-file-name-nondirectory bfn))) | 204 | (when newbuffile |
| 205 | (bufname (buffer-name buffer)) | 205 | (expand-file-name |
| 206 | (deserving (and rawname | 206 | (if (file-directory-p newbuffile) |
| 207 | (not (string= bufname " **lose**")) | 207 | (directory-file-name newbuffile) |
| 208 | (not (and uniquify-ignore-buffers-re | 208 | newbuffile))) |
| 209 | (string-match uniquify-ignore-buffers-re | 209 | (uniquify-buffer-file-name buffer))) |
| 210 | bufname))) | 210 | (setq rawname (uniquify-file-name-nondirectory bfn)) |
| 211 | (or (not newbuffile) | 211 | (or (not newbuffile) |
| 212 | (equal rawname newbuffile-nd)))) | 212 | (equal rawname newbuffile-nd)) |
| 213 | (min-proposed (if deserving | 213 | (setq min-proposed (uniquify-get-proposed-name |
| 214 | (uniquify-get-proposed-name | 214 | rawname bfn uniquify-min-dir-content))) |
| 215 | rawname bfn uniquify-min-dir-content)))) | ||
| 216 | (if deserving | ||
| 217 | (push (list rawname bfn buffer min-proposed) fix-list) | 215 | (push (list rawname bfn buffer min-proposed) fix-list) |
| 218 | (push (list bufname) uniquify-non-file-buffer-names)))) | 216 | (push (list bufname) uniquify-non-file-buffer-names)))) |
| 219 | ;; selects buffers whose names may need changing, and others that | 217 | ;; selects buffers whose names may need changing, and others that |
| 220 | ;; may conflict. | 218 | ;; may conflict. |
| 221 | (setq fix-list | 219 | (setq fix-list (sort fix-list 'uniquify-item-lessp)) |
| 222 | (sort fix-list 'uniquify-item-lessp)) | ||
| 223 | ;; bringing conflicting names together | 220 | ;; bringing conflicting names together |
| 224 | (uniquify-rationalize-a-list fix-list uniquify-min-dir-content))) | 221 | (uniquify-rationalize-a-list fix-list uniquify-min-dir-content))) |
| 225 | 222 | ||