return build_string (buf);
}
-#ifdef unix
-
-DEFUN ("set-default-file-mode", Fset_default_file_mode, Sset_default_file_mode, 1, 1, "p",
- "Set Unix `umask' value to ARGUMENT, and return old value.\n\
-The `umask' value is the default protection mode for new files.")
- (nmask)
- Lisp_Object nmask;
-{
- CHECK_NUMBER (nmask, 0);
- return make_number (umask (XINT (nmask)));
-}
-
-DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "",
- "Tell Unix to finish all pending disk updates.")
+DEFUN ("current-time-zone", Fcurrent_time_zone, Scurrent_time_zone, 0, 0, 0,
+ "Return the offset, savings state, and names for the current time zone.\n\
+This returns a list of the form (OFFSET SAVINGS-FLAG STANDARD SAVINGS).\n\
+OFFSET is an integer specifying how many minutes east of Greenwich the\n\
+ current time zone is located. A negative value means west of\n\
+ Greenwich. Note that this describes the standard time; If daylight\n\
+ savings time is in effect, it does not affect this value.\n\
+SAVINGS-FLAG is non-nil iff daylight savings time or some other sort\n\
+ of seasonal time adjustment is in effect.\n\
+STANDARD is a string giving the name of the time zone when no seasonal\n\
+ time adjustment is in effect.\n\
+SAVINGS is a string giving the name of the time zone when there is a\n\
+ seasonal time adjustment in effect.\n\
+If the local area does not use a seasonal time adjustment,\n\
+SAVINGS-FLAG will always be nil, and STANDARD and SAVINGS will be the\n\
+same.")
()
{
- sync ();
- return Qnil;
+#ifdef EMACS_CURRENT_TIME_ZONE
+ int offset, savings_flag;
+ char standard[11];
+ char savings[11];
+
+ EMACS_CURRENT_TIME_ZONE (&offset, &savings_flag, standard, savings);
+
+ return Fcons (make_number (offset),
+ Fcons ((savings_flag ? Qt : Qnil),
+ Fcons (build_string (standard),
+ Fcons (build_string (savings),
+ Qnil))));
+#else
+ error
+ ("current-time-zone has not been implemented on this operating system.");
+#endif
}
-#endif /* unix */
\f
void
insert1 (arg)
}
\f
-/* Return a string with the contents of the current region */
+/* Making strings from buffer contents. */
+
+/* Return a Lisp_String containing the text of the current buffer from
+ START to END.
+
+ We don't want to use plain old make_string here, because it calls
+ make_uninit_string, which can cause the buffer arena to be
+ compacted. make_string has no way of knowing that the data has
+ been moved, and thus copies the wrong data into the string. This
+ doesn't effect most of the other users of make_string, so it should
+ be left as is. But we should use this function when conjuring
+ buffer substrings. */
+Lisp_Object
+make_buffer_string (start, end)
+ int start, end;
+{
+ Lisp_Object result;
+
+ if (start < GPT && GPT < end)
+ move_gap (start);
+
+ result = make_uninit_string (end - start);
+ bcopy (&FETCH_CHAR (start), XSTRING (result)->data, end - start);
+
+ return result;
+}
DEFUN ("buffer-substring", Fbuffer_substring, Sbuffer_substring, 2, 2, 0,
"Return the contents of part of the current buffer as a string.\n\
Lisp_Object b, e;
{
register int beg, end;
- Lisp_Object result;
validate_region (&b, &e);
beg = XINT (b);
end = XINT (e);
- if (beg < GPT && end > GPT)
- move_gap (beg);
-
- /* Plain old make_string calls make_uninit_string, which can cause
- the buffer arena to be compacted. make_string has no way of
- knowing that the data has been moved, and thus copies the wrong
- data into the string. This doesn't effect most of the other
- users of make_string, so it should be left as is. */
- result = make_uninit_string (end - beg);
- bcopy (&FETCH_CHAR (beg), XSTRING (result)->data, end - beg);
-
- return result;
+ return make_buffer_string (beg, end);
}
DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0,
"Return the contents of the current buffer as a string.")
()
{
- if (BEGV < GPT && ZV > GPT)
- move_gap (BEGV);
- return make_string (BEGV_ADDR, ZV - BEGV);
+ return make_buffer_string (BEGV, ZV);
}
DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_substring,
defsubr (&Suser_full_name);
defsubr (&Scurrent_time);
defsubr (&Scurrent_time_string);
+ defsubr (&Scurrent_time_zone);
defsubr (&Ssystem_name);
- defsubr (&Sset_default_file_mode);
- defsubr (&Sunix_sync);
defsubr (&Smessage);
defsubr (&Sformat);