From df7eb2bd5f2ab3ece2551ae7e65d022372b07d2a Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 13 Jul 2003 17:20:00 +0000 Subject: [PATCH] (desktop-buffer-dired-misc-data, desktop-buffer-dired): Handle `dired-directory' being a list. --- lisp/desktop.el | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/lisp/desktop.el b/lisp/desktop.el index 4c3a6be176f..a5a898e2cd5 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -783,9 +783,18 @@ This function always sets `desktop-enable' to t." (when (eq major-mode 'dired-mode) (eval-when-compile (defvar dirname)) (cons - ;; dired directory in portable form - (file-name-as-directory (desktop-file-name dired-directory dirname)) - (cdr (nreverse (mapcar (function car) dired-subdir-alist)))))) + ;; Value of `dired-directory'. + (if (consp dired-directory) + ;; Directory name followed by list of files. + (cons (desktop-file-name (car dired-directory) dirname) (cdr dired-directory)) + ;; Directory name, optionally with with shell wildcard. + (desktop-file-name dired-directory dirname)) + ;; Subdirectories in `dired-subdir-alist'. + (cdr + (nreverse + (mapcar + (function (lambda (f) (desktop-file-name (car f) dirname))) + dired-subdir-alist)))))) ;; ---------------------------------------------------------------------------- (defun desktop-buffer-info () "Load an info file." @@ -823,14 +832,19 @@ This function always sets `desktop-enable' to t." ;; ---------------------------------------------------------------------------- (defun desktop-buffer-dired () "Load a directory using dired." (if (eq 'dired-mode desktop-buffer-major-mode) - (if (file-directory-p (file-name-directory (car desktop-buffer-misc))) - (progn - (dired (car desktop-buffer-misc)) - (mapcar 'dired-maybe-insert-subdir (cdr desktop-buffer-misc)) - (current-buffer)) - (message "Directory %s no longer exists." (car desktop-buffer-misc)) - (sit-for 1) - 'ignored))) + ;; First element of `desktop-buffer-misc' is the value of `dired-directory'. + ;; This value is a directory name, optionally with with shell wildcard or + ;; a directory name followed by list of files. + (let* ((dired-directory (car desktop-buffer-misc)) + (dir (if (consp dired-directory) (car dired-directory) dired-directory))) + (if (file-directory-p (file-name-directory dir)) + (progn + (dired dired-directory) + (mapcar 'dired-maybe-insert-subdir (cdr desktop-buffer-misc)) + (current-buffer)) + (message "Directory %s no longer exists." dir) + (sit-for 1) + 'ignored)))) ;; ---------------------------------------------------------------------------- (defun desktop-buffer-file () -- 2.11.4.GIT