report_file_errno (char const *string, Lisp_Object name, int errorno)
{
Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
- synchronize_system_messages_locale ();
- char *str = strerror (errorno);
+ char *str = emacs_strerror (errorno);
AUTO_STRING (unibyte_str, str);
Lisp_Object errstring
= code_convert_string_norecord (unibyte_str, Vlocale_coding_system, 0);
void
report_file_notify_error (const char *string, Lisp_Object name)
{
- Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
- synchronize_system_messages_locale ();
- char *str = strerror (errno);
+ char *str = emacs_strerror (errno);
AUTO_STRING (unibyte_str, str);
Lisp_Object errstring
= code_convert_string_norecord (unibyte_str, Vlocale_coding_system, 0);
+ Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
Lisp_Object errdata = Fcons (errstring, data);
xsignal (Qfile_notify_error, Fcons (build_string (string), errdata));
/* The read-only attribute of the parent directory doesn't affect
whether a file or directory can be created within it. Some day we
should check ACLs though, which do affect this. */
- return file_directory_p (SDATA (dir)) ? Qt : Qnil;
+ return file_directory_p (SSDATA (dir)) ? Qt : Qnil;
#else
return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil;
#endif
DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p,
Sfile_accessible_directory_p, 1, 1, 0,
- doc: /* Return t if file FILENAME names a directory you can open.
-For the value to be t, FILENAME must specify the name of a directory as a file,
-and the directory must allow you to open files in it. In order to use a
-directory as a buffer's current directory, this predicate must return true.
-A directory name spec may be given instead; then the value is t
-if the directory so specified exists and really is a readable and
-searchable directory. */)
+ doc: /* Return t if FILENAME names a directory you can open.
+For the value to be t, FILENAME must specify the name of a directory
+as a file, and the directory must allow you to open files in it. In
+order to use a directory as a buffer's current directory, this
+predicate must return true. A directory name spec may be given
+instead; then the value is t if the directory so specified exists and
+really is a readable and searchable directory. */)
(Lisp_Object filename)
{
Lisp_Object absname;
/* Tell stat to use expensive method to get accurate info. */
Vw32_get_true_file_attributes = Qt;
- result = stat (SDATA (absname), &st);
+ result = stat (SSDATA (absname), &st);
Vw32_get_true_file_attributes = tem;
if (result < 0)
}
}
+/* Make sure the gap is at Z_BYTE. This is required to treat buffer
+ text as a linear C char array. */
+static void
+maybe_move_gap (struct buffer *b)
+{
+ if (BUF_GPT_BYTE (b) != BUF_Z_BYTE (b))
+ {
+ struct buffer *cb = current_buffer;
+
+ set_buffer_internal (b);
+ move_gap_both (Z, Z_BYTE);
+ set_buffer_internal (cb);
+ }
+}
+
/* FIXME: insert-file-contents should be split with the top-level moved to
Elisp and only the core kept in C. */
coding_system = CODING_ID_NAME (coding.id);
set_coding_system = true;
+ maybe_move_gap (XBUFFER (conversion_buffer));
decoded = BUF_BEG_ADDR (XBUFFER (conversion_buffer));
inserted = (BUF_Z_BYTE (XBUFFER (conversion_buffer))
- BUF_BEG_BYTE (XBUFFER (conversion_buffer)));
{
int open_flags;
int mode;
- off_t offset IF_LINT (= 0);
+ off_t offset UNINIT;
bool open_and_close_file = desc < 0;
bool ok;
int save_errno = 0;
struct stat st;
struct timespec modtime;
ptrdiff_t count = SPECPDL_INDEX ();
- ptrdiff_t count1 IF_LINT (= 0);
+ ptrdiff_t count1 UNINIT;
Lisp_Object handler;
Lisp_Object visit_file;
Lisp_Object annotations;
static Lisp_Object
auto_save_error (Lisp_Object error_val)
{
- Lisp_Object msg;
- int i;
-
auto_save_error_occurred = 1;
ring_bell (XFRAME (selected_frame));
AUTO_STRING (format, "Auto-saving %s: %s");
- msg = CALLN (Fformat, format, BVAR (current_buffer, name),
- Ferror_message_string (error_val));
-
- for (i = 0; i < 3; ++i)
- {
- if (i == 0)
- message3 (msg);
- else
- message3_nolog (msg);
- Fsleep_for (make_number (1), Qnil);
- }
+ Lisp_Object msg = CALLN (Fformat, format, BVAR (current_buffer, name),
+ Ferror_message_string (error_val));
+ call3 (intern ("display-warning"),
+ intern ("auto-save"), msg, intern ("error"));
return Qnil;
}