1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

(desktop-create-buffer): Undo last change.

(desktop-kill, desktop-save, desktop-remove): Use expand-directory rather than
concat to construct desktop filename.
(desktop-kill, desktop-read, desktop-change-dir): Ensure desktop-dirname is a
directory name.
(desktop-change-dir): Fix bug when DIR was relative.
This commit is contained in:
Juanma Barranquero 2003-06-03 23:35:20 +00:00
parent e09f3bff95
commit 73b0b745c3
2 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,16 @@
2003-06-04 Lars Hansen <larsh@math.ku.dk>
* desktop.el (desktop-create-buffer): Undo last change.
(desktop-kill, desktop-save, desktop-remove): Use expand-directory
rather than concat to construct desktop filename.
(desktop-kill, desktop-read, desktop-change-dir): Ensure
desktop-dirname is a directory name.
(desktop-change-dir): Fix bug when DIR was relative.
2003-06-04 Alex Coventry <alex_c@mit.edu> (tiny change)
* files.el (after-find-file): Fix arguments of call to `sit-for'.
2003-06-03 Lute Kamstra <Lute.Kamstra@cwi.nl> 2003-06-03 Lute Kamstra <Lute.Kamstra@cwi.nl>
* cus-edit.el (custom-get-fresh-buffer): Test for nonexistence buffer. * cus-edit.el (custom-get-fresh-buffer): Test for nonexistence buffer.

View File

@ -394,7 +394,7 @@ is nil, ask the user where to save the desktop."
(when (when
(and (and
desktop-enable desktop-enable
(let ((exists (file-exists-p (concat desktop-dirname desktop-base-file-name)))) (let ((exists (file-exists-p (expand-file-name desktop-base-file-name desktop-dirname))))
(or (or
(eq desktop-save 't) (eq desktop-save 't)
(and exists (memq desktop-save '(ask-if-new if-exists))) (and exists (memq desktop-save '(ask-if-new if-exists)))
@ -405,9 +405,10 @@ is nil, ask the user where to save the desktop."
(y-or-n-p "Save desktop? "))))) (y-or-n-p "Save desktop? ")))))
(unless desktop-dirname (unless desktop-dirname
(setq desktop-dirname (setq desktop-dirname
(expand-file-name (file-name-as-directory
(call-interactively (expand-file-name
(lambda (dir) (interactive "DDirectory for desktop file: ") dir))))) (call-interactively
(lambda (dir) (interactive "DDirectory for desktop file: ") dir))))))
(condition-case err (condition-case err
(desktop-save desktop-dirname) (desktop-save desktop-dirname)
(file-error (file-error
@ -583,7 +584,7 @@ DIRNAME must be the directory in which the desktop file will be saved."
(run-hooks 'desktop-save-hook) (run-hooks 'desktop-save-hook)
(setq dirname (file-name-as-directory (expand-file-name dirname))) (setq dirname (file-name-as-directory (expand-file-name dirname)))
(save-excursion (save-excursion
(let ((filename (concat dirname desktop-base-file-name)) (let ((filename (expand-file-name desktop-base-file-name dirname))
(info (info
(mapcar (mapcar
(function (function
@ -666,11 +667,10 @@ DIRNAME must be the directory in which the desktop file will be saved."
"Delete the Desktop file and inactivate the desktop system." "Delete the Desktop file and inactivate the desktop system."
(interactive) (interactive)
(if desktop-dirname (if desktop-dirname
(let ((filename (concat desktop-dirname desktop-base-file-name))) (let ((filename (expand-file-name desktop-base-file-name desktop-dirname)))
(setq desktop-dirname nil) (setq desktop-dirname nil)
(if (file-exists-p filename) (if (file-exists-p filename)
(delete-file filename))))) (delete-file filename)))))
;; ---------------------------------------------------------------------------- ;; ----------------------------------------------------------------------------
;;;###autoload ;;;###autoload
(defun desktop-read () (defun desktop-read ()
@ -688,7 +688,7 @@ Returns t if it has read a desktop file, nil otherwise."
(not (not
(file-exists-p (expand-file-name desktop-base-file-name (car dirs))))) (file-exists-p (expand-file-name desktop-base-file-name (car dirs)))))
(setq dirs (cdr dirs))) (setq dirs (cdr dirs)))
(setq desktop-dirname (and dirs (expand-file-name (car dirs)))) (setq desktop-dirname (and dirs (file-name-as-directory (expand-file-name (car dirs)))))
(if desktop-dirname (if desktop-dirname
(let ((desktop-first-buffer nil)) (let ((desktop-first-buffer nil))
;; Evaluate desktop buffer. ;; Evaluate desktop buffer.
@ -727,16 +727,16 @@ to provide correct modes for autoloaded files."
However, if `desktop-enable' was nil at call, don't save the old desktop. However, if `desktop-enable' was nil at call, don't save the old desktop.
This function always sets `desktop-enable' to t." This function always sets `desktop-enable' to t."
(interactive "DNew directory: ") (interactive "DNew directory: ")
(setq dir (file-name-as-directory (expand-file-name dir desktop-dirname)))
(desktop-kill) (desktop-kill)
(desktop-clear) (desktop-clear)
(cd dir)
(setq desktop-enable t) (setq desktop-enable t)
(let ((desktop-path '("."))) (let ((desktop-path (list dir))
(desktop-read) (default-directory dir))
;; Set `desktop-dirname' even in no desktop file was found (desktop-read))
(setq desktop-dirname (expand-file-name dir)))) ;; Set `desktop-dirname' even in no desktop file was found
(setq desktop-dirname dir))
;; ---------------------------------------------------------------------------- ;; ----------------------------------------------------------------------------
;;;###autoload ;;;###autoload
(defun desktop-save-in-load-dir () (defun desktop-save-in-load-dir ()
"Save desktop in directory from which it was loaded." "Save desktop in directory from which it was loaded."
@ -875,7 +875,6 @@ This function always sets `desktop-enable' to t."
(let ( (let (
(buffer-list (buffer-list)) (buffer-list (buffer-list))
(hlist desktop-buffer-handlers) (hlist desktop-buffer-handlers)
(desktop-first-buffer)
(result) (result)
(handler) (handler)
) )
@ -909,7 +908,7 @@ This function always sets `desktop-enable' to t."
(when (functionp minor-mode) (funcall minor-mode 1))) (when (functionp minor-mode) (funcall minor-mode 1)))
desktop-buffer-minor-modes))) desktop-buffer-minor-modes)))
;; Even though point and mark are non-nil when written by `desktop-save' ;; Even though point and mark are non-nil when written by `desktop-save'
;; they may be modified by mandlers wanting to set point or mark themselves. ;; they may be modified by handlers wanting to set point or mark themselves.
(when desktop-buffer-point (goto-char desktop-buffer-point)) (when desktop-buffer-point (goto-char desktop-buffer-point))
(when desktop-buffer-mark (when desktop-buffer-mark
(if (consp desktop-buffer-mark) (if (consp desktop-buffer-mark)