[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nonsensical byte compiler warning.
From: |
Markus Triska |
Subject: |
Re: Nonsensical byte compiler warning. |
Date: |
Tue, 10 Apr 2007 19:27:04 +0200 |
Glenn Morris <address@hidden> writes:
> installed
Thank you. Here's the remaining part:
2007-04-10 Markus Triska <address@hidden>
* emacs-lisp/byte-opt.el (byte-optimize-backward-char)
(byte-optimize-backward-word): Remove (move to bytecomp.el)
* emacs-lisp/bytecomp.el (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).
Index: byte-opt.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/byte-opt.el,v
retrieving revision 1.92
diff -c -r1.92 byte-opt.el
*** byte-opt.el 10 Apr 2007 03:55:17 -0000 1.92
--- byte-opt.el 10 Apr 2007 09:04:21 -0000
***************
*** 1117,1142 ****
(byte-optimize-predicate form))
form))
- ;; Avoid having to write forward-... with a negative arg for speed.
- ;; Fixme: don't be limited to constant args.
- (put 'backward-char 'byte-optimizer 'byte-optimize-backward-char)
- (defun byte-optimize-backward-char (form)
- (cond ((and (= 2 (safe-length form))
- (numberp (nth 1 form)))
- (list 'forward-char (eval (- (nth 1 form)))))
- ((= 1 (safe-length form))
- '(forward-char -1))
- (t form)))
-
- (put 'backward-word 'byte-optimizer 'byte-optimize-backward-word)
- (defun byte-optimize-backward-word (form)
- (cond ((and (= 2 (safe-length form))
- (numberp (nth 1 form)))
- (list 'forward-word (eval (- (nth 1 form)))))
- ((= 1 (safe-length form))
- '(forward-word -1))
- (t form)))
-
;; Fixme: delete-char -> delete-region (byte-coded)
;; optimize string-as-unibyte, string-as-multibyte, string-make-unibyte,
;; string-make-multibyte for constant args.
--- 1117,1122 ----
Index: bytecomp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v
retrieving revision 2.197
diff -c -r2.197 bytecomp.el
*** bytecomp.el 10 Apr 2007 03:54:36 -0000 2.197
--- bytecomp.el 10 Apr 2007 09:07:07 -0000
***************
*** 3149,3154 ****
--- 3149,3156 ----
;; more complicated compiler macros
(byte-defop-compiler char-before)
+ (byte-defop-compiler backward-char)
+ (byte-defop-compiler backward-word)
(byte-defop-compiler list)
(byte-defop-compiler concat)
(byte-defop-compiler fset)
***************
*** 3162,3171 ****
(defun byte-compile-char-before (form)
(cond ((= 2 (length form))
! (byte-compile-form `(char-after (1- ,(nth 1 form)))))
! ((= 1 (length form))
! (byte-compile-form '(char-after (1- (point)))))
! (t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-list (form)
(let ((count (length (cdr form))))
--- 3164,3194 ----
(defun byte-compile-char-before (form)
(cond ((= 2 (length form))
! (byte-compile-form (list 'char-after (if (numberp (nth 1 form))
! (1- (nth 1 form))
! `(1- ,(nth 1 form))))))
! ((= 1 (length form))
! (byte-compile-form '(char-after (1- (point)))))
! (t (byte-compile-subr-wrong-args form "0-1"))))
!
! ;; backward-... ==> forward-... with negated argument.
! (defun byte-compile-backward-char (form)
! (cond ((= 2 (length form))
! (byte-compile-form (list 'forward-char (if (numberp (nth 1 form))
! (- (nth 1 form))
! `(- ,(nth 1 form))))))
! ((= 1 (length form))
! (byte-compile-form '(forward-char -1)))
! (t (byte-compile-subr-wrong-args form "0-1"))))
!
! (defun byte-compile-backward-word (form)
! (cond ((= 2 (length form))
! (byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
! (- (nth 1 form))
! `(- ,(nth 1 form))))))
! ((= 1 (length form))
! (byte-compile-form '(forward-word -1)))
! (t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-list (form)
(let ((count (length (cdr form))))
- Re: Nonsensical byte compiler warning., (continued)
- Re: Nonsensical byte compiler warning., Richard Stallman, 2007/04/05
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/05
- Re: Nonsensical byte compiler warning., Richard Stallman, 2007/04/06
- Re: Nonsensical byte compiler warning., Chong Yidong, 2007/04/06
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/08
- Re: Nonsensical byte compiler warning., Richard Stallman, 2007/04/09
- Re: Nonsensical byte compiler warning., Glenn Morris, 2007/04/09
- Re: Nonsensical byte compiler warning.,
Markus Triska <=
- Re: Nonsensical byte compiler warning., Glenn Morris, 2007/04/11
- Re: Nonsensical byte compiler warning., Chong Yidong, 2007/04/05
- Re: Nonsensical byte compiler warning., Alan Mackenzie, 2007/04/04
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/04
- Re: Nonsensical byte compiler warning., Chong Yidong, 2007/04/04
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/05
- Re: Nonsensical byte compiler warning., Kim F. Storm, 2007/04/07
- Re: Nonsensical byte compiler warning., Alan Mackenzie, 2007/04/08