changeset 24794:ce4f0f55e174

forms-save-buffer): Call set-buffer-modified-p to force the data buffer to be saved, even if the data didn't change, in case the write filter was modified. Restore the current record after read-file-filter finishes.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 31 May 1999 08:34:19 +0000
parents 10e8ff07a198
children a7afe99e73cf
files lisp/forms.el
diffstat 1 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/forms.el	Sat May 29 19:26:53 1999 +0000
+++ b/lisp/forms.el	Mon May 31 08:34:19 1999 +0000
@@ -301,10 +301,10 @@
 (provide 'forms)			;;; official
 (provide 'forms-mode)			;;; for compatibility
 
-(defconst forms-version (substring "$Revision: 2.37 $" 11 -2)
+(defconst forms-version (substring "$Revision: 2.38 $" 11 -2)
   "The version number of forms-mode (as string).  The complete RCS id is:
 
-  $Id: forms.el,v 2.37 1999/01/15 16:19:53 rms Exp kwzh $")
+  $Id: forms.el,v 2.38 1999/05/01 01:11:12 kwzh Exp eliz $")
 
 (defcustom forms-mode-hooks nil
   "Hook functions to be run upon entering Forms mode."
@@ -1924,19 +1924,32 @@
   (interactive "p")
   (forms--checkmod)
   (let ((write-file-filter forms-write-file-filter)
-	(read-file-filter forms-read-file-filter))
+	(read-file-filter forms-read-file-filter)
+	(cur forms--current-record))
     (save-excursion
       (set-buffer forms--file-buffer)
       (let ((inhibit-read-only t))
 	;; Write file hooks are run via local-write-file-hooks.
 	;; (if write-file-filter 
 	;;  (save-excursion 
-	;;   (run-hooks 'write-file-filter))) 
+	;;   (run-hooks 'write-file-filter)))
+
+	;; If they have a write-file-filter, force the buffer to be
+	;; saved even if it doesn't seem to be changed.  First, they
+	;; might have changed the write-file-filter; and second, if
+	;; save-buffer does nothing, write-file-filter won't get run,
+	;; and then read-file-filter will be mightily confused.
+	(or (null write-file-filter)
+	    (set-buffer-modified-p t))
 	(save-buffer args)
 	(if read-file-filter
 	   (save-excursion
 	     (run-hooks 'read-file-filter)))
-	(set-buffer-modified-p nil))))
+	(set-buffer-modified-p nil)))
+    ;; Make sure we end up with the same record number as we started.
+    ;; Since read-file-filter may perform arbitrary transformations on
+    ;; the data buffer contents, save-excursion is not enough.
+    (forms-jump-record cur))
   t)
 
 (defun forms--revert-buffer (&optional arg noconfirm)