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)
((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.
(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.
;; -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)))
;; 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