Now on revision 112267. ------------------------------------------------------------ revno: 112267 committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-04-10 22:17:51 +0000 message: lisp/gnus/nnir.el: Fix last change diff: === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2013-04-10 22:14:14 +0000 +++ lisp/gnus/nnir.el 2013-04-10 22:17:51 +0000 @@ -881,10 +881,10 @@ articleids)))) (dolist (mark marks) (destructuring-bind (type . range) mark - (gnus-add-marked-articles + (gnus-add-marked-articles group type (delq nil - (mapcar + (mapcar #'(lambda (art) (when (gnus-member-of-range (cdr art) range) (car art))) articleids))))))))) ------------------------------------------------------------ revno: 112266 author: Andrew Cohen committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-04-10 22:14:14 +0000 message: lisp/gnus/nnir.el: Small optimizations. Use 'gnus-group-guess-full-name-from-command-method diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-04-10 22:13:37 +0000 +++ lisp/gnus/ChangeLog 2013-04-10 22:14:14 +0000 @@ -4,6 +4,11 @@ (nnir-request-set-mark): New function. (nnir-request-update-info): Improve marks updating. (nnir-request-scan): Don't duplicate marks updating. + (gnus-group-make-nnir-group, nnir-run-imap, nnir-request-create-group): + Use 'assq rather than 'assoc. Quote anonymous function. + (nnir-request-group, nnir-close-group, gnus-summary-create-nnir-group): + Use 'gnus-group-prefixed-p. + (gnus-summary-create-nnir-group): Make sure server for method is open. 2013-04-04 Andrew Cohen === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2013-04-10 22:13:37 +0000 +++ lisp/gnus/nnir.el 2013-04-10 22:14:14 +0000 @@ -602,7 +602,7 @@ skips all prompting." (interactive "P") (let* ((group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (if (gnus-server-server-name) (list (list (gnus-server-server-name))) (nnir-categorize @@ -612,7 +612,7 @@ (cdr (assoc (gnus-group-topic-name) gnus-topic-alist)))) gnus-group-server)))) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (apply 'append (list (cons 'query @@ -659,9 +659,7 @@ (deffoo nnir-request-group (group &optional server dont-check info) (nnir-possibly-change-group group server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir")))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group)) length) ;; Check for cached search result or run the query and cache the ;; result. @@ -893,9 +891,7 @@ (deffoo nnir-close-group (group &optional server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir"))))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group))) (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup))) (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist)) (setq nnir-artlist nil) @@ -972,7 +968,7 @@ 'vconcat (catch 'found (mapcar - (lambda (group) + #'(lambda (group) (let (artlist) (condition-case () (when (nnimap-possibly-change-group @@ -1870,12 +1866,11 @@ (defun gnus-summary-create-nnir-group () (interactive) + (or (nnir-server-opened "") (nnir-open-server "nnir")) (let ((name (gnus-read-group "Group name: ")) - (method "nnir") - (pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name) - gnus-newsgroup-name - (gnus-group-prefixed-name - gnus-newsgroup-name '(nnir "nnir"))))) + (method '(nnir "")) + (pgroup + (gnus-group-guess-full-name-from-command-method gnus-newsgroup-name))) (with-current-buffer gnus-group-buffer (gnus-group-make-group name method nil @@ -1885,20 +1880,20 @@ (deffoo nnir-request-create-group (group &optional server args) (message "Creating nnir group %s" group) (let* ((group (gnus-group-prefixed-name group '(nnir "nnir"))) - (specs (assoc 'nnir-specs args)) + (specs (assq 'nnir-specs args)) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (list (cons 'query (read-string "Query: " nil 'nnir-search-history))))) (group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (list (list (read-string "Server: " nil nil))))) (nnir-specs (list (cons 'nnir-query-spec query-spec) (cons 'nnir-group-spec group-spec)))) (gnus-group-set-parameter group 'nnir-specs nnir-specs) (gnus-group-set-parameter group 'nnir-artlist - (or (cdr (assoc 'nnir-artlist args)) + (or (cdr (assq 'nnir-artlist args)) (nnir-run-query nnir-specs))) (nnir-request-update-info group (gnus-get-info group))) t) ------------------------------------------------------------ revno: 112265 author: Andrew Cohen committer: Katsumi Yamaoka branch nick: trunk timestamp: Wed 2013-04-10 22:13:37 +0000 message: lisp/gnus/nnir.el: Improve marks handling diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-04-04 22:15:25 +0000 +++ lisp/gnus/ChangeLog 2013-04-10 22:13:37 +0000 @@ -1,3 +1,10 @@ +2013-04-10 Andrew Cohen + + * nnir.el (number-sequence): No longer used. + (nnir-request-set-mark): New function. + (nnir-request-update-info): Improve marks updating. + (nnir-request-scan): Don't duplicate marks updating. + 2013-04-04 Andrew Cohen * nnir.el (gnus-nnir-group-p): New function. === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2013-04-04 22:15:25 +0000 +++ lisp/gnus/nnir.el 2013-04-10 22:13:37 +0000 @@ -173,15 +173,7 @@ ;; For Emacs <22.2 and XEmacs. (eval-and-compile - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) - (unless (fboundp 'number-sequence) - (defun number-sequence (from to) - (let (seq (n 0) (next from)) - (while (<= next to) - (setq seq (cons next seq) - n (1+ n) - next (+ from n ))) - (nreverse seq))))) + (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) (require 'nnoo) (require 'gnus-group) @@ -846,11 +838,31 @@ (artnumber (nnir-article-number article))) (gnus-request-update-mark artgroup artnumber mark))) +(deffoo nnir-request-set-mark (group actions &optional server) + (let (mlist) + (dolist (action actions) + (destructuring-bind (range action marks) action + (let ((articles-by-group (nnir-categorize + (gnus-uncompress-range range) + nnir-article-group nnir-article-number))) + (dolist (artgroup articles-by-group) + (push (list + (car artgroup) + (list (gnus-compress-sequence + (sort (cadr artgroup) '<)) action marks)) mlist))))) + (dolist (request (nnir-categorize mlist car cadr)) + (gnus-request-set-mark (car request) (cadr request))))) + (deffoo nnir-request-update-info (group info &optional server) - (let ((articles-by-group + (nnir-possibly-change-group group) + ;; clear out all existing marks. + (gnus-info-set-marks info nil) + (gnus-info-set-read info nil) + (let ((group (gnus-group-guess-full-name-from-command-method group)) + (articles-by-group (nnir-categorize - (number-sequence 1 (nnir-artlist-length nnir-artlist)) + (gnus-uncompress-range (cons 1 (nnir-artlist-length nnir-artlist))) nnir-article-group nnir-article-ids))) (gnus-set-active group (cons 1 (nnir-artlist-length nnir-artlist))) @@ -864,23 +876,20 @@ info (gnus-add-to-range (gnus-info-read info) - (remove nil (mapcar (lambda (art) - (let ((num (cdr art))) - (when (gnus-member-of-range num read) - (car art)))) articleids)))) - (mapc (lambda (mark) - (let ((type (car mark)) - (range (cdr mark))) + (delq nil + (mapcar + #'(lambda (art) + (when (gnus-member-of-range (cdr art) read) (car art))) + articleids)))) + (dolist (mark marks) + (destructuring-bind (type . range) mark (gnus-add-marked-articles - group - type - (remove nil + group type + (delq nil (mapcar - (lambda (art) - (let ((num (cdr art))) - (when (gnus-member-of-range num range) - (car art)))) - articleids))))) marks))))) + #'(lambda (art) + (when (gnus-member-of-range (cdr art) range) (car art))) + articleids))))))))) (deffoo nnir-close-group (group &optional server) @@ -1901,22 +1910,11 @@ t) (deffoo nnir-request-scan (group method) - (if group - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir"))))) - (gnus-group-set-parameter - pgroup 'nnir-artlist - (setq nnir-artlist - (nnir-run-query - (gnus-group-get-parameter pgroup 'nnir-specs t)))) - (nnir-request-update-info pgroup (gnus-get-info pgroup))) - t)) + t) (deffoo nnir-request-close () t) - (nnoo-define-skeleton nnir) ;; The end. ------------------------------------------------------------ revno: 112264 fixes bug: http://debbugs.gnu.org/13864 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2013-04-10 18:38:20 +0300 message: Fix bug #13864 with flickering of TTY frames in an emacslient session. src/frame.c (do_switch_frame): Mark the TTY frame we switch to as garbaged only if it is not already the top frame on its TTY. This prevents flickering due to constant redrawing of TTY frames when there are GUI frames open in the same session. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-04-10 13:31:35 +0000 +++ src/ChangeLog 2013-04-10 15:38:20 +0000 @@ -1,3 +1,10 @@ +2013-04-10 Eli Zaretskii + + * frame.c (do_switch_frame): Mark the TTY frame we switch to as + garbaged only if it is not already the top frame on its TTY. This + prevents flickering due to constant redrawing of TTY frames when + there are GUI frames open in the same session. (Bug#13864) + 2013-04-10 Stefan Monnier * keyboard.c (timer_start_idle): Call internal-timer-start-idle instead === modified file 'src/frame.c' --- src/frame.c 2013-04-07 04:41:19 +0000 +++ src/frame.c 2013-04-10 15:38:20 +0000 @@ -834,10 +834,18 @@ if (FRAME_TERMCAP_P (XFRAME (frame)) || FRAME_MSDOS_P (XFRAME (frame))) { - if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame)) - /* Mark previously displayed frame as now obscured. */ - SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (XFRAME (frame))->top_frame), 2); - SET_FRAME_VISIBLE (XFRAME (frame), 1); + Lisp_Object top_frame = FRAME_TTY (XFRAME (frame))->top_frame; + + /* Don't mark the frame garbaged and/or obscured if we are + switching to the frame that is already the top frame of that + TTY. */ + if (!EQ (frame, top_frame)) + { + if (FRAMEP (top_frame)) + /* Mark previously displayed frame as now obscured. */ + SET_FRAME_VISIBLE (XFRAME (top_frame), 2); + SET_FRAME_VISIBLE (XFRAME (frame), 1); + } FRAME_TTY (XFRAME (frame))->top_frame = frame; } ------------------------------------------------------------ revno: 112263 committer: Tassilo Horn branch nick: trunk timestamp: Wed 2013-04-10 16:48:44 +0200 message: * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut off leading { and trailing } from field values. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-10 13:31:35 +0000 +++ lisp/ChangeLog 2013-04-10 14:48:44 +0000 @@ -1,3 +1,8 @@ +2013-04-10 Tassilo Horn + + * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut + off leading { and trailing } from field values. + 2013-04-10 Stefan Monnier * emacs-lisp/timer.el (timer--check): New function. === modified file 'lisp/textmodes/reftex-cite.el' --- lisp/textmodes/reftex-cite.el 2013-01-21 12:14:56 +0000 +++ lisp/textmodes/reftex-cite.el 2013-04-10 14:48:44 +0000 @@ -514,12 +514,6 @@ ;; remove extra whitespace (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) (setq field (replace-match " " nil t field))) - ;; remove leading garbage - (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field) - (setq field (replace-match "" nil t field))) - ;; remove trailing garbage - (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field) - (setq field (replace-match "" nil t field))) (push (cons key field) alist)))) alist)) ------------------------------------------------------------ revno: 112262 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-04-10 09:31:35 -0400 message: * src/keyboard.c (timer_start_idle): Call internal-timer-start-idle instead of marking the idle timers directly. * lisp/emacs-lisp/timer.el (timer--check): New function. (timer--time, timer-set-function, timer-event-handler): Use it. (timer-set-idle-time): Simplify. (timer--activate): CSE. (timer-event-handler): Give more info in error message. (internal-timer-start-idle): New function, moved from C. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-10 13:17:27 +0000 +++ lisp/ChangeLog 2013-04-10 13:31:35 +0000 @@ -1,5 +1,12 @@ 2013-04-10 Stefan Monnier + * emacs-lisp/timer.el (timer--check): New function. + (timer--time, timer-set-function, timer-event-handler): Use it. + (timer-set-idle-time): Simplify. + (timer--activate): CSE. + (timer-event-handler): Give more info in error message. + (internal-timer-start-idle): New function, moved from C. + * mpc.el (mpc-proc): Add `restart' argument. (mpc-proc-cmd): Use it. (mpc--status-timer-run): Also catch signals from `mpc-proc'. === modified file 'lisp/emacs-lisp/timer.el' --- lisp/emacs-lisp/timer.el 2013-04-08 02:08:45 +0000 +++ lisp/emacs-lisp/timer.el 2013-04-10 13:31:35 +0000 @@ -27,27 +27,34 @@ ;;; Code: -;; Layout of a timer vector: -;; [triggered-p high-seconds low-seconds usecs repeat-delay -;; function args idle-delay psecs] -;; triggered-p is nil if the timer is active (waiting to be triggered), -;; t if it is inactive ("already triggered", in theory) - (eval-when-compile (require 'cl-lib)) (cl-defstruct (timer - (:constructor nil) - (:copier nil) - (:constructor timer-create ()) - (:type vector) - (:conc-name timer--)) + (:constructor nil) + (:copier nil) + (:constructor timer-create ()) + (:type vector) + (:conc-name timer--)) + ;; nil if the timer is active (waiting to be triggered), + ;; non-nil if it is inactive ("already triggered", in theory). (triggered t) - high-seconds low-seconds usecs repeat-delay function args idle-delay psecs) + ;; Time of next trigger: for normal timers, absolute time, for idle timers, + ;; time relative to idle-start. + high-seconds low-seconds usecs + ;; For normal timers, time between repetitions, or nil. For idle timers, + ;; non-nil iff repeated. + repeat-delay + function args ;What to do when triggered. + idle-delay ;If non-nil, this is an idle-timer. + psecs) (defun timerp (object) "Return t if OBJECT is a timer." (and (vectorp object) (= (length object) 9))) +(defsubst timer--check (timer) + (or (timerp timer) (signal 'wrong-type-argument (list #'timerp timer)))) + ;; Pseudo field `time'. (defun timer--time (timer) (list (timer--high-seconds timer) @@ -57,17 +64,17 @@ (gv-define-simple-setter timer--time (lambda (timer time) - (or (timerp timer) (error "Invalid timer")) + (timer--check timer) (setf (timer--high-seconds timer) (pop time)) (let ((low time) (usecs 0) (psecs 0)) (if (consp time) - (progn - (setq low (pop time)) - (if time - (progn - (setq usecs (pop time)) - (if time - (setq psecs (car time))))))) + (progn + (setq low (pop time)) + (if time + (progn + (setq usecs (pop time)) + (if time + (setq psecs (car time))))))) (setf (timer--low-seconds timer) low) (setf (timer--usecs timer) usecs) (setf (timer--psecs timer) psecs)))) @@ -83,15 +90,13 @@ timer) (defun timer-set-idle-time (timer secs &optional repeat) + ;; FIXME: Merge with timer-set-time. "Set the trigger idle time of TIMER to SECS. SECS may be an integer, floating point number, or the internal time format returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." - (if (consp secs) - (setf (timer--time timer) secs) - (setf (timer--time timer) '(0 0 0)) - (timer-inc-time timer secs)) + (setf (timer--time timer) (if (consp secs) secs (seconds-to-time secs))) (setf (timer--repeat-delay timer) repeat) timer) @@ -156,8 +161,7 @@ (defun timer-set-function (timer function &optional args) "Make TIMER call FUNCTION with optional ARGS when triggering." - (or (timerp timer) - (error "Invalid timer")) + (timer--check timer) (setf (timer--function timer) function) (setf (timer--args timer) args) timer) @@ -181,9 +185,10 @@ (setcdr reuse-cell timers)) (setq reuse-cell (cons timer timers))) ;; Insert new timer after last which possibly means in front of queue. - (cond (last (setcdr last reuse-cell)) - (idle (setq timer-idle-list reuse-cell)) - (t (setq timer-list reuse-cell))) + (setf (cond (last (cdr last)) + (idle timer-idle-list) + (t timer-list)) + reuse-cell) (setf (timer--triggered timer) triggered-p) (setf (timer--idle-delay timer) idle) nil) @@ -223,8 +228,7 @@ (defun cancel-timer (timer) "Remove TIMER from the list of active timers." - (or (timerp timer) - (error "Invalid timer")) + (timer--check timer) (setq timer-list (delq timer timer-list)) (setq timer-idle-list (delq timer timer-idle-list)) nil) @@ -283,44 +287,47 @@ (setq timer-event-last-1 timer-event-last) (setq timer-event-last timer) (let ((inhibit-quit t)) - (if (timerp timer) - (let (retrigger cell) - ;; Delete from queue. Record the cons cell that was used. - (setq cell (cancel-timer-internal timer)) - ;; Re-schedule if requested. - (if (timer--repeat-delay timer) - (if (timer--idle-delay timer) - (timer-activate-when-idle timer nil cell) - (timer-inc-time timer (timer--repeat-delay timer) 0) - ;; If real time has jumped forward, - ;; perhaps because Emacs was suspended for a long time, - ;; limit how many times things get repeated. - (if (and (numberp timer-max-repeats) - (< 0 (timer-until timer (current-time)))) - (let ((repeats (/ (timer-until timer (current-time)) - (timer--repeat-delay timer)))) - (if (> repeats timer-max-repeats) - (timer-inc-time timer (* (timer--repeat-delay timer) - repeats))))) - (timer-activate timer t cell) - (setq retrigger t))) - ;; Run handler. - ;; We do this after rescheduling so that the handler function - ;; can cancel its own timer successfully with cancel-timer. - (condition-case-unless-debug err - ;; Timer functions should not change the current buffer. - ;; If they do, all kinds of nasty surprises can happen, - ;; and it can be hellish to track down their source. - (save-current-buffer - (apply (timer--function timer) (timer--args timer))) - (error (message "Error in timer: %S" err))) - (when (and retrigger - ;; If the timer's been canceled, don't "retrigger" it - ;; since it might still be in the copy of timer-list kept - ;; by keyboard.c:timer_check (bug#14156). - (memq timer timer-list)) - (setf (timer--triggered timer) nil))) - (error "Bogus timer event")))) + (timer--check timer) + (let ((retrigger nil) + (cell + ;; Delete from queue. Record the cons cell that was used. + (cancel-timer-internal timer))) + ;; Re-schedule if requested. + (if (timer--repeat-delay timer) + (if (timer--idle-delay timer) + (timer-activate-when-idle timer nil cell) + (timer-inc-time timer (timer--repeat-delay timer) 0) + ;; If real time has jumped forward, + ;; perhaps because Emacs was suspended for a long time, + ;; limit how many times things get repeated. + (if (and (numberp timer-max-repeats) + (< 0 (timer-until timer (current-time)))) + (let ((repeats (/ (timer-until timer (current-time)) + (timer--repeat-delay timer)))) + (if (> repeats timer-max-repeats) + (timer-inc-time timer (* (timer--repeat-delay timer) + repeats))))) + ;; Place it back on the timer-list before running + ;; timer--function, so it can cancel-timer itself. + (timer-activate timer t cell) + (setq retrigger t))) + ;; Run handler. + (condition-case-unless-debug err + ;; Timer functions should not change the current buffer. + ;; If they do, all kinds of nasty surprises can happen, + ;; and it can be hellish to track down their source. + (save-current-buffer + (apply (timer--function timer) (timer--args timer))) + (error (message "Error running timer%s: %S" + (if (symbolp (timer--function timer)) + (format " `%s'" (timer--function timer)) "") + err))) + (when (and retrigger + ;; If the timer's been canceled, don't "retrigger" it + ;; since it might still be in the copy of timer-list kept + ;; by keyboard.c:timer_check (bug#14156). + (memq timer timer-list)) + (setf (timer--triggered timer) nil))))) ;; This function is incompatible with the one in levents.el. (defun timeout-event-p (event) @@ -531,6 +538,12 @@ secs (if (string-match-p "\\`[0-9.]+\\'" string) (string-to-number string))))) + +(defun internal-timer-start-idle () + "Mark all idle-time timers as once again candidates for running." + (dolist (timer timer-idle-list) + (if (timerp timer) ;; FIXME: Why test? + (setf (timer--triggered timer) nil)))) (provide 'timer) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-04-09 20:10:47 +0000 +++ src/ChangeLog 2013-04-10 13:31:35 +0000 @@ -1,3 +1,8 @@ +2013-04-10 Stefan Monnier + + * keyboard.c (timer_start_idle): Call internal-timer-start-idle instead + of marking the idle timers directly. + 2013-04-09 Stefan Monnier * minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash === modified file 'src/keyboard.c' --- src/keyboard.c 2013-04-08 18:04:58 +0000 +++ src/keyboard.c 2013-04-10 13:31:35 +0000 @@ -4198,16 +4198,7 @@ timer_last_idleness_start_time = timer_idleness_start_time; /* Mark all idle-time timers as once again candidates for running. */ - for (timers = Vtimer_idle_list; CONSP (timers); timers = XCDR (timers)) - { - Lisp_Object timer; - - timer = XCAR (timers); - - if (!VECTORP (timer) || ASIZE (timer) != 9) - continue; - ASET (timer, 0, Qnil); - } + call0 (intern ("internal-timer-start-idle")); } /* Record that Emacs is no longer idle, so stop running idle-time timers. */ ------------------------------------------------------------ revno: 112261 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-04-10 09:17:27 -0400 message: * lisp/mpc.el (mpc-proc): Add `restart' argument. (mpc-proc-cmd): Use it. (mpc--status-timer-run): Also catch signals from `mpc-proc'. (mpc-status-buffer-show, mpc-tagbrowser-dir-toggle): Call `mpc-proc' less often. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-04-09 17:31:17 +0000 +++ lisp/ChangeLog 2013-04-10 13:17:27 +0000 @@ -1,3 +1,11 @@ +2013-04-10 Stefan Monnier + + * mpc.el (mpc-proc): Add `restart' argument. + (mpc-proc-cmd): Use it. + (mpc--status-timer-run): Also catch signals from `mpc-proc'. + (mpc-status-buffer-show, mpc-tagbrowser-dir-toggle): Call `mpc-proc' + less often. + 2013-04-10 Masatake YAMATO * progmodes/sh-script.el: Implement `sh-mode' own === modified file 'lisp/mpc.el' --- lisp/mpc.el 2013-03-29 14:23:24 +0000 +++ lisp/mpc.el 2013-04-10 13:17:27 +0000 @@ -320,10 +320,11 @@ (if tmp (push (nreverse tmp) alists)) (nreverse alists))) -(defun mpc-proc () +(defun mpc-proc (&optional restart) (unless (and mpc-proc (buffer-live-p (process-buffer mpc-proc)) - (not (memq (process-status mpc-proc) '(closed)))) + (not (and restart + (memq (process-status mpc-proc) '(closed))))) (mpc--proc-connect mpc-host)) mpc-proc) @@ -356,7 +357,7 @@ when the command terminates. CMD can be a string which is passed as-is to MPD or a list of strings which will be concatenated with proper quoting before passing them to MPD." - (let ((proc (mpc-proc))) + (let ((proc (mpc-proc 'restart))) (if (and callback (not (process-get proc 'ready))) (let ((old (process-get proc 'callback))) (process-put proc 'callback @@ -491,10 +492,10 @@ (cancel-timer mpc--status-timer) (setq mpc--status-timer nil))) (defun mpc--status-timer-run () - (when (process-get (mpc-proc) 'ready) (condition-case err - (with-local-quit (mpc-status-refresh)) - (error (message "MPC: %s" err))))) + (when (process-get (mpc-proc) 'ready) + (with-local-quit (mpc-status-refresh))) + (error (message "MPC: %s" err)))) (defvar mpc--status-idle-timer nil) (defun mpc--status-idle-timer-start () @@ -1177,14 +1178,15 @@ (defun mpc-status-buffer-show () (interactive) - (let* ((buf (mpc-proc-buffer (mpc-proc) 'status)) - (songs-buf (mpc-proc-buffer (mpc-proc) 'songs)) + (let* ((proc (mpc-proc)) + (buf (mpc-proc-buffer proc 'status)) + (songs-buf (mpc-proc-buffer proc 'songs)) (songs-win (if songs-buf (get-buffer-window songs-buf 0)))) (unless (buffer-live-p buf) (setq buf (get-buffer-create "*MPC-Status*")) (with-current-buffer buf (mpc-status-mode)) - (mpc-proc-buffer (mpc-proc) 'status buf)) + (mpc-proc-buffer proc 'status buf)) (if (null songs-win) (pop-to-buffer buf) (let ((_win (split-window songs-win 20 t))) (set-window-dedicated-p songs-win nil) @@ -1692,13 +1694,14 @@ (mpc-event-set-point event) (let ((name (buffer-substring (line-beginning-position) (line-end-position))) - (prop (intern mpc-tag))) - (if (not (member name (process-get (mpc-proc) prop))) - (process-put (mpc-proc) prop - (cons name (process-get (mpc-proc) prop))) - (let ((new (delete name (process-get (mpc-proc) prop)))) + (prop (intern mpc-tag)) + (proc (mpc-proc))) + (if (not (member name (process-get proc prop))) + (process-put proc prop + (cons name (process-get proc prop))) + (let ((new (delete name (process-get proc prop)))) (setq name (concat name "/")) - (process-put (mpc-proc) prop + (process-put proc prop (delq nil (mapcar (lambda (x) (if (string-prefix-p name x) ------------------------------------------------------------ revno: 112260 committer: Glenn Morris branch nick: trunk timestamp: Tue 2013-04-09 18:22:15 -0700 message: Standardize license text diff: === modified file 'lisp/pcmpl-x.el' --- lisp/pcmpl-x.el 2013-04-07 07:14:00 +0000 +++ lisp/pcmpl-x.el 2013-04-10 01:22:15 +0000 @@ -1,23 +1,25 @@ ;;; pcmpl-x.el --- completion for miscellaneous tools -*- lexical-binding: t; -*- -;; Copyright (C) 2013 Free Software Foundation, Inc. +;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Author: Leo Liu ;; Keywords: processes, tools, convenience ;; Package: pcomplete -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Code: