1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

(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.
This commit is contained in:
Kim F. Storm 2006-10-22 22:32:53 +00:00
parent cbfe778a85
commit fb1a5d8a82

View file

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