[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v [EMACS_22_BASE]
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v [EMACS_22_BASE] |
Date: |
Wed, 09 Apr 2008 20:17:30 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Michael Albinus <albinus> 08/04/09 20:17:29
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.124.2.10
retrieving revision 1.124.2.11
diff -u -b -r1.124.2.10 -r1.124.2.11
--- tramp.el 2 Feb 2008 10:46:08 -0000 1.124.2.10
+++ tramp.el 9 Apr 2008 20:17:27 -0000 1.124.2.11
@@ -3888,6 +3888,21 @@
(t (tramp-make-tramp-file-name
multi-method method user host "")))))))
+(defun tramp-find-file-name-coding-system-alist (filename tmpname)
+ "Like `find-operation-coding-system' for Tramp filenames.
+Tramp's `insert-file-contents' and `write-region' work over
+temporary file names. If `file-coding-system-alist' contains an
+expression, which matches more than the file name suffix, the
+coding system might not be determined. This function repairs it."
+ (let (result)
+ (dolist (elt file-coding-system-alist result)
+ (when (and (consp elt) (string-match (car elt) filename))
+ ;; We found a matching entry in `file-coding-system-alist'.
+ ;; So we add a similar entry, but with the temporary file name
+ ;; as regexp.
+ (add-to-list
+ 'result (cons (regexp-quote tmpname) (cdr elt)) 'append)))))
+
(defun tramp-handle-insert-file-contents
(filename &optional visit beg end replace)
"Like `insert-file-contents' for tramp files."
@@ -3916,6 +3931,10 @@
(tramp-message-for-buffer
multi-method method user host
9 "Inserting local temp file `%s'..." local-copy)
+ ;; We must ensure that `file-coding-system-alist' matches
+ ;; `local-copy'.
+ (let ((file-coding-system-alist
+ (tramp-find-file-name-coding-system-alist filename local-copy)))
(setq result (insert-file-contents local-copy nil beg end replace))
(when visit
(setq buffer-file-name filename)
@@ -3923,7 +3942,7 @@
(set-buffer-modified-p nil))
;; Now `last-coding-system-used' has right value. Remember it.
(when (boundp 'last-coding-system-used)
- (setq coding-system-used (symbol-value 'last-coding-system-used)))
+ (setq coding-system-used (symbol-value 'last-coding-system-used))))
(tramp-message-for-buffer
multi-method method user host
9 "Inserting local temp file `%s'...done" local-copy)
@@ -4072,9 +4091,12 @@
;; Set current buffer. If connection wasn't open, `file-modes' has
;; changed it accidently.
(set-buffer curbuf)
- ;; We say `no-message' here because we don't want the visited file
- ;; modtime data to be clobbered from the temp file. We call
- ;; `set-visited-file-modtime' ourselves later on.
+ ;; We say `no-message' here because we don't want the visited
+ ;; file modtime data to be clobbered from the temp file. We
+ ;; call `set-visited-file-modtime' ourselves later on. We must
+ ;; ensure that `file-coding-system-alist' matches `tmpfil'.
+ (let ((file-coding-system-alist
+ (tramp-find-file-name-coding-system-alist filename tmpfil)))
(tramp-run-real-handler
'write-region
(if confirm ; don't pass this arg unless defined for backward compat.
@@ -4082,7 +4104,7 @@
(list start end tmpfil append 'no-message lockname)))
;; Now, `last-coding-system-used' has the right value. Remember it.
(when (boundp 'last-coding-system-used)
- (setq coding-system-used (symbol-value 'last-coding-system-used)))
+ (setq coding-system-used (symbol-value 'last-coding-system-used))))
;; The permissions of the temporary file should be set. If
;; filename does not exist (eq modes nil) it has been renamed to
;; the backup file. This case `save-buffer' handles
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v [EMACS_22_BASE],
Michael Albinus <=