[comp.emacs] Problem with rmail

erf@progress.UUCP (Eric Feigenson) (07/07/90)

I hope someone out there can help me...

I started using saveconf as someone recently suggested (I didn't even know it was
around!) with GNU Emacs 18.55.  However, as soon as I did I started having odd
problems with "rmail", which had been working perfectly.  It may be a coincidence,
but the problems started almost exactly at the time I started using saveconf.

The problem is that as soon as I do a "M-x rmail" I get a message:

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

and an occasional similar message with rmail-inbox-list replaced by nil (that is,
the three letters n i l).  This seems to happen mainly when rmail has already
been run.

I just tried it again, and I can't issue the "h" (for headers) command... the
'h' just gets inserted in the buffer.

If I do another "M-x rmail", things seem to work, until I give the 'q' command,
at which point I get the message "Wrong type argument: integer-or-marker-p, nil".
Issuing the 'h' command at this point yields the same message.

As I say, I don't know for sure if it's an interaction with saveconf, but it
sure looks suspicious.  If anyone has *any* idea what's going on, I'd appreciate
it if you'd let me know.  If you have a fix, that's even better!

Please reply to progress!erf@eddie.mit.edu, as the From: headers usually get
pretty badly munged.

Thanks!

-Eric

-- 
----------
Eric R. Feigenson			UUCP: mit-eddie!progress!erf
Progress Software Corp.		    Internet: progress!erf@eddie.mit.edu
5 Oak Park, Bedford, MA  01730

kjones@talos.pm.com (Kyle Jones) (07/09/90)

