aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2010-07-12 11:28:50 +0900
committerKenichi Handa2010-07-12 11:28:50 +0900
commit2300368463c9719839a0289cd6dccaa93d3274cf (patch)
treed3e5e3b91444fb135bdedf40d0b4f597d47b40de /src
parent892dd5657e548f66bbcfb07a9556cc5fc9f17b8d (diff)
parentf479ef6e6f5c77ba0f1f6b60c1146f324d604e92 (diff)
downloademacs-2300368463c9719839a0289cd6dccaa93d3274cf.tar.gz
emacs-2300368463c9719839a0289cd6dccaa93d3274cf.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog198
-rw-r--r--src/alloc.c10
-rw-r--r--src/blockinput.h1
-rw-r--r--src/buffer.h2
-rw-r--r--src/callint.c12
-rw-r--r--src/callproc.c28
-rw-r--r--src/config.in20
-rw-r--r--src/dbusbind.c46
-rw-r--r--src/dispextern.h8
-rw-r--r--src/doc.c10
-rw-r--r--src/doprnt.c47
-rw-r--r--src/editfns.c14
-rw-r--r--src/emacs.c31
-rw-r--r--src/eval.c98
-rw-r--r--src/fileio.c4
-rw-r--r--src/filelock.c7
-rw-r--r--src/fns.c10
-rw-r--r--src/font.c6
-rw-r--r--src/fontset.c4
-rw-r--r--src/frame.c18
-rw-r--r--src/fringe.c281
-rw-r--r--src/image.c4
-rw-r--r--src/insdel.c2
-rw-r--r--src/keyboard.c52
-rw-r--r--src/keyboard.h1
-rw-r--r--src/keymap.c10
-rw-r--r--src/lisp.h59
-rw-r--r--src/lread.c50
-rw-r--r--src/msdos.c31
-rw-r--r--src/nsterm.m15
-rw-r--r--src/print.c7
-rw-r--r--src/process.c957
-rw-r--r--src/s/hpux10-20.h4
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/s/usg5-4.h8
-rw-r--r--src/sysdep.c8
-rw-r--r--src/vm-limit.c4
-rw-r--r--src/w32fns.c10
-rw-r--r--src/w32term.c17
-rw-r--r--src/xdisp.c36
-rw-r--r--src/xfaces.c15
-rw-r--r--src/xfns.c10
-rw-r--r--src/xmenu.c13
-rw-r--r--src/xterm.c17
44 files changed, 1130 insertions, 1057 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1cd57516c45..5acf42608e4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -11,6 +11,130 @@
11 return value changed. 11 return value changed.
12 (syms_of_font): Adjusted for the above change. 12 (syms_of_font): Adjusted for the above change.
13 13
142010-07-11 Andreas Schwab <schwab@linux-m68k.org>
15
16 * blockinput.h: Remove obsolete comment.
17
18 * lisp.h: Include <stddef.h>.
19 (OFFSETOF): Don't define.
20 (VECSIZE): Use offsetof instead of OFFSETOF.
21 (PSEUDOVECSIZE): Likewise.
22 * process.c (conv_sockaddr_to_lisp): Likewise.
23 * alloc.c: Don't include <stddef.h>.
24 * buffer.h (PER_BUFFER_VAR_OFFSET): Use offsetof.
25
26 * process.c: Remove obsolete comment.
27
282010-07-11 Chong Yidong <cyd@stupidchicken.com>
29
30 * xfaces.c (Vface_remapping_alist): Doc fix (Bug#6091).
31
322010-07-11 Andreas Schwab <schwab@linux-m68k.org>
33
34 * callint.c (Fcall_interactively): Use strchr, strrchr instead of
35 index, rindex.
36 * doc.c (get_doc_string, Fsnarf_documentation): Likewise.
37 * editfns.c (Fuser_full_name, Fformat): Likewise.
38 * emacs.c (argmatch, sort_args, decode_env_path): Likewise.
39 * fileio.c (Ffile_symlink_p): Likewise.
40 * filelock.c (current_lock_owner): Likewise.
41 * font.c (font_parse_name, font_parse_family_registry): Likewise.
42 * fontset.c (fontset_pattern_regexp): Likewise.
43 * lread.c (read1): Likewise.
44 * sysdep.c (init_system_name): Likewise.
45 * xfns.c (select_visual): Likewise.
46 * s/hpux10-20.h (index, rindex): Don't define.
47 * s/ms-w32.h (index): Likewise.
48 * s/usg5-4.h: Likewise.
49
50 * callproc.c (relocate_fd): Use F_DUPFD if defined.
51
52 * alloc.c (pending_malloc_warning, malloc_warning): Add const.
53 * callproc.c (relocate_fd, getenv_internal_1, getenv_internal)
54 (egetenv): Likewise.
55 * doprnt.c (doprnt): Likewise.
56 * editfns.c (set_time_zone_rule, format2): Likewise.
57 * emacs.c (decode_env_path): Likewise.
58 * eval.c (signal_error, error): Likewise.
59 * insdel.c (replace_range_2): Likewise.
60 * keyboard.c (cmd_error_internal): Likewise.
61 * lread.c (isfloat_string, make_symbol, dir_warning): Likewise.
62 * print.c (write_string, write_string_1, print_error_message):
63 Likewise.
64 * vm-limit.c (warn_function, memory_warnings): Likewise.
65 * xdisp.c (message1, message1_nolog, message_with_string)
66 (vmessage, message, message_nolog): Likewise.
67 * emacs.c: Remove duplicate declaration.
68 * keyboard.h: Likewise.
69 * lisp.h: Update prototypes.
70
71 * eval.c: Fix indentation problem.
72
73 * keyboard.c: Include "process.h"
74
75 * eval.c: Remove obsolete noinline declaration.
76 * fns.c: Likewise.
77
782010-07-11 Ken Raeburn <raeburn@raeburn.org>
79
80 * doprnt.c (doprnt): Take a va_list argument instead of count and
81 pointer.
82 * eval.c (error): Change to a standard-C variadic function.
83 * xdisp.c (vmessage): Renamed from message, made static, and
84 changed to take a va_list argument.
85 (message): New variadic wrapper.
86 (message_nolog): Now a variadic function, calling vmessage.
87 * lisp.h: Include stdarg.h for va_list.
88 (doprnt, error, message, message_nolog): Decls updated.
89
902010-07-11 Eli Zaretskii <eliz@gnu.org>
91
92 * process.c (syms_of_process) <delete-exited-processes>: Define
93 even if !subprocesses.
94 (delete_exited_processes): Ditto.
95
96 * msdos.c (syms_of_msdos) <delete-exited-processes>: Remove DEFVAR.
97 (delete_exited_processes): Don't define.
98
992010-07-10 Chong Yidong <cyd@stupidchicken.com>
100
101 * frame.c (make_frame): Initialize menu_bar_lines and
102 tool_bar_lines members.
103 (make_initial_frame, make_terminal_frame): Initialize
104 menu_bar_lines using value of menu-bar-mode.
105
106 * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines.
107
1082010-07-10 Eli Zaretskii <eliz@gnu.org>
109
110 * process.c: Reshuffle #include's. Condition some of the global
111 and static variables on `subprocesses'.
112 (hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p):
113 Leave only one implementation.
114 (Fget_buffer_process, Fprocess_inherit_coding_system_flag)
115 (kill_buffer_processes, Flist_system_processes)
116 (Fprocess_attributes, init_process, syms_of_process): Unify the
117 implementations for with subprocesses and without them.
118
1192010-07-09 Jan Djärv <jan.h.d@swipnet.se>
120
121 * xmenu.c (set_frame_menubar): Must realize menubar_widget to get the
122 correct size for Motif.
123 (free_frame_menubar): Call x_set_window_size to update frame size.
124
125 * xfns.c (x_window): Set borderWidth to 0 for pane and
126 EmacsFrame. Frame size calculation is wrong otherwise.
127
1282010-07-09 Michael Albinus <michael.albinus@gmx.de>
129
130 * dbusbind.c (xd_initialize): Add new argument RAISE_ERROR, which
131 allows to suppress errors when polling in Emacs' main loop.
132 (Fdbus_init_bus, Fdbus_get_unique_name, Fdbus_call_method)
133 (Fdbus_call_method_asynchronously, Fdbus_method_return_internal)
134 (Fdbus_method_error_internal, Fdbus_send_signal)
135 (xd_get_dispatch_status, xd_read_message, Fdbus_register_signal)
136 (Fdbus_register_method): Use it. (Bug#6579)
137
142010-07-08 Dan Nicolaescu <dann@ics.uci.edu> 1382010-07-08 Dan Nicolaescu <dann@ics.uci.edu>
15 139
16 * alloc.c: Convert DEFUNs to standard C. 140 * alloc.c: Convert DEFUNs to standard C.
@@ -785,7 +909,55 @@
785 Improve documentation. Return font regardless of use_system_font. 909 Improve documentation. Return font regardless of use_system_font.
786 (syms_of_xsettings): Improve documentation for font-use-system-font. 910 (syms_of_xsettings): Improve documentation for font-use-system-font.
787 911
7882009-06-17 Naohiro Aota <naota@elisp.net> (tiny change) 9122010-07-10 Chong Yidong <cyd@stupidchicken.com>
913
914 * xfaces.c (realize_face): Garbage the frame if a face is removed
915 (Bug#6593).
916
9172010-07-05 Andreas Schwab <schwab@linux-m68k.org>
918
919 * keyboard.c: Remove duplicate <setjmp.h>.
920 (read_key_sequence): Remove volatile qualifiers.
921
9222010-07-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
923
924 * dispextern.h (FRINGE_HEIGHT_BITS): New define.
925 (struct glyph_row): New members left_fringe_offset and
926 right_fringe_offset.
927
928 * xterm.c (x_draw_fringe_bitmap): Don't clip bottom aligned bitmap
929 specially.
930 * w32term.c (w32_draw_fringe_bitmap): Likewise.
931 * nsterm.m (ns_draw_fringe_bitmap): Likewise.
932
933 * fringe.c (draw_fringe_bitmap_1): Don't clip bitmap here.
934 Take account of bitmap offset.
935 (draw_window_fringes): Take account of window vscroll.
936 (update_window_fringes): Likewise. Extend top-aligned top indicator
937 or bottom-aligned bottom indicator to adjacent rows if it doesn't fit
938 in one row. Don't set redraw_fringe_bitmaps_p outside row comparison.
939 Set left_fringe_offset and right_fringe_offset (Bug#5634, Bug#6325).
940
9412010-07-04 Juanma Barranquero <lekktu@gmail.com>
942
943 * w32fns.c (Qtooltip): Declare.
944 Suggested by Andy Moreton <andrewjmoreton@gmail.com>.
945
9462010-07-03 Jan Djärv <jan.h.d@swipnet.se>
947
948 * xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid
949 grab on just Press (Bug#6499).
950
9512010-07-02 Chong Yidong <cyd@stupidchicken.com>
952
953 * frame.c (Qtooltip): New var.
954 (delete_frame): Use it. Fix faulty if statement. Don't update
955 mode line for tooltip frames. Suggested by Martin Rudalics.
956
957 * xfns.c (x_create_tip_frame):
958 * w32fns.c (x_create_tip_frame): Use it.
959
9602010-06-17 Naohiro Aota <naota@elisp.net> (tiny change)
789 961
790 * xftfont.c (xftfont_open): Check font width one by one also when 962 * xftfont.c (xftfont_open): Check font width one by one also when
791 spacing is dual. 963 spacing is dual.
@@ -964,6 +1136,30 @@
964 1136
965 * m/ibms390x.h: Rather than duplicating ibms390.h, just include it. 1137 * m/ibms390x.h: Rather than duplicating ibms390.h, just include it.
966 1138
11392010-06-26 Andreas Schwab <schwab@linux-m68k.org>
1140
1141 * alloc.c (Fmake_byte_code): Don't access undefined argument
1142 (Bug#6517).
1143
11442010-06-25 Chong Yidong <cyd@stupidchicken.com>
1145
1146 * xdisp.c (next_element_from_image): Ensure that after-strings are
1147 read the next time we hit handle_stop (Bug#1336).
1148
11492010-06-23 Andreas Schwab <schwab@linux-m68k.org>
1150
1151 * lread.c (read1): Signal error if #s is not followed by paren.
1152
11532010-06-19 Chong Yidong <cyd@stupidchicken.com>
1154
1155 * image.c (free_image): Mark frame as garbaged (Bug#6426).
1156
1157 * keymap.c (Fdefine_key): Doc fix (Bug#6460).
1158
11592010-06-15 Glenn Morris <rgm@gnu.org>
1160
1161 * editfns.c (Fbyte_to_string): Pacify compiler.
1162
9672010-06-09 Stefan Monnier <monnier@iro.umontreal.ca> 11632010-06-09 Stefan Monnier <monnier@iro.umontreal.ca>
968 1164
969 * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string. 1165 * dbusbind.c (xd_append_arg): Don't "make-unibyte" the string.
diff --git a/src/alloc.c b/src/alloc.c
index 2a15fd0d63d..5c860bc1f8e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -23,10 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <limits.h> /* For CHAR_BIT. */ 23#include <limits.h> /* For CHAR_BIT. */
24#include <setjmp.h> 24#include <setjmp.h>
25 25
26#ifdef STDC_HEADERS
27#include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */
28#endif
29
30#ifdef ALLOC_DEBUG 26#ifdef ALLOC_DEBUG
31#undef INLINE 27#undef INLINE
32#endif 28#endif
@@ -298,7 +294,7 @@ static EMACS_INT pure_bytes_used_non_lisp;
298/* If nonzero, this is a warning delivered by malloc and not yet 294/* If nonzero, this is a warning delivered by malloc and not yet
299 displayed. */ 295 displayed. */
300 296
301char *pending_malloc_warning; 297const char *pending_malloc_warning;
302 298
303/* Pre-computed signal argument for use when memory is exhausted. */ 299/* Pre-computed signal argument for use when memory is exhausted. */
304 300
@@ -514,7 +510,7 @@ static POINTER_TYPE *pure_alloc (size_t, int);
514/* Function malloc calls this if it finds we are near exhausting storage. */ 510/* Function malloc calls this if it finds we are near exhausting storage. */
515 511
516void 512void
517malloc_warning (char *str) 513malloc_warning (const char *str)
518{ 514{
519 pending_malloc_warning = str; 515 pending_malloc_warning = str;
520} 516}
@@ -3030,7 +3026,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3030 else 3026 else
3031 val = Fmake_vector (len, Qnil); 3027 val = Fmake_vector (len, Qnil);
3032 3028
3033 if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) 3029 if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1]))
3034 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the 3030 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
3035 earlier because they produced a raw 8-bit string for byte-code 3031 earlier because they produced a raw 8-bit string for byte-code
3036 and now such a byte-code string is loaded as multibyte while 3032 and now such a byte-code string is loaded as multibyte while
diff --git a/src/blockinput.h b/src/blockinput.h
index 99c8274fc60..7ba6fc264fd 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -122,7 +122,6 @@ extern int pending_atimers;
122#define INPUT_BLOCKED_P (interrupt_input_blocked > 0) 122#define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
123 123
124/* Defined in keyboard.c */ 124/* Defined in keyboard.c */
125/* Don't use a prototype here; it causes trouble in some files. */
126extern void reinvoke_input_signal (void); 125extern void reinvoke_input_signal (void);
127 126
128#endif /* EMACS_BLOCKINPUT_H */ 127#endif /* EMACS_BLOCKINPUT_H */
diff --git a/src/buffer.h b/src/buffer.h
index 8e4e5d569ae..339e7d9bb6d 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -954,7 +954,7 @@ extern int last_per_buffer_idx;
954 from the start of a buffer structure. */ 954 from the start of a buffer structure. */
955 955
956#define PER_BUFFER_VAR_OFFSET(VAR) \ 956#define PER_BUFFER_VAR_OFFSET(VAR) \
957 ((char *) &((struct buffer *)0)->VAR - (char *) ((struct buffer *)0)) 957 offsetof (struct buffer, VAR)
958 958
959/* Return the index of buffer-local variable VAR. Each per-buffer 959/* Return the index of buffer-local variable VAR. Each per-buffer
960 variable has an index > 0 associated with it, except when it always 960 variable has an index > 0 associated with it, except when it always
diff --git a/src/callint.c b/src/callint.c
index 3d4782e7bd6..fa0be112bea 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -29,10 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "window.h" 29#include "window.h"
30#include "keymap.h" 30#include "keymap.h"
31 31
32#ifdef HAVE_INDEX
33extern char *index (const char *, int);
34#endif
35
36extern Lisp_Object Qcursor_in_echo_area; 32extern Lisp_Object Qcursor_in_echo_area;
37extern Lisp_Object Qfile_directory_p; 33extern Lisp_Object Qfile_directory_p;
38extern Lisp_Object Qonly; 34extern Lisp_Object Qonly;
@@ -469,7 +465,7 @@ invoke it. If KEYS is omitted or nil, the return value of
469 j += 2; 465 j += 2;
470 else 466 else
471 j++; 467 j++;
472 tem = (unsigned char *) index (tem, '\n'); 468 tem = (unsigned char *) strchr (tem, '\n');
473 if (tem) 469 if (tem)
474 ++tem; 470 ++tem;
475 else 471 else
@@ -500,11 +496,11 @@ invoke it. If KEYS is omitted or nil, the return value of
500 { 496 {
501 strncpy (prompt1, tem + 1, sizeof prompt1 - 1); 497 strncpy (prompt1, tem + 1, sizeof prompt1 - 1);
502 prompt1[sizeof prompt1 - 1] = 0; 498 prompt1[sizeof prompt1 - 1] = 0;
503 tem1 = (char *) index (prompt1, '\n'); 499 tem1 = strchr (prompt1, '\n');
504 if (tem1) *tem1 = 0; 500 if (tem1) *tem1 = 0;
505 501
506 visargs[0] = build_string (prompt1); 502 visargs[0] = build_string (prompt1);
507 if (index (prompt1, '%')) 503 if (strchr (prompt1, '%'))
508 callint_message = Fformat (i, visargs); 504 callint_message = Fformat (i, visargs);
509 else 505 else
510 callint_message = visargs[0]; 506 callint_message = visargs[0];
@@ -809,7 +805,7 @@ invoke it. If KEYS is omitted or nil, the return value of
809 if (NILP (visargs[i]) && STRINGP (args[i])) 805 if (NILP (visargs[i]) && STRINGP (args[i]))
810 visargs[i] = args[i]; 806 visargs[i] = args[i];
811 807
812 tem = (unsigned char *) index (tem, '\n'); 808 tem = (unsigned char *) strchr (tem, '\n');
813 if (tem) tem++; 809 if (tem) tem++;
814 else tem = (unsigned char *) ""; 810 else tem = (unsigned char *) "";
815 } 811 }
diff --git a/src/callproc.c b/src/callproc.c
index 674243f50de..4ad6bcf41ea 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1288,27 +1288,34 @@ relocate_fd (int fd, int minfd)
1288 return fd; 1288 return fd;
1289 else 1289 else
1290 { 1290 {
1291 int new = dup (fd); 1291 int new;
1292#ifdef F_DUPFD
1293 new = fcntl (fd, F_DUPFD, minfd);
1294#else
1295 new = dup (fd);
1296 if (new != -1)
1297 /* Note that we hold the original FD open while we recurse,
1298 to guarantee we'll get a new FD if we need it. */
1299 new = relocate_fd (new, minfd);
1300#endif
1292 if (new == -1) 1301 if (new == -1)
1293 { 1302 {
1294 char *message1 = "Error while setting up child: "; 1303 const char *message1 = "Error while setting up child: ";
1295 char *errmessage = strerror (errno); 1304 const char *errmessage = strerror (errno);
1296 char *message2 = "\n"; 1305 const char *message2 = "\n";
1297 emacs_write (2, message1, strlen (message1)); 1306 emacs_write (2, message1, strlen (message1));
1298 emacs_write (2, errmessage, strlen (errmessage)); 1307 emacs_write (2, errmessage, strlen (errmessage));
1299 emacs_write (2, message2, strlen (message2)); 1308 emacs_write (2, message2, strlen (message2));
1300 _exit (1); 1309 _exit (1);
1301 } 1310 }
1302 /* Note that we hold the original FD open while we recurse,
1303 to guarantee we'll get a new FD if we need it. */
1304 new = relocate_fd (new, minfd);
1305 emacs_close (fd); 1311 emacs_close (fd);
1306 return new; 1312 return new;
1307 } 1313 }
1308} 1314}
1309 1315
1310static int 1316static int
1311getenv_internal_1 (char *var, int varlen, char **value, int *valuelen, Lisp_Object env) 1317getenv_internal_1 (const char *var, int varlen, char **value, int *valuelen,
1318 Lisp_Object env)
1312{ 1319{
1313 for (; CONSP (env); env = XCDR (env)) 1320 for (; CONSP (env); env = XCDR (env))
1314 { 1321 {
@@ -1342,7 +1349,8 @@ getenv_internal_1 (char *var, int varlen, char **value, int *valuelen, Lisp_Obje
1342} 1349}
1343 1350
1344static int 1351static int
1345getenv_internal (char *var, int varlen, char **value, int *valuelen, Lisp_Object frame) 1352getenv_internal (const char *var, int varlen, char **value, int *valuelen,
1353 Lisp_Object frame)
1346{ 1354{
1347 /* Try to find VAR in Vprocess_environment first. */ 1355 /* Try to find VAR in Vprocess_environment first. */
1348 if (getenv_internal_1 (var, varlen, value, valuelen, 1356 if (getenv_internal_1 (var, varlen, value, valuelen,
@@ -1403,7 +1411,7 @@ If optional parameter ENV is a list, then search this list instead of
1403/* A version of getenv that consults the Lisp environment lists, 1411/* A version of getenv that consults the Lisp environment lists,
1404 easily callable from C. */ 1412 easily callable from C. */
1405char * 1413char *
1406egetenv (char *var) 1414egetenv (const char *var)
1407{ 1415{
1408 char *value; 1416 char *value;
1409 int valuelen; 1417 int valuelen;
diff --git a/src/config.in b/src/config.in
index 1ef407c158b..40b62633446 100644
--- a/src/config.in
+++ b/src/config.in
@@ -288,9 +288,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
288/* Define to 1 if netdb.h declares h_errno. */ 288/* Define to 1 if netdb.h declares h_errno. */
289#undef HAVE_H_ERRNO 289#undef HAVE_H_ERRNO
290 290
291/* Define to 1 if you have the `index' function. */
292#undef HAVE_INDEX
293
294/* Define to 1 if you have inet sockets. */ 291/* Define to 1 if you have inet sockets. */
295#undef HAVE_INET_SOCKETS 292#undef HAVE_INET_SOCKETS
296 293
@@ -537,9 +534,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
537/* Define to 1 if res_init is available. */ 534/* Define to 1 if res_init is available. */
538#undef HAVE_RES_INIT 535#undef HAVE_RES_INIT
539 536
540/* Define to 1 if you have the `rindex' function. */
541#undef HAVE_RINDEX
542
543/* Define to 1 if you have the `rint' function. */ 537/* Define to 1 if you have the `rint' function. */
544#undef HAVE_RINT 538#undef HAVE_RINT
545 539
@@ -597,6 +591,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
597/* Define to 1 if you have the <stdlib.h> header file. */ 591/* Define to 1 if you have the <stdlib.h> header file. */
598#undef HAVE_STDLIB_H 592#undef HAVE_STDLIB_H
599 593
594/* Define to 1 if you have the `strchr' function. */
595#undef HAVE_STRCHR
596
600/* Define to 1 if you have the `strerror' function. */ 597/* Define to 1 if you have the `strerror' function. */
601#undef HAVE_STRERROR 598#undef HAVE_STRERROR
602 599
@@ -609,6 +606,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
609/* Define to 1 if you have the <string.h> header file. */ 606/* Define to 1 if you have the <string.h> header file. */
610#undef HAVE_STRING_H 607#undef HAVE_STRING_H
611 608
609/* Define to 1 if you have the `strrchr' function. */
610#undef HAVE_STRRCHR
611
612/* Define to 1 if you have the `strsignal' function. */ 612/* Define to 1 if you have the `strsignal' function. */
613#undef HAVE_STRSIGNAL 613#undef HAVE_STRSIGNAL
614 614
@@ -1154,6 +1154,14 @@ void *alloca (size_t);
1154typedef unsigned size_t; 1154typedef unsigned size_t;
1155#endif 1155#endif
1156 1156
1157#ifndef HAVE_STRCHR
1158#define strchr(a, b) index (a, b)
1159#endif
1160
1161#ifndef HAVE_STRRCHR
1162#define strrchr(a, b) rindex (a, b)
1163#endif
1164
1157#if defined __GNUC__ && (__GNUC__ > 2 \ 1165#if defined __GNUC__ && (__GNUC__ > 2 \
1158 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) 1166 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
1159#define NO_RETURN __attribute__ ((__noreturn__)) 1167#define NO_RETURN __attribute__ ((__noreturn__))
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 005b04950b9..c5dbb62aed9 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -714,9 +714,11 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
714} 714}
715 715
716/* Initialize D-Bus connection. BUS is a Lisp symbol, either :system 716/* Initialize D-Bus connection. BUS is a Lisp symbol, either :system
717 or :session. It tells which D-Bus to be initialized. */ 717 or :session. It tells which D-Bus to be initialized. RAISE_ERROR
718 can be TRUE or FALSE, it controls whether an error is signalled in
719 case the connection cannot be initialized. */
718static DBusConnection * 720static DBusConnection *
719xd_initialize (Lisp_Object bus) 721xd_initialize (Lisp_Object bus, int raise_error)
720{ 722{
721 DBusConnection *connection; 723 DBusConnection *connection;
722 DBusError derror; 724 DBusError derror;
@@ -724,12 +726,18 @@ xd_initialize (Lisp_Object bus)
724 /* Parameter check. */ 726 /* Parameter check. */
725 CHECK_SYMBOL (bus); 727 CHECK_SYMBOL (bus);
726 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) 728 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
727 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); 729 if (raise_error == TRUE)
730 XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
731 else
732 return NULL;
728 733
729 /* We do not want to have an autolaunch for the session bus. */ 734 /* We do not want to have an autolaunch for the session bus. */
730 if (EQ (bus, QCdbus_session_bus) 735 if (EQ (bus, QCdbus_session_bus)
731 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) 736 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
732 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 737 if (raise_error == TRUE)
738 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
739 else
740 return NULL;
733 741
734 /* Open a connection to the bus. */ 742 /* Open a connection to the bus. */
735 dbus_error_init (&derror); 743 dbus_error_init (&derror);
@@ -740,9 +748,12 @@ xd_initialize (Lisp_Object bus)
740 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); 748 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
741 749
742 if (dbus_error_is_set (&derror)) 750 if (dbus_error_is_set (&derror))
743 XD_ERROR (derror); 751 if (raise_error == TRUE)
752 XD_ERROR (derror);
753 else
754 connection = NULL;
744 755
745 if (connection == NULL) 756 if ((connection == NULL) && (raise_error == TRUE))
746 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 757 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
747 758
748 /* Cleanup. */ 759 /* Cleanup. */
@@ -829,7 +840,7 @@ This is an internal function, it shall not be used outside dbus.el. */)
829 CHECK_SYMBOL (bus); 840 CHECK_SYMBOL (bus);
830 841
831 /* Open a connection to the bus. */ 842 /* Open a connection to the bus. */
832 connection = xd_initialize (bus); 843 connection = xd_initialize (bus, TRUE);
833 844
834 /* Add the watch functions. We pass also the bus as data, in order 845 /* Add the watch functions. We pass also the bus as data, in order
835 to distinguish between the busses in xd_remove_watch. */ 846 to distinguish between the busses in xd_remove_watch. */
@@ -855,7 +866,7 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
855 CHECK_SYMBOL (bus); 866 CHECK_SYMBOL (bus);
856 867
857 /* Open a connection to the bus. */ 868 /* Open a connection to the bus. */
858 connection = xd_initialize (bus); 869 connection = xd_initialize (bus, TRUE);
859 870
860 /* Request the name. */ 871 /* Request the name. */
861 name = dbus_bus_get_unique_name (connection); 872 name = dbus_bus_get_unique_name (connection);
@@ -970,7 +981,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
970 SDATA (method)); 981 SDATA (method));
971 982
972 /* Open a connection to the bus. */ 983 /* Open a connection to the bus. */
973 connection = xd_initialize (bus); 984 connection = xd_initialize (bus, TRUE);
974 985
975 /* Create the message. */ 986 /* Create the message. */
976 dmessage = dbus_message_new_method_call (SDATA (service), 987 dmessage = dbus_message_new_method_call (SDATA (service),
@@ -1153,7 +1164,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1153 SDATA (method)); 1164 SDATA (method));
1154 1165
1155 /* Open a connection to the bus. */ 1166 /* Open a connection to the bus. */
1156 connection = xd_initialize (bus); 1167 connection = xd_initialize (bus, TRUE);
1157 1168
1158 /* Create the message. */ 1169 /* Create the message. */
1159 dmessage = dbus_message_new_method_call (SDATA (service), 1170 dmessage = dbus_message_new_method_call (SDATA (service),
@@ -1268,7 +1279,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1268 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); 1279 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service));
1269 1280
1270 /* Open a connection to the bus. */ 1281 /* Open a connection to the bus. */
1271 connection = xd_initialize (bus); 1282 connection = xd_initialize (bus, TRUE);
1272 1283
1273 /* Create the message. */ 1284 /* Create the message. */
1274 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); 1285 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
@@ -1360,7 +1371,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1360 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); 1371 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service));
1361 1372
1362 /* Open a connection to the bus. */ 1373 /* Open a connection to the bus. */
1363 connection = xd_initialize (bus); 1374 connection = xd_initialize (bus, TRUE);
1364 1375
1365 /* Create the message. */ 1376 /* Create the message. */
1366 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR); 1377 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR);
@@ -1483,7 +1494,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1483 SDATA (signal)); 1494 SDATA (signal));
1484 1495
1485 /* Open a connection to the bus. */ 1496 /* Open a connection to the bus. */
1486 connection = xd_initialize (bus); 1497 connection = xd_initialize (bus, TRUE);
1487 1498
1488 /* Create the message. */ 1499 /* Create the message. */
1489 dmessage = dbus_message_new_signal (SDATA (path), 1500 dmessage = dbus_message_new_signal (SDATA (path),
@@ -1548,7 +1559,8 @@ xd_get_dispatch_status (Lisp_Object bus)
1548 DBusConnection *connection; 1559 DBusConnection *connection;
1549 1560
1550 /* Open a connection to the bus. */ 1561 /* Open a connection to the bus. */
1551 connection = xd_initialize (bus); 1562 connection = xd_initialize (bus, FALSE);
1563 if (connection == NULL) return FALSE;
1552 1564
1553 /* Non blocking read of the next available message. */ 1565 /* Non blocking read of the next available message. */
1554 dbus_connection_read_write (connection, 0); 1566 dbus_connection_read_write (connection, 0);
@@ -1592,7 +1604,7 @@ xd_read_message (Lisp_Object bus)
1592 const char *uname, *path, *interface, *member; 1604 const char *uname, *path, *interface, *member;
1593 1605
1594 /* Open a connection to the bus. */ 1606 /* Open a connection to the bus. */
1595 connection = xd_initialize (bus); 1607 connection = xd_initialize (bus, TRUE);
1596 1608
1597 /* Non blocking read of the next available message. */ 1609 /* Non blocking read of the next available message. */
1598 dbus_connection_read_write (connection, 0); 1610 dbus_connection_read_write (connection, 0);
@@ -1842,7 +1854,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
1842 if (NILP (uname) || (SBYTES (uname) > 0)) 1854 if (NILP (uname) || (SBYTES (uname) > 0))
1843 { 1855 {
1844 /* Open a connection to the bus. */ 1856 /* Open a connection to the bus. */
1845 connection = xd_initialize (bus); 1857 connection = xd_initialize (bus, TRUE);
1846 1858
1847 /* Create a rule to receive related signals. */ 1859 /* Create a rule to receive related signals. */
1848 sprintf (rule, 1860 sprintf (rule,
@@ -1932,7 +1944,7 @@ used for composing the returning D-Bus message. */)
1932 a segmentation fault. */ 1944 a segmentation fault. */
1933 1945
1934 /* Open a connection to the bus. */ 1946 /* Open a connection to the bus. */
1935 connection = xd_initialize (bus); 1947 connection = xd_initialize (bus, TRUE);
1936 1948
1937 /* Request the known name from the bus. We can ignore the result, 1949 /* Request the known name from the bus. We can ignore the result,
1938 it is set to -1 if there is an error - kind of redundancy. */ 1950 it is set to -1 if there is an error - kind of redundancy. */
diff --git a/src/dispextern.h b/src/dispextern.h
index 9bafb49dd91..5ca7e813a1e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -105,6 +105,8 @@ enum window_part
105/* Number of bits allocated to store fringe bitmap numbers. */ 105/* Number of bits allocated to store fringe bitmap numbers. */
106#define FRINGE_ID_BITS 16 106#define FRINGE_ID_BITS 16
107 107
108/* Number of bits allocated to store fringe bitmap height. */
109#define FRINGE_HEIGHT_BITS 8
108 110
109 111
110/*********************************************************************** 112/***********************************************************************
@@ -800,6 +802,12 @@ struct glyph_row
800 /* Face of the right fringe glyph. */ 802 /* Face of the right fringe glyph. */
801 unsigned right_fringe_face_id : FACE_ID_BITS; 803 unsigned right_fringe_face_id : FACE_ID_BITS;
802 804
805 /* Vertical offset of the left fringe bitmap. */
806 signed left_fringe_offset : FRINGE_HEIGHT_BITS;
807
808 /* Vertical offset of the right fringe bitmap. */
809 signed right_fringe_offset : FRINGE_HEIGHT_BITS;
810
803 /* 1 means that we must draw the bitmaps of this row. */ 811 /* 1 means that we must draw the bitmaps of this row. */
804 unsigned redraw_fringe_bitmaps_p : 1; 812 unsigned redraw_fringe_bitmaps_p : 1;
805 813
diff --git a/src/doc.c b/src/doc.c
index a8f6217c4ce..fc3cbc1c215 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -45,10 +45,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include "keymap.h" 45#include "keymap.h"
46#include "buildobj.h" 46#include "buildobj.h"
47 47
48#ifdef HAVE_INDEX
49extern char *index (const char *, int);
50#endif
51
52Lisp_Object Vdoc_file_name; 48Lisp_Object Vdoc_file_name;
53 49
54Lisp_Object Qfunction_documentation; 50Lisp_Object Qfunction_documentation;
@@ -218,9 +214,9 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
218 if (!nread) 214 if (!nread)
219 break; 215 break;
220 if (p == get_doc_string_buffer) 216 if (p == get_doc_string_buffer)
221 p1 = (char *) index (p + offset, '\037'); 217 p1 = strchr (p + offset, '\037');
222 else 218 else
223 p1 = (char *) index (p, '\037'); 219 p1 = strchr (p, '\037');
224 if (p1) 220 if (p1)
225 { 221 {
226 *p1 = 0; 222 *p1 = 0;
@@ -633,7 +629,7 @@ the same file name is found in the `doc-directory'. */)
633 /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ 629 /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */
634 if (p != end) 630 if (p != end)
635 { 631 {
636 end = (char *) index (p, '\n'); 632 end = strchr (p, '\n');
637 633
638 /* See if this is a file name, and if it is a file in build-files. */ 634 /* See if this is a file name, and if it is a file in build-files. */
639 if (p[1] == 'S' && end - p > 4 && end[-2] == '.' 635 if (p[1] == 'S' && end - p > 4 && end[-2] == '.'
diff --git a/src/doprnt.c b/src/doprnt.c
index 3ff2f70dd34..1b45b21e36b 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -59,10 +59,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
59 Integers are passed as C integers. */ 59 Integers are passed as C integers. */
60 60
61int 61int
62doprnt (char *buffer, register int bufsize, char *format, char *format_end, int nargs, char **args) 62doprnt (char *buffer, register int bufsize, const char *format,
63 const char *format_end, va_list ap)
63{ 64{
64 int cnt = 0; /* Number of arg to gobble next */ 65 const char *fmt = format; /* Pointer into format string */
65 register char *fmt = format; /* Pointer into format string */
66 register char *bufptr = buffer; /* Pointer into output buffer.. */ 66 register char *bufptr = buffer; /* Pointer into output buffer.. */
67 67
68 /* Use this for sprintf unless we need something really big. */ 68 /* Use this for sprintf unless we need something really big. */
@@ -161,8 +161,6 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
161 case 'd': 161 case 'd':
162 case 'o': 162 case 'o':
163 case 'x': 163 case 'x':
164 if (cnt == nargs)
165 error ("Not enough arguments for format string");
166 if (sizeof (int) == sizeof (EMACS_INT)) 164 if (sizeof (int) == sizeof (EMACS_INT))
167 ; 165 ;
168 else if (sizeof (long) == sizeof (EMACS_INT)) 166 else if (sizeof (long) == sizeof (EMACS_INT))
@@ -173,7 +171,7 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
173 string++; 171 string++;
174 else 172 else
175 abort (); 173 abort ();
176 sprintf (sprintf_buffer, fmtcpy, args[cnt++]); 174 sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *));
177 /* Now copy into final output, truncating as nec. */ 175 /* Now copy into final output, truncating as nec. */
178 string = (unsigned char *) sprintf_buffer; 176 string = (unsigned char *) sprintf_buffer;
179 goto doit; 177 goto doit;
@@ -182,12 +180,8 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
182 case 'e': 180 case 'e':
183 case 'g': 181 case 'g':
184 { 182 {
185 union { double d; char *half[2]; } u; 183 double d = va_arg(ap, double);
186 if (cnt + 1 == nargs) 184 sprintf (sprintf_buffer, fmtcpy, d);
187 error ("Not enough arguments for format string");
188 u.half[0] = args[cnt++];
189 u.half[1] = args[cnt++];
190 sprintf (sprintf_buffer, fmtcpy, u.d);
191 /* Now copy into final output, truncating as nec. */ 185 /* Now copy into final output, truncating as nec. */
192 string = (unsigned char *) sprintf_buffer; 186 string = (unsigned char *) sprintf_buffer;
193 goto doit; 187 goto doit;
@@ -196,11 +190,9 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
196 case 'S': 190 case 'S':
197 string[-1] = 's'; 191 string[-1] = 's';
198 case 's': 192 case 's':
199 if (cnt == nargs)
200 error ("Not enough arguments for format string");
201 if (fmtcpy[1] != 's') 193 if (fmtcpy[1] != 's')
202 minlen = atoi (&fmtcpy[1]); 194 minlen = atoi (&fmtcpy[1]);
203 string = (unsigned char *) args[cnt++]; 195 string = va_arg(ap, unsigned char *);
204 tem = strlen (string); 196 tem = strlen (string);
205 width = strwidth (string, tem); 197 width = strwidth (string, tem);
206 goto doit1; 198 goto doit1;
@@ -250,16 +242,21 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
250 continue; 242 continue;
251 243
252 case 'c': 244 case 'c':
253 if (cnt == nargs) 245 {
254 error ("Not enough arguments for format string"); 246 /* Sometimes for %c we pass a char, which would widen
255 tem = CHAR_STRING ((int) (EMACS_INT) args[cnt], charbuf); 247 to int. Sometimes we pass XFASTINT() or XINT()
256 string = charbuf; 248 values, which would be EMACS_INT. Let's hope that
257 cnt++; 249 both are passed the same way, otherwise we'll need
258 string[tem] = 0; 250 to rewrite callers. */
259 width = strwidth (string, tem); 251 EMACS_INT chr = va_arg(ap, EMACS_INT);
260 if (fmtcpy[1] != 'c') 252 tem = CHAR_STRING ((int) chr, charbuf);
261 minlen = atoi (&fmtcpy[1]); 253 string = charbuf;
262 goto doit1; 254 string[tem] = 0;
255 width = strwidth (string, tem);
256 if (fmtcpy[1] != 'c')
257 minlen = atoi (&fmtcpy[1]);
258 goto doit1;
259 }
263 260
264 case '%': 261 case '%':
265 fmt--; /* Drop thru and this % will be treated as normal */ 262 fmt--; /* Drop thru and this % will be treated as normal */
diff --git a/src/editfns.c b/src/editfns.c
index fe493162c01..2d8fcb6c85b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -109,10 +109,6 @@ static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); 109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
110static void transpose_markers (int, int, int, int, int, int, int, int); 110static void transpose_markers (int, int, int, int, int, int, int, int);
111 111
112#ifdef HAVE_INDEX
113extern char *index (const char *, int);
114#endif
115
116Lisp_Object Vbuffer_access_fontify_functions; 112Lisp_Object Vbuffer_access_fontify_functions;
117Lisp_Object Qbuffer_access_fontify_functions; 113Lisp_Object Qbuffer_access_fontify_functions;
118Lisp_Object Vbuffer_access_fontified_property; 114Lisp_Object Vbuffer_access_fontified_property;
@@ -1369,12 +1365,12 @@ name, or nil if there is no such user. */)
1369 1365
1370 p = (unsigned char *) USER_FULL_NAME; 1366 p = (unsigned char *) USER_FULL_NAME;
1371 /* Chop off everything after the first comma. */ 1367 /* Chop off everything after the first comma. */
1372 q = (unsigned char *) index (p, ','); 1368 q = (unsigned char *) strchr (p, ',');
1373 full = make_string (p, q ? q - p : strlen (p)); 1369 full = make_string (p, q ? q - p : strlen (p));
1374 1370
1375#ifdef AMPERSAND_FULL_NAME 1371#ifdef AMPERSAND_FULL_NAME
1376 p = SDATA (full); 1372 p = SDATA (full);
1377 q = (unsigned char *) index (p, '&'); 1373 q = (unsigned char *) strchr (p, '&');
1378 /* Substitute the login name for the &, upcasing the first character. */ 1374 /* Substitute the login name for the &, upcasing the first character. */
1379 if (q) 1375 if (q)
1380 { 1376 {
@@ -2045,7 +2041,7 @@ static char set_time_zone_rule_tz2[] = "TZ=GMT+1";
2045 responsibility to free. */ 2041 responsibility to free. */
2046 2042
2047void 2043void
2048set_time_zone_rule (char *tzstring) 2044set_time_zone_rule (const char *tzstring)
2049{ 2045{
2050 int envptrs; 2046 int envptrs;
2051 char **from, **to, **newenv; 2047 char **from, **to, **newenv;
@@ -3813,7 +3809,7 @@ usage: (format STRING &rest OBJECTS) */)
3813 discarded[format - format_start] = 1; 3809 discarded[format - format_start] = 1;
3814 format++; 3810 format++;
3815 3811
3816 while (index ("-+0# ", *format)) 3812 while (strchr ("-+0# ", *format))
3817 { 3813 {
3818 if (*format == '-') 3814 if (*format == '-')
3819 { 3815 {
@@ -4111,7 +4107,7 @@ usage: (format STRING &rest OBJECTS) */)
4111} 4107}
4112 4108
4113Lisp_Object 4109Lisp_Object
4114format2 (char *string1, Lisp_Object arg0, Lisp_Object arg1) 4110format2 (const char *string1, Lisp_Object arg0, Lisp_Object arg1)
4115{ 4111{
4116 Lisp_Object args[3]; 4112 Lisp_Object args[3];
4117 args[0] = build_string (string1); 4113 args[0] = build_string (string1);
diff --git a/src/emacs.c b/src/emacs.c
index 92d8b82cbd7..e00c49b8d24 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -90,12 +90,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
90const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 90const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
91const char emacs_version[] = "24.0.50"; 91const char emacs_version[] = "24.0.50";
92 92
93extern void malloc_warning (char *);
94extern void set_time_zone_rule (char *);
95#ifdef HAVE_INDEX
96extern char *index (const char *, int);
97#endif
98
99/* Make these values available in GDB, which doesn't see macros. */ 93/* Make these values available in GDB, which doesn't see macros. */
100 94
101#ifdef USE_LSB_TAG 95#ifdef USE_LSB_TAG
@@ -664,7 +658,7 @@ argmatch (char **argv, int argc, char *sstr, char *lstr, int minlen, char **valp
664 *skipptr += 1; 658 *skipptr += 1;
665 return 1; 659 return 1;
666 } 660 }
667 arglen = (valptr != NULL && (p = index (arg, '=')) != NULL 661 arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL
668 ? p - arg : strlen (arg)); 662 ? p - arg : strlen (arg));
669 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0) 663 if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0)
670 return 0; 664 return 0;
@@ -1976,7 +1970,7 @@ sort_args (int argc, char **argv)
1976 { 1970 {
1977 match = -1; 1971 match = -1;
1978 thislen = strlen (argv[from]); 1972 thislen = strlen (argv[from]);
1979 equals = index (argv[from], '='); 1973 equals = strchr (argv[from], '=');
1980 if (equals != 0) 1974 if (equals != 0)
1981 thislen = equals - argv[from]; 1975 thislen = equals - argv[from];
1982 1976
@@ -2344,17 +2338,16 @@ synchronize_system_messages_locale ()
2344#endif 2338#endif
2345 2339
2346Lisp_Object 2340Lisp_Object
2347decode_env_path (evarname, defalt) 2341decode_env_path (const char *evarname, const char *defalt)
2348 char *evarname, *defalt;
2349{ 2342{
2350 register char *path, *p; 2343 const char *path, *p;
2351 Lisp_Object lpath, element, tem; 2344 Lisp_Object lpath, element, tem;
2352 2345
2353 /* It's okay to use getenv here, because this function is only used 2346 /* It's okay to use getenv here, because this function is only used
2354 to initialize variables when Emacs starts up, and isn't called 2347 to initialize variables when Emacs starts up, and isn't called
2355 after that. */ 2348 after that. */
2356 if (evarname != 0) 2349 if (evarname != 0)
2357 path = (char *) getenv (evarname); 2350 path = getenv (evarname);
2358 else 2351 else
2359 path = 0; 2352 path = 0;
2360 if (!path) 2353 if (!path)
@@ -2363,18 +2356,18 @@ decode_env_path (evarname, defalt)
2363 /* Ensure values from the environment use the proper directory separator. */ 2356 /* Ensure values from the environment use the proper directory separator. */
2364 if (path) 2357 if (path)
2365 { 2358 {
2366 p = alloca (strlen (path) + 1); 2359 char *path_copy = alloca (strlen (path) + 1);
2367 strcpy (p, path); 2360 strcpy (path_copy, path);
2368 path = p; 2361 dostounix_filename (path_copy);
2369 2362 path = path_copy;
2370 dostounix_filename (path);
2371 } 2363 }
2372#endif 2364#endif
2373 lpath = Qnil; 2365 lpath = Qnil;
2374 while (1) 2366 while (1)
2375 { 2367 {
2376 p = index (path, SEPCHAR); 2368 p = strchr (path, SEPCHAR);
2377 if (!p) p = path + strlen (path); 2369 if (!p)
2370 p = path + strlen (path);
2378 element = (p - path ? make_string (path, p - path) 2371 element = (p - path ? make_string (path, p - path)
2379 : build_string (".")); 2372 : build_string ("."));
2380 2373
diff --git a/src/eval.c b/src/eval.c
index fa65a5f0d6e..1a7eb4a123e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,7 +1,7 @@
1/* Evaluator for GNU Emacs Lisp interpreter. 1/* Evaluator for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001, 2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -172,14 +172,6 @@ extern Lisp_Object Qfunction;
172 172
173static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object*); 173static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object*);
174static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; 174static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
175
176#if __GNUC__
177/* "gcc -O3" enables automatic function inlining, which optimizes out
178 the arguments for the invocations of these functions, whereas they
179 expect these values on the stack. */
180Lisp_Object apply1 (Lisp_Object fn, Lisp_Object arg) __attribute__((noinline));
181Lisp_Object call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) __attribute__((noinline));
182#endif
183 175
184void 176void
185init_eval_once (void) 177init_eval_once (void)
@@ -435,7 +427,7 @@ usage: (prog1 FIRST BODY...) */)
435 do 427 do
436 { 428 {
437 if (!(argnum++)) 429 if (!(argnum++))
438 val = Feval (Fcar (args_left)); 430 val = Feval (Fcar (args_left));
439 else 431 else
440 Feval (Fcar (args_left)); 432 Feval (Fcar (args_left));
441 args_left = Fcdr (args_left); 433 args_left = Fcdr (args_left);
@@ -470,7 +462,7 @@ usage: (prog2 FORM1 FORM2 BODY...) */)
470 do 462 do
471 { 463 {
472 if (!(argnum++)) 464 if (!(argnum++))
473 val = Feval (Fcar (args_left)); 465 val = Feval (Fcar (args_left));
474 else 466 else
475 Feval (Fcar (args_left)); 467 Feval (Fcar (args_left));
476 args_left = Fcdr (args_left); 468 args_left = Fcdr (args_left);
@@ -944,30 +936,30 @@ chain of symbols. */)
944 /* If indirect and there's an alias loop, don't check anything else. */ 936 /* If indirect and there's an alias loop, don't check anything else. */
945 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS 937 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
946 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable, 938 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
947 Qt, user_variable_p_eh))) 939 Qt, user_variable_p_eh)))
948 return Qnil; 940 return Qnil;
949 941
950 while (1) 942 while (1)
951 { 943 {
952 documentation = Fget (variable, Qvariable_documentation); 944 documentation = Fget (variable, Qvariable_documentation);
953 if (INTEGERP (documentation) && XINT (documentation) < 0) 945 if (INTEGERP (documentation) && XINT (documentation) < 0)
954 return Qt; 946 return Qt;
955 if (STRINGP (documentation) 947 if (STRINGP (documentation)
956 && ((unsigned char) SREF (documentation, 0) == '*')) 948 && ((unsigned char) SREF (documentation, 0) == '*'))
957 return Qt; 949 return Qt;
958 /* If it is (STRING . INTEGER), a negative integer means a user variable. */ 950 /* If it is (STRING . INTEGER), a negative integer means a user variable. */
959 if (CONSP (documentation) 951 if (CONSP (documentation)
960 && STRINGP (XCAR (documentation)) 952 && STRINGP (XCAR (documentation))
961 && INTEGERP (XCDR (documentation)) 953 && INTEGERP (XCDR (documentation))
962 && XINT (XCDR (documentation)) < 0) 954 && XINT (XCDR (documentation)) < 0)
963 return Qt; 955 return Qt;
964 /* Customizable? See `custom-variable-p'. */ 956 /* Customizable? See `custom-variable-p'. */
965 if ((!NILP (Fget (variable, intern ("standard-value")))) 957 if ((!NILP (Fget (variable, intern ("standard-value"))))
966 || (!NILP (Fget (variable, intern ("custom-autoload"))))) 958 || (!NILP (Fget (variable, intern ("custom-autoload")))))
967 return Qt; 959 return Qt;
968 960
969 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS)) 961 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
970 return Qnil; 962 return Qnil;
971 963
972 /* An indirect variable? Let's follow the chain. */ 964 /* An indirect variable? Let's follow the chain. */
973 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable))); 965 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
@@ -1254,7 +1246,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1254 last_time = catchlist == catch; 1246 last_time = catchlist == catch;
1255 1247
1256 /* Unwind the specpdl stack, and then restore the proper set of 1248 /* Unwind the specpdl stack, and then restore the proper set of
1257 handlers. */ 1249 handlers. */
1258 unbind_to (catchlist->pdlcount, Qnil); 1250 unbind_to (catchlist->pdlcount, Qnil);
1259 handlerlist = catchlist->handlerlist; 1251 handlerlist = catchlist->handlerlist;
1260 catchlist = catchlist->next; 1252 catchlist = catchlist->next;
@@ -1265,8 +1257,8 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1265 /* If x_catch_errors was done, turn it off now. 1257 /* If x_catch_errors was done, turn it off now.
1266 (First we give unbind_to a chance to do that.) */ 1258 (First we give unbind_to a chance to do that.) */
1267#if 0 /* This would disable x_catch_errors after x_connection_closed. 1259#if 0 /* This would disable x_catch_errors after x_connection_closed.
1268 * The catch must remain in effect during that delicate 1260 The catch must remain in effect during that delicate
1269 * state. --lorentey */ 1261 state. --lorentey */
1270 x_fully_uncatch_errors (); 1262 x_fully_uncatch_errors ();
1271#endif 1263#endif
1272#endif 1264#endif
@@ -1342,13 +1334,13 @@ instead of a single condition name. Then it handles all of them.
1342When a handler handles an error, control returns to the `condition-case' 1334When a handler handles an error, control returns to the `condition-case'
1343and it executes the handler's BODY... 1335and it executes the handler's BODY...
1344with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. 1336with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error.
1345(If VAR is nil, the handler can't access that information.) 1337\(If VAR is nil, the handler can't access that information.)
1346Then the value of the last BODY form is returned from the `condition-case' 1338Then the value of the last BODY form is returned from the `condition-case'
1347expression. 1339expression.
1348 1340
1349See also the function `signal' for more info. 1341See also the function `signal' for more info.
1350usage: (condition-case VAR BODYFORM &rest HANDLERS) */) 1342usage: (condition-case VAR BODYFORM &rest HANDLERS) */)
1351(Lisp_Object args) 1343 (Lisp_Object args)
1352{ 1344{
1353 register Lisp_Object bodyform, handlers; 1345 register Lisp_Object bodyform, handlers;
1354 volatile Lisp_Object var; 1346 volatile Lisp_Object var;
@@ -1397,7 +1389,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
1397 if (_setjmp (c.jmp)) 1389 if (_setjmp (c.jmp))
1398 { 1390 {
1399 if (!NILP (h.var)) 1391 if (!NILP (h.var))
1400 specbind (h.var, c.val); 1392 specbind (h.var, c.val);
1401 val = Fprogn (Fcdr (h.chosen_clause)); 1393 val = Fprogn (Fcdr (h.chosen_clause));
1402 1394
1403 /* Note that this just undoes the binding of h.var; whoever 1395 /* Note that this just undoes the binding of h.var; whoever
@@ -1619,7 +1611,7 @@ internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*),
1619 1611
1620 1612
1621static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object, 1613static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object,
1622 Lisp_Object, Lisp_Object); 1614 Lisp_Object, Lisp_Object);
1623 1615
1624DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, 1616DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0,
1625 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. 1617 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA.
@@ -1783,7 +1775,7 @@ xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Obj
1783 If ARG is not a genuine list, make it a one-element list. */ 1775 If ARG is not a genuine list, make it a one-element list. */
1784 1776
1785void 1777void
1786signal_error (char *s, Lisp_Object arg) 1778signal_error (const char *s, Lisp_Object arg)
1787{ 1779{
1788 Lisp_Object tortoise, hare; 1780 Lisp_Object tortoise, hare;
1789 1781
@@ -2003,9 +1995,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions,
2003 1995
2004/* VARARGS 1 */ 1996/* VARARGS 1 */
2005void 1997void
2006error (m, a1, a2, a3) 1998error (const char *m, ...)
2007 char *m;
2008 char *a1, *a2, *a3;
2009{ 1999{
2010 char buf[200]; 2000 char buf[200];
2011 int size = 200; 2001 int size = 200;
@@ -2015,15 +2005,18 @@ error (m, a1, a2, a3)
2015 int allocated = 0; 2005 int allocated = 0;
2016 Lisp_Object string; 2006 Lisp_Object string;
2017 2007
2018 args[0] = a1;
2019 args[1] = a2;
2020 args[2] = a3;
2021
2022 mlen = strlen (m); 2008 mlen = strlen (m);
2023 2009
2024 while (1) 2010 while (1)
2025 { 2011 {
2026 int used = doprnt (buffer, size, m, m + mlen, 3, args); 2012 va_list ap;
2013 int used;
2014
2015 /* A va_list can't be reused if we have to go around the loop
2016 again; we need to "reinitialize" it each time. */
2017 va_start(ap, m);
2018 used = doprnt (buffer, size, m, m + mlen, ap);
2019 va_end(ap);
2027 if (used < size) 2020 if (used < size)
2028 break; 2021 break;
2029 size *= 2; 2022 size *= 2;
@@ -2515,7 +2508,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2515 2508
2516enum run_hooks_condition {to_completion, until_success, until_failure}; 2509enum run_hooks_condition {to_completion, until_success, until_failure};
2517static Lisp_Object run_hook_with_args (int, Lisp_Object *, 2510static Lisp_Object run_hook_with_args (int, Lisp_Object *,
2518 enum run_hooks_condition); 2511 enum run_hooks_condition);
2519 2512
2520DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, 2513DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
2521 doc: /* Run each hook in HOOKS. 2514 doc: /* Run each hook in HOOKS.
@@ -3253,18 +3246,17 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3253 case SYMBOL_VARALIAS: 3246 case SYMBOL_VARALIAS:
3254 sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start; 3247 sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start;
3255 case SYMBOL_PLAINVAL: 3248 case SYMBOL_PLAINVAL:
3256 { /* The most common case is that of a non-constant symbol with a 3249 /* The most common case is that of a non-constant symbol with a
3257 trivial value. Make that as fast as we can. */ 3250 trivial value. Make that as fast as we can. */
3258 specpdl_ptr->symbol = symbol; 3251 specpdl_ptr->symbol = symbol;
3259 specpdl_ptr->old_value = SYMBOL_VAL (sym); 3252 specpdl_ptr->old_value = SYMBOL_VAL (sym);
3260 specpdl_ptr->func = NULL; 3253 specpdl_ptr->func = NULL;
3261 ++specpdl_ptr; 3254 ++specpdl_ptr;
3262 if (!sym->constant) 3255 if (!sym->constant)
3263 SET_SYMBOL_VAL (sym, value); 3256 SET_SYMBOL_VAL (sym, value);
3264 else 3257 else
3265 set_internal (symbol, value, Qnil, 1); 3258 set_internal (symbol, value, Qnil, 1);
3266 break; 3259 break;
3267 }
3268 case SYMBOL_LOCALIZED: 3260 case SYMBOL_LOCALIZED:
3269 if (SYMBOL_BLV (sym)->frame_local) 3261 if (SYMBOL_BLV (sym)->frame_local)
3270 error ("Frame-local vars cannot be let-bound"); 3262 error ("Frame-local vars cannot be let-bound");
@@ -3374,7 +3366,7 @@ unbind_to (int count, Lisp_Object value)
3374 bound a variable that had a buffer-local or frame-local 3366 bound a variable that had a buffer-local or frame-local
3375 binding. WHERE nil means that the variable had the default 3367 binding. WHERE nil means that the variable had the default
3376 value when it was bound. CURRENT-BUFFER is the buffer that 3368 value when it was bound. CURRENT-BUFFER is the buffer that
3377 was current when the variable was bound. */ 3369 was current when the variable was bound. */
3378 else if (CONSP (this_binding.symbol)) 3370 else if (CONSP (this_binding.symbol))
3379 { 3371 {
3380 Lisp_Object symbol, where; 3372 Lisp_Object symbol, where;
diff --git a/src/fileio.c b/src/fileio.c
index 7c0921a0e39..c942803e280 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1455,7 +1455,7 @@ See also the function `substitute-in-file-name'.")
1455 /* Get past ~ to user */ 1455 /* Get past ~ to user */
1456 unsigned char *user = nm + 1; 1456 unsigned char *user = nm + 1;
1457 /* Find end of name. */ 1457 /* Find end of name. */
1458 unsigned char *ptr = (unsigned char *) index (user, '/'); 1458 unsigned char *ptr = (unsigned char *) strchr (user, '/');
1459 int len = ptr ? ptr - user : strlen (user); 1459 int len = ptr ? ptr - user : strlen (user);
1460 /* Copy the user name into temp storage. */ 1460 /* Copy the user name into temp storage. */
1461 o = (unsigned char *) alloca (len + 1); 1461 o = (unsigned char *) alloca (len + 1);
@@ -2729,7 +2729,7 @@ points to a nonexistent file. */)
2729 while (valsize >= bufsize); 2729 while (valsize >= bufsize);
2730 2730
2731 val = make_string (buf, valsize); 2731 val = make_string (buf, valsize);
2732 if (buf[0] == '/' && index (buf, ':')) 2732 if (buf[0] == '/' && strchr (buf, ':'))
2733 val = concat2 (build_string ("/:"), val); 2733 val = concat2 (build_string ("/:"), val);
2734 xfree (buf); 2734 xfree (buf);
2735 val = DECODE_FILE (val); 2735 val = DECODE_FILE (val);
diff --git a/src/filelock.c b/src/filelock.c
index 8eb6060e531..c3f1bfde292 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -413,9 +413,6 @@ within_one_second (time_t a, time_t b)
413static int 413static int
414current_lock_owner (lock_info_type *owner, char *lfname) 414current_lock_owner (lock_info_type *owner, char *lfname)
415{ 415{
416#ifndef index
417 extern char *rindex (const char *, int), *index (const char *, int);
418#endif
419 int len, ret; 416 int len, ret;
420 int local_owner = 0; 417 int local_owner = 0;
421 char *at, *dot, *colon; 418 char *at, *dot, *colon;
@@ -457,8 +454,8 @@ current_lock_owner (lock_info_type *owner, char *lfname)
457 454
458 /* Parse USER@HOST.PID:BOOT_TIME. If can't parse, return -1. */ 455 /* Parse USER@HOST.PID:BOOT_TIME. If can't parse, return -1. */
459 /* The USER is everything before the last @. */ 456 /* The USER is everything before the last @. */
460 at = rindex (lfinfo, '@'); 457 at = strrchr (lfinfo, '@');
461 dot = rindex (lfinfo, '.'); 458 dot = strrchr (lfinfo, '.');
462 if (!at || !dot) 459 if (!at || !dot)
463 { 460 {
464 xfree (lfinfo); 461 xfree (lfinfo);
diff --git a/src/fns.c b/src/fns.c
index 42e7a715f76..0e220c5ee0b 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -371,14 +371,8 @@ Symbols are also allowed; their print names are used instead. */)
371 return i1 < SCHARS (s2) ? Qt : Qnil; 371 return i1 < SCHARS (s2) ? Qt : Qnil;
372} 372}
373 373
374#if __GNUC__ 374static Lisp_Object concat (int nargs, Lisp_Object *args,
375/* "gcc -O3" enables automatic function inlining, which optimizes out 375 enum Lisp_Type target_type, int last_special);
376 the arguments for the invocations of this function, whereas it
377 expects these values on the stack. */
378static Lisp_Object concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special) __attribute__((noinline));
379#else /* !__GNUC__ */
380static Lisp_Object concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special);
381#endif
382 376
383/* ARGSUSED */ 377/* ARGSUSED */
384Lisp_Object 378Lisp_Object
diff --git a/src/font.c b/src/font.c
index bf3c4b6c8c2..c72453d6702 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1815,7 +1815,7 @@ font_unparse_gtkname (Lisp_Object font, struct frame *f, char *name, int nbytes)
1815static int 1815static int
1816font_parse_name (char *name, Lisp_Object font) 1816font_parse_name (char *name, Lisp_Object font)
1817{ 1817{
1818 if (name[0] == '-' || index (name, '*') || index (name, '?')) 1818 if (name[0] == '-' || strchr (name, '*') || strchr (name, '?'))
1819 return font_parse_xlfd (name, font); 1819 return font_parse_xlfd (name, font);
1820 return font_parse_fcname (name, font); 1820 return font_parse_fcname (name, font);
1821} 1821}
@@ -1837,7 +1837,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1837 CHECK_STRING (family); 1837 CHECK_STRING (family);
1838 len = SBYTES (family); 1838 len = SBYTES (family);
1839 p0 = (char *) SDATA (family); 1839 p0 = (char *) SDATA (family);
1840 p1 = index (p0, '-'); 1840 p1 = strchr (p0, '-');
1841 if (p1) 1841 if (p1)
1842 { 1842 {
1843 if ((*p0 != '*' && p1 - p0 > 0) 1843 if ((*p0 != '*' && p1 - p0 > 0)
@@ -1856,7 +1856,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1856 CHECK_STRING (registry); 1856 CHECK_STRING (registry);
1857 len = SBYTES (registry); 1857 len = SBYTES (registry);
1858 p0 = (char *) SDATA (registry); 1858 p0 = (char *) SDATA (registry);
1859 p1 = index (p0, '-'); 1859 p1 = strchr (p0, '-');
1860 if (! p1) 1860 if (! p1)
1861 { 1861 {
1862 if (SDATA (registry)[len - 1] == '*') 1862 if (SDATA (registry)[len - 1] == '*')
diff --git a/src/fontset.c b/src/fontset.c
index 676e96fd88c..9a27fc3e36b 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1065,8 +1065,8 @@ static Lisp_Object Vcached_fontset_data;
1065static Lisp_Object 1065static Lisp_Object
1066fontset_pattern_regexp (Lisp_Object pattern) 1066fontset_pattern_regexp (Lisp_Object pattern)
1067{ 1067{
1068 if (!index ((char *) SDATA (pattern), '*') 1068 if (!strchr ((char *) SDATA (pattern), '*')
1069 && !index ((char *) SDATA (pattern), '?')) 1069 && !strchr ((char *) SDATA (pattern), '?'))
1070 /* PATTERN does not contain any wild cards. */ 1070 /* PATTERN does not contain any wild cards. */
1071 return Qnil; 1071 return Qnil;
1072 1072
diff --git a/src/frame.c b/src/frame.c
index 37d1579dd4d..cebec92c426 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -100,6 +100,7 @@ Lisp_Object Qgeometry; /* Not used */
100Lisp_Object Qheight, Qwidth; 100Lisp_Object Qheight, Qwidth;
101Lisp_Object Qleft, Qright; 101Lisp_Object Qleft, Qright;
102Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name; 102Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name;
103Lisp_Object Qtooltip;
103Lisp_Object Qinternal_border_width; 104Lisp_Object Qinternal_border_width;
104Lisp_Object Qmouse_color; 105Lisp_Object Qmouse_color;
105Lisp_Object Qminibuffer; 106Lisp_Object Qminibuffer;
@@ -326,6 +327,8 @@ make_frame (int mini_p)
326 f->n_tool_bar_items = 0; 327 f->n_tool_bar_items = 0;
327 f->left_fringe_width = f->right_fringe_width = 0; 328 f->left_fringe_width = f->right_fringe_width = 0;
328 f->fringe_cols = 0; 329 f->fringe_cols = 0;
330 f->menu_bar_lines = 0;
331 f->tool_bar_lines = 0;
329 f->scroll_bar_actual_width = 0; 332 f->scroll_bar_actual_width = 0;
330 f->border_width = 0; 333 f->border_width = 0;
331 f->internal_border_width = 0; 334 f->internal_border_width = 0;
@@ -550,6 +553,7 @@ make_initial_frame (void)
550 553
551 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 554 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
552 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 555 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
556 FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1;
553 557
554#ifdef CANNOT_DUMP 558#ifdef CANNOT_DUMP
555 if (!noninteractive) 559 if (!noninteractive)
@@ -600,6 +604,7 @@ make_terminal_frame (struct terminal *terminal)
600 604
601 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 605 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
602 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 606 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
607 FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1;
603 608
604 /* Set the top frame to the newly created frame. */ 609 /* Set the top frame to the newly created frame. */
605 if (FRAMEP (FRAME_TTY (f)->top_frame) 610 if (FRAMEP (FRAME_TTY (f)->top_frame)
@@ -1298,7 +1303,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1298 struct frame *sf = SELECTED_FRAME (); 1303 struct frame *sf = SELECTED_FRAME ();
1299 struct kboard *kb; 1304 struct kboard *kb;
1300 1305
1301 int minibuffer_selected; 1306 int minibuffer_selected, tooltip_frame;
1302 1307
1303 if (EQ (frame, Qnil)) 1308 if (EQ (frame, Qnil))
1304 { 1309 {
@@ -1350,13 +1355,15 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1350 } 1355 }
1351 } 1356 }
1352 1357
1358 tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip")));
1359
1353 /* Run `delete-frame-functions' unless FORCE is `noelisp' or 1360 /* Run `delete-frame-functions' unless FORCE is `noelisp' or
1354 frame is a tooltip. FORCE is set to `noelisp' when handling 1361 frame is a tooltip. FORCE is set to `noelisp' when handling
1355 a disconnect from the terminal, so we don't dare call Lisp 1362 a disconnect from the terminal, so we don't dare call Lisp
1356 code. */ 1363 code. */
1357 if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip")))) 1364 if (NILP (Vrun_hooks) || tooltip_frame)
1358 ; 1365 ;
1359 if (EQ (force, Qnoelisp)) 1366 else if (EQ (force, Qnoelisp))
1360 pending_funcalls 1367 pending_funcalls
1361 = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame), 1368 = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
1362 pending_funcalls); 1369 pending_funcalls);
@@ -1602,7 +1609,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1602 } 1609 }
1603 1610
1604 /* Cause frame titles to update--necessary if we now have just one frame. */ 1611 /* Cause frame titles to update--necessary if we now have just one frame. */
1605 update_mode_lines = 1; 1612 if (!tooltip_frame)
1613 update_mode_lines = 1;
1606 1614
1607 return Qnil; 1615 return Qnil;
1608} 1616}
@@ -4320,6 +4328,8 @@ syms_of_frame (void)
4320 staticpro (&Qicon_left); 4328 staticpro (&Qicon_left);
4321 Qicon_top = intern_c_string ("icon-top"); 4329 Qicon_top = intern_c_string ("icon-top");
4322 staticpro (&Qicon_top); 4330 staticpro (&Qicon_top);
4331 Qtooltip = intern_c_string ("tooltip");
4332 staticpro (&Qtooltip);
4323 Qleft = intern_c_string ("left"); 4333 Qleft = intern_c_string ("left");
4324 staticpro (&Qleft); 4334 staticpro (&Qleft);
4325 Qright = intern_c_string ("right"); 4335 Qright = intern_c_string ("right");
diff --git a/src/fringe.c b/src/fringe.c
index 50d5a5c9747..399779009dc 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -555,23 +555,26 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
555 struct fringe_bitmap *fb; 555 struct fringe_bitmap *fb;
556 int period; 556 int period;
557 int face_id = DEFAULT_FACE_ID; 557 int face_id = DEFAULT_FACE_ID;
558 int offset, header_line_height;
558 559
559 p.cursor_p = 0;
560 p.overlay_p = (overlay & 1) == 1; 560 p.overlay_p = (overlay & 1) == 1;
561 p.cursor_p = (overlay & 2) == 2; 561 p.cursor_p = (overlay & 2) == 2;
562 562
563 if (which != NO_FRINGE_BITMAP) 563 if (which != NO_FRINGE_BITMAP)
564 { 564 {
565 offset = 0;
565 } 566 }
566 else if (left_p) 567 else if (left_p)
567 { 568 {
568 which = row->left_fringe_bitmap; 569 which = row->left_fringe_bitmap;
569 face_id = row->left_fringe_face_id; 570 face_id = row->left_fringe_face_id;
571 offset = row->left_fringe_offset;
570 } 572 }
571 else 573 else
572 { 574 {
573 which = row->right_fringe_bitmap; 575 which = row->right_fringe_bitmap;
574 face_id = row->right_fringe_face_id; 576 face_id = row->right_fringe_face_id;
577 offset = row->right_fringe_offset;
575 } 578 }
576 579
577 if (face_id == DEFAULT_FACE_ID) 580 if (face_id == DEFAULT_FACE_ID)
@@ -591,7 +594,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
591 period = fb->period; 594 period = fb->period;
592 595
593 /* Convert row to frame coordinates. */ 596 /* Convert row to frame coordinates. */
594 p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 597 p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y) + offset;
595 598
596 p.which = which; 599 p.which = which;
597 p.bits = fb->bits; 600 p.bits = fb->bits;
@@ -600,9 +603,19 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
600 p.h = fb->height; 603 p.h = fb->height;
601 p.dh = (period > 0 ? (p.y % period) : 0); 604 p.dh = (period > 0 ? (p.y % period) : 0);
602 p.h -= p.dh; 605 p.h -= p.dh;
603 /* Clip bitmap if too high. */ 606
604 if (p.h > row->height) 607 /* Adjust y to the offset in the row to start drawing the bitmap. */
605 p.h = row->height; 608 switch (fb->align)
609 {
610 case ALIGN_BITMAP_CENTER:
611 p.y += (row->height - p.h) / 2;
612 break;
613 case ALIGN_BITMAP_BOTTOM:
614 p.y += (row->visible_height - p.h);
615 break;
616 case ALIGN_BITMAP_TOP:
617 break;
618 }
606 619
607 p.face = FACE_FROM_ID (f, face_id); 620 p.face = FACE_FROM_ID (f, face_id);
608 621
@@ -618,6 +631,9 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
618 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill 631 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill
619 the fringe. */ 632 the fringe. */
620 p.bx = -1; 633 p.bx = -1;
634 header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
635 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
636 p.ny = row->visible_height;
621 if (left_p) 637 if (left_p)
622 { 638 {
623 int wd = WINDOW_LEFT_FRINGE_WIDTH (w); 639 int wd = WINDOW_LEFT_FRINGE_WIDTH (w);
@@ -628,7 +644,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
628 p.wd = wd; 644 p.wd = wd;
629 p.x = x - p.wd - (wd - p.wd) / 2; 645 p.x = x - p.wd - (wd - p.wd) / 2;
630 646
631 if (p.wd < wd || row->height > p.h) 647 if (p.wd < wd || p.y > p.by || p.y + p.h < p.by + p.ny)
632 { 648 {
633 /* If W has a vertical border to its left, don't draw over it. */ 649 /* If W has a vertical border to its left, don't draw over it. */
634 wd -= ((!WINDOW_LEFTMOST_P (w) 650 wd -= ((!WINDOW_LEFTMOST_P (w)
@@ -650,35 +666,13 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
650 p.x = x + (wd - p.wd) / 2; 666 p.x = x + (wd - p.wd) / 2;
651 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill 667 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill
652 the fringe. */ 668 the fringe. */
653 if (p.wd < wd || row->height > p.h) 669 if (p.wd < wd || p.y > p.by || p.y + p.h < p.by + p.ny)
654 { 670 {
655 p.bx = x; 671 p.bx = x;
656 p.nx = wd; 672 p.nx = wd;
657 } 673 }
658 } 674 }
659 675
660 if (p.bx >= 0)
661 {
662 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
663
664 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
665 p.ny = row->visible_height;
666 }
667
668 /* Adjust y to the offset in the row to start drawing the bitmap. */
669 switch (fb->align)
670 {
671 case ALIGN_BITMAP_CENTER:
672 p.y += (row->height - p.h) / 2;
673 break;
674 case ALIGN_BITMAP_BOTTOM:
675 p.h = fb->height;
676 p.y += (row->visible_height - p.h);
677 break;
678 case ALIGN_BITMAP_TOP:
679 break;
680 }
681
682 FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p); 676 FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
683} 677}
684 678
@@ -892,7 +886,7 @@ draw_window_fringes (struct window *w, int no_fringe)
892 struct glyph_row *row; 886 struct glyph_row *row;
893 int yb = window_text_bottom_y (w); 887 int yb = window_text_bottom_y (w);
894 int nrows = w->current_matrix->nrows; 888 int nrows = w->current_matrix->nrows;
895 int y = 0, rn; 889 int y, rn;
896 int updated = 0; 890 int updated = 0;
897 891
898 if (w->pseudo_window_p) 892 if (w->pseudo_window_p)
@@ -904,7 +898,7 @@ draw_window_fringes (struct window *w, int no_fringe)
904 || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)) 898 || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0))
905 updated++; 899 updated++;
906 900
907 for (y = 0, rn = 0, row = w->current_matrix->rows; 901 for (y = w->vscroll, rn = 0, row = w->current_matrix->rows;
908 y < yb && rn < nrows; 902 y < yb && rn < nrows;
909 y += row->height, ++row, ++rn) 903 y += row->height, ++row, ++rn)
910 { 904 {
@@ -938,6 +932,9 @@ update_window_fringes (struct window *w, int keep_current_p)
938 Lisp_Object ind = Qnil; 932 Lisp_Object ind = Qnil;
939#define MAX_BITMAP_CACHE (8*4) 933#define MAX_BITMAP_CACHE (8*4)
940 int bitmap_cache[MAX_BITMAP_CACHE]; 934 int bitmap_cache[MAX_BITMAP_CACHE];
935 int top_ind_rn, bot_ind_rn;
936 int top_ind_min_y, bot_ind_max_y;
937 int top_row_ends_at_zv_p, bot_row_ends_at_zv_p;
941 938
942 if (w->pseudo_window_p) 939 if (w->pseudo_window_p)
943 return 0; 940 return 0;
@@ -966,11 +963,10 @@ update_window_fringes (struct window *w, int keep_current_p)
966 boundary_top = boundary_bot = Qleft; 963 boundary_top = boundary_bot = Qleft;
967 } 964 }
968 965
966 top_ind_rn = bot_ind_rn = -1;
969 if (!NILP (ind)) 967 if (!NILP (ind))
970 { 968 {
971 int done_top = 0, done_bot = 0; 969 for (y = w->vscroll, rn = 0;
972
973 for (y = 0, rn = 0;
974 y < yb && rn < nrows; 970 y < yb && rn < nrows;
975 y += row->height, ++rn) 971 y += row->height, ++rn)
976 { 972 {
@@ -991,31 +987,25 @@ update_window_fringes (struct window *w, int keep_current_p)
991 987
992 if (!row->mode_line_p) 988 if (!row->mode_line_p)
993 { 989 {
994 if (!done_top) 990 if (top_ind_rn < 0 && row->visible_height > 0)
995 { 991 {
996 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) 992 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))
997 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) 993 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
998 row->indicate_bob_p = !NILP (boundary_top); 994 row->indicate_bob_p = !NILP (boundary_top);
999 else 995 else
1000 row->indicate_top_line_p = !NILP (arrow_top); 996 row->indicate_top_line_p = !NILP (arrow_top);
1001 done_top = 1; 997 top_ind_rn = rn;
1002 } 998 }
1003 999
1004 if (!done_bot) 1000 if (bot_ind_rn < 0)
1005 { 1001 {
1006 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) 1002 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))
1007 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) 1003 && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row))
1008 row->indicate_eob_p = !NILP (boundary_bot), done_bot = 1; 1004 row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn;
1009 else if (y + row->height >= yb) 1005 else if (y + row->height >= yb)
1010 row->indicate_bottom_line_p = !NILP (arrow_bot), done_bot = 1; 1006 row->indicate_bottom_line_p = !NILP (arrow_bot), bot_ind_rn = rn;
1011 } 1007 }
1012 } 1008 }
1013
1014 if (indicate_bob_p != row->indicate_bob_p
1015 || indicate_top_line_p != row->indicate_top_line_p
1016 || indicate_eob_p != row->indicate_eob_p
1017 || indicate_bottom_line_p != row->indicate_bottom_line_p)
1018 row->redraw_fringe_bitmaps_p = 1;
1019 } 1009 }
1020 } 1010 }
1021 1011
@@ -1039,12 +1029,139 @@ update_window_fringes (struct window *w, int keep_current_p)
1039 get_logical_fringe_bitmap (w, which, 1, partial_p))) 1029 get_logical_fringe_bitmap (w, which, 1, partial_p)))
1040 1030
1041 1031
1042 for (y = 0, rn = 0; 1032 /* Extend top-aligned top indicator (or bottom-aligned bottom
1033 indicator) to adjacent rows if it doesn't fit in one row. */
1034 top_ind_min_y = bot_ind_max_y = -1;
1035 if (top_ind_rn >= 0)
1036 {
1037 int bn = NO_FRINGE_BITMAP;
1038
1039 row = w->desired_matrix->rows + top_ind_rn;
1040 if (!row->enabled_p)
1041 row = w->current_matrix->rows + top_ind_rn;
1042
1043 top_row_ends_at_zv_p = row->ends_at_zv_p;
1044 if (row->indicate_bob_p)
1045 {
1046 if (EQ (boundary_top, Qleft))
1047 bn = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
1048 ? LEFT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p)
1049 : LEFT_FRINGE (2, Qtop, 0));
1050 else
1051 bn = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
1052 ? RIGHT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p)
1053 : RIGHT_FRINGE (2, Qtop, 0));
1054 }
1055 else if (row->indicate_top_line_p)
1056 {
1057 if (EQ (arrow_top, Qleft))
1058 bn = LEFT_FRINGE (6, Qup, 0);
1059 else
1060 bn = RIGHT_FRINGE (6, Qup, 0);
1061 }
1062
1063 if (bn != NO_FRINGE_BITMAP)
1064 {
1065 struct fringe_bitmap *fb;
1066
1067 fb = fringe_bitmaps[bn];
1068 if (fb == NULL)
1069 fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
1070 ? bn : UNDEF_FRINGE_BITMAP];
1071 if (fb->align == ALIGN_BITMAP_TOP && fb->period == 0)
1072 {
1073 struct glyph_row *row1;
1074 int top_ind_max_y;
1075
1076 top_ind_min_y = WINDOW_HEADER_LINE_HEIGHT (w);
1077 top_ind_max_y = top_ind_min_y + fb->height;
1078 if (top_ind_max_y > yb)
1079 top_ind_max_y = yb;
1080
1081 for (y = row->y + row->height, rn = top_ind_rn + 1;
1082 y < top_ind_max_y && rn < nrows;
1083 y += row1->height, rn++)
1084 {
1085 if (bot_ind_rn >= 0 && rn >= bot_ind_rn)
1086 break;
1087
1088 row1 = w->desired_matrix->rows + rn;
1089 if (!row1->enabled_p)
1090 row1 = w->current_matrix->rows + rn;
1091
1092 row1->indicate_bob_p = row->indicate_bob_p;
1093 row1->indicate_top_line_p = row->indicate_top_line_p;
1094 }
1095 }
1096 }
1097 }
1098 if (bot_ind_rn >= 0)
1099 {
1100 int bn = NO_FRINGE_BITMAP;
1101
1102 row = w->desired_matrix->rows + bot_ind_rn;
1103 if (!row->enabled_p)
1104 row = w->current_matrix->rows + bot_ind_rn;
1105
1106 bot_row_ends_at_zv_p = row->ends_at_zv_p;
1107 if (row->indicate_eob_p)
1108 {
1109 if (EQ (boundary_bot, Qleft))
1110 bn = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p);
1111 else
1112 bn = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p);
1113 }
1114 else if (row->indicate_bottom_line_p)
1115 {
1116 if (EQ (arrow_bot, Qleft))
1117 bn = LEFT_FRINGE (7, Qdown, 0);
1118 else
1119 bn = RIGHT_FRINGE (7, Qdown, 0);
1120 }
1121
1122 if (bn != NO_FRINGE_BITMAP)
1123 {
1124 struct fringe_bitmap *fb;
1125
1126 fb = fringe_bitmaps[bn];
1127 if (fb == NULL)
1128 fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
1129 ? bn : UNDEF_FRINGE_BITMAP];
1130 if (fb->align == ALIGN_BITMAP_BOTTOM && fb->period == 0)
1131 {
1132 struct glyph_row *row1;
1133 int bot_ind_min_y;
1134
1135 bot_ind_max_y = row->y + row->visible_height;
1136 bot_ind_min_y = bot_ind_max_y - fb->height;
1137 if (bot_ind_min_y < WINDOW_HEADER_LINE_HEIGHT (w))
1138 bot_ind_min_y = WINDOW_HEADER_LINE_HEIGHT (w);
1139
1140 for (y = row->y, rn = bot_ind_rn - 1;
1141 y >= bot_ind_min_y && rn >= 0;
1142 y -= row1->height, rn--)
1143 {
1144 if (top_ind_rn >= 0 && rn <= top_ind_rn)
1145 break;
1146
1147 row1 = w->desired_matrix->rows + rn;
1148 if (!row1->enabled_p)
1149 row1 = w->current_matrix->rows + rn;
1150
1151 row1->indicate_eob_p = row->indicate_eob_p;
1152 row1->indicate_bottom_line_p = row->indicate_bottom_line_p;
1153 }
1154 }
1155 }
1156 }
1157
1158 for (y = w->vscroll, rn = 0;
1043 y < yb && rn < nrows; 1159 y < yb && rn < nrows;
1044 y += row->height, rn++) 1160 y += row->height, rn++)
1045 { 1161 {
1046 int left, right; 1162 int left, right;
1047 unsigned left_face_id, right_face_id; 1163 unsigned left_face_id, right_face_id;
1164 int left_offset, right_offset;
1048 1165
1049 row = w->desired_matrix->rows + rn; 1166 row = w->desired_matrix->rows + rn;
1050 cur = w->current_matrix->rows + rn; 1167 cur = w->current_matrix->rows + rn;
@@ -1052,6 +1169,7 @@ update_window_fringes (struct window *w, int keep_current_p)
1052 row = cur; 1169 row = cur;
1053 1170
1054 left_face_id = right_face_id = DEFAULT_FACE_ID; 1171 left_face_id = right_face_id = DEFAULT_FACE_ID;
1172 left_offset = right_offset = 0;
1055 1173
1056 /* Decide which bitmap to draw in the left fringe. */ 1174 /* Decide which bitmap to draw in the left fringe. */
1057 if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) 1175 if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
@@ -1065,20 +1183,35 @@ update_window_fringes (struct window *w, int keep_current_p)
1065 || (row->reversed_p && row->truncated_on_right_p)) 1183 || (row->reversed_p && row->truncated_on_right_p))
1066 left = LEFT_FRINGE(0, Qtruncation, 0); 1184 left = LEFT_FRINGE(0, Qtruncation, 0);
1067 else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) 1185 else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
1068 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) 1186 {
1069 ? LEFT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) 1187 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
1070 : LEFT_FRINGE (2, Qtop, 0)); 1188 ? LEFT_FRINGE (1, Qtop_bottom, top_row_ends_at_zv_p)
1189 : LEFT_FRINGE (2, Qtop, 0));
1190 if (top_ind_min_y >= 0)
1191 left_offset = top_ind_min_y - row->y;
1192 }
1071 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) 1193 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
1072 left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); 1194 {
1073 else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)) 1195 left = LEFT_FRINGE (3, Qbottom, bot_row_ends_at_zv_p);
1074 || (row->reversed_p && row->continued_p)) 1196 if (bot_ind_max_y >= 0)
1197 left_offset = bot_ind_max_y - (row->y + row->visible_height);
1198 }
1199 else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
1075 left = LEFT_FRINGE (4, Qcontinuation, 0); 1200 left = LEFT_FRINGE (4, Qcontinuation, 0);
1076 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) 1201 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
1077 left = LEFT_FRINGE (5, Qempty_line, 0); 1202 left = LEFT_FRINGE (5, Qempty_line, 0);
1078 else if (row->indicate_top_line_p && EQ (arrow_top, Qleft)) 1203 else if (row->indicate_top_line_p && EQ (arrow_top, Qleft))
1079 left = LEFT_FRINGE (6, Qup, 0); 1204 {
1205 left = LEFT_FRINGE (6, Qup, 0);
1206 if (top_ind_min_y >= 0)
1207 left_offset = top_ind_min_y - row->y;
1208 }
1080 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft)) 1209 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft))
1081 left = LEFT_FRINGE (7, Qdown, 0); 1210 {
1211 left = LEFT_FRINGE (7, Qdown, 0);
1212 if (bot_ind_max_y >= 0)
1213 left_offset = bot_ind_max_y - (row->y + row->visible_height);
1214 }
1082 else 1215 else
1083 left = NO_FRINGE_BITMAP; 1216 left = NO_FRINGE_BITMAP;
1084 1217
@@ -1094,18 +1227,33 @@ update_window_fringes (struct window *w, int keep_current_p)
1094 || (row->reversed_p && row->truncated_on_left_p)) 1227 || (row->reversed_p && row->truncated_on_left_p))
1095 right = RIGHT_FRINGE (0, Qtruncation, 0); 1228 right = RIGHT_FRINGE (0, Qtruncation, 0);
1096 else if (row->indicate_bob_p && EQ (boundary_top, Qright)) 1229 else if (row->indicate_bob_p && EQ (boundary_top, Qright))
1097 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) 1230 {
1098 ? RIGHT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) 1231 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
1099 : RIGHT_FRINGE (2, Qtop, 0)); 1232 ? RIGHT_FRINGE (1, Qtop_bottom, top_row_ends_at_zv_p)
1233 : RIGHT_FRINGE (2, Qtop, 0));
1234 if (top_ind_min_y >= 0)
1235 right_offset = top_ind_min_y - row->y;
1236 }
1100 else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) 1237 else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
1101 right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); 1238 {
1102 else if ((!row->reversed_p && row->continued_p) 1239 right = RIGHT_FRINGE (3, Qbottom, bot_row_ends_at_zv_p);
1103 || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))) 1240 if (bot_ind_max_y >= 0)
1241 right_offset = bot_ind_max_y - (row->y + row->visible_height);
1242 }
1243 else if (row->continued_p)
1104 right = RIGHT_FRINGE (4, Qcontinuation, 0); 1244 right = RIGHT_FRINGE (4, Qcontinuation, 0);
1105 else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) 1245 else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
1106 right = RIGHT_FRINGE (6, Qup, 0); 1246 {
1247 right = RIGHT_FRINGE (6, Qup, 0);
1248 if (top_ind_min_y >= 0)
1249 right_offset = top_ind_min_y - row->y;
1250 }
1107 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright)) 1251 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright))
1108 right = RIGHT_FRINGE (7, Qdown, 0); 1252 {
1253 right = RIGHT_FRINGE (7, Qdown, 0);
1254 if (bot_ind_max_y >= 0)
1255 right_offset = bot_ind_max_y - (row->y + row->visible_height);
1256 }
1109 else if (row->indicate_empty_line_p && EQ (empty_pos, Qright)) 1257 else if (row->indicate_empty_line_p && EQ (empty_pos, Qright))
1110 right = RIGHT_FRINGE (5, Qempty_line, 0); 1258 right = RIGHT_FRINGE (5, Qempty_line, 0);
1111 else 1259 else
@@ -1118,6 +1266,8 @@ update_window_fringes (struct window *w, int keep_current_p)
1118 || right != cur->right_fringe_bitmap 1266 || right != cur->right_fringe_bitmap
1119 || left_face_id != cur->left_fringe_face_id 1267 || left_face_id != cur->left_fringe_face_id
1120 || right_face_id != cur->right_fringe_face_id 1268 || right_face_id != cur->right_fringe_face_id
1269 || left_offset != cur->left_fringe_offset
1270 || right_offset != cur->right_fringe_offset
1121 || cur->redraw_fringe_bitmaps_p) 1271 || cur->redraw_fringe_bitmaps_p)
1122 { 1272 {
1123 redraw_p = row->redraw_fringe_bitmaps_p = 1; 1273 redraw_p = row->redraw_fringe_bitmaps_p = 1;
@@ -1128,6 +1278,8 @@ update_window_fringes (struct window *w, int keep_current_p)
1128 cur->right_fringe_bitmap = right; 1278 cur->right_fringe_bitmap = right;
1129 cur->left_fringe_face_id = left_face_id; 1279 cur->left_fringe_face_id = left_face_id;
1130 cur->right_fringe_face_id = right_face_id; 1280 cur->right_fringe_face_id = right_face_id;
1281 cur->left_fringe_offset = left_offset;
1282 cur->right_fringe_offset = right_offset;
1131 } 1283 }
1132 } 1284 }
1133 1285
@@ -1144,9 +1296,8 @@ update_window_fringes (struct window *w, int keep_current_p)
1144 row->right_fringe_bitmap = right; 1296 row->right_fringe_bitmap = right;
1145 row->left_fringe_face_id = left_face_id; 1297 row->left_fringe_face_id = left_face_id;
1146 row->right_fringe_face_id = right_face_id; 1298 row->right_fringe_face_id = right_face_id;
1147 1299 row->left_fringe_offset = left_offset;
1148 if (rn > 0 && row->redraw_fringe_bitmaps_p) 1300 row->right_fringe_offset = right_offset;
1149 row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1;
1150 } 1301 }
1151 1302
1152 return redraw_p && !keep_current_p; 1303 return redraw_p && !keep_current_p;
diff --git a/src/image.c b/src/image.c
index 064278eebbc..6e75921414b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1053,6 +1053,10 @@ free_image (struct frame *f, struct image *img)
1053 /* Free resources, then free IMG. */ 1053 /* Free resources, then free IMG. */
1054 img->type->free (f, img); 1054 img->type->free (f, img);
1055 xfree (img); 1055 xfree (img);
1056
1057 /* As display glyphs may still be referring to the image ID, we
1058 must garbage the frame (Bug#6426). */
1059 SET_FRAME_GARBAGED (f);
1056 } 1060 }
1057} 1061}
1058 1062
diff --git a/src/insdel.c b/src/insdel.c
index 8c6e8f6364d..8b0b2f7ab01 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1628,7 +1628,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1628void 1628void
1629replace_range_2 (EMACS_INT from, EMACS_INT from_byte, 1629replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
1630 EMACS_INT to, EMACS_INT to_byte, 1630 EMACS_INT to, EMACS_INT to_byte,
1631 char *ins, EMACS_INT inschars, EMACS_INT insbytes, 1631 const char *ins, EMACS_INT inschars, EMACS_INT insbytes,
1632 int markers) 1632 int markers)
1633{ 1633{
1634 EMACS_INT nbytes_del, nchars_del; 1634 EMACS_INT nbytes_del, nchars_del;
diff --git a/src/keyboard.c b/src/keyboard.c
index 6ea0b90b9b4..bf3a01fc481 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -42,7 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include "puresize.h" 42#include "puresize.h"
43#include "systime.h" 43#include "systime.h"
44#include "atimer.h" 44#include "atimer.h"
45#include <setjmp.h> 45#include "process.h"
46#include <errno.h> 46#include <errno.h>
47 47
48#ifdef HAVE_GTK_AND_PTHREAD 48#ifdef HAVE_GTK_AND_PTHREAD
@@ -1238,7 +1238,7 @@ cmd_error (Lisp_Object data)
1238 string. */ 1238 string. */
1239 1239
1240void 1240void
1241cmd_error_internal (Lisp_Object data, char *context) 1241cmd_error_internal (Lisp_Object data, const char *context)
1242{ 1242{
1243 struct frame *sf = SELECTED_FRAME (); 1243 struct frame *sf = SELECTED_FRAME ();
1244 1244
@@ -9000,48 +9000,48 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9000 int dont_downcase_last, int can_return_switch_frame, 9000 int dont_downcase_last, int can_return_switch_frame,
9001 int fix_current_buffer) 9001 int fix_current_buffer)
9002{ 9002{
9003 volatile Lisp_Object from_string; 9003 Lisp_Object from_string;
9004 volatile int count = SPECPDL_INDEX (); 9004 int count = SPECPDL_INDEX ();
9005 9005
9006 /* How many keys there are in the current key sequence. */ 9006 /* How many keys there are in the current key sequence. */
9007 volatile int t; 9007 int t;
9008 9008
9009 /* The length of the echo buffer when we started reading, and 9009 /* The length of the echo buffer when we started reading, and
9010 the length of this_command_keys when we started reading. */ 9010 the length of this_command_keys when we started reading. */
9011 volatile int echo_start; 9011 int echo_start;
9012 volatile int keys_start; 9012 int keys_start;
9013 9013
9014 /* The number of keymaps we're scanning right now, and the number of 9014 /* The number of keymaps we're scanning right now, and the number of
9015 keymaps we have allocated space for. */ 9015 keymaps we have allocated space for. */
9016 volatile int nmaps; 9016 int nmaps;
9017 volatile int nmaps_allocated = 0; 9017 int nmaps_allocated = 0;
9018 9018
9019 /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in 9019 /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in
9020 the current keymaps. */ 9020 the current keymaps. */
9021 Lisp_Object *volatile defs = NULL; 9021 Lisp_Object *defs = NULL;
9022 9022
9023 /* submaps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] 9023 /* submaps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1]
9024 in the current keymaps, or nil where it is not a prefix. */ 9024 in the current keymaps, or nil where it is not a prefix. */
9025 Lisp_Object *volatile submaps = NULL; 9025 Lisp_Object *submaps = NULL;
9026 9026
9027 /* The local map to start out with at start of key sequence. */ 9027 /* The local map to start out with at start of key sequence. */
9028 volatile Lisp_Object orig_local_map; 9028 Lisp_Object orig_local_map;
9029 9029
9030 /* The map from the `keymap' property to start out with at start of 9030 /* The map from the `keymap' property to start out with at start of
9031 key sequence. */ 9031 key sequence. */
9032 volatile Lisp_Object orig_keymap; 9032 Lisp_Object orig_keymap;
9033 9033
9034 /* 1 if we have already considered switching to the local-map property 9034 /* 1 if we have already considered switching to the local-map property
9035 of the place where a mouse click occurred. */ 9035 of the place where a mouse click occurred. */
9036 volatile int localized_local_map = 0; 9036 int localized_local_map = 0;
9037 9037
9038 /* The index in submaps[] of the first keymap that has a binding for 9038 /* The index in submaps[] of the first keymap that has a binding for
9039 this key sequence. In other words, the lowest i such that 9039 this key sequence. In other words, the lowest i such that
9040 submaps[i] is non-nil. */ 9040 submaps[i] is non-nil. */
9041 volatile int first_binding; 9041 int first_binding;
9042 /* Index of the first key that has no binding. 9042 /* Index of the first key that has no binding.
9043 It is useless to try fkey.start larger than that. */ 9043 It is useless to try fkey.start larger than that. */
9044 volatile int first_unbound; 9044 int first_unbound;
9045 9045
9046 /* If t < mock_input, then KEYBUF[t] should be read as the next 9046 /* If t < mock_input, then KEYBUF[t] should be read as the next
9047 input key. 9047 input key.
@@ -9056,7 +9056,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9056 restart_sequence; the loop will read keys from keybuf up until 9056 restart_sequence; the loop will read keys from keybuf up until
9057 mock_input, thus rebuilding the state; and then it will resume 9057 mock_input, thus rebuilding the state; and then it will resume
9058 reading characters from the keyboard. */ 9058 reading characters from the keyboard. */
9059 volatile int mock_input = 0; 9059 int mock_input = 0;
9060 9060
9061 /* If the sequence is unbound in submaps[], then 9061 /* If the sequence is unbound in submaps[], then
9062 keybuf[fkey.start..fkey.end-1] is a prefix in Vfunction_key_map, 9062 keybuf[fkey.start..fkey.end-1] is a prefix in Vfunction_key_map,
@@ -9066,28 +9066,28 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9066 should hold off until t reaches them. We do this when we've just 9066 should hold off until t reaches them. We do this when we've just
9067 recognized a function key, to avoid searching for the function 9067 recognized a function key, to avoid searching for the function
9068 key's again in Vfunction_key_map. */ 9068 key's again in Vfunction_key_map. */
9069 volatile keyremap fkey; 9069 keyremap fkey;
9070 9070
9071 /* Likewise, for key_translation_map and input-decode-map. */ 9071 /* Likewise, for key_translation_map and input-decode-map. */
9072 volatile keyremap keytran, indec; 9072 keyremap keytran, indec;
9073 9073
9074 /* Non-zero if we are trying to map a key by changing an upper-case 9074 /* Non-zero if we are trying to map a key by changing an upper-case
9075 letter to lower case, or a shifted function key to an unshifted 9075 letter to lower case, or a shifted function key to an unshifted
9076 one. */ 9076 one. */
9077 volatile int shift_translated = 0; 9077 int shift_translated = 0;
9078 9078
9079 /* If we receive a `switch-frame' or `select-window' event in the middle of 9079 /* If we receive a `switch-frame' or `select-window' event in the middle of
9080 a key sequence, we put it off for later. 9080 a key sequence, we put it off for later.
9081 While we're reading, we keep the event here. */ 9081 While we're reading, we keep the event here. */
9082 volatile Lisp_Object delayed_switch_frame; 9082 Lisp_Object delayed_switch_frame;
9083 9083
9084 /* See the comment below... */ 9084 /* See the comment below... */
9085#if defined (GOBBLE_FIRST_EVENT) 9085#if defined (GOBBLE_FIRST_EVENT)
9086 Lisp_Object first_event; 9086 Lisp_Object first_event;
9087#endif 9087#endif
9088 9088
9089 volatile Lisp_Object original_uppercase; 9089 Lisp_Object original_uppercase;
9090 volatile int original_uppercase_position = -1; 9090 int original_uppercase_position = -1;
9091 9091
9092 /* Gets around Microsoft compiler limitations. */ 9092 /* Gets around Microsoft compiler limitations. */
9093 int dummyflag = 0; 9093 int dummyflag = 0;
@@ -9095,7 +9095,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9095 struct buffer *starting_buffer; 9095 struct buffer *starting_buffer;
9096 9096
9097 /* List of events for which a fake prefix key has been generated. */ 9097 /* List of events for which a fake prefix key has been generated. */
9098 volatile Lisp_Object fake_prefixed_keys = Qnil; 9098 Lisp_Object fake_prefixed_keys = Qnil;
9099 9099
9100#if defined (GOBBLE_FIRST_EVENT) 9100#if defined (GOBBLE_FIRST_EVENT)
9101 int junk; 9101 int junk;
@@ -9252,13 +9252,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9252 (say, a mouse click on the mode line which is being treated 9252 (say, a mouse click on the mode line which is being treated
9253 as [mode-line (mouse-...)], then we backtrack to this point 9253 as [mode-line (mouse-...)], then we backtrack to this point
9254 of keybuf. */ 9254 of keybuf. */
9255 volatile int last_real_key_start; 9255 int last_real_key_start;
9256 9256
9257 /* These variables are analogous to echo_start and keys_start; 9257 /* These variables are analogous to echo_start and keys_start;
9258 while those allow us to restart the entire key sequence, 9258 while those allow us to restart the entire key sequence,
9259 echo_local_start and keys_local_start allow us to throw away 9259 echo_local_start and keys_local_start allow us to throw away
9260 just one key. */ 9260 just one key. */
9261 volatile int echo_local_start, keys_local_start, local_first_binding; 9261 int echo_local_start, keys_local_start, local_first_binding;
9262 9262
9263 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); 9263 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input));
9264 eassert (indec.start <= indec.end); 9264 eassert (indec.start <= indec.end);
diff --git a/src/keyboard.h b/src/keyboard.h
index 98c735023d7..a6eb750c373 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -468,7 +468,6 @@ extern void clear_waiting_for_input (void);
468extern void swallow_events (int); 468extern void swallow_events (int);
469extern int help_char_p (Lisp_Object); 469extern int help_char_p (Lisp_Object);
470extern void quit_throw_to_read_char (void) NO_RETURN; 470extern void quit_throw_to_read_char (void) NO_RETURN;
471extern void cmd_error_internal (Lisp_Object, char *);
472extern int lucid_event_type_list_p (Lisp_Object); 471extern int lucid_event_type_list_p (Lisp_Object);
473extern void kbd_buffer_store_event (struct input_event *); 472extern void kbd_buffer_store_event (struct input_event *);
474extern void kbd_buffer_store_event_hold (struct input_event *, 473extern void kbd_buffer_store_event_hold (struct input_event *,
diff --git a/src/keymap.c b/src/keymap.c
index 1245caf3b9b..40005a51008 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1126,11 +1126,13 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0,
1126 doc: /* In KEYMAP, define key sequence KEY as DEF. 1126 doc: /* In KEYMAP, define key sequence KEY as DEF.
1127KEYMAP is a keymap. 1127KEYMAP is a keymap.
1128 1128
1129KEY is a string or a vector of symbols and characters meaning a 1129KEY is a string or a vector of symbols and characters, representing a
1130sequence of keystrokes and events. Non-ASCII characters with codes 1130sequence of keystrokes and events. Non-ASCII characters with codes
1131above 127 (such as ISO Latin-1) can be included if you use a vector. 1131above 127 (such as ISO Latin-1) can be represented by vectors.
1132Using [t] for KEY creates a default definition, which applies to any 1132Two types of vector have special meanings:
1133event type that has no other definition in this keymap. 1133 [remap COMMAND] remaps any key binding for COMMAND.
1134 [t] creates a default definition, which applies to any event with no
1135 other definition in KEYMAP.
1134 1136
1135DEF is anything that can be a key's definition: 1137DEF is anything that can be a key's definition:
1136 nil (means key is undefined in this keymap), 1138 nil (means key is undefined in this keymap),
diff --git a/src/lisp.h b/src/lisp.h
index 02c9ed03e13..656e8fbb624 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -21,6 +21,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21#ifndef EMACS_LISP_H 21#ifndef EMACS_LISP_H
22#define EMACS_LISP_H 22#define EMACS_LISP_H
23 23
24#include <stdarg.h>
25#include <stddef.h>
26
24/* Use the configure flag --enable-checking[=LIST] to enable various 27/* Use the configure flag --enable-checking[=LIST] to enable various
25 types of run time checks for Lisp objects. */ 28 types of run time checks for Lisp objects. */
26 29
@@ -782,13 +785,6 @@ struct Lisp_String
782 unsigned char *data; 785 unsigned char *data;
783 }; 786 };
784 787
785#ifdef offsetof
786#define OFFSETOF(type,field) offsetof(type,field)
787#else
788#define OFFSETOF(type,field) \
789 ((int)((char*)&((type*)0)->field - (char*)0))
790#endif
791
792struct Lisp_Vector 788struct Lisp_Vector
793 { 789 {
794 EMACS_UINT size; 790 EMACS_UINT size;
@@ -799,7 +795,7 @@ struct Lisp_Vector
799/* If a struct is made to look like a vector, this macro returns the length 795/* If a struct is made to look like a vector, this macro returns the length
800 of the shortest vector that would hold that struct. */ 796 of the shortest vector that would hold that struct. */
801#define VECSIZE(type) ((sizeof (type) \ 797#define VECSIZE(type) ((sizeof (type) \
802 - OFFSETOF (struct Lisp_Vector, contents[0]) \ 798 - offsetof (struct Lisp_Vector, contents[0]) \
803 + sizeof(Lisp_Object) - 1) /* round up */ \ 799 + sizeof(Lisp_Object) - 1) /* round up */ \
804 / sizeof (Lisp_Object)) 800 / sizeof (Lisp_Object))
805 801
@@ -807,7 +803,7 @@ struct Lisp_Vector
807 at the end and we need to compute the number of Lisp_Object fields (the 803 at the end and we need to compute the number of Lisp_Object fields (the
808 ones that the GC needs to trace). */ 804 ones that the GC needs to trace). */
809#define PSEUDOVECSIZE(type, nonlispfield) \ 805#define PSEUDOVECSIZE(type, nonlispfield) \
810 ((OFFSETOF(type, nonlispfield) - OFFSETOF(struct Lisp_Vector, contents[0])) \ 806 ((offsetof(type, nonlispfield) - offsetof(struct Lisp_Vector, contents[0])) \
811 / sizeof (Lisp_Object)) 807 / sizeof (Lisp_Object))
812 808
813/* A char-table is a kind of vectorlike, with contents are like a 809/* A char-table is a kind of vectorlike, with contents are like a
@@ -2614,7 +2610,7 @@ extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT,
2614 EMACS_INT, EMACS_INT); 2610 EMACS_INT, EMACS_INT);
2615extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int); 2611extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int);
2616extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, 2612extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
2617 char *, EMACS_INT, EMACS_INT, int); 2613 const char *, EMACS_INT, EMACS_INT, int);
2618extern void syms_of_insdel (void); 2614extern void syms_of_insdel (void);
2619 2615
2620/* Defined in dispnew.c */ 2616/* Defined in dispnew.c */
@@ -2648,16 +2644,16 @@ extern void restore_message (void);
2648extern Lisp_Object current_message (void); 2644extern Lisp_Object current_message (void);
2649extern void set_message (const char *s, Lisp_Object, int, int); 2645extern void set_message (const char *s, Lisp_Object, int, int);
2650extern void clear_message (int, int); 2646extern void clear_message (int, int);
2651extern void message (/* char *, ... */); 2647extern void message (const char *, ...);
2652extern void message_nolog (/* char *, ... */); 2648extern void message_nolog (const char *, ...);
2653extern void message1 (char *); 2649extern void message1 (const char *);
2654extern void message1_nolog (char *); 2650extern void message1_nolog (const char *);
2655extern void message2 (const char *, int, int); 2651extern void message2 (const char *, int, int);
2656extern void message2_nolog (const char *, int, int); 2652extern void message2_nolog (const char *, int, int);
2657extern void message3 (Lisp_Object, int, int); 2653extern void message3 (Lisp_Object, int, int);
2658extern void message3_nolog (Lisp_Object, int, int); 2654extern void message3_nolog (Lisp_Object, int, int);
2659extern void message_dolog (const char *, int, int, int); 2655extern void message_dolog (const char *, int, int, int);
2660extern void message_with_string (char *, Lisp_Object, int); 2656extern void message_with_string (const char *, Lisp_Object, int);
2661extern void message_log_maybe_newline (void); 2657extern void message_log_maybe_newline (void);
2662extern void update_echo_area (void); 2658extern void update_echo_area (void);
2663extern void truncate_echo_area (int); 2659extern void truncate_echo_area (int);
@@ -2678,14 +2674,14 @@ extern int pos_visible_p (struct window *, int, int *,
2678extern void syms_of_xsettings (void); 2674extern void syms_of_xsettings (void);
2679 2675
2680/* Defined in vm-limit.c. */ 2676/* Defined in vm-limit.c. */
2681extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (char*)); 2677extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (const char *));
2682 2678
2683/* Defined in alloc.c */ 2679/* Defined in alloc.c */
2684extern void check_pure_size (void); 2680extern void check_pure_size (void);
2685extern void allocate_string_data (struct Lisp_String *, int, int); 2681extern void allocate_string_data (struct Lisp_String *, int, int);
2686extern void reset_malloc_hooks (void); 2682extern void reset_malloc_hooks (void);
2687extern void uninterrupt_malloc (void); 2683extern void uninterrupt_malloc (void);
2688extern void malloc_warning (char *); 2684extern void malloc_warning (const char *);
2689extern void memory_full (void) NO_RETURN; 2685extern void memory_full (void) NO_RETURN;
2690extern void buffer_memory_full (void) NO_RETURN; 2686extern void buffer_memory_full (void) NO_RETURN;
2691extern int survives_gc_p (Lisp_Object); 2687extern int survives_gc_p (Lisp_Object);
@@ -2789,16 +2785,17 @@ extern Lisp_Object Qexternal_debugging_output;
2789extern void temp_output_buffer_setup (const char *); 2785extern void temp_output_buffer_setup (const char *);
2790extern int print_level, print_escape_newlines; 2786extern int print_level, print_escape_newlines;
2791extern Lisp_Object Qprint_escape_newlines; 2787extern Lisp_Object Qprint_escape_newlines;
2792extern void write_string (char *, int); 2788extern void write_string (const char *, int);
2793extern void write_string_1 (char *, int, Lisp_Object); 2789extern void write_string_1 (const char *, int, Lisp_Object);
2794extern void print_error_message (Lisp_Object, Lisp_Object, char *, Lisp_Object); 2790extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
2791 Lisp_Object);
2795extern Lisp_Object internal_with_output_to_temp_buffer 2792extern Lisp_Object internal_with_output_to_temp_buffer
2796 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); 2793 (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
2797extern void float_to_string (unsigned char *, double); 2794extern void float_to_string (unsigned char *, double);
2798extern void syms_of_print (void); 2795extern void syms_of_print (void);
2799 2796
2800/* Defined in doprnt.c */ 2797/* Defined in doprnt.c */
2801extern int doprnt (char *, int, char *, char *, int, char **); 2798extern int doprnt (char *, int, const char *, const char *, va_list);
2802 2799
2803/* Defined in lread.c */ 2800/* Defined in lread.c */
2804extern Lisp_Object Qvariable_documentation, Qstandard_input; 2801extern Lisp_Object Qvariable_documentation, Qstandard_input;
@@ -2817,7 +2814,7 @@ EXFUN (Feval_region, 4);
2817extern Lisp_Object check_obarray (Lisp_Object); 2814extern Lisp_Object check_obarray (Lisp_Object);
2818extern Lisp_Object intern (const char *); 2815extern Lisp_Object intern (const char *);
2819extern Lisp_Object intern_c_string (const char *); 2816extern Lisp_Object intern_c_string (const char *);
2820extern Lisp_Object make_symbol (char *); 2817extern Lisp_Object make_symbol (const char *);
2821extern Lisp_Object oblookup (Lisp_Object, const char *, int, int); 2818extern Lisp_Object oblookup (Lisp_Object, const char *, int, int);
2822#define LOADHIST_ATTACH(x) \ 2819#define LOADHIST_ATTACH(x) \
2823 do { \ 2820 do { \
@@ -2827,10 +2824,10 @@ extern Lisp_Object Vcurrent_load_list;
2827extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes; 2824extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
2828extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, 2825extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
2829 Lisp_Object *, Lisp_Object); 2826 Lisp_Object *, Lisp_Object);
2830extern int isfloat_string (char *, int); 2827extern int isfloat_string (const char *, int);
2831extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), 2828extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
2832 Lisp_Object); 2829 Lisp_Object);
2833extern void dir_warning (char *, Lisp_Object); 2830extern void dir_warning (const char *, Lisp_Object);
2834extern void close_load_descs (void); 2831extern void close_load_descs (void);
2835extern void init_obarray (void); 2832extern void init_obarray (void);
2836extern void init_lread (void); 2833extern void init_lread (void);
@@ -2883,7 +2880,7 @@ extern void xsignal0 (Lisp_Object) NO_RETURN;
2883extern void xsignal1 (Lisp_Object, Lisp_Object) NO_RETURN; 2880extern void xsignal1 (Lisp_Object, Lisp_Object) NO_RETURN;
2884extern void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; 2881extern void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN;
2885extern void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN; 2882extern void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN;
2886extern void signal_error (char *, Lisp_Object) NO_RETURN; 2883extern void signal_error (const char *, Lisp_Object) NO_RETURN;
2887EXFUN (Fautoload, 5); 2884EXFUN (Fautoload, 5);
2888EXFUN (Fcommandp, 2); 2885EXFUN (Fcommandp, 2);
2889EXFUN (Feval, 1); 2886EXFUN (Feval, 1);
@@ -2910,7 +2907,7 @@ extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (int, Lisp_Object
2910extern void specbind (Lisp_Object, Lisp_Object); 2907extern void specbind (Lisp_Object, Lisp_Object);
2911extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); 2908extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
2912extern Lisp_Object unbind_to (int, Lisp_Object); 2909extern Lisp_Object unbind_to (int, Lisp_Object);
2913extern void error (/* char *, ... */) NO_RETURN; 2910extern void error (const char *, ...) NO_RETURN;
2914extern void do_autoload (Lisp_Object, Lisp_Object); 2911extern void do_autoload (Lisp_Object, Lisp_Object);
2915extern Lisp_Object un_autoload (Lisp_Object); 2912extern Lisp_Object un_autoload (Lisp_Object);
2916EXFUN (Ffetch_bytecode, 1); 2913EXFUN (Ffetch_bytecode, 1);
@@ -2949,7 +2946,7 @@ EXFUN (Fbolp, 0);
2949EXFUN (Fbobp, 0); 2946EXFUN (Fbobp, 0);
2950EXFUN (Fformat, MANY); 2947EXFUN (Fformat, MANY);
2951EXFUN (Fmessage, MANY); 2948EXFUN (Fmessage, MANY);
2952extern Lisp_Object format2 (char *, Lisp_Object, Lisp_Object); 2949extern Lisp_Object format2 (const char *, Lisp_Object, Lisp_Object);
2953EXFUN (Fbuffer_substring, 2); 2950EXFUN (Fbuffer_substring, 2);
2954EXFUN (Fbuffer_string, 0); 2951EXFUN (Fbuffer_string, 0);
2955extern Lisp_Object save_excursion_save (void); 2952extern Lisp_Object save_excursion_save (void);
@@ -2975,7 +2972,7 @@ EXFUN (Fdelete_field, 1);
2975EXFUN (Ffield_beginning, 3); 2972EXFUN (Ffield_beginning, 3);
2976EXFUN (Ffield_end, 3); 2973EXFUN (Ffield_end, 3);
2977EXFUN (Ffield_string_no_properties, 1); 2974EXFUN (Ffield_string_no_properties, 1);
2978extern void set_time_zone_rule (char *); 2975extern void set_time_zone_rule (const char *);
2979 2976
2980/* Defined in buffer.c */ 2977/* Defined in buffer.c */
2981extern int mouse_face_overlay_overlaps (Lisp_Object); 2978extern int mouse_face_overlay_overlaps (Lisp_Object);
@@ -3175,7 +3172,7 @@ extern int detect_input_pending (void);
3175extern int detect_input_pending_ignore_squeezables (void); 3172extern int detect_input_pending_ignore_squeezables (void);
3176extern int detect_input_pending_run_timers (int); 3173extern int detect_input_pending_run_timers (int);
3177extern void safe_run_hooks (Lisp_Object); 3174extern void safe_run_hooks (Lisp_Object);
3178extern void cmd_error_internal (Lisp_Object, char *); 3175extern void cmd_error_internal (Lisp_Object, const char *);
3179extern Lisp_Object command_loop_1 (void); 3176extern Lisp_Object command_loop_1 (void);
3180extern Lisp_Object recursive_edit_1 (void); 3177extern Lisp_Object recursive_edit_1 (void);
3181extern void record_auto_save (void); 3178extern void record_auto_save (void);
@@ -3239,7 +3236,7 @@ extern void frames_bury_buffer (Lisp_Object);
3239extern void syms_of_frame (void); 3236extern void syms_of_frame (void);
3240 3237
3241/* Defined in emacs.c */ 3238/* Defined in emacs.c */
3242extern Lisp_Object decode_env_path (char *, char *); 3239extern Lisp_Object decode_env_path (const char *, const char *);
3243extern Lisp_Object Vinvocation_name, Vinvocation_directory; 3240extern Lisp_Object Vinvocation_name, Vinvocation_directory;
3244extern Lisp_Object Vbefore_init_time, Vafter_init_time; 3241extern Lisp_Object Vbefore_init_time, Vafter_init_time;
3245extern Lisp_Object Vinstallation_directory; 3242extern Lisp_Object Vinstallation_directory;
@@ -3525,7 +3522,7 @@ extern void xfree (POINTER_TYPE *);
3525 3522
3526extern char *xstrdup (const char *); 3523extern char *xstrdup (const char *);
3527 3524
3528extern char *egetenv (char *); 3525extern char *egetenv (const char *);
3529 3526
3530/* Set up the name of the machine we're running on. */ 3527/* Set up the name of the machine we're running on. */
3531extern void init_system_name (void); 3528extern void init_system_name (void);
diff --git a/src/lread.c b/src/lread.c
index 42925f8ac09..79214936f4c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2316,28 +2316,28 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2316 /* This is repetitive but fast and simple. */ 2316 /* This is repetitive but fast and simple. */
2317 params[param_count] = QCsize; 2317 params[param_count] = QCsize;
2318 params[param_count+1] = Fplist_get (tmp, Qsize); 2318 params[param_count+1] = Fplist_get (tmp, Qsize);
2319 if (!NILP (params[param_count+1])) 2319 if (!NILP (params[param_count + 1]))
2320 param_count+=2; 2320 param_count += 2;
2321 2321
2322 params[param_count] = QCtest; 2322 params[param_count] = QCtest;
2323 params[param_count+1] = Fplist_get (tmp, Qtest); 2323 params[param_count+1] = Fplist_get (tmp, Qtest);
2324 if (!NILP (params[param_count+1])) 2324 if (!NILP (params[param_count + 1]))
2325 param_count+=2; 2325 param_count += 2;
2326 2326
2327 params[param_count] = QCweakness; 2327 params[param_count] = QCweakness;
2328 params[param_count+1] = Fplist_get (tmp, Qweakness); 2328 params[param_count+1] = Fplist_get (tmp, Qweakness);
2329 if (!NILP (params[param_count+1])) 2329 if (!NILP (params[param_count + 1]))
2330 param_count+=2; 2330 param_count += 2;
2331 2331
2332 params[param_count] = QCrehash_size; 2332 params[param_count] = QCrehash_size;
2333 params[param_count+1] = Fplist_get (tmp, Qrehash_size); 2333 params[param_count+1] = Fplist_get (tmp, Qrehash_size);
2334 if (!NILP (params[param_count+1])) 2334 if (!NILP (params[param_count + 1]))
2335 param_count+=2; 2335 param_count += 2;
2336 2336
2337 params[param_count] = QCrehash_threshold; 2337 params[param_count] = QCrehash_threshold;
2338 params[param_count+1] = Fplist_get (tmp, Qrehash_threshold); 2338 params[param_count+1] = Fplist_get (tmp, Qrehash_threshold);
2339 if (!NILP (params[param_count+1])) 2339 if (!NILP (params[param_count + 1]))
2340 param_count+=2; 2340 param_count += 2;
2341 2341
2342 /* This is the hashtable data. */ 2342 /* This is the hashtable data. */
2343 data = Fplist_get (tmp, Qdata); 2343 data = Fplist_get (tmp, Qdata);
@@ -2358,6 +2358,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2358 2358
2359 return ht; 2359 return ht;
2360 } 2360 }
2361 UNREAD (c);
2362 invalid_syntax ("#", 1);
2361 } 2363 }
2362 if (c == '^') 2364 if (c == '^')
2363 { 2365 {
@@ -2723,7 +2725,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2723 2725
2724 ok = (next_next_char <= 040 2726 ok = (next_next_char <= 040
2725 || (next_next_char < 0200 2727 || (next_next_char < 0200
2726 && (index ("\"';([#?", next_next_char) 2728 && (strchr ("\"';([#?", next_next_char)
2727 || (!first_in_list && next_next_char == '`') 2729 || (!first_in_list && next_next_char == '`')
2728 || (new_backquote_flag && next_next_char == ',')))); 2730 || (new_backquote_flag && next_next_char == ','))));
2729 } 2731 }
@@ -2731,7 +2733,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2731 { 2733 {
2732 ok = (next_char <= 040 2734 ok = (next_char <= 040
2733 || (next_char < 0200 2735 || (next_char < 0200
2734 && (index ("\"';()[]#?", next_char) 2736 && (strchr ("\"';()[]#?", next_char)
2735 || (!first_in_list && next_char == '`') 2737 || (!first_in_list && next_char == '`')
2736 || (new_backquote_flag && next_char == ',')))); 2738 || (new_backquote_flag && next_char == ','))));
2737 } 2739 }
@@ -2876,7 +2878,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2876 2878
2877 if (next_char <= 040 2879 if (next_char <= 040
2878 || (next_char < 0200 2880 || (next_char < 0200
2879 && (index ("\"';([#?", next_char) 2881 && (strchr ("\"';([#?", next_char)
2880 || (!first_in_list && next_char == '`') 2882 || (!first_in_list && next_char == '`')
2881 || (new_backquote_flag && next_char == ',')))) 2883 || (new_backquote_flag && next_char == ','))))
2882 { 2884 {
@@ -2903,7 +2905,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2903 while (c > 040 2905 while (c > 040
2904 && c != 0x8a0 /* NBSP */ 2906 && c != 0x8a0 /* NBSP */
2905 && (c >= 0200 2907 && (c >= 0200
2906 || (!index ("\"';()[]#", c) 2908 || (!strchr ("\"';()[]#", c)
2907 && !(!first_in_list && c == '`') 2909 && !(!first_in_list && c == '`')
2908 && !(new_backquote_flag && c == ',')))) 2910 && !(new_backquote_flag && c == ','))))
2909 { 2911 {
@@ -3188,11 +3190,10 @@ substitute_in_interval (INTERVAL interval, Lisp_Object arg)
3188#define EXP_INT 16 3190#define EXP_INT 16
3189 3191
3190int 3192int
3191isfloat_string (register char *cp, int ignore_trailing) 3193isfloat_string (const char *cp, int ignore_trailing)
3192{ 3194{
3193 register int state; 3195 int state;
3194 3196 const char *start = cp;
3195 char *start = cp;
3196 3197
3197 state = 0; 3198 state = 0;
3198 if (*cp == '+' || *cp == '-') 3199 if (*cp == '+' || *cp == '-')
@@ -3243,7 +3244,8 @@ isfloat_string (register char *cp, int ignore_trailing)
3243 } 3244 }
3244 3245
3245 return ((ignore_trailing 3246 return ((ignore_trailing
3246 || (*cp == 0) || (*cp == ' ') || (*cp == '\t') || (*cp == '\n') || (*cp == '\r') || (*cp == '\f')) 3247 || *cp == 0 || *cp == ' ' || *cp == '\t' || *cp == '\n'
3248 || *cp == '\r' || *cp == '\f')
3247 && (state == (LEAD_INT|DOT_CHAR|TRAIL_INT) 3249 && (state == (LEAD_INT|DOT_CHAR|TRAIL_INT)
3248 || state == (DOT_CHAR|TRAIL_INT) 3250 || state == (DOT_CHAR|TRAIL_INT)
3249 || state == (LEAD_INT|E_CHAR|EXP_INT) 3251 || state == (LEAD_INT|E_CHAR|EXP_INT)
@@ -3586,13 +3588,13 @@ intern_c_string (const char *str)
3586/* Create an uninterned symbol with name STR. */ 3588/* Create an uninterned symbol with name STR. */
3587 3589
3588Lisp_Object 3590Lisp_Object
3589make_symbol (char *str) 3591make_symbol (const char *str)
3590{ 3592{
3591 int len = strlen (str); 3593 int len = strlen (str);
3592 3594
3593 return Fmake_symbol ((!NILP (Vpurify_flag) 3595 return Fmake_symbol (!NILP (Vpurify_flag)
3594 ? make_pure_string (str, len, len, 0) 3596 ? make_pure_string (str, len, len, 0)
3595 : make_string (str, len))); 3597 : make_string (str, len));
3596} 3598}
3597 3599
3598DEFUN ("intern", Fintern, Sintern, 1, 2, 0, 3600DEFUN ("intern", Fintern, Sintern, 1, 2, 0,
@@ -4168,7 +4170,7 @@ init_lread (void)
4168 does not exist. Print it on stderr and put it in *Messages*. */ 4170 does not exist. Print it on stderr and put it in *Messages*. */
4169 4171
4170void 4172void
4171dir_warning (char *format, Lisp_Object dirname) 4173dir_warning (const char *format, Lisp_Object dirname)
4172{ 4174{
4173 char *buffer 4175 char *buffer
4174 = (char *) alloca (SCHARS (dirname) + strlen (format) + 5); 4176 = (char *) alloca (SCHARS (dirname) + strlen (format) + 5);
diff --git a/src/msdos.c b/src/msdos.c
index 668243ef422..8bfdce22fcd 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2074,10 +2074,6 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
2074 unsigned long orig_fg, orig_bg; 2074 unsigned long orig_fg, orig_bg;
2075 Lisp_Object frame_bg, frame_fg; 2075 Lisp_Object frame_bg, frame_fg;
2076 struct tty_display_info *tty = FRAME_TTY (f); 2076 struct tty_display_info *tty = FRAME_TTY (f);
2077 extern Lisp_Object Qmenu_bar_lines;
2078 extern Lisp_Object Vmenu_bar_mode;
2079 int menu_bar_lines_defined =
2080 !NILP (Fassq (Qmenu_bar_lines, Vdefault_frame_alist));
2081 2077
2082 /* If we are creating a new frame, begin with the original screen colors 2078 /* If we are creating a new frame, begin with the original screen colors
2083 used for the initial frame. */ 2079 used for the initial frame. */
@@ -2116,8 +2112,6 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
2116 2112
2117 if (EQ (prop, Qreverse)) 2113 if (EQ (prop, Qreverse))
2118 reverse = EQ (val, Qt); 2114 reverse = EQ (val, Qt);
2119 else if (!menu_bar_lines_defined && EQ (prop, Qmenu_bar_lines))
2120 menu_bar_lines_defined = 1;
2121 } 2115 }
2122 2116
2123 if (tty->termscript && reverse) 2117 if (tty->termscript && reverse)
@@ -2217,18 +2211,6 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
2217 store_frame_param (f, prop, val); 2211 store_frame_param (f, prop, val);
2218 } 2212 }
2219 2213
2220 /* If menu-bar-lines is neither in the frame parameters nor in
2221 default-frame-alist, set it according to menu-bar-mode. */
2222 if (!menu_bar_lines_defined)
2223 {
2224 store_frame_param (f, Qmenu_bar_lines,
2225 NILP (Vmenu_bar_mode)
2226 ? make_number (0) : make_number (1));
2227 if (tty->termscript)
2228 fprintf (tty->termscript, "<MENU BAR LINES DEFAULTED: %d\n",
2229 !NILP (Vmenu_bar_mode));
2230 }
2231
2232 /* If they specified "reverse", but not the colors, we need to swap 2214 /* If they specified "reverse", but not the colors, we need to swap
2233 the current frame colors. */ 2215 the current frame colors. */
2234 if (reverse) 2216 if (reverse)
@@ -4719,13 +4701,6 @@ abort (void)
4719} 4701}
4720#endif 4702#endif
4721 4703
4722/* The following variables are required so that cus-start.el won't
4723 complain about unbound variables. */
4724#ifndef subprocesses
4725/* Nonzero means delete a process right away if it exits (process.c). */
4726static int delete_exited_processes;
4727#endif
4728
4729void 4704void
4730syms_of_msdos (void) 4705syms_of_msdos (void)
4731{ 4706{
@@ -4744,12 +4719,6 @@ This variable is used only by MS-DOS terminals. */);
4744 Vdos_unsupported_char_glyph = make_number ('\177'); 4719 Vdos_unsupported_char_glyph = make_number ('\177');
4745 4720
4746#endif 4721#endif
4747#ifndef subprocesses
4748 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
4749 doc: /* *Non-nil means delete processes immediately when they exit.
4750A value of nil means don't delete them until `list-processes' is run. */);
4751 delete_exited_processes = 0;
4752#endif
4753 4722
4754 defsubr (&Srecent_doskeys); 4723 defsubr (&Srecent_doskeys);
4755 defsubr (&Smsdos_long_file_names); 4724 defsubr (&Smsdos_long_file_names);
diff --git a/src/nsterm.m b/src/nsterm.m
index 62f1c0bcd57..58245f4aebf 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2177,20 +2177,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2177 2177
2178 /* Must clip because of partially visible lines. */ 2178 /* Must clip because of partially visible lines. */
2179 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 2179 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
2180 if (p->y < rowY) 2180 ns_clip_to_row (w, row, -1, YES);
2181 {
2182 /* Adjust position of "bottom aligned" bitmap on partially
2183 visible last row. */
2184 int oldY = row->y;
2185 int oldVH = row->visible_height;
2186 row->visible_height = p->h;
2187 row->y -= rowY - p->y;
2188 ns_clip_to_row (w, row, -1, NO);
2189 row->y = oldY;
2190 row->visible_height = oldVH;
2191 }
2192 else
2193 ns_clip_to_row (w, row, -1, YES);
2194 2181
2195 if (p->bx >= 0 && !p->overlay_p) 2182 if (p->bx >= 0 && !p->overlay_p)
2196 { 2183 {
diff --git a/src/print.c b/src/print.c
index 0a0e6c7452c..97f6494678f 100644
--- a/src/print.c
+++ b/src/print.c
@@ -540,7 +540,7 @@ PRINTCHARFUN defaults to the value of `standard-output' (which see). */)
540 Do not use this on the contents of a Lisp string. */ 540 Do not use this on the contents of a Lisp string. */
541 541
542void 542void
543write_string (char *data, int size) 543write_string (const char *data, int size)
544{ 544{
545 PRINTDECLARE; 545 PRINTDECLARE;
546 Lisp_Object printcharfun; 546 Lisp_Object printcharfun;
@@ -557,7 +557,7 @@ write_string (char *data, int size)
557 Do not use this on the contents of a Lisp string. */ 557 Do not use this on the contents of a Lisp string. */
558 558
559void 559void
560write_string_1 (char *data, int size, Lisp_Object printcharfun) 560write_string_1 (const char *data, int size, Lisp_Object printcharfun)
561{ 561{
562 PRINTDECLARE; 562 PRINTDECLARE;
563 563
@@ -1007,7 +1007,8 @@ error message is constructed. */)
1007 CALLER is the Lisp function inside which the error was signaled. */ 1007 CALLER is the Lisp function inside which the error was signaled. */
1008 1008
1009void 1009void
1010print_error_message (Lisp_Object data, Lisp_Object stream, char *context, Lisp_Object caller) 1010print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
1011 Lisp_Object caller)
1011{ 1012{
1012 Lisp_Object errname, errmsg, file_error, tail; 1013 Lisp_Object errname, errmsg, file_error, tail;
1013 struct gcpro gcpro1; 1014 struct gcpro gcpro1;
diff --git a/src/process.c b/src/process.c
index 1eefae1adc9..0fec550ad8f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -21,17 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <signal.h> 23#include <signal.h>
24
25/* This file is split into two parts by the following preprocessor
26 conditional. The 'then' clause contains all of the support for
27 asynchronous subprocesses. The 'else' clause contains stub
28 versions of some of the asynchronous subprocess routines that are
29 often called elsewhere in Emacs, so we don't have to #ifdef the
30 sections that call them. */
31
32
33#ifdef subprocesses
34
35#include <stdio.h> 24#include <stdio.h>
36#include <errno.h> 25#include <errno.h>
37#include <setjmp.h> 26#include <setjmp.h>
@@ -51,6 +40,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#endif 40#endif
52#include <fcntl.h> 41#include <fcntl.h>
53 42
43/* Only MS-DOS does not define `subprocesses'. */
44#ifdef subprocesses
45
54#ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ 46#ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */
55#include <sys/socket.h> 47#include <sys/socket.h>
56#include <netdb.h> 48#include <netdb.h>
@@ -101,6 +93,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
101#include <resolv.h> 93#include <resolv.h>
102#endif 94#endif
103 95
96#endif /* subprocesses */
97
104#include "lisp.h" 98#include "lisp.h"
105#include "systime.h" 99#include "systime.h"
106#include "systty.h" 100#include "systty.h"
@@ -119,11 +113,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
119#include "dispextern.h" 113#include "dispextern.h"
120#include "composite.h" 114#include "composite.h"
121#include "atimer.h" 115#include "atimer.h"
116#include "sysselect.h"
117#include "syssignal.h"
118#include "syswait.h"
122 119
123#if defined (USE_GTK) || defined (HAVE_GCONF) 120#if defined (USE_GTK) || defined (HAVE_GCONF)
124#include "xgselect.h" 121#include "xgselect.h"
125#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ 122#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
126 123
124#ifdef subprocesses
125
127Lisp_Object Qprocessp; 126Lisp_Object Qprocessp;
128Lisp_Object Qrun, Qstop, Qsignal; 127Lisp_Object Qrun, Qstop, Qsignal;
129Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten; 128Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
@@ -135,7 +134,7 @@ Lisp_Object Qipv6;
135Lisp_Object QCport, QCspeed, QCprocess; 134Lisp_Object QCport, QCspeed, QCprocess;
136Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven; 135Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
137Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; 136Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
138Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype; 137Lisp_Object QCbuffer, QChost, QCservice;
139Lisp_Object QClocal, QCremote, QCcoding; 138Lisp_Object QClocal, QCremote, QCcoding;
140Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; 139Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
141Lisp_Object QCsentinel, QClog, QCoptions, QCplist; 140Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
@@ -151,11 +150,6 @@ extern Lisp_Object QCfamily;
151/* QCfilter is defined in keyboard.c. */ 150/* QCfilter is defined in keyboard.c. */
152extern Lisp_Object QCfilter; 151extern Lisp_Object QCfilter;
153 152
154Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
155Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
156Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
157Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
158
159#ifdef HAVE_SOCKETS 153#ifdef HAVE_SOCKETS
160#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) 154#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
161#define NETCONN1_P(p) (EQ ((p)->type, Qnetwork)) 155#define NETCONN1_P(p) (EQ ((p)->type, Qnetwork))
@@ -178,10 +172,6 @@ Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
178#define SIGCHLD SIGCLD 172#define SIGCHLD SIGCLD
179#endif /* SIGCLD */ 173#endif /* SIGCLD */
180 174
181#include "syssignal.h"
182
183#include "syswait.h"
184
185extern char *get_operating_system_release (void); 175extern char *get_operating_system_release (void);
186 176
187/* Serial processes require termios or Windows. */ 177/* Serial processes require termios or Windows. */
@@ -282,9 +272,6 @@ static Lisp_Object Vprocess_adaptive_read_buffering;
282#define process_output_delay_count 0 272#define process_output_delay_count 0
283#endif 273#endif
284 274
285
286#include "sysselect.h"
287
288static int keyboard_bit_set (SELECT_TYPE *); 275static int keyboard_bit_set (SELECT_TYPE *);
289static void deactivate_process (Lisp_Object); 276static void deactivate_process (Lisp_Object);
290static void status_notify (struct Lisp_Process *); 277static void status_notify (struct Lisp_Process *);
@@ -300,16 +287,29 @@ static void create_pty (Lisp_Object);
300static Lisp_Object get_process (register Lisp_Object name); 287static Lisp_Object get_process (register Lisp_Object name);
301static void exec_sentinel (Lisp_Object proc, Lisp_Object reason); 288static void exec_sentinel (Lisp_Object proc, Lisp_Object reason);
302 289
303extern int timers_run; 290#endif /* subprocesses */
304
305/* Mask of bits indicating the descriptors that we wait for input on. */
306 291
307static SELECT_TYPE input_wait_mask; 292extern int timers_run;
308 293
294Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
295Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
296Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
297Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
298Lisp_Object QCname, QCtype;
299
309/* Non-zero if keyboard input is on hold, zero otherwise. */ 300/* Non-zero if keyboard input is on hold, zero otherwise. */
310 301
311static int kbd_is_on_hold; 302static int kbd_is_on_hold;
312 303
304/* Nonzero means delete a process right away if it exits. */
305static int delete_exited_processes;
306
307#ifdef subprocesses
308
309/* Mask of bits indicating the descriptors that we wait for input on. */
310
311static SELECT_TYPE input_wait_mask;
312
313/* Mask that excludes keyboard input descriptor(s). */ 313/* Mask that excludes keyboard input descriptor(s). */
314 314
315static SELECT_TYPE non_keyboard_wait_mask; 315static SELECT_TYPE non_keyboard_wait_mask;
@@ -333,9 +333,9 @@ static SELECT_TYPE connect_wait_mask;
333static int num_pending_connects; 333static int num_pending_connects;
334 334
335#define IF_NON_BLOCKING_CONNECT(s) s 335#define IF_NON_BLOCKING_CONNECT(s) s
336#else 336#else /* NON_BLOCKING_CONNECT */
337#define IF_NON_BLOCKING_CONNECT(s) 337#define IF_NON_BLOCKING_CONNECT(s)
338#endif 338#endif /* NON_BLOCKING_CONNECT */
339 339
340/* The largest descriptor currently in use for a process object. */ 340/* The largest descriptor currently in use for a process object. */
341static int max_process_desc; 341static int max_process_desc;
@@ -346,9 +346,6 @@ static int max_keyboard_desc;
346/* The largest descriptor currently in use for gpm mouse input. */ 346/* The largest descriptor currently in use for gpm mouse input. */
347static int max_gpm_desc; 347static int max_gpm_desc;
348 348
349/* Nonzero means delete a process right away if it exits. */
350static int delete_exited_processes;
351
352/* Indexed by descriptor, gives the process (if any) for that descriptor */ 349/* Indexed by descriptor, gives the process (if any) for that descriptor */
353Lisp_Object chan_process[MAXDESC]; 350Lisp_Object chan_process[MAXDESC];
354 351
@@ -695,26 +692,6 @@ DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
695 return Fcdr (Fassoc (name, Vprocess_alist)); 692 return Fcdr (Fassoc (name, Vprocess_alist));
696} 693}
697 694
698DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
699 doc: /* Return the (or a) process associated with BUFFER.
700BUFFER may be a buffer or the name of one. */)
701 (register Lisp_Object buffer)
702{
703 register Lisp_Object buf, tail, proc;
704
705 if (NILP (buffer)) return Qnil;
706 buf = Fget_buffer (buffer);
707 if (NILP (buf)) return Qnil;
708
709 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
710 {
711 proc = Fcdr (XCAR (tail));
712 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
713 return proc;
714 }
715 return Qnil;
716}
717
718/* This is how commands for the user decode process arguments. It 695/* This is how commands for the user decode process arguments. It
719 accepts a process, a process name, a buffer, a buffer name, or nil. 696 accepts a process, a process name, a buffer, a buffer name, or nil.
720 Buffers denote the first process in the buffer, and nil denotes the 697 Buffers denote the first process in the buffer, and nil denotes the
@@ -1096,19 +1073,6 @@ for the process which will run. */)
1096 return flag; 1073 return flag;
1097} 1074}
1098 1075
1099DEFUN ("process-inherit-coding-system-flag",
1100 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
1101 1, 1, 0,
1102 doc: /* Return the value of inherit-coding-system flag for PROCESS.
1103If this flag is t, `buffer-file-coding-system' of the buffer
1104associated with PROCESS will inherit the coding system used to decode
1105the process output. */)
1106 (register Lisp_Object process)
1107{
1108 CHECK_PROCESS (process);
1109 return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
1110}
1111
1112DEFUN ("set-process-query-on-exit-flag", 1076DEFUN ("set-process-query-on-exit-flag",
1113 Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag, 1077 Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag,
1114 2, 2, 0, 1078 2, 2, 0,
@@ -2299,7 +2263,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
2299 /* Workaround for a bug in getsockname on BSD: Names bound to 2263 /* Workaround for a bug in getsockname on BSD: Names bound to
2300 sockets in the UNIX domain are inaccessible; getsockname returns 2264 sockets in the UNIX domain are inaccessible; getsockname returns
2301 a zero length name. */ 2265 a zero length name. */
2302 if (len < OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family)) 2266 if (len < offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family))
2303 return empty_unibyte_string; 2267 return empty_unibyte_string;
2304 2268
2305 switch (sa->sa_family) 2269 switch (sa->sa_family)
@@ -2339,7 +2303,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
2339 } 2303 }
2340#endif 2304#endif
2341 default: 2305 default:
2342 len -= OFFSETOF (struct sockaddr, sa_family) + sizeof (sa->sa_family); 2306 len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
2343 address = Fcons (make_number (sa->sa_family), 2307 address = Fcons (make_number (sa->sa_family),
2344 Fmake_vector (make_number (len), Qnil)); 2308 Fmake_vector (make_number (len), Qnil));
2345 p = XVECTOR (XCDR (address)); 2309 p = XVECTOR (XCDR (address));
@@ -6474,28 +6438,6 @@ process has been transmitted to the serial port. */)
6474 } 6438 }
6475 return process; 6439 return process;
6476} 6440}
6477
6478/* Kill all processes associated with `buffer'.
6479 If `buffer' is nil, kill all processes */
6480
6481void
6482kill_buffer_processes (Lisp_Object buffer)
6483{
6484 Lisp_Object tail, proc;
6485
6486 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
6487 {
6488 proc = XCDR (XCAR (tail));
6489 if (PROCESSP (proc)
6490 && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
6491 {
6492 if (NETCONN_P (proc) || SERIALCONN_P (proc))
6493 Fdelete_process (proc);
6494 else if (XPROCESS (proc)->infd >= 0)
6495 process_send_signal (proc, SIGHUP, Qnil, 1);
6496 }
6497 }
6498}
6499 6441
6500/* On receipt of a signal that a child status has changed, loop asking 6442/* On receipt of a signal that a child status has changed, loop asking
6501 about children with changed statuses until the system says there 6443 about children with changed statuses until the system says there
@@ -6960,29 +6902,6 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
6960 6902
6961 6903
6962 6904
6963/* Stop reading input from keyboard sources. */
6964
6965void
6966hold_keyboard_input (void)
6967{
6968 kbd_is_on_hold = 1;
6969}
6970
6971/* Resume reading input from keyboard sources. */
6972
6973void
6974unhold_keyboard_input (void)
6975{
6976 kbd_is_on_hold = 0;
6977}
6978
6979/* Return non-zero if keyboard input is on hold, zero otherwise. */
6980
6981int
6982kbd_on_hold_p (void)
6983{
6984 return kbd_is_on_hold;
6985}
6986 6905
6987/* Add DESC to the set of keyboard input descriptors. */ 6906/* Add DESC to the set of keyboard input descriptors. */
6988 6907
@@ -7060,6 +6979,326 @@ keyboard_bit_set (fd_set *mask)
7060 6979
7061 return 0; 6980 return 0;
7062} 6981}
6982
6983#else /* not subprocesses */
6984
6985/* Defined on msdos.c. */
6986extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
6987 EMACS_TIME *);
6988
6989/* Implementation of wait_reading_process_output, assuming that there
6990 are no subprocesses. Used only by the MS-DOS build.
6991
6992 Wait for timeout to elapse and/or keyboard input to be available.
6993
6994 time_limit is:
6995 timeout in seconds, or
6996 zero for no limit, or
6997 -1 means gobble data immediately available but don't wait for any.
6998
6999 read_kbd is a Lisp_Object:
7000 0 to ignore keyboard input, or
7001 1 to return when input is available, or
7002 -1 means caller will actually read the input, so don't throw to
7003 the quit handler.
7004
7005 see full version for other parameters. We know that wait_proc will
7006 always be NULL, since `subprocesses' isn't defined.
7007
7008 do_display != 0 means redisplay should be done to show subprocess
7009 output that arrives.
7010
7011 Return true if we received input from any process. */
7012
7013int
7014wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
7015 wait_for_cell, wait_proc, just_wait_proc)
7016 int time_limit, microsecs, read_kbd, do_display;
7017 Lisp_Object wait_for_cell;
7018 struct Lisp_Process *wait_proc;
7019 int just_wait_proc;
7020{
7021 register int nfds;
7022 EMACS_TIME end_time, timeout;
7023 SELECT_TYPE waitchannels;
7024 int xerrno;
7025
7026 /* What does time_limit really mean? */
7027 if (time_limit || microsecs)
7028 {
7029 EMACS_GET_TIME (end_time);
7030 EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
7031 EMACS_ADD_TIME (end_time, end_time, timeout);
7032 }
7033
7034 /* Turn off periodic alarms (in case they are in use)
7035 and then turn off any other atimers,
7036 because the select emulator uses alarms. */
7037 stop_polling ();
7038 turn_on_atimers (0);
7039
7040 while (1)
7041 {
7042 int timeout_reduced_for_timers = 0;
7043
7044 /* If calling from keyboard input, do not quit
7045 since we want to return C-g as an input character.
7046 Otherwise, do pending quit if requested. */
7047 if (read_kbd >= 0)
7048 QUIT;
7049
7050 /* Exit now if the cell we're waiting for became non-nil. */
7051 if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
7052 break;
7053
7054 /* Compute time from now till when time limit is up */
7055 /* Exit if already run out */
7056 if (time_limit == -1)
7057 {
7058 /* -1 specified for timeout means
7059 gobble output available now
7060 but don't wait at all. */
7061
7062 EMACS_SET_SECS_USECS (timeout, 0, 0);
7063 }
7064 else if (time_limit || microsecs)
7065 {
7066 EMACS_GET_TIME (timeout);
7067 EMACS_SUB_TIME (timeout, end_time, timeout);
7068 if (EMACS_TIME_NEG_P (timeout))
7069 break;
7070 }
7071 else
7072 {
7073 EMACS_SET_SECS_USECS (timeout, 100000, 0);
7074 }
7075
7076 /* If our caller will not immediately handle keyboard events,
7077 run timer events directly.
7078 (Callers that will immediately read keyboard events
7079 call timer_delay on their own.) */
7080 if (NILP (wait_for_cell))
7081 {
7082 EMACS_TIME timer_delay;
7083
7084 do
7085 {
7086 int old_timers_run = timers_run;
7087 timer_delay = timer_check (1);
7088 if (timers_run != old_timers_run && do_display)
7089 /* We must retry, since a timer may have requeued itself
7090 and that could alter the time delay. */
7091 redisplay_preserve_echo_area (14);
7092 else
7093 break;
7094 }
7095 while (!detect_input_pending ());
7096
7097 /* If there is unread keyboard input, also return. */
7098 if (read_kbd != 0
7099 && requeued_events_pending_p ())
7100 break;
7101
7102 if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
7103 {
7104 EMACS_TIME difference;
7105 EMACS_SUB_TIME (difference, timer_delay, timeout);
7106 if (EMACS_TIME_NEG_P (difference))
7107 {
7108 timeout = timer_delay;
7109 timeout_reduced_for_timers = 1;
7110 }
7111 }
7112 }
7113
7114 /* Cause C-g and alarm signals to take immediate action,
7115 and cause input available signals to zero out timeout. */
7116 if (read_kbd < 0)
7117 set_waiting_for_input (&timeout);
7118
7119 /* Wait till there is something to do. */
7120
7121 if (! read_kbd && NILP (wait_for_cell))
7122 FD_ZERO (&waitchannels);
7123 else
7124 FD_SET (0, &waitchannels);
7125
7126 /* If a frame has been newly mapped and needs updating,
7127 reprocess its display stuff. */
7128 if (frame_garbaged && do_display)
7129 {
7130 clear_waiting_for_input ();
7131 redisplay_preserve_echo_area (15);
7132 if (read_kbd < 0)
7133 set_waiting_for_input (&timeout);
7134 }
7135
7136 if (read_kbd && detect_input_pending ())
7137 {
7138 nfds = 0;
7139 FD_ZERO (&waitchannels);
7140 }
7141 else
7142 nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
7143 &timeout);
7144
7145 xerrno = errno;
7146
7147 /* Make C-g and alarm signals set flags again */
7148 clear_waiting_for_input ();
7149
7150 /* If we woke up due to SIGWINCH, actually change size now. */
7151 do_pending_window_change (0);
7152
7153 if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
7154 /* We waited the full specified time, so return now. */
7155 break;
7156
7157 if (nfds == -1)
7158 {
7159 /* If the system call was interrupted, then go around the
7160 loop again. */
7161 if (xerrno == EINTR)
7162 FD_ZERO (&waitchannels);
7163 else
7164 error ("select error: %s", emacs_strerror (xerrno));
7165 }
7166
7167 /* Check for keyboard input */
7168
7169 if (read_kbd
7170 && detect_input_pending_run_timers (do_display))
7171 {
7172 swallow_events (do_display);
7173 if (detect_input_pending_run_timers (do_display))
7174 break;
7175 }
7176
7177 /* If there is unread keyboard input, also return. */
7178 if (read_kbd
7179 && requeued_events_pending_p ())
7180 break;
7181
7182 /* If wait_for_cell. check for keyboard input
7183 but don't run any timers.
7184 ??? (It seems wrong to me to check for keyboard
7185 input at all when wait_for_cell, but the code
7186 has been this way since July 1994.
7187 Try changing this after version 19.31.) */
7188 if (! NILP (wait_for_cell)
7189 && detect_input_pending ())
7190 {
7191 swallow_events (do_display);
7192 if (detect_input_pending ())
7193 break;
7194 }
7195
7196 /* Exit now if the cell we're waiting for became non-nil. */
7197 if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
7198 break;
7199 }
7200
7201 start_polling ();
7202
7203 return 0;
7204}
7205
7206#endif /* not subprocesses */
7207
7208/* The following functions are needed even if async subprocesses are
7209 not supported. Some of them are no-op stubs in that case. */
7210
7211DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
7212 doc: /* Return the (or a) process associated with BUFFER.
7213BUFFER may be a buffer or the name of one. */)
7214 (register Lisp_Object buffer)
7215{
7216#ifdef subprocesses
7217 register Lisp_Object buf, tail, proc;
7218
7219 if (NILP (buffer)) return Qnil;
7220 buf = Fget_buffer (buffer);
7221 if (NILP (buf)) return Qnil;
7222
7223 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
7224 {
7225 proc = Fcdr (XCAR (tail));
7226 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
7227 return proc;
7228 }
7229#endif /* subprocesses */
7230 return Qnil;
7231}
7232
7233DEFUN ("process-inherit-coding-system-flag",
7234 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
7235 1, 1, 0,
7236 doc: /* Return the value of inherit-coding-system flag for PROCESS.
7237If this flag is t, `buffer-file-coding-system' of the buffer
7238associated with PROCESS will inherit the coding system used to decode
7239the process output. */)
7240 (register Lisp_Object process)
7241{
7242#ifdef subprocesses
7243 CHECK_PROCESS (process);
7244 return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
7245#else
7246 /* Ignore the argument and return the value of
7247 inherit-process-coding-system. */
7248 return inherit_process_coding_system ? Qt : Qnil;
7249#endif
7250}
7251
7252/* Kill all processes associated with `buffer'.
7253 If `buffer' is nil, kill all processes */
7254
7255void
7256kill_buffer_processes (Lisp_Object buffer)
7257{
7258#ifdef subprocesses
7259 Lisp_Object tail, proc;
7260
7261 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
7262 {
7263 proc = XCDR (XCAR (tail));
7264 if (PROCESSP (proc)
7265 && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
7266 {
7267 if (NETCONN_P (proc) || SERIALCONN_P (proc))
7268 Fdelete_process (proc);
7269 else if (XPROCESS (proc)->infd >= 0)
7270 process_send_signal (proc, SIGHUP, Qnil, 1);
7271 }
7272 }
7273#else /* subprocesses */
7274 /* Since we have no subprocesses, this does nothing. */
7275#endif /* subprocesses */
7276}
7277
7278/* Stop reading input from keyboard sources. */
7279
7280void
7281hold_keyboard_input (void)
7282{
7283 kbd_is_on_hold = 1;
7284}
7285
7286/* Resume reading input from keyboard sources. */
7287
7288void
7289unhold_keyboard_input (void)
7290{
7291 kbd_is_on_hold = 0;
7292}
7293
7294/* Return non-zero if keyboard input is on hold, zero otherwise. */
7295
7296int
7297kbd_on_hold_p (void)
7298{
7299 return kbd_is_on_hold;
7300}
7301
7063 7302
7064/* Enumeration of and access to system processes a-la ps(1). */ 7303/* Enumeration of and access to system processes a-la ps(1). */
7065 7304
@@ -7129,10 +7368,12 @@ integer or floating point values.
7129{ 7368{
7130 return system_process_attributes (pid); 7369 return system_process_attributes (pid);
7131} 7370}
7371
7132 7372
7133void 7373void
7134init_process (void) 7374init_process (void)
7135{ 7375{
7376#ifdef subprocesses
7136 register int i; 7377 register int i;
7137 7378
7138 inhibit_sentinels = 0; 7379 inhibit_sentinels = 0;
@@ -7231,11 +7472,15 @@ init_process (void)
7231 } 7472 }
7232 } 7473 }
7233#endif 7474#endif
7475#endif /* subprocesses */
7476 kbd_is_on_hold = 0;
7234} 7477}
7235 7478
7236void 7479void
7237syms_of_process (void) 7480syms_of_process (void)
7238{ 7481{
7482#ifdef subprocesses
7483
7239 Qprocessp = intern_c_string ("processp"); 7484 Qprocessp = intern_c_string ("processp");
7240 staticpro (&Qprocessp); 7485 staticpro (&Qprocessp);
7241 Qrun = intern_c_string ("run"); 7486 Qrun = intern_c_string ("run");
@@ -7306,17 +7551,12 @@ syms_of_process (void)
7306 staticpro (&Qnetwork); 7551 staticpro (&Qnetwork);
7307 Qserial = intern_c_string ("serial"); 7552 Qserial = intern_c_string ("serial");
7308 staticpro (&Qserial); 7553 staticpro (&Qserial);
7309
7310 QCname = intern_c_string (":name");
7311 staticpro (&QCname);
7312 QCbuffer = intern_c_string (":buffer"); 7554 QCbuffer = intern_c_string (":buffer");
7313 staticpro (&QCbuffer); 7555 staticpro (&QCbuffer);
7314 QChost = intern_c_string (":host"); 7556 QChost = intern_c_string (":host");
7315 staticpro (&QChost); 7557 staticpro (&QChost);
7316 QCservice = intern_c_string (":service"); 7558 QCservice = intern_c_string (":service");
7317 staticpro (&QCservice); 7559 staticpro (&QCservice);
7318 QCtype = intern_c_string (":type");
7319 staticpro (&QCtype);
7320 QClocal = intern_c_string (":local"); 7560 QClocal = intern_c_string (":local");
7321 staticpro (&QClocal); 7561 staticpro (&QClocal);
7322 QCremote = intern_c_string (":remote"); 7562 QCremote = intern_c_string (":remote");
@@ -7348,6 +7588,13 @@ syms_of_process (void)
7348 staticpro (&deleted_pid_list); 7588 staticpro (&deleted_pid_list);
7349#endif 7589#endif
7350 7590
7591#endif /* subprocesses */
7592
7593 QCname = intern_c_string (":name");
7594 staticpro (&QCname);
7595 QCtype = intern_c_string (":type");
7596 staticpro (&QCtype);
7597
7351 Qeuid = intern_c_string ("euid"); 7598 Qeuid = intern_c_string ("euid");
7352 staticpro (&Qeuid); 7599 staticpro (&Qeuid);
7353 Qegid = intern_c_string ("egid"); 7600 Qegid = intern_c_string ("egid");
@@ -7417,6 +7664,7 @@ A value of nil means don't delete them until `list-processes' is run. */);
7417 7664
7418 delete_exited_processes = 1; 7665 delete_exited_processes = 1;
7419 7666
7667#ifdef subprocesses
7420 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type, 7668 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
7421 doc: /* Control type of device used to communicate with subprocesses. 7669 doc: /* Control type of device used to communicate with subprocesses.
7422Values are nil to use a pipe, or t or `pty' to use a pty. 7670Values are nil to use a pipe, or t or `pty' to use a pty.
@@ -7441,7 +7689,6 @@ The variable takes effect when `start-process' is called. */);
7441 7689
7442 defsubr (&Sprocessp); 7690 defsubr (&Sprocessp);
7443 defsubr (&Sget_process); 7691 defsubr (&Sget_process);
7444 defsubr (&Sget_buffer_process);
7445 defsubr (&Sdelete_process); 7692 defsubr (&Sdelete_process);
7446 defsubr (&Sprocess_status); 7693 defsubr (&Sprocess_status);
7447 defsubr (&Sprocess_exit_status); 7694 defsubr (&Sprocess_exit_status);
@@ -7458,7 +7705,6 @@ The variable takes effect when `start-process' is called. */);
7458 defsubr (&Sprocess_sentinel); 7705 defsubr (&Sprocess_sentinel);
7459 defsubr (&Sset_process_window_size); 7706 defsubr (&Sset_process_window_size);
7460 defsubr (&Sset_process_inherit_coding_system_flag); 7707 defsubr (&Sset_process_inherit_coding_system_flag);
7461 defsubr (&Sprocess_inherit_coding_system_flag);
7462 defsubr (&Sset_process_query_on_exit_flag); 7708 defsubr (&Sset_process_query_on_exit_flag);
7463 defsubr (&Sprocess_query_on_exit_flag); 7709 defsubr (&Sprocess_query_on_exit_flag);
7464 defsubr (&Sprocess_contact); 7710 defsubr (&Sprocess_contact);
@@ -7505,474 +7751,8 @@ The variable takes effect when `start-process' is called. */);
7505 defsubr (&Sprocess_coding_system); 7751 defsubr (&Sprocess_coding_system);
7506 defsubr (&Sset_process_filter_multibyte); 7752 defsubr (&Sset_process_filter_multibyte);
7507 defsubr (&Sprocess_filter_multibyte_p); 7753 defsubr (&Sprocess_filter_multibyte_p);
7508 defsubr (&Slist_system_processes);
7509 defsubr (&Sprocess_attributes);
7510}
7511
7512
7513#else /* not subprocesses */
7514 7754
7515#include <sys/types.h> 7755#endif /* subprocesses */
7516#include <errno.h>
7517#include <sys/stat.h>
7518#include <stdlib.h>
7519#include <fcntl.h>
7520#include <setjmp.h>
7521#ifdef HAVE_UNISTD_H
7522#include <unistd.h>
7523#endif
7524
7525#include "lisp.h"
7526#include "systime.h"
7527#include "character.h"
7528#include "coding.h"
7529#include "termopts.h"
7530#include "sysselect.h"
7531
7532extern int frame_garbaged;
7533
7534extern EMACS_TIME timer_check ();
7535extern int timers_run;
7536
7537Lisp_Object QCtype, QCname;
7538
7539Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
7540Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
7541Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
7542Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
7543
7544/* Non-zero if keyboard input is on hold, zero otherwise. */
7545static int kbd_is_on_hold;
7546
7547/* As described above, except assuming that there are no subprocesses:
7548
7549 Wait for timeout to elapse and/or keyboard input to be available.
7550
7551 time_limit is:
7552 timeout in seconds, or
7553 zero for no limit, or
7554 -1 means gobble data immediately available but don't wait for any.
7555
7556 read_kbd is a Lisp_Object:
7557 0 to ignore keyboard input, or
7558 1 to return when input is available, or
7559 -1 means caller will actually read the input, so don't throw to
7560 the quit handler.
7561
7562 see full version for other parameters. We know that wait_proc will
7563 always be NULL, since `subprocesses' isn't defined.
7564
7565 do_display != 0 means redisplay should be done to show subprocess
7566 output that arrives.
7567
7568 Return true if we received input from any process. */
7569
7570int
7571wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
7572 wait_for_cell, wait_proc, just_wait_proc)
7573 int time_limit, microsecs, read_kbd, do_display;
7574 Lisp_Object wait_for_cell;
7575 struct Lisp_Process *wait_proc;
7576 int just_wait_proc;
7577{
7578 register int nfds;
7579 EMACS_TIME end_time, timeout;
7580 SELECT_TYPE waitchannels;
7581 int xerrno;
7582
7583 /* What does time_limit really mean? */
7584 if (time_limit || microsecs)
7585 {
7586 EMACS_GET_TIME (end_time);
7587 EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
7588 EMACS_ADD_TIME (end_time, end_time, timeout);
7589 }
7590
7591 /* Turn off periodic alarms (in case they are in use)
7592 and then turn off any other atimers,
7593 because the select emulator uses alarms. */
7594 stop_polling ();
7595 turn_on_atimers (0);
7596
7597 while (1)
7598 {
7599 int timeout_reduced_for_timers = 0;
7600
7601 /* If calling from keyboard input, do not quit
7602 since we want to return C-g as an input character.
7603 Otherwise, do pending quit if requested. */
7604 if (read_kbd >= 0)
7605 QUIT;
7606
7607 /* Exit now if the cell we're waiting for became non-nil. */
7608 if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
7609 break;
7610
7611 /* Compute time from now till when time limit is up */
7612 /* Exit if already run out */
7613 if (time_limit == -1)
7614 {
7615 /* -1 specified for timeout means
7616 gobble output available now
7617 but don't wait at all. */
7618
7619 EMACS_SET_SECS_USECS (timeout, 0, 0);
7620 }
7621 else if (time_limit || microsecs)
7622 {
7623 EMACS_GET_TIME (timeout);
7624 EMACS_SUB_TIME (timeout, end_time, timeout);
7625 if (EMACS_TIME_NEG_P (timeout))
7626 break;
7627 }
7628 else
7629 {
7630 EMACS_SET_SECS_USECS (timeout, 100000, 0);
7631 }
7632
7633 /* If our caller will not immediately handle keyboard events,
7634 run timer events directly.
7635 (Callers that will immediately read keyboard events
7636 call timer_delay on their own.) */
7637 if (NILP (wait_for_cell))
7638 {
7639 EMACS_TIME timer_delay;
7640
7641 do
7642 {
7643 int old_timers_run = timers_run;
7644 timer_delay = timer_check (1);
7645 if (timers_run != old_timers_run && do_display)
7646 /* We must retry, since a timer may have requeued itself
7647 and that could alter the time delay. */
7648 redisplay_preserve_echo_area (14);
7649 else
7650 break;
7651 }
7652 while (!detect_input_pending ());
7653
7654 /* If there is unread keyboard input, also return. */
7655 if (read_kbd != 0
7656 && requeued_events_pending_p ())
7657 break;
7658
7659 if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
7660 {
7661 EMACS_TIME difference;
7662 EMACS_SUB_TIME (difference, timer_delay, timeout);
7663 if (EMACS_TIME_NEG_P (difference))
7664 {
7665 timeout = timer_delay;
7666 timeout_reduced_for_timers = 1;
7667 }
7668 }
7669 }
7670
7671 /* Cause C-g and alarm signals to take immediate action,
7672 and cause input available signals to zero out timeout. */
7673 if (read_kbd < 0)
7674 set_waiting_for_input (&timeout);
7675
7676 /* Wait till there is something to do. */
7677
7678 if (! read_kbd && NILP (wait_for_cell))
7679 FD_ZERO (&waitchannels);
7680 else
7681 FD_SET (0, &waitchannels);
7682
7683 /* If a frame has been newly mapped and needs updating,
7684 reprocess its display stuff. */
7685 if (frame_garbaged && do_display)
7686 {
7687 clear_waiting_for_input ();
7688 redisplay_preserve_echo_area (15);
7689 if (read_kbd < 0)
7690 set_waiting_for_input (&timeout);
7691 }
7692
7693 if (read_kbd && detect_input_pending ())
7694 {
7695 nfds = 0;
7696 FD_ZERO (&waitchannels);
7697 }
7698 else
7699 nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
7700 &timeout);
7701
7702 xerrno = errno;
7703
7704 /* Make C-g and alarm signals set flags again */
7705 clear_waiting_for_input ();
7706
7707 /* If we woke up due to SIGWINCH, actually change size now. */
7708 do_pending_window_change (0);
7709
7710 if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
7711 /* We waited the full specified time, so return now. */
7712 break;
7713
7714 if (nfds == -1)
7715 {
7716 /* If the system call was interrupted, then go around the
7717 loop again. */
7718 if (xerrno == EINTR)
7719 FD_ZERO (&waitchannels);
7720 else
7721 error ("select error: %s", emacs_strerror (xerrno));
7722 }
7723#ifdef SOLARIS2
7724 else if (nfds > 0 && (waitchannels & 1) && interrupt_input)
7725 /* System sometimes fails to deliver SIGIO. */
7726 kill (getpid (), SIGIO);
7727#endif
7728#ifdef SIGIO
7729 if (read_kbd && interrupt_input && (waitchannels & 1))
7730 kill (getpid (), SIGIO);
7731#endif
7732
7733 /* Check for keyboard input */
7734
7735 if (read_kbd
7736 && detect_input_pending_run_timers (do_display))
7737 {
7738 swallow_events (do_display);
7739 if (detect_input_pending_run_timers (do_display))
7740 break;
7741 }
7742
7743 /* If there is unread keyboard input, also return. */
7744 if (read_kbd
7745 && requeued_events_pending_p ())
7746 break;
7747
7748 /* If wait_for_cell. check for keyboard input
7749 but don't run any timers.
7750 ??? (It seems wrong to me to check for keyboard
7751 input at all when wait_for_cell, but the code
7752 has been this way since July 1994.
7753 Try changing this after version 19.31.) */
7754 if (! NILP (wait_for_cell)
7755 && detect_input_pending ())
7756 {
7757 swallow_events (do_display);
7758 if (detect_input_pending ())
7759 break;
7760 }
7761
7762 /* Exit now if the cell we're waiting for became non-nil. */
7763 if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
7764 break;
7765 }
7766
7767 start_polling ();
7768
7769 return 0;
7770}
7771
7772
7773/* Don't confuse make-docfile by having two doc strings for this function.
7774 make-docfile does not pay attention to #if, for good reason! */
7775DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
7776 0)
7777 (register Lisp_Object name)
7778{
7779 return Qnil;
7780}
7781
7782 /* Don't confuse make-docfile by having two doc strings for this function.
7783 make-docfile does not pay attention to #if, for good reason! */
7784DEFUN ("process-inherit-coding-system-flag",
7785 Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
7786 1, 1, 0,
7787 0)
7788 (register Lisp_Object process)
7789{
7790 /* Ignore the argument and return the value of
7791 inherit-process-coding-system. */
7792 return inherit_process_coding_system ? Qt : Qnil;
7793}
7794
7795/* Kill all processes associated with `buffer'.
7796 If `buffer' is nil, kill all processes.
7797 Since we have no subprocesses, this does nothing. */
7798
7799void
7800kill_buffer_processes (buffer)
7801 Lisp_Object buffer;
7802{
7803}
7804
7805
7806/* Stop reading input from keyboard sources. */
7807
7808void
7809hold_keyboard_input (void)
7810{
7811 kbd_is_on_hold = 1;
7812}
7813
7814/* Resume reading input from keyboard sources. */
7815
7816void
7817unhold_keyboard_input (void)
7818{
7819 kbd_is_on_hold = 0;
7820}
7821
7822/* Return non-zero if keyboard input is on hold, zero otherwise. */
7823
7824int
7825kbd_on_hold_p (void)
7826{
7827 return kbd_is_on_hold;
7828}
7829
7830DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes,
7831 0, 0, 0,
7832 doc: /* Return a list of numerical process IDs of all running processes.
7833If this functionality is unsupported, return nil.
7834
7835See `process-attributes' for getting attributes of a process given its ID. */)
7836 (void)
7837{
7838 return list_system_processes ();
7839}
7840
7841DEFUN ("process-attributes", Fprocess_attributes,
7842 Sprocess_attributes, 1, 1, 0,
7843 doc: /* Return attributes of the process given by its PID, a number.
7844
7845Value is an alist where each element is a cons cell of the form
7846
7847 \(KEY . VALUE)
7848
7849If this functionality is unsupported, the value is nil.
7850
7851See `list-system-processes' for getting a list of all process IDs.
7852
7853The KEYs of the attributes that this function may return are listed
7854below, together with the type of the associated VALUE (in parentheses).
7855Not all platforms support all of these attributes; unsupported
7856attributes will not appear in the returned alist.
7857Unless explicitly indicated otherwise, numbers can have either
7858integer or floating point values.
7859
7860 euid -- Effective user User ID of the process (number)
7861 user -- User name corresponding to euid (string)
7862 egid -- Effective user Group ID of the process (number)
7863 group -- Group name corresponding to egid (string)
7864 comm -- Command name (executable name only) (string)
7865 state -- Process state code, such as "S", "R", or "T" (string)
7866 ppid -- Parent process ID (number)
7867 pgrp -- Process group ID (number)
7868 sess -- Session ID, i.e. process ID of session leader (number)
7869 ttname -- Controlling tty name (string)
7870 tpgid -- ID of foreground process group on the process's tty (number)
7871 minflt -- number of minor page faults (number)
7872 majflt -- number of major page faults (number)
7873 cminflt -- cumulative number of minor page faults (number)
7874 cmajflt -- cumulative number of major page faults (number)
7875 utime -- user time used by the process, in the (HIGH LOW USEC) format
7876 stime -- system time used by the process, in the (HIGH LOW USEC) format
7877 time -- sum of utime and stime, in the (HIGH LOW USEC) format
7878 cutime -- user time used by the process and its children, (HIGH LOW USEC)
7879 cstime -- system time used by the process and its children, (HIGH LOW USEC)
7880 ctime -- sum of cutime and cstime, in the (HIGH LOW USEC) format
7881 pri -- priority of the process (number)
7882 nice -- nice value of the process (number)
7883 thcount -- process thread count (number)
7884 start -- time the process started, in the (HIGH LOW USEC) format
7885 vsize -- virtual memory size of the process in KB's (number)
7886 rss -- resident set size of the process in KB's (number)
7887 etime -- elapsed time the process is running, in (HIGH LOW USEC) format
7888 pcpu -- percents of CPU time used by the process (floating-point number)
7889 pmem -- percents of total physical memory used by process's resident set
7890 (floating-point number)
7891 args -- command line which invoked the process (string). */)
7892 ( Lisp_Object pid)
7893{
7894 return system_process_attributes (pid);
7895}
7896
7897void
7898init_process ()
7899{
7900 kbd_is_on_hold = 0;
7901}
7902
7903void
7904syms_of_process ()
7905{
7906 QCtype = intern_c_string (":type");
7907 staticpro (&QCtype);
7908 QCname = intern_c_string (":name");
7909 staticpro (&QCname);
7910 QCtype = intern_c_string (":type");
7911 staticpro (&QCtype);
7912 QCname = intern_c_string (":name");
7913 staticpro (&QCname);
7914 Qeuid = intern_c_string ("euid");
7915 staticpro (&Qeuid);
7916 Qegid = intern_c_string ("egid");
7917 staticpro (&Qegid);
7918 Quser = intern_c_string ("user");
7919 staticpro (&Quser);
7920 Qgroup = intern_c_string ("group");
7921 staticpro (&Qgroup);
7922 Qcomm = intern_c_string ("comm");
7923 staticpro (&Qcomm);
7924 Qstate = intern_c_string ("state");
7925 staticpro (&Qstate);
7926 Qppid = intern_c_string ("ppid");
7927 staticpro (&Qppid);
7928 Qpgrp = intern_c_string ("pgrp");
7929 staticpro (&Qpgrp);
7930 Qsess = intern_c_string ("sess");
7931 staticpro (&Qsess);
7932 Qttname = intern_c_string ("ttname");
7933 staticpro (&Qttname);
7934 Qtpgid = intern_c_string ("tpgid");
7935 staticpro (&Qtpgid);
7936 Qminflt = intern_c_string ("minflt");
7937 staticpro (&Qminflt);
7938 Qmajflt = intern_c_string ("majflt");
7939 staticpro (&Qmajflt);
7940 Qcminflt = intern_c_string ("cminflt");
7941 staticpro (&Qcminflt);
7942 Qcmajflt = intern_c_string ("cmajflt");
7943 staticpro (&Qcmajflt);
7944 Qutime = intern_c_string ("utime");
7945 staticpro (&Qutime);
7946 Qstime = intern_c_string ("stime");
7947 staticpro (&Qstime);
7948 Qtime = intern_c_string ("time");
7949 staticpro (&Qtime);
7950 Qcutime = intern_c_string ("cutime");
7951 staticpro (&Qcutime);
7952 Qcstime = intern_c_string ("cstime");
7953 staticpro (&Qcstime);
7954 Qctime = intern_c_string ("ctime");
7955 staticpro (&Qctime);
7956 Qpri = intern_c_string ("pri");
7957 staticpro (&Qpri);
7958 Qnice = intern_c_string ("nice");
7959 staticpro (&Qnice);
7960 Qthcount = intern_c_string ("thcount");
7961 staticpro (&Qthcount);
7962 Qstart = intern_c_string ("start");
7963 staticpro (&Qstart);
7964 Qvsize = intern_c_string ("vsize");
7965 staticpro (&Qvsize);
7966 Qrss = intern_c_string ("rss");
7967 staticpro (&Qrss);
7968 Qetime = intern_c_string ("etime");
7969 staticpro (&Qetime);
7970 Qpcpu = intern_c_string ("pcpu");
7971 staticpro (&Qpcpu);
7972 Qpmem = intern_c_string ("pmem");
7973 staticpro (&Qpmem);
7974 Qargs = intern_c_string ("args");
7975 staticpro (&Qargs);
7976 7756
7977 defsubr (&Sget_buffer_process); 7757 defsubr (&Sget_buffer_process);
7978 defsubr (&Sprocess_inherit_coding_system_flag); 7758 defsubr (&Sprocess_inherit_coding_system_flag);
@@ -7980,8 +7760,5 @@ syms_of_process ()
7980 defsubr (&Sprocess_attributes); 7760 defsubr (&Sprocess_attributes);
7981} 7761}
7982 7762
7983
7984#endif /* not subprocesses */
7985
7986/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4 7763/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4
7987 (do not change this comment) */ 7764 (do not change this comment) */
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index dd0e1bea9ad..ee841041edb 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -146,9 +146,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
146/* No underscore please. */ 146/* No underscore please. */
147#define LDAV_SYMBOL "avenrun" 147#define LDAV_SYMBOL "avenrun"
148 148
149/* On USG systems these have different names. */
150#define index strchr
151#define rindex strrchr
152
153/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6 149/* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6
154 (do not change this comment) */ 150 (do not change this comment) */
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index df9929f6823..a87e22b338c 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -274,8 +274,6 @@ typedef int pid_t;
274#define pclose _pclose 274#define pclose _pclose
275#define umask _umask 275#define umask _umask
276#define utimbuf _utimbuf 276#define utimbuf _utimbuf
277#define index strchr
278#define rindex strrchr
279#define strdup _strdup 277#define strdup _strdup
280#define strupr _strupr 278#define strupr _strupr
281#define strnicmp _strnicmp 279#define strnicmp _strnicmp
diff --git a/src/s/usg5-4.h b/src/s/usg5-4.h
index e667ffdc106..b92a5bbb450 100644
--- a/src/s/usg5-4.h
+++ b/src/s/usg5-4.h
@@ -50,14 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#define _setjmp setjmp 50#define _setjmp setjmp
51#define _longjmp longjmp 51#define _longjmp longjmp
52 52
53/* On USG systems these have different names. */
54#ifndef HAVE_INDEX
55#define index strchr
56#endif /* ! defined (HAVE_INDEX) */
57#ifndef HAVE_RINDEX
58#define rindex strrchr
59#endif /* ! defined (HAVE_RINDEX) */
60
61/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ 53/* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */
62#define HAVE_SYSV_SIGPAUSE 54#define HAVE_SYSV_SIGPAUSE
63 55
diff --git a/src/sysdep.c b/src/sysdep.c
index daca9d12510..e45664a8bd6 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1555,7 +1555,7 @@ init_system_name (void)
1555#ifndef CANNOT_DUMP 1555#ifndef CANNOT_DUMP
1556 if (initialized) 1556 if (initialized)
1557#endif /* not CANNOT_DUMP */ 1557#endif /* not CANNOT_DUMP */
1558 if (! index (hostname, '.')) 1558 if (! strchr (hostname, '.'))
1559 { 1559 {
1560 int count; 1560 int count;
1561#ifdef HAVE_GETADDRINFO 1561#ifdef HAVE_GETADDRINFO
@@ -1584,7 +1584,7 @@ init_system_name (void)
1584 while (it) 1584 while (it)
1585 { 1585 {
1586 char *fqdn = it->ai_canonname; 1586 char *fqdn = it->ai_canonname;
1587 if (fqdn && index (fqdn, '.') 1587 if (fqdn && strchr (fqdn, '.')
1588 && strcmp (fqdn, "localhost.localdomain") != 0) 1588 && strcmp (fqdn, "localhost.localdomain") != 0)
1589 break; 1589 break;
1590 it = it->ai_next; 1590 it = it->ai_next;
@@ -1620,13 +1620,13 @@ init_system_name (void)
1620 { 1620 {
1621 char *fqdn = (char *) hp->h_name; 1621 char *fqdn = (char *) hp->h_name;
1622 1622
1623 if (!index (fqdn, '.')) 1623 if (!strchr (fqdn, '.'))
1624 { 1624 {
1625 /* We still don't have a fully qualified domain name. 1625 /* We still don't have a fully qualified domain name.
1626 Try to find one in the list of alternate names */ 1626 Try to find one in the list of alternate names */
1627 char **alias = hp->h_aliases; 1627 char **alias = hp->h_aliases;
1628 while (*alias 1628 while (*alias
1629 && (!index (*alias, '.') 1629 && (!strchr (*alias, '.')
1630 || !strcmp (*alias, "localhost.localdomain"))) 1630 || !strcmp (*alias, "localhost.localdomain")))
1631 alias++; 1631 alias++;
1632 if (*alias) 1632 if (*alias)
diff --git a/src/vm-limit.c b/src/vm-limit.c
index cb42f78701b..aca0e0afb47 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -42,7 +42,7 @@ static enum warnlevel warnlevel;
42 42
43/* Function to call to issue a warning; 43/* Function to call to issue a warning;
44 0 means don't issue them. */ 44 0 means don't issue them. */
45static void (*warn_function) (char *); 45static void (*warn_function) (const char *);
46 46
47/* Start of data space; can be changed by calling malloc_init. */ 47/* Start of data space; can be changed by calling malloc_init. */
48static POINTER data_space_start; 48static POINTER data_space_start;
@@ -289,7 +289,7 @@ start_of_data (void)
289 WARNFUN specifies the function to call to issue a warning. */ 289 WARNFUN specifies the function to call to issue a warning. */
290 290
291void 291void
292memory_warnings (POINTER start, void (*warnfun) (char *)) 292memory_warnings (POINTER start, void (*warnfun) (const char *))
293{ 293{
294 extern void (* __after_morecore_hook) (void); /* From gmalloc.c */ 294 extern void (* __after_morecore_hook) (void); /* From gmalloc.c */
295 295
diff --git a/src/w32fns.c b/src/w32fns.c
index 916aea28eea..c1791f2bf3e 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -288,10 +288,15 @@ unsigned int msh_mousewheel = 0;
288#define MENU_FREE_DELAY 1000 288#define MENU_FREE_DELAY 1000
289static unsigned menu_free_timer = 0; 289static unsigned menu_free_timer = 0;
290 290
291/* In dispnew.c */
292
293extern Lisp_Object Vwindow_system_version;
294
291/* The below are defined in frame.c. */ 295/* The below are defined in frame.c. */
292 296
293extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; 297extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
294extern Lisp_Object Vwindow_system_version; 298extern Lisp_Object Vwindow_system_version;
299extern Lisp_Object Qtooltip;
295 300
296#ifdef GLYPH_DEBUG 301#ifdef GLYPH_DEBUG
297int image_cache_refcount, dpyinfo_refcount; 302int image_cache_refcount, dpyinfo_refcount;
@@ -5476,9 +5481,8 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5476 change_frame_size (f, height, width, 1, 0, 0); 5481 change_frame_size (f, height, width, 1, 0, 0);
5477 5482
5478 /* Add `tooltip' frame parameter's default value. */ 5483 /* Add `tooltip' frame parameter's default value. */
5479 if (NILP (Fframe_parameter (frame, intern ("tooltip")))) 5484 if (NILP (Fframe_parameter (frame, Qtooltip)))
5480 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 5485 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil));
5481 Qnil));
5482 5486
5483 /* Set up faces after all frame parameters are known. This call 5487 /* Set up faces after all frame parameters are known. This call
5484 also merges in face attributes specified for new frames. 5488 also merges in face attributes specified for new frames.
diff --git a/src/w32term.c b/src/w32term.c
index 7ace4b01f95..9db533eb5e9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -737,7 +737,6 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
737 struct frame *f = XFRAME (WINDOW_FRAME (w)); 737 struct frame *f = XFRAME (WINDOW_FRAME (w));
738 HDC hdc; 738 HDC hdc;
739 struct face *face = p->face; 739 struct face *face = p->face;
740 int rowY;
741 740
742 hdc = get_frame_dc (f); 741 hdc = get_frame_dc (f);
743 742
@@ -796,21 +795,7 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
796 } 795 }
797 796
798 /* Must clip because of partially visible lines. */ 797 /* Must clip because of partially visible lines. */
799 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 798 w32_clip_to_row (w, row, -1, hdc);
800 if (p->y < rowY)
801 {
802 /* Adjust position of "bottom aligned" bitmap on partially
803 visible last row. */
804 int oldY = row->y;
805 int oldVH = row->visible_height;
806 row->visible_height = p->h;
807 row->y -= rowY - p->y;
808 w32_clip_to_row (w, row, -1, hdc);
809 row->y = oldY;
810 row->visible_height = oldVH;
811 }
812 else
813 w32_clip_to_row (w, row, -1, hdc);
814 799
815 if (p->which && p->which < max_fringe_bmp) 800 if (p->which && p->which < max_fringe_bmp)
816 { 801 {
diff --git a/src/xdisp.c b/src/xdisp.c
index d145e7bd9f6..b68425da743 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6625,6 +6625,7 @@ static int
6625next_element_from_image (struct it *it) 6625next_element_from_image (struct it *it)
6626{ 6626{
6627 it->what = IT_IMAGE; 6627 it->what = IT_IMAGE;
6628 it->ignore_overlay_strings_at_pos_p = 0;
6628 return 1; 6629 return 1;
6629} 6630}
6630 6631
@@ -8412,7 +8413,7 @@ message3_nolog (Lisp_Object m, int nbytes, int multibyte)
8412 that was alloca'd. */ 8413 that was alloca'd. */
8413 8414
8414void 8415void
8415message1 (char *m) 8416message1 (const char *m)
8416{ 8417{
8417 message2 (m, (m ? strlen (m) : 0), 0); 8418 message2 (m, (m ? strlen (m) : 0), 0);
8418} 8419}
@@ -8421,7 +8422,7 @@ message1 (char *m)
8421/* The non-logging counterpart of message1. */ 8422/* The non-logging counterpart of message1. */
8422 8423
8423void 8424void
8424message1_nolog (char *m) 8425message1_nolog (const char *m)
8425{ 8426{
8426 message2_nolog (m, (m ? strlen (m) : 0), 0); 8427 message2_nolog (m, (m ? strlen (m) : 0), 0);
8427} 8428}
@@ -8430,7 +8431,7 @@ message1_nolog (char *m)
8430 which gets replaced with STRING. */ 8431 which gets replaced with STRING. */
8431 8432
8432void 8433void
8433message_with_string (char *m, Lisp_Object string, int log) 8434message_with_string (const char *m, Lisp_Object string, int log)
8434{ 8435{
8435 CHECK_STRING (string); 8436 CHECK_STRING (string);
8436 8437
@@ -8493,9 +8494,8 @@ message_with_string (char *m, Lisp_Object string, int log)
8493/* Dump an informative message to the minibuf. If M is 0, clear out 8494/* Dump an informative message to the minibuf. If M is 0, clear out
8494 any existing message, and let the mini-buffer text show through. */ 8495 any existing message, and let the mini-buffer text show through. */
8495 8496
8496/* VARARGS 1 */ 8497static void
8497void 8498vmessage (const char *m, va_list ap)
8498message (char *m, EMACS_INT a1, EMACS_INT a2, EMACS_INT a3)
8499{ 8499{
8500 if (noninteractive) 8500 if (noninteractive)
8501 { 8501 {
@@ -8504,7 +8504,7 @@ message (char *m, EMACS_INT a1, EMACS_INT a2, EMACS_INT a3)
8504 if (noninteractive_need_newline) 8504 if (noninteractive_need_newline)
8505 putc ('\n', stderr); 8505 putc ('\n', stderr);
8506 noninteractive_need_newline = 0; 8506 noninteractive_need_newline = 0;
8507 fprintf (stderr, m, a1, a2, a3); 8507 vfprintf (stderr, m, ap);
8508 if (cursor_in_echo_area == 0) 8508 if (cursor_in_echo_area == 0)
8509 fprintf (stderr, "\n"); 8509 fprintf (stderr, "\n");
8510 fflush (stderr); 8510 fflush (stderr);
@@ -8532,13 +8532,9 @@ message (char *m, EMACS_INT a1, EMACS_INT a2, EMACS_INT a3)
8532 if (m) 8532 if (m)
8533 { 8533 {
8534 int len; 8534 int len;
8535 char *a[3];
8536 a[0] = (char *) a1;
8537 a[1] = (char *) a2;
8538 a[2] = (char *) a3;
8539 8535
8540 len = doprnt (FRAME_MESSAGE_BUF (f), 8536 len = doprnt (FRAME_MESSAGE_BUF (f),
8541 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, 3, a); 8537 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
8542 8538
8543 message2 (FRAME_MESSAGE_BUF (f), len, 0); 8539 message2 (FRAME_MESSAGE_BUF (f), len, 0);
8544 } 8540 }
@@ -8552,17 +8548,29 @@ message (char *m, EMACS_INT a1, EMACS_INT a2, EMACS_INT a3)
8552 } 8548 }
8553} 8549}
8554 8550
8551void
8552message (const char *m, ...)
8553{
8554 va_list ap;
8555 va_start (ap, m);
8556 vmessage (m, ap);
8557 va_end (ap);
8558}
8559
8555 8560
8556/* The non-logging version of message. */ 8561/* The non-logging version of message. */
8557 8562
8558void 8563void
8559message_nolog (char *m, EMACS_INT a1, EMACS_INT a2, EMACS_INT a3) 8564message_nolog (const char *m, ...)
8560{ 8565{
8561 Lisp_Object old_log_max; 8566 Lisp_Object old_log_max;
8567 va_list ap;
8568 va_start (ap, m);
8562 old_log_max = Vmessage_log_max; 8569 old_log_max = Vmessage_log_max;
8563 Vmessage_log_max = Qnil; 8570 Vmessage_log_max = Qnil;
8564 message (m, a1, a2, a3); 8571 vmessage (m, ap);
8565 Vmessage_log_max = old_log_max; 8572 Vmessage_log_max = old_log_max;
8573 va_end (ap);
8566} 8574}
8567 8575
8568 8576
diff --git a/src/xfaces.c b/src/xfaces.c
index 520546c42b1..ad436f06202 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5605,6 +5605,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
5605 struct face *former_face = cache->faces_by_id[former_face_id]; 5605 struct face *former_face = cache->faces_by_id[former_face_id];
5606 uncache_face (cache, former_face); 5606 uncache_face (cache, former_face);
5607 free_realized_face (cache->f, former_face); 5607 free_realized_face (cache->f, former_face);
5608 SET_FRAME_GARBAGED (cache->f);
5608 } 5609 }
5609 5610
5610 if (FRAME_WINDOW_P (cache->f)) 5611 if (FRAME_WINDOW_P (cache->f))
@@ -6790,10 +6791,10 @@ Each element is of the form:
6790 (FACE REPLACEMENT...), 6791 (FACE REPLACEMENT...),
6791 6792
6792which causes display of the face FACE to use REPLACEMENT... instead. 6793which causes display of the face FACE to use REPLACEMENT... instead.
6793REPLACEMENT... is interpreted the same way the value of a `face' text 6794REPLACEMENT... is interpreted the same way as the value of a `face'
6794property is: it may be (1) A face name, (2) A list of face names, (3) A 6795text property: it may be (1) A face name, (2) A list of face names,
6795property-list of face attribute/value pairs, or (4) A list of face names 6796(3) A property-list of face attribute/value pairs, or (4) A list of
6796intermixed with lists containing face attribute/value pairs. 6797face names or lists containing face attribute/value pairs.
6797 6798
6798Multiple entries in REPLACEMENT... are merged together to form the final 6799Multiple entries in REPLACEMENT... are merged together to form the final
6799result, with faces or attributes earlier in the list taking precedence 6800result, with faces or attributes earlier in the list taking precedence
@@ -6817,7 +6818,11 @@ face definitions. For instance, the mode my-mode could define a face
6817`my-mode-default', and then in the mode setup function, do: 6818`my-mode-default', and then in the mode setup function, do:
6818 6819
6819 (set (make-local-variable 'face-remapping-alist) 6820 (set (make-local-variable 'face-remapping-alist)
6820 '((default my-mode-default)))). */); 6821 '((default my-mode-default)))).
6822
6823Because Emacs normally only redraws screen areas when the underlying
6824buffer contents change, you may need to call `redraw-display' after
6825changing this variable for it to take effect. */);
6821 Vface_remapping_alist = Qnil; 6826 Vface_remapping_alist = Qnil;
6822 6827
6823 DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist, 6828 DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist,
diff --git a/src/xfns.c b/src/xfns.c
index 3f4f32bbb2c..5a96598eaee 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -205,6 +205,7 @@ extern Lisp_Object Vsystem_name;
205/* The below are defined in frame.c. */ 205/* The below are defined in frame.c. */
206 206
207extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; 207extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
208extern Lisp_Object Qtooltip;
208 209
209#if GLYPH_DEBUG 210#if GLYPH_DEBUG
210int image_cache_refcount, dpyinfo_refcount; 211int image_cache_refcount, dpyinfo_refcount;
@@ -2450,6 +2451,7 @@ x_window (f, window_prompting, minibuffer_only)
2450 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; 2451 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
2451 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; 2452 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;
2452 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; 2453 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
2454 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
2453 XtSetValues (pane_widget, al, ac); 2455 XtSetValues (pane_widget, al, ac);
2454 f->output_data.x->column_widget = pane_widget; 2456 f->output_data.x->column_widget = pane_widget;
2455 2457
@@ -2465,6 +2467,7 @@ x_window (f, window_prompting, minibuffer_only)
2465 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; 2467 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
2466 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; 2468 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++;
2467 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; 2469 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
2470 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
2468 frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, 2471 frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget,
2469 al, ac); 2472 al, ac);
2470 2473
@@ -4002,7 +4005,7 @@ select_visual (struct x_display_info *dpyinfo)
4002 XVisualInfo vinfo; 4005 XVisualInfo vinfo;
4003 4006
4004 strcpy (s, SDATA (value)); 4007 strcpy (s, SDATA (value));
4005 dash = index (s, '-'); 4008 dash = strchr (s, '-');
4006 if (dash) 4009 if (dash)
4007 { 4010 {
4008 dpyinfo->n_planes = atoi (dash + 1); 4011 dpyinfo->n_planes = atoi (dash + 1);
@@ -4845,9 +4848,8 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms, Lisp_Obje
4845 change_frame_size (f, height, width, 1, 0, 0); 4848 change_frame_size (f, height, width, 1, 0, 0);
4846 4849
4847 /* Add `tooltip' frame parameter's default value. */ 4850 /* Add `tooltip' frame parameter's default value. */
4848 if (NILP (Fframe_parameter (frame, intern ("tooltip")))) 4851 if (NILP (Fframe_parameter (frame, Qtooltip)))
4849 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 4852 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtooltip, Qt), Qnil));
4850 Qnil));
4851 4853
4852 /* FIXME - can this be done in a similar way to normal frames? 4854 /* FIXME - can this be done in a similar way to normal frames?
4853 http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */ 4855 http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00641.html */
diff --git a/src/xmenu.c b/src/xmenu.c
index 431ef58e0b1..93a40792aec 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -676,6 +676,14 @@ x_activate_menubar (FRAME_PTR f)
676 set_frame_menubar (f, 0, 1); 676 set_frame_menubar (f, 0, 1);
677 BLOCK_INPUT; 677 BLOCK_INPUT;
678#ifdef USE_GTK 678#ifdef USE_GTK
679 /* If we click outside any menu item, the menu bar still grabs.
680 So we send Press and the Release. If outside, grab is released.
681 If on a menu item, it is popped up normally.
682 PutBack is like a stack, so we put back in reverse order. */
683 f->output_data.x->saved_menu_event->type = ButtonRelease;
684 XPutBackEvent (f->output_data.x->display_info->display,
685 f->output_data.x->saved_menu_event);
686 f->output_data.x->saved_menu_event->type = ButtonPress;
679 XPutBackEvent (f->output_data.x->display_info->display, 687 XPutBackEvent (f->output_data.x->display_info->display,
680 f->output_data.x->saved_menu_event); 688 f->output_data.x->saved_menu_event);
681 popup_activated_flag = 1; 689 popup_activated_flag = 1;
@@ -1285,6 +1293,9 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1285 } 1293 }
1286 1294
1287 { 1295 {
1296 if (f->output_data.x->menubar_widget)
1297 XtRealizeWidget (f->output_data.x->menubar_widget);
1298
1288 int menubar_size 1299 int menubar_size
1289 = (f->output_data.x->menubar_widget 1300 = (f->output_data.x->menubar_widget
1290 ? (f->output_data.x->menubar_widget->core.height 1301 ? (f->output_data.x->menubar_widget->core.height
@@ -1385,7 +1396,7 @@ free_frame_menubar (f)
1385 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL); 1396 XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
1386 } 1397 }
1387#endif 1398#endif
1388 1399 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
1389 UNBLOCK_INPUT; 1400 UNBLOCK_INPUT;
1390 } 1401 }
1391} 1402}
diff --git a/src/xterm.c b/src/xterm.c
index d1bf9eaa5ea..3ec0636fc60 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -753,24 +753,9 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
753 Window window = FRAME_X_WINDOW (f); 753 Window window = FRAME_X_WINDOW (f);
754 GC gc = f->output_data.x->normal_gc; 754 GC gc = f->output_data.x->normal_gc;
755 struct face *face = p->face; 755 struct face *face = p->face;
756 int rowY;
757 756
758 /* Must clip because of partially visible lines. */ 757 /* Must clip because of partially visible lines. */
759 rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 758 x_clip_to_row (w, row, -1, gc);
760 if (p->y < rowY)
761 {
762 /* Adjust position of "bottom aligned" bitmap on partially
763 visible last row. */
764 int oldY = row->y;
765 int oldVH = row->visible_height;
766 row->visible_height = p->h;
767 row->y -= rowY - p->y;
768 x_clip_to_row (w, row, -1, gc);
769 row->y = oldY;
770 row->visible_height = oldVH;
771 }
772 else
773 x_clip_to_row (w, row, -1, gc);
774 759
775 if (!p->overlay_p) 760 if (!p->overlay_p)
776 { 761 {