summaryrefslogtreecommitdiff
path: root/lisp/gnus/binhex.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>2000-11-01 14:46:55 +0000
committerDave Love <fx@gnu.org>2000-11-01 14:46:55 +0000
commitdd8955f010bec28b040388b288349834fe9b038a (patch)
treec0b51e7c4f9a3844fecf0f7b56707c2ca20ed34c /lisp/gnus/binhex.el
parentcd66d2ed41e603162041ee546caf692f548800c9 (diff)
downloademacs-dd8955f010bec28b040388b288349834fe9b038a.tar.gz
Use (featurep 'xemacs).
(binhex-char-int): New alias, replacing char-int. Change callers. (binhex-decode-region): Simplify work buffer code. (binhex-decode-region-external): Use expand-file-name, not concat.
Diffstat (limited to 'lisp/gnus/binhex.el')
-rw-r--r--lisp/gnus/binhex.el31
1 files changed, 13 insertions, 18 deletions
diff --git a/lisp/gnus/binhex.el b/lisp/gnus/binhex.el
index 200d571a4b0..1b096287240 100644
--- a/lisp/gnus/binhex.el
+++ b/lisp/gnus/binhex.el
@@ -28,8 +28,10 @@
(eval-when-compile (require 'cl))
-(if (not (fboundp 'char-int))
- (fset 'char-int 'identity))
+(defalias 'binhex-char-int
+ (if (fboundp 'char-int)
+ 'char-int
+ 'identity))
(defvar binhex-decoder-program "hexbin"
"*Non-nil value should be a string that names a uu decoder.
@@ -67,7 +69,7 @@ input and write the converted data to its standard output.")
((boundp 'temporary-file-directory) temporary-file-directory)
("/tmp/")))
-(if (string-match "XEmacs" emacs-version)
+(if (featurep 'xemacs)
(defalias 'binhex-insert-char 'insert-char)
(defun binhex-insert-char (char &optional count ignored buffer)
(if (or (null buffer) (eq buffer (current-buffer)))
@@ -132,14 +134,14 @@ input and write the converted data to its standard output.")
(defun binhex-string-big-endian (string)
(let ((ret 0) (i 0) (len (length string)))
(while (< i len)
- (setq ret (+ (lsh ret 8) (char-int (aref string i)))
+ (setq ret (+ (lsh ret 8) (binhex-char-int (aref string i)))
i (1+ i)))
ret))
(defun binhex-string-little-endian (string)
(let ((ret 0) (i 0) (shift 0) (len (length string)))
(while (< i len)
- (setq ret (+ ret (lsh (char-int (aref string i)) shift))
+ (setq ret (+ ret (lsh (binhex-char-int (aref string i)) shift))
i (1+ i)
shift (+ shift 8)))
ret))
@@ -149,11 +151,11 @@ input and write the converted data to its standard output.")
(let ((pos (point-min)) len)
(vector
(prog1
- (setq len (char-int (char-after pos)))
+ (setq len (binhex-char-int (char-after pos)))
(setq pos (1+ pos)))
(buffer-substring pos (setq pos (+ pos len)))
(prog1
- (setq len (char-int (char-after pos)))
+ (setq len (binhex-char-int (char-after pos)))
(setq pos (1+ pos)))
(buffer-substring pos (setq pos (+ pos 4)))
(buffer-substring pos (setq pos (+ pos 4)))
@@ -198,15 +200,8 @@ If HEADER-ONLY is non-nil only decode header and return filename."
(save-excursion
(goto-char start)
(when (re-search-forward binhex-begin-line end t)
- (if (and (not (string-match "XEmacs\\|Lucid" emacs-version))
- (boundp 'enable-multibyte-characters))
- (let ((multibyte
- (default-value 'enable-multibyte-characters)))
- (setq-default enable-multibyte-characters nil)
- (setq work-buffer (generate-new-buffer " *binhex-work*"))
- (setq-default enable-multibyte-characters multibyte))
+ (let (default-enable-multibyte-characters)
(setq work-buffer (generate-new-buffer " *binhex-work*")))
- (buffer-disable-undo work-buffer)
(beginning-of-line)
(setq bits 0 counter 0)
(while tmp
@@ -267,9 +262,9 @@ If HEADER-ONLY is non-nil only decode header and return filename."
"Binhex decode region between START and END using external decoder."
(interactive "r")
(let ((cbuf (current-buffer)) firstline work-buffer status
- (file-name (concat binhex-temporary-file-directory
- (binhex-decode-region start end t)
- ".data")))
+ (file-name (expand-file-name
+ (concat (binhex-decode-region start end t) ".data")
+ binhex-temporary-file-directory)))
(save-excursion
(goto-char start)
(when (re-search-forward binhex-begin-line nil t)