Eric R. Feigenson writes:
 > I started using saveconf as someone recently suggested (I
 > didn't even know it was around!) with GNU Emacs 18.55.
 > However, as soon as I did I started having odd problems with
 > "rmail", which had been working perfectly.  It may be a
 > coincidence, but the problems started almost exactly at the
 > time I started using saveconf.
 > 
 > The problem is that as soon as I do a "M-x rmail" I get a message:
 > 
 > 	"Symbol's value as variable is void: rmail-inbox-list"

As I recall, the problem is with RMAIL.  If an uninitialized
~/RMAIL file buffer exists when RMAIL is invoked, RMAIL will get
confused and die.

saveconf.el stimulates the bug as follows: You exit Emacs with a
~/RMAIL buffer present.  You start a new Emacs session and
saveconf dutifully visits ~/RMAIL.  When you subsequently start
RMAIL it sees the buffer and (mistakenly) assumes that certain
local variables have been initialized.

ag@sics.se (Anders G|ransson) (07/10/90)

>>>>> In article <1990Jul9.141448.15783@talos.pm.com>, kjones@talos.pm.com (Kyle Jones) writes:

kjones> Eric R. Feigenson writes:
 > I started using saveconf as someone recently suggested (I
 > didn't even know it was around!) with GNU Emacs 18.55.
 > However, as soon as I did I started having odd problems with
 > "rmail", which had been working perfectly.  It may be a
 > coincidence, but the problems started almost exactly at the
 > time I started using saveconf.
 > 
 > The problem is that as soon as I do a "M-x rmail" I get a message:
 > 
 > 	"Symbol's value as variable is void: rmail-inbox-list"

kjones> As I recall, the problem is with RMAIL.  If an uninitialized
kjones> ~/RMAIL file buffer exists when RMAIL is invoked, RMAIL will get
kjones> confused and die.

kjones> saveconf.el stimulates the bug as follows: You exit Emacs with a
kjones> ~/RMAIL buffer present.  You start a new Emacs session and
kjones> saveconf dutifully visits ~/RMAIL.  When you subsequently start
kjones> RMAIL it sees the buffer and (mistakenly) assumes that certain
kjones> local variables have been initialized.



I have the same problem (at least it seems to be related). I use
the code that was presented here some week ago. To be precise it 
looks like this;

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;;Save buffer context so that the conf. shows upon entering emacs
(require 'saveconf)
(setq auto-save-and-recover-context t)
(setq save-buffer-context t)
(if (null (cdr command-line-args))
    (setq inhibit-startup-message (recover-context)))

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Since then the files are there when I enter emacs BUT the buffer has 
forgotten which mode it was in. For exampel, if I exit emacs (with C-x C-c)
from Rmail-mode, then when I enter emacs again there is the file RMAIL
but the buffer is now in Fundamental-mode. This is not what I hoped for!

There must be some way to tell emacs that the mode should be kept the same!


Please let me know!


Best regards  Anders




--
  name(!): Anders G|ransson

kjones@talos.pm.com (Kyle Jones) (07/11/90)

Anders G|ransson writes about trouble using saveconf.el:
 > The files are there when I enter emacs BUT the buffer has 
 > forgotten which mode it was in. For exampel, if I exit emacs (with C-x C-c)
 > from Rmail-mode, then when I enter emacs again there is the file RMAIL
 > but the buffer is now in Fundamental-mode. This is not what I hoped for!
 > 
 > There must be some way to tell emacs that the mode should be
 > kept the same!

The standard way to cause a file to be visited under w particular
major mode is to add a pattern for that type of file in auto-mode-alist.
I.e.

(setq auto-mode-alist (cons '("RMAIL$" . rmail-mode) auto-mode-alist))

I don't know whether calling rmail-mode in this fashion will work
as expected or not.

weiner@novavax.UUCP (Bob &) (07/13/90)

OK, for all you people trying to restore your GNU Emacs configuration
between sessions, here is my most recent version of em-config.el that
handles rmail and Info buffers properly, tries to save window
configurations and works superbly with the 'ange-ftp' package, so that
remote files may also be restored.

Enjoy, and donate to the Free Software Foundation if you can, if you
like it.  I've actually been using it (aside from one change today) for
months and it does everything I and most people should need.
Unfortunately, I've never had time to properly document the internals,
but the user interface is simplistic.

;;!emacs
;;
;; FILE:         em-config.el
;; SUMMARY:      Save and restore Emacs configurations between sessions.
;; USAGE:        GNU Emacs Lisp Library
;;
;; AUTHOR:       Bob Weiner
;; E-MAIL:       USENET:  weiner@novavax.UUCP
;;
;; ORIG-DATE:    22-Aug-89 at 16:07:48
;; LAST-MOD:     12-Jul-90 at 13:25:52 by Bob Weiner
;;
;; Copyright (C) 1989 Bob Weiner and Free Software Foundation, Inc.
;; Available for use and distribution under the same terms as GNU Emacs.
;;
;; This file is not part of GNU Emacs.
;;
;; DESCRIPTION:  
;;
;;   Currently saves only unmodified buffers visiting files.  Also
;;   saves only limited information about buffers.  It may not work
;;   properly with subsystem buffers that visit files.  It is best to
;;   kill these before saving a configuration.
;;
;;   The exceptions are that:
;;     An Info buffer is handled properly, so it need not be deleted.
;;     Any buffer in rmail-mode is not saved.  Thus, when 'rmail' is
;;     invoked it works properly.
;;
;;   To enable reading of Emacs state from last session at the start
;;   of a new session, put the following in your personal Emacs init file:
;;
;;          (load-library "em-config")
;;          (emc-restore)
;;
;;   Follow the above with this code to enable saving of Emacs state
;;   when quitting a session:
;;
;;         (defun save-buffers-kill-emacs (&optional arg)
;;            "Offer to save each buffer, save file configuration, then kill this Emacs fork.
;;         With prefix arg, silently save all file-visiting buffers, then kill."
;;           (interactive "P")
;;           (save-some-buffers arg t)
;;           (emc-save)
;;           (kill-emacs))
;;
;; DESCRIP-END.

(defconst emc-file "~/.em-config"
  "Default file into which to save Emacs session data.")

(defconst emc-wconfigs-file "~/.em-wconfigs"
  "Default file into which to save Emacs window configuration ring data.")

(defvar emc-start-file nil
  "Last file to read in each time the default Emacs configuration is loaded.
This makes it the first file seen by the user.")

;;; User settings to control data that is saved and restored.  The restore
;;; will fail if any of these values are changed after a 'save' but before a
;;; 'restore'.  Always change values before a 'save'.
;;;
(defconst emc-save-session-data-p t)
(defconst emc-restore-session-data-p nil)
(defconst emc-save-buffer-data-p t)
(defconst emc-save-wconfig-ring-p t)
(defconst emc-save-window-data-p t)

(defun emc-save (&optional file)
  "Save Emacs configuration to optional FILE or 'emc-file'."
  (interactive "FSave Emacs configuration to: ")
  (run-hooks 'emc-save-hook)
  (if (or (equal file "") (null file))
      (setq file emc-file))
  (let ((standard-output (set-buffer (find-file-noselect file)))
	(hdr))
    (erase-buffer)
    (if emc-save-session-data-p
	(progn (print "SESSION DATA")
	       (emc-save-session-data)))
    (if emc-save-buffer-data-p
	(progn (print "BUFFER DATA")
	       (emc-save-buffer-data)))
    (if emc-save-window-data-p
	(progn (set-buffer standard-output)
	       (save-excursion
		 (print "WINDOW DATA")
		 (emc-save-window-data))))
    (if emc-save-wconfig-ring-p
	(progn 
	  ;; Save ring of window configurations ahead of current window config.
	  (print "WINDOW CONFIG RING")
	  (emc-save-wconfig-ring)))
    ;; Add (goto-char (point-max)) here before adding another 'emc-save'
    ;; function call.
    (set-buffer standard-output)
    (save-buffer)
    ))

(defun emc-restore (&optional file)
  "Restore Emacs configuration from optional FILE or 'emc-file'.
Adds buffers to current buffer list.  Returns t if the restore is successful
or the restore file does not exist, otherwise returns a string indicating
the restore failure point."
  (interactive "fRestore Emacs configuration from: ")
  (run-hooks 'emc-restore-hook)
  (let ((hdr t))
    (if (or (equal file "") (null file))
	(setq file emc-file))
    (if (file-exists-p file)
	(let ((standard-input (set-buffer (find-file-noselect emc-file))))
	  (goto-char (point-min))
	  (if (and
		(or (not emc-save-session-data-p)
		    (and (setq hdr "SESSION DATA")
			 (emc-valid-hdr-p hdr)
			 (emc-read-session-data)))
		(or (not emc-restore-session-data-p)
		    (emc-restore-session-data))
		(or (not emc-save-buffer-data-p)
		    (and (setq hdr "BUFFER DATA")
			 (emc-valid-hdr-p hdr)
			 (emc-restore-buffer-data)))
		(if (or (< (screen-height) emc-screen-height)
			(< (screen-width) emc-screen-width))
		    (progn (beep)
			   (message "Skipping window restores, screen size shrunk since saved session.")
			   (sit-for 2)
			   t)
		  ;; This should come before restore of window data.
		  (and (or (not emc-save-wconfig-ring-p)
			   (and (setq hdr "WINDOW CONFIG RING")
				(emc-valid-hdr-p hdr)
				(emc-restore-wconfig-ring)))
		       (or (not emc-save-window-data-p)
			   (and (setq hdr "WINDOW DATA")
				(emc-valid-hdr-p hdr)
				(emc-restore-window-data))))))
	      (progn (kill-buffer standard-input)
		     (and emc-start-file (equal file emc-file)
			  (file-exists-p emc-start-file)
			  (find-file emc-start-file))
		     (setq hdr t)))
	  ))
    hdr))


(defun emc-save-wconfigs (&optional file)
  "Save Emacs window configuration ring to optional FILE or 'emc-wconfigs-file'."
  (interactive "FSave Emacs window configuration ring to: ")
  (run-hooks 'emc-save-hook)
  (if (or (equal file "") (null file))
      (setq file emc-wconfigs-file))
  (let ((standard-output (set-buffer (find-file-noselect file)))
	(hdr))
    (erase-buffer)
    (set-buffer standard-output)
    (print "WINDOW CONFIG RING")
    (emc-save-wconfig-ring)
    ;; Add (goto-char (point-max)) here before adding another 'emc-save'
    ;; function call.
    (set-buffer standard-output)
    (save-buffer)
    ))

(defun emc-restore-wconfigs (&optional file)
  "Restore Emacs window configuration ring from optional FILE or 'emc-wconfigs-file'.
Returns t if the restore is successful or the restore file does not exist,
otherwise returns a string indicating the restore failure point."
  (interactive "fRestore Emacs window configuration ring from: ")
  (run-hooks 'emc-restore-hook)
  (let ((hdr t))
    (if (or (equal file "") (null file))
	(setq file emc-wconfigs-file))
    (if (file-exists-p file)
	(let ((standard-input (set-buffer (find-file-noselect emc-file))))
	  (goto-char (point-min))
	  (if (or (not emc-save-wconfig-ring-p)
		  (and (setq hdr "WINDOW CONFIG RING")
		       (emc-valid-hdr-p hdr)
		       (emc-restore-wconfig-ring)))
	      (progn (kill-buffer standard-input)
		     (setq hdr t))
	    )))
    hdr))


(defun emc-valid-hdr-p (hdr)
  (equal (read) hdr))

(defun buffer-major-mode= (buf mode)
  (eq (cdr (assq 'major-mode (buffer-local-variables buf))) mode))

(defun emc-save-buffer-data ()
  ;; Save only buffers visiting files; skip some in special modes.
  (let ((buf-list (mapcar '(lambda (buf)
			     (let ((bn (buffer-name buf)))
			       (if (and (not (buffer-major-mode= buf 'Info-mode))
					(or (null (buffer-file-name buf))
					    (string-match "^[ \*].*\*$" bn)
					    (buffer-major-mode= buf 'rmail-mode)
					    (equal bn (buffer-name
							standard-output))))
				   nil
				 bn)))
			  (nreverse (buffer-list)))))
    (print buf-list)
    (mapcar '(lambda (buf)
	       (if (null buf)
		   nil
		 (set-buffer buf)
		 (if (eq major-mode 'Info-mode)
		     (progn (print major-mode)
			    (print Info-current-file)
			    (print Info-current-node)
			    (print (point)))
		   (print major-mode)
		   (print (buffer-name))
		   (print (buffer-file-name))
		   (print buffer-read-only)
		   (print (point))
		   ;; t if buffer is narrowed
		   (print (if (or (/= (point-min) 1)
				  (/= (point-max) (1+ (buffer-size)))) t))
		   (print (point-min))
		   (print (point-max))
		   )))
	    buf-list)
    ))

(defun emc-restore-buffer-data ()
  (let ((buf-list (read))
	(buf-name) (file) (mode)
	(buf-read-only) (point)
	(point-min) (point-max)
	(narrowed-p)
	(mark-list))
    (mapcar '(lambda (buf)
	       (if (null buf)
		   nil
		 (setq mode (read))
		 (if (eq mode 'Info-mode)
		     (progn (info)
			    (Info-find-node (read) (read))
			    (goto-char (read)))
		   (setq buf-name (read)
			 file (read)
			 buf-read-only (read)
			 point (read)
			 narrowed-p (read) ;; t if buffer was narrowed
			 point-min (read)
			 point-max (read))
		   (if (or (file-exists-p file)
			   (and (featurep 'ange-ftp)
				(string-match 
				  (if (boundp 'ange-ftp-path-user-exp)
				      ;; Old style
				      (concat "^" ange-ftp-path-user-exp
					      ange-ftp-path-host-exp
					      ange-ftp-path-path-exp)
				      ;; New style
				    (concat "^" (car ange-ftp-path-format)))
				  file)))
		       (progn (find-file file)
			      (or (get-buffer buf-name)
				  (rename-buffer buf-name))
			      (setq buffer-read-only buf-read-only)
			      (and mode (funcall mode))
			      (if (<= point (point-max))
				  (goto-char point))
			      (if (and narrowed-p
				       (or (< point-max (point-max))
					   (> point-min (point-min))))
				  (narrow-to-region point-min point-max)))))))
	    buf-list)
    ;;
    ;; Might want to do stuff and set buffer local variables from src/buffer.c.
    ;;
    )
  t)

;;;
;;; Often won't work properly when used with an external window system.
;;; 
(defun emc-save-session-data ()
  (print (screen-height))
  (print (screen-width))
  )

(defun emc-read-session-data ()
  (setq emc-screen-height (read))
  (setq emc-screen-width (read))
  t)

;; Must only be called after 'emc-read-session-data'.
(defun emc-restore-session-data ()
  (set-screen-height emc-screen-height)
  (set-screen-width emc-screen-width)
  t)

;;;
;;; Should be done after current window configuration is saved but output of
;;; this function should be written in save file AHEAD of the output from
;;; current window configuration.  This allows the current to be the last
;;; config restored, as one would desire.
;;;
(defun emc-save-wconfig-ring ()
  ;; Assumes point is at proper position in standard-output.
  (if (or (not (featurep 'wconfig)) (null wconfig-ring))
      (print 0) ;; No wconfigs stored.
    (let ((wconfig-list (reverse wconfig-ring)))
      (print (length wconfig-list))
      (mapcar
	'(lambda (w)
	   (set-window-configuration w)
	   (emc-save-window-data))
	wconfig-list))))

;;;
;;; Should be done before last current window configuration is restored.
;;;
(defun emc-restore-wconfig-ring ()
  (let ((n (read))) ;; Number of window-configurations saved.
    (if (<= n 0)
	nil
      (if (not (featurep 'wconfig)) (load "wconfig"))
      (setq wconfig-ring nil) ;; Clear out any window configurations.
      (if (> n wconfig-ring-max) (setq wconfig-ring-max n))
      (while (> n 0)
	(setq n (1- n))
	(emc-restore-window-data)
	(wconfig-ring-save))))
  t)


(defun emc-save-window-data ()
  (goto-char (point-max))
  (let ((wind-list (nreverse (emc-window-list 1))))
    (print (length wind-list))
    (mapcar
      '(lambda (w)
	 (select-window w)
	 (let* ((bn (buffer-name))
		(buf (get-buffer bn)))
	   (if (or (string-match "^[ \*].*\*$" bn)
		   (buffer-major-mode= buf 'rmail-mode)
		   (equal bn (buffer-name standard-output))
		   (and (not (buffer-major-mode= buf 'Info-mode))
			(null (buffer-file-name buf))))
	       (print nil)
	     (print (buffer-file-name))
	     (print (buffer-name))
	     (print (window-edges))
	     (print (window-point))
	     (print (window-start))
	     (print (window-hscroll))
	     )))
      wind-list)))

(defun emc-read-window-data ()
  (let* ((num-windows (read))
	 (n num-windows)
	 (wind-list)
	 (buf-name) (file)
	 (window-edges) (window-point) (window-start) (window-hscroll))
    (while (> n 0)
      (setq n (1- n)
	    file (read))
      (if (null file)
	  nil
	(setq buf-name (read))
	(if (file-exists-p file)
	    (progn (setq window-edges (read))
		   (setq window-point (read))
		   (setq window-start (read))
		   (setq window-hscroll (read)))
	  ;; Skip irrelevant data.
	  (read) (read) (read) (read)))
      (setq wind-list (cons (list window-edges file buf-name window-point
				  window-start window-hscroll) wind-list))
      )
    wind-list))


;; WORK IN PROGRESS

;;window-edges:
;;Return a list of the edge coordinates of WINDOW.
;;(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of screen.
;;RIGHT is one more than the rightmost column used by WINDOW,
;;and BOTTOM is one more than the bottommost row used by WINDOW
;; and its mode-line.

(defun emc-calc-window-splits ()
  (let* ((wind-list (emc-read-window-data))
	 (wind-tops) (winds-per-top))
    ;; Compute set of unique window top positions.
    (mapcar '(lambda (w)
	       (set-cons wind-tops (car (cdr (car w))))
	       wind-list))
    ;; Order tops in descending order
    (setq wind-tops (sort wind-tops '>))
    ;; Calc num of windows at each top position (num horiz windows)
    (setq winds-per-top
	  (mapcar '(lambda (wt)
		     (apply '+ (mapcar '(lambda (w)
					  (if (= wt (car (cdr (car w)))) 1 0)
					  wind-list))))
		  wind-tops))
    (let ((wpt (apply '+ winds-per-top))
	  (winds (length wind-list)))
      (if (/= wpt winds)
	  (error "Bug in 'emc-calc-window-splits', wpt = %s, winds = %s" wpt
		 winds))
      (emc-split-windows-vert wind-tops)
      )))


;; Remember windows that share a top dimension, do not have to share a bottom
;; one, so can't always do all vertical splitting before all horizontal.

(defun emc-split-windows-vert (wind-tops)
  (let* ((n (length wind-tops))
	 (i 0)
	 (window-min-height 2)
	 (prev-window-top 0) (top))
    (delete-other-windows)
    (while (< i n)
      (split-window)
      ;; If top edge of window is less than previous, then size
      ;; current window.
      (setq top (nth i wind-tops))
      (if (<= top prev-window-top)
	  (progn (shrink-window (- (window-height)
				   ;; NOT DONE
				   (- (nth 3 window-edges) top)))
		 (other-window 1))
	(let ((owin (selected-window)))
	  (other-window 1)
	  (shrink-window (- (window-height)
			    (- (nth 3 window-edges) top)))
	  (select-window owin)))
      (setq prev-window-top top)
      (setq i (1+ i))
      )))


;;;
;;; Not finished; have to figure out how to set vertical window edges properly.
;;; Therefore does not yet handle side-by-side window splits.
;;;
(defun emc-restore-window-data ()
  (let* ((num-windows (read))
	 (n num-windows)
	 (buf-name) (file) (window-edges)
	 (window-min-height 2)
	 (prev-window-top 0))
    (delete-other-windows)
    (while (> n 0)
      (setq n (1- n)
	    file (read))
      (if (null file)
	  nil
	(setq buf-name (read))
	(if (file-exists-p file)
	    (progn (find-file file)
		   (or (get-buffer buf-name)
		       (rename-buffer buf-name))
		   (setq window-edges (read))
		   (set-window-point (selected-window) (read))
		   (set-window-start (selected-window) (read))
		   (set-window-hscroll (selected-window) (read))
		   ;; Set top and bottom window edges here.
		   (if (= n 0)
		       nil
		     (split-window)
		     ;; If top edge of window is less than previous then size
		     ;; current window.
		     (let ((top (nth 1 window-edges)))
		       (if (> top prev-window-top)
			   (let ((owin (selected-window)))
			     (other-window 1)
			     (shrink-window (- (window-height)
					       (- (nth 3 window-edges) top)))
			     (select-window owin)) 
			 (shrink-window (- (window-height)
					   (- (nth 3 window-edges) top)))
			 (other-window 1))
		       (setq prev-window-top top))))
	  ;; Skip irrelevant data.
	  (read) (read) (read) (read)))
      ))
  t)


;;;
;;; Copyright (C) 1987, 1988 Kyle E. Jones
;;;
(defun emc-window-list (&optional mini)
  "Returns a list of Lisp window objects for all Emacs windows.
Optional first arg MINIBUF t means include the minibuffer window
in the list, even if it is not active.  If MINIBUF is neither t
nor nil it means to not count the minibuffer window even if it is active."
  (let* ((first-window (next-window (previous-window (selected-window)) mini))
	 (windows (cons first-window nil))
	 (current-cons windows)
	 (w (next-window first-window mini)))
    (while (not (eq w first-window))
      (setq current-cons (setcdr current-cons (cons w nil)))
      (setq w (next-window w mini)))
    windows))


(provide 'em-config)
--
Bob Weiner	    Usenet:   ...!gatech!uflorida!novavax!weiner
			      Internet: weiner%novavax@bikini.cis.ufl.edu

fgth@ugus21.uucp (Frank Ridderbusch Tel. 4685) (07/13/90)

In article <1990Jul9.173737.26777@sics.se> ag@sics.se (Anders G|ransson) writes:
>>>>>> In article <1990Jul9.141448.15783@talos.pm.com>, kjones@talos.pm.com (Kyle Jones) writes:
>
>kjones> Eric R. Feigenson writes:
> > I started using saveconf as someone recently suggested (I
> > didn't even know it was around!) with GNU Emacs 18.55.
> > However, as soon as I did I started having odd problems with
> > "rmail", which had been working perfectly.  It may be a
> > coincidence, but the problems started almost exactly at the
> > time I started using saveconf.
> > 
> > The problem is that as soon as I do a "M-x rmail" I get a message:
> > 
> > 	"Symbol's value as variable is void: rmail-inbox-list"
>
>kjones> As I recall, the problem is with RMAIL.  If an uninitialized
>kjones> ~/RMAIL file buffer exists when RMAIL is invoked, RMAIL will get
>kjones> confused and die.
>
>kjones> saveconf.el stimulates the bug as follows: You exit Emacs with a
>kjones> ~/RMAIL buffer present.  You start a new Emacs session and
>kjones> saveconf dutifully visits ~/RMAIL.  When you subsequently start
>kjones> RMAIL it sees the buffer and (mistakenly) assumes that certain
>kjones> local variables have been initialized.
>
>
>
>I have the same problem (at least it seems to be related). I use
>the code that was presented here some week ago. To be precise it 
>looks like this;
>
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>;;Save buffer context so that the conf. shows upon entering emacs
>(require 'saveconf)
>(setq auto-save-and-recover-context t)
>(setq save-buffer-context t)
>(if (null (cdr command-line-args))
>    (setq inhibit-startup-message (recover-context)))
>
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
Hi there.

I run into the same problems, when running the PCMAIL mail reader.
Saveconf.el had saved some buffers, but on new startup the respective
packages are not loaded. So various variables and/or functions are void
for that buffer. I made the following changes to saveconf.el, which
basically modify the regexps for saving the windows and buffers.

diff -c -r1.1 saveconf.el
*** /tmp/,RCSt1a23437	Fri Jul 13 14:08:38 1990
--- saveconf.el	Fri Jul 13 11:08:48 1990
***************
*** 31,37 ****
  (defvar save-context-predicate
    (function (lambda (w)
  	      (and (buffer-file-name (window-buffer w))
! 		   (not (string-match "^\\(/usr\\)?/tmp/"
  				      (buffer-file-name (window-buffer w)))))))
    "*Value is a predicate function which determines which windows' contexts
  are saved.  When the `save-context' command is invoked, this function will
--- 31,37 ----
  (defvar save-context-predicate
    (function (lambda (w)
  	      (and (buffer-file-name (window-buffer w))
! 		   (not (string-match "^\\(/usr\\)?/tmp/\\|\\.pcmail/"
  				      (buffer-file-name (window-buffer w)))))))
    "*Value is a predicate function which determines which windows' contexts
  are saved.  When the `save-context' command is invoked, this function will
***************
*** 128,138 ****
  	     (function
  	      (lambda (b)
  		(set-buffer b)
! 		(cond (buffer-file-name
! 		       (prin1 buffer-file-name context-buffer)
! 		       (princ " " context-buffer)
! 		       (prin1 (point) context-buffer)
! 		       (princ "\n" context-buffer)))))
  	     (buffer-list)))
  
  	;;
--- 128,139 ----
  	     (function
  	      (lambda (b)
  		(set-buffer b)
! 		(if (and (buffer-file-name)
! 			 (not (string-match "\\.pcmail/" buffer-file-name)))
! 			   (progn (prin1 buffer-file-name context-buffer)
! 				  (princ " " context-buffer)
! 				  (prin1 (point) context-buffer)
! 				  (princ "\n" context-buffer)))))
  	     (buffer-list)))
  
  	;;

----
MfG/Regards

     /====                          Nixdorf Computer AG
    /   Ridderbusch,PXD-S4  / ,    Heinz Nixdorf Ring
   /                       /./    4790 Paderborn, West Germany
  /=== /,== ,===/  /,==,  //     Tel.: (+49) 5251/104685
 /    //   /   /  //   / / \    NERV:ridderbusch.pad
/    /     `==/\ /    / /   \  BIX:fridder   BTX:0525467066
UUCP: !USA            ...!unido!nixpbe!ridderbusch.pad
       USA  uunet!philabs!linus!nixbur!ridderbusch.pad

kjones@talos.pm.com (Kyle Jones) (07/17/90)

Looking at the size of RMAIL I can't blame people for posting
changes to saveconf.el to avoid messing with it.  But I hope that
whoever is still supporting RMAIL will fix this bug before
version 19 of Emacs is released.  RMAIL should not lose its mind
just because a user happens to be already visiting ~/RMAIL when
RMAIL is invoked.