comparison lisp/uniquify.el @ 38641:2e6dd0de246f

(uniquify-rationalize-file-buffer-names): Reshuffled the code for clarity and speed (maybe).
author Francesco Potortì <pot@gnu.org>
date Wed, 01 Aug 2001 14:39:56 +0000
parents d7598641f4bf
children 683a60ba2533
comparison
equal deleted inserted replaced
38640:3ad03111e566 38641:2e6dd0de246f
192 (let (fix-list 192 (let (fix-list
193 uniquify-non-file-buffer-names 193 uniquify-non-file-buffer-names
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
226 ;; uniquify's version of buffer-file-name; result never contains trailing slash 223 ;; uniquify's version of buffer-file-name; result never contains trailing slash
227 (defun uniquify-buffer-file-name (buffer) 224 (defun uniquify-buffer-file-name (buffer)