aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2002-06-11 19:26:45 +0000
committerRichard M. Stallman <[email protected]>2002-06-11 19:26:45 +0000
commit34f30f79b31dbe7e5db45c716e4f34cf9d674542 (patch)
tree5dda07e382c81738c1b419f041193c2a18725e56
parent77d18896aac58d7e77b4421971db063b43b58f2d (diff)
(format-alist): Document new element PRESERVE.
(format-write-file): Implement PRESERVE elt for a format.
-rw-r--r--lisp/format.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/format.el b/lisp/format.el
index e8298a5d47..ad7a22bba9 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -140,7 +140,10 @@ MODIFY, if non-nil, means the TO-FN wants to modify the region. If nil,
MODE-FN, if specified, is called when visiting a file with that format.
It is called with a single positive argument, on the assumption
- that it turns on some Emacs mode.")
+ that it turns on some Emacs mode.
+
+PRESERVE, if non-nil, means that `format-write-file' should not remove
+ this format from `buffer-file-formats'.")
;;; Basic Functions (called from Lisp)
@@ -371,7 +374,16 @@ name as FILENAME, to write a file of the same old name in that directory."
(fmt (format-read (format "Write file `%s' in format: "
(file-name-nondirectory file)))))
(list file fmt)))
- (setq buffer-file-format format)
+ (let ((old-formats buffer-file-format)
+ preserve-formats)
+ (dolist (fmt old-formats)
+ (let ((aelt (assq fmt format-alist)))
+ (if (nth 7 aelt)
+ (push fmt preserve-formats))))
+ (setq buffer-file-format format)
+ (dolist (fmt preserve-formats)
+ (unless (memq fmt buffer-file-format)
+ (setq buffer-file-format (append buffer-file-format (list fmt))))))
(write-file filename))
(defun format-find-file (filename format)