aboutsummaryrefslogtreecommitdiffstats
path: root/src/terminal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 1b15d1f26be..5c4852c5b6f 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -251,8 +251,8 @@ decode_live_terminal (Lisp_Object terminal)
251 return t; 251 return t;
252} 252}
253 253
254/* Like decode_terminal, but ensure that the resulting terminal object refers 254/* Like decode_live_terminal, but ensure that the resulting terminal
255 to a text-based terminal device. */ 255 object refers to a text-based terminal device. */
256 256
257struct terminal * 257struct terminal *
258decode_tty_terminal (Lisp_Object terminal) 258decode_tty_terminal (Lisp_Object terminal)
@@ -508,6 +508,25 @@ return values. */)
508 } 508 }
509} 509}
510 510
511DEFUN ("frame-initial-p", Fframe_initial_p, Sframe_initial_p, 0, 1, 0,
512 doc: /* Return non-nil if FRAME is the initial frame.
513That is, the initial text frame used internally during daemon mode,
514batch mode, and the early stages of startup.
515If FRAME is a terminal object, return non-nil if it holds
516the initial frame. FRAME defaults to the selected frame. */)
517 (Lisp_Object frame)
518{
519 if (NILP (frame))
520 frame = selected_frame;
521 if (FRAMEP (frame))
522 {
523 struct frame *f = XFRAME (frame);
524 return FRAME_LIVE_P (f) && FRAME_INITIAL_P (f) ? Qt : Qnil;
525 }
526 struct terminal *t = decode_terminal (frame);
527 return t && t->type == output_initial ? Qt : Qnil;
528}
529
511DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0, 530DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0,
512 doc: /* Return a list of all terminal devices. */) 531 doc: /* Return a list of all terminal devices. */)
513 (void) 532 (void)
@@ -680,8 +699,6 @@ init_initial_terminal (void)
680#else 699#else
681 initial_terminal_lisp = make_lisp_ptr (create_terminal (output_initial, NULL), Lisp_Vectorlike); 700 initial_terminal_lisp = make_lisp_ptr (create_terminal (output_initial, NULL), Lisp_Vectorlike);
682#endif 701#endif
683 /* Note: menu-bar.el:menu-bar-update-buffers knows about this
684 special name of the initial terminal. */
685 initial_terminal->name = xstrdup ("initial_terminal"); 702 initial_terminal->name = xstrdup ("initial_terminal");
686 initial_terminal->kboard = initial_kboard; 703 initial_terminal->kboard = initial_kboard;
687 initial_terminal->delete_terminal_hook = &delete_initial_terminal; 704 initial_terminal->delete_terminal_hook = &delete_initial_terminal;
@@ -725,6 +742,7 @@ or some time later. */);
725 Vdelete_terminal_functions = Qnil; 742 Vdelete_terminal_functions = Qnil;
726 743
727 DEFSYM (Qterminal_live_p, "terminal-live-p"); 744 DEFSYM (Qterminal_live_p, "terminal-live-p");
745 DEFSYM (Qframe_initial_p, "frame-initial-p");
728 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions"); 746 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions");
729 DEFSYM (Qrun_hook_with_args, "run-hook-with-args"); 747 DEFSYM (Qrun_hook_with_args, "run-hook-with-args");
730 748
@@ -734,6 +752,7 @@ or some time later. */);
734 defsubr (&Sdelete_terminal); 752 defsubr (&Sdelete_terminal);
735 defsubr (&Sframe_terminal); 753 defsubr (&Sframe_terminal);
736 defsubr (&Sterminal_live_p); 754 defsubr (&Sterminal_live_p);
755 defsubr (&Sframe_initial_p);
737 defsubr (&Sterminal_list); 756 defsubr (&Sterminal_list);
738 defsubr (&Sterminal_name); 757 defsubr (&Sterminal_name);
739 defsubr (&Sterminal_parameters); 758 defsubr (&Sterminal_parameters);