diff options
| author | Igor Kuzmin | 2011-02-10 13:53:49 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-02-10 13:53:49 -0500 |
| commit | 94d11cb5773b3b37367ee3c4885a374ff129d475 (patch) | |
| tree | b7acbbd87cfce602ad52c23f4434a3b27eac83e1 /lisp/mpc.el | |
| parent | 8f1d2ef658f95549eb33fe5265f8f11c5129bece (diff) | |
| download | emacs-94d11cb5773b3b37367ee3c4885a374ff129d475.tar.gz emacs-94d11cb5773b3b37367ee3c4885a374ff129d475.zip | |
* lisp/emacs-lisp/cconv.el: New file.
* lisp/emacs-lisp/bytecomp.el: Use cconv.
(byte-compile-file-form, byte-compile):
Call cconv-closure-convert-toplevel when requested.
* lisp/server.el:
* lisp/mpc.el:
* lisp/emacs-lisp/pcase.el:
* lisp/doc-view.el:
* lisp/dired.el: Use lexical-binding.
Diffstat (limited to 'lisp/mpc.el')
| -rw-r--r-- | lisp/mpc.el | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el index 8feddf8829b..4f21a162c08 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | ;;; -*- lexical-binding: t -*- | ||
| 1 | ;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8 -*- | 2 | ;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8 -*- |
| 2 | 3 | ||
| 3 | ;; Copyright (C) 2006-2011 Free Software Foundation, Inc. | 4 | ;; Copyright (C) 2006-2011 Free Software Foundation, Inc. |
| @@ -341,9 +342,7 @@ CMD can be a string which is passed as-is to MPD or a list of strings | |||
| 341 | which will be concatenated with proper quoting before passing them to MPD." | 342 | which will be concatenated with proper quoting before passing them to MPD." |
| 342 | (let ((proc (mpc-proc))) | 343 | (let ((proc (mpc-proc))) |
| 343 | (if (and callback (not (process-get proc 'ready))) | 344 | (if (and callback (not (process-get proc 'ready))) |
| 344 | (lexical-let ((old (process-get proc 'callback)) | 345 | (let ((old (process-get proc 'callback))) |
| 345 | (callback callback) | ||
| 346 | (cmd cmd)) | ||
| 347 | (process-put proc 'callback | 346 | (process-put proc 'callback |
| 348 | (lambda () | 347 | (lambda () |
| 349 | (funcall old) | 348 | (funcall old) |
| @@ -359,8 +358,7 @@ which will be concatenated with proper quoting before passing them to MPD." | |||
| 359 | (mapconcat 'mpc--proc-quote-string cmd " ")) | 358 | (mapconcat 'mpc--proc-quote-string cmd " ")) |
| 360 | "\n"))) | 359 | "\n"))) |
| 361 | (if callback | 360 | (if callback |
| 362 | (lexical-let ((buf (current-buffer)) | 361 | (let ((buf (current-buffer))) |
| 363 | (callback callback)) | ||
| 364 | (process-put proc 'callback | 362 | (process-put proc 'callback |
| 365 | callback | 363 | callback |
| 366 | ;; (lambda () | 364 | ;; (lambda () |
| @@ -402,8 +400,7 @@ which will be concatenated with proper quoting before passing them to MPD." | |||
| 402 | 400 | ||
| 403 | (defun mpc-proc-cmd-to-alist (cmd &optional callback) | 401 | (defun mpc-proc-cmd-to-alist (cmd &optional callback) |
| 404 | (if callback | 402 | (if callback |
| 405 | (lexical-let ((buf (current-buffer)) | 403 | (let ((buf (current-buffer))) |
| 406 | (callback callback)) | ||
| 407 | (mpc-proc-cmd cmd (lambda () | 404 | (mpc-proc-cmd cmd (lambda () |
| 408 | (funcall callback (prog1 (mpc-proc-buf-to-alist | 405 | (funcall callback (prog1 (mpc-proc-buf-to-alist |
| 409 | (current-buffer)) | 406 | (current-buffer)) |
| @@ -522,7 +519,7 @@ to call FUN for any change whatsoever.") | |||
| 522 | 519 | ||
| 523 | (defun mpc-status-refresh (&optional callback) | 520 | (defun mpc-status-refresh (&optional callback) |
| 524 | "Refresh `mpc-status'." | 521 | "Refresh `mpc-status'." |
| 525 | (lexical-let ((cb callback)) | 522 | (let ((cb callback)) |
| 526 | (mpc-proc-cmd (mpc-proc-cmd-list '("status" "currentsong")) | 523 | (mpc-proc-cmd (mpc-proc-cmd-list '("status" "currentsong")) |
| 527 | (lambda () | 524 | (lambda () |
| 528 | (mpc--status-callback) | 525 | (mpc--status-callback) |
| @@ -775,7 +772,7 @@ The songs are returned as alists." | |||
| 775 | 772 | ||
| 776 | (defun mpc-cmd-pause (&optional arg callback) | 773 | (defun mpc-cmd-pause (&optional arg callback) |
| 777 | "Pause or resume playback of the queue of songs." | 774 | "Pause or resume playback of the queue of songs." |
| 778 | (lexical-let ((cb callback)) | 775 | (let ((cb callback)) |
| 779 | (mpc-proc-cmd (list "pause" arg) | 776 | (mpc-proc-cmd (list "pause" arg) |
| 780 | (lambda () (mpc-status-refresh) (if cb (funcall cb)))) | 777 | (lambda () (mpc-status-refresh) (if cb (funcall cb)))) |
| 781 | (unless callback (mpc-proc-sync)))) | 778 | (unless callback (mpc-proc-sync)))) |
| @@ -839,7 +836,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." | |||
| 839 | (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))) | 836 | (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))) |
| 840 | 837 | ||
| 841 | (defun mpc-cmd-update (&optional arg callback) | 838 | (defun mpc-cmd-update (&optional arg callback) |
| 842 | (lexical-let ((cb callback)) | 839 | (let ((cb callback)) |
| 843 | (mpc-proc-cmd (if arg (list "update" arg) "update") | 840 | (mpc-proc-cmd (if arg (list "update" arg) "update") |
| 844 | (lambda () (mpc-status-refresh) (if cb (funcall cb)))) | 841 | (lambda () (mpc-status-refresh) (if cb (funcall cb)))) |
| 845 | (unless callback (mpc-proc-sync)))) | 842 | (unless callback (mpc-proc-sync)))) |
| @@ -2351,8 +2348,7 @@ This is used so that they can be compared with `eq', which is needed for | |||
| 2351 | (mpc-proc-cmd (list "seekid" songid time) | 2348 | (mpc-proc-cmd (list "seekid" songid time) |
| 2352 | 'mpc-status-refresh)))) | 2349 | 'mpc-status-refresh)))) |
| 2353 | (let ((status (mpc-cmd-status))) | 2350 | (let ((status (mpc-cmd-status))) |
| 2354 | (lexical-let* ((songid (cdr (assq 'songid status))) | 2351 | (let* ((songid (cdr (assq 'songid status))) |
| 2355 | (step step) | ||
| 2356 | (time (if songid (string-to-number | 2352 | (time (if songid (string-to-number |
| 2357 | (cdr (assq 'time status)))))) | 2353 | (cdr (assq 'time status)))))) |
| 2358 | (let ((timer (run-with-timer | 2354 | (let ((timer (run-with-timer |
| @@ -2389,13 +2385,12 @@ This is used so that they can be compared with `eq', which is needed for | |||
| 2389 | (if mpc--faster-toggle-timer | 2385 | (if mpc--faster-toggle-timer |
| 2390 | (mpc--faster-stop) | 2386 | (mpc--faster-stop) |
| 2391 | (mpc-status-refresh) (mpc-proc-sync) | 2387 | (mpc-status-refresh) (mpc-proc-sync) |
| 2392 | (lexical-let* ((speedup speedup) | 2388 | (let* (songid ;The ID of the currently ffwd/rewinding song. |
| 2393 | songid ;The ID of the currently ffwd/rewinding song. | 2389 | songnb ;The position of that song in the playlist. |
| 2394 | songnb ;The position of that song in the playlist. | 2390 | songduration ;The duration of that song. |
| 2395 | songduration ;The duration of that song. | 2391 | songtime ;The time of the song last time we ran. |
| 2396 | songtime ;The time of the song last time we ran. | 2392 | oldtime ;The timeoftheday last time we ran. |
| 2397 | oldtime ;The timeoftheday last time we ran. | 2393 | prevsongid) ;The song we're in the process leaving. |
| 2398 | prevsongid) ;The song we're in the process leaving. | ||
| 2399 | (let ((fun | 2394 | (let ((fun |
| 2400 | (lambda () | 2395 | (lambda () |
| 2401 | (let ((newsongid (cdr (assq 'songid mpc-status))) | 2396 | (let ((newsongid (cdr (assq 'songid mpc-status))) |