Commit cdec2ad7 authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

(insert-file-contents-literally): Allow it to be called within a magic file name

handler.
parent ad599c11
...@@ -803,7 +803,7 @@ use with M-x." ...@@ -803,7 +803,7 @@ use with M-x."
default-coding)) default-coding))
(setq from-coding (read-coding-system (setq from-coding (read-coding-system
(format "Recode filename %s from: " filename)))) (format "Recode filename %s from: " filename))))
;; We provide the default coding only when a user is going to ;; We provide the default coding only when a user is going to
;; change the encoding not from the default coding. ;; change the encoding not from the default coding.
(if (eq from-coding default-coding) (if (eq from-coding default-coding)
...@@ -1412,15 +1412,17 @@ This function ensures that none of these modifications will take place." ...@@ -1412,15 +1412,17 @@ This function ensures that none of these modifications will take place."
(coding-system-for-read 'no-conversion) (coding-system-for-read 'no-conversion)
(coding-system-for-write 'no-conversion) (coding-system-for-write 'no-conversion)
(find-buffer-file-type-function (find-buffer-file-type-function
(if (fboundp 'find-buffer-file-type) (if (fboundp 'find-buffer-file-type)
(symbol-function 'find-buffer-file-type) (symbol-function 'find-buffer-file-type)
nil)) nil))
(inhibit-file-name-handlers '(jka-compr-handler image-file-handler)) (inhibit-file-name-handlers
(inhibit-file-name-operation 'insert-file-contents)) (append '(jka-compr-handler image-file-handler)
inhibit-file-name-handlers))
(inhibit-file-name-operation 'insert-file-contents))
(unwind-protect (unwind-protect
(progn (progn
(fset 'find-buffer-file-type (lambda (filename) t)) (fset 'find-buffer-file-type (lambda (filename) t))
(insert-file-contents filename visit beg end replace)) (insert-file-contents filename visit beg end replace))
(if find-buffer-file-type-function (if find-buffer-file-type-function
(fset 'find-buffer-file-type find-buffer-file-type-function) (fset 'find-buffer-file-type find-buffer-file-type-function)
(fmakunbound 'find-buffer-file-type))))) (fmakunbound 'find-buffer-file-type)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment