From d8d88035302e4c588cf813994b9cb73625d6b449 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 26 Feb 1999 02:08:57 +0000 Subject: [PATCH] * 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'. --- ChangeLog | 12 ++++++++++++ poem-20.el | 2 +- poem-nemacs.el | 34 +++++++++++++++++++++++++++------- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5503702..3764be0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-02-26 Katsumi Yamaoka + + * 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 * poem-om.el (find-file-noselect-as-raw-text-CRLF): New function. diff --git a/poem-20.el b/poem-20.el index 06039ea..f304951 100644 --- a/poem-20.el +++ b/poem-20.el @@ -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))) diff --git a/poem-nemacs.el b/poem-nemacs.el index 1af5fef..6b24d3f 100644 --- a/poem-nemacs.el +++ b/poem-nemacs.el @@ -181,7 +181,7 @@ (,@ 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) -- 1.7.10.4