unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* byte-opt.el: byte-optimize-backward-word
@ 2004-10-10  3:16 sri
  2004-10-10 14:28 ` Andreas Schwab
  2004-10-10 15:16 ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: sri @ 2004-10-10  3:16 UTC (permalink / raw)


Using GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
        of 2004-07-07 on localhost.localdomain.

In byte-opt.el:

(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-char -1))
;-------------^
        (t form)))

Shouldn't that be (forward-word -1)?  Also, backward-word requires an
argument; so, shouldn't Emacs complain here when it encounters 
backward-word without an argument.  (IIRC, several other optimizer
functions do something similar -- provide arguments when none is
there, for functions that require it.)

-Sriram

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: byte-opt.el: byte-optimize-backward-word
  2004-10-10  3:16 byte-opt.el: byte-optimize-backward-word sri
@ 2004-10-10 14:28 ` Andreas Schwab
  2004-10-10 15:16 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2004-10-10 14:28 UTC (permalink / raw)
  Cc: bug-gnu-emacs

sri@asu.edu writes:

> In byte-opt.el:
>
> (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-char -1))
> ;-------------^
>         (t form)))
>
> Shouldn't that be (forward-word -1)?

Yes, you are right.  Looks like a pasto.  And a rather old one.

> Also, backward-word requires an argument;

Not any more.  The argument is now optional in CVS.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: byte-opt.el: byte-optimize-backward-word
  2004-10-10  3:16 byte-opt.el: byte-optimize-backward-word sri
  2004-10-10 14:28 ` Andreas Schwab
@ 2004-10-10 15:16 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2004-10-10 15:16 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Thanks for finding this bug.  In the latest Emacs,
the argument to backward-word is optional, so it is a
real bug.  I will fix it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-10 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-10  3:16 byte-opt.el: byte-optimize-backward-word sri
2004-10-10 14:28 ` Andreas Schwab
2004-10-10 15:16 ` Richard Stallman

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