diff options
| author | Glenn Morris | 2007-04-11 03:59:20 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-04-11 03:59:20 +0000 |
| commit | a746fb658bd9f3ae6bcccf84dc6c431c48ffe995 (patch) | |
| tree | fcfe920aeea9f182c4524c6bad791a2be603e7e4 /lisp | |
| parent | 6f7e29f1d2e5c71de825072c83803fd0640e8d84 (diff) | |
| download | emacs-a746fb658bd9f3ae6bcccf84dc6c431c48ffe995.tar.gz emacs-a746fb658bd9f3ae6bcccf84dc6c431c48ffe995.zip | |
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).
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index de749e1d0c8..f1761c125ac 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -3149,6 +3149,8 @@ That command is designed for interactive use only" fn)) | |||
| 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) |
| @@ -3162,10 +3164,31 @@ That command is designed for interactive use only" fn)) | |||
| 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)))) |