[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mpdired d7c42d2e6d 010/133: kill the global process
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mpdired d7c42d2e6d 010/133: kill the global process |
Date: |
Sun, 10 Mar 2024 15:59:32 -0400 (EDT) |
branch: externals/mpdired
commit d7c42d2e6d64eab4feedc8ef2826506057788c44
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Manuel Giraud <manuel@ledu-giraud.fr>
kill the global process
Now everything is done through the process of the communication
buffer.
---
mpdired.el | 55 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/mpdired.el b/mpdired.el
index 76ebd3e37e..0ef1de167d 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -101,38 +101,43 @@
(unless (string-search "connection broken" event)
(message "Process: %s had the event '%s'" process event)))
-(defvar mpdired-process nil)
-
-(defun mpdired-local-p (host)
+(defun mpdired--local-p (host)
;; Hack: if the `expand-file-name' of host leads to an existing
;; file, that should be our Unix socket.
(file-exists-p (expand-file-name host)))
-(defun mpdired--maybe-init ()
- ;; Always reparse host should the user have changed it.
- (let* ((localp (mpdired-local-p mpdired-host))
- (host (if localp (expand-file-name mpdired-host) mpdired-host))
- (service (if localp host mpdired-port)))
- (with-current-buffer (get-buffer-create "*mpdired-work*")
- (setq-local buffer-read-only nil)
- (erase-buffer)
+(defun mpdired--comm-name (host service localp)
+ (if localp
+ (format "*mpdired-%s" host)
+ (format "*mpdired-%s:%s" host service)))
+
+(defun mpdired--maybe-init (host service localp)
+ (with-current-buffer (get-buffer-create (mpdired--comm-name host service
localp))
+ (setq-local buffer-read-only nil)
+ (erase-buffer)
+ (let ((process (get-buffer-process (current-buffer))))
;; 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 service
- :family (if localp 'local)
- :coding 'utf-8
- :filter 'my-filter
- :sentinel 'msg-me))))))
+ (unless (and process
+ (eq (process-status process) 'open))
+ (set-process-buffer (make-network-process :name "mpdired"
+ :buffer (current-buffer)
+ :host host
+ :service service
+ :family (if localp 'local)
+ :coding 'utf-8
+ :filter 'my-filter
+ :sentinel 'msg-me)
+ (current-buffer))))))
(defun mpdired-listall (path)
- (mpdired--maybe-init)
- (with-current-buffer "*mpdired-work*"
- (setq-local mpdired--last-command 'listall)
- (process-send-string mpdired-process (format "listall \"%s\"\n" path))))
+ ;; Always reparse host should the user have changed it.
+ (let* ((localp (mpdired--local-p mpdired-host))
+ (host (if localp (expand-file-name mpdired-host) mpdired-host))
+ (service (if localp host mpdired-port)))
+ (mpdired--maybe-init host service localp)
+ (with-current-buffer (mpdired--comm-name host service localp)
+ (setq-local mpdired--last-command 'listall)
+ (process-send-string (get-buffer-process (current-buffer)) (format
"listall \"%s\"\n" path)))))
(defun mpdired-test-me ()
(interactive)
- [elpa] externals/mpdired 1f473c2840 015/133: no more *toplevel*, (continued)
- [elpa] externals/mpdired 1f473c2840 015/133: no more *toplevel*, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 6bb7fab67b 019/133: fix more navigation, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 809a5df8e5 030/133: first command list for delete, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 7bbcf712a1 033/133: fix a bug on progress bar, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired a9d1cddab5 037/133: arrange keymap, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 5699213525 007/133: mostly fancy, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired a74ca07e9e 002/133: rename, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 9063b7c80a 004/133: better naming, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired ec768308ac 005/133: a recursive parser for listall, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 5c777bc465 006/133: start cleaning display, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired d7c42d2e6d 010/133: kill the global process,
ELPA Syncer <=
- [elpa] externals/mpdired f6733f5577 012/133: factorize buffer naming, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired f44c2e1810 013/133: navigation, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 55e5bffec8 017/133: fix line movement, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired c8fcb8a87e 018/133: more hacking, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 77a5b2aae8 020/133: mpdired--directory is global and only set in one place, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 53544d970f 021/133: start putting things in place for playlist, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 6da84bce76 023/133: functional playlist view, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 5755e4b4ff 028/133: use the more apropriate "queue" for active playlist, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired ef9eb96157 031/133: progress bar on the song's uri, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 69020f1f01 036/133: put uri into a text property, ELPA Syncer, 2024/03/10