aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2002-11-04 08:21:51 +0000
committerJuanma Barranquero2002-11-04 08:21:51 +0000
commite571462046b0bc1a9a00a17b26350bf2789abde9 (patch)
tree5b2288a1609a1a4ac8952aff206ef02286c53ab4
parent570050dc4300ce3aca13e9982433c2668699a068 (diff)
downloademacs-e571462046b0bc1a9a00a17b26350bf2789abde9.tar.gz
emacs-e571462046b0bc1a9a00a17b26350bf2789abde9.zip
(desktop-relative-file-names): New variable.
(desktop-save): Use it.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/desktop.el99
2 files changed, 60 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 781ef98ca95..b6f333ce897 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12002-11-04 Robert Fenk <Robert.Fenk@gmx.de> (tiny change)
2
3 * desktop.el (desktop-relative-file-names): New variable.
4 (desktop-save): Use it.
5
12002-11-03 Andre Spiegel <spiegel@gnu.org> 62002-11-03 Andre Spiegel <spiegel@gnu.org>
2 7
3 * vc.el (vc-dired-mode): Adapt dired-move-to-filename-regexp to 8 * vc.el (vc-dired-mode): Adapt dired-move-to-filename-regexp to
@@ -415,7 +420,7 @@
415 (cp866): Delete this alias. 420 (cp866): Delete this alias.
416 ("Bulgarian"): Fix the value of `input-method'. 421 ("Bulgarian"): Fix the value of `input-method'.
417 422
4182002-10-16 Luc Teirlinck <teirllm@mail.auburn.edu> (tiny change) 4232002-10-16 Luc Teirlinck <teirllm@mail.auburn.edu>
419 424
420 * dired-aux.el (dired-add-entry): Put point in correct position 425 * dired-aux.el (dired-add-entry): Put point in correct position
421 before inserting marker char. 426 before inserting marker char.
diff --git a/lisp/desktop.el b/lisp/desktop.el
index f0749ef66a1..11665272f88 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -471,6 +471,11 @@ MODE is the major mode."
471 (and (null filename) 471 (and (null filename)
472 (memq mode desktop-buffer-modes-to-save)))))) 472 (memq mode desktop-buffer-modes-to-save))))))
473;; ---------------------------------------------------------------------------- 473;; ----------------------------------------------------------------------------
474(defcustom desktop-relative-file-names nil
475 "*Store relative file names in the desktop file."
476 :type 'boolean
477 :group 'desktop)
478
474(defun desktop-save (dirname) 479(defun desktop-save (dirname)
475 "Save the Desktop file. Parameter DIRNAME specifies where to save desktop." 480 "Save the Desktop file. Parameter DIRNAME specifies where to save desktop."
476 (interactive "DDirectory to save desktop file in: ") 481 (interactive "DDirectory to save desktop file in: ")
@@ -481,42 +486,46 @@ MODE is the major mode."
481 (mapcar 486 (mapcar
482 (function 487 (function
483 (lambda (b) 488 (lambda (b)
484 (set-buffer b) 489 (set-buffer b)
485 (list 490 (list
486 (buffer-file-name) 491 (let ((bn (buffer-file-name)))
487 (buffer-name) 492 (if bn
488 major-mode 493 (if desktop-relative-file-names
489 ;; minor modes 494 (file-relative-name bn dirname)
490 (let (ret) 495 bn)))
491 (mapcar 496 (buffer-name)
492 #'(lambda (mim) 497 major-mode
493 (and (boundp mim) 498 ;; minor modes
494 (symbol-value mim) 499 (let (ret)
495 (setq ret 500 (mapcar
496 (cons (let ((special (assq mim desktop-minor-mode-table))) 501 #'(lambda (mim)
497 (if special 502 (and (boundp mim)
498 (cadr special) 503 (symbol-value mim)
499 mim)) 504 (setq ret
500 ret)))) 505 (cons (let ((special (assq mim desktop-minor-mode-table)))
501 (mapcar #'car minor-mode-alist)) 506 (if special
502 ret) 507 (cadr special)
503 (point) 508 mim))
504 (list (mark t) mark-active) 509 ret))))
505 buffer-read-only 510 (mapcar #'car minor-mode-alist))
506 (run-hook-with-args-until-success 511 ret)
507 'desktop-buffer-misc-functions) 512 (point)
508 (let ((locals desktop-locals-to-save) 513 (list (mark t) mark-active)
509 (loclist (buffer-local-variables)) 514 buffer-read-only
510 (ll)) 515 (run-hook-with-args-until-success
511 (while locals 516 'desktop-buffer-misc-functions)
512 (let ((here (assq (car locals) loclist))) 517 (let ((locals desktop-locals-to-save)
513 (if here 518 (loclist (buffer-local-variables))
514 (setq ll (cons here ll)) 519 (ll))
515 (if (member (car locals) loclist) 520 (while locals
516 (setq ll (cons (car locals) ll))))) 521 (let ((here (assq (car locals) loclist)))
517 (setq locals (cdr locals))) 522 (if here
518 ll) 523 (setq ll (cons here ll))
519 ))) 524 (if (member (car locals) loclist)
525 (setq ll (cons (car locals) ll)))))
526 (setq locals (cdr locals)))
527 ll)
528 )))
520 (buffer-list)))) 529 (buffer-list))))
521 (buf (get-buffer-create "*desktop*"))) 530 (buf (get-buffer-create "*desktop*")))
522 (set-buffer buf) 531 (set-buffer buf)
@@ -537,15 +546,15 @@ MODE is the major mode."
537 (insert "\n;; Buffer section:\n") 546 (insert "\n;; Buffer section:\n")
538 (mapcar 547 (mapcar
539 (function (lambda (l) 548 (function (lambda (l)
540 (if (apply 'desktop-save-buffer-p l) 549 (if (apply 'desktop-save-buffer-p l)
541 (progn 550 (progn
542 (insert desktop-create-buffer-form) 551 (insert desktop-create-buffer-form)
543 (mapcar 552 (mapcar
544 (function (lambda (e) 553 (function (lambda (e)
545 (insert "\n " 554 (insert "\n "
546 (desktop-value-to-string e)))) 555 (desktop-value-to-string e))))
547 l) 556 l)
548 (insert ")\n\n"))))) 557 (insert ")\n\n")))))
549 info) 558 info)
550 (setq default-directory dirname) 559 (setq default-directory dirname)
551 (if (file-exists-p filename) (delete-file filename)) 560 (if (file-exists-p filename) (delete-file filename))