#include <c-ctype.h>
#include "lisp.h"
-#include "intervals.h"
+#include "composite.h"
#include "character.h"
#include "buffer.h"
#include "coding.h"
#include "blockinput.h"
#include "region-cache.h"
#include "frame.h"
-#include "dispextern.h"
#ifdef WINDOWSNT
#define NOMINMAX 1
A `directly usable' directory name is one that may be used without the
intervention of any file handler.
If FILENAME is a directly usable file itself, return
-(file-name-directory FILENAME).
+(file-name-as-directory FILENAME).
If FILENAME refers to a file which is not accessible from a local process,
then this should return nil.
The `call-process' and `start-process' functions use this function to
return STRINGP (handled_name) ? handled_name : Qnil;
}
- return Ffile_name_directory (filename);
+ return Ffile_name_as_directory (filename);
}
/* Maximum number of bytes that DST will be longer than SRC
st.st_size = -1;
if (!NILP (Vcoding_system_for_read))
{
+ /* Don't let invalid values into buffer-file-coding-system. */
CHECK_CODING_SYSTEM (Vcoding_system_for_read);
Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
}
if (CODING_FOR_UNIBYTE (&coding)
/* Can't do this if part of the buffer might be preserved. */
&& NILP (replace))
- /* Visiting a file with these coding system makes the buffer
- unibyte. */
- bset_enable_multibyte_characters (current_buffer, Qnil);
+ {
+ /* Visiting a file with these coding system makes the buffer
+ unibyte. */
+ if (inserted > 0)
+ bset_enable_multibyte_characters (current_buffer, Qnil);
+ else
+ Fset_buffer_multibyte (Qnil);
+ }
}
coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
else if (!NILP (Vcoding_system_for_write))
{
val = Vcoding_system_for_write;
- CHECK_CODING_SYSTEM (val);
if (coding_system_require_warning
&& !NILP (Ffboundp (Vselect_safe_coding_system_function)))
/* Confirm that VAL can surely encode the current region. */
if (NILP (val))
{
/* If we still have not decided a coding system, use the
- default value of buffer-file-coding-system. */
+ current buffer's value of buffer-file-coding-system. */
val = BVAR (current_buffer, buffer_file_coding_system);
using_default_coding = 1;
}
- if (!NILP (val))
- CHECK_CODING_SYSTEM (val);
-
if (! NILP (val) && ! force_raw_text)
{
Lisp_Object spec, attrs;
+ CHECK_CODING_SYSTEM (val);
CHECK_CODING_SYSTEM_GET_SPEC (val, spec);
attrs = AREF (spec, 0);
if (EQ (CODING_ATTR_TYPE (attrs), Qraw_text))
/* Confirm that VAL can surely encode the current region. */
val = call5 (Vselect_safe_coding_system_function,
start, end, val, Qnil, filename);
- CHECK_CODING_SYSTEM (val);
+ /* As the function specified by select-safe-coding-system-function
+ is out of our control, make sure we are not fed by bogus
+ values. */
+ if (!NILP (val))
+ CHECK_CODING_SYSTEM (val);
}
/* If the decided coding-system doesn't specify end-of-line
Lisp_Object dflt = BVAR (&buffer_defaults, buffer_file_coding_system);
if (! NILP (dflt))
- {
- CHECK_CODING_SYSTEM (dflt);
- val = (coding_inherit_eol_type (val, dflt));
- }
+ val = coding_inherit_eol_type (val, dflt);
}
/* If we decide not to encode text, use `raw-text' or one of its