summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2010-10-08 12:14:47 +0200
committerJuanma Barranquero <lekktu@gmail.com>2010-10-08 12:14:47 +0200
commit4628bef1eea0f60e846fe6b6591725aa92952de9 (patch)
tree9d137b8e0964c0b1ebc4afb4e743e35b807d048d /src
parent24ac444fbe5d76a7cf09a62b741b9e956ab90d3e (diff)
parent2b7c934285417d2eac7a3c603231d22ce7e212d8 (diff)
Merge changes from emacs-23 branch.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog51
-rw-r--r--src/buffer.c10
-rw-r--r--src/callproc.c21
-rw-r--r--src/coding.c48
-rw-r--r--src/coding.h1
-rw-r--r--src/dbusbind.c10
-rw-r--r--src/keyboard.c5
-rw-r--r--src/process.c36
-rw-r--r--src/xfont.c2
9 files changed, 144 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2effe2ea84..0bde3bb19f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,54 @@
+2010-10-08 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (complement_process_encoding_system): Fix previous change.
+
+2010-10-08 Michael Albinus <michael.albinus@gmx.de>
+
+ * dbusbind.c (syms_of_dbusbind): Move putenv call ...
+ (Fdbus_init_bus): ... here. (Bug#7113)
+
+2010-10-08 Glenn Morris <rgm@gnu.org>
+
+ * buffer.c (before-change-functions, after-change-functions):
+ Three-year overdue doc fix following 2007-08-13 change.
+
+2010-10-08 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (coding_inherit_eol_type): If parent doesn't specify
+ eol-format, inherit from the system's default.
+ (complement_process_encoding_system): Make a new coding system
+ inherit the original eol-format.
+
+2010-10-08 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (complement_process_encoding_system): New function.
+
+ * coding.h (complement_process_encoding_system): Extern it.
+
+ * callproc.c (Fcall_process): Complement the coding system for
+ encoding arguments.
+ (Fcall_process_region): Complement the coding system for encoding
+ the input to the process.
+
+ * process.c (Fstart_process): Complement the coding system for
+ encoding arguments.
+ (send_process): Complement the coding system for encoding what
+ sent to the process.
+
+2010-10-08 Kenichi Handa <handa@m17n.org>
+
+ * xfont.c (xfont_open): Fix setting of font->average_width from
+ :avgwidth property (Bug#7123).
+
+2010-10-08 Michael Albinus <michael.albinus@gmx.de>
+
+ * dbusbind.c (syms_of_dbusbind): Use putenv instead of setenv, it
+ is more portable.
+
+ * keyboard.c (gobble_input): Move call of xd_read_queued_messages ...
+ (kbd_buffer_get_event): ... here. This is needed for cygwin, which
+ has not defined SIGIO.
+
2010-10-08 Chong Yidong <cyd@stupidchicken.com>
* xterm.c (x_draw_relief_rect): If box width is larger than 1,
diff --git a/src/buffer.c b/src/buffer.c
index 3f087d62a5..ed3b7acd2a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5957,10 +5957,7 @@ No information is given about the length of the text after the change.
Buffer changes made while executing the `before-change-functions'
don't call any before-change or after-change functions.
-That's because these variables are temporarily set to nil.
-As a result, a hook function cannot straightforwardly alter the
-value of these variables. See the Emacs Lisp manual for a way of
-accomplishing an equivalent result by using other variables.
+That's because `inhibit-modification-hooks' is temporarily set non-nil.
If an unhandled error happens in running these functions,
the variable's value remains nil. That prevents the error
@@ -5978,10 +5975,7 @@ and the post-change beginning and end are at the same place.)
Buffer changes made while executing the `after-change-functions'
don't call any before-change or after-change functions.
-That's because these variables are temporarily set to nil.
-As a result, a hook function cannot straightforwardly alter the
-value of these variables. See the Emacs Lisp manual for a way of
-accomplishing an equivalent result by using other variables.
+That's because `inhibit-modification-hooks' is temporarily set non-nil.
If an unhandled error happens in running these functions,
the variable's value remains nil. That prevents the error
diff --git a/src/callproc.c b/src/callproc.c
index 29e13bbc4a..ee0872b556 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -254,21 +254,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (!NILP (Vcoding_system_for_write))
val = Vcoding_system_for_write;
else if (! must_encode)
- val = Qnil;
+ val = Qraw_text;
else
{
args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
args2[0] = Qcall_process;
for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
- if (CONSP (coding_systems))
- val = XCDR (coding_systems);
- else if (CONSP (Vdefault_process_coding_system))
- val = XCDR (Vdefault_process_coding_system);
- else
- val = Qnil;
+ val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
}
- val = coding_inherit_eol_type (val, Qnil);
+ val = complement_process_encoding_system (val);
setup_coding_system (Fcheck_coding_system (val), &argument_coding);
coding_attrs = CODING_ID_ATTRS (argument_coding.id);
if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs)))
@@ -912,20 +907,16 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
if (!NILP (Vcoding_system_for_write))
val = Vcoding_system_for_write;
else if (NILP (current_buffer->enable_multibyte_characters))
- val = Qnil;
+ val = Qraw_text;
else
{
args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
args2[0] = Qcall_process_region;
for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
- if (CONSP (coding_systems))
- val = XCDR (coding_systems);
- else if (CONSP (Vdefault_process_coding_system))
- val = XCDR (Vdefault_process_coding_system);
- else
- val = Qnil;
+ val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
}
+ val = complement_process_encoding_system (val);
{
int count1 = SPECPDL_INDEX ();
diff --git a/src/coding.c b/src/coding.c
index d6285ed924..2cf3236009 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6016,10 +6016,9 @@ raw_text_coding_system (Lisp_Object coding_system)
}
-/* If CODING_SYSTEM doesn't specify end-of-line format but PARENT
- does, return one of the subsidiary that has the same eol-spec as
- PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil,
- inherit end-of-line format from the system's setting
+/* If CODING_SYSTEM doesn't specify end-of-line format, return one of
+ the subsidiary that has the same eol-spec as PARENT (if it is not
+ nil and specifies end-of-line format) or the system's setting
(system_eol_type). */
Lisp_Object
@@ -6041,6 +6040,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
parent_spec = CODING_SYSTEM_SPEC (parent);
parent_eol_type = AREF (parent_spec, 2);
+ if (VECTORP (parent_eol_type))
+ parent_eol_type = system_eol_type;
}
else
parent_eol_type = system_eol_type;
@@ -6054,6 +6055,45 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
return coding_system;
}
+
+/* Check if text-conversion and eol-conversion of CODING_SYSTEM are
+ decided for writing to a process. If not, complement them, and
+ return a new coding system. */
+
+Lisp_Object
+complement_process_encoding_system (Lisp_Object coding_system)
+{
+ Lisp_Object coding_base = Qnil, eol_base = Qnil;
+ Lisp_Object spec, attrs;
+ int i;
+
+ for (i = 0; i < 3; i++)
+ {
+ if (i == 1)
+ coding_system = CDR_SAFE (Vdefault_process_coding_system);
+ else if (i == 2)
+ coding_system = preferred_coding_system ();
+ spec = CODING_SYSTEM_SPEC (coding_system);
+ if (NILP (spec))
+ continue;
+ attrs = AREF (spec, 0);
+ if (NILP (coding_base) && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
+ coding_base = CODING_ATTR_BASE_NAME (attrs);
+ if (NILP (eol_base) && ! VECTORP (AREF (spec, 2)))
+ eol_base = coding_system;
+ if (! NILP (coding_base) && ! NILP (eol_base))
+ break;
+ }
+
+ if (i > 0)
+ /* The original CODING_SYSTEM didn't specify text-conversion or
+ eol-conversion. Be sure that we return a fully complemented
+ coding system. */
+ coding_system = coding_inherit_eol_type (coding_base, eol_base);
+ return coding_system;
+}
+
+
/* Emacs has a mechanism to automatically detect a coding system if it
is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But,
it's impossible to distinguish some coding systems accurately
diff --git a/src/coding.h b/src/coding.h
index 0caa5b2f96..7233726a25 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -707,6 +707,7 @@ extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
int);
extern Lisp_Object raw_text_coding_system (Lisp_Object);
extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
+extern Lisp_Object complement_process_encoding_system (Lisp_Object);
extern int decode_coding_gap (struct coding_system *,
EMACS_INT, EMACS_INT);
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 99a157fbc7..683b7cb583 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -900,6 +900,9 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
/* Add bus to list of registered buses. */
Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses);
+ /* We do not want to abort. */
+ putenv ("DBUS_FATAL_WARNINGS=0");
+
/* Return. */
return Qnil;
}
@@ -2160,12 +2163,11 @@ be called when the D-Bus reply message arrives. */);
doc: /* If non-nil, debug messages of D-Bus bindings are raised. */);
#ifdef DBUS_DEBUG
Vdbus_debug = Qt;
- /* We can also set environment DBUS_VERBOSE=1 in order to see more
- traces. */
+ /* We can also set environment variable DBUS_VERBOSE=1 in order to
+ see more traces. This requires libdbus-1 to be configured with
+ --enable-verbose-mode. */
#else
Vdbus_debug = Qnil;
- /* We do not want to abort. */
- setenv ("DBUS_FATAL_WARNINGS", "0", 1);
#endif
Fprovide (intern_c_string ("dbusbind"), Qnil);
diff --git a/src/keyboard.c b/src/keyboard.c
index 9af26cd427..b284244ac8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3952,6 +3952,11 @@ kbd_buffer_get_event (KBOARD **kbp,
/* One way or another, wait until input is available; then, if
interrupt handlers have not read it, read it now. */
+#ifdef HAVE_DBUS
+ /* Read D-Bus messages. */
+ xd_read_queued_messages ();
+#endif /* HAVE_DBUS */
+
/* Note SIGIO has been undef'd if FIONREAD is missing. */
#ifdef SIGIO
gobble_input (0);
diff --git a/src/process.c b/src/process.c
index 370fb673e8..e151506595 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1670,6 +1670,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
val = XCDR (Vdefault_process_coding_system);
}
XPROCESS (proc)->encode_coding_system = val;
+ /* Note: At this momemnt, the above coding system may leave
+ text-conversion or eol-conversion unspecified. They will be
+ decided after we read output from the process and decode it by
+ some coding system, or just before we actually send a text to
+ the process. */
}
@@ -1712,6 +1717,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
tem = Fsubstring (tem, make_number (2), Qnil);
{
+ Lisp_Object arg_encoding = Qnil;
struct gcpro gcpro1;
GCPRO1 (tem);
@@ -1729,9 +1735,14 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
tem = Fcons (args[i], tem);
CHECK_STRING (XCAR (tem));
if (STRING_MULTIBYTE (XCAR (tem)))
- XSETCAR (tem,
- code_convert_string_norecord
- (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1));
+ {
+ if (NILP (arg_encoding))
+ arg_encoding = (complement_process_encoding_system
+ (XPROCESS (proc)->encode_coding_system));
+ XSETCAR (tem,
+ code_convert_string_norecord
+ (XCAR (tem), arg_encoding, 1));
+ }
}
UNGCPRO;
@@ -5529,12 +5540,21 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf,
&& !NILP (XBUFFER (object)->enable_multibyte_characters))
|| EQ (object, Qt))
{
+ p->encode_coding_system
+ = complement_process_encoding_system (p->encode_coding_system);
if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
- /* The coding system for encoding was changed to raw-text
- because we sent a unibyte text previously. Now we are
- sending a multibyte text, thus we must encode it by the
- original coding system specified for the current process. */
- setup_coding_system (p->encode_coding_system, coding);
+ {
+ /* The coding system for encoding was changed to raw-text
+ because we sent a unibyte text previously. Now we are
+ sending a multibyte text, thus we must encode it by the
+ original coding system specified for the current process.
+
+ Another reason we comming here is that the coding system
+ was just complemented and new one was returned by
+ complement_process_encoding_system. */
+ setup_coding_system (p->encode_coding_system, coding);
+ Vlast_coding_system_used = p->encode_coding_system;
+ }
coding->src_multibyte = 1;
}
else
diff --git a/src/xfont.c b/src/xfont.c
index 0a7f4a3c97..d4c6af17c4 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -841,7 +841,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
val = Ffont_get (font_object, QCavgwidth);
if (INTEGERP (val))
- font->average_width = XINT (val);
+ font->average_width = XINT (val) / 10;
if (font->average_width < 0)
font->average_width = - font->average_width;
if (font->average_width == 0