comparison lisp/emacs-lisp/bytecomp.el @ 77119:8e8844e56964

Markus Triska <markus.triska at gmx.at>: (byte-compile-char-before): Improve numeric argument case. (byte-compile-backward-char, byte-compile-backward-word): New functions, performing rewriting previously done in byte-opt.el. Fix their "Fixme" item (restriction to numeric arguments).
author Glenn Morris <rgm@gnu.org>
date Wed, 11 Apr 2007 03:59:20 +0000
parents 14feb20665af
children 964d6961bdb6 908a902d5545 dc002877ce12 e6fdae9180d4
comparison
equal deleted inserted replaced
77118:c7fe4de39577 77119:8e8844e56964
3147 3147
3148 3148
3149 ;; more complicated compiler macros 3149 ;; more complicated compiler macros
3150 3150
3151 (byte-defop-compiler char-before) 3151 (byte-defop-compiler char-before)
3152 (byte-defop-compiler backward-char)
3153 (byte-defop-compiler backward-word)
3152 (byte-defop-compiler list) 3154 (byte-defop-compiler list)
3153 (byte-defop-compiler concat) 3155 (byte-defop-compiler concat)
3154 (byte-defop-compiler fset) 3156 (byte-defop-compiler fset)
3155 (byte-defop-compiler (indent-to-column byte-indent-to) byte-compile-indent-to) 3157 (byte-defop-compiler (indent-to-column byte-indent-to) byte-compile-indent-to)
3156 (byte-defop-compiler indent-to) 3158 (byte-defop-compiler indent-to)
3160 (byte-defop-compiler19 (/ byte-quo) byte-compile-quo) 3162 (byte-defop-compiler19 (/ byte-quo) byte-compile-quo)
3161 (byte-defop-compiler19 nconc) 3163 (byte-defop-compiler19 nconc)
3162 3164
3163 (defun byte-compile-char-before (form) 3165 (defun byte-compile-char-before (form)
3164 (cond ((= 2 (length form)) 3166 (cond ((= 2 (length form))
3165 (byte-compile-form `(char-after (1- ,(nth 1 form))))) 3167 (byte-compile-form (list 'char-after (if (numberp (nth 1 form))
3166 ((= 1 (length form)) 3168 (1- (nth 1 form))
3167 (byte-compile-form '(char-after (1- (point))))) 3169 `(1- ,(nth 1 form))))))
3168 (t (byte-compile-subr-wrong-args form "0-1")))) 3170 ((= 1 (length form))
3171 (byte-compile-form '(char-after (1- (point)))))
3172 (t (byte-compile-subr-wrong-args form "0-1"))))
3173
3174 ;; backward-... ==> forward-... with negated argument.
3175 (defun byte-compile-backward-char (form)
3176 (cond ((= 2 (length form))
3177 (byte-compile-form (list 'forward-char (if (numberp (nth 1 form))
3178 (- (nth 1 form))
3179 `(- ,(nth 1 form))))))
3180 ((= 1 (length form))
3181 (byte-compile-form '(forward-char -1)))
3182 (t (byte-compile-subr-wrong-args form "0-1"))))
3183
3184 (defun byte-compile-backward-word (form)
3185 (cond ((= 2 (length form))
3186 (byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
3187 (- (nth 1 form))
3188 `(- ,(nth 1 form))))))
3189 ((= 1 (length form))
3190 (byte-compile-form '(forward-word -1)))
3191 (t (byte-compile-subr-wrong-args form "0-1"))))
3169 3192
3170 (defun byte-compile-list (form) 3193 (defun byte-compile-list (form)
3171 (let ((count (length (cdr form)))) 3194 (let ((count (length (cdr form))))
3172 (cond ((= count 0) 3195 (cond ((= count 0)
3173 (byte-compile-constant nil)) 3196 (byte-compile-constant nil))