From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.devel Subject: Re: Nonsensical byte compiler warning. Date: Tue, 10 Apr 2007 19:27:04 +0200 Message-ID: <87lkh0ywbb.fsf@gmx.at> References: <85ps6okoe5.fsf@lola.goethe.zz> <87lkhcj791.fsf@stupidchicken.com> <87tzvwvj6c.fsf@gmx.at> <861wj04qcq.fsf@lola.quinscape.zz> <873b3gpn4u.fsf@gmx.at> <86fy7g34tk.fsf@lola.quinscape.zz> <87r6qzqmpg.fsf@gmx.at> <87tzvqpp95.fsf@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1176238373 24558 80.91.229.12 (10 Apr 2007 20:52:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2007 20:52:53 +0000 (UTC) Cc: acm@muc.de, cyd@stupidchicken.com, rms@gnu.org, emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 10 22:51:58 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HbK7n-0007Oz-OT for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 19:27:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbKBk-00066u-PW for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 13:31:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HbKBh-00063u-Fr for emacs-devel@gnu.org; Tue, 10 Apr 2007 13:31:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HbKBf-0005yg-J3 for emacs-devel@gnu.org; Tue, 10 Apr 2007 13:31:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbKBf-0005xr-CF for emacs-devel@gnu.org; Tue, 10 Apr 2007 13:31:23 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1HbK7c-0005PT-Pd for emacs-devel@gnu.org; Tue, 10 Apr 2007 13:27:13 -0400 Original-Received: (qmail invoked by alias); 10 Apr 2007 17:27:10 -0000 Original-Received: from chello062178240212.3.14.tuwien.teleweb.at (EHLO enterprise) [62.178.240.212] by mail.gmx.net (mp005) with SMTP; 10 Apr 2007 19:27:10 +0200 X-Authenticated: #4064391 X-Provags-ID: V01U2FsdGVkX19u8BpyJQBuvG1Hxu+/e6jvRsSwanBxdX8rDWG1sS Zt7qW0uahF4Bhc In-Reply-To: (Glenn Morris's message of "Mon\, 09 Apr 2007 23\:53\:09 -0400") X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69263 Archived-At: Glenn Morris writes: > installed Thank you. Here's the remaining part: 2007-04-10 Markus Triska * 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))))