aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-12-23 04:59:47 +0000
committerRichard M. Stallman1993-12-23 04:59:47 +0000
commitb6105c76eec3316272e2bf7918fe07b3965b0d9d (patch)
tree5fa84bde95319fe2f07a5736a55601f91e4d5a0d
parent57b908e3c061220d806f8809bf05ae818efecdb5 (diff)
downloademacs-b6105c76eec3316272e2bf7918fe07b3965b0d9d.tar.gz
emacs-b6105c76eec3316272e2bf7918fe07b3965b0d9d.zip
Add keywords.
(desktop-outvar): clean-up output using fewer quotes and \n for newlines. (desktop-save): print buffer information using \n for newlines. (desktop-save-buffer-p): doc fix. (desktop-save): bug in mark-activity saving. (desktop-buffer-rmail): doc fix. (desktop-buffer-rmail, desktop-buffer-dired, desktop-buffer): Use `eq' instead of `equal'. (desktop-clear): end up with one window.
-rw-r--r--lisp/desktop.el72
1 files changed, 40 insertions, 32 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 405f6a243fe..66f8417a8cb 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -3,7 +3,9 @@
3;; Copyright (C) 1993 Free Software Foundation, Inc. 3;; Copyright (C) 1993 Free Software Foundation, Inc.
4 4
5;; Author: Morten Welinder <terra@diku.dk> 5;; Author: Morten Welinder <terra@diku.dk>
6;; Version: 2.02 6;; Version: 2.03
7;; Keywords: customization
8;; Favourite-brand-of-beer: None, I hate beer.
7 9
8;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
9 11
@@ -87,7 +89,7 @@ Otherwise simply ignore the file.")
87 'tags-file-name 89 'tags-file-name
88 'tags-table-list 90 'tags-table-list
89 ;; 'desktop-globals-to-save ; Itself! 91 ;; 'desktop-globals-to-save ; Itself!
90 ) 92 )
91 "List of global variables to save when killing Emacs.") 93 "List of global variables to save when killing Emacs.")
92 94
93;; We skip .log files because they are normally temporary. 95;; We skip .log files because they are normally temporary.
@@ -125,7 +127,8 @@ If the function returns t then the buffer is considered created.")
125 (interactive) 127 (interactive)
126 (setq kill-ring nil) 128 (setq kill-ring nil)
127 (setq kill-ring-yank-pointer nil) 129 (setq kill-ring-yank-pointer nil)
128 (mapcar (function kill-buffer) (buffer-list))) 130 (mapcar (function kill-buffer) (buffer-list))
131 (delete-other-windows))
129;; ---------------------------------------------------------------------------- 132;; ----------------------------------------------------------------------------
130;; This is a bit dirty for version 18 because that version of Emacs was not 133;; This is a bit dirty for version 18 because that version of Emacs was not
131;; toilet-trained considering hooks. 134;; toilet-trained considering hooks.
@@ -146,21 +149,26 @@ If the function returns t then the buffer is considered created.")
146 (progn 149 (progn
147 (desktop-save desktop-dirname)))) 150 (desktop-save desktop-dirname))))
148;; ---------------------------------------------------------------------------- 151;; ----------------------------------------------------------------------------
149(defun desktop-outvar (VAR) 152(defun desktop-outvar (var)
150 "Output a setq statement for VAR to the desktop file." 153 "Output a setq statement for VAR to the desktop file."
151 (if (boundp VAR) 154 (if (boundp var)
152 (progn 155 (let ((print-escape-newlines t)
156 (val (symbol-value var)))
153 (insert "(setq ") 157 (insert "(setq ")
154 (prin1 VAR (current-buffer)) 158 (prin1 var (current-buffer))
155 (insert " '") 159 ;; symbols are needed for cons cells and for symbols except
156 (prin1 (symbol-value VAR) (current-buffer)) 160 ;; `t' and `nil'.
161 (if (or (consp val)
162 (and (symbolp val) val (not (eq t val))))
163 (insert " '")
164 (insert " "))
165 (prin1 val (current-buffer))
157 (insert ")\n")))) 166 (insert ")\n"))))
158;; ---------------------------------------------------------------------------- 167;; ----------------------------------------------------------------------------
159(defun desktop-save-buffer-p (filename bufname mode) 168(defun desktop-save-buffer-p (filename bufname mode)
160 "Return t if should record a particular buffer for next startup. 169 "Return t if the desktop should record a particular buffer for next startup.
161FILENAME is the visited file name, BUFNAME is the buffer name, and 170FILENAME is the visited file name, BUFNAME is the buffer name, and
162MODE is the major mode." 171MODE is the major mode."
163
164 (or (and filename 172 (or (and filename
165 (not (string-match desktop-buffers-not-to-save bufname))) 173 (not (string-match desktop-buffers-not-to-save bufname)))
166 (and (null filename) 174 (and (null filename)
@@ -188,7 +196,7 @@ MODE is the major mode."
188 auto-fill-hook))))) 196 auto-fill-hook)))))
189 (point) 197 (point)
190 (if postv18 198 (if postv18
191 (list 'quote (mark t) mark-active) 199 (list 'quote (list (mark t) mark-active))
192 (mark)) 200 (mark))
193 buffer-read-only 201 buffer-read-only
194 truncate-lines 202 truncate-lines
@@ -226,21 +234,22 @@ MODE is the major mode."
226 " kill-ring))\n")) 234 " kill-ring))\n"))
227 235
228 (insert "\n;; Buffer section:\n") 236 (insert "\n;; Buffer section:\n")
229 (mapcar 237 (let ((print-escape-newlines t))
230 (function (lambda (l) 238 (mapcar
231 (if (desktop-save-buffer-p 239 (function (lambda (l)
232 (car l) 240 (if (desktop-save-buffer-p
233 (nth 1 l) 241 (car l)
234 (nth 1 (nth 2 l))) 242 (nth 1 l)
235 (progn 243 (nth 1 (nth 2 l)))
236 (insert "(desktop-buffer") 244 (progn
237 (mapcar 245 (insert "(desktop-buffer")
238 (function (lambda (e) 246 (mapcar
239 (insert "\n ") 247 (function (lambda (e)
240 (prin1 e (current-buffer)))) 248 (insert "\n ")
241 l) 249 (prin1 e (current-buffer))))
242 (insert ")\n\n"))))) 250 l)
243 info) 251 (insert ")\n\n")))))
252 info))
244 (setq default-directory dirname) 253 (setq default-directory dirname)
245 (if (file-exists-p filename) (delete-file filename)) 254 (if (file-exists-p filename) (delete-file filename))
246 (write-region (point-min) (point-max) filename nil 'nomessage))) 255 (write-region (point-min) (point-max) filename nil 'nomessage)))
@@ -288,12 +297,12 @@ autoloaded files."
288 (Info-find-node (nth 0 misc) (nth 1 misc)) 297 (Info-find-node (nth 0 misc) (nth 1 misc))
289 t))) 298 t)))
290;; ---------------------------------------------------------------------------- 299;; ----------------------------------------------------------------------------
291(defun desktop-buffer-rmail () "Load a RMAIL file." 300(defun desktop-buffer-rmail () "Load an RMAIL file."
292 (if (equal 'rmail-mode mam) 301 (if (eq 'rmail-mode mam)
293 (progn (rmail-input fn) t))) 302 (progn (rmail-input fn) t)))
294;; ---------------------------------------------------------------------------- 303;; ----------------------------------------------------------------------------
295(defun desktop-buffer-dired () "Load a directory using dired." 304(defun desktop-buffer-dired () "Load a directory using dired."
296 (if (equal 'dired-mode mam) 305 (if (eq 'dired-mode mam)
297 (progn 306 (progn
298 (dired (car misc)) 307 (dired (car misc))
299 (mapcar (function dired-maybe-insert-subdir) (cdr misc)) 308 (mapcar (function dired-maybe-insert-subdir) (cdr misc))
@@ -319,7 +328,7 @@ autoloaded files."
319 (setq handler (car hlist)) 328 (setq handler (car hlist))
320 (setq result (funcall handler)) 329 (setq result (funcall handler))
321 (setq hlist (cdr hlist))) 330 (setq hlist (cdr hlist)))
322 (if (equal result t) 331 (if (eq result t)
323 (progn 332 (progn
324 (if (not (equal (buffer-name) bn)) 333 (if (not (equal (buffer-name) bn))
325 (rename-buffer bn)) 334 (rename-buffer bn))
@@ -346,4 +355,3 @@ autoloaded files."
346(provide 'desktop) 355(provide 'desktop)
347 356
348;; desktop.el ends here. 357;; desktop.el ends here.
349