From: Markus Triska <markus.triska@gmx.at>
To: rms@gnu.org
Cc: acm@muc.de, cyd@stupidchicken.com, emacs-devel@gnu.org
Subject: Re: Nonsensical byte compiler warning.
Date: Sun, 08 Apr 2007 22:47:34 +0200 [thread overview]
Message-ID: <87tzvqpp95.fsf@gmx.at> (raw)
In-Reply-To: <E1HZnzv-0007t3-UT@fencepost.gnu.org> (Richard Stallman's message of "Fri\, 06 Apr 2007 08\:56\:59 -0400")
Richard Stallman <rms@gnu.org> 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 <markus.triska@gmx.at>
* 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 ----
\f
;; 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)
next prev parent reply other threads:[~2007-04-08 20:47 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 [this message]
2007-04-09 15:42 ` Richard Stallman
2007-04-10 3:53 ` Glenn Morris
2007-04-10 17:27 ` Markus Triska
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=87tzvqpp95.fsf@gmx.at \
--to=markus.triska@gmx.at \
--cc=acm@muc.de \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@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).