changeset 91841:93224b3daf2a

(uniquify-managed): Don't defvar. (desktop-buffer-info): Use `uniquify-buffer-base-name', not `uniquify-managed'. Return also the buffer's base name. (desktop-save): When saving the buffer info, filter out the base name, and save it as buffer name if the buffer is managed by uniquify. (uniquify-item-base): Don't declare; not called anymore.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 14 Feb 2008 14:34:59 +0000
parents 53e2227d1fae
children 2ac341f3fba9
files lisp/desktop.el
diffstat 1 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/desktop.el	Thu Feb 14 14:32:44 2008 +0000
+++ b/lisp/desktop.el	Thu Feb 14 14:34:59 2008 +0000
@@ -135,8 +135,6 @@
 
 ;;; Code:
 
-(defvar uniquify-managed)
-
 (defvar desktop-file-version "206"
   "Version number of desktop file format.
 Written into the desktop file and used at desktop read to provide
@@ -651,16 +649,14 @@
       value)))
 
 ;; ----------------------------------------------------------------------------
-(declare-function uniquify-item-base "uniquify" (cl-x) t) ; defstruct
-
 (defun desktop-buffer-info (buffer)
   (set-buffer buffer)
   (list
+   ;; base name of the buffer; replaces the buffer name if managed by uniquify
+   (and (fboundp 'uniquify-buffer-base-name) (uniquify-buffer-base-name))
    ;; basic information
    (desktop-file-name (buffer-file-name) desktop-dirname)
-   (if (bound-and-true-p uniquify-managed)
-       (uniquify-item-base (car uniquify-managed))
-     (buffer-name))
+   (buffer-name)
    major-mode
    ;; minor modes
    (let (ret)
@@ -890,19 +886,22 @@
 
 	  (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
 	  (dolist (l (mapcar 'desktop-buffer-info (buffer-list)))
-	    (when (apply 'desktop-save-buffer-p l)
-	      (insert "("
-		      (if (or (not (integerp eager))
-			      (if (zerop eager)
-				  nil
-				(setq eager (1- eager))))
-			  "desktop-create-buffer"
-			"desktop-append-buffer-args")
-		      " "
-		      desktop-file-version)
-	      (dolist (e l)
-		(insert "\n  " (desktop-value-to-string e)))
-	      (insert ")\n\n")))
+	    (let ((base (pop l)))
+	      (when (apply 'desktop-save-buffer-p l)
+		(insert "("
+			(if (or (not (integerp eager))
+				(if (zerop eager)
+				    nil
+				  (setq eager (1- eager))))
+			    "desktop-create-buffer"
+			  "desktop-append-buffer-args")
+			" "
+			desktop-file-version)
+		;; If the base name is non-nil, we save it instead of the buffer name
+		(when base (setcar (nthcdr 1 l) base))
+		(dolist (e l)
+		  (insert "\n  " (desktop-value-to-string e)))
+		(insert ")\n\n"))))
 
 	  (setq default-directory desktop-dirname)
 	  (let ((coding-system-for-write 'emacs-mule))