unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Markus Triska <markus.triska@gmx.at>
To: Glenn Morris <rgm@gnu.org>
Cc: acm@muc.de, cyd@stupidchicken.com, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Nonsensical byte compiler warning.
Date: Tue, 10 Apr 2007 19:27:04 +0200	[thread overview]
Message-ID: <87lkh0ywbb.fsf@gmx.at> (raw)
In-Reply-To: <telkh0c2ca.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon\, 09 Apr 2007 23\:53\:09 -0400")

Glenn Morris <rgm@gnu.org> writes:

> installed

Thank you. Here's the remaining part:

2007-04-10  Markus Triska  <markus.triska@gmx.at>

	* 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))))

  reply	other threads:[~2007-04-10 17:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-01 17:14 Nonsensical byte compiler warning David Kastrup
2007-04-01 18:10 ` Chong Yidong
2007-04-01 20:57   ` Alan Mackenzie
2007-04-02 12:29   ` Richard Stallman
2007-04-04  4:48     ` Markus Triska
2007-04-04  6:15       ` David Kastrup
2007-04-04  8:19         ` Markus Triska
2007-04-04  8:46           ` David Kastrup
2007-04-04  9:50             ` Markus Triska
2007-04-04 10:17               ` David Kastrup
2007-04-04 12:35                 ` Markus Triska
2007-04-04 18:25                 ` Markus Triska
2007-04-04 22:13                   ` David Kastrup
2007-04-05  6:52             ` Richard Stallman
2007-04-05  7:55               ` Markus Triska
2007-04-06 12:56                 ` Richard Stallman
2007-04-06 15:11                   ` Chong Yidong
2007-04-08 20:47                   ` Markus Triska
2007-04-09 15:42                     ` Richard Stallman
2007-04-10  3:53                       ` Glenn Morris
2007-04-10 17:27                         ` Markus Triska [this message]
2007-04-11  4:00                           ` Glenn Morris
2007-04-05 18:01               ` Chong Yidong
2007-04-04 20:08           ` Alan Mackenzie
2007-04-04 21:45             ` Markus Triska
2007-04-04 22:11               ` Chong Yidong
2007-04-05  5:44                 ` Markus Triska
2007-04-08  1:21             ` Kim F. Storm
2007-04-08 11:27               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lkh0ywbb.fsf@gmx.at \
    --to=markus.triska@gmx.at \
    --cc=acm@muc.de \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).