Merge branch 'Stebalien.github.com/steb/fix-subordinate-daemon' into externals/exwm
* ch11ng.github.com/pull/939: Correctly stop the subordinate Emacs daemon
This commit is contained in:
		
						commit
						64d324e6ea
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		
							
								
								
									
										14
									
								
								exwm.el
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								exwm.el
									
										
									
									
									
								
							| 
						 | 
					@ -5,7 +5,7 @@
 | 
				
			||||||
;; Author: Chris Feng <chris.w.feng@gmail.com>
 | 
					;; Author: Chris Feng <chris.w.feng@gmail.com>
 | 
				
			||||||
;; Maintainer: Adrián Medraño Calvo <adrian@medranocalvo.com>
 | 
					;; Maintainer: Adrián Medraño Calvo <adrian@medranocalvo.com>
 | 
				
			||||||
;; Version: 0.28
 | 
					;; Version: 0.28
 | 
				
			||||||
;; Package-Requires: ((xelb "0.18"))
 | 
					;; Package-Requires: ((emacs "26.1") (xelb "0.18"))
 | 
				
			||||||
;; Keywords: unix
 | 
					;; Keywords: unix
 | 
				
			||||||
;; URL: https://github.com/ch11ng/exwm
 | 
					;; URL: https://github.com/ch11ng/exwm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,9 @@
 | 
				
			||||||
(defconst exwm--server-name "server-exwm"
 | 
					(defconst exwm--server-name "server-exwm"
 | 
				
			||||||
  "Name of the subordinate Emacs server.")
 | 
					  "Name of the subordinate Emacs server.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar exwm--server-timeout 1
 | 
				
			||||||
 | 
					  "Number of seconds to wait for the subordinate Emacs server to exit before killing it.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defvar exwm--server-process nil "Process of the subordinate Emacs server.")
 | 
					(defvar exwm--server-process nil "Process of the subordinate Emacs server.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun exwm-reset ()
 | 
					(defun exwm-reset ()
 | 
				
			||||||
| 
						 | 
					@ -999,8 +1002,13 @@ FRAME, if given, indicates the X display EXWM should manage."
 | 
				
			||||||
(defun exwm--server-stop ()
 | 
					(defun exwm--server-stop ()
 | 
				
			||||||
  "Stop the subordinate Emacs server."
 | 
					  "Stop the subordinate Emacs server."
 | 
				
			||||||
  (exwm--log)
 | 
					  (exwm--log)
 | 
				
			||||||
  (server-force-delete exwm--server-name)
 | 
					 | 
				
			||||||
  (when exwm--server-process
 | 
					  (when exwm--server-process
 | 
				
			||||||
 | 
					    (when (process-live-p exwm--server-process)
 | 
				
			||||||
 | 
					      (cl-loop
 | 
				
			||||||
 | 
					       initially (signal-process exwm--server-process 'TERM)
 | 
				
			||||||
 | 
					       while     (process-live-p exwm--server-process)
 | 
				
			||||||
 | 
					       repeat    (* 10 exwm--server-timeout)
 | 
				
			||||||
 | 
					       do        (sit-for 0.1)))
 | 
				
			||||||
    (delete-process exwm--server-process)
 | 
					    (delete-process exwm--server-process)
 | 
				
			||||||
    (setq exwm--server-process nil)))
 | 
					    (setq exwm--server-process nil)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1017,7 +1025,7 @@ FUNCTION is the function to be evaluated, ARGS are the arguments."
 | 
				
			||||||
                         (car command-line-args) ;The executable file
 | 
					                         (car command-line-args) ;The executable file
 | 
				
			||||||
                         "-d" (frame-parameter nil 'display)
 | 
					                         "-d" (frame-parameter nil 'display)
 | 
				
			||||||
                         "-Q"
 | 
					                         "-Q"
 | 
				
			||||||
                         (concat "--daemon=" exwm--server-name)
 | 
					                         (concat "--fg-daemon=" exwm--server-name)
 | 
				
			||||||
                         "--eval"
 | 
					                         "--eval"
 | 
				
			||||||
                         ;; Create an invisible frame
 | 
					                         ;; Create an invisible frame
 | 
				
			||||||
                         "(make-frame '((window-system . x) (visibility)))"))
 | 
					                         "(make-frame '((window-system . x) (visibility)))"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue