* pgg-epg.el (pgg-epg-decrypt-region): Don't call
authorueno <ueno>
Mon, 11 Dec 2006 06:04:44 +0000 (06:04 +0000)
committerueno <ueno>
Mon, 11 Dec 2006 06:04:44 +0000 (06:04 +0000)
decode-coding-string if it is not bound.

* epa-file.el (epa-file--encode-coding-string): New alias.
(epa-file--decode-coding-string): New alias.
(epa-file-write-region): Use epa-file--encode-coding-string.
(epa-file-decode-and-insert): Use epa-file--decode-coding-string.

* epa.el (epa--encode-coding-string): New alias.
(epa--decode-coding-string): New alias.
(epa-verify-region): Use epa--encode-coding-string.
(epa-sign-region): Ditto; use epa--decode-coding-string.
(epa-encrypt-region): Ditto.

* epg.el (epg--encode-coding-string): New alias.
(epg--status-GET_HIDDEN): use it.

ChangeLog
epa-file.el
epa.el
epg.el
pgg-epg.el

index 90f24ca..6e07128 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2006-12-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * pgg-epg.el (pgg-epg-decrypt-region): Don't call
+       decode-coding-string if it is not bound.
+
+       * epa-file.el (epa-file--encode-coding-string): New alias.
+       (epa-file--decode-coding-string): New alias.
+       (epa-file-write-region): Use epa-file--encode-coding-string.
+       (epa-file-decode-and-insert): Use epa-file--decode-coding-string.
+
+       * epa.el (epa--encode-coding-string): New alias.
+       (epa--decode-coding-string): New alias.
+       (epa-verify-region): Use epa--encode-coding-string.
+       (epa-sign-region): Ditto; use epa--decode-coding-string.
+       (epa-encrypt-region): Ditto.
+
+       * epg.el (epg--encode-coding-string): New alias.
+       (epg--status-GET_HIDDEN): use it.
+
 2006-11-29  Daiki Ueno  <ueno@unixuser.org>
 
        * EasyPG: Version 0.0.8 released.
index a924aa7..f086f90 100644 (file)
@@ -60,6 +60,14 @@ May either be a string or a list of strings.")
 
 (defvar epa-file-passphrase-alist nil)
 
