[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: desktop~ ?
Re: desktop~ ?
Tue, 17 Sep 2002 10:36:01 -0700
i've hacked desktop-save to do this and load my version in my
.emacs file. it's below. i've only made a few changes to it.
;;------------------------------------------------- -save ----
(message "Set my redefine desktop-save...")
;; *** Why do I redefine desktop-save?
;; Because, the normal desktop-save doesn't make backup copies!
(defun desktop-save (dirname)
"Save the Desktop file. Parameter DIRNAME specifies where to save desktop."
(interactive "DDirectory to save desktop file in: ")
(let* ((filename (expand-file-name
(concat dirname desktop-basefilename)))
(function (lambda (b)
(list ; list explaining minor modes
(not (null auto-fill-function)))
(list (mark t) mark-active)
(cond ((eq major-mode 'Info-mode)
((eq major-mode 'dired-mode)
(let ((locals desktop-locals-to-save)
(let ((here (assq (car locals) loclist)))
(setq ll (cons here ll))
(if (member (car locals) loclist)
(setq ll (cons (car locals) ll)))))
(setq locals (cdr locals)))
;(buf (get-buffer-create "*desktop*")) ;cs 020701
(buf (find-file-noselect filename)))
";; Created " (current-time-string) "\n"
";; Emacs version " emacs-version "\n\n"
";; Global section:\n")
(mapcar (function desktop-outvar) desktop-globals-to-save)
(if (memq 'kill-ring desktop-globals-to-save)
(insert "(setq kill-ring-yank-pointer (nthcdr "
(- (length kill-ring) (length kill-ring-yank-pointer)))
(insert "\n;; Buffer section:\n")
(function (lambda (l)
(if (apply 'desktop-save-buffer-p l)
(function (lambda (e)
(insert "\n "
(setq default-directory dirname)
; (if (file-exists-p filename) (delete-file filename))
; (write-region (point-min) (point-max) filename nil 'nomessage)
(save-buffer) ;cs 020701
(kill-buffer buf) ;ensure a backup is made every time, if desired. ;cs
(setq desktop-dirname dirname))
Thomas L Roche wrote:
> Has anyone got a way to make 'desktop' back up its most-recently-used
> file? Why I ask:
> I recently whacked my desktop file when emacs (GNU Emacs 21.1.1
> i386-msvc-nt5.0.2195) of 2001-10-22 on buffy) abended. Fortunately, at
> my main workstation, all my emacs stuff gets backed up nightly, so I
> just restored. Unfortunately I don't have such luxury everywhere I
> run. So I'd like to make desktop back up its MRU file, e.g. to
> desktop~ in the "normal emacsian manner."
> I notice that *Customize Group: Desktop* has a Desktop Save Hook:
> anyone got code for that? Or an advice?
> Apologies if this is a FAQ, but I didn't see anything in the info.
> Help-gnu-emacs mailing list
What is life without looking for . . `; -._ )-;-,_`)
the next cute little bug to play with? v_,- _ ),(,.\ ``-'
_.- _.,-_/ / ((.'
-- address@hidden `<}:.. ((,.-' ((,/
- desktop~ ?, Thomas L Roche, 2002/09/17
- Re: desktop~ ?,
Chuck Siska <=