comparison lisp/sha1.el @ 92779:e9bef8bf2940

(sha1-string-external): Use set-buffer-multibyte rather than setting default-enable-multibyte-characters.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 12 Mar 2008 20:48:46 +0000
parents 107ccd98fa12
children ee5932bf781d
comparison
equal deleted inserted replaced
92778:054fe9aaf3e3 92779:e9bef8bf2940
86 If this variable is set to nil, use internal function only." 86 If this variable is set to nil, use internal function only."
87 :type 'boolean 87 :type 'boolean
88 :group 'sha1) 88 :group 'sha1)
89 89
90 (defun sha1-string-external (string &optional binary) 90 (defun sha1-string-external (string &optional binary)
91 (let (prog args digest default-enable-multibyte-characters) 91 (let (prog args digest)
92 (if (consp sha1-program) 92 (if (consp sha1-program)
93 (setq prog (car sha1-program) 93 (setq prog (car sha1-program)
94 args (cdr sha1-program)) 94 args (cdr sha1-program))
95 (setq prog sha1-program 95 (setq prog sha1-program
96 args nil)) 96 args nil))
97 (with-temp-buffer 97 (with-temp-buffer
98 (set-buffer-multibyte nil)
98 (insert string) 99 (insert string)
99 (apply (function call-process-region) 100 (apply (function call-process-region)
100 (point-min)(point-max) 101 (point-min) (point-max)
101 prog t t nil args) 102 prog t t nil args)
102 ;; SHA1 is 40 bytes long in hexadecimal form. 103 ;; SHA1 is 40 bytes long in hexadecimal form.
103 (setq digest (buffer-substring (point-min)(+ (point-min) 40)))) 104 (setq digest (buffer-substring (point-min)(+ (point-min) 40))))
104 (if binary 105 (if binary
105 (decode-hex-string digest) 106 (decode-hex-string digest)