+(if (fboundp 'encode-coding-string)
+    (defalias 'epa-file--encode-coding-string 'encode-coding-string)
+  (defalias 'epa-file--encode-coding-string 'identity))
+
+(if (fboundp 'decode-coding-string)
+    (defalias 'epa-file--decode-coding-string 'decode-coding-string)
+  (defalias 'epa-file--decode-coding-string 'identity))
+
 (defun epa-file-passphrase-callback-function (context key-id file)
   (if (and epa-file-cache-passphrase-for-symmetric-encryption
           (eq key-id 'SYM))
@@ -104,8 +112,8 @@ May either be a string or a list of strings.")
           (point-min) (point-max)
           (substring file 0 (string-match epa-file-name-regexp file))
           visit beg end replace)))
-    (insert (decode-coding-string string (or coding-system-for-read
-                                            'undecided)))))
+    (insert (epa-file--decode-coding-string string (or coding-system-for-read
+                                                      'undecided)))))
 
 (defvar last-coding-system-used)
 (defun epa-file-insert-file-contents (file &optional visit beg end replace)
@@ -175,9 +183,9 @@ May either be a string or a list of strings.")
              (epg-encrypt-string
               context
               (if (stringp start)
-                  (encode-coding-string start coding-system)
-                (encode-coding-string (buffer-substring start end)
-                                      coding-system))
+                  (epa-file--encode-coding-string start coding-system)
+                (epa-file--encode-coding-string (buffer-substring start end)
+                                                coding-system))
               (unless (assoc file epa-file-passphrase-alist)
                 (epa-select-keys
                  context
diff --git a/epa.el b/epa.el
index 2044980..b3b51e8 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -238,6 +238,14 @@ the separate window."
          (epg-sub-key-id (car (epg-key-sub-key-list
                                (widget-get widget :value))))))
 
+(if (fboundp 'encode-coding-string)
+    (defalias 'epa--encode-coding-string 'encode-coding-string)
+  (defalias 'epa--encode-coding-string 'identity))
+
+(if (fboundp 'decode-coding-string)
+    (defalias 'epa--decode-coding-string 'decode-coding-string)
+  (defalias 'epa--decode-coding-string 'identity))
+
 (defun epa-keys-mode ()
   "Major mode for `epa-list-keys'."
   (kill-all-local-variables)
@@ -693,7 +701,7 @@ Don't use this command in Lisp programs!"
       (message "Decrypting...done")
       (delete-region start end)
       (goto-char start)
-      (insert (decode-coding-string plain coding-system-for-read))
+      (insert (epg--decode-coding-string plain coding-system-for-read))
       (if (epg-context-result-for context 'verify)
          (epa-display-info (epg-verify-result-to-string
                             (epg-context-result-for context 'verify)))))))
@@ -736,7 +744,7 @@ Don't use this command in Lisp programs!"
     (epg-context-set-progress-callback context
                                       #'epa-progress-callback-function)
     (epg-verify-string context
-                      (encode-coding-string
+                      (epa--encode-coding-string
                        (buffer-substring start end)
                        coding-system-for-write))
     (if (epg-context-result-for context 'verify)
@@ -810,13 +818,13 @@ d - Create a detached signature
                                         #'epa-progress-callback-function)
       (message "Signing...")
       (setq signature (epg-sign-string context
-                                      (encode-coding-string
+                                      (epa--encode-coding-string
                                        (buffer-substring start end)
                                        coding-system-for-write)
                                       mode))
       (message "Signing...done")
       (delete-region start end)
-      (insert (decode-coding-string signature coding-system-for-read)))))
+      (insert (epg--decode-coding-string signature coding-system-for-read)))))
 
 ;;;###autoload
 (defun epa-encrypt-region (start end recipients)
@@ -838,7 +846,7 @@ If no one is selected, symmetric encryption will be performed.  ")))
                                         #'epa-progress-callback-function)
       (message "Encrypting...")
       (setq cipher (epg-encrypt-string context
-                                      (encode-coding-string
+                                      (epa--encode-coding-string
                                        (buffer-substring start end)
                                        coding-system-for-write)
                                       recipients))
diff --git a/epg.el b/epg.el
index 2aaa58f..515110f 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -1222,7 +1222,7 @@ This function is for internal use only."
                  (if epg-passphrase-coding-system
                      (progn
                        (setq encoded-passphrase-with-new-line
-                             (encode-coding-string
+                             (epg--encode-coding-string
                               passphrase-with-new-line
                               (coding-system-change-eol-conversion
                                epg-passphrase-coding-system 'unix)))
@@ -1800,6 +1800,10 @@ You can then use `write-region' to write new data into the file."
   (defun epg--clear-string (string)
     (fillarray string 0)))
 
+(if (fboundp 'encode-coding-string)
+    (defalias 'epg--encode-coding-string 'encode-coding-string)
+  (defalias 'epg--encode-coding-string 'identity))
+
 (defun epg--args-from-sig-notations (notations)
   (apply #'nconc
         (mapcar
index bd1a167..86c6155 100644 (file)
@@ -132,7 +132,8 @@ passphrase cache or user."
         (pgg-remove-passphrase-from-cache (car pgg-epg-secret-key-id-list))
         (setq pgg-epg-secret-key-id-list (cdr pgg-epg-secret-key-id-list)))
        (signal (car error) (cdr error))))
-    (if pgg-text-mode
+    (if (and pgg-text-mode
+            (fboundp 'decode-coding-string))
        (setq plain (decode-coding-string plain 'raw-text)))
     (save-excursion
       (set-buffer (get-buffer-create pgg-output-buffer))