emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Lars Hansen
Subject: [Emacs-diffs] Changes to emacs/lisp/desktop.el
Date: Tue, 30 Sep 2003 03:22:22 -0400

Index: emacs/lisp/desktop.el
diff -c emacs/lisp/desktop.el:1.64 emacs/lisp/desktop.el:1.65
*** emacs/lisp/desktop.el:1.64  Mon Sep  8 03:02:44 2003
--- emacs/lisp/desktop.el       Tue Sep 30 03:22:22 2003
***************
*** 37,74 ****
  ;;            - buffer-read-only
  ;;            - some local variables
  
! ;; To use this, add these lines to the bottom of your .emacs file:
  ;;
! ;;      (require 'desktop)
! ;;      (setq desktop-enable t)
  ;;
! ;; Between the first two lines you may wish to add something that updates the
! ;; variables `desktop-globals-to-save' and/or `desktop-locals-to-save'.  If
! ;; for instance you want to save the local variable `foobar' for every buffer
! ;; in which it is local, you could add the line
! ;;
! ;;    (add-to-list 'desktop-locals-to-save 'foobar)
! ;;
! ;; To avoid saving excessive amounts of data you may also wish to add
! ;; something like the following
! ;;
! ;;    (add-hook 'kill-emacs-hook
! ;;              '(lambda ()
! ;;                 (desktop-truncate search-ring 3)
! ;;                 (desktop-truncate regexp-search-ring 3)))
! ;;
! ;; which will make sure that no more than three search items are saved.  You
! ;; must place this line *after* the `(desktop-load-default)' line.  See also
! ;; the variable `desktop-save-hook'.
! 
! ;; Start Emacs in the root directory of your "project". The desktop saver
! ;; is inactive by default.  You activate it by M-x desktop-save RET.  When
! ;; you exit the next time the above data will be saved.  This ensures that
! ;; all the files you were editing will be reloaded the next time you start
! ;; Emacs from the same directory and that points will be set where you
! ;; left them.  If you save a desktop file in your home directory it will
! ;; act as a default desktop when you start Emacs from a directory that
! ;; doesn't have its own.  I never do this, but you may want to.
  
  ;; Some words on minor modes: Most minor modes are controlled by
  ;; buffer-local variables, which have a standard save / restore
--- 37,55 ----
  ;;            - buffer-read-only
  ;;            - some local variables
  
! ;; To use this, use customize to turn on desktop-save-mode or add the
! ;; following line somewhere in your .emacs file:
  ;;
! ;;    (desktop-save-mode 1)
  ;;
! ;; For further usage information, look at the section
! ;; "Saving Emacs Sessions" in the GNU Emacs Manual.
! 
! ;; When the desktop module is loaded, the function `desktop-kill' is
! ;; added to the `kill-emacs-hook'. This function is responsible for
! ;; saving the desktop when Emacs is killed.  Furthermore an anonymous
! ;; function is added to the `after-init-hook'. This function is
! ;; responsible for loading the desktop when Emacs is started.
  
  ;; Some words on minor modes: Most minor modes are controlled by
  ;; buffer-local variables, which have a standard save / restore
***************
*** 121,144 ****
    "Save status of Emacs when you exit."
    :group 'frames)
  
! (defcustom desktop-enable nil
!   "*Non-nil enable Desktop to save the state of Emacs when you exit."
!   :group 'desktop
!   :type 'boolean
!   :require 'desktop
!   :initialize 'custom-initialize-default
!   :version "20.3")
  
  (defcustom desktop-save 'ask-if-new
!   "*When the user changes desktop or quits emacs, should the desktop be saved?
! \(in the current desktop directory)
     t             -- always save.
     ask           -- always ask.
     ask-if-new    -- ask if no desktop file exists, otherwise just save.
     ask-if-exists -- ask if desktop file exists, otherwise don't save.
     if-exists     -- save if desktop file exists, otherwise don't save.
     nil           -- never save.
! The desktop is never saved when `desktop-enable' is nil."
    :type '(choice
      (const :tag "Always save" t)
      (const :tag "Always ask" ask)
--- 102,133 ----
    "Save status of Emacs when you exit."
    :group 'frames)
  
! ;;;###autoload
! (define-minor-mode desktop-save-mode
!   "Toggle desktop saving mode.
! With numeric ARG, turn desktop saving on if ARG is positive, off
! otherwise.  See variable `desktop-save' for a description of when the
! desktop is saved."
!   :global t
!   :group 'desktop)
! 
! ;; Maintained for backward compatibility
! (defvaralias 'desktop-enable 'desktop-save-mode)
! (make-obsolete-variable 'desktop-enable 'desktop-save-mode)
  
  (defcustom desktop-save 'ask-if-new
!   "*Specifies whether the desktop should be saved when it is killed.
! A desktop is killed when the user changes desktop or quits Emacs.
! Possible values are:
     t             -- always save.
     ask           -- always ask.
     ask-if-new    -- ask if no desktop file exists, otherwise just save.
     ask-if-exists -- ask if desktop file exists, otherwise don't save.
     if-exists     -- save if desktop file exists, otherwise don't save.
     nil           -- never save.
! The desktop is never saved when `desktop-save-mode' is nil.
! The variables `desktop-directory' and `desktop-base-file-name'
! determine where the desktop is saved."
    :type '(choice
      (const :tag "Always save" t)
      (const :tag "Always ask" ask)
***************
*** 150,156 ****
  
  (defcustom desktop-base-file-name
    (convert-standard-filename ".emacs.desktop")
!   "File for Emacs desktop, not including the directory name."
    :type 'file
    :group 'desktop)
  (defvaralias 'desktop-basefilename 'desktop-base-file-name)
--- 139,145 ----
  
  (defcustom desktop-base-file-name
    (convert-standard-filename ".emacs.desktop")
!   "Name of file for Emacs desktop, excluding the directory part."
    :type 'file
    :group 'desktop)
  (defvaralias 'desktop-basefilename 'desktop-base-file-name)
***************
*** 162,174 ****
    :group 'desktop)
  
  (defcustom desktop-missing-file-warning nil
!   "*If non-nil then desktop warns when a file no longer exists.
  Otherwise it simply ignores that file."
    :type 'boolean
    :group 'desktop)
  
  (defcustom desktop-no-desktop-file-hook nil
!   "Normal hook run after fail of `desktop-read' due to missing desktop file.
  May e.g. be used to show a dired buffer."
    :type 'hook
    :group 'desktop)
--- 151,163 ----
    :group 'desktop)
  
  (defcustom desktop-missing-file-warning nil
!   "*If non-nil then `desktop-read' warns when a file no longer exists.
  Otherwise it simply ignores that file."
    :type 'boolean
    :group 'desktop)
  
  (defcustom desktop-no-desktop-file-hook nil
!   "Normal hook run when `desktop-read' can't find a desktop file.
  May e.g. be used to show a dired buffer."
    :type 'hook
    :group 'desktop)
***************
*** 180,186 ****
    :group 'desktop)
  
  (defcustom desktop-save-hook nil
!   "Hook run before desktop saves the state of Emacs.
  This is useful for truncating history lists, for example."
    :type 'hook
    :group 'desktop)
--- 169,175 ----
    :group 'desktop)
  
  (defcustom desktop-save-hook nil
!   "Normal hook run before the desktop is saved in a desktop file.
  This is useful for truncating history lists, for example."
    :type 'hook
    :group 'desktop)
***************
*** 192,202 ****
    search-ring
    regexp-search-ring
    register-alist)
!   "List of global variables to save when killing Emacs.
! An element may be variable name (a symbol)
! or a cons cell of the form  (VAR . MAX-SIZE),
! which means to truncate VAR's value to at most MAX-SIZE elements
! \(if the value is a list) before saving the value.
  Feature: Saving `kill-ring' implies saving `kill-ring-yank-pointer'."
    :type '(repeat (restricted-sexp :match-alternatives (symbolp consp)))
    :group 'desktop)
--- 181,190 ----
    search-ring
    regexp-search-ring
    register-alist)
!   "List of global variables saved by `desktop-save'.
! An element may be variable name (a symbol) or a cons cell of the form
! \(VAR . MAX-SIZE), which means to truncate VAR's value to at most
! MAX-SIZE elements (if the value is a list) before saving the value.
  Feature: Saving `kill-ring' implies saving `kill-ring-yank-pointer'."
    :type '(repeat (restricted-sexp :match-alternatives (symbolp consp)))
    :group 'desktop)
***************
*** 208,214 ****
    search-ring-yank-pointer
    regexp-search-ring
    regexp-search-ring-yank-pointer)
!   "List of global variables set to clear by `desktop-clear'.
  An element may be variable name (a symbol) or a cons cell of the form
  \(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
  to the value obtained by evaluateing FORM."
--- 196,202 ----
    search-ring-yank-pointer
    regexp-search-ring
    regexp-search-ring-yank-pointer)
!   "List of global variables to clear by `desktop-clear'.
  An element may be variable name (a symbol) or a cons cell of the form
  \(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
  to the value obtained by evaluateing FORM."
***************
*** 216,234 ****
    :group 'desktop)
  
  (defcustom desktop-clear-preserve-buffers-regexp
!   "^\\*tramp/.+\\*$"
    "Regexp identifying buffers that `desktop-clear' should not delete."
    :type 'regexp
    :group 'desktop)
  
  ;; Maintained for backward compatibility
! (defcustom desktop-clear-preserve-buffers
!   '("*scratch*" "*Messages*")
!   "*List of buffer names that `desktop-clear' should not delete."
    :type '(repeat string)
    :group 'desktop)
  
! (defvar desktop-locals-to-save '(
    desktop-locals-to-save  ; Itself!  Think it over.
    truncate-lines
    case-fold-search
--- 204,225 ----
    :group 'desktop)
  
  (defcustom desktop-clear-preserve-buffers-regexp
!   "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$"
    "Regexp identifying buffers that `desktop-clear' should not delete."
    :type 'regexp
    :group 'desktop)
  
  ;; Maintained for backward compatibility
! (defcustom desktop-clear-preserve-buffers nil
!   "*List of buffer names that `desktop-clear' should not delete.
! This variable is maintained for backward compatibility only.  Use
! `desktop-clear-preserve-buffers-regexp' instead."
    :type '(repeat string)
    :group 'desktop)
+ (make-obsolete-variable 'desktop-clear-preserve-buffers
+                         'desktop-clear-preserve-buffers-regexp)
  
! (defcustom desktop-locals-to-save '(
    desktop-locals-to-save  ; Itself!  Think it over.
    truncate-lines
    case-fold-search
***************
*** 238,244 ****
    change-log-default-name
    line-number-mode)
    "List of local variables to save for each buffer.
! The variables are saved only when they really are local.")
  (make-variable-buffer-local 'desktop-locals-to-save)
  
  ;; We skip .log files because they are normally temporary.
--- 229,237 ----
    change-log-default-name
    line-number-mode)
    "List of local variables to save for each buffer.
! The variables are saved only when they really are local."
!   :type '(repeat symbol)
!   :group 'desktop)
  (make-variable-buffer-local 'desktop-locals-to-save)
  
  ;; We skip .log files because they are normally temporary.
***************
*** 250,256 ****
    :type 'regexp
    :group 'desktop)
  
! ;; Skip ange-ftp files
  (defcustom desktop-files-not-to-save
    "^/[^/:]*:"
    "Regexp identifying files whose buffers are to be excluded from saving."
--- 243,249 ----
    :type 'regexp
    :group 'desktop)
  
! ;; Skip tramp and ange-ftp files
  (defcustom desktop-files-not-to-save
    "^/[^/:]*:"
    "Regexp identifying files whose buffers are to be excluded from saving."
***************
*** 259,265 ****
  
  (defcustom desktop-buffer-modes-to-save
    '(Info-mode rmail-mode)
!   "If a buffer is of one of these major modes, save the buffer name.
  It is up to the functions in `desktop-buffer-handlers' to decide
  whether the buffer should be recreated or not, and how."
    :type '(repeat symbol)
--- 252,258 ----
  
  (defcustom desktop-buffer-modes-to-save
    '(Info-mode rmail-mode)
!   "If a buffer is of one of these major modes, save the buffer state.
  It is up to the functions in `desktop-buffer-handlers' to decide
  whether the buffer should be recreated or not, and how."
    :type '(repeat symbol)
***************
*** 283,299 ****
    '(desktop-buffer-info-misc-data
      desktop-buffer-dired-misc-data)
    "*Functions used to determine auxiliary information for a buffer.
! These functions are called in order, with no arguments.  If a function
! returns non-nil, its value is saved along with the desktop buffer for
! which it was called; no further functions will be called.
  
! File names should formatted using the call
  \"(desktop-file-name FILE-NAME dirname)\".
  
! Later, when desktop.el restores the buffers it has saved, each of the
! `desktop-buffer-handlers' functions will have access to a buffer local
! variable, named `desktop-buffer-misc', whose value is what the
! \"misc\" function returned previously."
    :type '(repeat function)
    :group 'desktop)
  
--- 276,293 ----
    '(desktop-buffer-info-misc-data
      desktop-buffer-dired-misc-data)
    "*Functions used to determine auxiliary information for a buffer.
! These functions are called by `desktop-save' in order, with no
! arguments.  If a function returns non-nil, its value is saved along
! with the state of the buffer for which it was called; no further
! functions will be called.
  
! When file names are returned, they should be formatted using the call
  \"(desktop-file-name FILE-NAME dirname)\".
  
! Later, when `desktop-read' restores buffers, each of the functions in
! `desktop-buffer-handlers' will have access to a buffer local variable,
! named `desktop-buffer-misc', whose value is what the function in
! `desktop-buffer-misc-functions' returned."
    :type '(repeat function)
    :group 'desktop)
  
***************
*** 303,309 ****
      desktop-buffer-mh
      desktop-buffer-info
      desktop-buffer-file)
!   "*List of functions to call in order to create a buffer.
  The functions are called without explicit parameters but can use the
  following variables:
  
--- 297,303 ----
      desktop-buffer-mh
      desktop-buffer-info
      desktop-buffer-file)
!   "*Functions called by `desktop-read' in order to create a buffer.
  The functions are called without explicit parameters but can use the
  following variables:
  
***************
*** 342,348 ****
  
  ;; 
----------------------------------------------------------------------------
  (defvar desktop-dirname nil
!   "The directory in which the current desktop file resides.")
  
  (defconst desktop-header
  ";; --------------------------------------------------------------------------
--- 336,342 ----
  
  ;; 
----------------------------------------------------------------------------
  (defvar desktop-dirname nil
!   "The directory in which the desktop file should be saved.")
  
  (defconst desktop-header
  ";; --------------------------------------------------------------------------
***************
*** 363,370 ****
  ;; 
----------------------------------------------------------------------------
  (defun desktop-clear ()
    "Empty the Desktop.
! This kills all buffers except for internal ones and those listed
! in `desktop-clear-preserve-buffers'.  Furthermore, it clears the
  variables listed in `desktop-globals-to-clear'."
    (interactive)
    (dolist (var desktop-globals-to-clear)
--- 357,365 ----
  ;; 
----------------------------------------------------------------------------
  (defun desktop-clear ()
    "Empty the Desktop.
! This kills all buffers except for internal ones and those matching
! `desktop-clear-preserve-buffers-regexp' or listed in
! `desktop-clear-preserve-buffers'.  Furthermore, it clears the
  variables listed in `desktop-globals-to-clear'."
    (interactive)
    (dolist (var desktop-globals-to-clear)
***************
*** 388,399 ****
  (add-hook 'kill-emacs-hook 'desktop-kill)
  
  (defun desktop-kill ()
!   "If `desktop-enable' is non-nil, do what `desktop-save' says to do.
  If the desktop should be saved and `desktop-dirname'
  is nil, ask the user where to save the desktop."
    (when
      (and
!       desktop-enable
        (let ((exists (file-exists-p (expand-file-name desktop-base-file-name 
desktop-dirname))))
          (or
            (eq desktop-save t)
--- 383,394 ----
  (add-hook 'kill-emacs-hook 'desktop-kill)
  
  (defun desktop-kill ()
!   "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
  If the desktop should be saved and `desktop-dirname'
  is nil, ask the user where to save the desktop."
    (when
      (and
!       desktop-save-mode
        (let ((exists (file-exists-p (expand-file-name desktop-base-file-name 
desktop-dirname))))
          (or
            (eq desktop-save t)
***************
*** 579,585 ****
  
  ;; 
----------------------------------------------------------------------------
  (defun desktop-save (dirname)
!   "Save the Desktop file. Parameter DIRNAME specifies where to save desktop."
    (interactive "DDirectory to save desktop file in: ")
    (run-hooks 'desktop-save-hook)
    (setq dirname (file-name-as-directory (expand-file-name dirname)))
--- 574,582 ----
  
  ;; 
----------------------------------------------------------------------------
  (defun desktop-save (dirname)
!   "Save the desktop in a desktop file.
! Parameter DIRNAME specifies where to save the desktop file.
! See also `desktop-base-file-name'."
    (interactive "DDirectory to save desktop file in: ")
    (run-hooks 'desktop-save-hook)
    (setq dirname (file-name-as-directory (expand-file-name dirname)))
***************
*** 664,745 ****
  
  ;; 
----------------------------------------------------------------------------
  (defun desktop-remove ()
!   "Delete the Desktop file and inactivate the desktop system."
    (interactive)
!   (if desktop-dirname
!       (let ((filename (expand-file-name desktop-base-file-name 
desktop-dirname)))
!     (setq desktop-dirname nil)
!     (if (file-exists-p filename)
          (delete-file filename)))))
  ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-read ()
!   "Read the Desktop file and the files it specifies.
! This is a no-op when Emacs is running in batch mode.
! Look for the desktop file according to the variables `desktop-base-file-name'
! and `desktop-path'.  If no desktop file is found, clear the desktop.
! Returns t if it has read a desktop file, nil otherwise."
    (interactive)
    (unless noninteractive
!     (let ((dirs desktop-path))
!       (while
!         (and
!           dirs
!           (not
!             (file-exists-p (expand-file-name desktop-base-file-name (car 
dirs)))))
!         (setq dirs (cdr dirs)))
!       (setq desktop-dirname (and dirs (file-name-as-directory 
(expand-file-name (car dirs)))))
!       (if desktop-dirname
!         (let ((desktop-first-buffer nil))
!           ;; Evaluate desktop buffer.
!           (load (expand-file-name desktop-base-file-name desktop-dirname) t t 
t)
!           ;; `desktop-create-buffer' puts buffers at end of the buffer list.
!           ;; We want buffers existing prior to evaluating the desktop (and 
not reused)
!           ;; to be placed at the end of the buffer list, so we move them here.
!           (mapcar 'bury-buffer
!                   (nreverse (cdr (memq desktop-first-buffer (nreverse 
(buffer-list))))))
!           (switch-to-buffer (car (buffer-list)))
!           (run-hooks 'desktop-delay-hook)
!           (setq desktop-delay-hook nil)
!           (run-hooks 'desktop-after-read-hook)
!           (message "Desktop loaded.")
!           t)
!         (desktop-clear)
!         (run-hooks 'desktop-no-desktop-file-hook)
!         (message "No desktop file.")
!         nil))))
  
  ;; 
----------------------------------------------------------------------------
  ;;;###autoload
  (defun desktop-load-default ()
    "Load the `default' start-up library manually.
! Also inhibit further loading of it.  Call this from your `.emacs' file
! to provide correct modes for autoloaded files."
    (if (not inhibit-default-init)      ; safety check
        (progn
        (load "default" t t)
        (setq inhibit-default-init t))))
  
  ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-change-dir (dir)
!   "Save and clear the desktop, then load the desktop from directory DIR.
! However, if `desktop-enable' was nil at call, don't save the old desktop.
! This function always sets `desktop-enable' to t."
!   (interactive "DNew directory: ")
!   (setq dir (file-name-as-directory (expand-file-name dir desktop-dirname)))
    (desktop-kill)
    (desktop-clear)
!   (setq desktop-enable t)
!   (let ((desktop-path (list dir))
!         (default-directory dir))
!     (desktop-read))
!   ;; Set `desktop-dirname' even in no desktop file was found
!   (setq desktop-dirname dir))
!   ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-save-in-load-dir ()
!   "Save desktop in directory from which it was loaded."
    (interactive)
    (if desktop-dirname
      (desktop-save desktop-dirname)
--- 661,758 ----
  
  ;; 
----------------------------------------------------------------------------
  (defun desktop-remove ()
!   "Delete desktop file in `desktop-dirname'.
! This function also sets `desktop-dirname' to nil."
    (interactive)
!   (when desktop-dirname
!     (let ((filename (expand-file-name desktop-base-file-name 
desktop-dirname)))
!       (setq desktop-dirname nil)
!       (when (file-exists-p filename)
          (delete-file filename)))))
+ 
  ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-read (&optional dirname)
!   "Read and process the desktop file in directory DIRNAME.
! Look for a desktop file in DIRNAME, or if DIRNAME is omitted, look in
! directories listed in `desktop-path'.  If a desktop file is found, it
! is processed and `desktop-after-read-hook' is run. If no desktop file
! is found, clear the desktop and run `desktop-no-desktop-file-hook'.
! This function is a no-op when Emacs is running in batch mode.
! It returns t if a desktop file was loaded, nil otherwise."
    (interactive)
    (unless noninteractive
!     (setq desktop-dirname
!       (file-name-as-directory
!         (expand-file-name
!           (or
!             ;; If DIRNAME is specified, use it.
!             (and (< 0 (length dirname)) dirname)
!             ;; Otherwise search desktop file in desktop-path.
!             (let ((dirs desktop-path))
!               (while
!                 (and
!                   dirs
!                   (not
!                     (file-exists-p (expand-file-name desktop-base-file-name 
(car dirs)))))
!                 (setq dirs (cdr dirs)))
!               (and dirs (car dirs)))
!             ;; If not found and `desktop-path' is non-nil, use its first 
element.
!             (and desktop-path (car desktop-path))
!             ;; Default: Home directory.
!             "~"))))
!     (if (file-exists-p (expand-file-name desktop-base-file-name 
desktop-dirname))
!       ;; Desktop file found, process it.
!       (let ((desktop-first-buffer nil))
!         ;; Evaluate desktop buffer.
!         (load (expand-file-name desktop-base-file-name desktop-dirname) t t t)
!         ;; `desktop-create-buffer' puts buffers at end of the buffer list.
!         ;; We want buffers existing prior to evaluating the desktop (and not 
reused)
!         ;; to be placed at the end of the buffer list, so we move them here.
!         (mapcar 'bury-buffer
!                 (nreverse (cdr (memq desktop-first-buffer (nreverse 
(buffer-list))))))
!         (switch-to-buffer (car (buffer-list)))
!         (run-hooks 'desktop-delay-hook)
!         (setq desktop-delay-hook nil)
!         (run-hooks 'desktop-after-read-hook)
!         (message "Desktop loaded.")
!         t)
!       ;; No desktop file found.
!       (desktop-clear)
!       (let ((default-directory desktop-dirname))
!         (run-hooks 'desktop-no-desktop-file-hook))
!       (message "No desktop file.")
!       nil)))
  
  ;; 
----------------------------------------------------------------------------
+ ;; Maintained for backward compatibility
  ;;;###autoload
  (defun desktop-load-default ()
    "Load the `default' start-up library manually.
! Also inhibit further loading of it."
    (if (not inhibit-default-init)      ; safety check
        (progn
        (load "default" t t)
        (setq inhibit-default-init t))))
+ (make-obsolete 'desktop-load-default 'desktop-save-mode)
  
  ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-change-dir (dirname)
!   "Change to desktop saved in DIRNAME.
! Kill the desktop as specified by variables `desktop-save-mode' and
! `desktop-save', then clear the desktop and load the desktop file in
! directory DIRNAME."
!   (interactive "DChange to directory: ")
!   (setq dirname (file-name-as-directory (expand-file-name dirname 
desktop-dirname)))
    (desktop-kill)
    (desktop-clear)
!   (desktop-read dirname))
!   
! ;; 
----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-save-in-desktop-dir ()
!   "Save the desktop in directory `desktop-dirname'."
    (interactive)
    (if desktop-dirname
      (desktop-save desktop-dirname)
***************
*** 751,759 ****
  (defun desktop-revert ()
    "Revert to the last loaded desktop."
    (interactive)
!   (unless desktop-dirname (error "No desktop has been loaded"))
!   (setq desktop-enable nil)
!   (desktop-change-dir desktop-dirname))
  
  ;; 
----------------------------------------------------------------------------
  ;; Note: the following functions use the dynamic variable binding in Lisp.
--- 764,775 ----
  (defun desktop-revert ()
    "Revert to the last loaded desktop."
    (interactive)
!   (unless desktop-dirname
!     (error "Unknown desktop directory"))
!   (unless (file-exists-p (expand-file-name desktop-base-file-name 
desktop-dirname))
!     (error "No desktop file found"))
!   (desktop-clear)
!   (desktop-read desktop-dirname))
  
  ;; 
----------------------------------------------------------------------------
  ;; Note: the following functions use the dynamic variable binding in Lisp.
***************
*** 962,968 ****
                               (cons 'overwrite-mode (car mim)))))
  
  ;; 
----------------------------------------------------------------------------
! ;; When `desktop-enable' is non-nil and "--no-desktop" is not specified on the
  ;; command line, we do the rest of what it takes to use desktop, but do it
  ;; after finishing loading the init file.
  ;; We cannot use `command-switch-alist' to process "--no-desktop" because 
these
--- 978,984 ----
                               (cons 'overwrite-mode (car mim)))))
  
  ;; 
----------------------------------------------------------------------------
! ;; When `desktop-save-mode' is non-nil and "--no-desktop" is not specified on 
the
  ;; command line, we do the rest of what it takes to use desktop, but do it
  ;; after finishing loading the init file.
  ;; We cannot use `command-switch-alist' to process "--no-desktop" because 
these
***************
*** 973,981 ****
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
          (delete key command-line-args)
!         (when desktop-enable
!           (desktop-load-default)
!           (desktop-read))))))
  
  (provide 'desktop)
  
--- 989,995 ----
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
          (delete key command-line-args)
!         (when desktop-save-mode (desktop-read))))))
  
  (provide 'desktop)
  




reply via email to

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