[gnu.emacs.bug] saveconf.el

pearce@tycho.yerkes.uchicago.edu (Eric C. Pearce) (05/04/89)

I gave saveconf.el a try in 18.52.  It does not seem to correctly save
the context of a rmail buffer (probably because of all the narrowed
regions), with (save-buffer-context t).  The resulting in my mailbox
being muffed badly.

Am I missing something, or will rmail.el and saveconf.el just not get
along well.

--

     - Ecp

       Eric C. Pearce, Yerkes Observatory, University of Chicago.
       pearce@tycho.yerkes.uchicago.edu  or  pearce@oddjob.uchicago.edu

grunwald@flute.cs.uiuc.edu (05/05/89)

Right, I have the same problems with saveconf.el; I use the following
to avoid the problem:

(require 'saveconf)
(setq auto-save-and-recover-context t)
(setq save-context-predicate
      (function
       (lambda (w)
	 (and
	  ; nil?
	  (buffer-file-name (window-buffer w))
	  ; /usr/tmp or /tmp?
	  (not (string-match "^\\(/usr\\)?/tmp/"
			       (buffer-file-name (window-buffer w))))
	  ; rmail mode?
	  (let
	      ((isok t))
	    (save-excursion
	      (set-buffer (window-buffer w))
	      (setq isok
		    (not (or (eq major-mode 'rmail-mode)
			     (eq major-mode 'mail-mode)))))
	    isok))
	  )))

Also, attached are some patches useful when you have multiple hosts
viewing the same file-system via NFS & you want to have different
configurations saved for the different hosts (trust me, this is
actually useful). These are w.r.t. the recently posted saveconf.el

*** new-saveconf.el	Wed May  3 17:42:05 1989
--- saveconf.el	Wed May  3 17:49:54 1989
***************
*** 55,60 ****
--- 55,71 ----
  value of this variable the `recover-context' command will ignore the file's
  contents.")
  
+ (defvar save-context-per-host t
+   "Flag to determine if contexts should be defined per-host
+    or per-user")
+ 
+ (defvar save-context-file-postfix
+   (if save-context-per-host
+       (concat ".emacs-" (system-name) "-" (user-login-name))
+     (concat ".emacs-" (user-login-name)))
+   "*Buffer file name postfix for saveconf, providing individual configurations
+    in a multi-machine NSF environment")
+ 
  (defvar auto-save-and-recover-context nil
    "*If non-nil the `save-context' command will always be run before Emacs is
  exited.  Also upon Emacs startup, if this variable is non-nil and Emacs is
***************
*** 121,127 ****
    (condition-case error-data
        (let (context-buffer mark save-file-name)
  	(setq save-file-name (concat (original-working-directory)
! 				     ".emacs_" (user-login-name)))
  	(if (not (file-writable-p save-file-name))
  	    (if (file-writable-p (original-working-directory))
  		(error "context is write-protected, %s" save-file-name)
--- 132,138 ----
    (condition-case error-data
        (let (context-buffer mark save-file-name)
  	(setq save-file-name (concat (original-working-directory)
! 				     save-context-file-postfix))
  	(if (not (file-writable-p save-file-name))
  	    (if (file-writable-p (original-working-directory))
  		(error "context is write-protected, %s" save-file-name)
***************
*** 213,219 ****
        ;;
        (let (sexpr context-buffer recover-file-name)
  	(setq recover-file-name (concat (original-working-directory)
! 					".emacs_" (user-login-name)))
  	(if (not (file-readable-p recover-file-name))
  	    (error "can't access context, %s" recover-file-name))
  	;;
--- 224,230 ----
        ;;
        (let (sexpr context-buffer recover-file-name)
  	(setq recover-file-name (concat (original-working-directory)
! 					save-context-file-postfix))
  	(if (not (file-readable-p recover-file-name))
  	    (error "can't access context, %s" recover-file-name))
  	;;

--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu

kjones@talos.UUCP (Kyle Jones) (05/08/89)

Eric C. Pearce writes:
 > I gave saveconf.el a try in 18.52.  It does not seem to correctly save
 > the context of a rmail buffer (probably because of all the narrowed
 > regions), with (save-buffer-context t).  The resulting in my mailbox
 > being muffed badly.
 > 
 > Am I missing something, or will rmail.el and saveconf.el just not get
 > along well.

I tried using RMAIL and saveconf and noted that the buffer and position
for ~/RMAIL were restored as advertised.  However the buffer was not put
into RMAIL mode.  When I ran M-x rmail to put the buffer in the right
major mode I get

Symbol's value as variable is void: rmail-inbox-list

which makes me think RMAIL doesn't expect the primary mail file
(rmail-file-name) to be already visited when RMAIL is run.  What kind of
lossage did you experience, Eric?