aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2006-10-22 22:32:53 +0000
committerKim F. Storm2006-10-22 22:32:53 +0000
commitfb1a5d8a82d2a3bba1f66c1825e85540d625412d (patch)
tree3aff79b0ca83e516520de61b74cd9eab9ecb641b
parentcbfe778a8534e0f862d14391a8136d5211067913 (diff)
downloademacs-fb1a5d8a82d2a3bba1f66c1825e85540d625412d.tar.gz
emacs-fb1a5d8a82d2a3bba1f66c1825e85540d625412d.zip
(add-to-list): Optimize if compare-fn is `eq' or `eql'.
(sit-for): If last command was a prefix arg, add the read-ahead event to unread-command-events as (t . EVENT) so it will be added to this-command-keys by read-key-sequence.
-rw-r--r--lisp/subr.el30
1 files changed, 21 insertions, 9 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 1f874be60e0..957d098703f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1100,13 +1100,19 @@ until a certain package is loaded, you should put the call to `add-to-list'
1100into a hook function that will be run only after loading the package. 1100into a hook function that will be run only after loading the package.
1101`eval-after-load' provides one way to do this. In some cases 1101`eval-after-load' provides one way to do this. In some cases
1102other hooks, such as major mode hooks, can do the job." 1102other hooks, such as major mode hooks, can do the job."
1103 (if (if compare-fn 1103 (if (cond
1104 (let (present) 1104 ((eq compare-fn 'eq)
1105 (dolist (elt (symbol-value list-var)) 1105 (memq element (symbol-value list-var)))
1106 (if (funcall compare-fn element elt) 1106 ((eq compare-fn 'eql)
1107 (setq present t))) 1107 (memql element (symbol-value list-var)))
1108 present) 1108 (compare-fn
1109 (member element (symbol-value list-var))) 1109 (let (present)
1110 (dolist (elt (symbol-value list-var))
1111 (if (funcall compare-fn element elt)
1112 (setq present t)))
1113 present))
1114 (t
1115 (member element (symbol-value list-var))))
1110 (symbol-value list-var) 1116 (symbol-value list-var)
1111 (set list-var 1117 (set list-var
1112 (if append 1118 (if append
@@ -1752,8 +1758,14 @@ floating point support.
1752 (or nodisp (redisplay)) 1758 (or nodisp (redisplay))
1753 (let ((read (read-event nil nil seconds))) 1759 (let ((read (read-event nil nil seconds)))
1754 (or (null read) 1760 (or (null read)
1755 (progn (push read unread-command-events) 1761 (progn
1756 nil)))))) 1762 ;; If last command was a prefix arg, e.g. C-u, push this event onto
1763 ;; unread-command-events as (t . EVENT) so it will be added to
1764 ;; this-command-keys by read-key-sequence.
1765 (if (eq overriding-terminal-local-map universal-argument-map)
1766 (setq read (cons t read)))
1767 (push read unread-command-events)
1768 nil))))))
1757 1769
1758;;; Atomic change groups. 1770;;; Atomic change groups.
1759 1771