aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-04-11 08:30:29 +0200
committerJoakim Verona2013-04-11 08:30:29 +0200
commit59e6916b93fa902aee35ddc7272556a53dab946e (patch)
treea8e51285d946300be9e1ca02d98843a8f5265eeb
parenta1002a150a8497832b98f167cb4ecd807f1684e7 (diff)
parentf07accae655f61468f3441dc48b61b5f125b601f (diff)
downloademacs-59e6916b93fa902aee35ddc7272556a53dab946e.tar.gz
emacs-59e6916b93fa902aee35ddc7272556a53dab946e.zip
auto upstream
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/emacs-lisp/timer.el151
-rw-r--r--lisp/gnus/ChangeLog12
-rw-r--r--lisp/gnus/nnir.el109
-rw-r--r--lisp/mpc.el33
-rw-r--r--lisp/textmodes/reftex-cite.el6
-rw-r--r--src/ChangeLog12
-rw-r--r--src/frame.c16
-rw-r--r--src/keyboard.c11
9 files changed, 208 insertions, 162 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 01887620250..c7ac52fac32 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
12013-04-10 Tassilo Horn <tsdh@gnu.org>
2
3 * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut
4 off leading { and trailing } from field values.
5
62013-04-10 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * emacs-lisp/timer.el (timer--check): New function.
9 (timer--time, timer-set-function, timer-event-handler): Use it.
10 (timer-set-idle-time): Simplify.
11 (timer--activate): CSE.
12 (timer-event-handler): Give more info in error message.
13 (internal-timer-start-idle): New function, moved from C.
14
15 * mpc.el (mpc-proc): Add `restart' argument.
16 (mpc-proc-cmd): Use it.
17 (mpc--status-timer-run): Also catch signals from `mpc-proc'.
18 (mpc-status-buffer-show, mpc-tagbrowser-dir-toggle): Call `mpc-proc'
19 less often.
20
12013-04-10 Masatake YAMATO <yamato@redhat.com> 212013-04-10 Masatake YAMATO <yamato@redhat.com>
2 22
3 * progmodes/sh-script.el: Implement `sh-mode' own 23 * progmodes/sh-script.el: Implement `sh-mode' own
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 8b1dca8cb78..a1bba2ddb6e 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -27,27 +27,34 @@
27 27
28;;; Code: 28;;; Code:
29 29
30;; Layout of a timer vector:
31;; [triggered-p high-seconds low-seconds usecs repeat-delay
32;; function args idle-delay psecs]
33;; triggered-p is nil if the timer is active (waiting to be triggered),
34;; t if it is inactive ("already triggered", in theory)
35
36(eval-when-compile (require 'cl-lib)) 30(eval-when-compile (require 'cl-lib))
37 31
38(cl-defstruct (timer 32(cl-defstruct (timer
39 (:constructor nil) 33 (:constructor nil)
40 (:copier nil) 34 (:copier nil)
41 (:constructor timer-create ()) 35 (:constructor timer-create ())
42 (:type vector) 36 (:type vector)
43 (:conc-name timer--)) 37 (:conc-name timer--))
38 ;; nil if the timer is active (waiting to be triggered),
39 ;; non-nil if it is inactive ("already triggered", in theory).
44 (triggered t) 40 (triggered t)
45 high-seconds low-seconds usecs repeat-delay function args idle-delay psecs) 41 ;; Time of next trigger: for normal timers, absolute time, for idle timers,
42 ;; time relative to idle-start.
43 high-seconds low-seconds usecs
44 ;; For normal timers, time between repetitions, or nil. For idle timers,
45 ;; non-nil iff repeated.
46 repeat-delay
47 function args ;What to do when triggered.
48 idle-delay ;If non-nil, this is an idle-timer.
49 psecs)
46 50
47(defun timerp (object) 51(defun timerp (object)
48 "Return t if OBJECT is a timer." 52 "Return t if OBJECT is a timer."
49 (and (vectorp object) (= (length object) 9))) 53 (and (vectorp object) (= (length object) 9)))
50 54
55(defsubst timer--check (timer)
56 (or (timerp timer) (signal 'wrong-type-argument (list #'timerp timer))))
57
51;; Pseudo field `time'. 58;; Pseudo field `time'.
52(defun timer--time (timer) 59(defun timer--time (timer)
53 (list (timer--high-seconds timer) 60 (list (timer--high-seconds timer)
@@ -57,17 +64,17 @@
57 64
58(gv-define-simple-setter timer--time 65(gv-define-simple-setter timer--time
59 (lambda (timer time) 66 (lambda (timer time)
60 (or (timerp timer) (error "Invalid timer")) 67 (timer--check timer)
61 (setf (timer--high-seconds timer) (pop time)) 68 (setf (timer--high-seconds timer) (pop time))
62 (let ((low time) (usecs 0) (psecs 0)) 69 (let ((low time) (usecs 0) (psecs 0))
63 (if (consp time) 70 (if (consp time)
64 (progn 71 (progn
65 (setq low (pop time)) 72 (setq low (pop time))
66 (if time 73 (if time
67 (progn 74 (progn
68 (setq usecs (pop time)) 75 (setq usecs (pop time))
69 (if time 76 (if time
70 (setq psecs (car time))))))) 77 (setq psecs (car time)))))))
71 (setf (timer--low-seconds timer) low) 78 (setf (timer--low-seconds timer) low)
72 (setf (timer--usecs timer) usecs) 79 (setf (timer--usecs timer) usecs)
73 (setf (timer--psecs timer) psecs)))) 80 (setf (timer--psecs timer) psecs))))
@@ -83,15 +90,13 @@ fire repeatedly that many seconds apart."
83 timer) 90 timer)
84 91
85(defun timer-set-idle-time (timer secs &optional repeat) 92(defun timer-set-idle-time (timer secs &optional repeat)
93 ;; FIXME: Merge with timer-set-time.
86 "Set the trigger idle time of TIMER to SECS. 94 "Set the trigger idle time of TIMER to SECS.
87SECS may be an integer, floating point number, or the internal 95SECS may be an integer, floating point number, or the internal
88time format returned by, e.g., `current-idle-time'. 96time format returned by, e.g., `current-idle-time'.
89If optional third argument REPEAT is non-nil, make the timer 97If optional third argument REPEAT is non-nil, make the timer
90fire each time Emacs is idle for that many seconds." 98fire each time Emacs is idle for that many seconds."
91 (if (consp secs) 99 (setf (timer--time timer) (if (consp secs) secs (seconds-to-time secs)))
92 (setf (timer--time timer) secs)
93 (setf (timer--time timer) '(0 0 0))
94 (timer-inc-time timer secs))
95 (setf (timer--repeat-delay timer) repeat) 100 (setf (timer--repeat-delay timer) repeat)
96 timer) 101 timer)
97 102
@@ -156,8 +161,7 @@ fire repeatedly that many seconds apart."
156 161
157(defun timer-set-function (timer function &optional args) 162(defun timer-set-function (timer function &optional args)
158 "Make TIMER call FUNCTION with optional ARGS when triggering." 163 "Make TIMER call FUNCTION with optional ARGS when triggering."
159 (or (timerp timer) 164 (timer--check timer)
160 (error "Invalid timer"))
161 (setf (timer--function timer) function) 165 (setf (timer--function timer) function)
162 (setf (timer--args timer) args) 166 (setf (timer--args timer) args)
163 timer) 167 timer)
@@ -181,9 +185,10 @@ fire repeatedly that many seconds apart."
181 (setcdr reuse-cell timers)) 185 (setcdr reuse-cell timers))
182 (setq reuse-cell (cons timer timers))) 186 (setq reuse-cell (cons timer timers)))
183 ;; Insert new timer after last which possibly means in front of queue. 187 ;; Insert new timer after last which possibly means in front of queue.
184 (cond (last (setcdr last reuse-cell)) 188 (setf (cond (last (cdr last))
185 (idle (setq timer-idle-list reuse-cell)) 189 (idle timer-idle-list)
186 (t (setq timer-list reuse-cell))) 190 (t timer-list))
191 reuse-cell)
187 (setf (timer--triggered timer) triggered-p) 192 (setf (timer--triggered timer) triggered-p)
188 (setf (timer--idle-delay timer) idle) 193 (setf (timer--idle-delay timer) idle)
189 nil) 194 nil)
@@ -223,8 +228,7 @@ timer will fire right away."
223 228
224(defun cancel-timer (timer) 229(defun cancel-timer (timer)
225 "Remove TIMER from the list of active timers." 230 "Remove TIMER from the list of active timers."
226 (or (timerp timer) 231 (timer--check timer)
227 (error "Invalid timer"))
228 (setq timer-list (delq timer timer-list)) 232 (setq timer-list (delq timer timer-list))
229 (setq timer-idle-list (delq timer timer-idle-list)) 233 (setq timer-idle-list (delq timer timer-idle-list))
230 nil) 234 nil)
@@ -283,44 +287,47 @@ This function is called, by name, directly by the C code."
283 (setq timer-event-last-1 timer-event-last) 287 (setq timer-event-last-1 timer-event-last)
284 (setq timer-event-last timer) 288 (setq timer-event-last timer)
285 (let ((inhibit-quit t)) 289 (let ((inhibit-quit t))
286 (if (timerp timer) 290 (timer--check timer)
287 (let (retrigger cell) 291 (let ((retrigger nil)
288 ;; Delete from queue. Record the cons cell that was used. 292 (cell
289 (setq cell (cancel-timer-internal timer)) 293 ;; Delete from queue. Record the cons cell that was used.
290 ;; Re-schedule if requested. 294 (cancel-timer-internal timer)))
291 (if (timer--repeat-delay timer) 295 ;; Re-schedule if requested.
292 (if (timer--idle-delay timer) 296 (if (timer--repeat-delay timer)
293 (timer-activate-when-idle timer nil cell) 297 (if (timer--idle-delay timer)
294 (timer-inc-time timer (timer--repeat-delay timer) 0) 298 (timer-activate-when-idle timer nil cell)
295 ;; If real time has jumped forward, 299 (timer-inc-time timer (timer--repeat-delay timer) 0)
296 ;; perhaps because Emacs was suspended for a long time, 300 ;; If real time has jumped forward,
297 ;; limit how many times things get repeated. 301 ;; perhaps because Emacs was suspended for a long time,
298 (if (and (numberp timer-max-repeats) 302 ;; limit how many times things get repeated.
299 (< 0 (timer-until timer (current-time)))) 303 (if (and (numberp timer-max-repeats)
300 (let ((repeats (/ (timer-until timer (current-time)) 304 (< 0 (timer-until timer (current-time))))
301 (timer--repeat-delay timer)))) 305 (let ((repeats (/ (timer-until timer (current-time))
302 (if (> repeats timer-max-repeats) 306 (timer--repeat-delay timer))))
303 (timer-inc-time timer (* (timer--repeat-delay timer) 307 (if (> repeats timer-max-repeats)
304 repeats))))) 308 (timer-inc-time timer (* (timer--repeat-delay timer)
305 (timer-activate timer t cell) 309 repeats)))))
306 (setq retrigger t))) 310 ;; Place it back on the timer-list before running
307 ;; Run handler. 311 ;; timer--function, so it can cancel-timer itself.
308 ;; We do this after rescheduling so that the handler function 312 (timer-activate timer t cell)
309 ;; can cancel its own timer successfully with cancel-timer. 313 (setq retrigger t)))
310 (condition-case-unless-debug err 314 ;; Run handler.
311 ;; Timer functions should not change the current buffer. 315 (condition-case-unless-debug err
312 ;; If they do, all kinds of nasty surprises can happen, 316 ;; Timer functions should not change the current buffer.
313 ;; and it can be hellish to track down their source. 317 ;; If they do, all kinds of nasty surprises can happen,
314 (save-current-buffer 318 ;; and it can be hellish to track down their source.
315 (apply (timer--function timer) (timer--args timer))) 319 (save-current-buffer
316 (error (message "Error in timer: %S" err))) 320 (apply (timer--function timer) (timer--args timer)))
317 (when (and retrigger 321 (error (message "Error running timer%s: %S"
318 ;; If the timer's been canceled, don't "retrigger" it 322 (if (symbolp (timer--function timer))
319 ;; since it might still be in the copy of timer-list kept 323 (format " `%s'" (timer--function timer)) "")
320 ;; by keyboard.c:timer_check (bug#14156). 324 err)))
321 (memq timer timer-list)) 325 (when (and retrigger
322 (setf (timer--triggered timer) nil))) 326 ;; If the timer's been canceled, don't "retrigger" it
323 (error "Bogus timer event")))) 327 ;; since it might still be in the copy of timer-list kept
328 ;; by keyboard.c:timer_check (bug#14156).
329 (memq timer timer-list))
330 (setf (timer--triggered timer) nil)))))
324 331
325;; This function is incompatible with the one in levents.el. 332;; This function is incompatible with the one in levents.el.
326(defun timeout-event-p (event) 333(defun timeout-event-p (event)
@@ -531,6 +538,12 @@ If the user does not answer after SECONDS seconds, return DEFAULT-VALUE."
531 secs 538 secs
532 (if (string-match-p "\\`[0-9.]+\\'" string) 539 (if (string-match-p "\\`[0-9.]+\\'" string)
533 (string-to-number string))))) 540 (string-to-number string)))))
541
542(defun internal-timer-start-idle ()
543 "Mark all idle-time timers as once again candidates for running."
544 (dolist (timer timer-idle-list)
545 (if (timerp timer) ;; FIXME: Why test?
546 (setf (timer--triggered timer) nil))))
534 547
535(provide 'timer) 548(provide 'timer)
536 549
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index ca78e7c99b4..58de51672e6 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,15 @@
12013-04-10 Andrew Cohen <cohen@bu.edu>
2
3 * nnir.el (number-sequence): No longer used.
4 (nnir-request-set-mark): New function.
5 (nnir-request-update-info): Improve marks updating.
6 (nnir-request-scan): Don't duplicate marks updating.
7 (gnus-group-make-nnir-group, nnir-run-imap, nnir-request-create-group):
8 Use 'assq rather than 'assoc. Quote anonymous function.
9 (nnir-request-group, nnir-close-group, gnus-summary-create-nnir-group):
10 Use 'gnus-group-prefixed-p.
11 (gnus-summary-create-nnir-group): Make sure server for method is open.
12
12013-04-04 Andrew Cohen <cohen@bu.edu> 132013-04-04 Andrew Cohen <cohen@bu.edu>
2 14
3 * nnir.el (gnus-nnir-group-p): New function. 15 * nnir.el (gnus-nnir-group-p): New function.
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index b96f0c1cb78..5d244a019cb 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -173,15 +173,7 @@
173 173
174;; For Emacs <22.2 and XEmacs. 174;; For Emacs <22.2 and XEmacs.
175(eval-and-compile 175(eval-and-compile
176 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) 176 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
177 (unless (fboundp 'number-sequence)
178 (defun number-sequence (from to)
179 (let (seq (n 0) (next from))
180 (while (<= next to)
181 (setq seq (cons next seq)
182 n (1+ n)
183 next (+ from n )))
184 (nreverse seq)))))
185 177
186(require 'nnoo) 178(require 'nnoo)
187(require 'gnus-group) 179(require 'gnus-group)
@@ -610,7 +602,7 @@ an alist with `nnir-query-spec' and `nnir-group-spec' keys, and
610skips all prompting." 602skips all prompting."
611 (interactive "P") 603 (interactive "P")
612 (let* ((group-spec 604 (let* ((group-spec
613 (or (cdr (assoc 'nnir-group-spec specs)) 605 (or (cdr (assq 'nnir-group-spec specs))
614 (if (gnus-server-server-name) 606 (if (gnus-server-server-name)
615 (list (list (gnus-server-server-name))) 607 (list (list (gnus-server-server-name)))
616 (nnir-categorize 608 (nnir-categorize
@@ -620,7 +612,7 @@ skips all prompting."
620 (cdr (assoc (gnus-group-topic-name) gnus-topic-alist)))) 612 (cdr (assoc (gnus-group-topic-name) gnus-topic-alist))))
621 gnus-group-server)))) 613 gnus-group-server))))
622 (query-spec 614 (query-spec
623 (or (cdr (assoc 'nnir-query-spec specs)) 615 (or (cdr (assq 'nnir-query-spec specs))
624 (apply 616 (apply
625 'append 617 'append
626 (list (cons 'query 618 (list (cons 'query
@@ -667,9 +659,7 @@ skips all prompting."
667 659
668(deffoo nnir-request-group (group &optional server dont-check info) 660(deffoo nnir-request-group (group &optional server dont-check info)
669 (nnir-possibly-change-group group server) 661 (nnir-possibly-change-group group server)
670 (let ((pgroup (if (gnus-group-prefixed-p group) 662 (let ((pgroup (gnus-group-guess-full-name-from-command-method group))
671 group
672 (gnus-group-prefixed-name group '(nnir "nnir"))))
673 length) 663 length)
674 ;; Check for cached search result or run the query and cache the 664 ;; Check for cached search result or run the query and cache the
675 ;; result. 665 ;; result.
@@ -846,11 +836,31 @@ skips all prompting."
846 (artnumber (nnir-article-number article))) 836 (artnumber (nnir-article-number article)))
847 (gnus-request-update-mark artgroup artnumber mark))) 837 (gnus-request-update-mark artgroup artnumber mark)))
848 838
839(deffoo nnir-request-set-mark (group actions &optional server)
840 (let (mlist)
841 (dolist (action actions)
842 (destructuring-bind (range action marks) action
843 (let ((articles-by-group (nnir-categorize
844 (gnus-uncompress-range range)
845 nnir-article-group nnir-article-number)))
846 (dolist (artgroup articles-by-group)
847 (push (list
848 (car artgroup)
849 (list (gnus-compress-sequence
850 (sort (cadr artgroup) '<)) action marks)) mlist)))))
851 (dolist (request (nnir-categorize mlist car cadr))
852 (gnus-request-set-mark (car request) (cadr request)))))
853
849 854
850(deffoo nnir-request-update-info (group info &optional server) 855(deffoo nnir-request-update-info (group info &optional server)
851 (let ((articles-by-group 856 (nnir-possibly-change-group group)
857 ;; clear out all existing marks.
858 (gnus-info-set-marks info nil)
859 (gnus-info-set-read info nil)
860 (let ((group (gnus-group-guess-full-name-from-command-method group))
861 (articles-by-group
852 (nnir-categorize 862 (nnir-categorize
853 (number-sequence 1 (nnir-artlist-length nnir-artlist)) 863 (gnus-uncompress-range (cons 1 (nnir-artlist-length nnir-artlist)))
854 nnir-article-group nnir-article-ids))) 864 nnir-article-group nnir-article-ids)))
855 (gnus-set-active group 865 (gnus-set-active group
856 (cons 1 (nnir-artlist-length nnir-artlist))) 866 (cons 1 (nnir-artlist-length nnir-artlist)))
@@ -864,29 +874,24 @@ skips all prompting."
864 info 874 info
865 (gnus-add-to-range 875 (gnus-add-to-range
866 (gnus-info-read info) 876 (gnus-info-read info)
867 (remove nil (mapcar (lambda (art) 877 (delq nil
868 (let ((num (cdr art))) 878 (mapcar
869 (when (gnus-member-of-range num read) 879 #'(lambda (art)
870 (car art)))) articleids)))) 880 (when (gnus-member-of-range (cdr art) read) (car art)))
871 (mapc (lambda (mark) 881 articleids))))
872 (let ((type (car mark)) 882 (dolist (mark marks)
873 (range (cdr mark))) 883 (destructuring-bind (type . range) mark
874 (gnus-add-marked-articles 884 (gnus-add-marked-articles
875 group 885 group type
876 type 886 (delq nil
877 (remove nil 887 (mapcar
878 (mapcar 888 #'(lambda (art)
879 (lambda (art) 889 (when (gnus-member-of-range (cdr art) range) (car art)))
880 (let ((num (cdr art))) 890 articleids)))))))))
881 (when (gnus-member-of-range num range)
882 (car art))))
883 articleids))))) marks)))))
884 891
885 892
886(deffoo nnir-close-group (group &optional server) 893(deffoo nnir-close-group (group &optional server)
887 (let ((pgroup (if (gnus-group-prefixed-p group) 894 (let ((pgroup (gnus-group-guess-full-name-from-command-method group)))
888 group
889 (gnus-group-prefixed-name group '(nnir "nnir")))))
890 (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup))) 895 (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup)))
891 (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist)) 896 (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist))
892 (setq nnir-artlist nil) 897 (setq nnir-artlist nil)
@@ -963,7 +968,7 @@ details on the language and supported extensions."
963 'vconcat 968 'vconcat
964 (catch 'found 969 (catch 'found
965 (mapcar 970 (mapcar
966 (lambda (group) 971 #'(lambda (group)
967 (let (artlist) 972 (let (artlist)
968 (condition-case () 973 (condition-case ()
969 (when (nnimap-possibly-change-group 974 (when (nnimap-possibly-change-group
@@ -1861,12 +1866,11 @@ article came from is also searched."
1861 1866
1862(defun gnus-summary-create-nnir-group () 1867(defun gnus-summary-create-nnir-group ()
1863 (interactive) 1868 (interactive)
1869 (or (nnir-server-opened "") (nnir-open-server "nnir"))
1864 (let ((name (gnus-read-group "Group name: ")) 1870 (let ((name (gnus-read-group "Group name: "))
1865 (method "nnir") 1871 (method '(nnir ""))
1866 (pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name) 1872 (pgroup
1867 gnus-newsgroup-name 1873 (gnus-group-guess-full-name-from-command-method gnus-newsgroup-name)))
1868 (gnus-group-prefixed-name
1869 gnus-newsgroup-name '(nnir "nnir")))))
1870 (with-current-buffer gnus-group-buffer 1874 (with-current-buffer gnus-group-buffer
1871 (gnus-group-make-group 1875 (gnus-group-make-group
1872 name method nil 1876 name method nil
@@ -1876,20 +1880,20 @@ article came from is also searched."
1876(deffoo nnir-request-create-group (group &optional server args) 1880(deffoo nnir-request-create-group (group &optional server args)
1877 (message "Creating nnir group %s" group) 1881 (message "Creating nnir group %s" group)
1878 (let* ((group (gnus-group-prefixed-name group '(nnir "nnir"))) 1882 (let* ((group (gnus-group-prefixed-name group '(nnir "nnir")))
1879 (specs (assoc 'nnir-specs args)) 1883 (specs (assq 'nnir-specs args))
1880 (query-spec 1884 (query-spec
1881 (or (cdr (assoc 'nnir-query-spec specs)) 1885 (or (cdr (assq 'nnir-query-spec specs))
1882 (list (cons 'query 1886 (list (cons 'query
1883 (read-string "Query: " nil 'nnir-search-history))))) 1887 (read-string "Query: " nil 'nnir-search-history)))))
1884 (group-spec 1888 (group-spec
1885 (or (cdr (assoc 'nnir-group-spec specs)) 1889 (or (cdr (assq 'nnir-group-spec specs))
1886 (list (list (read-string "Server: " nil nil))))) 1890 (list (list (read-string "Server: " nil nil)))))
1887 (nnir-specs (list (cons 'nnir-query-spec query-spec) 1891 (nnir-specs (list (cons 'nnir-query-spec query-spec)
1888 (cons 'nnir-group-spec group-spec)))) 1892 (cons 'nnir-group-spec group-spec))))
1889 (gnus-group-set-parameter group 'nnir-specs nnir-specs) 1893 (gnus-group-set-parameter group 'nnir-specs nnir-specs)
1890 (gnus-group-set-parameter 1894 (gnus-group-set-parameter
1891 group 'nnir-artlist 1895 group 'nnir-artlist
1892 (or (cdr (assoc 'nnir-artlist args)) 1896 (or (cdr (assq 'nnir-artlist args))
1893 (nnir-run-query nnir-specs))) 1897 (nnir-run-query nnir-specs)))
1894 (nnir-request-update-info group (gnus-get-info group))) 1898 (nnir-request-update-info group (gnus-get-info group)))
1895 t) 1899 t)
@@ -1901,22 +1905,11 @@ article came from is also searched."
1901 t) 1905 t)
1902 1906
1903(deffoo nnir-request-scan (group method) 1907(deffoo nnir-request-scan (group method)
1904 (if group 1908 t)
1905 (let ((pgroup (if (gnus-group-prefixed-p group)
1906 group
1907 (gnus-group-prefixed-name group '(nnir "nnir")))))
1908 (gnus-group-set-parameter
1909 pgroup 'nnir-artlist
1910 (setq nnir-artlist
1911 (nnir-run-query
1912 (gnus-group-get-parameter pgroup 'nnir-specs t))))
1913 (nnir-request-update-info pgroup (gnus-get-info pgroup)))
1914 t))
1915 1909
1916(deffoo nnir-request-close () 1910(deffoo nnir-request-close ()
1917 t) 1911 t)
1918 1912
1919
1920(nnoo-define-skeleton nnir) 1913(nnoo-define-skeleton nnir)
1921 1914
1922;; The end. 1915;; The end.
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 9d9da27f6da..ad7381bb4b7 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -320,10 +320,11 @@ defaults to 6600 and HOST defaults to localhost."
320 (if tmp (push (nreverse tmp) alists)) 320 (if tmp (push (nreverse tmp) alists))
321 (nreverse alists))) 321 (nreverse alists)))
322 322
323(defun mpc-proc () 323(defun mpc-proc (&optional restart)
324 (unless (and mpc-proc 324 (unless (and mpc-proc
325 (buffer-live-p (process-buffer mpc-proc)) 325 (buffer-live-p (process-buffer mpc-proc))
326 (not (memq (process-status mpc-proc) '(closed)))) 326 (not (and restart
327 (memq (process-status mpc-proc) '(closed)))))
327 (mpc--proc-connect mpc-host)) 328 (mpc--proc-connect mpc-host))
328 mpc-proc) 329 mpc-proc)
329 330
@@ -356,7 +357,7 @@ otherwise return immediately and call CALLBACK with no argument
356when the command terminates. 357when the command terminates.
357CMD can be a string which is passed as-is to MPD or a list of strings 358CMD can be a string which is passed as-is to MPD or a list of strings
358which will be concatenated with proper quoting before passing them to MPD." 359which will be concatenated with proper quoting before passing them to MPD."
359 (let ((proc (mpc-proc))) 360 (let ((proc (mpc-proc 'restart)))
360 (if (and callback (not (process-get proc 'ready))) 361 (if (and callback (not (process-get proc 'ready)))
361 (let ((old (process-get proc 'callback))) 362 (let ((old (process-get proc 'callback)))
362 (process-put proc 'callback 363 (process-put proc 'callback
@@ -491,10 +492,10 @@ to call FUN for any change whatsoever.")
491 (cancel-timer mpc--status-timer) 492 (cancel-timer mpc--status-timer)
492 (setq mpc--status-timer nil))) 493 (setq mpc--status-timer nil)))
493(defun mpc--status-timer-run () 494(defun mpc--status-timer-run ()
494 (when (process-get (mpc-proc) 'ready)
495 (condition-case err 495 (condition-case err
496 (with-local-quit (mpc-status-refresh)) 496 (when (process-get (mpc-proc) 'ready)
497 (error (message "MPC: %s" err))))) 497 (with-local-quit (mpc-status-refresh)))
498 (error (message "MPC: %s" err))))
498 499
499(defvar mpc--status-idle-timer nil) 500(defvar mpc--status-idle-timer nil)
500(defun mpc--status-idle-timer-start () 501(defun mpc--status-idle-timer-start ()
@@ -1177,14 +1178,15 @@ If PLAYLIST is t or nil or missing, use the main playlist."
1177 1178
1178(defun mpc-status-buffer-show () 1179(defun mpc-status-buffer-show ()
1179 (interactive) 1180 (interactive)
1180 (let* ((buf (mpc-proc-buffer (mpc-proc) 'status)) 1181 (let* ((proc (mpc-proc))
1181 (songs-buf (mpc-proc-buffer (mpc-proc) 'songs)) 1182 (buf (mpc-proc-buffer proc 'status))
1183 (songs-buf (mpc-proc-buffer proc 'songs))
1182 (songs-win (if songs-buf (get-buffer-window songs-buf 0)))) 1184 (songs-win (if songs-buf (get-buffer-window songs-buf 0))))
1183 (unless (buffer-live-p buf) 1185 (unless (buffer-live-p buf)
1184 (setq buf (get-buffer-create "*MPC-Status*")) 1186 (setq buf (get-buffer-create "*MPC-Status*"))
1185 (with-current-buffer buf 1187 (with-current-buffer buf
1186 (mpc-status-mode)) 1188 (mpc-status-mode))
1187 (mpc-proc-buffer (mpc-proc) 'status buf)) 1189 (mpc-proc-buffer proc 'status buf))
1188 (if (null songs-win) (pop-to-buffer buf) 1190 (if (null songs-win) (pop-to-buffer buf)
1189 (let ((_win (split-window songs-win 20 t))) 1191 (let ((_win (split-window songs-win 20 t)))
1190 (set-window-dedicated-p songs-win nil) 1192 (set-window-dedicated-p songs-win nil)
@@ -1692,13 +1694,14 @@ Return non-nil if a selection was deactivated."
1692 (mpc-event-set-point event) 1694 (mpc-event-set-point event)
1693 (let ((name (buffer-substring (line-beginning-position) 1695 (let ((name (buffer-substring (line-beginning-position)
1694 (line-end-position))) 1696 (line-end-position)))
1695 (prop (intern mpc-tag))) 1697 (prop (intern mpc-tag))
1696 (if (not (member name (process-get (mpc-proc) prop))) 1698 (proc (mpc-proc)))
1697 (process-put (mpc-proc) prop 1699 (if (not (member name (process-get proc prop)))
1698 (cons name (process-get (mpc-proc) prop))) 1700 (process-put proc prop
1699 (let ((new (delete name (process-get (mpc-proc) prop)))) 1701 (cons name (process-get proc prop)))
1702 (let ((new (delete name (process-get proc prop))))
1700 (setq name (concat name "/")) 1703 (setq name (concat name "/"))
1701 (process-put (mpc-proc) prop 1704 (process-put proc prop
1702 (delq nil 1705 (delq nil
1703 (mapcar (lambda (x) 1706 (mapcar (lambda (x)
1704 (if (string-prefix-p name x) 1707 (if (string-prefix-p name x)
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 079101b56ee..ca29709de2e 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -514,12 +514,6 @@
514 ;; remove extra whitespace 514 ;; remove extra whitespace
515 (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) 515 (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field)
516 (setq field (replace-match " " nil t field))) 516 (setq field (replace-match " " nil t field)))
517 ;; remove leading garbage
518 (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field)
519 (setq field (replace-match "" nil t field)))
520 ;; remove trailing garbage
521 (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field)
522 (setq field (replace-match "" nil t field)))
523 (push (cons key field) alist)))) 517 (push (cons key field) alist))))
524 alist)) 518 alist))
525 519
diff --git a/src/ChangeLog b/src/ChangeLog
index 402792b5460..ff6b9508d62 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12013-04-10 Eli Zaretskii <eliz@gnu.org>
2
3 * frame.c (do_switch_frame): Mark the TTY frame we switch to as
4 garbaged only if it is not already the top frame on its TTY. This
5 prevents flickering due to constant redrawing of TTY frames when
6 there are GUI frames open in the same session. (Bug#13864)
7
82013-04-10 Stefan Monnier <monnier@iro.umontreal.ca>
9
10 * keyboard.c (timer_start_idle): Call internal-timer-start-idle instead
11 of marking the idle timers directly.
12
12013-04-09 Stefan Monnier <monnier@iro.umontreal.ca> 132013-04-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 14
3 * minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash 15 * minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash
diff --git a/src/frame.c b/src/frame.c
index 2fe398296ed..ccd50122f50 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -834,10 +834,18 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
834 834
835 if (FRAME_TERMCAP_P (XFRAME (frame)) || FRAME_MSDOS_P (XFRAME (frame))) 835 if (FRAME_TERMCAP_P (XFRAME (frame)) || FRAME_MSDOS_P (XFRAME (frame)))
836 { 836 {
837 if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame)) 837 Lisp_Object top_frame = FRAME_TTY (XFRAME (frame))->top_frame;
838 /* Mark previously displayed frame as now obscured. */ 838
839 SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (XFRAME (frame))->top_frame), 2); 839 /* Don't mark the frame garbaged and/or obscured if we are
840 SET_FRAME_VISIBLE (XFRAME (frame), 1); 840 switching to the frame that is already the top frame of that
841 TTY. */
842 if (!EQ (frame, top_frame))
843 {
844 if (FRAMEP (top_frame))
845 /* Mark previously displayed frame as now obscured. */
846 SET_FRAME_VISIBLE (XFRAME (top_frame), 2);
847 SET_FRAME_VISIBLE (XFRAME (frame), 1);
848 }
841 FRAME_TTY (XFRAME (frame))->top_frame = frame; 849 FRAME_TTY (XFRAME (frame))->top_frame = frame;
842 } 850 }
843 851
diff --git a/src/keyboard.c b/src/keyboard.c
index ab599512085..dbd3717c428 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4208,16 +4208,7 @@ timer_start_idle (void)
4208 timer_last_idleness_start_time = timer_idleness_start_time; 4208 timer_last_idleness_start_time = timer_idleness_start_time;
4209 4209
4210 /* Mark all idle-time timers as once again candidates for running. */ 4210 /* Mark all idle-time timers as once again candidates for running. */
4211 for (timers = Vtimer_idle_list; CONSP (timers); timers = XCDR (timers)) 4211 call0 (intern ("internal-timer-start-idle"));
4212 {
4213 Lisp_Object timer;
4214
4215 timer = XCAR (timers);
4216
4217 if (!VECTORP (timer) || ASIZE (timer) != 9)
4218 continue;
4219 ASET (timer, 0, Qnil);
4220 }
4221} 4212}
4222 4213
4223/* Record that Emacs is no longer idle, so stop running idle-time timers. */ 4214/* Record that Emacs is no longer idle, so stop running idle-time timers. */