summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-06-07 18:35:47 -0700
committerGlenn Morris <rgm@gnu.org>2013-06-07 18:35:47 -0700
commit467f3b337c3f67ddf8380c52efbf49715fb5ea4c (patch)
treea8e13dafb5bf47dcc7b0dfa6bd51431aa890a5c4 /lisp/emacs-lisp/bytecomp.el
parent650645d50f03a64195b72e4c8d08a7e1c508de99 (diff)
downloademacs-467f3b337c3f67ddf8380c52efbf49715fb5ea4c.tar.gz
emacs-467f3b337c3f67ddf8380c52efbf49715fb5ea4c.tar.bz2
emacs-467f3b337c3f67ddf8380c52efbf49715fb5ea4c.zip
Improve previous bytecomp fix
* lisp/emacs-lisp/bytecomp.el (byte-compile-char-before) (byte-compile-backward-char, byte-compile-backward-word): Improve previous change, to handle non-explicit nil.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5efdd6a675c..e603f76f41d 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3446,6 +3446,7 @@ discarding."
(byte-defop-compiler (/ byte-quo) byte-compile-quo)
(byte-defop-compiler nconc)
+;; Is this worth it? Both -before and -after are written in C.
(defun byte-compile-char-before (form)
(cond ((or (= 1 (length form))
(and (= 2 (length form)) (not (nth 1 form))))
@@ -3453,10 +3454,12 @@ discarding."
((= 2 (length form))
(byte-compile-form (list 'char-after (if (numberp (nth 1 form))
(1- (nth 1 form))
- `(1- ,(nth 1 form))))))
+ `(1- (or ,(nth 1 form)
+ (point)))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
;; backward-... ==> forward-... with negated argument.
+;; Is this worth it? Both -backward and -forward are written in C.
(defun byte-compile-backward-char (form)
(cond ((or (= 1 (length form))
(and (= 2 (length form)) (not (nth 1 form))))
@@ -3464,7 +3467,7 @@ discarding."
((= 2 (length form))
(byte-compile-form (list 'forward-char (if (numberp (nth 1 form))
(- (nth 1 form))
- `(- ,(nth 1 form))))))
+ `(- (or ,(nth 1 form) 1))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-backward-word (form)
@@ -3474,7 +3477,7 @@ discarding."
((= 2 (length form))
(byte-compile-form (list 'forward-word (if (numberp (nth 1 form))
(- (nth 1 form))
- `(- ,(nth 1 form))))))
+ `(- (or ,(nth 1 form) 1))))))
(t (byte-compile-subr-wrong-args form "0-1"))))
(defun byte-compile-list (form)