aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2007-12-16 05:08:49 +0000
committerMiles Bader2007-12-16 05:08:49 +0000
commitd29ee6b1a110cf5d170a10317a96acbbd4a1c68b (patch)
tree58f3c40766d8d56de7d2b026c29e198764d910aa /src
parent7e095e45a3f790e4608c88db9648d248e24901dc (diff)
parent47854a55680b5809811caf72f66ecbe8289c2855 (diff)
downloademacs-d29ee6b1a110cf5d170a10317a96acbbd4a1c68b.tar.gz
emacs-d29ee6b1a110cf5d170a10317a96acbbd4a1c68b.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-300
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog69
-rw-r--r--src/buffer.c58
-rw-r--r--src/dbusbind.c224
-rw-r--r--src/dispextern.h2
-rw-r--r--src/keyboard.c89
-rw-r--r--src/w32fns.c8
-rw-r--r--src/w32term.c2
7 files changed, 260 insertions, 192 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f55e4ac786c..d5edca82fe9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,72 @@
12007-12-14 Jason Rumney <jasonr@gnu.org>
2
3 * w32term.c (w32_read_socket): Use MULTIBYTE_CHAR_KEYSTROKE_EVENT
4 for characters above 127.
5
62007-12-13 Jason Rumney <jasonr@gnu.org>
7
8 * w32fns.c (w32_wnd_proc, Fw32_reconstruct_hot_key): Range check
9 before dereferencing array.
10 (lookup_vk_code): Remove zero comparison.
11
122007-12-14 Michael Albinus <michael.albinus@gmx.de>
13
14 * dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
15 (Fdbus_call_method, Fdbus_send_signal, xd_read_message): Use
16 `unsigned int' instead of `uint'.
17 (xd_read_message, Fdbus_register_signal): Split expressions into
18 multiple lines before operators "&&" and "||", according to the
19 GNU Coding Standards.
20
212007-12-14 Eli Zaretskii <eliz@gnu.org>
22
23 * dispextern.h (WINDOWS_NT): Fix incorrect spelling of WINDOWSNT.
24
252007-12-12 Juri Linkov <juri@jurta.org>
26
27 * buffer.c (Frename_buffer): In interactive spec replace
28 `read-buffer' with `read-string' that uses `buffer-name-history'
29 as history, and the current buffer's name as default.
30
312007-12-10 Stefan Monnier <monnier@iro.umontreal.ca>
32
33 * keyboard.c (Fcommand_execute): Call Qcall_interactively instead of
34 manipulating the backtrace manually.
35 (make_lispy_event): Merge the ASCII and MULTIBYTE cases.
36 (struct backtrace, backtrace_list): Remove.
37 (command_loop_1): Remove dead var `no_direct'.
38
39 * buffer.c (reset_buffer_local_variables): If permanent_too is 0, also
40 preserve non-built-in buffer-local variables.
41 (Fkill_all_local_variables): Don't re-create&re-set permanent
42 buffer-local variables.
43
442007-12-09 Juri Linkov <juri@jurta.org>
45
46 * buffer.c (Frename_buffer): Change interactive spec from "s" to
47 Lisp code that uses `read-buffer' with current buffer as default.
48
492007-12-08 Michael Albinus <michael.albinus@gmx.de>
50
51 * dbusbind.c (xd_read_message): Generate an event for every
52 registered handler. There might be several handlers registered
53 for the same signal.
54 (Fdbus_register_signal): Don't overwrite a registration for the
55 same signal. Add a new registration if handlers are different.
56 (Vdbus_registered_functions_table): Rework doc string.
57
582007-12-07 Michael Albinus <michael.albinus@gmx.de>
59
60 * dbusbind.c (Fdbus_get_unique_name, xd_read_message)
61 (Fdbus_register_signal): Use DBUS_MAXIMUM_NAME_LENGTH and
62 DBUS_MAXIMUM_MATCH_RULE_LENGTH for string lengths.
63 (Fdbus_call_method, Fdbus_send_signal, Fdbus_register_signal):
64 Unify argument lists.
65 (xd_read_message, Fdbus_register_signal) Reorder and extend event
66 arguments and hash table keys. Use unique name for service.
67 (Fdbus_unregister_signal): Remove checks.
68 (Vdbus_registered_functions_table): Fix doc string.
69
12007-12-05 Magnus Henoch <mange@freemail.hu> 702007-12-05 Magnus Henoch <mange@freemail.hu>
2 71
3 * process.c (make_process): Initialize pty_flag to 0. 72 * process.c (make_process): Initialize pty_flag to 0.
diff --git a/src/buffer.c b/src/buffer.c
index 77af23ace39..009d7de86fc 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -107,12 +107,14 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
107 107
108int last_per_buffer_idx; 108int last_per_buffer_idx;
109 109
110Lisp_Object Fset_buffer (); 110EXFUN (Fset_buffer, 1);
111void set_buffer_internal (); 111void set_buffer_internal P_ ((struct buffer *b));
112void set_buffer_internal_1 (); 112void set_buffer_internal_1 P_ ((struct buffer *b));
113static void call_overlay_mod_hooks (); 113static void call_overlay_mod_hooks P_ ((Lisp_Object list, Lisp_Object overlay,
114static void swap_out_buffer_local_variables (); 114 int after, Lisp_Object arg1,
115static void reset_buffer_local_variables (); 115 Lisp_Object arg2, Lisp_Object arg3));
116static void swap_out_buffer_local_variables P_ ((struct buffer *b));
117static void reset_buffer_local_variables P_ ((struct buffer *b, int permanent_too));
116 118
117/* Alist of all buffer names vs the buffers. */ 119/* Alist of all buffer names vs the buffers. */
118/* This used to be a variable, but is no longer, 120/* This used to be a variable, but is no longer,
@@ -717,7 +719,7 @@ reset_buffer (b)
717 it does not treat permanent locals consistently. 719 it does not treat permanent locals consistently.
718 Instead, use Fkill_all_local_variables. 720 Instead, use Fkill_all_local_variables.
719 721
720 If PERMANENT_TOO is 1, then we reset permanent built-in 722 If PERMANENT_TOO is 1, then we reset permanent
721 buffer-local variables. If PERMANENT_TOO is 0, 723 buffer-local variables. If PERMANENT_TOO is 0,
722 we preserve those. */ 724 we preserve those. */
723 725
@@ -755,7 +757,23 @@ reset_buffer_local_variables (b, permanent_too)
755#endif 757#endif
756 758
757 /* Reset all (or most) per-buffer variables to their defaults. */ 759 /* Reset all (or most) per-buffer variables to their defaults. */
758 b->local_var_alist = Qnil; 760 if (permanent_too)
761 b->local_var_alist = Qnil;
762 else
763 {
764 Lisp_Object tmp, last = Qnil;
765 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp))
766 if (CONSP (XCAR (tmp))
767 && SYMBOLP (XCAR (XCAR (tmp)))
768 && !NILP (Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
769 /* If permanent-local, keep it. */
770 last = tmp;
771 else if (NILP (last))
772 b->local_var_alist = XCDR (tmp);
773 else
774 XSETCDR (last, XCDR (tmp));
775 }
776
759 for (i = 0; i < last_per_buffer_idx; ++i) 777 for (i = 0; i < last_per_buffer_idx; ++i)
760 if (permanent_too || buffer_permanent_local_flags[i] == 0) 778 if (permanent_too || buffer_permanent_local_flags[i] == 0)
761 SET_PER_BUFFER_VALUE_P (b, i, 0); 779 SET_PER_BUFFER_VALUE_P (b, i, 0);
@@ -1170,7 +1188,9 @@ buffer as BUFFER. */)
1170} 1188}
1171 1189
1172DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, 1190DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
1173 "sRename buffer (to new name): \nP", 1191 "(list (read-string \"Rename buffer (to new name): \" \
1192 nil 'buffer-name-history (buffer-name (current-buffer))) \
1193 current-prefix-arg)",
1174 doc: /* Change current buffer's name to NEWNAME (a string). 1194 doc: /* Change current buffer's name to NEWNAME (a string).
1175If second arg UNIQUE is nil or omitted, it is an error if a 1195If second arg UNIQUE is nil or omitted, it is an error if a
1176buffer named NEWNAME already exists. 1196buffer named NEWNAME already exists.
@@ -2467,14 +2487,10 @@ The first thing this function does is run
2467the normal hook `change-major-mode-hook'. */) 2487the normal hook `change-major-mode-hook'. */)
2468 () 2488 ()
2469{ 2489{
2470 register Lisp_Object alist, sym, tem;
2471 Lisp_Object oalist;
2472
2473 if (!NILP (Vrun_hooks)) 2490 if (!NILP (Vrun_hooks))
2474 call1 (Vrun_hooks, Qchange_major_mode_hook); 2491 call1 (Vrun_hooks, Qchange_major_mode_hook);
2475 oalist = current_buffer->local_var_alist;
2476 2492
2477 /* Make sure none of the bindings in oalist 2493 /* Make sure none of the bindings in local_var_alist
2478 remain swapped in, in their symbols. */ 2494 remain swapped in, in their symbols. */
2479 2495
2480 swap_out_buffer_local_variables (current_buffer); 2496 swap_out_buffer_local_variables (current_buffer);
@@ -2483,20 +2499,6 @@ the normal hook `change-major-mode-hook'. */)
2483 2499
2484 reset_buffer_local_variables (current_buffer, 0); 2500 reset_buffer_local_variables (current_buffer, 0);
2485 2501
2486 /* Any which are supposed to be permanent,
2487 make local again, with the same values they had. */
2488
2489 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2490 {
2491 sym = XCAR (XCAR (alist));
2492 tem = Fget (sym, Qpermanent_local);
2493 if (! NILP (tem))
2494 {
2495 Fmake_local_variable (sym);
2496 Fset (sym, XCDR (XCAR (alist)));
2497 }
2498 }
2499
2500 /* Force mode-line redisplay. Useful here because all major mode 2502 /* Force mode-line redisplay. Useful here because all major mode
2501 commands call this function. */ 2503 commands call this function. */
2502 update_mode_lines++; 2504 update_mode_lines++;
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 07fc24243d7..0ccccc8b22d 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -112,7 +112,7 @@ Lisp_Object Vdbus_debug;
112 message. */ 112 message. */
113char * 113char *
114xd_retrieve_value (dtype, object) 114xd_retrieve_value (dtype, object)
115 uint dtype; 115 unsigned int dtype;
116 Lisp_Object object; 116 Lisp_Object object;
117{ 117{
118 118
@@ -146,7 +146,7 @@ xd_retrieve_value (dtype, object)
146 partly supported; they result always in a Lisp list. */ 146 partly supported; they result always in a Lisp list. */
147Lisp_Object 147Lisp_Object
148xd_retrieve_arg (dtype, iter) 148xd_retrieve_arg (dtype, iter)
149 uint dtype; 149 unsigned int dtype;
150 DBusMessageIter *iter; 150 DBusMessageIter *iter;
151{ 151{
152 152
@@ -241,7 +241,7 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
241 Lisp_Object bus; 241 Lisp_Object bus;
242{ 242{
243 DBusConnection *connection; 243 DBusConnection *connection;
244 char name[1024]; 244 char name[DBUS_MAXIMUM_NAME_LENGTH];
245 245
246 /* Check parameters. */ 246 /* Check parameters. */
247 CHECK_SYMBOL (bus); 247 CHECK_SYMBOL (bus);
@@ -287,8 +287,8 @@ are converted into a list of Lisp objects which correspond to the
287elements of the D-Bus container. Example: 287elements of the D-Bus container. Example:
288 288
289\(dbus-call-method 289\(dbus-call-method
290 :session "GetKeyField" "org.gnome.seahorse" 290 :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp"
291 "/org/gnome/seahorse/keys/openpgp" "org.gnome.seahorse.Keys" 291 "org.gnome.seahorse.Keys" "GetKeyField"
292 "openpgp:657984B8C7A966DD" "simple-name") 292 "openpgp:657984B8C7A966DD" "simple-name")
293 293
294 => (t ("Philip R. Zimmermann")) 294 => (t ("Philip R. Zimmermann"))
@@ -297,18 +297,18 @@ If the result of the METHOD call is just one value, the converted Lisp
297object is returned instead of a list containing this single Lisp object. 297object is returned instead of a list containing this single Lisp object.
298 298
299\(dbus-call-method 299\(dbus-call-method
300 :system "GetPropertyString" "org.freedesktop.Hal" 300 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer"
301 "/org/freedesktop/Hal/devices/computer" "org.freedesktop.Hal.Device" 301 "org.freedesktop.Hal.Device" "GetPropertyString"
302 "system.kernel.machine") 302 "system.kernel.machine")
303 303
304 => "i686" 304 => "i686"
305 305
306usage: (dbus-call-method BUS METHOD SERVICE PATH INTERFACE &rest ARGS) */) 306usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &rest ARGS) */)
307 (nargs, args) 307 (nargs, args)
308 int nargs; 308 int nargs;
309 register Lisp_Object *args; 309 register Lisp_Object *args;
310{ 310{
311 Lisp_Object bus, method, service, path, interface; 311 Lisp_Object bus, service, path, interface, method;
312 Lisp_Object result; 312 Lisp_Object result;
313 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 313 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
314 DBusConnection *connection; 314 DBusConnection *connection;
@@ -316,29 +316,29 @@ usage: (dbus-call-method BUS METHOD SERVICE PATH INTERFACE &rest ARGS) */)
316 DBusMessage *reply; 316 DBusMessage *reply;
317 DBusMessageIter iter; 317 DBusMessageIter iter;
318 DBusError derror; 318 DBusError derror;
319 uint dtype; 319 unsigned int dtype;
320 int i; 320 int i;
321 char *value; 321 char *value;
322 322
323 /* Check parameters. */ 323 /* Check parameters. */
324 bus = args[0]; 324 bus = args[0];
325 method = args[1]; 325 service = args[1];
326 service = args[2]; 326 path = args[2];
327 path = args[3]; 327 interface = args[3];
328 interface = args[4]; 328 method = args[4];
329 329
330 CHECK_SYMBOL (bus); 330 CHECK_SYMBOL (bus);
331 CHECK_STRING (method);
332 CHECK_STRING (service); 331 CHECK_STRING (service);
333 CHECK_STRING (path); 332 CHECK_STRING (path);
334 CHECK_STRING (interface); 333 CHECK_STRING (interface);
335 GCPRO5 (bus, method, service, path, interface); 334 CHECK_STRING (method);
335 GCPRO5 (bus, service, path, interface, method);
336 336
337 XD_DEBUG_MESSAGE ("%s %s %s %s", 337 XD_DEBUG_MESSAGE ("%s %s %s %s",
338 SDATA (method),
339 SDATA (service), 338 SDATA (service),
340 SDATA (path), 339 SDATA (path),
341 SDATA (interface)); 340 SDATA (interface),
341 SDATA (method));
342 342
343 /* Open a connection to the bus. */ 343 /* Open a connection to the bus. */
344 connection = xd_initialize (bus); 344 connection = xd_initialize (bus);
@@ -447,40 +447,41 @@ Other Lisp objects are not supported as arguments of SIGNAL.
447Example: 447Example:
448 448
449\(dbus-send-signal 449\(dbus-send-signal
450 :session "Started" "org.gnu.emacs" "/org/gnu/emacs" "org.gnu.emacs"))) 450 :session "org.gnu.Emacs" "/org/gnu/Emacs"
451 "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")
451 452
452usage: (dbus-send-signal BUS SIGNAL SERVICE PATH INTERFACE &rest ARGS) */) 453usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
453 (nargs, args) 454 (nargs, args)
454 int nargs; 455 int nargs;
455 register Lisp_Object *args; 456 register Lisp_Object *args;
456{ 457{
457 Lisp_Object bus, signal, service, path, interface; 458 Lisp_Object bus, service, path, interface, signal;
458 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 459 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
459 DBusConnection *connection; 460 DBusConnection *connection;
460 DBusMessage *dmessage; 461 DBusMessage *dmessage;
461 uint dtype; 462 unsigned int dtype;
462 int i; 463 int i;
463 char *value; 464 char *value;
464 465
465 /* Check parameters. */ 466 /* Check parameters. */
466 bus = args[0]; 467 bus = args[0];
467 signal = args[1]; 468 service = args[1];
468 service = args[2]; 469 path = args[2];
469 path = args[3]; 470 interface = args[3];
470 interface = args[4]; 471 signal = args[4];
471 472
472 CHECK_SYMBOL (bus); 473 CHECK_SYMBOL (bus);
473 CHECK_STRING (signal);
474 CHECK_STRING (service); 474 CHECK_STRING (service);
475 CHECK_STRING (path); 475 CHECK_STRING (path);
476 CHECK_STRING (interface); 476 CHECK_STRING (interface);
477 GCPRO5 (bus, signal, service, path, interface); 477 CHECK_STRING (signal);
478 GCPRO5 (bus, service, path, interface, signal);
478 479
479 XD_DEBUG_MESSAGE ("%s %s %s %s", 480 XD_DEBUG_MESSAGE ("%s %s %s %s",
480 SDATA (signal),
481 SDATA (service), 481 SDATA (service),
482 SDATA (path), 482 SDATA (path),
483 SDATA (interface)); 483 SDATA (interface),
484 SDATA (signal));
484 485
485 /* Open a connection to the bus. */ 486 /* Open a connection to the bus. */
486 connection = xd_initialize (bus); 487 connection = xd_initialize (bus);
@@ -542,14 +543,17 @@ Lisp_Object
542xd_read_message (bus) 543xd_read_message (bus)
543 Lisp_Object bus; 544 Lisp_Object bus;
544{ 545{
545 Lisp_Object key; 546 Lisp_Object args, key, value;
546 struct gcpro gcpro1; 547 struct gcpro gcpro1;
547 static struct input_event event; 548 static struct input_event event;
548 DBusConnection *connection; 549 DBusConnection *connection;
549 DBusMessage *dmessage; 550 DBusMessage *dmessage;
550 DBusMessageIter iter; 551 DBusMessageIter iter;
551 uint dtype; 552 unsigned int dtype;
552 char service[1024], path[1024], interface[1024], member[1024]; 553 char uname[DBUS_MAXIMUM_NAME_LENGTH];
554 char path[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; /* Unlimited in D-Bus spec. */
555 char interface[DBUS_MAXIMUM_NAME_LENGTH];
556 char member[DBUS_MAXIMUM_NAME_LENGTH];
553 557
554 /* Open a connection to the bus. */ 558 /* Open a connection to the bus. */
555 connection = xd_initialize (bus); 559 connection = xd_initialize (bus);
@@ -562,16 +566,11 @@ xd_read_message (bus)
562 if (dmessage == NULL) 566 if (dmessage == NULL)
563 return; 567 return;
564 568
565 /* There is a message in the queue. Construct the D-Bus event. */
566 XD_DEBUG_MESSAGE ("Event received"); 569 XD_DEBUG_MESSAGE ("Event received");
567 EVENT_INIT (event);
568
569 event.kind = DBUS_EVENT;
570 event.frame_or_window = Qnil;
571 570
572 /* Collect the parameters. */ 571 /* Collect the parameters. */
573 event.arg = Qnil; 572 args = Qnil;
574 GCPRO1 (event.arg); 573 GCPRO1 (args);
575 574
576 if (!dbus_message_iter_init (dmessage, &iter)) 575 if (!dbus_message_iter_init (dmessage, &iter))
577 { 576 {
@@ -583,42 +582,61 @@ xd_read_message (bus)
583 /* Loop over the resulting parameters. Construct a list. */ 582 /* Loop over the resulting parameters. Construct a list. */
584 while ((dtype = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID) 583 while ((dtype = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID)
585 { 584 {
586 event.arg = Fcons (xd_retrieve_arg (dtype, &iter), event.arg); 585 args = Fcons (xd_retrieve_arg (dtype, &iter), args);
587 dbus_message_iter_next (&iter); 586 dbus_message_iter_next (&iter);
588 } 587 }
589 588
590 /* The arguments are stored in reverse order. Reorder them. */ 589 /* The arguments are stored in reverse order. Reorder them. */
591 event.arg = Fnreverse (event.arg); 590 args = Fnreverse (args);
592 591
593 /* Read service, object path interface and member from the 592 /* Read unique name, object path, interface and member from the
594 message. */ 593 message. */
595 strcpy (service, dbus_message_get_sender (dmessage)); 594 strcpy (uname, dbus_message_get_sender (dmessage));
596 strcpy (path, dbus_message_get_path (dmessage)); 595 strcpy (path, dbus_message_get_path (dmessage));
597 strcpy (interface, dbus_message_get_interface (dmessage)); 596 strcpy (interface, dbus_message_get_interface (dmessage));
598 strcpy (member, dbus_message_get_member (dmessage)); 597 strcpy (member, dbus_message_get_member (dmessage));
599 598
600 /* Add them to the event. */ 599 /* Search for a registered function of the message. */
601 event.arg = Fcons ((member == NULL ? Qnil : build_string (member)), 600 key = list3 (bus, build_string (interface), build_string (member));
602 event.arg); 601 value = Fgethash (key, Vdbus_registered_functions_table, Qnil);
603 event.arg = Fcons ((interface == NULL ? Qnil : build_string (interface)), 602
604 event.arg); 603 /* Loop over the registered functions. Construct an event. */
605 event.arg = Fcons ((path == NULL ? Qnil : build_string (path)), 604 while (!NILP (value))
606 event.arg); 605 {
607 event.arg = Fcons ((service == NULL ? Qnil : build_string (service)), 606 key = XCAR (value);
608 event.arg); 607 /* key has the structure (SERVICE UNAME PATH HANDLER). */
609 608 if (((uname == NULL)
610 /* Add the bus symbol to the event. */ 609 || (NILP (XCAR (XCDR (key))))
611 event.arg = Fcons (bus, event.arg); 610 || (strcmp (uname, SDATA (XCAR (XCDR (key)))) == 0))
612 611 && ((path == NULL)
613 /* Add the registered function of the message. */ 612 || (NILP (XCAR (XCDR (XCDR (key)))))
614 key = list3 (bus, 613 || (strcmp (path, SDATA (XCAR (XCDR (XCDR (key))))) == 0))
615 (interface == NULL ? Qnil : build_string (interface)), 614 && (!NILP (XCAR (XCDR (XCDR (XCDR (key)))))))
616 (member == NULL ? Qnil : build_string (member))); 615 {
617 event.arg = Fcons (Fgethash (key, Vdbus_registered_functions_table, Qnil), 616 EVENT_INIT (event);
618 event.arg); 617 event.kind = DBUS_EVENT;
619 618 event.frame_or_window = Qnil;
620 /* Store it into the input event queue. */ 619 event.arg = Fcons (XCAR (XCDR (XCDR (XCDR (key)))), args);
621 kbd_buffer_store_event (&event); 620
621 /* Add uname, path, interface and member to the event. */
622 event.arg = Fcons ((member == NULL ? Qnil : build_string (member)),
623 event.arg);
624 event.arg = Fcons ((interface == NULL
625 ? Qnil : build_string (interface)),
626 event.arg);
627 event.arg = Fcons ((path == NULL ? Qnil : build_string (path)),
628 event.arg);
629 event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),
630 event.arg);
631
632 /* Add the bus symbol to the event. */
633 event.arg = Fcons (bus, event.arg);
634
635 /* Store it into the input event queue. */
636 kbd_buffer_store_event (&event);
637 }
638 value = XCDR (value);
639 }
622 640
623 /* Cleanup. */ 641 /* Cleanup. */
624 dbus_message_unref (dmessage); 642 dbus_message_unref (dmessage);
@@ -666,31 +684,42 @@ SIGNAL and HANDLER must not be nil. Example:
666 (message "Device %s added" device)) 684 (message "Device %s added" device))
667 685
668\(dbus-register-signal 686\(dbus-register-signal
669 :system "DeviceAdded" 687 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
670 (dbus-get-name-owner :system "org.freedesktop.Hal") 688 "org.freedesktop.Hal.Manager" "DeviceAdded" 'my-signal-handler)
671 "/org/freedesktop/Hal/Manager" "org.freedesktop.Hal.Manager"
672 'my-signal-handler)
673 689
674 => (:system "org.freedesktop.Hal.Manager" "DeviceAdded") 690 => (:system ":1.3" "/org/freedesktop/Hal/Manager"
691 "org.freedesktop.Hal.Manager" "DeviceAdded")
675 692
676`dbus-register-signal' returns an object, which can be used in 693`dbus-register-signal' returns an object, which can be used in
677`dbus-unregister-signal' for removing the registration. */) 694`dbus-unregister-signal' for removing the registration. */)
678 (bus, signal, service, path, interface, handler) 695 (bus, service, path, interface, signal, handler)
679 Lisp_Object bus, signal, service, path, interface, handler; 696 Lisp_Object bus, service, path, interface, signal, handler;
680{ 697{
681 Lisp_Object key; 698 Lisp_Object unique_name, key, value;
682 DBusConnection *connection; 699 DBusConnection *connection;
683 char rule[1024]; 700 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
684 DBusError derror; 701 DBusError derror;
685 702
686 /* Check parameters. */ 703 /* Check parameters. */
687 CHECK_SYMBOL (bus); 704 CHECK_SYMBOL (bus);
688 CHECK_STRING (signal);
689 if (!NILP (service)) CHECK_STRING (service); 705 if (!NILP (service)) CHECK_STRING (service);
690 if (!NILP (path)) CHECK_STRING (path); 706 if (!NILP (path)) CHECK_STRING (path);
691 CHECK_STRING (interface); 707 CHECK_STRING (interface);
708 CHECK_STRING (signal);
692 CHECK_SYMBOL (handler); 709 CHECK_SYMBOL (handler);
693 710
711 /* Retrieve unique name of service. If service is a known name, we
712 will register for the corresponding unique name, if any. Signals
713 are sent always with the unique name as sender. Note: the unique
714 name of "org.freedesktop.DBus" is that string itself. */
715 if ((!NILP (service))
716 && (strlen (SDATA (service)) > 0)
717 && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0)
718 && (strncmp (SDATA (service), ":", 1) != 0))
719 unique_name = call2 (intern ("dbus-get-name-owner"), bus, service);
720 else
721 unique_name = service;
722
694 /* Open a connection to the bus. */ 723 /* Open a connection to the bus. */
695 connection = xd_initialize (bus); 724 connection = xd_initialize (bus);
696 725
@@ -700,9 +729,9 @@ SIGNAL and HANDLER must not be nil. Example:
700 SDATA (interface), 729 SDATA (interface),
701 SDATA (signal)); 730 SDATA (signal));
702 731
703 /* Add service and path to the rule if they are non-nil. */ 732 /* Add unique name and path to the rule if they are non-nil. */
704 if (!NILP (service)) 733 if (!NILP (unique_name))
705 sprintf (rule, "%s,sender='%s'%", rule, SDATA (service)); 734 sprintf (rule, "%s,sender='%s'%", rule, SDATA (unique_name));
706 735
707 if (!NILP (path)) 736 if (!NILP (path))
708 sprintf (rule, "%s,path='%s'", rule, SDATA (path)); 737 sprintf (rule, "%s,path='%s'", rule, SDATA (path));
@@ -717,15 +746,21 @@ SIGNAL and HANDLER must not be nil. Example:
717 746
718 /* Create a hash table entry. */ 747 /* Create a hash table entry. */
719 key = list3 (bus, interface, signal); 748 key = list3 (bus, interface, signal);
720 Fputhash (key, handler, Vdbus_registered_functions_table); 749 value = Fgethash (key, Vdbus_registered_functions_table, Qnil);
721 XD_DEBUG_MESSAGE ("\"%s\" registered with handler \"%s\"", 750
722 SDATA (format2 ("%s", key, Qnil)), 751 if (NILP (Fmember (list4 (service, unique_name, path, handler), value)))
723 SDATA (format2 ("%s", handler, Qnil))); 752 Fputhash (key,
753 Fcons (list4 (service, unique_name, path, handler), value),
754 Vdbus_registered_functions_table);
724 755
725 /* Return key. */ 756 /* Return key. */
726 return key; 757 return key;
727} 758}
728 759
760/* The current implementation removes ALL registered functions for a
761 given signal. Shouldn't be a problem in general, but there might
762 be cases it is not desired. Maybe we can refine the
763 implementation. */
729DEFUN ("dbus-unregister-signal", Fdbus_unregister_signal, Sdbus_unregister_signal, 764DEFUN ("dbus-unregister-signal", Fdbus_unregister_signal, Sdbus_unregister_signal,
730 1, 1, 0, 765 1, 1, 0,
731 doc: /* Unregister OBJECT from the D-Bus. 766 doc: /* Unregister OBJECT from the D-Bus.
@@ -734,13 +769,6 @@ OBJECT must be the result of a preceding `dbus-register-signal' call. */)
734 Lisp_Object object; 769 Lisp_Object object;
735{ 770{
736 771
737 /* Check parameters. */
738 CHECK_SYMBOL (object);
739
740 XD_DEBUG_MESSAGE ("\"%s\" unregistered with handler \"%s\"",
741 SDATA (format2 ("%s", object, Qnil)),
742 SDATA (format2 ("%s", Fsymbol_function (object), Qnil)));
743
744 /* Unintern the signal symbol. */ 772 /* Unintern the signal symbol. */
745 Fremhash (object, Vdbus_registered_functions_table); 773 Fremhash (object, Vdbus_registered_functions_table);
746 774
@@ -788,13 +816,19 @@ syms_of_dbusbind ()
788 816
789 DEFVAR_LISP ("dbus-registered-functions-table", &Vdbus_registered_functions_table, 817 DEFVAR_LISP ("dbus-registered-functions-table", &Vdbus_registered_functions_table,
790 doc: /* Hash table of registered functions for D-Bus. 818 doc: /* Hash table of registered functions for D-Bus.
791The key in the hash table is the list (BUS INTERFACE MEMBER). BUS is 819The key in the hash table is the list (BUS MEMBER INTERFACE). BUS is
792either the symbol `:system' or the symbol `:session'. INTERFACE is a 820either the symbol `:system' or the symbol `:session'. INTERFACE is a
793string which denotes a D-Bus interface, and MEMBER, also a string, is 821string which denotes a D-Bus interface, and MEMBER, also a string, is
794either a method or a signal INTERFACE is offering. 822either a method or a signal INTERFACE is offering. All arguments but
795 823BUS must not be nil.
796The value in the hash table a the function to be called when a D-Bus 824
797message, which matches the key criteria, arrives. */); 825The value in the hash table is a list of triple lists
826\((SERVICE UNAME PATH HANDLER) (SERVICE UNAME PATH HANDLER) ...).
827SERVICE is the service name as registered, UNAME is the corresponding
828unique name. PATH is the object path of the sending object. All of
829them be nil, which means a wildcard then. HANDLER is the function to
830be called when a D-Bus message, which matches the key criteria,
831arrives. */);
798 /* We initialize Vdbus_registered_functions_table in dbus.el, 832 /* We initialize Vdbus_registered_functions_table in dbus.el,
799 because we need to define a hash table function first. */ 833 because we need to define a hash table function first. */
800 Vdbus_registered_functions_table = Qnil; 834 Vdbus_registered_functions_table = Qnil;
diff --git a/src/dispextern.h b/src/dispextern.h
index a4021622ba1..b8027593721 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2785,7 +2785,7 @@ int draw_window_fringes P_ ((struct window *, int));
2785int update_window_fringes P_ ((struct window *, int)); 2785int update_window_fringes P_ ((struct window *, int));
2786void compute_fringe_widths P_ ((struct frame *, int)); 2786void compute_fringe_widths P_ ((struct frame *, int));
2787 2787
2788#ifdef WINDOWS_NT 2788#ifdef WINDOWSNT
2789void w32_init_fringe P_ ((struct redisplay_interface *)); 2789void w32_init_fringe P_ ((struct redisplay_interface *));
2790void w32_reset_fringes P_ ((void)); 2790void w32_reset_fringes P_ ((void));
2791#endif 2791#endif
diff --git a/src/keyboard.c b/src/keyboard.c
index 6595b7f800d..2230b339f5e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -108,21 +108,6 @@ int interrupt_input_pending;
108#define KBD_BUFFER_SIZE 4096 108#define KBD_BUFFER_SIZE 4096
109#endif /* No X-windows */ 109#endif /* No X-windows */
110 110
111/* Following definition copied from eval.c */
112
113struct backtrace
114 {
115 struct backtrace *next;
116 Lisp_Object *function;
117 Lisp_Object *args; /* Points to vector of args. */
118 int nargs; /* length of vector. If nargs is UNEVALLED,
119 args points to slot holding list of
120 unevalled args */
121 char evalargs;
122 /* Nonzero means call value of debugger when done with this operation. */
123 char debug_on_exit;
124 };
125
126#ifdef MULTI_KBOARD 111#ifdef MULTI_KBOARD
127KBOARD *initial_kboard; 112KBOARD *initial_kboard;
128KBOARD *current_kboard; 113KBOARD *current_kboard;
@@ -175,8 +160,6 @@ extern int minbuf_level;
175 160
176extern int message_enable_multibyte; 161extern int message_enable_multibyte;
177 162
178extern struct backtrace *backtrace_list;
179
180/* If non-nil, the function that implements the display of help. 163/* If non-nil, the function that implements the display of help.
181 It's called with one argument, the help string to display. */ 164 It's called with one argument, the help string to display. */
182 165
@@ -1565,7 +1548,6 @@ command_loop_1 ()
1565 int nonundocount; 1548 int nonundocount;
1566 Lisp_Object keybuf[30]; 1549 Lisp_Object keybuf[30];
1567 int i; 1550 int i;
1568 int no_direct;
1569 int prev_modiff = 0; 1551 int prev_modiff = 0;
1570 struct buffer *prev_buffer = NULL; 1552 struct buffer *prev_buffer = NULL;
1571#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1553#if 0 /* This shouldn't be necessary anymore. --lorentey */
@@ -1625,8 +1607,6 @@ command_loop_1 ()
1625 while (pending_malloc_warning) 1607 while (pending_malloc_warning)
1626 display_malloc_warning (); 1608 display_malloc_warning ();
1627 1609
1628 no_direct = 0;
1629
1630 Vdeactivate_mark = Qnil; 1610 Vdeactivate_mark = Qnil;
1631 1611
1632 /* If minibuffer on and echo area in use, 1612 /* If minibuffer on and echo area in use,
@@ -1787,7 +1767,7 @@ command_loop_1 ()
1787 } 1767 }
1788 else 1768 else
1789 { 1769 {
1790 if (NILP (current_kboard->Vprefix_arg) && ! no_direct) 1770 if (NILP (current_kboard->Vprefix_arg))
1791 { 1771 {
1792 /* In case we jump to directly_done. */ 1772 /* In case we jump to directly_done. */
1793 Vcurrent_prefix_arg = current_kboard->Vprefix_arg; 1773 Vcurrent_prefix_arg = current_kboard->Vprefix_arg;
@@ -5558,41 +5538,32 @@ make_lispy_event (event)
5558 { 5538 {
5559 /* A simple keystroke. */ 5539 /* A simple keystroke. */
5560 case ASCII_KEYSTROKE_EVENT: 5540 case ASCII_KEYSTROKE_EVENT:
5561 {
5562 Lisp_Object lispy_c;
5563 int c = event->code & 0377;
5564 /* Turn ASCII characters into control characters
5565 when proper. */
5566 if (event->modifiers & ctrl_modifier)
5567 c = make_ctrl_char (c);
5568
5569 /* Add in the other modifier bits. We took care of ctrl_modifier
5570 just above, and the shift key was taken care of by the X code,
5571 and applied to control characters by make_ctrl_char. */
5572 c |= (event->modifiers
5573 & (meta_modifier | alt_modifier
5574 | hyper_modifier | super_modifier));
5575 /* Distinguish Shift-SPC from SPC. */
5576 if ((event->code & 0377) == 040
5577 && event->modifiers & shift_modifier)
5578 c |= shift_modifier;
5579 button_down_time = 0;
5580 XSETFASTINT (lispy_c, c);
5581 return lispy_c;
5582 }
5583
5584 case MULTIBYTE_CHAR_KEYSTROKE_EVENT: 5541 case MULTIBYTE_CHAR_KEYSTROKE_EVENT:
5585 { 5542 {
5586 Lisp_Object lispy_c; 5543 Lisp_Object lispy_c;
5587 int c = event->code; 5544 int c = event->code;
5545 if (event->kind == ASCII_KEYSTROKE_EVENT)
5546 {
5547 c &= 0377;
5548 eassert (c == event->code);
5549 /* Turn ASCII characters into control characters
5550 when proper. */
5551 if (event->modifiers & ctrl_modifier)
5552 {
5553 c = make_ctrl_char (c);
5554 event->modifiers &= ~ctrl_modifier;
5555 }
5556 }
5588 5557
5589 /* Add in the other modifier bits. We took care of ctrl_modifier 5558 /* Add in the other modifier bits. The shift key was taken care
5590 just above, and the shift key was taken care of by the X code, 5559 of by the X code. */
5591 and applied to control characters by make_ctrl_char. */
5592 c |= (event->modifiers 5560 c |= (event->modifiers
5593 & (meta_modifier | alt_modifier 5561 & (meta_modifier | alt_modifier
5594 | hyper_modifier | super_modifier | ctrl_modifier)); 5562 | hyper_modifier | super_modifier | ctrl_modifier));
5595 /* What about the `shift' modifier ? */ 5563 /* Distinguish Shift-SPC from SPC. */
5564 if ((event->code) == 040
5565 && event->modifiers & shift_modifier)
5566 c |= shift_modifier;
5596 button_down_time = 0; 5567 button_down_time = 0;
5597 XSETFASTINT (lispy_c, c); 5568 XSETFASTINT (lispy_c, c);
5598 return lispy_c; 5569 return lispy_c;
@@ -9619,7 +9590,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9619 } 9590 }
9620 9591
9621 GROW_RAW_KEYBUF; 9592 GROW_RAW_KEYBUF;
9622 XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; 9593 ASET (raw_keybuf, raw_keybuf_count++, key);
9623 } 9594 }
9624 9595
9625 /* Clicks in non-text areas get prefixed by the symbol 9596 /* Clicks in non-text areas get prefixed by the symbol
@@ -10401,7 +10372,6 @@ a special event, so ignore the prefix argument and don't clear it. */)
10401 register Lisp_Object final; 10372 register Lisp_Object final;
10402 register Lisp_Object tem; 10373 register Lisp_Object tem;
10403 Lisp_Object prefixarg; 10374 Lisp_Object prefixarg;
10404 struct backtrace backtrace;
10405 extern int debug_on_next_call; 10375 extern int debug_on_next_call;
10406 10376
10407 debug_on_next_call = 0; 10377 debug_on_next_call = 0;
@@ -10467,20 +10437,11 @@ a special event, so ignore the prefix argument and don't clear it. */)
10467 } 10437 }
10468 10438
10469 if (CONSP (final) || SUBRP (final) || COMPILEDP (final)) 10439 if (CONSP (final) || SUBRP (final) || COMPILEDP (final))
10470 { 10440 /* Don't call Fcall_interactively directly because we want to make
10471 backtrace.next = backtrace_list; 10441 sure the backtrace has an entry for `call-interactively'.
10472 backtrace_list = &backtrace; 10442 For the same reason, pass `cmd' rather than `final'. */
10473 backtrace.function = &Qcall_interactively; 10443 return call3 (Qcall_interactively, cmd, record_flag, keys);
10474 backtrace.args = &cmd;
10475 backtrace.nargs = 1;
10476 backtrace.evalargs = 0;
10477 backtrace.debug_on_exit = 0;
10478
10479 tem = Fcall_interactively (cmd, record_flag, keys);
10480 10444
10481 backtrace_list = backtrace.next;
10482 return tem;
10483 }
10484 return Qnil; 10445 return Qnil;
10485} 10446}
10486 10447
@@ -10591,7 +10552,7 @@ give to the command you invoke, if it asks for an argument. */)
10591 bindings = Qnil; 10552 bindings = Qnil;
10592 10553
10593 value = Qnil; 10554 value = Qnil;
10594 GCPRO2 (bindings, value); 10555 GCPRO3 (bindings, value, function);
10595 value = Fcommand_execute (function, Qt, Qnil, Qnil); 10556 value = Fcommand_execute (function, Qt, Qnil, Qnil);
10596 10557
10597 /* If the command has a key binding, print it now. */ 10558 /* If the command has a key binding, print it now. */
diff --git a/src/w32fns.c b/src/w32fns.c
index 441ad0f60dc..8ddf8d0f74d 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2971,7 +2971,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
2971 they don't produce WM_CHAR messages). This ensures that 2971 they don't produce WM_CHAR messages). This ensures that
2972 indicator lights are toggled promptly on Windows 9x, for 2972 indicator lights are toggled promptly on Windows 9x, for
2973 example. */ 2973 example. */
2974 if (lispy_function_keys[wParam] != 0) 2974 if (wParam < 256 && lispy_function_keys[wParam])
2975 { 2975 {
2976 windows_translate = 1; 2976 windows_translate = 1;
2977 goto translate; 2977 goto translate;
@@ -3093,7 +3093,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3093 break; 3093 break;
3094 default: 3094 default:
3095 /* If not defined as a function key, change it to a WM_CHAR message. */ 3095 /* If not defined as a function key, change it to a WM_CHAR message. */
3096 if (lispy_function_keys[wParam] == 0) 3096 if (wParam > 255 || !lispy_function_keys[wParam])
3097 { 3097 {
3098 DWORD modifiers = construct_console_modifiers (); 3098 DWORD modifiers = construct_console_modifiers ();
3099 3099
@@ -8366,7 +8366,7 @@ lookup_vk_code (char *key)
8366 int i; 8366 int i;
8367 8367
8368 for (i = 0; i < 256; i++) 8368 for (i = 0; i < 256; i++)
8369 if (lispy_function_keys[i] != 0 8369 if (lispy_function_keys[i]
8370 && strcmp (lispy_function_keys[i], key) == 0) 8370 && strcmp (lispy_function_keys[i], key) == 0)
8371 return i; 8371 return i;
8372 8372
@@ -8544,7 +8544,7 @@ usage: (w32-reconstruct-hot-key ID) */)
8544 vk_code = HOTKEY_VK_CODE (hotkeyid); 8544 vk_code = HOTKEY_VK_CODE (hotkeyid);
8545 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); 8545 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
8546 8546
8547 if (lispy_function_keys[vk_code]) 8547 if (vk_code < 256 && lispy_function_keys[vk_code])
8548 key = intern (lispy_function_keys[vk_code]); 8548 key = intern (lispy_function_keys[vk_code]);
8549 else 8549 else
8550 key = make_number (vk_code); 8550 key = make_number (vk_code);
diff --git a/src/w32term.c b/src/w32term.c
index 75714a4a118..b489657361c 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4625,6 +4625,8 @@ x_scroll_bar_clear (f)
4625static int temp_index; 4625static int temp_index;
4626static short temp_buffer[100]; 4626static short temp_buffer[100];
4627 4627
4628/* Temporarily store lead byte of DBCS input sequences. */
4629static char dbcs_lead = 0;
4628 4630
4629/* Read events coming from the W32 shell. 4631/* Read events coming from the W32 shell.
4630 This routine is called by the SIGIO handler. 4632 This routine is called by the SIGIO handler.