diff options
author | Kim F. Storm <storm@cua.dk> | 2006-10-22 22:32:53 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2006-10-22 22:32:53 +0000 |
commit | fb1a5d8a82d2a3bba1f66c1825e85540d625412d (patch) | |
tree | 3aff79b0ca83e516520de61b74cd9eab9ecb641b /lisp/subr.el | |
parent | cbfe778a8534e0f862d14391a8136d5211067913 (diff) | |
download | emacs-fb1a5d8a82d2a3bba1f66c1825e85540d625412d.tar.gz |
(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.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 30 |
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' into a hook function that will be run only after loading the package. `eval-after-load' provides one way to do this. In some cases other hooks, such as major mode hooks, can do the job." - (if (if compare-fn - (let (present) - (dolist (elt (symbol-value list-var)) - (if (funcall compare-fn element elt) - (setq present t))) - present) - (member element (symbol-value list-var))) + (if (cond + ((eq compare-fn 'eq) + (memq element (symbol-value list-var))) + ((eq compare-fn 'eql) + (memql element (symbol-value list-var))) + (compare-fn + (let (present) + (dolist (elt (symbol-value list-var)) + (if (funcall compare-fn element elt) + (setq present t))) + present)) + (t + (member element (symbol-value list-var)))) (symbol-value list-var) (set list-var (if append @@ -1752,8 +1758,14 @@ floating point support. (or nodisp (redisplay)) (let ((read (read-event nil nil seconds))) (or (null read) - (progn (push read unread-command-events) - nil)))))) + (progn + ;; If last command was a prefix arg, e.g. C-u, push this event onto + ;; unread-command-events as (t . EVENT) so it will be added to + ;; this-command-keys by read-key-sequence. + (if (eq overriding-terminal-local-map universal-argument-map) + (setq read (cons t read))) + (push read unread-command-events) + nil)))))) ;;; Atomic change groups. |