Commit 341c2f07 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(desktop-save, desktop-create-buffer): Replace mapcar with dolist.

(after-init-hook): Don't quote lambda.
(desktop-first-buffer): Don't wrap it in eval-when-compile.
(desktop-internal-v2s): Remove unused var `el'.
(desktop-buffer-major-mode, desktop-buffer-locals): Move out of
desktop-restore-file-buffer.
(desktop-buffer-ok-count, desktop-buffer-fail-count): Move out of
desktop-create-buffer.
parent c429815a
2007-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
* desktop.el (desktop-save, desktop-create-buffer): Replace mapcar with
dolist.
(after-init-hook): Don't quote lambda.
(desktop-first-buffer): Don't wrap it in eval-when-compile.
(desktop-internal-v2s): Remove unused var `el'.
(desktop-buffer-major-mode, desktop-buffer-locals): Move out of
desktop-restore-file-buffer.
(desktop-buffer-ok-count, desktop-buffer-fail-count): Move out of
desktop-create-buffer.
2007-04-10 Chong Yidong <cyd@stupidchicken.com>
 
* woman.el (woman-decode-buffer): Postphone macro-set check...
......@@ -25,8 +37,8 @@
 
* emacs-lisp/byte-opt.el (byte-optimize-char-before): Remove (move
to bytecomp.el as byte-compile-char-before).
* emacs-lisp/bytecomp.el (byte-compile-char-before): New
function (modified replacement for byte-optimize-char-before in
* emacs-lisp/bytecomp.el (byte-compile-char-before):
New function (modified replacement for byte-optimize-char-before in
byte-opt.el).
 
2007-04-09 Alan Mackenzie <acm@muc.de>
......@@ -76,8 +88,8 @@
 
2007-04-08 Johan Bockg,Ae(Brd <bojohan+news@dd.chalmers.se>
 
* term/xterm.el (terminal-init-xterm): Fix key definitions. Add
binding for C-M-SPC.
* term/xterm.el (terminal-init-xterm): Fix key definitions.
Add binding for C-M-SPC.
 
2007-04-08 Richard Stallman <rms@gnu.org>
 
......@@ -142,8 +154,8 @@
 
* menu-bar.el (menu-bar-tools-menu): Revert 2003-07-25 change.
 
* desktop.el (desktop-create-buffer, desktop-save): Revert
2004-11-12 change.
* desktop.el (desktop-create-buffer, desktop-save):
Revert 2004-11-12 change for lack of copyright papers.
 
* dired-x.el (dired-guess-shell-case-fold-search): Delete var.
(dired-guess-default): Respect case.
......@@ -619,8 +619,7 @@ QUOTE may be `may' (value may be quoted),
(setq newlist (cons q.txt newlist)))
(setq p (cdr p)))
(if p
(let ((last (desktop-internal-v2s p))
(el (car newlist)))
(let ((last (desktop-internal-v2s p)))
(or anynil (setq anynil (null (car last))))
(or anynil
(setq newlist (cons '(must . ".") newlist)))
......@@ -782,7 +781,8 @@ See also `desktop-base-file-name'."
";; Desktop file format version " desktop-file-version "\n"
";; Emacs version " emacs-version "\n\n"
";; Global section:\n")
(mapcar (function desktop-outvar) desktop-globals-to-save)
(dolist (varspec desktop-globals-to-save)
(desktop-outvar varspec))
(if (memq 'kill-ring desktop-globals-to-save)
(insert
"(setq kill-ring-yank-pointer (nthcdr "
......@@ -790,7 +790,7 @@ See also `desktop-base-file-name'."
" kill-ring))\n"))
(insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
(mapcar #'(lambda (l)
(dolist (l info)
(when (apply 'desktop-save-buffer-p l)
(insert "("
(if (or (not (integerp eager))
......@@ -801,11 +801,9 @@ See also `desktop-base-file-name'."
"desktop-append-buffer-args")
" "
desktop-file-version)
(mapcar #'(lambda (e)
(dolist (e l)
(insert "\n " (desktop-value-to-string e)))
l)
(insert ")\n\n")))
info)
(setq default-directory dirname)
(let ((coding-system-for-write 'emacs-mule))
(write-region (point-min) (point-max) filename nil 'nomessage)))))
......@@ -941,14 +939,13 @@ directory DIRNAME."
(desktop-clear)
(desktop-read desktop-dirname))
(defvar desktop-buffer-major-mode)
(defvar desktop-buffer-locals)
;; ----------------------------------------------------------------------------
(defun desktop-restore-file-buffer (desktop-buffer-file-name
desktop-buffer-name
desktop-buffer-misc)
"Restore a file buffer."
(eval-when-compile ; Just to silence the byte compiler
(defvar desktop-buffer-major-mode)
(defvar desktop-buffer-locals))
(if desktop-buffer-file-name
(if (or (file-exists-p desktop-buffer-file-name)
(let ((msg (format "Desktop: File \"%s\" no longer exists."
......@@ -985,8 +982,12 @@ directory DIRNAME."
;; called from Desktop file only.
;; Just to silence the byte compiler.
(eval-when-compile
(defvar desktop-first-buffer)) ; Dynamically bound in `desktop-read'
(defvar desktop-first-buffer) ; Dynamically bound in `desktop-read'
;; Bound locally in `desktop-read'.
(defvar desktop-buffer-ok-count)
(defvar desktop-buffer-fail-count)
(defun desktop-create-buffer
(desktop-file-version
......@@ -1000,10 +1001,6 @@ directory DIRNAME."
desktop-buffer-misc
&optional
desktop-buffer-locals)
;; Just to silence the byte compiler. Bound locally in `desktop-read'.
(eval-when-compile
(defvar desktop-buffer-ok-count)
(defvar desktop-buffer-fail-count))
;; To make desktop files with relative file names possible, we cannot
;; allow `default-directory' to change. Therefore we save current buffer.
(save-current-buffer
......@@ -1045,21 +1042,22 @@ directory DIRNAME."
((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible
(auto-fill-mode 0))
(t
(mapcar #'(lambda (minor-mode)
(dolist (minor-mode desktop-buffer-minor-modes)
;; Give minor mode module a chance to add a handler.
(desktop-load-file minor-mode)
(let ((handler (cdr (assq minor-mode desktop-minor-mode-handlers))))
(if handler
(funcall handler desktop-buffer-locals)
(when (functionp minor-mode)
(funcall minor-mode 1)))))
desktop-buffer-minor-modes)))
;; Even though point and mark are non-nil when written by `desktop-save',
;; they may be modified by handlers wanting to set point or mark themselves.
(funcall minor-mode 1)))))))
;; Even though point and mark are non-nil when written by
;; `desktop-save', they may be modified by handlers wanting to set
;; point or mark themselves.
(when desktop-buffer-point
(goto-char
(condition-case err
;; Evaluate point. Thus point can be something like '(search-forward ...
;; Evaluate point. Thus point can be something like
;; '(search-forward ...
(eval desktop-buffer-point)
(error (message "%s" (error-message-string err)) 1))))
(when desktop-buffer-mark
......@@ -1167,7 +1165,7 @@ If there are no buffers left to create, kill the timer."
;; functions are processed after `after-init-hook'.
(add-hook
'after-init-hook
'(lambda ()
(lambda ()
(let ((key "--no-desktop"))
(when (member key command-line-args)
(setq command-line-args (delete key command-line-args))
......@@ -1176,5 +1174,5 @@ If there are no buffers left to create, kill the timer."
(provide 'desktop)
;;; arch-tag: 221907c3-1771-4fd3-9c2e-c6f700c6ede9
;; arch-tag: 221907c3-1771-4fd3-9c2e-c6f700c6ede9
;;; desktop.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment