aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2009-01-17 12:35:50 +0000
committerEli Zaretskii2009-01-17 12:35:50 +0000
commit5a4122e2bf1b05200332cb0e2d1b34ddaddd43e1 (patch)
tree6b6971e303f7ca7174377fb2fd2670f7e21f0eaf
parentfc47d8a7c9f0362e9c922ef0806d6e1103a8563e (diff)
downloademacs-5a4122e2bf1b05200332cb0e2d1b34ddaddd43e1.tar.gz
emacs-5a4122e2bf1b05200332cb0e2d1b34ddaddd43e1.zip
(find-buffer-file-type-coding-system): If `(car target)' does not exist as a
file, try again with its basename replaced by `(cdr target)'. Fixes Bug #1853.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/dos-w32.el22
2 files changed, 22 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 05468e1f113..7cf7c8edf5c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12009-01-17 Eli Zaretskii <eliz@gnu.org> 12009-01-17 Eli Zaretskii <eliz@gnu.org>
2 2
3 * dos-w32.el (find-buffer-file-type-coding-system): If `(car
4 TARGET)' does not exist, try again with its basename replaced by
5 `(cdr TARGET)'. Fixes Bug #1853.
6
3 * international/mule-conf.el (raw-text, eight-bit): Doc fixes. 7 * international/mule-conf.el (raw-text, eight-bit): Doc fixes.
4 8
52009-01-16 Agustín Martín <agustin.martin@hispalinux.es> 92009-01-16 Agustín Martín <agustin.martin@hispalinux.es>
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el
index 9e9c386d205..ae6ed5dc366 100644
--- a/lisp/dos-w32.el
+++ b/lisp/dos-w32.el
@@ -129,9 +129,9 @@ set to the appropriate coding system, and the value of
129`buffer-file-coding-system' will be used when writing the file." 129`buffer-file-coding-system' will be used when writing the file."
130 130
131 (let ((op (nth 0 command)) 131 (let ((op (nth 0 command))
132 (target)
133 (binary nil) (text nil) 132 (binary nil) (text nil)
134 (undecided nil) (undecided-unix nil)) 133 (undecided nil) (undecided-unix nil)
134 target target-buf)
135 (cond ((eq op 'insert-file-contents) 135 (cond ((eq op 'insert-file-contents)
136 (setq target (nth 1 command)) 136 (setq target (nth 1 command))
137 ;; If TARGET is a cons cell, it has the form (FILENAME . BUFFER), 137 ;; If TARGET is a cons cell, it has the form (FILENAME . BUFFER),
@@ -140,7 +140,11 @@ set to the appropriate coding system, and the value of
140 ;; arguments is used, e.g., in arc-mode.el.) This function 140 ;; arguments is used, e.g., in arc-mode.el.) This function
141 ;; doesn't care about the contents, it only looks at the file's 141 ;; doesn't care about the contents, it only looks at the file's
142 ;; name, which is the CAR of the cons cell. 142 ;; name, which is the CAR of the cons cell.
143 (if (consp target) (setq target (car target))) 143 (when (consp target)
144 (setq target-buf
145 (and (bufferp (cdr target))
146 (buffer-name (cdr target))))
147 (setq target (car target)))
144 ;; First check for a file name that indicates 148 ;; First check for a file name that indicates
145 ;; it is truly binary. 149 ;; it is truly binary.
146 (setq binary (find-buffer-file-type target)) 150 (setq binary (find-buffer-file-type target))
@@ -149,7 +153,17 @@ set to the appropriate coding system, and the value of
149 ((find-buffer-file-type-match target) 153 ((find-buffer-file-type-match target)
150 (setq text t)) 154 (setq text t))
151 ;; For any other existing file, decide based on contents. 155 ;; For any other existing file, decide based on contents.
152 ((file-exists-p target) 156 ((or
157 (file-exists-p target)
158 ;; If TARGET does not exist as a file, replace its
159 ;; base name with TARGET-BUF and try again. This
160 ;; is for jka-compr's sake, which strips the
161 ;; compression (.gz etc.) extension from the
162 ;; FILENAME, but leaves it in the BUFFER's name.
163 (and (stringp target-buf)
164 (file-exists-p
165 (expand-file-name target-buf
166 (file-name-directory target)))))
153 (setq undecided t)) 167 (setq undecided t))
154 ;; Next check for a non-DOS file system. 168 ;; Next check for a non-DOS file system.
155 ((untranslated-file-p target) 169 ((untranslated-file-p target)