emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/uniquify.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/uniquify.el
Date: Sat, 10 May 2003 14:16:19 -0400

Index: emacs/lisp/uniquify.el
diff -c emacs/lisp/uniquify.el:1.49 emacs/lisp/uniquify.el:1.50
*** emacs/lisp/uniquify.el:1.49 Fri May  9 09:19:15 2003
--- emacs/lisp/uniquify.el      Sat May 10 14:16:19 2003
***************
*** 1,6 ****
  ;;; uniquify.el --- unique buffer names dependent on file name
  
! ;; Copyright (c) 1989, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
  
  ;; Author: Dick King <address@hidden>
  ;; Maintainer: FSF
--- 1,6 ----
  ;;; uniquify.el --- unique buffer names dependent on file name
  
! ;; Copyright (c) 1989,95,96,97,2001,2003  Free Software Foundation, Inc.
  
  ;; Author: Dick King <address@hidden>
  ;; Maintainer: FSF
***************
*** 186,192 ****
    "Make file buffer names unique by adding segments from file name.
  If `uniquify-min-dir-content' > 0, always pulls that many
  file name elements.
! Arguments NEWBUFFILE and NEWBUF cause only a subset of buffers to be renamed."
    (interactive)
    (if (null dirname)
        (with-current-buffer newbuf (setq uniquify-managed nil))
--- 186,193 ----
    "Make file buffer names unique by adding segments from file name.
  If `uniquify-min-dir-content' > 0, always pulls that many
  file name elements.
! Arguments BASE, DIRNAME, and NEWBUF specify the new buffer that causes
! this rationaliztion."
    (interactive)
    (if (null dirname)
        (with-current-buffer newbuf (setq uniquify-managed nil))
***************
*** 203,208 ****
--- 204,223 ----
                   ;; Don't re-add stuff we already have.  Actually this
                   ;; whole `and' test should only match at most once.
                   (not (memq (car items) fix-list)))
+         (unless (cdr items)
+           ;; If there was no conflict, the buffer-name is equal to the
+           ;; base-name and we may have missed a rename-buffer because
+           ;; of code like in set-visited-file-name:
+           ;; (or (string= new-name (buffer-name)) (rename-buffer new-name t))
+           ;; So we need to refresh the dirname of the uniquify-item.
+           (setf (uniquify-item-dirname (car items))
+                 (uniquify-buffer-file-name
+                  (uniquify-item-buffer (car items))))
+           ;; This shouldn't happen, but maybe there' no dirname any more.
+           (unless (uniquify-item-dirname (car items))
+             (setq items nil)
+             (with-current-buffer (uniquify-item-buffer (car items))
+               (setq uniquify-managed nil))))
          (setq fix-list (append fix-list items))))
        ;; selects buffers whose names may need changing, and others that
        ;; may conflict, then bring conflicting names together
***************
*** 219,225 ****
               (if (memq major-mode uniquify-list-buffers-directory-modes)
                   list-buffers-directory))))
        (when filename
!       (file-name-directory (expand-file-name (directory-file-name 
filename)))))))
  
  (defun uniquify-rerationalize-w/o-cb (fix-list)
    "Re-rationalize the buffers in FIX-LIST, but ignoring current-buffer."
--- 234,243 ----
               (if (memq major-mode uniquify-list-buffers-directory-modes)
                   list-buffers-directory))))
        (when filename
!       (directory-file-name
!        (file-name-directory
!         (expand-file-name
!          (directory-file-name filename))))))))
  
  (defun uniquify-rerationalize-w/o-cb (fix-list)
    "Re-rationalize the buffers in FIX-LIST, but ignoring current-buffer."
***************
*** 236,242 ****
    ;; if there is a conflict.
    (dolist (item fix-list)
      (with-current-buffer (uniquify-item-buffer item)
!       ;; Reset the proposed names.
        (setf (uniquify-item-proposed item)
            (uniquify-get-proposed-name (uniquify-item-base item)
                                        (uniquify-item-dirname item)))
--- 254,260 ----
    ;; if there is a conflict.
    (dolist (item fix-list)
      (with-current-buffer (uniquify-item-buffer item)
!       ;; Refresh the dirnames and proposed names.
        (setf (uniquify-item-proposed item)
            (uniquify-get-proposed-name (uniquify-item-base item)
                                        (uniquify-item-dirname item)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]