return Qt;
}
+DEFUN ("set-process-inherit-coding-system-flag",
+ Fset_process_inherit_coding_system_flag,
+ Sset_process_inherit_coding_system_flag, 2, 2, 0,
+ "Determine whether buffer of PROCESS will inherit coding-system.\n\
+If the second argument FLAG is non-nil, then the variable\n\
+`buffer-file-coding-system' of the buffer associated with PROCESS\n\
+will be bound to the value of the coding system used to decode\n\
+the process output.\n\
+\n\
+This is useful when the coding system specified for the process buffer\n\
+leaves either the character code conversion or the end-of-line conversion\n\
+unspecified, or if the coding system used to decode the process output\n\
+is more appropriate for saving the process buffer.\n\
+\n\
+Binding the variable `inherit-process-coding-system' to non-nil before\n\
+starting the process is an alternative way of setting the inherit flag\n\
+for the process which will run.")
+ (process, flag)
+ register Lisp_Object process, flag;
+{
+ CHECK_PROCESS (process, 0);
+ XPROCESS (process)->inherit_coding_system_flag = !Fnull (flag);
+ return flag;
+}
+
+DEFUN ("process-inherit-coding-system-flag",
+ Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
+ 1, 1, 0,
+ "Return the value of inherit-coding-system flag for PROCESS.\n\
+If this flag is t, `buffer-file-coding-system' of the buffer\n\
+associated with PROCESS will inherit the coding system used to decode\n\
+the process output.")
+ (process)
+ register Lisp_Object process;
+{
+ CHECK_PROCESS (process, 0);
+ return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
+}
+
DEFUN ("process-kill-without-query", Fprocess_kill_without_query,
Sprocess_kill_without_query, 1, 2, 0,
"Say no query needed if PROCESS is running when Emacs is exited.\n\
XPROCESS (proc)->encoding_buf = make_uninit_string (0);
XPROCESS (proc)->encoding_carryover = make_number (0);
+ XPROCESS (proc)->inherit_coding_system_flag
+ = (NILP (buffer) || !inherit_process_coding_system) ? 0 : 1;
+
create_process (proc, (char **) new_argv, current_dir);
return unbind_to (count, proc);
XPROCESS (proc)->encoding_buf = make_uninit_string (0);
XPROCESS (proc)->encoding_carryover = make_number (0);
+ XPROCESS (proc)->inherit_coding_system_flag =
+ NILP (buffer) || !inherit_process_coding_system ? 0 : 1;
+
UNGCPRO;
return proc;
}
XSETINT (p->decoding_carryover, carryover);
Vlast_coding_system_used = coding->symbol;
+ /* If the caller required, let the process associated buffer
+ inherit the coding-system used to decode the process output. */
+ if (p->inherit_coding_system_flag
+ && !NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
+ {
+ struct buffer *prev_buf = current_buffer;
+
+ Fset_buffer (p->buffer);
+ call1 (intern ("after-insert-file-set-buffer-file-coding-system"),
+ make_number (nbytes));
+ set_buffer_internal (prev_buf);
+ }
+
/* Read and dispose of the process output. */
outstream = p->filter;
if (!NILP (outstream))
defsubr (&Sset_process_sentinel);
defsubr (&Sprocess_sentinel);
defsubr (&Sset_process_window_size);
+ defsubr (&Sset_process_inherit_coding_system_flag);
+ defsubr (&Sprocess_inherit_coding_system_flag);
defsubr (&Sprocess_kill_without_query);
defsubr (&Sprocess_contact);
defsubr (&Slist_processes);
#include "lisp.h"
#include "systime.h"
+#include "charset.h"
+#include "coding.h"
#include "termopts.h"
#include "sysselect.h"
return Qnil;
}
+DEFUN ("process-inherit-coding-system-flag",
+ Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
+ 1, 1, 0,
+ /* Don't confuse make-docfile by having two doc strings for this function.
+ make-docfile does not pay attention to #if, for good reason! */
+ 0)
+ (process)
+ register Lisp_Object process;
+{
+ /* Ignore the argument and return the value of
+ inherit-process-coding-system. */
+ return inherit_process_coding_system ? Qt : Qnil;
+}
+
/* Kill all processes associated with `buffer'.
If `buffer' is nil, kill all processes.
Since we have no subprocesses, this does nothing. */
syms_of_process ()
{
defsubr (&Sget_buffer_process);
+ defsubr (&Sprocess_inherit_coding_system_flag);
}
\f