branch: externals/mpdired commit 9063b7c80a92ac6e7e7976badc9011f693072875 Author: Manuel Giraud <man...@ledu-giraud.fr> Commit: Manuel Giraud <man...@ledu-giraud.fr>
better naming --- mpdired.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/mpdired.el b/mpdired.el index 4a8fc4ce6d..f6d511cf21 100644 --- a/mpdired.el +++ b/mpdired.el @@ -1,7 +1,7 @@ -(defcustom mpd-host (or (getenv "MPD_HOST") "localhost") +(defcustom mpdired-host (or (getenv "MPD_HOST") "localhost") "Host for MPD.") -(defcustom mpd-port (or (getenv "MPD_PORT") 6600) +(defcustom mpdired-port (or (getenv "MPD_PORT") 6600) "Host for MPD.") (defun my-filter (proc string) @@ -15,6 +15,7 @@ (set-marker (process-mark proc) (point))) (if moving (goto-char (process-mark proc))) (when (re-search-backward "^OK$" nil t) + (goto-char (point-min)) (set-buffer-modified-p nil) (message "Fini")))))) @@ -22,7 +23,7 @@ (princ (format "Process: %s had the event '%s'" process event))) -(defvar *mpdired-process* nil) +(defvar mpdired-process nil) (defun mpdired-local-p (host) ;; Hack: if the `expand-file-name' of host leads to an existing @@ -32,22 +33,22 @@ (defun mpc-connect () (with-current-buffer (get-buffer-create "*mpc*") (erase-buffer) - (let* ((localp (mpdired-local-p mpd-host)) - (host (if localp (expand-file-name mpd-host) mpd-host))) + (let* ((localp (mpdired-local-p mpdired-host)) + (host (if localp (expand-file-name mpdired-host) mpdired-host))) ;; Create a new connection if needed - (unless (and *mpdired-process* - (eq (process-status *mpdired-process*) 'open)) - (setq *mpdired-process* (make-network-process :name "mpdired" - :buffer (current-buffer) - :host host - :service (if localp host mpd-port) - :family (if localp 'local) - :coding 'utf-8 - :filter 'my-filter - :sentinel 'msg-me))) + (unless (and mpdired-process + (eq (process-status mpdired-process) 'open)) + (setq mpdired-process (make-network-process :name "mpdired" + :buffer (current-buffer) + :host host + :service (if localp host mpdired-port) + :family (if localp 'local) + :coding 'utf-8 + :filter 'my-filter + :sentinel 'msg-me))) ;;(process-send-string proc "list album\n") ;;(process-send-string proc "playlistinfo\n") - (process-send-string *mpdired-process* "listall \"\"\n") + (process-send-string mpdired-process "listall \"\"\n") ;;(process-send-string proc "close\n") ;;(buffer-string) )))