(server-process-filter): In daemon mode, default to emacsclient's tty
if not opening a new frame and only the terminal-frame is available.
This commit is contained in:
parent
89c4b597aa
commit
cd9c54eb5f
1 changed files with 20 additions and 8 deletions
|
@ -810,6 +810,7 @@ The following commands are accepted by the client:
|
|||
dontkill ; t if the client should not be killed.
|
||||
(commands ())
|
||||
dir
|
||||
use-current-frame
|
||||
(tty-name nil) ;nil, `window-system', or the tty name.
|
||||
tty-type ;string.
|
||||
(files nil)
|
||||
|
@ -830,7 +831,7 @@ The following commands are accepted by the client:
|
|||
((equal "-nowait" arg) (setq nowait t))
|
||||
|
||||
;; -current-frame: Don't create frames.
|
||||
((equal "-current-frame" arg) (setq tty-name nil))
|
||||
((equal "-current-frame" arg) (setq use-current-frame t))
|
||||
|
||||
;; -display DISPLAY:
|
||||
;; Open X frames on the given display instead of the default.
|
||||
|
@ -874,7 +875,8 @@ The following commands are accepted by the client:
|
|||
(cdr command-line-args-left))
|
||||
(setq tty-name (pop command-line-args-left)
|
||||
tty-type (pop command-line-args-left)
|
||||
dontkill t))
|
||||
dontkill (or dontkill
|
||||
(not use-current-frame))))
|
||||
|
||||
;; -position LINE[:COLUMN]: Set point to the given
|
||||
;; position in the next file.
|
||||
|
@ -902,6 +904,8 @@ The following commands are accepted by the client:
|
|||
;; -eval EXPR: Evaluate a Lisp expression.
|
||||
((and (equal "-eval" arg)
|
||||
command-line-args-left)
|
||||
(if use-current-frame
|
||||
(setq use-current-frame 'always))
|
||||
(lexical-let ((expr (pop command-line-args-left)))
|
||||
(if coding-system
|
||||
(setq expr (decode-coding-string expr coding-system)))
|
||||
|
@ -926,12 +930,20 @@ The following commands are accepted by the client:
|
|||
;; Unknown command.
|
||||
(t (error "Unknown command: %s" arg))))
|
||||
|
||||
(setq frame
|
||||
(case tty-name
|
||||
((nil) (if display (server-select-display display)))
|
||||
((window-system)
|
||||
(server-create-window-system-frame display nowait proc))
|
||||
(t (server-create-tty-frame tty-name tty-type proc))))
|
||||
(setq frame
|
||||
(cond
|
||||
((and use-current-frame
|
||||
(or (eq use-current-frame 'always)
|
||||
;; We can't use the Emacs daemon's
|
||||
;; terminal frame.
|
||||
(not (and (= (length (frame-list)) 1)
|
||||
(eq (selected-frame)
|
||||
terminal-frame)))))
|
||||
(setq tty-name nil)
|
||||
(if display (server-select-display display)))
|
||||
((eq tty-name 'window-system)
|
||||
(server-create-window-system-frame display nowait proc))
|
||||
(t (server-create-tty-frame tty-name tty-type proc))))
|
||||
|
||||
(process-put
|
||||
proc 'continuation
|
||||
|
|
Loading…
Add table
Reference in a new issue