aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-11-16 17:18:39 +0000
committerRichard M. Stallman2004-11-16 17:18:39 +0000
commit14b3fa075ead87bdd5a30835d236f7cff90facf0 (patch)
tree5d3b20b21f020ab5c62fb522cba8f557063620fe
parent6161791395e8834471ba08350bae47782c193b86 (diff)
downloademacs-14b3fa075ead87bdd5a30835d236f7cff90facf0.tar.gz
emacs-14b3fa075ead87bdd5a30835d236f7cff90facf0.zip
(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.
-rw-r--r--lisp/international/mule.el17
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."
1135 (setq coding-system-alist (cons (list (symbol-name symbol)) 1135 (setq coding-system-alist (cons (list (symbol-name symbol))
1136 coding-system-alist))) 1136 coding-system-alist)))
1137 1137
1138(defun set-buffer-file-coding-system (coding-system &optional force) 1138(defun set-buffer-file-coding-system (coding-system &optional force nomodify)
1139 "Set the file coding-system of the current buffer to CODING-SYSTEM. 1139 "Set the file coding-system of the current buffer to CODING-SYSTEM.
1140This means that when you save the buffer, it will be converted 1140This means that when you save the buffer, it will be converted
1141according to CODING-SYSTEM. For a list of possible values of CODING-SYSTEM, 1141according to CODING-SYSTEM. For a list of possible values of CODING-SYSTEM,
@@ -1149,8 +1149,9 @@ specified there). Otherwise, leave it unspecified.
1149 1149
1150This marks the buffer modified so that the succeeding \\[save-buffer] 1150This marks the buffer modified so that the succeeding \\[save-buffer]
1151surely saves the buffer with CODING-SYSTEM. From a program, if you 1151surely saves the buffer with CODING-SYSTEM. From a program, if you
1152don't want to mark the buffer modified, just set the variable 1152don't want to mark the buffer modified, specify t for NOMODIFY.
1153`buffer-file-coding-system' directly." 1153If you know exactly what coding system you want to use,
1154just set the variable `buffer-file-coding-system' directly."
1154 (interactive "zCoding system for saving file (default, nil): \nP") 1155 (interactive "zCoding system for saving file (default, nil): \nP")
1155 (check-coding-system coding-system) 1156 (check-coding-system coding-system)
1156 (if (and coding-system buffer-file-coding-system (null force)) 1157 (if (and coding-system buffer-file-coding-system (null force))
@@ -1736,7 +1737,11 @@ different if the buffer has become unibyte."
1736 (find-new-buffer-file-coding-system last-coding-system-used)) 1737 (find-new-buffer-file-coding-system last-coding-system-used))
1737 (modified-p (buffer-modified-p))) 1738 (modified-p (buffer-modified-p)))
1738 (when coding-system 1739 (when coding-system
1739 (set-buffer-file-coding-system coding-system t) 1740 ;; Tell set-buffer-file-coding-system not to mark the file
1741 ;; as modified; we just read it, and it's supposed to be unmodified.
1742 ;; Marking it modified would try to lock it, which would
1743 ;; check the modtime, and we don't want to do that again now.
1744 (set-buffer-file-coding-system coding-system t t)
1740 (if (and enable-multibyte-characters 1745 (if (and enable-multibyte-characters
1741 (or (eq coding-system 'no-conversion) 1746 (or (eq coding-system 'no-conversion)
1742 (eq (coding-system-type coding-system) 5)) 1747 (eq (coding-system-type coding-system) 5))
@@ -1746,7 +1751,9 @@ different if the buffer has become unibyte."
1746 (= (buffer-size) inserted)) 1751 (= (buffer-size) inserted))
1747 ;; For coding systems no-conversion and raw-text..., 1752 ;; For coding systems no-conversion and raw-text...,
1748 ;; edit the buffer as unibyte. 1753 ;; edit the buffer as unibyte.
1749 (let ((pos-marker (copy-marker (+ (point) inserted)))) 1754 (let ((pos-marker (copy-marker (+ (point) inserted)))
1755 ;; Prevent locking.
1756 (buffer-file-name nil))
1750 (set-buffer-multibyte nil) 1757 (set-buffer-multibyte nil)
1751 (setq inserted (- pos-marker (point))))) 1758 (setq inserted (- pos-marker (point)))))
1752 (set-buffer-modified-p modified-p)))) 1759 (set-buffer-modified-p modified-p))))