comparison lispref/os.texi @ 12067:73dc8205d259

*** empty log message ***
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Jun 1995 12:23:13 +0000
parents 7cdfcd5e71ff
children a6eb5f12b0f3
comparison
equal deleted inserted replaced
12066:b9b0b3f96dc2 12067:73dc8205d259
18 * Starting Up:: Customizing Emacs start-up processing. 18 * Starting Up:: Customizing Emacs start-up processing.
19 * Getting Out:: How exiting works (permanent or temporary). 19 * Getting Out:: How exiting works (permanent or temporary).
20 * System Environment:: Distinguish the name and kind of system. 20 * System Environment:: Distinguish the name and kind of system.
21 * User Identification:: Finding the name and user id of the user. 21 * User Identification:: Finding the name and user id of the user.
22 * Time of Day:: Getting the current time. 22 * Time of Day:: Getting the current time.
23 * Time Conversion:: Converting a time from numeric form to a string, or
24 to calendrical data (or vice versa).
23 * Timers:: Setting a timer to call a function at a certain time. 25 * Timers:: Setting a timer to call a function at a certain time.
24 * Terminal Input:: Recording terminal input for debugging. 26 * Terminal Input:: Recording terminal input for debugging.
25 * Terminal Output:: Recording terminal output for debugging. 27 * Terminal Output:: Recording terminal output for debugging.
26 * Special Keysyms:: Defining system-specific key symbols for X windows. 28 * Special Keysyms:: Defining system-specific key symbols for X windows.
27 * Flow Control:: How to turn output flow control on or off. 29 * Flow Control:: How to turn output flow control on or off.
596 (system-name) 598 (system-name)
597 @result{} "prep.ai.mit.edu" 599 @result{} "prep.ai.mit.edu"
598 @end example 600 @end example
599 @end defun 601 @end defun
600 602
603 @vindex system-name
604 The symbol @code{system-name} is a variable as well as a function. In
605 fact, the function returns whatever value the variable
606 @code{system-name} currently holds. Thus, you can set the variable
607 @code{system-name} in case Emacs is confused about the name of your
608 system. The variable is also useful for constructing frame titles
609 (@pxref{Frame Titles}).
610
611 @defvar mail-host-address
612 If this variable is non-@code{nil}, it is used instead of
613 @code{system-name} for purposes of generating email addresses. For
614 example, it is used when constructing the default value of
615 @code{user-mail-address}. @xref{User Identification}. (Since this is
616 done when Emacs starts up, the value actually used is the one saved when
617 Emacs was dumped. @xref{Building Emacs}.)
618 @end defvar
619
601 @defun getenv var 620 @defun getenv var
602 @cindex environment variable access 621 @cindex environment variable access
603 This function returns the value of the environment variable @var{var}, 622 This function returns the value of the environment variable @var{var},
604 as a string. Within Emacs, the environment variable values are kept in 623 as a string. Within Emacs, the environment variable values are kept in
605 the Lisp variable @code{process-environment}. 624 the Lisp variable @code{process-environment}.
629 @var{variable} to @var{value}. Both arguments should be strings. This 648 @var{variable} to @var{value}. Both arguments should be strings. This
630 function works by modifying @code{process-environment}; binding that 649 function works by modifying @code{process-environment}; binding that
631 variable with @code{let} is also reasonable practice. 650 variable with @code{let} is also reasonable practice.
632 @end deffn 651 @end deffn
633 652
653 @defvar path-separator
654 This variable holds a string which says which character separates
655 directories in a search path (as found in an environment variable). Its
656 value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS
657 and Windows NT.
658 @end defvar
659
634 @defvar process-environment 660 @defvar process-environment
635 This variable is a list of strings, each describing one environment 661 This variable is a list of strings, each describing one environment
636 variable. The functions @code{getenv} and @code{setenv} work by means 662 variable. The functions @code{getenv} and @code{setenv} work by means
637 of this variable. 663 of this variable.
638 664
706 @end defun 732 @end defun
707 733
708 @node User Identification 734 @node User Identification
709 @section User Identification 735 @section User Identification
710 736
711 @defun user-login-name 737 @defvar user-mail-address
712 This function returns the name under which the user is logged in. If 738 This holds the nominal email address of the user who is using Emacs.
713 the environment variable @code{LOGNAME} is set, that value is used. 739 When Emacs starts up, it computes a default value that is usually right,
714 Otherwise, if the environment variable @code{USER} is set, that value is 740 but users often set this themselves when the default value is not right.
715 used. Otherwise, the value is based on the effective @sc{uid}, not the 741 @end defvar
716 real @sc{uid}. 742
743 @defun user-login-name &optional uid
744 If you don't specify @var{uid}, this function returns the name under
745 which the user is logged in. If the environment variable @code{LOGNAME}
746 is set, that value is used. Otherwise, if the environment variable
747 @code{USER} is set, that value is used. Otherwise, the value is based
748 on the effective @sc{uid}, not the real @sc{uid}.
749
750 If you specify @var{uid}, the value is the user name that corresponds
751 to @var{uid} (which should be an integer).
717 752
718 @example 753 @example
719 @group 754 @group
720 (user-login-name) 755 (user-login-name)
721 @result{} "lewis" 756 @result{} "lewis"
737 (user-full-name) 772 (user-full-name)
738 @result{} "Bil Lewis" 773 @result{} "Bil Lewis"
739 @end group 774 @end group
740 @end example 775 @end example
741 @end defun 776 @end defun
777
778 @vindex user-full-name
779 @vindex user-real-login-name
780 @vindex user-login-name
781 The symbols @code{user-login-name}, @code{user-real-login-name} and
782 @code{user-full-name} are variables as well as functions. The functions
783 return the same values that the variables hold. These variables allow
784 you to ``fake out'' Emacs by telling the functions what to return. The
785 variables are also useful for constructing frame titles (@pxref{Frame
786 Titles}).
787
788 @defvar user-real-login-name
789 This variable holds the same value that the function
790 @code{user-real-login-name} returns. The variable lets you alter the value;
791 also, you can use variables for constructing frame titles.
792 @end defvar
793
794 @defvar user-full-name
795 This variable holds the same value that the function
796 @code{user-full-name} returns. The variable lets you alter the value;
797 also, you can use variables for constructing frame titles.
798 @end defvar
742 799
743 @defun user-real-uid 800 @defun user-real-uid
744 This function returns the real @sc{uid} of the user. 801 This function returns the real @sc{uid} of the user.
745 802
746 @example 803 @example
823 880
824 The argument @var{time-value}, if given, specifies a time to analyze 881 The argument @var{time-value}, if given, specifies a time to analyze
825 instead of the current time. The argument should be a cons cell 882 instead of the current time. The argument should be a cons cell
826 containing two integers, or a list whose first two elements are 883 containing two integers, or a list whose first two elements are
827 integers. Thus, you can use times obtained from @code{current-time} 884 integers. Thus, you can use times obtained from @code{current-time}
828 (see below) and from @code{file-attributes} (@pxref{File Attributes}). 885 (see above) and from @code{file-attributes} (@pxref{File Attributes}).
886 @end defun
887
888 @node Time Conversion
889 @section Time Conversion
890
891 These functions convert time values (lists of two or three integers)
892 to strings or to calendrical information. There is also a function to
893 convert calendrical information to a time value. You can get time
894 values from the functions @code{current-time} (@pxref{Time of Day}) and
895 @code{file-attributes} (@pxref{File Attributes}).
896
897 @defun format-time-string format-string time
898 This function converts @var{time} to a string according to
899 @var{format-string}. The argument @var{format-string} may contain
900 @samp{%}-sequences which say to substitute parts of the time. Here is a
901 table of what the @samp{%}-sequences mean:
902
903 @table @samp
904 @item %a
905 This stands for the abbreviated name of the day of week.
906 @item %A
907 This stands for the full name of the day of week.
908 @item %b
909 This stands for the abbreviated name of the month.
910 @item %B
911 This stands for the full name of the month.
912 @item %c
913 This is a synonym for @samp{%x %X}.
914 @item %C
915 This has a locale-specific meaning. In the C locale, it is equivalent
916 to @samp{%A, %B %e, %Y}.
917 @item %d
918 This stands for the day of month, zero-padded.
919 @item %D
920 This is a synonym for @samp{%m/%d/%y}.
921 @item %e
922 This stands for the day of month, blank-padded.
923 @item %h
924 This is a synonym for @samp{%b}.
925 @item %H
926 This stands for the hour (00-23).
927 @item %I
928 This stands for the hour (00-12).
929 @item %j
930 This stands for the day of the year (001-366).
931 @item %k
932 This stands for the hour (0-23), blank padded.
933 @item %l
934 This stands for the hour (1-12), blank padded.
935 @item %m
936 This stands for the month (01-12).
937 @item %M
938 This stands for the minute (00-59).
939 @item %n
940 This stands for a newline.
941 @item %p
942 This stands for @samp{AM} or @samp{PM}, as appropriate.
943 @item %r
944 This is a synonym for @samp{%I:%M:%S %p}.
945 @item %R
946 This is a synonym for @samp{%H:%M}.
947 @item %S
948 This stands for the seconds (00-60).
949 @item %t
950 This stands for a tab character.
951 @item %T
952 This is a synonym for @samp{%H:%M:%S}.
953 @item %U
954 This stands for the week of the year (01-52), assuming that weeks
955 start on Sunday.
956 @item %w
957 This stands for the numeric day of week (0-6). Sunday is day 0.
958 @item %W
959 This stands for the week of the year (01-52), assuming that weeks
960 start on Monday.
961 @item %x
962 This has a locale-specific meaning. In the C locale, it is equivalent
963 to @samp{%D}.
964 @item %X
965 This has a locale-specific meaning. In the C locale, it is equivalent
966 to @samp{%T}.
967 @item %y
968 This stands for the year without century (00-99).
969 @item %Y
970 This stands for the year with century.
971 @item %Z
972 This stands for the time zone abbreviation.
973 @end table
974 @end defun
975
976 @defun decode-time time
977 This function converts a time value into calendrical form. The return
978 value is a list of nine elements, as follows:
979
980 @example
981 (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{zone})
982 @end example
983
984 Here is what the elements mean:
985
986 @table @var
987 @item sec
988 The number of seconds past the minute, as an integer between 0 and 59.
989 @item minute
990 The number of minutes past the hour, as an integer between 0 and 59.
991 @item hour
992 The hour of the day, as an integer between 0 and 23.
993 @item day
994 The day of the month, as an integer between 1 and 31.
995 @item month
996 The month of the year, as an integer between 1 and 12.
997 @item year
998 The year, an integer typically greater than 1900.
999 @item dow
1000 The day of week, as an integer between 0 and 6, where 0 stands for
1001 Sunday.
1002 @item dst
1003 @code{t} if daylight savings time is effect, otherwise @code{nil}.
1004 @item zone
1005 An integer indicating the number of seconds east of Greenwich.
1006 @end table
1007
1008 Note that Common Lisp has different meanings for @var{dow} and
1009 @var{zone}.
1010 @end defun
1011
1012 @defun encode-time seconds minutes hour day month year &optional zone
1013 This function is the inverse of @code{decode-time}. It converts seven
1014 items of calendrical data into a time value.
1015
1016 For the meanings of the arguments, see the table above under
1017 @code{decode-time}.
1018
1019 Year numbers less than 100 are treated just like other year numbers. If
1020 you them to stand for years above 1900, you must alter them yourself
1021 before you call @code{encode-time}.
1022
1023 The optional argument @var{zone} defaults to the current time zone and
1024 its daylight savings time rules. If specified, it can be either a list
1025 (as you would get from @code{current-time-zone}) or an integer (as you
1026 would get from @code{decode-time}). The specified zone is used without
1027 any further alteration for daylight savings time.
829 @end defun 1028 @end defun
830 1029
831 @node Timers 1030 @node Timers
832 @section Timers 1031 @section Timers
833 1032
1269 by HP X servers whose numeric code is (1 << 28) + 168. 1468 by HP X servers whose numeric code is (1 << 28) + 168.
1270 1469
1271 It is not a problem if the alist defines keysyms for other X servers, as 1470 It is not a problem if the alist defines keysyms for other X servers, as
1272 long as they don't conflict with the ones used by the X server actually 1471 long as they don't conflict with the ones used by the X server actually
1273 in use. 1472 in use.
1473
1474 The variable is always local to the current X terminal and cannot be
1475 buffer-local. @xref{Multiple Displays}.
1274 @end defvar 1476 @end defvar
1275 1477
1276 @node Flow Control 1478 @node Flow Control
1277 @section Flow Control 1479 @section Flow Control
1278 @cindex flow control characters 1480 @cindex flow control characters