[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: |
Sun, 08 Apr 2007 22:47:34 +0200 |
Richard Stallman <address@hidden> writes:
> I agree this is too hard to change now.
> However, it would have been premature to give up without
> checking.
Sure; here's a rather trivial compromise for `char-before': It makes
the compiler rewrite calls to char-before at the time the byte-code is
emitted instead of during the optimisation phase. This retains the
correct function call in the warning. It can yield slightly inferior
byte-code though (with usage-patterns that don't occur in Emacs trunk
and are probably rather atypical). If you find this change advisable,
I'll implement analogous changes for backward-char and backward-word.
2007-04-08 Markus Triska <address@hidden>
* emacs-lisp/byte-opt.el: remove char-before rewriting
* emacs-lisp/bytecomp.el: add char-before rewriting
*** byte-opt.el 04 Apr 2007 19:36:54 +0200 1.88
--- byte-opt.el 08 Apr 2007 21:33:44 +0200
***************
*** 1158,1171 ****
'(forward-word -1))
(t form)))
- (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
- (defun byte-optimize-char-before (form)
- (cond ((= 2 (safe-length form))
- `(char-after (1- ,(nth 1 form))))
- ((= 1 (safe-length form))
- '(char-after (1- (point))))
- (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.
--- 1158,1163 ----
*** bytecomp.el 27 Mar 2007 08:08:58 +0200 2.196
--- bytecomp.el 08 Apr 2007 21:52:58 +0200
***************
*** 3148,3153 ****
--- 3148,3154 ----
;; more complicated compiler macros
+ (byte-defop-compiler char-before)
(byte-defop-compiler list)
(byte-defop-compiler concat)
(byte-defop-compiler fset)
***************
*** 3159,3164 ****
--- 3160,3172 ----
(byte-defop-compiler19 (/ byte-quo) byte-compile-quo)
(byte-defop-compiler19 nconc)
+ (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))))
(cond ((= count 0)
- Re: Nonsensical byte compiler warning., (continued)
- Re: Nonsensical byte compiler warning., David Kastrup, 2007/04/04
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/04
- Re: Nonsensical byte compiler warning., David Kastrup, 2007/04/04
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/04
- Re: Nonsensical byte compiler warning., Markus Triska, 2007/04/04
- Re: Nonsensical byte compiler warning., David Kastrup, 2007/04/04
- 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 <=
- 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, 2007/04/10
- 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