* poem-nemacs.el (find-file-noselect-as-coding-system): Bind
authoryamaoka <yamaoka>
Fri, 26 Feb 1999 02:08:57 +0000 (02:08 +0000)
committeryamaoka <yamaoka>
Fri, 26 Feb 1999 02:08:57 +0000 (02:08 +0000)
`default-kanji-fileio-code' to specified coding system instead of the use of
`kanji-fileio-code'; bind `kanji-fileio-code' to nil.
(find-file-noselect-as-raw-text): Revert buffer if the file is newer than the
buffer.
(as-binary-input-file): Bind `default-kanji-flag' to nil.

* poem-20.el (find-file-noselect-as-binary): Bug fix - use
`coding-system-for-read' instead of `coding-system-for-write'.

ChangeLog
poem-20.el
poem-nemacs.el

index 5503702..3764be0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+1999-02-26  Katsumi Yamaoka   <yamaoka@jpl.org>
+
+       * poem-nemacs.el (find-file-noselect-as-coding-system): Bind
+       `default-kanji-fileio-code' to specified coding system instead of
+       the use of `kanji-fileio-code'; bind `kanji-fileio-code' to nil.
+       (find-file-noselect-as-raw-text): Revert buffer if the file is
+       newer than the buffer.
+       (as-binary-input-file): Bind `default-kanji-flag' to nil.
+
+       * poem-20.el (find-file-noselect-as-binary): Bug fix - use
+       `coding-system-for-read' instead of `coding-system-for-write'.
+
 1999-02-25  Katsumi Yamaoka   <yamaoka@jpl.org>
 
        * poem-om.el (find-file-noselect-as-raw-text-CRLF): New function.
index 06039ea..f304951 100644 (file)
@@ -90,7 +90,7 @@ from CRLF to LF."
 
 (defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but don't code and format conversion."
-  (let ((coding-system-for-write 'binary)
+  (let ((coding-system-for-read 'binary)
        format-alist)
     (find-file-noselect filename nowarn rawfile)))
 
index 1af5fef..6b24d3f 100644 (file)
        (,@ body))))
 
 (defmacro as-binary-input-file (&rest body)
-  (` (let (kanji-flag)
+  (` (let (kanji-flag default-kanji-flag)
        (,@ body))))
 
 (defmacro as-binary-output-file (&rest body)
@@ -239,16 +239,36 @@ It converts line-break code from CRLF to LF. [emu-nemacs.el]"
 (defun find-file-noselect-as-raw-text (filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but it does not code conversion
 except for line-break code. [emu-nemacs.el]"
-  (or (get-file-buffer filename)
+  (let ((buf (get-file-buffer filename))
+       cur)
+    (if buf
+       (prog1
+           buf
+         (or nowarn
+             (verify-visited-file-modtime buf)
+             (cond ((not (file-exists-p filename))
+                    (error "File %s no longer exists!" filename))
+                   ((yes-or-no-p
+                     (if (buffer-modified-p buf)
+    "File has changed since last visited or saved.  Flush your changes? "
+  "File has changed since last visited or saved.  Read from disk? "))
+                    (setq cur (current-buffer))
+                    (set-buffer buf)
+                    (revert-buffer t t)
+                    (save-excursion
+                      (goto-char (point-min))
+                      (while (search-forward "\r\n" nil t)
+                        (replace-match "\n")))
+                    (set-buffer-modified-p nil)
+                    (set-buffer cur)))))
       (save-excursion
        (prog1
            (set-buffer
-            (as-binary-input-file
-             (find-file-noselect filename nowarn)))
+            (find-file-noselect-as-binary filename nowarn rawfile))
          (while (search-forward "\r\n" nil t)
            (replace-match "\n"))
          (goto-char (point-min))
-         (set-buffer-modified-p nil)))))
+         (set-buffer-modified-p nil))))))
 
 (defalias 'find-file-noselect-as-raw-text-CRLF
   'find-file-noselect-as-raw-text)
@@ -309,8 +329,8 @@ applied to `kanji-fileio-code'. [emu-nemacs.el]"
   (coding-system filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but CODING-SYSTEM the first arg will
 be applied to `kanji-fileio-code'. [emu-nemacs.el]"
-  (let ((kanji-fileio-code coding-system)
-       kanji-expected-code)
+  (let ((default-kanji-fileio-code coding-system)
+       kanji-fileio-code kanji-expected-code)
     (find-file-noselect filename nowarn)))
 
 (defun save-buffer-as-coding-system (coding-system &optional args)