From: ueno Date: Wed, 12 Apr 2006 06:20:02 +0000 (+0000) Subject: (epg-file-decode-coding-inserted-region): Abolished. X-Git-Tag: epgsm-branchpoint~127 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c01784fdb83d60438f48888b84ebf4e9f5dfdbc0;p=elisp%2Fepg.git (epg-file-decode-coding-inserted-region): Abolished. --- diff --git a/epg-file.el b/epg-file.el index f7790ed..f15d07f 100644 --- a/epg-file.el +++ b/epg-file.el @@ -115,11 +115,7 @@ with GnuPG." (let ((buffer-file-name (if visit nil buffer-file-name))) (save-restriction (narrow-to-region (point) (point)) - (insert string) - (epg-file-decode-coding-inserted-region - (point-min) (point-max) - expanded-filename - visit beg end replace)) + (insert (decode-coding-string string 'undecided))) (if replace (delete-region (point) (point-max)))))) (when (and local-copy (file-exists-p local-copy)) @@ -138,66 +134,14 @@ with GnuPG." ;; Returns list of absolute file name and number of characters inserted. (list expanded-filename length))) - -(if (fboundp 'decode-coding-inserted-region) - (defalias 'epg-file-decode-coding-inserted-region 'decode-coding-inserted-region) - (defun epg-file-decode-coding-inserted-region (from to filename - &optional visit beg end replace) - "Decode the region between FROM and TO as if it is read from file FILENAME. -The idea is that the text between FROM and TO was just inserted somehow. -Optional arguments VISIT, BEG, END, and REPLACE are the same as those -of the function `insert-file-contents'. -Part of the job of this function is setting `buffer-undo-list' appropriately." - (save-excursion - (save-restriction - (let ((coding coding-system-for-read) - undo-list-saved) - (if visit - ;; Temporarily turn off undo recording, if we're decoding the - ;; text of a visited file. - (setq buffer-undo-list t) - ;; Otherwise, if we can recognize the undo elt for the insertion, - ;; remove it and get ready to replace it later. - ;; In the mean time, turn off undo recording. - (let ((last (car-safe buffer-undo-list))) - (if (and (consp last) (eq (car last) from) (eq (cdr last) to)) - (setq undo-list-saved (cdr buffer-undo-list) - buffer-undo-list t)))) - (narrow-to-region from to) - (goto-char (point-min)) - (or coding - (setq coding (funcall set-auto-coding-function - filename (- (point-max) (point-min))))) - (or coding - (setq coding (car (find-operation-coding-system - 'insert-file-contents - filename visit beg end replace)))) - (if (coding-system-p coding) - (or enable-multibyte-characters - (setq coding - (coding-system-change-text-conversion coding 'raw-text))) - (setq coding nil)) - (if coding - (decode-coding-region (point-min) (point-max) coding) - (setq last-coding-system-used coding)) - ;; If we're decoding the text of a visited file, - ;; the undo list should start out empty. - (if visit - (setq buffer-undo-list nil) - ;; If we decided to replace the undo entry for the insertion, - ;; do so now. - (if undo-list-saved - (setq buffer-undo-list - (cons (cons from (point-max)) undo-list-saved))))))))) (put 'epg-file-handler 'safe-magic t) (let (epg-file-operations) (mapc (lambda (operation) (let ((epg-file-operation (intern (format "epg-file-%s" operation)))) - (when (fboundp epg-file-operation) - (push operation epg-file-operations) - (put operation 'epg-file epg-file-operation)))) + (setq epg-file-operation (cons operation epg-file-operations)) + (put operation 'epg-file epg-file-operation))) '(access-file add-name-to-file byte-compiler-base-file-name copy-file delete-directory delete-file diff-latest-backup-file directory-file-name directory-files directory-files-and-attributes dired-call-process @@ -217,9 +161,11 @@ Part of the job of this function is setting `buffer-undo-list' appropriately." (put 'epg-file-handler 'operations epg-file-operations)) (unless (assoc epg-file-name-regexp file-name-handler-alist) - (push (cons epg-file-name-regexp 'epg-file-handler) - file-name-handler-alist)) + (setq file-name-handler-alist + (cons (cons epg-file-name-regexp 'epg-file-handler) + file-name-handler-alist))) (unless (assoc epg-file-name-regexp auto-mode-alist) - (push (list epg-file-name-regexp nil 'strip-suffix) - auto-mode-alist)) + (setq auto-mode-alist + (cons (list epg-file-name-regexp nil 'strip-suffix) + auto-mode-alist)))