diff options
author | Richard M. Stallman <rms@gnu.org> | 2004-11-16 17:18:39 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2004-11-16 17:18:39 +0000 |
commit | 14b3fa075ead87bdd5a30835d236f7cff90facf0 (patch) | |
tree | 5d3b20b21f020ab5c62fb522cba8f557063620fe /lisp/international/mule.el | |
parent | 6161791395e8834471ba08350bae47782c193b86 (diff) | |
download | emacs-14b3fa075ead87bdd5a30835d236f7cff90facf0.tar.gz |
(set-buffer-file-coding-system): New arg NOMODIFY.
(after-insert-file-set-coding): Pass that new arg.
Prevent set-buffer-multibyte from trying to lock the file.
Diffstat (limited to 'lisp/international/mule.el')
-rw-r--r-- | lisp/international/mule.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 9136a257ee1..5477402a9ba 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -1135,7 +1135,7 @@ FROM is a form to evaluate to define the coding-system." (setq coding-system-alist (cons (list (symbol-name symbol)) coding-system-alist))) -(defun set-buffer-file-coding-system (coding-system &optional force) +(defun set-buffer-file-coding-system (coding-system &optional force nomodify) "Set the file coding-system of the current buffer to CODING-SYSTEM. This means that when you save the buffer, it will be converted according to CODING-SYSTEM. For a list of possible values of CODING-SYSTEM, @@ -1149,8 +1149,9 @@ specified there). Otherwise, leave it unspecified. This marks the buffer modified so that the succeeding \\[save-buffer] surely saves the buffer with CODING-SYSTEM. From a program, if you -don't want to mark the buffer modified, just set the variable -`buffer-file-coding-system' directly." +don't want to mark the buffer modified, specify t for NOMODIFY. +If you know exactly what coding system you want to use, +just set the variable `buffer-file-coding-system' directly." (interactive "zCoding system for saving file (default, nil): \nP") (check-coding-system coding-system) (if (and coding-system buffer-file-coding-system (null force)) @@ -1736,7 +1737,11 @@ different if the buffer has become unibyte." (find-new-buffer-file-coding-system last-coding-system-used)) (modified-p (buffer-modified-p))) (when coding-system - (set-buffer-file-coding-system coding-system t) + ;; Tell set-buffer-file-coding-system not to mark the file + ;; as modified; we just read it, and it's supposed to be unmodified. + ;; Marking it modified would try to lock it, which would + ;; check the modtime, and we don't want to do that again now. + (set-buffer-file-coding-system coding-system t t) (if (and enable-multibyte-characters (or (eq coding-system 'no-conversion) (eq (coding-system-type coding-system) 5)) @@ -1746,7 +1751,9 @@ different if the buffer has become unibyte." (= (buffer-size) inserted)) ;; For coding systems no-conversion and raw-text..., ;; edit the buffer as unibyte. - (let ((pos-marker (copy-marker (+ (point) inserted)))) + (let ((pos-marker (copy-marker (+ (point) inserted))) + ;; Prevent locking. + (buffer-file-name nil)) (set-buffer-multibyte nil) (setq inserted (- pos-marker (point))))) (set-buffer-modified-p modified-p)))) |