comparison lisp/desktop.el @ 14172:da563949c7d7

(desktop-read): Do nothing in batch mode. Clear desktop-delay-hook after use. Simplify.
author Richard M. Stallman <rms@gnu.org>
date Sun, 14 Jan 1996 23:24:40 +0000
parents 83f275dcd93a
children 9955249f9b0f
comparison
equal deleted inserted replaced
14171:e8e99446ef2c 14172:da563949c7d7
83 ;; avk@rtsg.mot.com (Andrew V. Klein) for a dired tip. 83 ;; avk@rtsg.mot.com (Andrew V. Klein) for a dired tip.
84 ;; chris@tecc.co.uk (Chris Boucher) for a mark tip. 84 ;; chris@tecc.co.uk (Chris Boucher) for a mark tip.
85 ;; f89-kam@nada.kth.se (Klas Mellbourn) for a mh-e tip. 85 ;; f89-kam@nada.kth.se (Klas Mellbourn) for a mh-e tip.
86 ;; kifer@sbkifer.cs.sunysb.edu (M. Kifer) for a bug hunt. 86 ;; kifer@sbkifer.cs.sunysb.edu (M. Kifer) for a bug hunt.
87 ;; treese@lcs.mit.edu (Win Treese) for ange-ftp tips. 87 ;; treese@lcs.mit.edu (Win Treese) for ange-ftp tips.
88 ;; pot@cnuce.cnr.it (Francesco Potorti`) for misc. tips.
88 ;; --------------------------------------------------------------------------- 89 ;; ---------------------------------------------------------------------------
89 ;; TODO: 90 ;; TODO:
90 ;; 91 ;;
91 ;; Save window configuration. 92 ;; Save window configuration.
92 ;; Recognize more minor modes. 93 ;; Recognize more minor modes.
436 (setq desktop-dirname nil) 437 (setq desktop-dirname nil)
437 (if (file-exists-p filename) 438 (if (file-exists-p filename)
438 (delete-file filename))))) 439 (delete-file filename)))))
439 ;; ---------------------------------------------------------------------------- 440 ;; ----------------------------------------------------------------------------
440 (defun desktop-read () 441 (defun desktop-read ()
441 "Read the Desktop file and the files it specifies." 442 "Read the Desktop file and the files it specifies.
443 This is a no-op when Emacs is running in batch mode."
442 (interactive) 444 (interactive)
443 (let ((filename)) 445 (if noninteractive
444 (if (file-exists-p (concat "./" desktop-basefilename)) 446 nil
445 (setq desktop-dirname (expand-file-name "./")) 447 (let ((dirs '("./" "~/")))
446 (if (file-exists-p (concat "~/" desktop-basefilename)) 448 (while (and dirs
447 (setq desktop-dirname (expand-file-name "~/")) 449 (not (file-exists-p (expand-file-name
448 (setq desktop-dirname nil))) 450 desktop-basefilename
449 (if desktop-dirname 451 (car dirs)))))
450 (progn 452 (setq dirs (cdr dirs)))
451 (load (concat desktop-dirname desktop-basefilename) t t t) 453 (setq desktop-dirname (and dirs (expand-file-name (car dirs))))
452 (run-hooks 'desktop-delay-hook) 454 (if desktop-dirname
453 (message "Desktop loaded.")) 455 (progn
454 (desktop-clear)))) 456 (load (expand-file-name desktop-basefilename desktop-dirname)
457 t t t)
458 (run-hooks 'desktop-delay-hook)
459 (setq desktop-delay-hook nil)
460 (message "Desktop loaded."))
461 (desktop-clear)))))
455 ;; ---------------------------------------------------------------------------- 462 ;; ----------------------------------------------------------------------------
456 (defun desktop-load-default () 463 (defun desktop-load-default ()
457 "Load the `default' start-up library manually. 464 "Load the `default' start-up library manually.
458 Also inhibit further loading of it. Call this from your `.emacs' file 465 Also inhibit further loading of it. Call this from your `.emacs' file
459 to provide correct modes for autoloaded files." 466 to provide correct modes for autoloaded files."