diff options
author | Michael Olson <mwolson@gnu.org> | 2009-08-05 08:07:03 -0700 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2009-08-05 08:07:03 -0700 |
commit | 2c1c56d553df6ee1973134fdb90543454b1146ca (patch) | |
tree | 24c99ac1faa709960a83a5922ddcd176ea4082e3 /lisp/emms.el | |
parent | 8176350744ebefe066478bfc3de9a00e34261b77 (diff) |
Introduce emms-insert-file-contents.
This function is a safe way to insert the contents of a file without
triggering major mode detection, and has been tested on several versions
of Emacs and XEmacs.
Diffstat (limited to 'lisp/emms.el')
-rw-r--r-- | lisp/emms.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/emms.el b/lisp/emms.el index 750781d..3c5402d 100644 --- a/lisp/emms.el +++ b/lisp/emms.el @@ -528,6 +528,27 @@ See `completing-read' for a description of ARGS." (require 'emms-compat) +;;; Utility functions + +(defun emms-insert-file-contents (filename &optional visit) + "Insert the contents of file FILENAME after point. +Do character code conversion and end-of-line conversion, but none +of the other unnecessary things like format decoding or +`find-file-hook'. + +If VISIT is non-nil, the buffer's visited filename +and last save file modtime are set, and it is marked unmodified. +If visiting and the file does not exist, visiting is completed +before the error is signaled." + (let ((format-alist nil) + (after-insert-file-functions nil) + (inhibit-file-name-handlers + (append '(jka-compr-handler image-file-handler epa-file-handler) + inhibit-file-name-handlers)) + (inhibit-file-name-operation 'insert-file-contents)) + (insert-file-contents filename visit))) + + ;;; Dictionaries ;; This is a simple helper data structure, used by both players |