diff options
| author | Miles Bader | 2002-05-26 07:23:47 +0000 |
|---|---|---|
| committer | Miles Bader | 2002-05-26 07:23:47 +0000 |
| commit | b63a55ac9707f09d90e4f2f4cd3a0acc5ef5cc56 (patch) | |
| tree | 44728bdc964c7ceb5727182987e8ca7a9b923b93 /src/term.c | |
| parent | a08166614a8cdd21b14f42c3b2f797d746b9462f (diff) | |
| download | emacs-b63a55ac9707f09d90e4f2f4cd3a0acc5ef5cc56.tar.gz emacs-b63a55ac9707f09d90e4f2f4cd3a0acc5ef5cc56.zip | |
(tty_capable_p): New function.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c index c2bac22d60c..ef5c41564c7 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1987,6 +1987,31 @@ turn_off_face (f, face_id) | |||
| 1987 | } | 1987 | } |
| 1988 | 1988 | ||
| 1989 | 1989 | ||
| 1990 | /* Return non-zero if the terminal on frame F supports all of the | ||
| 1991 | capabilities in CAPS simultaneously, with foreground and background | ||
| 1992 | colors FG and BG. */ | ||
| 1993 | |||
| 1994 | int tty_capable_p (f, caps, fg, bg) | ||
| 1995 | struct frame *f; | ||
| 1996 | unsigned caps; | ||
| 1997 | unsigned long fg, bg; | ||
| 1998 | { | ||
| 1999 | #define TTY_CAPABLE_P_TRY(cap, TS, NC_bit) \ | ||
| 2000 | if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(NC_bit))) \ | ||
| 2001 | return 0; | ||
| 2002 | |||
| 2003 | TTY_CAPABLE_P_TRY (TTY_CAP_INVERSE, TS_standout_mode, NC_REVERSE); | ||
| 2004 | TTY_CAPABLE_P_TRY (TTY_CAP_UNDERLINE, TS_enter_underline_mode, NC_UNDERLINE); | ||
| 2005 | TTY_CAPABLE_P_TRY (TTY_CAP_BOLD, TS_enter_bold_mode, NC_BOLD); | ||
| 2006 | TTY_CAPABLE_P_TRY (TTY_CAP_DIM, TS_enter_dim_mode, NC_DIM); | ||
| 2007 | TTY_CAPABLE_P_TRY (TTY_CAP_BLINK, TS_enter_blink_mode, NC_BLINK); | ||
| 2008 | TTY_CAPABLE_P_TRY (TTY_CAP_ALT_CHARSET, TS_enter_alt_charset_mode, NC_ALT_CHARSET); | ||
| 2009 | |||
| 2010 | /* We can do it! */ | ||
| 2011 | return 1; | ||
| 2012 | } | ||
| 2013 | |||
| 2014 | |||
| 1990 | /* Return non-zero if the terminal is capable to display colors. */ | 2015 | /* Return non-zero if the terminal is capable to display colors. */ |
| 1991 | 2016 | ||
| 1992 | DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, | 2017 | DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, |