From: ueno Date: Wed, 12 Apr 2006 07:11:06 +0000 (+0000) Subject: Don't call set-buffer-multibyte if it is not fbound. X-Git-Tag: epgsm-branchpoint~123 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3ac2d6d6c872f7cb42fd87bcdf5894d7c34b5ca;p=elisp%2Fepg.git Don't call set-buffer-multibyte if it is not fbound. --- diff --git a/epg-file.el b/epg-file.el index d3f5da1..fc2123f 100644 --- a/epg-file.el +++ b/epg-file.el @@ -20,6 +20,8 @@ with GnuPG." (inhibit-file-name-operation operation)) (apply operation args))) +(defvar buffer-file-type) +(defvar last-coding-system-used) (defun epg-file-write-region (start end filename &optional append visit lockname mustbenew) (let* ((visit-file (if (stringp visit) @@ -29,7 +31,8 @@ with GnuPG." (coding-system (condition-case nil (epg-file-run-real-handler 'write-region (list start end "/")) - (file-error last-coding-system-used))) + (file-error (if (boundp 'last-coding-system-used) + last-coding-system-used)))) ;; start and end are normally buffer positions ;; specifying the part of the buffer to write. ;; If start is nil, that means to use the entire buffer contents. @@ -44,7 +47,8 @@ with GnuPG." (buffer-substring start end))) coding-system))) (with-temp-buffer - (set-buffer-multibyte nil) + (if (fboundp 'set-buffer-multibyte) + (set-buffer-multibyte nil)) ;; Optional fourth argument append if non-nil means ;; append to existing file contents (if any). If it is an integer, ;; seek to that offset in the file before writing. @@ -64,7 +68,8 @@ with GnuPG." (context (epg-make-context)) cipher) (when (setq cipher (epg-encrypt-string context (buffer-string) nil)) - (if (memq system-type '(ms-dos windows-nt)) + (if (and (memq system-type '(ms-dos windows-nt)) + (boundp 'buffer-file-type)) (setq buffer-file-type t)) (epg-file-run-real-handler 'write-region @@ -84,7 +89,8 @@ with GnuPG." (setq buffer-file-name visit)) (when (or (eq visit t) (eq visit nil) (stringp visit)) (message "Wrote %s" visit-file)) - (setq last-coding-system-used coding-system) + (if (boundp 'last-coding-system-used) + (setq last-coding-system-used coding-system)) nil)) (defun epg-file-insert-file-contents (filename &optional visit beg end replace) diff --git a/epg.el b/epg.el index 9b42d60..330e7c4 100644 --- a/epg.el +++ b/epg.el @@ -260,7 +260,8 @@ This function is for internal use only." (defun epg-read-output (context) (with-temp-buffer - (set-buffer-multibyte nil) + (if (fboundp 'set-buffer-multibyte) + (set-buffer-multibyte nil)) (if (file-exists-p (epg-context-output-file context)) (let ((coding-system-for-read (if (epg-context-textmode context) 'raw-text