diff options
| author | Stefan Monnier | 2010-09-13 16:40:48 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-09-13 16:40:48 +0200 |
| commit | cc390e46c7ba95b76ea133d98fd386214cd01709 (patch) | |
| tree | ead4400d22bd07214b782ff7e46e79d473fac419 /src | |
| parent | c566235d981eba73c88bbff00b6a1d88360b6e9f (diff) | |
| parent | c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff) | |
| download | emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.tar.gz emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.zip | |
Merge from trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.trunk | 618 | ||||
| -rw-r--r-- | src/Makefile.in | 15 | ||||
| -rw-r--r-- | src/alloc.c | 15 | ||||
| -rw-r--r-- | src/bidi.c | 3 | ||||
| -rw-r--r-- | src/biditype.h | 5 | ||||
| -rw-r--r-- | src/callproc.c | 9 | ||||
| -rw-r--r-- | src/casefiddle.c | 5 | ||||
| -rw-r--r-- | src/cmds.c | 144 | ||||
| -rw-r--r-- | src/composite.c | 53 | ||||
| -rw-r--r-- | src/config.in | 9 | ||||
| -rw-r--r-- | src/dbusbind.c | 234 | ||||
| -rw-r--r-- | src/deps.mk | 4 | ||||
| -rw-r--r-- | src/dispextern.h | 10 | ||||
| -rw-r--r-- | src/dispnew.c | 41 | ||||
| -rw-r--r-- | src/doc.c | 31 | ||||
| -rw-r--r-- | src/dosfns.c | 6 | ||||
| -rw-r--r-- | src/dosfns.h | 1 | ||||
| -rw-r--r-- | src/emacs.c | 77 | ||||
| -rw-r--r-- | src/eval.c | 32 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/floatfns.c | 8 | ||||
| -rw-r--r-- | src/fns.c | 149 | ||||
| -rw-r--r-- | src/font.c | 2 | ||||
| -rw-r--r-- | src/font.h | 2 | ||||
| -rw-r--r-- | src/fontset.c | 11 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/gtkutil.c | 103 | ||||
| -rw-r--r-- | src/gtkutil.h | 56 | ||||
| -rw-r--r-- | src/image.c | 710 | ||||
| -rw-r--r-- | src/insdel.c | 12 | ||||
| -rw-r--r-- | src/keyboard.c | 147 | ||||
| -rw-r--r-- | src/keyboard.h | 25 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/makefile.w32-in | 1 | ||||
| -rw-r--r-- | src/marker.c | 4 | ||||
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/menu.h | 6 | ||||
| -rw-r--r-- | src/msdos.c | 97 | ||||
| -rw-r--r-- | src/nsfns.m | 1 | ||||
| -rw-r--r-- | src/nsfont.m | 4 | ||||
| -rw-r--r-- | src/nsimage.m | 12 | ||||
| -rw-r--r-- | src/nsmenu.m | 14 | ||||
| -rw-r--r-- | src/nsselect.m | 15 | ||||
| -rw-r--r-- | src/nsterm.h | 6 | ||||
| -rw-r--r-- | src/nsterm.m | 15 | ||||
| -rw-r--r-- | src/process.c | 89 | ||||
| -rw-r--r-- | src/process.h | 2 | ||||
| -rw-r--r-- | src/puresize.h | 9 | ||||
| -rw-r--r-- | src/s/aix4-2.h | 4 | ||||
| -rw-r--r-- | src/s/hpux10-20.h | 7 | ||||
| -rw-r--r-- | src/s/ms-w32.h | 1 | ||||
| -rw-r--r-- | src/s/unixware.h | 2 | ||||
| -rw-r--r-- | src/syntax.c | 238 | ||||
| -rw-r--r-- | src/syntax.h | 51 | ||||
| -rw-r--r-- | src/sysdep.c | 180 | ||||
| -rw-r--r-- | src/sysselect.h | 5 | ||||
| -rw-r--r-- | src/systty.h | 124 | ||||
| -rw-r--r-- | src/term.c | 48 | ||||
| -rw-r--r-- | src/unexcoff.c | 105 | ||||
| -rw-r--r-- | src/unexmacosx.c | 2 | ||||
| -rw-r--r-- | src/w16select.c | 8 | ||||
| -rw-r--r-- | src/w32fns.c | 8 | ||||
| -rw-r--r-- | src/w32menu.c | 98 | ||||
| -rw-r--r-- | src/w32term.c | 39 | ||||
| -rw-r--r-- | src/w32uniscribe.c | 48 | ||||
| -rw-r--r-- | src/xdisp.c | 365 | ||||
| -rw-r--r-- | src/xfns.c | 12 | ||||
| -rw-r--r-- | src/xmenu.c | 20 | ||||
| -rw-r--r-- | src/xml.c | 141 | ||||
| -rw-r--r-- | src/xrdb.c | 13 | ||||
| -rw-r--r-- | src/xselect.c | 248 | ||||
| -rw-r--r-- | src/xsmfns.c | 29 | ||||
| -rw-r--r-- | src/xterm.c | 64 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
74 files changed, 2667 insertions, 2019 deletions
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk index a3e08cf699d..87b54529f2e 100644 --- a/src/ChangeLog.trunk +++ b/src/ChangeLog.trunk | |||
| @@ -1,9 +1,609 @@ | |||
| 1 | 2010-09-12 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * xml.c (Fhtml_parse_string, Fxml_parse_string): Mention BASE-URL. | ||
| 4 | |||
| 5 | 2010-09-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 6 | |||
| 7 | * fns.c (Fy_or_n_p): Move to lisp/subr.el. | ||
| 8 | (syms_of_fns): Don't defsubr Sy_or_n_p. | ||
| 9 | * lisp.h: Don't declare Fy_or_n_p. | ||
| 10 | * fileio.c (barf_or_query_if_file_exists): Fy_or_n_p -> y-or-n-p. | ||
| 11 | |||
| 12 | 2010-09-09 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 13 | |||
| 14 | * xml.c (Fxml_parse_buffer): New function to parse XML files. | ||
| 15 | |||
| 16 | 2010-09-08 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 17 | |||
| 18 | * xml.c: New file. | ||
| 19 | (Fhtml_parse_buffer): New function to interface to the libxml2 | ||
| 20 | html parsing function. | ||
| 21 | |||
| 22 | 2010-09-05 Juanma Barranquero <lekktu@gmail.com> | ||
| 23 | |||
| 24 | * biditype.h: Regenerate. | ||
| 25 | |||
| 26 | 2010-09-04 Andreas Schwab <schwab@linux-m68k.org> | ||
| 27 | |||
| 28 | * nsimage.m (ns_load_image): Check argument types. | ||
| 29 | |||
| 30 | * image.c: Remove all uses of gcpro. | ||
| 31 | (xpm_load): Check all lisp types. | ||
| 32 | (pbm_load): Likewise. | ||
| 33 | (png_load): Likewise. | ||
| 34 | (jpeg_load): Likewise. | ||
| 35 | (tiff_load): Likewise. | ||
| 36 | (gif_load): Likewise. | ||
| 37 | (imagemagick_load_image): Likewise. | ||
| 38 | (imagemagick_load): Likewise. | ||
| 39 | (svg_load): Likewise. | ||
| 40 | (gs_load): Likewise. | ||
| 41 | |||
| 42 | 2010-09-04 Eli Zaretskii <eliz@gnu.org> | ||
| 43 | |||
| 44 | * w32uniscribe.c (uniscribe_shape): Update commentary. Don't | ||
| 45 | try to reorder grapheme clusters, since LGSTRING should always | ||
| 46 | hold them in the logical order. | ||
| 47 | (uniscribe_encode_char, uniscribe_shape): Force ScriptShape to | ||
| 48 | return glyph codes in the logical order. | ||
| 49 | |||
| 50 | 2010-09-04 Andreas Schwab <schwab@linux-m68k.org> | ||
| 51 | |||
| 52 | * image.c (imagemagick_image_p): Replace bcopy by memcpy. | ||
| 53 | (imagemagick_load_image): Fix type mismatch. | ||
| 54 | (Fimagemagick_types): Likewise. Doc fix. | ||
| 55 | |||
| 56 | 2010-09-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 57 | |||
| 58 | * xterm.h (struct dpyinfo): Remove cut_buffers_initialized. | ||
| 59 | |||
| 60 | * xterm.c (x_term_init): Don't set dpyinfo->cut_buffers_initialized. | ||
| 61 | |||
| 62 | * xselect.c: Remove declaration of cut-buffer objects and functions. | ||
| 63 | (symbol_to_x_atom): Remove mapping to XA_CUT_BUFFERn. | ||
| 64 | (x_atom_to_symbol): Remove mapping to QCUT_BUFFERn. | ||
| 65 | (Fx_get_cut_buffer_internal, Fx_store_cut_buffer_internal) | ||
| 66 | (Fx_rotate_cut_buffers_internal): Remove. | ||
| 67 | (syms_of_xselect): Remove defsubr of above. | ||
| 68 | Remove intern of QCUT_BUFFERn. | ||
| 69 | |||
| 70 | 2010-09-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 71 | |||
| 72 | * cmds.c (Vblink_paren_function): Remove. | ||
| 73 | (internal_self_insert): Make it insert N chars at a time. | ||
| 74 | Don't call blink-paren-function. | ||
| 75 | (Fself_insert_command): Adjust accordingly. | ||
| 76 | (syms_of_cmds): Don't declare blink-paren-function. | ||
| 77 | |||
| 78 | 2010-08-31 Kenichi Handa <handa@m17n.org> | ||
| 79 | |||
| 80 | * dispextern.h (FACE_FOR_CHAR): Use an ASCII face for 8-bit | ||
| 81 | characters. | ||
| 82 | |||
| 83 | * term.c (encode_terminal_code): Fix the previous change. | ||
| 84 | (produce_glyphs): Don't set it->char_to_display here. | ||
| 85 | Don't handle unibyte-display-via-language-environment here. | ||
| 86 | (produce_special_glyphs): Set temp_it.char_to_display before | ||
| 87 | calling produce_glyphs. | ||
| 88 | |||
| 89 | * xdisp.c (get_next_display_element): Set it->char_to_display | ||
| 90 | here. Convert all 8-bit bytes from unibyte buffer/string to 8-bit | ||
| 91 | characters. | ||
| 92 | (get_overlay_arrow_glyph_row): Set it.char_to_display too before | ||
| 93 | calling PRODUCE_GLYPHS. | ||
| 94 | (append_space_for_newline): Save and store it->char_to_display. | ||
| 95 | Set it->char_to_display before calling PRODUCE_GLYPHS. | ||
| 96 | (extend_face_to_end_of_line): Set it->char_to_display before | ||
| 97 | calling PRODUCE_GLYPHS. | ||
| 98 | (get_glyph_face_and_encoding): Set the glyph code an 8-bit | ||
| 99 | character to its byte value. | ||
| 100 | (get_char_glyph_code): New function. | ||
| 101 | (produce_stretch_glyph): Set it2.char_to_display too before | ||
| 102 | calling x_produce_glyphs. | ||
| 103 | (x_produce_glyphs): Simplify by using the same code for ASCII and | ||
| 104 | non-ASCII characters. Don't set it->char_to_display here. Don't | ||
| 105 | handle unibyte-display-via-language-environment here. For a | ||
| 106 | charater of no glyph, use font->space_width instead of FONT_WIDTH. | ||
| 107 | |||
| 108 | 2010-08-31 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 109 | |||
| 110 | * keyboard.c (Fwindow_system): Fix compilation for USE_LISP_UNION_TYPE. | ||
| 111 | |||
| 112 | 2010-08-31 Chong Yidong <cyd@stupidchicken.com> | ||
| 113 | |||
| 114 | * keyboard.c (command_loop_1): Don't call x-set-selection on tty. | ||
| 115 | |||
| 116 | 2010-08-30 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 117 | |||
| 118 | * marker.c (Fcopy_marker): Make the first arg optional. | ||
| 119 | |||
| 120 | 2010-08-30 Kenichi Handa <handa@m17n.org> | ||
| 121 | |||
| 122 | * composite.c (composition_update_it): Fix computing of | ||
| 123 | cmp_it->width. | ||
| 124 | |||
| 125 | 2010-08-29 Kenichi Handa <handa@m17n.org> | ||
| 126 | |||
| 127 | * term.c (encode_terminal_code): Encode byte chars to the | ||
| 128 | corresponding bytes. | ||
| 129 | |||
| 130 | 2010-08-29 Jan Djärv <jan.h.d@swipnet.se> | ||
| 131 | |||
| 132 | * nsterm.m (ns_draw_window_cursor): Draw BAR_CURSOR correct for R2L. | ||
| 133 | |||
| 134 | 2010-08-26 Kenichi Handa <handa@m17n.org> | ||
| 135 | |||
| 136 | * xdisp.c (compute_stop_pos): Pay attention to bidi scan direction | ||
| 137 | on calling composition_compute_stop_pos. | ||
| 138 | |||
| 139 | 2010-08-25 Kenichi Handa <handa@m17n.org> | ||
| 140 | |||
| 141 | * fontset.c (reorder_font_vector): Prefer a font-spec specifying | ||
| 142 | :otf. | ||
| 143 | |||
| 144 | * composite.c (composition_compute_stop_pos): Don't break | ||
| 145 | composition at PT. | ||
| 146 | (composition_reseat_it): Likewise. Fix calculation of character | ||
| 147 | position starting a composition. | ||
| 148 | (Fcomposition_get_gstring): Don't limit the number of components | ||
| 149 | for automatic composition. | ||
| 150 | |||
| 151 | 2010-08-25 Kenichi Handa <handa@m17n.org> | ||
| 152 | |||
| 153 | * composite.c (composition_compute_stop_pos): In forward search, | ||
| 154 | pay attention to the possibility that some character after ENDPOS | ||
| 155 | will be composed with charactrs before ENDPOS. | ||
| 156 | |||
| 157 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 158 | |||
| 159 | * keyboard.c (command_loop_1): Don't clobber primary selection | ||
| 160 | during handle-switch-frame (Bug#6872). | ||
| 161 | |||
| 162 | 2010-08-23 Michael Albinus <michael.albinus@gmx.de> | ||
| 163 | |||
| 164 | * dbusbind.c: Accept UNIX domain sockets as bus address. | ||
| 165 | (Fdbus_close_bus): New function. | ||
| 166 | (Vdbus_registered_buses): New variable. | ||
| 167 | (xd_initialize): Implement string as bus address. | ||
| 168 | (Fdbus_init_bus): Add bus to Vdbus_registered_buses). | ||
| 169 | (Fdbus_get_unique_name, Fdbus_call_method) | ||
| 170 | (Fdbus_call_method_asynchronously, Fdbus_method_return_internal) | ||
| 171 | (Fdbus_method_error_internal, Fdbus_send_signal) | ||
| 172 | (Fdbus_register_signal, Fdbus_register_method): Remove bus type | ||
| 173 | check. This is done in xd_initialize_bus. Adapt doc string, if | ||
| 174 | necessary. | ||
| 175 | (xd_pending_messages, xd_read_queued_messages): Loop over buses in | ||
| 176 | Vdbus_registered_buses. | ||
| 177 | (Vdbus_registered_objects_table): Create hash. | ||
| 178 | |||
| 179 | 2010-08-22 Juri Linkov <juri@jurta.org> | ||
| 180 | |||
| 181 | * keyboard.c (Fexecute_extended_command): Move reading a command name | ||
| 182 | with `completing-read' to a new Elisp function `read-extended-command'. | ||
| 183 | Call it to read a command to `function' (bug#5364, bug#5214). | ||
| 184 | |||
| 185 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 186 | |||
| 187 | * emacs.c (main): Remove handling of --unibyte arg (Bug#6886). | ||
| 188 | |||
| 189 | 2010-08-22 Andreas Schwab <schwab@linux-m68k.org> | ||
| 190 | |||
| 191 | * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP | ||
| 192 | instead of SAFE_ALLOCA. | ||
| 193 | |||
| 194 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 195 | |||
| 196 | * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA | ||
| 197 | (Bug#6214). | ||
| 198 | |||
| 199 | 2010-08-22 Jan Djärv <jan.h.d@swipnet.se> | ||
| 200 | |||
| 201 | * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S. | ||
| 202 | |||
| 203 | 2010-08-22 Jan Djärv <jan.h.d@swipnet.se> | ||
| 204 | |||
| 205 | * doc.c (Fsnarf_documentation): Initialize skip_file before | ||
| 206 | build-files test. | ||
| 207 | |||
| 208 | 2010-08-22 Peter O'Gorman <pogma@thewrittenword.com> (tiny change) | ||
| 209 | |||
| 210 | * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK): | ||
| 211 | New definitions. | ||
| 212 | (HAVE_TERMIO): Remove. | ||
| 213 | |||
| 214 | 2010-08-22 Eli Zaretskii <eliz@gnu.org> | ||
| 215 | |||
| 216 | * deps.mk (sysdep.o, msdos.o): Depend on sysselect.h. | ||
| 217 | |||
| 218 | * sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff | ||
| 219 | for w32. | ||
| 220 | |||
| 221 | * s/ms-w32.h (HAVE_SYS_TIMEB_H): Don't #undef HAVE_SYS_SELECT_H, | ||
| 222 | it's done in nt/config.nt. | ||
| 223 | |||
| 224 | * makefile.w32-in ($(BLD)/sysdep.$(O)): Depend on sysselect.h. | ||
| 225 | |||
| 226 | * unexcoff.c (report_error, make_hdr, write_segment) | ||
| 227 | (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec): | ||
| 228 | Convert argument lists and prototypes to ANSI C. | ||
| 229 | (make_hdr, write_segment): Remove unused variables. | ||
| 230 | (unexec): Remove commented-out line. Initialize `new' to shut up | ||
| 231 | compiler warnings. | ||
| 232 | |||
| 233 | 2010-08-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 234 | |||
| 235 | Simplify termio code. | ||
| 236 | All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so | ||
| 237 | HAVE_TERMIO code is obsolete. | ||
| 238 | Replace HAVE_TERMIOS conditionals with !DOS_NT. | ||
| 239 | * systty.h: Do not define HAVE_TCATTR. | ||
| 240 | Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code. | ||
| 241 | Do not define EMACS_HAVE_TTY_PGRP. Only define | ||
| 242 | EMACS_GET_TTY_PGRP for !DOS_NT. | ||
| 243 | * sysdep.c: Include sysselect.h unconditionally. Do not include | ||
| 244 | sys/ioctl.h and termios.h, systty.h does it. Use | ||
| 245 | HAVE_SYS_UTSNAME_H instead of USG as an include guard. | ||
| 246 | (init_baud_rate): Remove HAVE_TERMIO code. | ||
| 247 | (child_setup_tty): Remove HAVE_TERMIO code. | ||
| 248 | (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS | ||
| 249 | and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. | ||
| 250 | (new_ltchars, new_tchars): Remove, unused. | ||
| 251 | (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS | ||
| 252 | code. Remove special casing for __mips__, it was a no-op. Remove | ||
| 253 | HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. | ||
| 254 | (init_sys_modes): Remove HPUX special case. | ||
| 255 | * process.c: Include stdlib.h unconditionally. Do not include | ||
| 256 | fcntl.h, systty.h does it. Remove conditional code for | ||
| 257 | HAVE_SERIAL, it is always true. | ||
| 258 | (process_send_signal): Remove HAVE_TERMIOS conditional, it's | ||
| 259 | always true when SIGNALS_VIA_CHARACTERS is true. | ||
| 260 | (Fcontinue_process, Fprocess_send_eof): Simplify conditionals: | ||
| 261 | !WINDOWSNT means HAVE_TERMIOS. | ||
| 262 | (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS | ||
| 263 | conditional, which is true for all HAVE_TERMIOS systems. | ||
| 264 | * keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT | ||
| 265 | instead of HAVE_TERMIOS. | ||
| 266 | * emacs.c (shut_down_emacs): Use !defined DOS_NT instead of | ||
| 267 | EMACS_HAVE_TTY_PGRP. | ||
| 268 | * callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the | ||
| 269 | non-MSDOS, non-WINDOWSNT code, it's only defined for such systems | ||
| 270 | anyway. | ||
| 271 | |||
| 272 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> | ||
| 273 | |||
| 274 | * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in | ||
| 275 | mirroring pixel positions. | ||
| 276 | |||
| 277 | 2010-08-20 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 278 | |||
| 279 | * alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove, | ||
| 280 | write only. | ||
| 281 | (init_alloc_once): Remove writes to malloc_sbrk_unused, and | ||
| 282 | malloc_sbrk_used, nothing uses them. | ||
| 283 | |||
| 284 | * puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not | ||
| 285 | defined, unconditionally defined in lisp.h. | ||
| 286 | |||
| 287 | * term.c: Do not include <termios.h>, systty.h does it. | ||
| 288 | |||
| 289 | * s/unixware.h (HAVE_TCATTR): | ||
| 290 | * s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed. | ||
| 291 | systty.h defines it when HAVE_TERMIOS is defined. | ||
| 292 | |||
| 293 | 2010-08-20 Eli Zaretskii <eliz@gnu.org> | ||
| 294 | |||
| 295 | * dispnew.c (buffer_posn_from_coords): Fix last change for text | ||
| 296 | terminals: add one-character offset for R2L lines. | ||
| 297 | |||
| 298 | * emacs.c <emacs_version>: Add a comment regarding | ||
| 299 | msdos/mainmake.v2's dependency on the syntax of this declaration. | ||
| 300 | |||
| 301 | 2010-08-20 Eli Zaretskii <eliz@gnu.org> | ||
| 302 | |||
| 303 | * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer | ||
| 304 | position for R2L lines by mirroring the pixel position wrt the | ||
| 305 | text are box. Improve commentary. | ||
| 306 | |||
| 307 | 2010-08-20 Andreas Schwab <schwab@linux-m68k.org> | ||
| 308 | |||
| 309 | * image.c (imagemagick_clear_image): Remove debugging output. | ||
| 310 | |||
| 311 | 2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 312 | |||
| 313 | * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove. | ||
| 314 | (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars. | ||
| 315 | (internal_self_insert): Run Qpost_self_insert_hook rather than handle | ||
| 316 | self-insert-face. | ||
| 317 | (syms_of_cmds): Initialize the new vars. | ||
| 318 | |||
| 319 | 2010-08-19 Jason Rumney <jasonr@gnu.org> | ||
| 320 | |||
| 321 | * w32menu.c (set_frame_menubar): Remove call to undefined function. | ||
| 322 | |||
| 323 | * w32fns.c (w32_wnd_proc): Don't check context before initializing. | ||
| 324 | |||
| 325 | 2010-08-19 Jan Djärv <jan.h.d@swipnet.se> | ||
| 326 | |||
| 327 | * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary". | ||
| 328 | |||
| 329 | 2010-08-18 Eli Zaretskii <eliz@gnu.org> | ||
| 330 | |||
| 331 | * xterm.c (x_draw_bar_cursor): | ||
| 332 | * w32term.c (x_draw_bar_cursor): If the character under cursor is | ||
| 333 | R2L, draw the bar cursor on its right rather than on its left. | ||
| 334 | |||
| 335 | 2010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 336 | |||
| 337 | * eval.c (Fdefmacro): Only obey one declaration. | ||
| 338 | |||
| 339 | * casefiddle.c (casify_region): Setup gl_state. | ||
| 340 | |||
| 341 | 2010-08-18 Jan Djärv <jan.h.d@swipnet.se> | ||
| 342 | |||
| 343 | * nsterm.m (ns_define_frame_cursor): Call x_update_cursor (Bug#6868). | ||
| 344 | |||
| 345 | 2010-08-18 Jan Djärv <jan.h.d@swipnet.se> | ||
| 346 | |||
| 347 | * gtkutil.c (update_frame_tool_bar): Literal stings are const char*. | ||
| 348 | |||
| 349 | 2010-08-18 David De La Harpe Golden <david@harpegolden.net> | ||
| 350 | |||
| 351 | * nsselect.m (QCLIPBOARD, NXPrimaryPboard): Define. | ||
| 352 | (symbol_to_nsstring): Map QCLIPBOARD => NSGeneralPboard, | ||
| 353 | QPRIMARY => NXPrimaryPboard. | ||
| 354 | (ns_string_to_symbol): NSGeneralPboard => QCLIPBOARD, | ||
| 355 | NXPrimaryPboard => QPRIMARY. | ||
| 356 | (nxatoms_of_nsselect): NXPrimaryPboard = PrimarySelection, | ||
| 357 | NXSecondaryPboard = SecondarySelection. | ||
| 358 | (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677). | ||
| 359 | |||
| 360 | 2010-08-18 Joakim Verona <joakim@verona.se> | ||
| 361 | |||
| 362 | * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is | ||
| 363 | defined: | ||
| 364 | (imagemagick_image_p): New function to test for ImageMagic image. | ||
| 365 | (imagemagick_load): New function to load ImageMagick image. | ||
| 366 | (imagemagick_load_image): New function, helper for imagemagick_load. | ||
| 367 | (imagemagick-types): New function. | ||
| 368 | (Qimagemagick): New Lisp_object. | ||
| 369 | (imagemagick-render-type): New variable, decides which renderer to use. | ||
| 370 | |||
| 371 | 2010-08-17 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 372 | |||
| 373 | * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL | ||
| 374 | is a string. | ||
| 375 | |||
| 376 | 2010-08-17 Jan Djärv <jan.h.d@swipnet.se> | ||
| 377 | |||
| 378 | * nsfns.m (ns_frame_parm_handlers): Add a slot for the | ||
| 379 | x_set_tool_bar_position handler. | ||
| 380 | |||
| 381 | 2010-08-17 Eli Zaretskii <eliz@gnu.org> | ||
| 382 | |||
| 383 | * w32fns.c <w32_frame_parm_handlers>: Add a slot for the | ||
| 384 | x_set_tool_bar_position handler, needed to support changes from | ||
| 385 | 2010-07-29T16:49:59Z!jan.h.d@swipnet.se for positioning the tool bar. (Bug#6796) | ||
| 386 | |||
| 387 | 2010-08-16 Jan Djärv <jan.h.d@swipnet.se> | ||
| 388 | |||
| 389 | * nsselect.m: include keyboard.h for QPRIMARY, remove its | ||
| 390 | declaration (Bug#6863). | ||
| 391 | (syms_of_nsselect): Don't intern QPRIMARY. | ||
| 392 | |||
| 393 | * xselect.c: Remove declaration of QPRIMARY (Bug#6864). | ||
| 394 | |||
| 395 | * keyboard.h (QPRIMARY): Declare (Bug#6864). | ||
| 396 | |||
| 397 | 2010-08-16 Chong Yidong <cyd@stupidchicken.com> | ||
| 398 | |||
| 399 | * keyboard.c (command_loop_1): Avoid setting selection twice, | ||
| 400 | since it's done in deactivate-mark as well. | ||
| 401 | (Vselect_active_regions): Change default to t. Replace `lazy' | ||
| 402 | with non-default value `only', meaning only set PRIMARY for | ||
| 403 | temporarily active regions. | ||
| 404 | |||
| 405 | * insdel.c (prepare_to_modify_buffer): Handle `only' value of | ||
| 406 | select-active-regions. | ||
| 407 | |||
| 408 | 2010-08-15 Jan Djärv <jan.h.d@swipnet.se> | ||
| 409 | |||
| 410 | * keyboard.c (parse_tool_bar_item): Put in a bad label if :label | ||
| 411 | isn't a string. | ||
| 412 | |||
| 413 | 2010-08-15 Andreas Schwab <schwab@linux-m68k.org> | ||
| 414 | |||
| 415 | * keyboard.c (parse_tool_bar_item): Avoid excessive use of strlen. | ||
| 416 | |||
| 417 | 2010-08-15 Jan Djärv <jan.h.d@swipnet.se> | ||
| 418 | |||
| 419 | * keyboard.c (parse_tool_bar_item): malloc buf. | ||
| 420 | Set TOOL_BAR_ITEM_LABEL to empty string if not set to | ||
| 421 | new_lbl (Bug#6855). | ||
| 422 | |||
| 423 | 2010-08-14 Eli Zaretskii <eliz@gnu.org> | ||
| 424 | |||
| 425 | * xterm.c (x_draw_stretch_glyph_string): | ||
| 426 | * w32term.c (x_draw_stretch_glyph_string): In R2L rows, display | ||
| 427 | the cursor on the right edge of the stretch glyph. | ||
| 428 | |||
| 429 | * xdisp.c (window_box_right_offset, window_box_right): | ||
| 430 | Fix commentary. | ||
| 431 | |||
| 432 | * xdisp.c (Fcurrent_bidi_paragraph_direction): Fix paragraph | ||
| 433 | direction when point is inside a run of whitespace characters. | ||
| 434 | |||
| 435 | * bidi.c (bidi_at_paragraph_end): Remove obsolete comment. | ||
| 436 | |||
| 437 | 2010-08-14 Jason Rumney <jasonr@gnu.org> | ||
| 438 | |||
| 439 | * keyboard.c (lispy_function_keys): Do not define VK_PACKET (bug#4836) | ||
| 440 | |||
| 441 | 2010-08-14 Chong Yidong <cyd@stupidchicken.com> | ||
| 442 | |||
| 443 | * fns.c (Fmake_hash_table): Doc fix (Bug#6851). | ||
| 444 | |||
| 445 | 2010-08-13 Jason Rumney <jasonr@gnu.org> | ||
| 446 | |||
| 447 | * w32menu.c (simple_dialog_show): Use unicode message box if available. | ||
| 448 | (MessageBoxW_Proc): New function typedef. | ||
| 449 | (unicode-message-box): New function pointer. | ||
| 450 | (globals_of_w32menu): Import it from user32.dll. (Bug#5629) | ||
| 451 | |||
| 452 | 2010-08-13 Jan Djärv <jan.h.d@swipnet.se> | ||
| 453 | |||
| 454 | * frame.h (Qtool_bar_position): Declare. | ||
| 455 | |||
| 456 | * xfns.c (Fx_create_frame): Call x_default_parameter for | ||
| 457 | Qtool_bar_position. | ||
| 458 | |||
| 459 | 2010-08-13 Eli Zaretskii <eliz@gnu.org> | ||
| 460 | |||
| 461 | * unexcoff.c: Remove the parts used when "emacs" is not defined. | ||
| 462 | (report_error, report_error_1): Ditto. | ||
| 463 | (write_segment): Remove "#if 0" unused code. | ||
| 464 | (make_hdr): Remove code that was "#ifndef NO_REMAP" before | ||
| 465 | NO_REMAP was removed (in 2010-07-29T03:25:08Z!dann@ics.uci.edu). | ||
| 466 | (start_of_text): Remove unused function (was used only if NO_REMAP | ||
| 467 | was NOT defined). | ||
| 468 | |||
| 469 | * msdos.c (IT_set_face): Fix format string to match argument | ||
| 470 | types. | ||
| 471 | (IT_write_glyphs, IT_note_mode_line_highlight) | ||
| 472 | (IT_set_frame_parameters): Remove unused variables. | ||
| 473 | (x_set_menu_bar_lines): Declare set_menu_bar_lines. | ||
| 474 | (IT_set_terminal_modes): Disambiguate expression in if clause. | ||
| 475 | (Fmsdos_remember_default_colors): Return Qnil. | ||
| 476 | (IT_set_frame_parameters): Add parens to disambiguate boolean | ||
| 477 | expression for logging the cursor type to termscript. | ||
| 478 | (keyboard_layout_list, keypad_translate_map) | ||
| 479 | (grey_key_translate_map): Add braces in inner initializers. | ||
| 480 | (dos_rawgetc): Add parens in condition for mouse-3 button-press. | ||
| 481 | (dos_rawgetc): Remove unused label. | ||
| 482 | (XMenuActivate): Add braces to remove ambiguous `else'. | ||
| 483 | (dos_ttraw): Always return a value. | ||
| 484 | (spawnve): Declare. | ||
| 485 | (run_msdos_command): Cast 3rd arg of spawnve to "char **". | ||
| 486 | |||
| 487 | * dosfns.h (x_set_title): Declare. | ||
| 488 | |||
| 489 | * w16select.c (Fw16_set_clipboard_data, Fw16_get_clipboard_data): | ||
| 490 | Remove unused variables. | ||
| 491 | |||
| 492 | * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Remove unused | ||
| 493 | variables. | ||
| 494 | (init_dosfns): Declare get_lim_data. | ||
| 495 | (system_process_attributes): Declare Fget_internal_run_time. | ||
| 496 | |||
| 497 | * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Fix argument | ||
| 498 | list to be consistent with menu.h. | ||
| 499 | |||
| 500 | * w32menu.c (add_menu_item, name_is_separator): Shut up compiler | ||
| 501 | warnings due to mixing of "char *" and "const char *". | ||
| 502 | |||
| 503 | 2010-08-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 504 | |||
| 505 | Introduce a new comment style "c" flag. | ||
| 506 | * syntax.c (SYNTAX_FLAGS_COMMENT_STYLEB) | ||
| 507 | (SYNTAX_FLAGS_COMMENT_STYLEC): New macros. | ||
| 508 | (SYNTAX_FLAGS_COMMENT_STYLE): Use them, add an argument. | ||
| 509 | (syntax_prefix_flag_p): New function. | ||
| 510 | (Fstring_to_syntax): Understand new "c" flag. | ||
| 511 | (Finternal_describe_syntax_value): Recognize new flag; use the | ||
| 512 | SYNTAX_FLAGS_* macros. | ||
| 513 | (scan_sexps_forward, Fparse_partial_sexp): Change representation of | ||
| 514 | comment style to accomodate the new styles. | ||
| 515 | (back_comment, forw_comment, Fforward_comment, scan_lists) | ||
| 516 | (scan_sexps_forward): Update code to obey the new comment style flag. | ||
| 517 | |||
| 518 | * syntax.h: Move SYNTAX_FLAGS_FOO() macros to syntax.c. | ||
| 519 | |||
| 520 | * casefiddle.c (casify_region): Use the new syntax_prefix_flag_p. | ||
| 521 | |||
| 522 | 2010-08-11 Jan Djärv <jan.h.d@swipnet.se> | ||
| 523 | |||
| 524 | * xfns.c (x_defined_color): If USE_GTK, call xg_check_special_colors | ||
| 525 | first. | ||
| 526 | (Fx_hide_tip): Check FRAME_LIVE_P (f) before calling xg_hide_tooltip. | ||
| 527 | |||
| 528 | * gtkutil.h (xg_check_special_colors): Declare. | ||
| 529 | |||
| 530 | * gtkutil.c (xg_check_special_colors, style_changed_cb): New functions. | ||
| 531 | (xg_create_frame_widgets): Connect theme name changes to | ||
| 532 | style_changed_cb. | ||
| 533 | |||
| 534 | * xterm.c (emacs_class): New char[] for EMACS_CLASS. | ||
| 535 | (xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class. | ||
| 536 | (x_term_init): Use char[] display_opt and name_opt instead of | ||
| 537 | string literal. file is const char*. | ||
| 538 | |||
| 539 | * xsmfns.c (NOSPLASH_OPT): Change to char[]. | ||
| 540 | (smc_save_yourself_CB): Do xstrdup on all ->type and ->name for | ||
| 541 | props. Free them at the end. | ||
| 542 | |||
| 543 | * xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "". | ||
| 544 | |||
| 545 | * xrdb.c (get_system_app): Make path const and use char *p for | ||
| 546 | non-const char. | ||
| 547 | |||
| 548 | * xmenu.c (Fx_popup_dialog): error_name is const char*. | ||
| 549 | (xmenu_show): error parameter is const char **. pane_string is const | ||
| 550 | char *. | ||
| 551 | (button_names): Is const char *. | ||
| 552 | (xdialog_show): error_name and pane_string is const. | ||
| 553 | |||
| 554 | * process.h (synch_process_death): Is const char*. | ||
| 555 | |||
| 556 | * w32menu.c (w32_menu_show): | ||
| 557 | * nsmenu.m (ns_menu_show): error parameter is const char **. | ||
| 558 | |||
| 559 | * menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter | ||
| 560 | is const char **. | ||
| 561 | |||
| 562 | * menu.c (Fx_popup_menu): error_name is const. | ||
| 563 | |||
| 564 | * keyboard.h (_widget_value): Add defined USE_GTK. Replace Boolean | ||
| 565 | with unsigned char and XtPointer with void *. | ||
| 566 | |||
| 567 | * gtkutil.h: Replace widget_value with struct _widget_value. | ||
| 568 | (enum button_type, struct _widget_value): Remove and use the one from | ||
| 569 | keyboard.h. | ||
| 570 | |||
| 571 | * gtkutil.c (get_utf8_string): Always return an allocated string. | ||
| 572 | Parameter is const. | ||
| 573 | (create_dialog, xg_create_one_menuitem, create_menus) | ||
| 574 | (xg_item_label_same_p, xg_update_menu_item): Free result from | ||
| 575 | get_utf8_string. | ||
| 576 | (xg_separator_p, xg_item_label_same_p): label is const. | ||
| 577 | |||
| 578 | * font.h (font_open_by_name): Make name const. | ||
| 579 | |||
| 580 | * font.c (font_open_by_name): Make name const. | ||
| 581 | |||
| 582 | * floatfns.c (matherr): Use a const char* variable for x->name. | ||
| 583 | |||
| 584 | * emacs.c (main): Pass char[] to putenv instead of literal. | ||
| 585 | |||
| 586 | * callproc.c (synch_process_death): Make const. | ||
| 587 | (Fcall_process): Make signame const. | ||
| 588 | |||
| 589 | * nsterm.h (parseKeyEquiv, addSubmenuWithTitle) | ||
| 590 | (addDisplayItemWithImage): Use const char*. | ||
| 591 | |||
| 592 | * nsmenu.m (parseKeyEquiv, addSubmenuWithTitle) | ||
| 593 | (addDisplayItemWithImage, update_frame_tool_bar): Use const char*. | ||
| 594 | |||
| 595 | * nsfont.m (ns_descriptor_to_entity): Use const char*. | ||
| 596 | |||
| 597 | * keyboard.h (_widget_value): name, value and key are const char*. | ||
| 598 | |||
| 599 | * unexmacosx.c (unexec_error): Use const char *. | ||
| 600 | |||
| 1 | 2010-08-09 Dan Nicolaescu <dann@ics.uci.edu> | 601 | 2010-08-09 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 602 | ||
| 3 | * font.h (font_parse_xlfd, font_parse_fcname, font_unparse_fcname) | 603 | * font.h (font_parse_xlfd, font_parse_fcname, font_unparse_fcname) |
| 4 | (font_parse_name): font_open_by_name): | 604 | (font_parse_name, font_open_by_name): |
| 5 | * font.c (font_parse_xlfd, font_parse_fcname, font_unparse_fcname) | 605 | * font.c (font_parse_xlfd, font_parse_fcname, font_unparse_fcname) |
| 6 | (font_parse_name): font_open_by_name): Remove const. | 606 | (font_parse_name, font_open_by_name): Remove const. |
| 7 | 607 | ||
| 8 | 2010-08-09 Andreas Schwab <schwab@linux-m68k.org> | 608 | 2010-08-09 Andreas Schwab <schwab@linux-m68k.org> |
| 9 | 609 | ||
| @@ -64,10 +664,10 @@ | |||
| 64 | 664 | ||
| 65 | 2010-08-08 Kenichi Handa <handa@m17n.org> | 665 | 2010-08-08 Kenichi Handa <handa@m17n.org> |
| 66 | 666 | ||
| 67 | * charset.c: Include <stdlib.h> | 667 | * charset.c: Include <stdlib.h>. |
| 68 | (struct charset_sort_data): New struct. | 668 | (struct charset_sort_data): New struct. |
| 69 | (charset_compare): New function. | 669 | (charset_compare): New function. |
| 70 | (Fsort_charsets): New funciton. | 670 | (Fsort_charsets): New function. |
| 71 | (syms_of_charset): Declare Fsort_charsets as a Lisp function. | 671 | (syms_of_charset): Declare Fsort_charsets as a Lisp function. |
| 72 | 672 | ||
| 73 | * coding.c (decode_coding_iso_2022): Fix checking of dimension | 673 | * coding.c (decode_coding_iso_2022): Fix checking of dimension |
| @@ -126,17 +726,17 @@ | |||
| 126 | 726 | ||
| 127 | * s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused. | 727 | * s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused. |
| 128 | 728 | ||
| 129 | * xrdb.c: Remove include guard. Remove | 729 | * xrdb.c: Remove include guard. |
| 130 | DECLARE_GETPWUID_WITH_UID_T conditional it had no effect. | 730 | Remove DECLARE_GETPWUID_WITH_UID_T conditional it had no effect. |
| 131 | Remove #if 0 code. Replace malloc->xmalloc, free->xfree, | 731 | Remove #if 0 code. Replace malloc->xmalloc, free->xfree, |
| 132 | realloc->xrealloc instead of using #defines. | 732 | realloc->xrealloc instead of using #defines. |
| 133 | 733 | ||
| 134 | 2010-08-08 Eli Zaretskii <eliz@gnu.org> | 734 | 2010-08-08 Eli Zaretskii <eliz@gnu.org> |
| 135 | 735 | ||
| 136 | * cmds.c (Fforward_line, Fbeginning_of_line, Fend_of_line): | 736 | * cmds.c (Fforward_line, Fbeginning_of_line, Fend_of_line): |
| 137 | * editfns.c (Fline_beginning_position, Fline_end_position): State | 737 | * editfns.c (Fline_beginning_position, Fline_end_position): |
| 138 | in the doc strings that start and end of line are in the logical | 738 | State in the doc strings that start and end of line are in the |
| 139 | order. | 739 | logical order. |
| 140 | 740 | ||
| 141 | * xdisp.c (display_line): Move the handling of overlay arrow after | 741 | * xdisp.c (display_line): Move the handling of overlay arrow after |
| 142 | the call to find_row_edges. (Bug#6699) | 742 | the call to find_row_edges. (Bug#6699) |
diff --git a/src/Makefile.in b/src/Makefile.in index a8d400c7c39..d91b95d86e3 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | |||
| 1 | # Makefile for GNU Emacs. | 2 | # Makefile for GNU Emacs. |
| 2 | # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, | 3 | # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, |
| 3 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | 4 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
| @@ -222,6 +223,12 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ | |||
| 222 | RSVG_LIBS= @RSVG_LIBS@ | 223 | RSVG_LIBS= @RSVG_LIBS@ |
| 223 | RSVG_CFLAGS= @RSVG_CFLAGS@ | 224 | RSVG_CFLAGS= @RSVG_CFLAGS@ |
| 224 | 225 | ||
| 226 | IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ | ||
| 227 | IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ | ||
| 228 | |||
| 229 | LIBXML2_LIBS = @LIBXML2_LIBS@ | ||
| 230 | LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ | ||
| 231 | |||
| 225 | ## widget.o if USE_X_TOOLKIT, otherwise empty. | 232 | ## widget.o if USE_X_TOOLKIT, otherwise empty. |
| 226 | WIDGET_OBJ=@WIDGET_OBJ@ | 233 | WIDGET_OBJ=@WIDGET_OBJ@ |
| 227 | 234 | ||
| @@ -315,7 +322,8 @@ MKDEPDIR=@MKDEPDIR@ | |||
| 315 | ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. | 322 | ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. |
| 316 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ | 323 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ |
| 317 | ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ | 324 | ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ |
| 318 | ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} \ | 325 | ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} \ |
| 326 | ${LIBXML2_CFLAGS} ${DBUS_CFLAGS} \ | ||
| 319 | ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ | 327 | ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ |
| 320 | ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ | 328 | ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ |
| 321 | ${C_WARNINGS_SWITCH} ${CFLAGS} | 329 | ${C_WARNINGS_SWITCH} ${CFLAGS} |
| @@ -344,7 +352,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | |||
| 344 | syntax.o $(UNEXEC_OBJ) bytecode.o \ | 352 | syntax.o $(UNEXEC_OBJ) bytecode.o \ |
| 345 | process.o callproc.o \ | 353 | process.o callproc.o \ |
| 346 | region-cache.o sound.o atimer.o \ | 354 | region-cache.o sound.o atimer.o \ |
| 347 | doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ | 355 | doprnt.o strftime.o intervals.o textprop.o composite.o md5.o xml.o \ |
| 348 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) | 356 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) |
| 349 | 357 | ||
| 350 | ## Object files used on some machine or other. | 358 | ## Object files used on some machine or other. |
| @@ -590,7 +598,8 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \ | |||
| 590 | ## duplicated symbols. If the standard libraries were compiled | 598 | ## duplicated symbols. If the standard libraries were compiled |
| 591 | ## with GCC, we might need LIB_GCC again after them. | 599 | ## with GCC, we might need LIB_GCC again after them. |
| 592 | LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ | 600 | LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ |
| 593 | $(RSVG_LIBS) $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ | 601 | $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ |
| 602 | ${LIBXML2_LIBS} $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ | ||
| 594 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ | 603 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ |
| 595 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ | 604 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ |
| 596 | $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) | 605 | $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) |
diff --git a/src/alloc.c b/src/alloc.c index 23debbdf2e8..d83d8937722 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -214,16 +214,6 @@ int abort_on_gc; | |||
| 214 | 214 | ||
| 215 | int garbage_collection_messages; | 215 | int garbage_collection_messages; |
| 216 | 216 | ||
| 217 | #ifndef VIRT_ADDR_VARIES | ||
| 218 | extern | ||
| 219 | #endif /* VIRT_ADDR_VARIES */ | ||
| 220 | int malloc_sbrk_used; | ||
| 221 | |||
| 222 | #ifndef VIRT_ADDR_VARIES | ||
| 223 | extern | ||
| 224 | #endif /* VIRT_ADDR_VARIES */ | ||
| 225 | int malloc_sbrk_unused; | ||
| 226 | |||
| 227 | /* Number of live and free conses etc. */ | 217 | /* Number of live and free conses etc. */ |
| 228 | 218 | ||
| 229 | static int total_conses, total_markers, total_symbols, total_vector_size; | 219 | static int total_conses, total_markers, total_symbols, total_vector_size; |
| @@ -6234,11 +6224,6 @@ init_alloc_once (void) | |||
| 6234 | consing_since_gc = 0; | 6224 | consing_since_gc = 0; |
| 6235 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); | 6225 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); |
| 6236 | gc_relative_threshold = 0; | 6226 | gc_relative_threshold = 0; |
| 6237 | |||
| 6238 | #ifdef VIRT_ADDR_VARIES | ||
| 6239 | malloc_sbrk_unused = 1<<22; /* A large number */ | ||
| 6240 | malloc_sbrk_used = 100000; /* as reasonable as any number */ | ||
| 6241 | #endif /* VIRT_ADDR_VARIES */ | ||
| 6242 | } | 6227 | } |
| 6243 | 6228 | ||
| 6244 | void | 6229 | void |
diff --git a/src/bidi.c b/src/bidi.c index b31de597688..a6d4d1b2506 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -497,7 +497,6 @@ bidi_peek_at_next_level (struct bidi_it *bidi_it) | |||
| 497 | static EMACS_INT | 497 | static EMACS_INT |
| 498 | bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) | 498 | bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) |
| 499 | { | 499 | { |
| 500 | /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value? */ | ||
| 501 | Lisp_Object sep_re; | 500 | Lisp_Object sep_re; |
| 502 | Lisp_Object start_re; | 501 | Lisp_Object start_re; |
| 503 | EMACS_INT val; | 502 | EMACS_INT val; |
| @@ -1534,7 +1533,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 1534 | 1533 | ||
| 1535 | we want it to be displayed as | 1534 | we want it to be displayed as |
| 1536 | 1535 | ||
| 1537 | {RLO}STet{PDF} | 1536 | {PDF}STet{RLO} |
| 1538 | 1537 | ||
| 1539 | not as | 1538 | not as |
| 1540 | 1539 | ||
diff --git a/src/biditype.h b/src/biditype.h index 60fc6374f39..868aabd9ea6 100644 --- a/src/biditype.h +++ b/src/biditype.h | |||
| @@ -83,7 +83,8 @@ | |||
| 83 | { 0x0671, 0x06D5, STRONG_AL }, | 83 | { 0x0671, 0x06D5, STRONG_AL }, |
| 84 | { 0x06D6, 0x06DC, WEAK_NSM }, | 84 | { 0x06D6, 0x06DC, WEAK_NSM }, |
| 85 | { 0x06DD, 0x06DD, WEAK_AN }, | 85 | { 0x06DD, 0x06DD, WEAK_AN }, |
| 86 | { 0x06DE, 0x06E4, WEAK_NSM }, | 86 | { 0x06DE, 0x06DE, NEUTRAL_ON }, |
| 87 | { 0x06DF, 0x06E4, WEAK_NSM }, | ||
| 87 | { 0x06E5, 0x06E6, STRONG_AL }, | 88 | { 0x06E5, 0x06E6, STRONG_AL }, |
| 88 | { 0x06E7, 0x06E8, WEAK_NSM }, | 89 | { 0x06E7, 0x06E8, WEAK_NSM }, |
| 89 | { 0x06E9, 0x06E9, NEUTRAL_ON }, | 90 | { 0x06E9, 0x06E9, NEUTRAL_ON }, |
| @@ -271,7 +272,7 @@ | |||
| 271 | { 0x2080, 0x2089, WEAK_EN }, | 272 | { 0x2080, 0x2089, WEAK_EN }, |
| 272 | { 0x208A, 0x208B, WEAK_ES }, | 273 | { 0x208A, 0x208B, WEAK_ES }, |
| 273 | { 0x208C, 0x208E, NEUTRAL_ON }, | 274 | { 0x208C, 0x208E, NEUTRAL_ON }, |
| 274 | { 0x20A0, 0x20B8, WEAK_ET }, | 275 | { 0x20A0, 0x20B9, WEAK_ET }, |
| 275 | { 0x20D0, 0x20F0, WEAK_NSM }, | 276 | { 0x20D0, 0x20F0, WEAK_NSM }, |
| 276 | { 0x2100, 0x2101, NEUTRAL_ON }, | 277 | { 0x2100, 0x2101, NEUTRAL_ON }, |
| 277 | { 0x2103, 0x2106, NEUTRAL_ON }, | 278 | { 0x2103, 0x2106, NEUTRAL_ON }, |
diff --git a/src/callproc.c b/src/callproc.c index ca9ff93a6d9..8c1384df6a1 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -115,7 +115,7 @@ Lisp_Object Qbuffer_file_type; | |||
| 115 | int synch_process_alive; | 115 | int synch_process_alive; |
| 116 | 116 | ||
| 117 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ | 117 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ |
| 118 | char *synch_process_death; | 118 | const char *synch_process_death; |
| 119 | 119 | ||
| 120 | /* Nonzero => this is the signal number that terminated the subprocess. */ | 120 | /* Nonzero => this is the signal number that terminated the subprocess. */ |
| 121 | int synch_process_termsig; | 121 | int synch_process_termsig; |
| @@ -818,7 +818,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 818 | 818 | ||
| 819 | if (synch_process_termsig) | 819 | if (synch_process_termsig) |
| 820 | { | 820 | { |
| 821 | char *signame; | 821 | const char *signame; |
| 822 | 822 | ||
| 823 | synchronize_system_messages_locale (); | 823 | synchronize_system_messages_locale (); |
| 824 | signame = strsignal (synch_process_termsig); | 824 | signame = strsignal (synch_process_termsig); |
| @@ -1231,8 +1231,6 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1231 | #else | 1231 | #else |
| 1232 | setpgrp (pid, pid); | 1232 | setpgrp (pid, pid); |
| 1233 | #endif /* USG */ | 1233 | #endif /* USG */ |
| 1234 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ | ||
| 1235 | EMACS_SET_TTY_PGRP (0, &pid); | ||
| 1236 | 1234 | ||
| 1237 | #ifdef MSDOS | 1235 | #ifdef MSDOS |
| 1238 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); | 1236 | pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); |
| @@ -1251,6 +1249,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1251 | report_file_error ("Spawning child process", Qnil); | 1249 | report_file_error ("Spawning child process", Qnil); |
| 1252 | return cpid; | 1250 | return cpid; |
| 1253 | #else /* not WINDOWSNT */ | 1251 | #else /* not WINDOWSNT */ |
| 1252 | /* setpgrp_of_tty is incorrect here; it uses input_fd. */ | ||
| 1253 | EMACS_SET_TTY_PGRP (0, &pid); | ||
| 1254 | |||
| 1254 | /* execvp does not accept an environment arg so the only way | 1255 | /* execvp does not accept an environment arg so the only way |
| 1255 | to pass this environment is to set environ. Our caller | 1256 | to pass this environment is to set environ. Our caller |
| 1256 | is responsible for restoring the ambient value of environ. */ | 1257 | is responsible for restoring the ambient value of environ. */ |
diff --git a/src/casefiddle.c b/src/casefiddle.c index 9545cf697a8..b6551618b2f 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -221,6 +221,8 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) | |||
| 221 | start_byte = CHAR_TO_BYTE (start); | 221 | start_byte = CHAR_TO_BYTE (start); |
| 222 | end_byte = CHAR_TO_BYTE (end); | 222 | end_byte = CHAR_TO_BYTE (end); |
| 223 | 223 | ||
| 224 | SETUP_BUFFER_SYNTAX_TABLE(); /* For syntax_prefix_flag_p. */ | ||
| 225 | |||
| 224 | while (start < end) | 226 | while (start < end) |
| 225 | { | 227 | { |
| 226 | int c2, len; | 228 | int c2, len; |
| @@ -243,7 +245,8 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) | |||
| 243 | && (!inword || flag != CASE_CAPITALIZE_UP)) | 245 | && (!inword || flag != CASE_CAPITALIZE_UP)) |
| 244 | c = UPCASE1 (c); | 246 | c = UPCASE1 (c); |
| 245 | if ((int) flag >= (int) CASE_CAPITALIZE) | 247 | if ((int) flag >= (int) CASE_CAPITALIZE) |
| 246 | inword = ((SYNTAX (c) == Sword) && (inword || !SYNTAX_PREFIX (c))); | 248 | inword = ((SYNTAX (c) == Sword) |
| 249 | && (inword || !syntax_prefix_flag_p (c))); | ||
| 247 | if (c != c2) | 250 | if (c != c2) |
| 248 | { | 251 | { |
| 249 | last = start; | 252 | last = start; |
diff --git a/src/cmds.c b/src/cmds.c index 4cb6ca199e7..f12e759b7a6 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -32,17 +32,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include "dispextern.h" | 32 | #include "dispextern.h" |
| 33 | #include "frame.h" | 33 | #include "frame.h" |
| 34 | 34 | ||
| 35 | Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function; | 35 | Lisp_Object Qkill_forward_chars, Qkill_backward_chars; |
| 36 | 36 | ||
| 37 | /* A possible value for a buffer's overwrite-mode variable. */ | 37 | /* A possible value for a buffer's overwrite-mode variable. */ |
| 38 | Lisp_Object Qoverwrite_mode_binary; | 38 | Lisp_Object Qoverwrite_mode_binary; |
| 39 | 39 | ||
| 40 | /* Non-nil means put this face on the next self-inserting character. */ | ||
| 41 | Lisp_Object Vself_insert_face; | ||
| 42 | |||
| 43 | /* This is the command that set up Vself_insert_face. */ | ||
| 44 | Lisp_Object Vself_insert_face_command; | ||
| 45 | |||
| 46 | static int internal_self_insert (int, int); | 40 | static int internal_self_insert (int, int); |
| 47 | 41 | ||
| 48 | DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, | 42 | DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, |
| @@ -310,50 +304,31 @@ After insertion, the value of `auto-fill-function' is called if the | |||
| 310 | { | 304 | { |
| 311 | int character = translate_char (Vtranslation_table_for_input, | 305 | int character = translate_char (Vtranslation_table_for_input, |
| 312 | XINT (last_command_event)); | 306 | XINT (last_command_event)); |
| 313 | if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) | 307 | int val = internal_self_insert (character, XFASTINT (n)); |
| 314 | { | 308 | if (val == 2) |
| 315 | XSETFASTINT (n, XFASTINT (n) - 2); | 309 | nonundocount = 0; |
| 316 | /* The first one might want to expand an abbrev. */ | 310 | frame_make_pointer_invisible (); |
| 317 | internal_self_insert (character, 1); | ||
| 318 | /* The bulk of the copies of this char can be inserted simply. | ||
| 319 | We don't have to handle a user-specified face specially | ||
| 320 | because it will get inherited from the first char inserted. */ | ||
| 321 | Finsert_char (make_number (character), n, Qt); | ||
| 322 | /* The last one might want to auto-fill. */ | ||
| 323 | internal_self_insert (character, 0); | ||
| 324 | } | ||
| 325 | else | ||
| 326 | while (XINT (n) > 0) | ||
| 327 | { | ||
| 328 | int val; | ||
| 329 | /* Ok since old and new vals both nonneg */ | ||
| 330 | XSETFASTINT (n, XFASTINT (n) - 1); | ||
| 331 | val = internal_self_insert (character, XFASTINT (n) != 0); | ||
| 332 | if (val == 2) | ||
| 333 | nonundocount = 0; | ||
| 334 | frame_make_pointer_invisible (); | ||
| 335 | } | ||
| 336 | } | 311 | } |
| 337 | 312 | ||
| 338 | return Qnil; | 313 | return Qnil; |
| 339 | } | 314 | } |
| 340 | 315 | ||
| 341 | /* Insert character C. If NOAUTOFILL is nonzero, don't do autofill | 316 | /* Insert N times character C |
| 342 | even if it is enabled. | ||
| 343 | 317 | ||
| 344 | If this insertion is suitable for direct output (completely simple), | 318 | If this insertion is suitable for direct output (completely simple), |
| 345 | return 0. A value of 1 indicates this *might* not have been simple. | 319 | return 0. A value of 1 indicates this *might* not have been simple. |
| 346 | A value of 2 means this did things that call for an undo boundary. */ | 320 | A value of 2 means this did things that call for an undo boundary. */ |
| 347 | 321 | ||
| 348 | static Lisp_Object Qexpand_abbrev; | 322 | static Lisp_Object Qexpand_abbrev; |
| 323 | static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook; | ||
| 349 | 324 | ||
| 350 | static int | 325 | static int |
| 351 | internal_self_insert (int c, int noautofill) | 326 | internal_self_insert (int c, int n) |
| 352 | { | 327 | { |
| 353 | int hairy = 0; | 328 | int hairy = 0; |
| 354 | Lisp_Object tem; | 329 | Lisp_Object tem; |
| 355 | register enum syntaxcode synt; | 330 | register enum syntaxcode synt; |
| 356 | Lisp_Object overwrite, string; | 331 | Lisp_Object overwrite; |
| 357 | /* Length of multi-byte form of C. */ | 332 | /* Length of multi-byte form of C. */ |
| 358 | int len; | 333 | int len; |
| 359 | /* Working buffer and pointer for multi-byte form of C. */ | 334 | /* Working buffer and pointer for multi-byte form of C. */ |
| @@ -396,32 +371,22 @@ internal_self_insert (int c, int noautofill) | |||
| 396 | /* This is the character after point. */ | 371 | /* This is the character after point. */ |
| 397 | int c2 = FETCH_CHAR (PT_BYTE); | 372 | int c2 = FETCH_CHAR (PT_BYTE); |
| 398 | 373 | ||
| 399 | /* Column the cursor should be placed at after this insertion. | ||
| 400 | The correct value should be calculated only when necessary. */ | ||
| 401 | int target_clm = 0; | ||
| 402 | |||
| 403 | /* Overwriting in binary-mode always replaces C2 by C. | 374 | /* Overwriting in binary-mode always replaces C2 by C. |
| 404 | Overwriting in textual-mode doesn't always do that. | 375 | Overwriting in textual-mode doesn't always do that. |
| 405 | It inserts newlines in the usual way, | 376 | It inserts newlines in the usual way, |
| 406 | and inserts any character at end of line | 377 | and inserts any character at end of line |
| 407 | or before a tab if it doesn't use the whole width of the tab. */ | 378 | or before a tab if it doesn't use the whole width of the tab. */ |
| 408 | if (EQ (overwrite, Qoverwrite_mode_binary) | 379 | if (EQ (overwrite, Qoverwrite_mode_binary)) |
| 409 | || (c != '\n' | 380 | chars_to_delete = n; |
| 410 | && c2 != '\n' | 381 | else if (c != '\n' && c2 != '\n') |
| 411 | && ! (c2 == '\t' | ||
| 412 | && XINT (current_buffer->tab_width) > 0 | ||
| 413 | && XFASTINT (current_buffer->tab_width) < 20 | ||
| 414 | && (target_clm = ((int) current_column () /* iftc */ | ||
| 415 | + XINT (Fchar_width (make_number (c)))), | ||
| 416 | target_clm % XFASTINT (current_buffer->tab_width))))) | ||
| 417 | { | 382 | { |
| 418 | int pos = PT; | 383 | int pos = PT; |
| 419 | int pos_byte = PT_BYTE; | 384 | int pos_byte = PT_BYTE; |
| 385 | /* Column the cursor should be placed at after this insertion. | ||
| 386 | The correct value should be calculated only when necessary. */ | ||
| 387 | int target_clm = ((int) current_column () /* iftc */ | ||
| 388 | + n * XINT (Fchar_width (make_number (c)))); | ||
| 420 | 389 | ||
| 421 | if (target_clm == 0) | ||
| 422 | chars_to_delete = 1; | ||
| 423 | else | ||
| 424 | { | ||
| 425 | /* The actual cursor position after the trial of moving | 390 | /* The actual cursor position after the trial of moving |
| 426 | to column TARGET_CLM. It is greater than TARGET_CLM | 391 | to column TARGET_CLM. It is greater than TARGET_CLM |
| 427 | if the TARGET_CLM is middle of multi-column | 392 | if the TARGET_CLM is middle of multi-column |
| @@ -433,14 +398,18 @@ internal_self_insert (int c, int noautofill) | |||
| 433 | chars_to_delete = PT - pos; | 398 | chars_to_delete = PT - pos; |
| 434 | 399 | ||
| 435 | if (actual_clm > target_clm) | 400 | if (actual_clm > target_clm) |
| 436 | { | 401 | { /* We will delete too many columns. Let's fill columns |
| 437 | /* We will delete too many columns. Let's fill columns | ||
| 438 | by spaces so that the remaining text won't move. */ | 402 | by spaces so that the remaining text won't move. */ |
| 403 | EMACS_INT actual = PT_BYTE; | ||
| 404 | DEC_POS (actual); | ||
| 405 | if (FETCH_CHAR (actual) == '\t') | ||
| 406 | /* Rather than add spaces, let's just keep the tab. */ | ||
| 407 | chars_to_delete--; | ||
| 408 | else | ||
| 439 | spaces_to_insert = actual_clm - target_clm; | 409 | spaces_to_insert = actual_clm - target_clm; |
| 440 | } | 410 | } |
| 441 | } | 411 | |
| 442 | SET_PT_BOTH (pos, pos_byte); | 412 | SET_PT_BOTH (pos, pos_byte); |
| 443 | hairy = 2; | ||
| 444 | } | 413 | } |
| 445 | hairy = 2; | 414 | hairy = 2; |
| 446 | } | 415 | } |
| @@ -451,10 +420,10 @@ internal_self_insert (int c, int noautofill) | |||
| 451 | && synt != Sword | 420 | && synt != Sword |
| 452 | && NILP (current_buffer->read_only) | 421 | && NILP (current_buffer->read_only) |
| 453 | && PT > BEGV | 422 | && PT > BEGV |
| 454 | && (!NILP (current_buffer->enable_multibyte_characters) | 423 | && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters) |
| 455 | ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword | 424 | ? XFASTINT (Fprevious_char ()) |
| 456 | : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) | 425 | : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) |
| 457 | == Sword))) | 426 | == Sword)) |
| 458 | { | 427 | { |
| 459 | int modiff = MODIFF; | 428 | int modiff = MODIFF; |
| 460 | Lisp_Object sym; | 429 | Lisp_Object sym; |
| @@ -479,16 +448,30 @@ internal_self_insert (int c, int noautofill) | |||
| 479 | 448 | ||
| 480 | if (chars_to_delete) | 449 | if (chars_to_delete) |
| 481 | { | 450 | { |
| 482 | string = make_string_from_bytes (str, 1, len); | 451 | int mc = ((NILP (current_buffer->enable_multibyte_characters) |
| 452 | && SINGLE_BYTE_CHAR_P (c)) | ||
| 453 | ? UNIBYTE_TO_CHAR (c) : c); | ||
| 454 | Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); | ||
| 455 | |||
| 483 | if (spaces_to_insert) | 456 | if (spaces_to_insert) |
| 484 | { | 457 | { |
| 485 | tem = Fmake_string (make_number (spaces_to_insert), | 458 | tem = Fmake_string (make_number (spaces_to_insert), |
| 486 | make_number (' ')); | 459 | make_number (' ')); |
| 487 | string = concat2 (tem, string); | 460 | string = concat2 (string, tem); |
| 488 | } | 461 | } |
| 489 | 462 | ||
| 490 | replace_range (PT, PT + chars_to_delete, string, 1, 1, 1); | 463 | replace_range (PT, PT + chars_to_delete, string, 1, 1, 1); |
| 491 | Fforward_char (make_number (1 + spaces_to_insert)); | 464 | Fforward_char (make_number (n + spaces_to_insert)); |
| 465 | } | ||
| 466 | else if (n > 1) | ||
| 467 | { | ||
| 468 | USE_SAFE_ALLOCA; | ||
| 469 | unsigned char *strn, *p; | ||
| 470 | SAFE_ALLOCA (strn, unsigned char*, n * len); | ||
| 471 | for (p = strn; n > 0; n--, p += len) | ||
| 472 | memcpy (p, str, len); | ||
| 473 | insert_and_inherit (strn, p - strn); | ||
| 474 | SAFE_FREE (); | ||
| 492 | } | 475 | } |
| 493 | else | 476 | else |
| 494 | insert_and_inherit (str, len); | 477 | insert_and_inherit (str, len); |
| @@ -496,7 +479,6 @@ internal_self_insert (int c, int noautofill) | |||
| 496 | if ((CHAR_TABLE_P (Vauto_fill_chars) | 479 | if ((CHAR_TABLE_P (Vauto_fill_chars) |
| 497 | ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) | 480 | ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) |
| 498 | : (c == ' ' || c == '\n')) | 481 | : (c == ' ' || c == '\n')) |
| 499 | && !noautofill | ||
| 500 | && !NILP (current_buffer->auto_fill_function)) | 482 | && !NILP (current_buffer->auto_fill_function)) |
| 501 | { | 483 | { |
| 502 | Lisp_Object tem; | 484 | Lisp_Object tem; |
| @@ -514,22 +496,9 @@ internal_self_insert (int c, int noautofill) | |||
| 514 | hairy = 2; | 496 | hairy = 2; |
| 515 | } | 497 | } |
| 516 | 498 | ||
| 517 | /* If previous command specified a face to use, use it. */ | 499 | /* Run hooks for electric keys. */ |
| 518 | if (!NILP (Vself_insert_face) | 500 | call1 (Vrun_hooks, Qpost_self_insert_hook); |
| 519 | && EQ (current_kboard->Vlast_command, Vself_insert_face_command)) | ||
| 520 | { | ||
| 521 | Fput_text_property (make_number (PT - 1), make_number (PT), | ||
| 522 | Qface, Vself_insert_face, Qnil); | ||
| 523 | Vself_insert_face = Qnil; | ||
| 524 | } | ||
| 525 | 501 | ||
| 526 | if ((synt == Sclose || synt == Smath) | ||
| 527 | && !NILP (Vblink_paren_function) && INTERACTIVE | ||
| 528 | && !noautofill) | ||
| 529 | { | ||
| 530 | call0 (Vblink_paren_function); | ||
| 531 | hairy = 2; | ||
| 532 | } | ||
| 533 | return hairy; | 502 | return hairy; |
| 534 | } | 503 | } |
| 535 | 504 | ||
| @@ -550,20 +519,13 @@ syms_of_cmds (void) | |||
| 550 | Qexpand_abbrev = intern_c_string ("expand-abbrev"); | 519 | Qexpand_abbrev = intern_c_string ("expand-abbrev"); |
| 551 | staticpro (&Qexpand_abbrev); | 520 | staticpro (&Qexpand_abbrev); |
| 552 | 521 | ||
| 553 | DEFVAR_LISP ("self-insert-face", &Vself_insert_face, | 522 | Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook"); |
| 554 | doc: /* If non-nil, set the face of the next self-inserting character to this. | 523 | staticpro (&Qpost_self_insert_hook); |
| 555 | See also `self-insert-face-command'. */); | ||
| 556 | Vself_insert_face = Qnil; | ||
| 557 | |||
| 558 | DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, | ||
| 559 | doc: /* This is the command that set up `self-insert-face'. | ||
| 560 | If `last-command' does not equal this value, we ignore `self-insert-face'. */); | ||
| 561 | Vself_insert_face_command = Qnil; | ||
| 562 | 524 | ||
| 563 | DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, | 525 | DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook, |
| 564 | doc: /* Function called, if non-nil, whenever a close parenthesis is inserted. | 526 | doc: /* Hook run at the end of `self-insert-command'. |
| 565 | More precisely, a char with closeparen syntax is self-inserted. */); | 527 | This run is run after inserting the charater. */); |
| 566 | Vblink_paren_function = Qnil; | 528 | Vpost_self_insert_hook = Qnil; |
| 567 | 529 | ||
| 568 | defsubr (&Sforward_point); | 530 | defsubr (&Sforward_point); |
| 569 | defsubr (&Sforward_char); | 531 | defsubr (&Sforward_char); |
diff --git a/src/composite.c b/src/composite.c index 392da1ceba1..bc5a67ef6e2 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -969,7 +969,9 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT | |||
| 969 | static Lisp_Object _work_val; | 969 | static Lisp_Object _work_val; |
| 970 | static int _work_char; | 970 | static int _work_char; |
| 971 | 971 | ||
| 972 | /* 1 iff the character C is composable. */ | 972 | /* 1 iff the character C is composable. Characters of general |
| 973 | category Z? or C? are not composable except for ZWNJ and ZWJ. */ | ||
| 974 | |||
| 973 | #define CHAR_COMPOSABLE_P(C) \ | 975 | #define CHAR_COMPOSABLE_P(C) \ |
| 974 | ((C) == 0x200C || (C) == 0x200D \ | 976 | ((C) == 0x200C || (C) == 0x200D \ |
| 975 | || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ | 977 | || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ |
| @@ -1028,19 +1030,6 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1028 | cmp_it->stop_pos = endpos = start; | 1030 | cmp_it->stop_pos = endpos = start; |
| 1029 | cmp_it->ch = -1; | 1031 | cmp_it->ch = -1; |
| 1030 | } | 1032 | } |
| 1031 | if (NILP (string)) | ||
| 1032 | { | ||
| 1033 | /* A composition never strides over PT. */ | ||
| 1034 | if (PT > charpos) | ||
| 1035 | { | ||
| 1036 | if (PT < endpos) | ||
| 1037 | cmp_it->stop_pos = endpos = PT; | ||
| 1038 | } | ||
| 1039 | else if (PT < charpos && PT > endpos) | ||
| 1040 | { | ||
| 1041 | cmp_it->stop_pos = endpos = PT - 1; | ||
| 1042 | } | ||
| 1043 | } | ||
| 1044 | if (NILP (current_buffer->enable_multibyte_characters) | 1033 | if (NILP (current_buffer->enable_multibyte_characters) |
| 1045 | || NILP (Vauto_composition_mode)) | 1034 | || NILP (Vauto_composition_mode)) |
| 1046 | return; | 1035 | return; |
| @@ -1091,6 +1080,16 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1091 | } | 1080 | } |
| 1092 | } | 1081 | } |
| 1093 | } | 1082 | } |
| 1083 | if (charpos == endpos) | ||
| 1084 | { | ||
| 1085 | /* We couldn't find a composition point before ENDPOS. But, | ||
| 1086 | some character after ENDPOS may be composed with | ||
| 1087 | characters before ENDPOS. So, we should stop at the safe | ||
| 1088 | point. */ | ||
| 1089 | charpos = endpos - MAX_AUTO_COMPOSITION_LOOKBACK; | ||
| 1090 | if (charpos < start) | ||
| 1091 | charpos = start; | ||
| 1092 | } | ||
| 1094 | } | 1093 | } |
| 1095 | else if (charpos > endpos) | 1094 | else if (charpos > endpos) |
| 1096 | { | 1095 | { |
| @@ -1223,23 +1222,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1223 | int | 1222 | int |
| 1224 | composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) | 1223 | composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) |
| 1225 | { | 1224 | { |
| 1226 | if (endpos <= charpos) | 1225 | if (endpos < 0) |
| 1227 | { | 1226 | endpos = NILP (string) ? BEGV : 0; |
| 1228 | if (NILP (string)) | ||
| 1229 | { | ||
| 1230 | if (endpos < 0) | ||
| 1231 | endpos = BEGV; | ||
| 1232 | if (endpos < PT && PT < charpos) | ||
| 1233 | endpos = PT; | ||
| 1234 | } | ||
| 1235 | else if (endpos < 0) | ||
| 1236 | endpos = 0; | ||
| 1237 | } | ||
| 1238 | else | ||
| 1239 | { | ||
| 1240 | if (NILP (string) && charpos < PT && PT < endpos) | ||
| 1241 | endpos = PT; | ||
| 1242 | } | ||
| 1243 | 1227 | ||
| 1244 | if (cmp_it->ch == -2) | 1228 | if (cmp_it->ch == -2) |
| 1245 | { | 1229 | { |
| @@ -1301,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1301 | elt = XCAR (val); | 1285 | elt = XCAR (val); |
| 1302 | if (cmp_it->lookback > 0) | 1286 | if (cmp_it->lookback > 0) |
| 1303 | { | 1287 | { |
| 1304 | cpos -= cmp_it->lookback; | 1288 | cpos = charpos - cmp_it->lookback; |
| 1305 | if (STRINGP (string)) | 1289 | if (STRINGP (string)) |
| 1306 | bpos = string_char_to_byte (string, cpos); | 1290 | bpos = string_char_to_byte (string, cpos); |
| 1307 | else | 1291 | else |
| @@ -1456,8 +1440,7 @@ composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1456 | { | 1440 | { |
| 1457 | c = XINT (LGSTRING_CHAR (gstring, i)); | 1441 | c = XINT (LGSTRING_CHAR (gstring, i)); |
| 1458 | cmp_it->nbytes += CHAR_BYTES (c); | 1442 | cmp_it->nbytes += CHAR_BYTES (c); |
| 1459 | cmp_it->width = (LGLYPH_WIDTH (glyph) > 0 | 1443 | cmp_it->width += CHAR_WIDTH (c); |
| 1460 | ? CHAR_WIDTH (LGLYPH_CHAR (glyph)) : 0); | ||
| 1461 | } | 1444 | } |
| 1462 | } | 1445 | } |
| 1463 | return c; | 1446 | return c; |
| @@ -1763,8 +1746,6 @@ should be ignored. */) | |||
| 1763 | 1746 | ||
| 1764 | CHECK_NATNUM (from); | 1747 | CHECK_NATNUM (from); |
| 1765 | CHECK_NATNUM (to); | 1748 | CHECK_NATNUM (to); |
| 1766 | if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS) | ||
| 1767 | to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS); | ||
| 1768 | if (! FONT_OBJECT_P (font_object)) | 1749 | if (! FONT_OBJECT_P (font_object)) |
| 1769 | { | 1750 | { |
| 1770 | struct coding_system *coding; | 1751 | struct coding_system *coding; |
diff --git a/src/config.in b/src/config.in index ea17a54d913..199afbd78ba 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -294,6 +294,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 294 | /* Define to 1 if netdb.h declares h_errno. */ | 294 | /* Define to 1 if netdb.h declares h_errno. */ |
| 295 | #undef HAVE_H_ERRNO | 295 | #undef HAVE_H_ERRNO |
| 296 | 296 | ||
| 297 | /* Define to 1 if using imagemagick. */ | ||
| 298 | #undef HAVE_IMAGEMAGICK | ||
| 299 | |||
| 297 | /* Define to 1 if you have inet sockets. */ | 300 | /* Define to 1 if you have inet sockets. */ |
| 298 | #undef HAVE_INET_SOCKETS | 301 | #undef HAVE_INET_SOCKETS |
| 299 | 302 | ||
| @@ -432,6 +435,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 432 | /* Define to 1 if you have the <mach/mach.h> header file. */ | 435 | /* Define to 1 if you have the <mach/mach.h> header file. */ |
| 433 | #undef HAVE_MACH_MACH_H | 436 | #undef HAVE_MACH_MACH_H |
| 434 | 437 | ||
| 438 | /* Define to 1 if you have the `MagickExportImagePixels' function. */ | ||
| 439 | #undef HAVE_MAGICKEXPORTIMAGEPIXELS | ||
| 440 | |||
| 435 | /* Define to 1 if you have the <maillock.h> header file. */ | 441 | /* Define to 1 if you have the <maillock.h> header file. */ |
| 436 | #undef HAVE_MAILLOCK_H | 442 | #undef HAVE_MAILLOCK_H |
| 437 | 443 | ||
| @@ -807,6 +813,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 807 | /* Define to 1 if you have the SM library (-lSM). */ | 813 | /* Define to 1 if you have the SM library (-lSM). */ |
| 808 | #undef HAVE_X_SM | 814 | #undef HAVE_X_SM |
| 809 | 815 | ||
| 816 | /* Define to 1 if you have the libxml2 library (-lxml2). */ | ||
| 817 | #undef HAVE_LIBXML2 | ||
| 818 | |||
| 810 | /* Define to 1 if you want to use the X window system. */ | 819 | /* Define to 1 if you want to use the X window system. */ |
| 811 | #undef HAVE_X_WINDOWS | 820 | #undef HAVE_X_WINDOWS |
| 812 | 821 | ||
diff --git a/src/dbusbind.c b/src/dbusbind.c index 683d6f047fa..3b6f0e543bb 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -31,6 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 31 | ||
| 32 | /* Subroutines. */ | 32 | /* Subroutines. */ |
| 33 | Lisp_Object Qdbus_init_bus; | 33 | Lisp_Object Qdbus_init_bus; |
| 34 | Lisp_Object Qdbus_close_bus; | ||
| 34 | Lisp_Object Qdbus_get_unique_name; | 35 | Lisp_Object Qdbus_get_unique_name; |
| 35 | Lisp_Object Qdbus_call_method; | 36 | Lisp_Object Qdbus_call_method; |
| 36 | Lisp_Object Qdbus_call_method_asynchronously; | 37 | Lisp_Object Qdbus_call_method_asynchronously; |
| @@ -59,6 +60,9 @@ Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; | |||
| 59 | Lisp_Object QCdbus_type_array, QCdbus_type_variant; | 60 | Lisp_Object QCdbus_type_array, QCdbus_type_variant; |
| 60 | Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; | 61 | Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; |
| 61 | 62 | ||
| 63 | /* Registered buses. */ | ||
| 64 | Lisp_Object Vdbus_registered_buses; | ||
| 65 | |||
| 62 | /* Hash table which keeps function definitions. */ | 66 | /* Hash table which keeps function definitions. */ |
| 63 | Lisp_Object Vdbus_registered_objects_table; | 67 | Lisp_Object Vdbus_registered_objects_table; |
| 64 | 68 | ||
| @@ -111,7 +115,7 @@ int xd_in_read_queued_messages = 0; | |||
| 111 | } while (0) | 115 | } while (0) |
| 112 | 116 | ||
| 113 | /* Macros for debugging. In order to enable them, build with | 117 | /* Macros for debugging. In order to enable them, build with |
| 114 | "make MYCPPFLAGS='-DDBUS_DEBUG -Wall'". */ | 118 | "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make". */ |
| 115 | #ifdef DBUS_DEBUG | 119 | #ifdef DBUS_DEBUG |
| 116 | #define XD_DEBUG_MESSAGE(...) \ | 120 | #define XD_DEBUG_MESSAGE(...) \ |
| 117 | do { \ | 121 | do { \ |
| @@ -713,10 +717,10 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) | |||
| 713 | } | 717 | } |
| 714 | } | 718 | } |
| 715 | 719 | ||
| 716 | /* Initialize D-Bus connection. BUS is a Lisp symbol, either :system | 720 | /* Initialize D-Bus connection. BUS is either a Lisp symbol, :system |
| 717 | or :session. It tells which D-Bus to initialize. If RAISE_ERROR | 721 | or :session, or a string denoting the bus address. It tells which |
| 718 | is non-zero signal an error when the connection cannot be | 722 | D-Bus to initialize. If RAISE_ERROR is non-zero, signal an error |
| 719 | initialized. */ | 723 | when the connection cannot be initialized. */ |
| 720 | static DBusConnection * | 724 | static DBusConnection * |
| 721 | xd_initialize (Lisp_Object bus, int raise_error) | 725 | xd_initialize (Lisp_Object bus, int raise_error) |
| 722 | { | 726 | { |
| @@ -724,34 +728,66 @@ xd_initialize (Lisp_Object bus, int raise_error) | |||
| 724 | DBusError derror; | 728 | DBusError derror; |
| 725 | 729 | ||
| 726 | /* Parameter check. */ | 730 | /* Parameter check. */ |
| 727 | CHECK_SYMBOL (bus); | 731 | if (!STRINGP (bus)) |
| 728 | if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) | 732 | { |
| 729 | if (raise_error) | 733 | CHECK_SYMBOL (bus); |
| 730 | XD_SIGNAL2 (build_string ("Wrong bus name"), bus); | 734 | if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) |
| 731 | else | 735 | { |
| 732 | return NULL; | 736 | if (raise_error) |
| 737 | XD_SIGNAL2 (build_string ("Wrong bus name"), bus); | ||
| 738 | else | ||
| 739 | return NULL; | ||
| 740 | } | ||
| 733 | 741 | ||
| 734 | /* We do not want to have an autolaunch for the session bus. */ | 742 | /* We do not want to have an autolaunch for the session bus. */ |
| 735 | if (EQ (bus, QCdbus_session_bus) | 743 | if (EQ (bus, QCdbus_session_bus) |
| 736 | && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) | 744 | && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) |
| 737 | if (raise_error) | 745 | { |
| 738 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 746 | if (raise_error) |
| 739 | else | 747 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| 740 | return NULL; | 748 | else |
| 749 | return NULL; | ||
| 750 | } | ||
| 751 | } | ||
| 741 | 752 | ||
| 742 | /* Open a connection to the bus. */ | 753 | /* Open a connection to the bus. */ |
| 743 | dbus_error_init (&derror); | 754 | dbus_error_init (&derror); |
| 744 | 755 | ||
| 745 | if (EQ (bus, QCdbus_system_bus)) | 756 | if (STRINGP (bus)) |
| 746 | connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); | 757 | connection = dbus_connection_open (SDATA (bus), &derror); |
| 747 | else | 758 | else |
| 748 | connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); | 759 | if (EQ (bus, QCdbus_system_bus)) |
| 760 | connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); | ||
| 761 | else | ||
| 762 | connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); | ||
| 749 | 763 | ||
| 750 | if (dbus_error_is_set (&derror)) | 764 | if (dbus_error_is_set (&derror)) |
| 751 | if (raise_error) | 765 | { |
| 752 | XD_ERROR (derror); | 766 | if (raise_error) |
| 753 | else | 767 | XD_ERROR (derror); |
| 754 | connection = NULL; | 768 | else |
| 769 | connection = NULL; | ||
| 770 | } | ||
| 771 | |||
| 772 | /* If it is not the system or session bus, we must register | ||
| 773 | ourselves. Otherwise, we have called dbus_bus_get, which has | ||
| 774 | configured us to exit if the connection closes - we undo this | ||
| 775 | setting. */ | ||
| 776 | if (connection != NULL) | ||
| 777 | { | ||
| 778 | if (STRINGP (bus)) | ||
| 779 | dbus_bus_register (connection, &derror); | ||
| 780 | else | ||
| 781 | dbus_connection_set_exit_on_disconnect (connection, FALSE); | ||
| 782 | } | ||
| 783 | |||
| 784 | if (dbus_error_is_set (&derror)) | ||
| 785 | { | ||
| 786 | if (raise_error) | ||
| 787 | XD_ERROR (derror); | ||
| 788 | else | ||
| 789 | connection = NULL; | ||
| 790 | } | ||
| 755 | 791 | ||
| 756 | if (connection == NULL && raise_error) | 792 | if (connection == NULL && raise_error) |
| 757 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 793 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| @@ -794,7 +830,8 @@ xd_add_watch (DBusWatch *watch, void *data) | |||
| 794 | } | 830 | } |
| 795 | 831 | ||
| 796 | /* Remove connection file descriptor from input_wait_mask. DATA is | 832 | /* Remove connection file descriptor from input_wait_mask. DATA is |
| 797 | the used bus, either QCdbus_system_bus or QCdbus_session_bus. */ | 833 | the used bus, either a string or QCdbus_system_bus or |
| 834 | QCdbus_session_bus. */ | ||
| 798 | void | 835 | void |
| 799 | xd_remove_watch (DBusWatch *watch, void *data) | 836 | xd_remove_watch (DBusWatch *watch, void *data) |
| 800 | { | 837 | { |
| @@ -830,15 +867,11 @@ xd_remove_watch (DBusWatch *watch, void *data) | |||
| 830 | } | 867 | } |
| 831 | 868 | ||
| 832 | DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, | 869 | DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, |
| 833 | doc: /* Initialize connection to D-Bus BUS. | 870 | doc: /* Initialize connection to D-Bus BUS. */) |
| 834 | This is an internal function, it shall not be used outside dbus.el. */) | ||
| 835 | (Lisp_Object bus) | 871 | (Lisp_Object bus) |
| 836 | { | 872 | { |
| 837 | DBusConnection *connection; | 873 | DBusConnection *connection; |
| 838 | 874 | ||
| 839 | /* Check parameters. */ | ||
| 840 | CHECK_SYMBOL (bus); | ||
| 841 | |||
| 842 | /* Open a connection to the bus. */ | 875 | /* Open a connection to the bus. */ |
| 843 | connection = xd_initialize (bus, TRUE); | 876 | connection = xd_initialize (bus, TRUE); |
| 844 | 877 | ||
| @@ -850,6 +883,28 @@ This is an internal function, it shall not be used outside dbus.el. */) | |||
| 850 | NULL, (void*) XHASH (bus), NULL)) | 883 | NULL, (void*) XHASH (bus), NULL)) |
| 851 | XD_SIGNAL1 (build_string ("Cannot add watch functions")); | 884 | XD_SIGNAL1 (build_string ("Cannot add watch functions")); |
| 852 | 885 | ||
| 886 | /* Add bus to list of registered buses. */ | ||
| 887 | Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); | ||
| 888 | |||
| 889 | /* Return. */ | ||
| 890 | return Qnil; | ||
| 891 | } | ||
| 892 | |||
| 893 | DEFUN ("dbus-close-bus", Fdbus_close_bus, Sdbus_close_bus, 1, 1, 0, | ||
| 894 | doc: /* Close connection to D-Bus BUS. */) | ||
| 895 | (Lisp_Object bus) | ||
| 896 | { | ||
| 897 | DBusConnection *connection; | ||
| 898 | |||
| 899 | /* Open a connection to the bus. */ | ||
| 900 | connection = xd_initialize (bus, TRUE); | ||
| 901 | |||
| 902 | /* Decrement reference count to the bus. */ | ||
| 903 | dbus_connection_unref (connection); | ||
| 904 | |||
| 905 | /* Remove bus from list of registered buses. */ | ||
| 906 | Vdbus_registered_buses = Fdelete (bus, Vdbus_registered_buses); | ||
| 907 | |||
| 853 | /* Return. */ | 908 | /* Return. */ |
| 854 | return Qnil; | 909 | return Qnil; |
| 855 | } | 910 | } |
| @@ -862,9 +917,6 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, | |||
| 862 | DBusConnection *connection; | 917 | DBusConnection *connection; |
| 863 | const char *name; | 918 | const char *name; |
| 864 | 919 | ||
| 865 | /* Check parameters. */ | ||
| 866 | CHECK_SYMBOL (bus); | ||
| 867 | |||
| 868 | /* Open a connection to the bus. */ | 920 | /* Open a connection to the bus. */ |
| 869 | connection = xd_initialize (bus, TRUE); | 921 | connection = xd_initialize (bus, TRUE); |
| 870 | 922 | ||
| @@ -880,7 +932,8 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, | |||
| 880 | DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, | 932 | DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, |
| 881 | doc: /* Call METHOD on the D-Bus BUS. | 933 | doc: /* Call METHOD on the D-Bus BUS. |
| 882 | 934 | ||
| 883 | BUS is either the symbol `:system' or the symbol `:session'. | 935 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 936 | denoting the bus address. | ||
| 884 | 937 | ||
| 885 | SERVICE is the D-Bus service name to be used. PATH is the D-Bus | 938 | SERVICE is the D-Bus service name to be used. PATH is the D-Bus |
| 886 | object path SERVICE is registered at. INTERFACE is an interface | 939 | object path SERVICE is registered at. INTERFACE is an interface |
| @@ -967,7 +1020,6 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI | |||
| 967 | interface = args[3]; | 1020 | interface = args[3]; |
| 968 | method = args[4]; | 1021 | method = args[4]; |
| 969 | 1022 | ||
| 970 | CHECK_SYMBOL (bus); | ||
| 971 | CHECK_STRING (service); | 1023 | CHECK_STRING (service); |
| 972 | CHECK_STRING (path); | 1024 | CHECK_STRING (path); |
| 973 | CHECK_STRING (interface); | 1025 | CHECK_STRING (interface); |
| @@ -1082,7 +1134,8 @@ DEFUN ("dbus-call-method-asynchronously", Fdbus_call_method_asynchronously, | |||
| 1082 | Sdbus_call_method_asynchronously, 6, MANY, 0, | 1134 | Sdbus_call_method_asynchronously, 6, MANY, 0, |
| 1083 | doc: /* Call METHOD on the D-Bus BUS asynchronously. | 1135 | doc: /* Call METHOD on the D-Bus BUS asynchronously. |
| 1084 | 1136 | ||
| 1085 | BUS is either the symbol `:system' or the symbol `:session'. | 1137 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 1138 | denoting the bus address. | ||
| 1086 | 1139 | ||
| 1087 | SERVICE is the D-Bus service name to be used. PATH is the D-Bus | 1140 | SERVICE is the D-Bus service name to be used. PATH is the D-Bus |
| 1088 | object path SERVICE is registered at. INTERFACE is an interface | 1141 | object path SERVICE is registered at. INTERFACE is an interface |
| @@ -1148,7 +1201,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE | |||
| 1148 | method = args[4]; | 1201 | method = args[4]; |
| 1149 | handler = args[5]; | 1202 | handler = args[5]; |
| 1150 | 1203 | ||
| 1151 | CHECK_SYMBOL (bus); | ||
| 1152 | CHECK_STRING (service); | 1204 | CHECK_STRING (service); |
| 1153 | CHECK_STRING (path); | 1205 | CHECK_STRING (path); |
| 1154 | CHECK_STRING (interface); | 1206 | CHECK_STRING (interface); |
| @@ -1271,7 +1323,6 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1271 | serial = args[1]; | 1323 | serial = args[1]; |
| 1272 | service = args[2]; | 1324 | service = args[2]; |
| 1273 | 1325 | ||
| 1274 | CHECK_SYMBOL (bus); | ||
| 1275 | CHECK_NUMBER (serial); | 1326 | CHECK_NUMBER (serial); |
| 1276 | CHECK_STRING (service); | 1327 | CHECK_STRING (service); |
| 1277 | GCPRO3 (bus, serial, service); | 1328 | GCPRO3 (bus, serial, service); |
| @@ -1363,7 +1414,6 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1363 | serial = args[1]; | 1414 | serial = args[1]; |
| 1364 | service = args[2]; | 1415 | service = args[2]; |
| 1365 | 1416 | ||
| 1366 | CHECK_SYMBOL (bus); | ||
| 1367 | CHECK_NUMBER (serial); | 1417 | CHECK_NUMBER (serial); |
| 1368 | CHECK_STRING (service); | 1418 | CHECK_STRING (service); |
| 1369 | GCPRO3 (bus, serial, service); | 1419 | GCPRO3 (bus, serial, service); |
| @@ -1436,7 +1486,8 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) | |||
| 1436 | DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, | 1486 | DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, |
| 1437 | doc: /* Send signal SIGNAL on the D-Bus BUS. | 1487 | doc: /* Send signal SIGNAL on the D-Bus BUS. |
| 1438 | 1488 | ||
| 1439 | BUS is either the symbol `:system' or the symbol `:session'. | 1489 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 1490 | denoting the bus address. | ||
| 1440 | 1491 | ||
| 1441 | SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the | 1492 | SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the |
| 1442 | D-Bus object path SERVICE is registered at. INTERFACE is an interface | 1493 | D-Bus object path SERVICE is registered at. INTERFACE is an interface |
| @@ -1480,7 +1531,6 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1480 | interface = args[3]; | 1531 | interface = args[3]; |
| 1481 | signal = args[4]; | 1532 | signal = args[4]; |
| 1482 | 1533 | ||
| 1483 | CHECK_SYMBOL (bus); | ||
| 1484 | CHECK_STRING (service); | 1534 | CHECK_STRING (service); |
| 1485 | CHECK_STRING (path); | 1535 | CHECK_STRING (path); |
| 1486 | CHECK_STRING (interface); | 1536 | CHECK_STRING (interface); |
| @@ -1552,7 +1602,8 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1552 | } | 1602 | } |
| 1553 | 1603 | ||
| 1554 | /* Check, whether there is pending input in the message queue of the | 1604 | /* Check, whether there is pending input in the message queue of the |
| 1555 | D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ | 1605 | D-Bus BUS. BUS is either a Lisp symbol, :system or :session, or a |
| 1606 | string denoting the bus address. */ | ||
| 1556 | int | 1607 | int |
| 1557 | xd_get_dispatch_status (Lisp_Object bus) | 1608 | xd_get_dispatch_status (Lisp_Object bus) |
| 1558 | { | 1609 | { |
| @@ -1572,24 +1623,31 @@ xd_get_dispatch_status (Lisp_Object bus) | |||
| 1572 | ? TRUE : FALSE; | 1623 | ? TRUE : FALSE; |
| 1573 | } | 1624 | } |
| 1574 | 1625 | ||
| 1575 | /* Check for queued incoming messages from the system and session buses. */ | 1626 | /* Check for queued incoming messages from the buses. */ |
| 1576 | int | 1627 | int |
| 1577 | xd_pending_messages (void) | 1628 | xd_pending_messages (void) |
| 1578 | { | 1629 | { |
| 1630 | Lisp_Object busp = Vdbus_registered_buses; | ||
| 1631 | |||
| 1632 | while (!NILP (busp)) | ||
| 1633 | { | ||
| 1634 | /* We do not want to have an autolaunch for the session bus. */ | ||
| 1635 | if (EQ ((CAR_SAFE (busp)), QCdbus_session_bus) | ||
| 1636 | && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) | ||
| 1637 | continue; | ||
| 1579 | 1638 | ||
| 1580 | /* Vdbus_registered_objects_table will be initialized as hash table | 1639 | if (xd_get_dispatch_status (CAR_SAFE (busp))) |
| 1581 | in dbus.el. When this package isn't loaded yet, it doesn't make | 1640 | return TRUE; |
| 1582 | sense to handle D-Bus messages. */ | 1641 | |
| 1583 | return (HASH_TABLE_P (Vdbus_registered_objects_table) | 1642 | busp = CDR_SAFE (busp); |
| 1584 | ? (xd_get_dispatch_status (QCdbus_system_bus) | 1643 | } |
| 1585 | || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) | 1644 | |
| 1586 | ? xd_get_dispatch_status (QCdbus_session_bus) | 1645 | return FALSE; |
| 1587 | : FALSE)) | ||
| 1588 | : FALSE); | ||
| 1589 | } | 1646 | } |
| 1590 | 1647 | ||
| 1591 | /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp | 1648 | /* Read queued incoming message of the D-Bus BUS. BUS is either a |
| 1592 | symbol, either :system or :session. */ | 1649 | Lisp symbol, :system or :session, or a string denoting the bus |
| 1650 | address. */ | ||
| 1593 | static Lisp_Object | 1651 | static Lisp_Object |
| 1594 | xd_read_message (Lisp_Object bus) | 1652 | xd_read_message (Lisp_Object bus) |
| 1595 | { | 1653 | { |
| @@ -1746,29 +1804,28 @@ xd_read_message (Lisp_Object bus) | |||
| 1746 | RETURN_UNGCPRO (Qnil); | 1804 | RETURN_UNGCPRO (Qnil); |
| 1747 | } | 1805 | } |
| 1748 | 1806 | ||
| 1749 | /* Read queued incoming messages from the system and session buses. */ | 1807 | /* Read queued incoming messages from all buses. */ |
| 1750 | void | 1808 | void |
| 1751 | xd_read_queued_messages (void) | 1809 | xd_read_queued_messages (void) |
| 1752 | { | 1810 | { |
| 1811 | Lisp_Object busp = Vdbus_registered_buses; | ||
| 1753 | 1812 | ||
| 1754 | /* Vdbus_registered_objects_table will be initialized as hash table | 1813 | xd_in_read_queued_messages = 1; |
| 1755 | in dbus.el. When this package isn't loaded yet, it doesn't make | 1814 | while (!NILP (busp)) |
| 1756 | sense to handle D-Bus messages. Furthermore, we ignore all Lisp | ||
| 1757 | errors during the call. */ | ||
| 1758 | if (HASH_TABLE_P (Vdbus_registered_objects_table)) | ||
| 1759 | { | 1815 | { |
| 1760 | xd_in_read_queued_messages = 1; | 1816 | /* We ignore all Lisp errors during the call. */ |
| 1761 | internal_catch (Qdbus_error, xd_read_message, QCdbus_system_bus); | 1817 | internal_catch (Qdbus_error, xd_read_message, CAR_SAFE (busp)); |
| 1762 | internal_catch (Qdbus_error, xd_read_message, QCdbus_session_bus); | 1818 | busp = CDR_SAFE (busp); |
| 1763 | xd_in_read_queued_messages = 0; | ||
| 1764 | } | 1819 | } |
| 1820 | xd_in_read_queued_messages = 0; | ||
| 1765 | } | 1821 | } |
| 1766 | 1822 | ||
| 1767 | DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, | 1823 | DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, |
| 1768 | 6, MANY, 0, | 1824 | 6, MANY, 0, |
| 1769 | doc: /* Register for signal SIGNAL on the D-Bus BUS. | 1825 | doc: /* Register for signal SIGNAL on the D-Bus BUS. |
| 1770 | 1826 | ||
| 1771 | BUS is either the symbol `:system' or the symbol `:session'. | 1827 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 1828 | denoting the bus address. | ||
| 1772 | 1829 | ||
| 1773 | SERVICE is the D-Bus service name used by the sending D-Bus object. | 1830 | SERVICE is the D-Bus service name used by the sending D-Bus object. |
| 1774 | It can be either a known name or the unique name of the D-Bus object | 1831 | It can be either a known name or the unique name of the D-Bus object |
| @@ -1822,7 +1879,6 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG | |||
| 1822 | signal = args[4]; | 1879 | signal = args[4]; |
| 1823 | handler = args[5]; | 1880 | handler = args[5]; |
| 1824 | 1881 | ||
| 1825 | CHECK_SYMBOL (bus); | ||
| 1826 | if (!NILP (service)) CHECK_STRING (service); | 1882 | if (!NILP (service)) CHECK_STRING (service); |
| 1827 | if (!NILP (path)) CHECK_STRING (path); | 1883 | if (!NILP (path)) CHECK_STRING (path); |
| 1828 | CHECK_STRING (interface); | 1884 | CHECK_STRING (interface); |
| @@ -1915,7 +1971,8 @@ DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, | |||
| 1915 | 6, 6, 0, | 1971 | 6, 6, 0, |
| 1916 | doc: /* Register for method METHOD on the D-Bus BUS. | 1972 | doc: /* Register for method METHOD on the D-Bus BUS. |
| 1917 | 1973 | ||
| 1918 | BUS is either the symbol `:system' or the symbol `:session'. | 1974 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 1975 | denoting the bus address. | ||
| 1919 | 1976 | ||
| 1920 | SERVICE is the D-Bus service name of the D-Bus object METHOD is | 1977 | SERVICE is the D-Bus service name of the D-Bus object METHOD is |
| 1921 | registered for. It must be a known name. | 1978 | registered for. It must be a known name. |
| @@ -1933,7 +1990,6 @@ used for composing the returning D-Bus message. */) | |||
| 1933 | DBusError derror; | 1990 | DBusError derror; |
| 1934 | 1991 | ||
| 1935 | /* Check parameters. */ | 1992 | /* Check parameters. */ |
| 1936 | CHECK_SYMBOL (bus); | ||
| 1937 | CHECK_STRING (service); | 1993 | CHECK_STRING (service); |
| 1938 | CHECK_STRING (path); | 1994 | CHECK_STRING (path); |
| 1939 | CHECK_STRING (interface); | 1995 | CHECK_STRING (interface); |
| @@ -1978,6 +2034,10 @@ syms_of_dbusbind (void) | |||
| 1978 | staticpro (&Qdbus_init_bus); | 2034 | staticpro (&Qdbus_init_bus); |
| 1979 | defsubr (&Sdbus_init_bus); | 2035 | defsubr (&Sdbus_init_bus); |
| 1980 | 2036 | ||
| 2037 | Qdbus_close_bus = intern_c_string ("dbus-close-bus"); | ||
| 2038 | staticpro (&Qdbus_close_bus); | ||
| 2039 | defsubr (&Sdbus_close_bus); | ||
| 2040 | |||
| 1981 | Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); | 2041 | Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); |
| 1982 | staticpro (&Qdbus_get_unique_name); | 2042 | staticpro (&Qdbus_get_unique_name); |
| 1983 | defsubr (&Sdbus_get_unique_name); | 2043 | defsubr (&Sdbus_get_unique_name); |
| @@ -2074,18 +2134,25 @@ syms_of_dbusbind (void) | |||
| 2074 | QCdbus_type_dict_entry = intern_c_string (":dict-entry"); | 2134 | QCdbus_type_dict_entry = intern_c_string (":dict-entry"); |
| 2075 | staticpro (&QCdbus_type_dict_entry); | 2135 | staticpro (&QCdbus_type_dict_entry); |
| 2076 | 2136 | ||
| 2137 | DEFVAR_LISP ("dbus-registered-buses", | ||
| 2138 | &Vdbus_registered_buses, | ||
| 2139 | doc: /* List of D-Bus buses we are polling for messages. */); | ||
| 2140 | Vdbus_registered_buses = Qnil; | ||
| 2141 | |||
| 2077 | DEFVAR_LISP ("dbus-registered-objects-table", | 2142 | DEFVAR_LISP ("dbus-registered-objects-table", |
| 2078 | &Vdbus_registered_objects_table, | 2143 | &Vdbus_registered_objects_table, |
| 2079 | doc: /* Hash table of registered functions for D-Bus. | 2144 | doc: /* Hash table of registered functions for D-Bus. |
| 2145 | |||
| 2080 | There are two different uses of the hash table: for accessing | 2146 | There are two different uses of the hash table: for accessing |
| 2081 | registered interfaces properties, targeted by signals or method calls, | 2147 | registered interfaces properties, targeted by signals or method calls, |
| 2082 | and for calling handlers in case of non-blocking method call returns. | 2148 | and for calling handlers in case of non-blocking method call returns. |
| 2083 | 2149 | ||
| 2084 | In the first case, the key in the hash table is the list (BUS | 2150 | In the first case, the key in the hash table is the list (BUS |
| 2085 | INTERFACE MEMBER). BUS is either the symbol `:system' or the symbol | 2151 | INTERFACE MEMBER). BUS is either a Lisp symbol, `:system' or |
| 2086 | `:session'. INTERFACE is a string which denotes a D-Bus interface, | 2152 | `:session', or a string denoting the bus address. INTERFACE is a |
| 2087 | and MEMBER, also a string, is either a method, a signal or a property | 2153 | string which denotes a D-Bus interface, and MEMBER, also a string, is |
| 2088 | INTERFACE is offering. All arguments but BUS must not be nil. | 2154 | either a method, a signal or a property INTERFACE is offering. All |
| 2155 | arguments but BUS must not be nil. | ||
| 2089 | 2156 | ||
| 2090 | The value in the hash table is a list of quadruple lists | 2157 | The value in the hash table is a list of quadruple lists |
| 2091 | \((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...). | 2158 | \((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...). |
| @@ -2097,15 +2164,18 @@ be called when a D-Bus message, which matches the key criteria, | |||
| 2097 | arrives (methods and signals), or a cons cell containing the value of | 2164 | arrives (methods and signals), or a cons cell containing the value of |
| 2098 | the property. | 2165 | the property. |
| 2099 | 2166 | ||
| 2100 | In the second case, the key in the hash table is the list (BUS SERIAL). | 2167 | In the second case, the key in the hash table is the list (BUS |
| 2101 | BUS is either the symbol `:system' or the symbol `:session'. SERIAL | 2168 | SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a |
| 2102 | is the serial number of the non-blocking method call, a reply is | 2169 | string denoting the bus address. SERIAL is the serial number of the |
| 2103 | expected. Both arguments must not be nil. The value in the hash | 2170 | non-blocking method call, a reply is expected. Both arguments must |
| 2104 | table is HANDLER, the function to be called when the D-Bus reply | 2171 | not be nil. The value in the hash table is HANDLER, the function to |
| 2105 | message arrives. */); | 2172 | be called when the D-Bus reply message arrives. */); |
| 2106 | /* We initialize Vdbus_registered_objects_table in dbus.el, because | 2173 | { |
| 2107 | we need to define a hash table function first. */ | 2174 | Lisp_Object args[2]; |
| 2108 | Vdbus_registered_objects_table = Qnil; | 2175 | args[0] = QCtest; |
| 2176 | args[1] = Qequal; | ||
| 2177 | Vdbus_registered_objects_table = Fmake_hash_table (2, args); | ||
| 2178 | } | ||
| 2109 | 2179 | ||
| 2110 | DEFVAR_LISP ("dbus-debug", &Vdbus_debug, | 2180 | DEFVAR_LISP ("dbus-debug", &Vdbus_debug, |
| 2111 | doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); | 2181 | doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); |
diff --git a/src/deps.mk b/src/deps.mk index 8eeed3822d0..d00be96744b 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -142,7 +142,7 @@ mktime.o: mktime.c $(config_h) | |||
| 142 | msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ | 142 | msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ |
| 143 | termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ | 143 | termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ |
| 144 | keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \ | 144 | keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \ |
| 145 | lisp.h $(config_h) | 145 | lisp.h sysselect.h $(config_h) |
| 146 | nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ | 146 | nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ |
| 147 | dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ | 147 | dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ |
| 148 | atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) | 148 | atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) |
| @@ -176,7 +176,7 @@ syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ | |||
| 176 | sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ | 176 | sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ |
| 177 | process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ | 177 | process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ |
| 178 | frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ | 178 | frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ |
| 179 | $(config_h) composite.h | 179 | $(config_h) composite.h sysselect.h |
| 180 | term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \ | 180 | term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \ |
| 181 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ | 181 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ |
| 182 | xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ | 182 | xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ |
diff --git a/src/dispextern.h b/src/dispextern.h index c36db91ea02..5138958b6db 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1718,7 +1718,7 @@ struct face_cache | |||
| 1718 | This macro is only meaningful for multibyte character CHAR. */ | 1718 | This macro is only meaningful for multibyte character CHAR. */ |
| 1719 | 1719 | ||
| 1720 | #define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ | 1720 | #define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ |
| 1721 | (ASCII_CHAR_P (CHAR) \ | 1721 | ((ASCII_CHAR_P (CHAR) || CHAR_BYTE8_P (CHAR)) \ |
| 1722 | ? (FACE)->ascii_face->id \ | 1722 | ? (FACE)->ascii_face->id \ |
| 1723 | : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT))) | 1723 | : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT))) |
| 1724 | 1724 | ||
| @@ -2275,9 +2275,11 @@ struct it | |||
| 2275 | composition. */ | 2275 | composition. */ |
| 2276 | struct composition_it cmp_it; | 2276 | struct composition_it cmp_it; |
| 2277 | 2277 | ||
| 2278 | /* The character to display, possibly translated to multibyte | 2278 | /* The character to display, possibly translated to multibyte if |
| 2279 | if unibyte_display_via_language_environment is set. This | 2279 | multibyte_p is zero or unibyte_display_via_language_environment |
| 2280 | is set after produce_glyphs has been called. */ | 2280 | is set. This is set after get_next_display_element has been |
| 2281 | called. If we are setting it->C directly before calling | ||
| 2282 | PRODUCE_GLYPHS, this should be set beforehand too. */ | ||
| 2281 | int char_to_display; | 2283 | int char_to_display; |
| 2282 | 2284 | ||
| 2283 | /* If what == IT_IMAGE, the id of the image to display. */ | 2285 | /* If what == IT_IMAGE, the id of the image to display. */ |
diff --git a/src/dispnew.c b/src/dispnew.c index 35893872c73..9344d792f3d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5351,9 +5351,15 @@ update_frame_line (struct frame *f, int vpos) | |||
| 5351 | ***********************************************************************/ | 5351 | ***********************************************************************/ |
| 5352 | 5352 | ||
| 5353 | /* Determine what's under window-relative pixel position (*X, *Y). | 5353 | /* Determine what's under window-relative pixel position (*X, *Y). |
| 5354 | Return the object (string or buffer) that's there. | 5354 | Return the OBJECT (string or buffer) that's there. |
| 5355 | Return in *POS the position in that object. | 5355 | Return in *POS the position in that object. |
| 5356 | Adjust *X and *Y to character positions. */ | 5356 | Adjust *X and *Y to character positions. |
| 5357 | Return in *DX and *DY the pixel coordinates of the click, | ||
| 5358 | relative to the top left corner of OBJECT, or relative to | ||
| 5359 | the top left corner of the character glyph at (*X, *Y) | ||
| 5360 | if OBJECT is nil. | ||
| 5361 | Return WIDTH and HEIGHT of the object at (*X, *Y), or zero | ||
| 5362 | if the coordinates point to an empty area of the display. */ | ||
| 5357 | 5363 | ||
| 5358 | Lisp_Object | 5364 | Lisp_Object |
| 5359 | buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) | 5365 | buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) |
| @@ -5366,7 +5372,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5366 | #ifdef HAVE_WINDOW_SYSTEM | 5372 | #ifdef HAVE_WINDOW_SYSTEM |
| 5367 | struct image *img = 0; | 5373 | struct image *img = 0; |
| 5368 | #endif | 5374 | #endif |
| 5369 | int x0, x1; | 5375 | int x0, x1, to_x; |
| 5370 | 5376 | ||
| 5371 | /* We used to set current_buffer directly here, but that does the | 5377 | /* We used to set current_buffer directly here, but that does the |
| 5372 | wrong thing with `face-remapping-alist' (bug#2044). */ | 5378 | wrong thing with `face-remapping-alist' (bug#2044). */ |
| @@ -5377,8 +5383,33 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5377 | start_display (&it, w, startp); | 5383 | start_display (&it, w, startp); |
| 5378 | 5384 | ||
| 5379 | x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); | 5385 | x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); |
| 5380 | move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, | 5386 | |
| 5381 | MOVE_TO_X | MOVE_TO_Y); | 5387 | /* First, move to the beginning of the row corresponding to *Y. We |
| 5388 | need to be in that row to get the correct value of base paragraph | ||
| 5389 | direction for the text at (*X, *Y). */ | ||
| 5390 | move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y); | ||
| 5391 | |||
| 5392 | /* TO_X is the pixel position that the iterator will compute for the | ||
| 5393 | glyph at *X. We add it.first_visible_x because iterator | ||
| 5394 | positions include the hscroll. */ | ||
| 5395 | to_x = x0 + it.first_visible_x; | ||
| 5396 | if (it.bidi_it.paragraph_dir == R2L) | ||
| 5397 | /* For lines in an R2L paragraph, we need to mirror TO_X wrt the | ||
| 5398 | text area. This is because the iterator, even in R2L | ||
| 5399 | paragraphs, delivers glyphs as if they started at the left | ||
| 5400 | margin of the window. (When we actually produce glyphs for | ||
| 5401 | display, we reverse their order in PRODUCE_GLYPHS, but the | ||
| 5402 | iterator doesn't know about that.) The following line adjusts | ||
| 5403 | the pixel position to the iterator geometry, which is what | ||
| 5404 | move_it_* routines use. (The -1 is because in a window whose | ||
| 5405 | text-area width is W, the rightmost pixel position is W-1, and | ||
| 5406 | it should be mirrored into zero pixel position.) */ | ||
| 5407 | to_x = window_box_width (w, TEXT_AREA) - to_x - 1; | ||
| 5408 | |||
| 5409 | /* Now move horizontally in the row to the glyph under *X. Second | ||
| 5410 | argument is ZV to prevent move_it_in_display_line from matching | ||
| 5411 | based on buffer positions. */ | ||
| 5412 | move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); | ||
| 5382 | 5413 | ||
| 5383 | Fset_buffer (old_current_buffer); | 5414 | Fset_buffer (old_current_buffer); |
| 5384 | 5415 | ||
| @@ -286,8 +286,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) | |||
| 286 | to - (get_doc_string_buffer + offset)); | 286 | to - (get_doc_string_buffer + offset)); |
| 287 | else | 287 | else |
| 288 | { | 288 | { |
| 289 | /* Let the data determine whether the string is multibyte, | 289 | /* The data determines whether the string is multibyte. */ |
| 290 | even if Emacs is running in --unibyte mode. */ | ||
| 291 | int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset, | 290 | int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset, |
| 292 | to - (get_doc_string_buffer + offset)); | 291 | to - (get_doc_string_buffer + offset)); |
| 293 | return make_string_from_bytes (get_doc_string_buffer + offset, | 292 | return make_string_from_bytes (get_doc_string_buffer + offset, |
| @@ -632,24 +631,28 @@ the same file name is found in the `doc-directory'. */) | |||
| 632 | p = buf; | 631 | p = buf; |
| 633 | end = buf + (filled < 512 ? filled : filled - 128); | 632 | end = buf + (filled < 512 ? filled : filled - 128); |
| 634 | while (p != end && *p != '\037') p++; | 633 | while (p != end && *p != '\037') p++; |
| 635 | /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ | 634 | /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n. */ |
| 636 | if (p != end) | 635 | if (p != end) |
| 637 | { | 636 | { |
| 638 | end = strchr (p, '\n'); | 637 | end = strchr (p, '\n'); |
| 639 | 638 | ||
| 640 | /* See if this is a file name, and if it is a file in build-files. */ | 639 | /* See if this is a file name, and if it is a file in build-files. */ |
| 641 | if (p[1] == 'S' && end - p > 4 && end[-2] == '.' | 640 | if (p[1] == 'S') |
| 642 | && (end[-1] == 'o' || end[-1] == 'c')) | ||
| 643 | { | 641 | { |
| 644 | int len = end - p - 2; | 642 | skip_file = 0; |
| 645 | char *fromfile = alloca (len + 1); | 643 | if (end - p > 4 && end[-2] == '.' |
| 646 | strncpy (fromfile, &p[2], len); | 644 | && (end[-1] == 'o' || end[-1] == 'c')) |
| 647 | fromfile[len] = 0; | 645 | { |
| 648 | if (fromfile[len-1] == 'c') | 646 | int len = end - p - 2; |
| 649 | fromfile[len-1] = 'o'; | 647 | char *fromfile = alloca (len + 1); |
| 650 | 648 | strncpy (fromfile, &p[2], len); | |
| 651 | skip_file = NILP (Fmember (build_string (fromfile), | 649 | fromfile[len] = 0; |
| 652 | Vbuild_files)); | 650 | if (fromfile[len-1] == 'c') |
| 651 | fromfile[len-1] = 'o'; | ||
| 652 | |||
| 653 | skip_file = NILP (Fmember (build_string (fromfile), | ||
| 654 | Vbuild_files)); | ||
| 655 | } | ||
| 653 | } | 656 | } |
| 654 | 657 | ||
| 655 | sym = oblookup (Vobarray, p + 2, | 658 | sym = oblookup (Vobarray, p + 2, |
diff --git a/src/dosfns.c b/src/dosfns.c index 5be0a363da8..e66b50ed3ff 100644 --- a/src/dosfns.c +++ b/src/dosfns.c | |||
| @@ -60,7 +60,6 @@ REGISTERS should be a vector produced by `make-register' and | |||
| 60 | register int i; | 60 | register int i; |
| 61 | int no; | 61 | int no; |
| 62 | union REGS inregs, outregs; | 62 | union REGS inregs, outregs; |
| 63 | Lisp_Object val; | ||
| 64 | 63 | ||
| 65 | CHECK_NUMBER (interrupt); | 64 | CHECK_NUMBER (interrupt); |
| 66 | no = (unsigned long) XINT (interrupt); | 65 | no = (unsigned long) XINT (interrupt); |
| @@ -101,7 +100,6 @@ Return the updated VECTOR. */) | |||
| 101 | register int i; | 100 | register int i; |
| 102 | int offs, len; | 101 | int offs, len; |
| 103 | char *buf; | 102 | char *buf; |
| 104 | Lisp_Object val; | ||
| 105 | 103 | ||
| 106 | CHECK_NUMBER (address); | 104 | CHECK_NUMBER (address); |
| 107 | offs = (unsigned long) XINT (address); | 105 | offs = (unsigned long) XINT (address); |
| @@ -125,7 +123,6 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0, | |||
| 125 | register int i; | 123 | register int i; |
| 126 | int offs, len; | 124 | int offs, len; |
| 127 | char *buf; | 125 | char *buf; |
| 128 | Lisp_Object val; | ||
| 129 | 126 | ||
| 130 | CHECK_NUMBER (address); | 127 | CHECK_NUMBER (address); |
| 131 | offs = (unsigned long) XINT (address); | 128 | offs = (unsigned long) XINT (address); |
| @@ -286,6 +283,8 @@ init_dosfns (void) | |||
| 286 | unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer; | 283 | unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer; |
| 287 | 284 | ||
| 288 | #ifndef SYSTEM_MALLOC | 285 | #ifndef SYSTEM_MALLOC |
| 286 | extern void get_lim_data (void); | ||
| 287 | |||
| 289 | get_lim_data (); /* why the hell isn't this called elsewhere? */ | 288 | get_lim_data (); /* why the hell isn't this called elsewhere? */ |
| 290 | #endif | 289 | #endif |
| 291 | 290 | ||
| @@ -558,6 +557,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 558 | int i; | 557 | int i; |
| 559 | Lisp_Object cmd_str, decoded_cmd, tem; | 558 | Lisp_Object cmd_str, decoded_cmd, tem; |
| 560 | double pmem; | 559 | double pmem; |
| 560 | EXFUN (Fget_internal_run_time, 0); | ||
| 561 | #ifndef SYSTEM_MALLOC | 561 | #ifndef SYSTEM_MALLOC |
| 562 | extern unsigned long ret_lim_data (); | 562 | extern unsigned long ret_lim_data (); |
| 563 | #endif | 563 | #endif |
diff --git a/src/dosfns.h b/src/dosfns.h index 820b6b30e43..d31401247b4 100644 --- a/src/dosfns.h +++ b/src/dosfns.h | |||
| @@ -40,6 +40,7 @@ extern Lisp_Object Vdos_display_scancodes; | |||
| 40 | 40 | ||
| 41 | extern int msdos_stdcolor_idx (const char *); | 41 | extern int msdos_stdcolor_idx (const char *); |
| 42 | extern Lisp_Object msdos_stdcolor_name (int); | 42 | extern Lisp_Object msdos_stdcolor_name (int); |
| 43 | extern void x_set_title (struct frame *, Lisp_Object); | ||
| 43 | #endif | 44 | #endif |
| 44 | 45 | ||
| 45 | /* arch-tag: a83b8c4c-63c8-451e-9e94-bc72e3e2f8bc | 46 | /* arch-tag: a83b8c4c-63c8-451e-9e94-bc72e3e2f8bc |
diff --git a/src/emacs.c b/src/emacs.c index 4dc670e6032..33e0d60630b 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -91,6 +91,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 91 | #endif | 91 | #endif |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | /* If you change the following line, remember to update | ||
| 95 | msdos/mainmake.v2 which gleans the Emacs version from it! */ | ||
| 94 | static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; | 96 | static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; |
| 95 | static const char emacs_version[] = "24.0.50"; | 97 | static const char emacs_version[] = "24.0.50"; |
| 96 | 98 | ||
| @@ -839,8 +841,9 @@ main (int argc, char **argv) | |||
| 839 | || strcmp (argv[argc-1], "bootstrap") == 0) | 841 | || strcmp (argv[argc-1], "bootstrap") == 0) |
| 840 | && ! getenv ("EMACS_HEAP_EXEC")) | 842 | && ! getenv ("EMACS_HEAP_EXEC")) |
| 841 | { | 843 | { |
| 844 | static char heapexec[] = "EMACS_HEAP_EXEC=true"; | ||
| 842 | /* Set this so we only do this once. */ | 845 | /* Set this so we only do this once. */ |
| 843 | putenv("EMACS_HEAP_EXEC=true"); | 846 | putenv(heapexec); |
| 844 | 847 | ||
| 845 | /* A flag to turn off address randomization which is introduced | 848 | /* A flag to turn off address randomization which is introduced |
| 846 | in linux kernel shipped with fedora core 4 */ | 849 | in linux kernel shipped with fedora core 4 */ |
| @@ -1329,68 +1332,6 @@ main (int argc, char **argv) | |||
| 1329 | init_atimer (); | 1332 | init_atimer (); |
| 1330 | running_asynch_code = 0; | 1333 | running_asynch_code = 0; |
| 1331 | 1334 | ||
| 1332 | /* Handle --unibyte and the EMACS_UNIBYTE envvar, | ||
| 1333 | but not while dumping. */ | ||
| 1334 | if (1) | ||
| 1335 | { | ||
| 1336 | int inhibit_unibyte = 0; | ||
| 1337 | |||
| 1338 | /* --multibyte overrides EMACS_UNIBYTE. */ | ||
| 1339 | if (argmatch (argv, argc, "-no-unibyte", "--no-unibyte", 4, NULL, &skip_args) | ||
| 1340 | || argmatch (argv, argc, "-multibyte", "--multibyte", 4, NULL, &skip_args) | ||
| 1341 | /* Ignore EMACS_UNIBYTE before dumping. */ | ||
| 1342 | || (!initialized && noninteractive)) | ||
| 1343 | inhibit_unibyte = 1; | ||
| 1344 | |||
| 1345 | /* --unibyte requests that we set up to do everything with single-byte | ||
| 1346 | buffers and strings. We need to handle this before calling | ||
| 1347 | init_lread, init_editfns and other places that generate Lisp strings | ||
| 1348 | from text in the environment. */ | ||
| 1349 | /* Actually this shouldn't be needed as of 20.4 in a generally | ||
| 1350 | unibyte environment. As handa says, environment values | ||
| 1351 | aren't now decoded; also existing buffers are now made | ||
| 1352 | unibyte during startup if .emacs sets unibyte. Tested with | ||
| 1353 | 8-bit data in environment variables and /etc/passwd, setting | ||
| 1354 | unibyte and Latin-1 in .emacs. -- Dave Love */ | ||
| 1355 | if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args) | ||
| 1356 | || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args) | ||
| 1357 | || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte)) | ||
| 1358 | { | ||
| 1359 | Lisp_Object old_log_max; | ||
| 1360 | Lisp_Object symbol, tail; | ||
| 1361 | |||
| 1362 | symbol = intern_c_string ("enable-multibyte-characters"); | ||
| 1363 | Fset_default (symbol, Qnil); | ||
| 1364 | |||
| 1365 | if (initialized) | ||
| 1366 | { | ||
| 1367 | /* Erase pre-dump messages in *Messages* now so no abort. */ | ||
| 1368 | old_log_max = Vmessage_log_max; | ||
| 1369 | XSETFASTINT (Vmessage_log_max, 0); | ||
| 1370 | message_dolog ("", 0, 1, 0); | ||
| 1371 | Vmessage_log_max = old_log_max; | ||
| 1372 | } | ||
| 1373 | |||
| 1374 | for (tail = Vbuffer_alist; CONSP (tail); | ||
| 1375 | tail = XCDR (tail)) | ||
| 1376 | { | ||
| 1377 | Lisp_Object buffer; | ||
| 1378 | |||
| 1379 | buffer = Fcdr (XCAR (tail)); | ||
| 1380 | /* Make a multibyte buffer unibyte. */ | ||
| 1381 | if (BUF_Z_BYTE (XBUFFER (buffer)) > BUF_Z (XBUFFER (buffer))) | ||
| 1382 | { | ||
| 1383 | struct buffer *current = current_buffer; | ||
| 1384 | |||
| 1385 | set_buffer_temp (XBUFFER (buffer)); | ||
| 1386 | Fset_buffer_multibyte (Qnil); | ||
| 1387 | set_buffer_temp (current); | ||
| 1388 | } | ||
| 1389 | } | ||
| 1390 | message ("Warning: unibyte sessions are obsolete and will disappear"); | ||
| 1391 | } | ||
| 1392 | } | ||
| 1393 | |||
| 1394 | no_loadup | 1335 | no_loadup |
| 1395 | = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); | 1336 | = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); |
| 1396 | 1337 | ||
| @@ -1603,6 +1544,10 @@ main (int argc, char **argv) | |||
| 1603 | #endif | 1544 | #endif |
| 1604 | #endif /* HAVE_X_WINDOWS */ | 1545 | #endif /* HAVE_X_WINDOWS */ |
| 1605 | 1546 | ||
| 1547 | #ifdef HAVE_LIBXML2 | ||
| 1548 | syms_of_xml (); | ||
| 1549 | #endif | ||
| 1550 | |||
| 1606 | syms_of_menu (); | 1551 | syms_of_menu (); |
| 1607 | 1552 | ||
| 1608 | #ifdef HAVE_NTGUI | 1553 | #ifdef HAVE_NTGUI |
| @@ -1789,10 +1734,6 @@ const struct standard_args standard_args[] = | |||
| 1789 | { "-script", "--script", 100, 1 }, | 1734 | { "-script", "--script", 100, 1 }, |
| 1790 | { "-daemon", "--daemon", 99, 0 }, | 1735 | { "-daemon", "--daemon", 99, 0 }, |
| 1791 | { "-help", "--help", 90, 0 }, | 1736 | { "-help", "--help", 90, 0 }, |
| 1792 | { "-no-unibyte", "--no-unibyte", 83, 0 }, | ||
| 1793 | { "-multibyte", "--multibyte", 82, 0 }, | ||
| 1794 | { "-unibyte", "--unibyte", 81, 0 }, | ||
| 1795 | { "-no-multibyte", "--no-multibyte", 80, 0 }, | ||
| 1796 | { "-nl", "--no-loadup", 70, 0 }, | 1737 | { "-nl", "--no-loadup", 70, 0 }, |
| 1797 | /* -d must come last before the options handled in startup.el. */ | 1738 | /* -d must come last before the options handled in startup.el. */ |
| 1798 | { "-d", "--display", 60, 1 }, | 1739 | { "-d", "--display", 60, 1 }, |
| @@ -2093,7 +2034,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) | |||
| 2093 | Vinhibit_redisplay = Qt; | 2034 | Vinhibit_redisplay = Qt; |
| 2094 | 2035 | ||
| 2095 | /* If we are controlling the terminal, reset terminal modes. */ | 2036 | /* If we are controlling the terminal, reset terminal modes. */ |
| 2096 | #ifdef EMACS_HAVE_TTY_PGRP | 2037 | #ifndef DOS_NT |
| 2097 | { | 2038 | { |
| 2098 | int pgrp = EMACS_GETPGRP (0); | 2039 | int pgrp = EMACS_GETPGRP (0); |
| 2099 | 2040 | ||
diff --git a/src/eval.c b/src/eval.c index 6d0a49c0d7e..a16d6c59809 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -722,8 +722,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | |||
| 722 | tail = XCDR (tail); | 722 | tail = XCDR (tail); |
| 723 | } | 723 | } |
| 724 | 724 | ||
| 725 | while (CONSP (Fcar (tail)) | 725 | if (CONSP (Fcar (tail)) |
| 726 | && EQ (Fcar (Fcar (tail)), Qdeclare)) | 726 | && EQ (Fcar (Fcar (tail)), Qdeclare)) |
| 727 | { | 727 | { |
| 728 | if (!NILP (Vmacro_declaration_function)) | 728 | if (!NILP (Vmacro_declaration_function)) |
| 729 | { | 729 | { |
| @@ -1072,12 +1072,13 @@ usage: (let VARLIST BODY...) */) | |||
| 1072 | int count = SPECPDL_INDEX (); | 1072 | int count = SPECPDL_INDEX (); |
| 1073 | register int argnum; | 1073 | register int argnum; |
| 1074 | struct gcpro gcpro1, gcpro2; | 1074 | struct gcpro gcpro1, gcpro2; |
| 1075 | USE_SAFE_ALLOCA; | ||
| 1075 | 1076 | ||
| 1076 | varlist = Fcar (args); | 1077 | varlist = Fcar (args); |
| 1077 | 1078 | ||
| 1078 | /* Make space to hold the values to give the bound variables */ | 1079 | /* Make space to hold the values to give the bound variables */ |
| 1079 | elt = Flength (varlist); | 1080 | elt = Flength (varlist); |
| 1080 | temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); | 1081 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); |
| 1081 | 1082 | ||
| 1082 | /* Compute the values and store them in `temps' */ | 1083 | /* Compute the values and store them in `temps' */ |
| 1083 | 1084 | ||
| @@ -1122,7 +1123,7 @@ usage: (let VARLIST BODY...) */) | |||
| 1122 | specbind (Qinternal_interpreter_environment, lexenv); | 1123 | specbind (Qinternal_interpreter_environment, lexenv); |
| 1123 | 1124 | ||
| 1124 | elt = Fprogn (Fcdr (args)); | 1125 | elt = Fprogn (Fcdr (args)); |
| 1125 | 1126 | SAFE_FREE (); | |
| 1126 | return unbind_to (count, elt); | 1127 | return unbind_to (count, elt); |
| 1127 | } | 1128 | } |
| 1128 | 1129 | ||
| @@ -2396,8 +2397,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2396 | /* Pass a vector of evaluated arguments */ | 2397 | /* Pass a vector of evaluated arguments */ |
| 2397 | Lisp_Object *vals; | 2398 | Lisp_Object *vals; |
| 2398 | register int argnum = 0; | 2399 | register int argnum = 0; |
| 2400 | USE_SAFE_ALLOCA; | ||
| 2399 | 2401 | ||
| 2400 | vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | 2402 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); |
| 2401 | 2403 | ||
| 2402 | GCPRO3 (args_left, fun, fun); | 2404 | GCPRO3 (args_left, fun, fun); |
| 2403 | gcpro3.var = vals; | 2405 | gcpro3.var = vals; |
| @@ -2415,6 +2417,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2415 | 2417 | ||
| 2416 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); | 2418 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); |
| 2417 | UNGCPRO; | 2419 | UNGCPRO; |
| 2420 | SAFE_FREE (); | ||
| 2418 | goto done; | 2421 | goto done; |
| 2419 | } | 2422 | } |
| 2420 | 2423 | ||
| @@ -2536,8 +2539,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2536 | register int i, numargs; | 2539 | register int i, numargs; |
| 2537 | register Lisp_Object spread_arg; | 2540 | register Lisp_Object spread_arg; |
| 2538 | register Lisp_Object *funcall_args; | 2541 | register Lisp_Object *funcall_args; |
| 2539 | Lisp_Object fun; | 2542 | Lisp_Object fun, retval; |
| 2540 | struct gcpro gcpro1; | 2543 | struct gcpro gcpro1; |
| 2544 | USE_SAFE_ALLOCA; | ||
| 2541 | 2545 | ||
| 2542 | fun = args [0]; | 2546 | fun = args [0]; |
| 2543 | funcall_args = 0; | 2547 | funcall_args = 0; |
| @@ -2576,8 +2580,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2576 | { | 2580 | { |
| 2577 | /* Avoid making funcall cons up a yet another new vector of arguments | 2581 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2578 | by explicitly supplying nil's for optional values */ | 2582 | by explicitly supplying nil's for optional values */ |
| 2579 | funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) | 2583 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2580 | * sizeof (Lisp_Object)); | ||
| 2581 | for (i = numargs; i < XSUBR (fun)->max_args;) | 2584 | for (i = numargs; i < XSUBR (fun)->max_args;) |
| 2582 | funcall_args[++i] = Qnil; | 2585 | funcall_args[++i] = Qnil; |
| 2583 | GCPRO1 (*funcall_args); | 2586 | GCPRO1 (*funcall_args); |
| @@ -2589,8 +2592,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2589 | function itself as well as its arguments. */ | 2592 | function itself as well as its arguments. */ |
| 2590 | if (!funcall_args) | 2593 | if (!funcall_args) |
| 2591 | { | 2594 | { |
| 2592 | funcall_args = (Lisp_Object *) alloca ((1 + numargs) | 2595 | SAFE_ALLOCA_LISP (funcall_args, 1 + numargs); |
| 2593 | * sizeof (Lisp_Object)); | ||
| 2594 | GCPRO1 (*funcall_args); | 2596 | GCPRO1 (*funcall_args); |
| 2595 | gcpro1.nvars = 1 + numargs; | 2597 | gcpro1.nvars = 1 + numargs; |
| 2596 | } | 2598 | } |
| @@ -2606,7 +2608,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2606 | } | 2608 | } |
| 2607 | 2609 | ||
| 2608 | /* By convention, the caller needs to gcpro Ffuncall's args. */ | 2610 | /* By convention, the caller needs to gcpro Ffuncall's args. */ |
| 2609 | RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); | 2611 | retval = Ffuncall (gcpro1.nvars, funcall_args); |
| 2612 | UNGCPRO; | ||
| 2613 | SAFE_FREE (); | ||
| 2614 | |||
| 2615 | return retval; | ||
| 2610 | } | 2616 | } |
| 2611 | 2617 | ||
| 2612 | /* Run hook variables in various ways. */ | 2618 | /* Run hook variables in various ways. */ |
| @@ -3212,9 +3218,10 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag, | |||
| 3212 | struct gcpro gcpro1, gcpro2, gcpro3; | 3218 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3213 | register int i; | 3219 | register int i; |
| 3214 | register Lisp_Object tem; | 3220 | register Lisp_Object tem; |
| 3221 | USE_SAFE_ALLOCA; | ||
| 3215 | 3222 | ||
| 3216 | numargs = Flength (args); | 3223 | numargs = Flength (args); |
| 3217 | arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | 3224 | SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); |
| 3218 | args_left = args; | 3225 | args_left = args; |
| 3219 | 3226 | ||
| 3220 | GCPRO3 (*arg_vector, args_left, fun); | 3227 | GCPRO3 (*arg_vector, args_left, fun); |
| @@ -3243,6 +3250,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag, | |||
| 3243 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); | 3250 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); |
| 3244 | /* Don't do it again when we return to eval. */ | 3251 | /* Don't do it again when we return to eval. */ |
| 3245 | backtrace_list->debug_on_exit = 0; | 3252 | backtrace_list->debug_on_exit = 0; |
| 3253 | SAFE_FREE (); | ||
| 3246 | return tem; | 3254 | return tem; |
| 3247 | } | 3255 | } |
| 3248 | 3256 | ||
diff --git a/src/fileio.c b/src/fileio.c index a04cd4e76f5..3d08e881e8f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1842,7 +1842,7 @@ barf_or_query_if_file_exists (Lisp_Object absname, const unsigned char *querystr | |||
| 1842 | tem = format2 ("File %s already exists; %s anyway? ", | 1842 | tem = format2 ("File %s already exists; %s anyway? ", |
| 1843 | absname, build_string (querystring)); | 1843 | absname, build_string (querystring)); |
| 1844 | if (quick) | 1844 | if (quick) |
| 1845 | tem = Fy_or_n_p (tem); | 1845 | tem = call1 (intern ("y-or-n-p"), tem); |
| 1846 | else | 1846 | else |
| 1847 | tem = do_yes_or_no_p (tem); | 1847 | tem = do_yes_or_no_p (tem); |
| 1848 | UNGCPRO; | 1848 | UNGCPRO; |
diff --git a/src/floatfns.c b/src/floatfns.c index 1c3e40eefde..29e5c119a1f 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -987,16 +987,18 @@ int | |||
| 987 | matherr (struct exception *x) | 987 | matherr (struct exception *x) |
| 988 | { | 988 | { |
| 989 | Lisp_Object args; | 989 | Lisp_Object args; |
| 990 | const char *name = x->name; | ||
| 991 | |||
| 990 | if (! in_float) | 992 | if (! in_float) |
| 991 | /* Not called from emacs-lisp float routines; do the default thing. */ | 993 | /* Not called from emacs-lisp float routines; do the default thing. */ |
| 992 | return 0; | 994 | return 0; |
| 993 | if (!strcmp (x->name, "pow")) | 995 | if (!strcmp (x->name, "pow")) |
| 994 | x->name = "expt"; | 996 | name = "expt"; |
| 995 | 997 | ||
| 996 | args | 998 | args |
| 997 | = Fcons (build_string (x->name), | 999 | = Fcons (build_string (name), |
| 998 | Fcons (make_float (x->arg1), | 1000 | Fcons (make_float (x->arg1), |
| 999 | ((!strcmp (x->name, "log") || !strcmp (x->name, "pow")) | 1001 | ((!strcmp (name, "log") || !strcmp (name, "pow")) |
| 1000 | ? Fcons (make_float (x->arg2), Qnil) | 1002 | ? Fcons (make_float (x->arg2), Qnil) |
| 1001 | : Qnil))); | 1003 | : Qnil))); |
| 1002 | switch (x->type) | 1004 | switch (x->type) |
| @@ -2447,146 +2447,6 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string. */) | |||
| 2447 | return sequence; | 2447 | return sequence; |
| 2448 | } | 2448 | } |
| 2449 | 2449 | ||
| 2450 | /* Anything that calls this function must protect from GC! */ | ||
| 2451 | |||
| 2452 | DEFUN ("y-or-n-p", Fy_or_n_p, Sy_or_n_p, 1, 1, 0, | ||
| 2453 | doc: /* Ask user a "y or n" question. Return t if answer is "y". | ||
| 2454 | Takes one argument, which is the string to display to ask the question. | ||
| 2455 | It should end in a space; `y-or-n-p' adds `(y or n) ' to it. | ||
| 2456 | No confirmation of the answer is requested; a single character is enough. | ||
| 2457 | Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses | ||
| 2458 | the bindings in `query-replace-map'; see the documentation of that variable | ||
| 2459 | for more information. In this case, the useful bindings are `act', `skip', | ||
| 2460 | `recenter', and `quit'.\) | ||
| 2461 | |||
| 2462 | Under a windowing system a dialog box will be used if `last-nonmenu-event' | ||
| 2463 | is nil and `use-dialog-box' is non-nil. */) | ||
| 2464 | (Lisp_Object prompt) | ||
| 2465 | { | ||
| 2466 | register Lisp_Object obj, key, def, map; | ||
| 2467 | register int answer; | ||
| 2468 | Lisp_Object xprompt; | ||
| 2469 | Lisp_Object args[2]; | ||
| 2470 | struct gcpro gcpro1, gcpro2; | ||
| 2471 | int count = SPECPDL_INDEX (); | ||
| 2472 | |||
| 2473 | specbind (Qcursor_in_echo_area, Qt); | ||
| 2474 | |||
| 2475 | map = Fsymbol_value (intern ("query-replace-map")); | ||
| 2476 | |||
| 2477 | CHECK_STRING (prompt); | ||
| 2478 | xprompt = prompt; | ||
| 2479 | GCPRO2 (prompt, xprompt); | ||
| 2480 | |||
| 2481 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 2482 | if (display_hourglass_p) | ||
| 2483 | cancel_hourglass (); | ||
| 2484 | #endif | ||
| 2485 | |||
| 2486 | while (1) | ||
| 2487 | { | ||
| 2488 | |||
| 2489 | #ifdef HAVE_MENUS | ||
| 2490 | if (FRAME_WINDOW_P (SELECTED_FRAME ()) | ||
| 2491 | && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | ||
| 2492 | && use_dialog_box | ||
| 2493 | && have_menus_p ()) | ||
| 2494 | { | ||
| 2495 | Lisp_Object pane, menu; | ||
| 2496 | redisplay_preserve_echo_area (3); | ||
| 2497 | pane = Fcons (Fcons (build_string ("Yes"), Qt), | ||
| 2498 | Fcons (Fcons (build_string ("No"), Qnil), | ||
| 2499 | Qnil)); | ||
| 2500 | menu = Fcons (prompt, pane); | ||
| 2501 | obj = Fx_popup_dialog (Qt, menu, Qnil); | ||
| 2502 | answer = !NILP (obj); | ||
| 2503 | break; | ||
| 2504 | } | ||
| 2505 | #endif /* HAVE_MENUS */ | ||
| 2506 | cursor_in_echo_area = 1; | ||
| 2507 | choose_minibuf_frame (); | ||
| 2508 | |||
| 2509 | { | ||
| 2510 | Lisp_Object pargs[3]; | ||
| 2511 | |||
| 2512 | /* Colorize prompt according to `minibuffer-prompt' face. */ | ||
| 2513 | pargs[0] = build_string ("%s(y or n) "); | ||
| 2514 | pargs[1] = intern ("face"); | ||
| 2515 | pargs[2] = intern ("minibuffer-prompt"); | ||
| 2516 | args[0] = Fpropertize (3, pargs); | ||
| 2517 | args[1] = xprompt; | ||
| 2518 | Fmessage (2, args); | ||
| 2519 | } | ||
| 2520 | |||
| 2521 | if (minibuffer_auto_raise) | ||
| 2522 | { | ||
| 2523 | Lisp_Object mini_frame; | ||
| 2524 | |||
| 2525 | mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); | ||
| 2526 | |||
| 2527 | Fraise_frame (mini_frame); | ||
| 2528 | } | ||
| 2529 | |||
| 2530 | temporarily_switch_to_single_kboard (SELECTED_FRAME ()); | ||
| 2531 | obj = read_filtered_event (1, 0, 0, 0, Qnil); | ||
| 2532 | cursor_in_echo_area = 0; | ||
| 2533 | /* If we need to quit, quit with cursor_in_echo_area = 0. */ | ||
| 2534 | QUIT; | ||
| 2535 | |||
| 2536 | key = Fmake_vector (make_number (1), obj); | ||
| 2537 | def = Flookup_key (map, key, Qt); | ||
| 2538 | |||
| 2539 | if (EQ (def, intern ("skip"))) | ||
| 2540 | { | ||
| 2541 | answer = 0; | ||
| 2542 | break; | ||
| 2543 | } | ||
| 2544 | else if (EQ (def, intern ("act"))) | ||
| 2545 | { | ||
| 2546 | answer = 1; | ||
| 2547 | break; | ||
| 2548 | } | ||
| 2549 | else if (EQ (def, intern ("recenter"))) | ||
| 2550 | { | ||
| 2551 | Frecenter (Qnil); | ||
| 2552 | xprompt = prompt; | ||
| 2553 | continue; | ||
| 2554 | } | ||
| 2555 | else if (EQ (def, intern ("quit"))) | ||
| 2556 | Vquit_flag = Qt; | ||
| 2557 | /* We want to exit this command for exit-prefix, | ||
| 2558 | and this is the only way to do it. */ | ||
| 2559 | else if (EQ (def, intern ("exit-prefix"))) | ||
| 2560 | Vquit_flag = Qt; | ||
| 2561 | |||
| 2562 | QUIT; | ||
| 2563 | |||
| 2564 | /* If we don't clear this, then the next call to read_char will | ||
| 2565 | return quit_char again, and we'll enter an infinite loop. */ | ||
| 2566 | Vquit_flag = Qnil; | ||
| 2567 | |||
| 2568 | Fding (Qnil); | ||
| 2569 | Fdiscard_input (); | ||
| 2570 | if (EQ (xprompt, prompt)) | ||
| 2571 | { | ||
| 2572 | args[0] = build_string ("Please answer y or n. "); | ||
| 2573 | args[1] = prompt; | ||
| 2574 | xprompt = Fconcat (2, args); | ||
| 2575 | } | ||
| 2576 | } | ||
| 2577 | UNGCPRO; | ||
| 2578 | |||
| 2579 | if (! noninteractive) | ||
| 2580 | { | ||
| 2581 | cursor_in_echo_area = -1; | ||
| 2582 | message_with_string (answer ? "%s(y or n) y" : "%s(y or n) n", | ||
| 2583 | xprompt, 0); | ||
| 2584 | } | ||
| 2585 | |||
| 2586 | unbind_to (count, Qnil); | ||
| 2587 | return answer ? Qt : Qnil; | ||
| 2588 | } | ||
| 2589 | |||
| 2590 | /* This is how C code calls `yes-or-no-p' and allows the user | 2450 | /* This is how C code calls `yes-or-no-p' and allows the user |
| 2591 | to redefined it. | 2451 | to redefined it. |
| 2592 | 2452 | ||
| @@ -4422,13 +4282,13 @@ keys. Default is `eql'. Predefined are the tests `eq', `eql', and | |||
| 4422 | Default is 65. | 4282 | Default is 65. |
| 4423 | 4283 | ||
| 4424 | :rehash-size REHASH-SIZE - Indicates how to expand the table when it | 4284 | :rehash-size REHASH-SIZE - Indicates how to expand the table when it |
| 4425 | fills up. If REHASH-SIZE is an integer, add that many space. If it | 4285 | fills up. If REHASH-SIZE is an integer, increase the size by that |
| 4426 | is a float, it must be > 1.0, and the new size is computed by | 4286 | amount. If it is a float, it must be > 1.0, and the new size is the |
| 4427 | multiplying the old size with that factor. Default is 1.5. | 4287 | old size multiplied by that factor. Default is 1.5. |
| 4428 | 4288 | ||
| 4429 | :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0. | 4289 | :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0. |
| 4430 | Resize the hash table when the ratio (number of entries / table size) | 4290 | Resize the hash table when the ratio (number of entries / table size) |
| 4431 | is greater or equal than THRESHOLD. Default is 0.8. | 4291 | is greater than or equal to THRESHOLD. Default is 0.8. |
| 4432 | 4292 | ||
| 4433 | :weakness WEAK -- WEAK must be one of nil, t, `key', `value', | 4293 | :weakness WEAK -- WEAK must be one of nil, t, `key', `value', |
| 4434 | `key-or-value', or `key-and-value'. If WEAK is not nil, the table | 4294 | `key-or-value', or `key-and-value'. If WEAK is not nil, the table |
| @@ -5061,7 +4921,6 @@ this variable. */); | |||
| 5061 | defsubr (&Smapcar); | 4921 | defsubr (&Smapcar); |
| 5062 | defsubr (&Smapc); | 4922 | defsubr (&Smapc); |
| 5063 | defsubr (&Smapconcat); | 4923 | defsubr (&Smapconcat); |
| 5064 | defsubr (&Sy_or_n_p); | ||
| 5065 | defsubr (&Syes_or_no_p); | 4924 | defsubr (&Syes_or_no_p); |
| 5066 | defsubr (&Sload_average); | 4925 | defsubr (&Sload_average); |
| 5067 | defsubr (&Sfeaturep); | 4926 | defsubr (&Sfeaturep); |
diff --git a/src/font.c b/src/font.c index eba75c11b2f..ae7211e92fe 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -3506,7 +3506,7 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec) | |||
| 3506 | found, return Qnil. */ | 3506 | found, return Qnil. */ |
| 3507 | 3507 | ||
| 3508 | Lisp_Object | 3508 | Lisp_Object |
| 3509 | font_open_by_name (FRAME_PTR f, char *name) | 3509 | font_open_by_name (FRAME_PTR f, const char *name) |
| 3510 | { | 3510 | { |
| 3511 | Lisp_Object args[2]; | 3511 | Lisp_Object args[2]; |
| 3512 | Lisp_Object spec, ret; | 3512 | Lisp_Object spec, ret; |
diff --git a/src/font.h b/src/font.h index 5f1a442b59e..c322b8e590f 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -783,7 +783,7 @@ extern void font_prepare_for_face (FRAME_PTR f, struct face *face); | |||
| 783 | extern void font_done_for_face (FRAME_PTR f, struct face *face); | 783 | extern void font_done_for_face (FRAME_PTR f, struct face *face); |
| 784 | 784 | ||
| 785 | extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); | 785 | extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); |
| 786 | extern Lisp_Object font_open_by_name (FRAME_PTR f, char *name); | 786 | extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name); |
| 787 | extern void font_close_object (FRAME_PTR f, Lisp_Object font_object); | 787 | extern void font_close_object (FRAME_PTR f, Lisp_Object font_object); |
| 788 | 788 | ||
| 789 | extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol); | 789 | extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol); |
diff --git a/src/fontset.c b/src/fontset.c index b273ace75af..86b9ceb45db 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -283,6 +283,10 @@ fontset_id_valid_p (id) | |||
| 283 | #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) | 283 | #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) |
| 284 | #define RFONT_DEF_SET_OBJECT(rfont_def, object) \ | 284 | #define RFONT_DEF_SET_OBJECT(rfont_def, object) \ |
| 285 | ASET ((rfont_def), 2, (object)) | 285 | ASET ((rfont_def), 2, (object)) |
| 286 | /* Score of RFONT_DEF is an integer value; the lowest 8 bits represent | ||
| 287 | the order of listing by font backends, the higher bits represents | ||
| 288 | the order given by charset priority list. The smaller value is | ||
| 289 | preferable. */ | ||
| 286 | #define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3)) | 290 | #define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3)) |
| 287 | #define RFONT_DEF_SET_SCORE(rfont_def, score) \ | 291 | #define RFONT_DEF_SET_SCORE(rfont_def, score) \ |
| 288 | ASET ((rfont_def), 3, make_number (score)) | 292 | ASET ((rfont_def), 3, make_number (score)) |
| @@ -412,8 +416,13 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) | |||
| 412 | Lisp_Object font_def = RFONT_DEF_FONT_DEF (rfont_def); | 416 | Lisp_Object font_def = RFONT_DEF_FONT_DEF (rfont_def); |
| 413 | Lisp_Object font_spec = FONT_DEF_SPEC (font_def); | 417 | Lisp_Object font_spec = FONT_DEF_SPEC (font_def); |
| 414 | int score = RFONT_DEF_SCORE (rfont_def) & 0xFF; | 418 | int score = RFONT_DEF_SCORE (rfont_def) & 0xFF; |
| 419 | Lisp_Object otf_spec = Ffont_get (font_spec, QCotf); | ||
| 415 | 420 | ||
| 416 | if (! font_match_p (font_spec, font_object)) | 421 | if (! NILP (otf_spec)) |
| 422 | /* A font-spec with :otf is preferable regardless of encoding | ||
| 423 | and language.. */ | ||
| 424 | ; | ||
| 425 | else if (! font_match_p (font_spec, font_object)) | ||
| 417 | { | 426 | { |
| 418 | Lisp_Object encoding = FONT_DEF_ENCODING (font_def); | 427 | Lisp_Object encoding = FONT_DEF_ENCODING (font_def); |
| 419 | 428 | ||
diff --git a/src/frame.h b/src/frame.h index 088b477dfce..6b307c7c3b1 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1050,7 +1050,7 @@ extern Lisp_Object Qbackground_color, Qforeground_color; | |||
| 1050 | extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top; | 1050 | extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top; |
| 1051 | extern Lisp_Object Qinternal_border_width; | 1051 | extern Lisp_Object Qinternal_border_width; |
| 1052 | extern Lisp_Object Qtooltip; | 1052 | extern Lisp_Object Qtooltip; |
| 1053 | extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines; | 1053 | extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position; |
| 1054 | extern Lisp_Object Qmouse_color; | 1054 | extern Lisp_Object Qmouse_color; |
| 1055 | extern Lisp_Object Qname, Qtitle; | 1055 | extern Lisp_Object Qname, Qtitle; |
| 1056 | extern Lisp_Object Qparent_id; | 1056 | extern Lisp_Object Qparent_id; |
diff --git a/src/gtkutil.c b/src/gtkutil.c index b1591b79f9c..dbd48eb5272 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -432,20 +432,22 @@ xg_list_remove (xg_list_node *list, xg_list_node *node) | |||
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | /* Allocate and return a utf8 version of STR. If STR is already | 434 | /* Allocate and return a utf8 version of STR. If STR is already |
| 435 | utf8 or NULL, just return STR. | 435 | utf8 or NULL, just return a copy of STR. |
| 436 | If not, a new string is allocated and the caller must free the result | 436 | A new string is allocated and the caller must free the result |
| 437 | with g_free. */ | 437 | with g_free. */ |
| 438 | 438 | ||
| 439 | static char * | 439 | static char * |
| 440 | get_utf8_string (char *str) | 440 | get_utf8_string (const char *str) |
| 441 | { | 441 | { |
| 442 | char *utf8_str = str; | 442 | char *utf8_str; |
| 443 | 443 | ||
| 444 | if (!str) return NULL; | 444 | if (!str) return NULL; |
| 445 | 445 | ||
| 446 | /* If not UTF-8, try current locale. */ | 446 | /* If not UTF-8, try current locale. */ |
| 447 | if (!g_utf8_validate (str, -1, NULL)) | 447 | if (!g_utf8_validate (str, -1, NULL)) |
| 448 | utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); | 448 | utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); |
| 449 | else | ||
| 450 | return g_strdup (str); | ||
| 449 | 451 | ||
| 450 | if (!utf8_str) | 452 | if (!utf8_str) |
| 451 | { | 453 | { |
| @@ -504,6 +506,41 @@ get_utf8_string (char *str) | |||
| 504 | return utf8_str; | 506 | return utf8_str; |
| 505 | } | 507 | } |
| 506 | 508 | ||
| 509 | /* Check for special colors used in face spec for region face. | ||
| 510 | The colors are fetched from the Gtk+ theme. | ||
| 511 | Return 1 if color was found, 0 if not. */ | ||
| 512 | |||
| 513 | int | ||
| 514 | xg_check_special_colors (struct frame *f, | ||
| 515 | const char *color_name, | ||
| 516 | XColor *color) | ||
| 517 | { | ||
| 518 | int success_p = 0; | ||
| 519 | if (FRAME_GTK_WIDGET (f)) | ||
| 520 | { | ||
| 521 | if (strcmp ("gtk_selection_bg_color", color_name) == 0) | ||
| 522 | { | ||
| 523 | GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); | ||
| 524 | color->red = gsty->bg[GTK_STATE_SELECTED].red; | ||
| 525 | color->green = gsty->bg[GTK_STATE_SELECTED].green; | ||
| 526 | color->blue = gsty->bg[GTK_STATE_SELECTED].blue; | ||
| 527 | color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel; | ||
| 528 | success_p = 1; | ||
| 529 | } | ||
| 530 | else if (strcmp ("gtk_selection_fg_color", color_name) == 0) | ||
| 531 | { | ||
| 532 | GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); | ||
| 533 | color->red = gsty->fg[GTK_STATE_SELECTED].red; | ||
| 534 | color->green = gsty->fg[GTK_STATE_SELECTED].green; | ||
| 535 | color->blue = gsty->fg[GTK_STATE_SELECTED].blue; | ||
| 536 | color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel; | ||
| 537 | success_p = 1; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | return success_p; | ||
| 542 | } | ||
| 543 | |||
| 507 | 544 | ||
| 508 | 545 | ||
| 509 | /*********************************************************************** | 546 | /*********************************************************************** |
| @@ -896,6 +933,26 @@ xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) | |||
| 896 | gdk_colormap_query_color (map, pixel, c); | 933 | gdk_colormap_query_color (map, pixel, c); |
| 897 | } | 934 | } |
| 898 | 935 | ||
| 936 | /* Callback called when the gtk theme changes. | ||
| 937 | We notify lisp code so it can fix faces used for region for example. */ | ||
| 938 | |||
| 939 | static void | ||
| 940 | style_changed_cb (GObject *go, | ||
| 941 | GParamSpec *spec, | ||
| 942 | gpointer user_data) | ||
| 943 | { | ||
| 944 | struct input_event event; | ||
| 945 | GdkDisplay *gdpy = (GdkDisplay *) user_data; | ||
| 946 | const char *display_name = gdk_display_get_name (gdpy); | ||
| 947 | |||
| 948 | EVENT_INIT (event); | ||
| 949 | event.kind = CONFIG_CHANGED_EVENT; | ||
| 950 | event.frame_or_window = make_string (display_name, strlen (display_name)); | ||
| 951 | /* Theme doesn't change often, so intern is called seldom. */ | ||
| 952 | event.arg = intern ("theme-name"); | ||
| 953 | kbd_buffer_store_event (&event); | ||
| 954 | } | ||
| 955 | |||
| 899 | /* Create and set up the GTK widgets for frame F. | 956 | /* Create and set up the GTK widgets for frame F. |
| 900 | Return 0 if creation failed, non-zero otherwise. */ | 957 | Return 0 if creation failed, non-zero otherwise. */ |
| 901 | 958 | ||
| @@ -1021,6 +1078,22 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 1021 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); | 1078 | g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); |
| 1022 | #endif | 1079 | #endif |
| 1023 | 1080 | ||
| 1081 | { | ||
| 1082 | GdkScreen *screen = gtk_widget_get_screen (wtop); | ||
| 1083 | GtkSettings *gs = gtk_settings_get_for_screen (screen); | ||
| 1084 | /* Only connect this signal once per screen. */ | ||
| 1085 | if (! g_signal_handler_find (G_OBJECT (gs), | ||
| 1086 | G_SIGNAL_MATCH_FUNC, | ||
| 1087 | 0, 0, 0, | ||
| 1088 | G_CALLBACK (style_changed_cb), | ||
| 1089 | 0)) | ||
| 1090 | { | ||
| 1091 | g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name", | ||
| 1092 | G_CALLBACK (style_changed_cb), | ||
| 1093 | gdk_screen_get_display (screen)); | ||
| 1094 | } | ||
| 1095 | } | ||
| 1096 | |||
| 1024 | UNBLOCK_INPUT; | 1097 | UNBLOCK_INPUT; |
| 1025 | 1098 | ||
| 1026 | return 1; | 1099 | return 1; |
| @@ -1336,7 +1409,7 @@ create_dialog (widget_value *wv, | |||
| 1336 | } | 1409 | } |
| 1337 | } | 1410 | } |
| 1338 | 1411 | ||
| 1339 | if (utf8_label && utf8_label != item->value) | 1412 | if (utf8_label) |
| 1340 | g_free (utf8_label); | 1413 | g_free (utf8_label); |
| 1341 | } | 1414 | } |
| 1342 | 1415 | ||
| @@ -2076,7 +2149,7 @@ static const char* separator_names[] = { | |||
| 2076 | }; | 2149 | }; |
| 2077 | 2150 | ||
| 2078 | static int | 2151 | static int |
| 2079 | xg_separator_p (char *label) | 2152 | xg_separator_p (const char *label) |
| 2080 | { | 2153 | { |
| 2081 | if (! label) return 0; | 2154 | if (! label) return 0; |
| 2082 | else if (strlen (label) > 3 | 2155 | else if (strlen (label) > 3 |
| @@ -2174,8 +2247,8 @@ xg_create_one_menuitem (widget_value *item, | |||
| 2174 | 2247 | ||
| 2175 | w = make_menu_item (utf8_label, utf8_key, item, group); | 2248 | w = make_menu_item (utf8_label, utf8_key, item, group); |
| 2176 | 2249 | ||
| 2177 | if (utf8_label && utf8_label != item->name) g_free (utf8_label); | 2250 | if (utf8_label) g_free (utf8_label); |
| 2178 | if (utf8_key && utf8_key != item->key) g_free (utf8_key); | 2251 | if (utf8_key) g_free (utf8_key); |
| 2179 | 2252 | ||
| 2180 | cb_data = xmalloc (sizeof (xg_menu_item_cb_data)); | 2253 | cb_data = xmalloc (sizeof (xg_menu_item_cb_data)); |
| 2181 | 2254 | ||
| @@ -2311,7 +2384,7 @@ create_menus (widget_value *data, | |||
| 2311 | gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); | 2384 | gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); |
| 2312 | w = gtk_menu_item_new_with_label (utf8_label); | 2385 | w = gtk_menu_item_new_with_label (utf8_label); |
| 2313 | gtk_widget_set_sensitive (w, FALSE); | 2386 | gtk_widget_set_sensitive (w, FALSE); |
| 2314 | if (utf8_label && utf8_label != item->name) g_free (utf8_label); | 2387 | if (utf8_label) g_free (utf8_label); |
| 2315 | } | 2388 | } |
| 2316 | else if (xg_separator_p (item->name)) | 2389 | else if (xg_separator_p (item->name)) |
| 2317 | { | 2390 | { |
| @@ -2432,7 +2505,7 @@ xg_get_menu_item_label (GtkMenuItem *witem) | |||
| 2432 | /* Return non-zero if the menu item WITEM has the text LABEL. */ | 2505 | /* Return non-zero if the menu item WITEM has the text LABEL. */ |
| 2433 | 2506 | ||
| 2434 | static int | 2507 | static int |
| 2435 | xg_item_label_same_p (GtkMenuItem *witem, char *label) | 2508 | xg_item_label_same_p (GtkMenuItem *witem, const char *label) |
| 2436 | { | 2509 | { |
| 2437 | int is_same = 0; | 2510 | int is_same = 0; |
| 2438 | char *utf8_label = get_utf8_string (label); | 2511 | char *utf8_label = get_utf8_string (label); |
| @@ -2443,7 +2516,7 @@ xg_item_label_same_p (GtkMenuItem *witem, char *label) | |||
| 2443 | else if (old_label && utf8_label) | 2516 | else if (old_label && utf8_label) |
| 2444 | is_same = strcmp (utf8_label, old_label) == 0; | 2517 | is_same = strcmp (utf8_label, old_label) == 0; |
| 2445 | 2518 | ||
| 2446 | if (utf8_label && utf8_label != label) g_free (utf8_label); | 2519 | if (utf8_label) g_free (utf8_label); |
| 2447 | 2520 | ||
| 2448 | return is_same; | 2521 | return is_same; |
| 2449 | } | 2522 | } |
| @@ -2590,6 +2663,7 @@ xg_update_menubar (GtkWidget *menubar, | |||
| 2590 | /* Set the title of the detached window. */ | 2663 | /* Set the title of the detached window. */ |
| 2591 | gtk_menu_set_title (GTK_MENU (submenu), utf8_label); | 2664 | gtk_menu_set_title (GTK_MENU (submenu), utf8_label); |
| 2592 | 2665 | ||
| 2666 | if (utf8_label) g_free (utf8_label); | ||
| 2593 | iter = g_list_next (iter); | 2667 | iter = g_list_next (iter); |
| 2594 | val = val->next; | 2668 | val = val->next; |
| 2595 | ++pos; | 2669 | ++pos; |
| @@ -2729,8 +2803,8 @@ xg_update_menu_item (widget_value *val, | |||
| 2729 | if (! old_label || strcmp (utf8_label, old_label) != 0) | 2803 | if (! old_label || strcmp (utf8_label, old_label) != 0) |
| 2730 | gtk_label_set_text (wlbl, utf8_label); | 2804 | gtk_label_set_text (wlbl, utf8_label); |
| 2731 | 2805 | ||
| 2732 | if (utf8_key && utf8_key != val->key) g_free (utf8_key); | 2806 | if (utf8_key) g_free (utf8_key); |
| 2733 | if (utf8_label && utf8_label != val->name) g_free (utf8_label); | 2807 | if (utf8_label) g_free (utf8_label); |
| 2734 | 2808 | ||
| 2735 | if (! val->enabled && gtk_widget_get_sensitive (w)) | 2809 | if (! val->enabled && gtk_widget_get_sensitive (w)) |
| 2736 | gtk_widget_set_sensitive (w, FALSE); | 2810 | gtk_widget_set_sensitive (w, FALSE); |
| @@ -4218,7 +4292,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4218 | GtkWidget *wbutton = NULL; | 4292 | GtkWidget *wbutton = NULL; |
| 4219 | GtkWidget *weventbox; | 4293 | GtkWidget *weventbox; |
| 4220 | Lisp_Object specified_file; | 4294 | Lisp_Object specified_file; |
| 4221 | char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); | 4295 | const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) |
| 4296 | ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); | ||
| 4222 | 4297 | ||
| 4223 | ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); | 4298 | ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); |
| 4224 | 4299 | ||
diff --git a/src/gtkutil.h b/src/gtkutil.h index 75620c54d10..9b796e1138c 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -38,14 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | /* Key for data that menu items hold. */ | 38 | /* Key for data that menu items hold. */ |
| 39 | #define XG_ITEM_DATA "emacs_menuitem" | 39 | #define XG_ITEM_DATA "emacs_menuitem" |
| 40 | 40 | ||
| 41 | /* Button types in menus. */ | ||
| 42 | enum button_type | ||
| 43 | { | ||
| 44 | BUTTON_TYPE_NONE, | ||
| 45 | BUTTON_TYPE_TOGGLE, | ||
| 46 | BUTTON_TYPE_RADIO | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* This is a list node in a generic list implementation. */ | 41 | /* This is a list node in a generic list implementation. */ |
| 50 | typedef struct xg_list_node_ | 42 | typedef struct xg_list_node_ |
| 51 | { | 43 | { |
| @@ -82,48 +74,13 @@ typedef struct xg_menu_item_cb_data_ | |||
| 82 | } xg_menu_item_cb_data; | 74 | } xg_menu_item_cb_data; |
| 83 | 75 | ||
| 84 | 76 | ||
| 85 | /* Used to specify menus and dialogs. | ||
| 86 | This is an adaption from lwlib for Gtk so we can use more of the same | ||
| 87 | code as lwlib in xmenu.c. */ | ||
| 88 | typedef struct _widget_value | ||
| 89 | { | ||
| 90 | /* name of widget */ | ||
| 91 | Lisp_Object lname; | ||
| 92 | char *name; | ||
| 93 | /* value (meaning depend on widget type) */ | ||
| 94 | char *value; | ||
| 95 | /* keyboard equivalent. no implications for XtTranslations */ | ||
| 96 | Lisp_Object lkey; | ||
| 97 | char *key; | ||
| 98 | /* Help string or nil if none. | ||
| 99 | GC finds this string through the frame's menu_bar_vector | ||
| 100 | or through menu_items. */ | ||
| 101 | Lisp_Object help; | ||
| 102 | /* true if enabled */ | ||
| 103 | gint enabled; | ||
| 104 | /* true if selected */ | ||
| 105 | gint selected; | ||
| 106 | /* The type of a button. */ | ||
| 107 | enum button_type button_type; | ||
| 108 | /* Contents of the sub-widgets, also selected slot for checkbox */ | ||
| 109 | struct _widget_value *contents; | ||
| 110 | /* data passed to callback */ | ||
| 111 | gpointer call_data; | ||
| 112 | /* next one in the list */ | ||
| 113 | struct _widget_value *next; | ||
| 114 | |||
| 115 | /* we resource the widget_value structures; this points to the next | ||
| 116 | one on the free list if this one has been deallocated. | ||
| 117 | */ | ||
| 118 | struct _widget_value *free_list; | ||
| 119 | } widget_value; | ||
| 120 | |||
| 121 | #ifdef HAVE_GTK_FILE_SELECTION_NEW | 77 | #ifdef HAVE_GTK_FILE_SELECTION_NEW |
| 122 | extern int use_old_gtk_file_dialog; | 78 | extern int use_old_gtk_file_dialog; |
| 123 | #endif | 79 | #endif |
| 80 | struct _widget_value; | ||
| 124 | 81 | ||
| 125 | extern widget_value *malloc_widget_value (void); | 82 | extern struct _widget_value *malloc_widget_value (void); |
| 126 | extern void free_widget_value (widget_value *); | 83 | extern void free_widget_value (struct _widget_value *); |
| 127 | 84 | ||
| 128 | extern int xg_uses_old_file_dialog (void); | 85 | extern int xg_uses_old_file_dialog (void); |
| 129 | 86 | ||
| @@ -138,14 +95,14 @@ extern char *xg_get_font_name (FRAME_PTR f, const char *); | |||
| 138 | extern GtkWidget *xg_create_widget (const char *type, | 95 | extern GtkWidget *xg_create_widget (const char *type, |
| 139 | const char *name, | 96 | const char *name, |
| 140 | FRAME_PTR f, | 97 | FRAME_PTR f, |
| 141 | widget_value *val, | 98 | struct _widget_value *val, |
| 142 | GCallback select_cb, | 99 | GCallback select_cb, |
| 143 | GCallback deactivate_cb, | 100 | GCallback deactivate_cb, |
| 144 | GCallback hightlight_cb); | 101 | GCallback hightlight_cb); |
| 145 | 102 | ||
| 146 | extern void xg_modify_menubar_widgets (GtkWidget *menubar, | 103 | extern void xg_modify_menubar_widgets (GtkWidget *menubar, |
| 147 | FRAME_PTR f, | 104 | FRAME_PTR f, |
| 148 | widget_value *val, | 105 | struct _widget_value *val, |
| 149 | int deep_p, | 106 | int deep_p, |
| 150 | GCallback select_cb, | 107 | GCallback select_cb, |
| 151 | GCallback deactivate_cb, | 108 | GCallback deactivate_cb, |
| @@ -199,6 +156,9 @@ extern void x_wm_set_size_hint (FRAME_PTR f, | |||
| 199 | long flags, | 156 | long flags, |
| 200 | int user_position); | 157 | int user_position); |
| 201 | extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); | 158 | extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); |
| 159 | extern int xg_check_special_colors (struct frame *f, | ||
| 160 | const char *color_name, | ||
| 161 | XColor *color); | ||
| 202 | 162 | ||
| 203 | extern void xg_set_frame_icon (FRAME_PTR f, | 163 | extern void xg_set_frame_icon (FRAME_PTR f, |
| 204 | Pixmap icon_pixmap, | 164 | Pixmap icon_pixmap, |
diff --git a/src/image.c b/src/image.c index 916fcfe8178..499cbf298c1 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -583,7 +583,7 @@ Lisp_Object Qxbm; | |||
| 583 | 583 | ||
| 584 | Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; | 584 | Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; |
| 585 | Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; | 585 | Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; |
| 586 | Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; | 586 | Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry, QCcrop, QCrotation; |
| 587 | 587 | ||
| 588 | /* Other symbols. */ | 588 | /* Other symbols. */ |
| 589 | 589 | ||
| @@ -1735,7 +1735,6 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1735 | struct image_cache *c; | 1735 | struct image_cache *c; |
| 1736 | struct image *img; | 1736 | struct image *img; |
| 1737 | unsigned hash; | 1737 | unsigned hash; |
| 1738 | struct gcpro gcpro1; | ||
| 1739 | EMACS_TIME now; | 1738 | EMACS_TIME now; |
| 1740 | 1739 | ||
| 1741 | /* F must be a window-system frame, and SPEC must be a valid image | 1740 | /* F must be a window-system frame, and SPEC must be a valid image |
| @@ -1745,8 +1744,6 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1745 | 1744 | ||
| 1746 | c = FRAME_IMAGE_CACHE (f); | 1745 | c = FRAME_IMAGE_CACHE (f); |
| 1747 | 1746 | ||
| 1748 | GCPRO1 (spec); | ||
| 1749 | |||
| 1750 | /* Look up SPEC in the hash table of the image cache. */ | 1747 | /* Look up SPEC in the hash table of the image cache. */ |
| 1751 | hash = sxhash (spec, 0); | 1748 | hash = sxhash (spec, 0); |
| 1752 | img = search_image_cache (f, spec, hash); | 1749 | img = search_image_cache (f, spec, hash); |
| @@ -1838,8 +1835,6 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1838 | EMACS_GET_TIME (now); | 1835 | EMACS_GET_TIME (now); |
| 1839 | img->timestamp = EMACS_SECS (now); | 1836 | img->timestamp = EMACS_SECS (now); |
| 1840 | 1837 | ||
| 1841 | UNGCPRO; | ||
| 1842 | |||
| 1843 | /* Value is the image id. */ | 1838 | /* Value is the image id. */ |
| 1844 | return img->id; | 1839 | return img->id; |
| 1845 | } | 1840 | } |
| @@ -2179,16 +2174,13 @@ Lisp_Object | |||
| 2179 | x_find_image_file (Lisp_Object file) | 2174 | x_find_image_file (Lisp_Object file) |
| 2180 | { | 2175 | { |
| 2181 | Lisp_Object file_found, search_path; | 2176 | Lisp_Object file_found, search_path; |
| 2182 | struct gcpro gcpro1, gcpro2; | ||
| 2183 | int fd; | 2177 | int fd; |
| 2184 | 2178 | ||
| 2185 | file_found = Qnil; | ||
| 2186 | /* TODO I think this should use something like image-load-path | 2179 | /* TODO I think this should use something like image-load-path |
| 2187 | instead. Unfortunately, that can contain non-string elements. */ | 2180 | instead. Unfortunately, that can contain non-string elements. */ |
| 2188 | search_path = Fcons (Fexpand_file_name (build_string ("images"), | 2181 | search_path = Fcons (Fexpand_file_name (build_string ("images"), |
| 2189 | Vdata_directory), | 2182 | Vdata_directory), |
| 2190 | Vx_bitmap_file_path); | 2183 | Vx_bitmap_file_path); |
| 2191 | GCPRO2 (file_found, search_path); | ||
| 2192 | 2184 | ||
| 2193 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ | 2185 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ |
| 2194 | fd = openp (search_path, file, Qnil, &file_found, Qnil); | 2186 | fd = openp (search_path, file, Qnil, &file_found, Qnil); |
| @@ -2201,7 +2193,6 @@ x_find_image_file (Lisp_Object file) | |||
| 2201 | close (fd); | 2193 | close (fd); |
| 2202 | } | 2194 | } |
| 2203 | 2195 | ||
| 2204 | UNGCPRO; | ||
| 2205 | return file_found; | 2196 | return file_found; |
| 2206 | } | 2197 | } |
| 2207 | 2198 | ||
| @@ -2875,14 +2866,11 @@ xbm_load (struct frame *f, struct image *img) | |||
| 2875 | Lisp_Object file; | 2866 | Lisp_Object file; |
| 2876 | unsigned char *contents; | 2867 | unsigned char *contents; |
| 2877 | int size; | 2868 | int size; |
| 2878 | struct gcpro gcpro1; | ||
| 2879 | 2869 | ||
| 2880 | file = x_find_image_file (file_name); | 2870 | file = x_find_image_file (file_name); |
| 2881 | GCPRO1 (file); | ||
| 2882 | if (!STRINGP (file)) | 2871 | if (!STRINGP (file)) |
| 2883 | { | 2872 | { |
| 2884 | image_error ("Cannot find image file `%s'", file_name, Qnil); | 2873 | image_error ("Cannot find image file `%s'", file_name, Qnil); |
| 2885 | UNGCPRO; | ||
| 2886 | return 0; | 2874 | return 0; |
| 2887 | } | 2875 | } |
| 2888 | 2876 | ||
| @@ -2890,12 +2878,10 @@ xbm_load (struct frame *f, struct image *img) | |||
| 2890 | if (contents == NULL) | 2878 | if (contents == NULL) |
| 2891 | { | 2879 | { |
| 2892 | image_error ("Error loading XBM image `%s'", img->spec, Qnil); | 2880 | image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
| 2893 | UNGCPRO; | ||
| 2894 | return 0; | 2881 | return 0; |
| 2895 | } | 2882 | } |
| 2896 | 2883 | ||
| 2897 | success_p = xbm_load_image (f, img, contents, contents + size); | 2884 | success_p = xbm_load_image (f, img, contents, contents + size); |
| 2898 | UNGCPRO; | ||
| 2899 | } | 2885 | } |
| 2900 | else | 2886 | else |
| 2901 | { | 2887 | { |
| @@ -3456,12 +3442,31 @@ xpm_load (struct frame *f, struct image *img) | |||
| 3456 | CONSP (tail); | 3442 | CONSP (tail); |
| 3457 | ++i, tail = XCDR (tail)) | 3443 | ++i, tail = XCDR (tail)) |
| 3458 | { | 3444 | { |
| 3459 | Lisp_Object name = XCAR (XCAR (tail)); | 3445 | Lisp_Object name; |
| 3460 | Lisp_Object color = XCDR (XCAR (tail)); | 3446 | Lisp_Object color; |
| 3461 | xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); | 3447 | |
| 3462 | strcpy (xpm_syms[i].name, SDATA (name)); | 3448 | if (!CONSP (XCAR (tail))) |
| 3463 | xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); | 3449 | { |
| 3464 | strcpy (xpm_syms[i].value, SDATA (color)); | 3450 | xpm_syms[i].name = ""; |
| 3451 | xpm_syms[i].value = ""; | ||
| 3452 | continue; | ||
| 3453 | } | ||
| 3454 | name = XCAR (XCAR (tail)); | ||
| 3455 | color = XCDR (XCAR (tail)); | ||
| 3456 | if (STRINGP (name)) | ||
| 3457 | { | ||
| 3458 | xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); | ||
| 3459 | strcpy (xpm_syms[i].name, SDATA (name)); | ||
| 3460 | } | ||
| 3461 | else | ||
| 3462 | xpm_syms[i].name = ""; | ||
| 3463 | if (STRINGP (color)) | ||
| 3464 | { | ||
| 3465 | xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); | ||
| 3466 | strcpy (xpm_syms[i].value, SDATA (color)); | ||
| 3467 | } | ||
| 3468 | else | ||
| 3469 | xpm_syms[i].value = ""; | ||
| 3465 | } | 3470 | } |
| 3466 | } | 3471 | } |
| 3467 | 3472 | ||
| @@ -3487,6 +3492,9 @@ xpm_load (struct frame *f, struct image *img) | |||
| 3487 | if (!STRINGP (file)) | 3492 | if (!STRINGP (file)) |
| 3488 | { | 3493 | { |
| 3489 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 3494 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 3495 | #ifdef ALLOC_XPM_COLORS | ||
| 3496 | xpm_free_color_cache (); | ||
| 3497 | #endif | ||
| 3490 | return 0; | 3498 | return 0; |
| 3491 | } | 3499 | } |
| 3492 | 3500 | ||
| @@ -3505,6 +3513,14 @@ xpm_load (struct frame *f, struct image *img) | |||
| 3505 | else | 3513 | else |
| 3506 | { | 3514 | { |
| 3507 | Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); | 3515 | Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); |
| 3516 | if (!STRINGP (buffer)) | ||
| 3517 | { | ||
| 3518 | image_error ("Invalid image data `%s'", buffer, Qnil); | ||
| 3519 | #ifdef ALLOC_XPM_COLORS | ||
| 3520 | xpm_free_color_cache (); | ||
| 3521 | #endif | ||
| 3522 | return 0; | ||
| 3523 | } | ||
| 3508 | #ifdef HAVE_NTGUI | 3524 | #ifdef HAVE_NTGUI |
| 3509 | /* XpmCreatePixmapFromBuffer is not available in the Windows port | 3525 | /* XpmCreatePixmapFromBuffer is not available in the Windows port |
| 3510 | of libxpm. But XpmCreateImageFromBuffer almost does what we want. */ | 3526 | of libxpm. But XpmCreateImageFromBuffer almost does what we want. */ |
| @@ -4071,14 +4087,11 @@ xpm_load (struct frame *f, | |||
| 4071 | Lisp_Object file; | 4087 | Lisp_Object file; |
| 4072 | unsigned char *contents; | 4088 | unsigned char *contents; |
| 4073 | int size; | 4089 | int size; |
| 4074 | struct gcpro gcpro1; | ||
| 4075 | 4090 | ||
| 4076 | file = x_find_image_file (file_name); | 4091 | file = x_find_image_file (file_name); |
| 4077 | GCPRO1 (file); | ||
| 4078 | if (!STRINGP (file)) | 4092 | if (!STRINGP (file)) |
| 4079 | { | 4093 | { |
| 4080 | image_error ("Cannot find image file `%s'", file_name, Qnil); | 4094 | image_error ("Cannot find image file `%s'", file_name, Qnil); |
| 4081 | UNGCPRO; | ||
| 4082 | return 0; | 4095 | return 0; |
| 4083 | } | 4096 | } |
| 4084 | 4097 | ||
| @@ -4086,19 +4099,22 @@ xpm_load (struct frame *f, | |||
| 4086 | if (contents == NULL) | 4099 | if (contents == NULL) |
| 4087 | { | 4100 | { |
| 4088 | image_error ("Error loading XPM image `%s'", img->spec, Qnil); | 4101 | image_error ("Error loading XPM image `%s'", img->spec, Qnil); |
| 4089 | UNGCPRO; | ||
| 4090 | return 0; | 4102 | return 0; |
| 4091 | } | 4103 | } |
| 4092 | 4104 | ||
| 4093 | success_p = xpm_load_image (f, img, contents, contents + size); | 4105 | success_p = xpm_load_image (f, img, contents, contents + size); |
| 4094 | xfree (contents); | 4106 | xfree (contents); |
| 4095 | UNGCPRO; | ||
| 4096 | } | 4107 | } |
| 4097 | else | 4108 | else |
| 4098 | { | 4109 | { |
| 4099 | Lisp_Object data; | 4110 | Lisp_Object data; |
| 4100 | 4111 | ||
| 4101 | data = image_spec_value (img->spec, QCdata, NULL); | 4112 | data = image_spec_value (img->spec, QCdata, NULL); |
| 4113 | if (!STRINGP (data)) | ||
| 4114 | { | ||
| 4115 | image_error ("Invalid image data `%s'", data, Qnil); | ||
| 4116 | return 0; | ||
| 4117 | } | ||
| 4102 | success_p = xpm_load_image (f, img, SDATA (data), | 4118 | success_p = xpm_load_image (f, img, SDATA (data), |
| 4103 | SDATA (data) + SBYTES (data)); | 4119 | SDATA (data) + SBYTES (data)); |
| 4104 | } | 4120 | } |
| @@ -5090,14 +5106,11 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5090 | XImagePtr ximg; | 5106 | XImagePtr ximg; |
| 5091 | Lisp_Object file, specified_file; | 5107 | Lisp_Object file, specified_file; |
| 5092 | enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type; | 5108 | enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type; |
| 5093 | struct gcpro gcpro1; | ||
| 5094 | unsigned char *contents = NULL; | 5109 | unsigned char *contents = NULL; |
| 5095 | unsigned char *end, *p; | 5110 | unsigned char *end, *p; |
| 5096 | int size; | 5111 | int size; |
| 5097 | 5112 | ||
| 5098 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 5113 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 5099 | file = Qnil; | ||
| 5100 | GCPRO1 (file); | ||
| 5101 | 5114 | ||
| 5102 | if (STRINGP (specified_file)) | 5115 | if (STRINGP (specified_file)) |
| 5103 | { | 5116 | { |
| @@ -5105,7 +5118,6 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5105 | if (!STRINGP (file)) | 5118 | if (!STRINGP (file)) |
| 5106 | { | 5119 | { |
| 5107 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 5120 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 5108 | UNGCPRO; | ||
| 5109 | return 0; | 5121 | return 0; |
| 5110 | } | 5122 | } |
| 5111 | 5123 | ||
| @@ -5113,7 +5125,6 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5113 | if (contents == NULL) | 5125 | if (contents == NULL) |
| 5114 | { | 5126 | { |
| 5115 | image_error ("Error reading `%s'", file, Qnil); | 5127 | image_error ("Error reading `%s'", file, Qnil); |
| 5116 | UNGCPRO; | ||
| 5117 | return 0; | 5128 | return 0; |
| 5118 | } | 5129 | } |
| 5119 | 5130 | ||
| @@ -5124,6 +5135,11 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5124 | { | 5135 | { |
| 5125 | Lisp_Object data; | 5136 | Lisp_Object data; |
| 5126 | data = image_spec_value (img->spec, QCdata, NULL); | 5137 | data = image_spec_value (img->spec, QCdata, NULL); |
| 5138 | if (!STRINGP (data)) | ||
| 5139 | { | ||
| 5140 | image_error ("Invalid image data `%s'", data, Qnil); | ||
| 5141 | return 0; | ||
| 5142 | } | ||
| 5127 | p = SDATA (data); | 5143 | p = SDATA (data); |
| 5128 | end = p + SBYTES (data); | 5144 | end = p + SBYTES (data); |
| 5129 | } | 5145 | } |
| @@ -5134,7 +5150,6 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5134 | image_error ("Not a PBM image: `%s'", img->spec, Qnil); | 5150 | image_error ("Not a PBM image: `%s'", img->spec, Qnil); |
| 5135 | error: | 5151 | error: |
| 5136 | xfree (contents); | 5152 | xfree (contents); |
| 5137 | UNGCPRO; | ||
| 5138 | return 0; | 5153 | return 0; |
| 5139 | } | 5154 | } |
| 5140 | 5155 | ||
| @@ -5336,7 +5351,6 @@ pbm_load (struct frame *f, struct image *img) | |||
| 5336 | img->width = width; | 5351 | img->width = width; |
| 5337 | img->height = height; */ | 5352 | img->height = height; */ |
| 5338 | 5353 | ||
| 5339 | UNGCPRO; | ||
| 5340 | xfree (contents); | 5354 | xfree (contents); |
| 5341 | return 1; | 5355 | return 1; |
| 5342 | } | 5356 | } |
| @@ -5576,7 +5590,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5576 | Lisp_Object specified_data; | 5590 | Lisp_Object specified_data; |
| 5577 | int x, y, i; | 5591 | int x, y, i; |
| 5578 | XImagePtr ximg, mask_img = NULL; | 5592 | XImagePtr ximg, mask_img = NULL; |
| 5579 | struct gcpro gcpro1; | ||
| 5580 | png_struct *png_ptr = NULL; | 5593 | png_struct *png_ptr = NULL; |
| 5581 | png_info *info_ptr = NULL, *end_info = NULL; | 5594 | png_info *info_ptr = NULL, *end_info = NULL; |
| 5582 | FILE *volatile fp = NULL; | 5595 | FILE *volatile fp = NULL; |
| @@ -5593,8 +5606,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5593 | /* Find out what file to load. */ | 5606 | /* Find out what file to load. */ |
| 5594 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 5607 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 5595 | specified_data = image_spec_value (img->spec, QCdata, NULL); | 5608 | specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 5596 | file = Qnil; | ||
| 5597 | GCPRO1 (file); | ||
| 5598 | 5609 | ||
| 5599 | if (NILP (specified_data)) | 5610 | if (NILP (specified_data)) |
| 5600 | { | 5611 | { |
| @@ -5602,7 +5613,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5602 | if (!STRINGP (file)) | 5613 | if (!STRINGP (file)) |
| 5603 | { | 5614 | { |
| 5604 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 5615 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 5605 | UNGCPRO; | ||
| 5606 | return 0; | 5616 | return 0; |
| 5607 | } | 5617 | } |
| 5608 | 5618 | ||
| @@ -5611,7 +5621,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5611 | if (!fp) | 5621 | if (!fp) |
| 5612 | { | 5622 | { |
| 5613 | image_error ("Cannot open image file `%s'", file, Qnil); | 5623 | image_error ("Cannot open image file `%s'", file, Qnil); |
| 5614 | UNGCPRO; | ||
| 5615 | return 0; | 5624 | return 0; |
| 5616 | } | 5625 | } |
| 5617 | 5626 | ||
| @@ -5620,13 +5629,18 @@ png_load (struct frame *f, struct image *img) | |||
| 5620 | || fn_png_sig_cmp (sig, 0, sizeof sig)) | 5629 | || fn_png_sig_cmp (sig, 0, sizeof sig)) |
| 5621 | { | 5630 | { |
| 5622 | image_error ("Not a PNG file: `%s'", file, Qnil); | 5631 | image_error ("Not a PNG file: `%s'", file, Qnil); |
| 5623 | UNGCPRO; | ||
| 5624 | fclose (fp); | 5632 | fclose (fp); |
| 5625 | return 0; | 5633 | return 0; |
| 5626 | } | 5634 | } |
| 5627 | } | 5635 | } |
| 5628 | else | 5636 | else |
| 5629 | { | 5637 | { |
| 5638 | if (!STRINGP (specified_data)) | ||
| 5639 | { | ||
| 5640 | image_error ("Invalid image data `%s'", specified_data, Qnil); | ||
| 5641 | return 0; | ||
| 5642 | } | ||
| 5643 | |||
| 5630 | /* Read from memory. */ | 5644 | /* Read from memory. */ |
| 5631 | tbr.bytes = SDATA (specified_data); | 5645 | tbr.bytes = SDATA (specified_data); |
| 5632 | tbr.len = SBYTES (specified_data); | 5646 | tbr.len = SBYTES (specified_data); |
| @@ -5637,7 +5651,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5637 | || fn_png_sig_cmp (tbr.bytes, 0, sizeof sig)) | 5651 | || fn_png_sig_cmp (tbr.bytes, 0, sizeof sig)) |
| 5638 | { | 5652 | { |
| 5639 | image_error ("Not a PNG image: `%s'", img->spec, Qnil); | 5653 | image_error ("Not a PNG image: `%s'", img->spec, Qnil); |
| 5640 | UNGCPRO; | ||
| 5641 | return 0; | 5654 | return 0; |
| 5642 | } | 5655 | } |
| 5643 | 5656 | ||
| @@ -5653,7 +5666,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5653 | if (!png_ptr) | 5666 | if (!png_ptr) |
| 5654 | { | 5667 | { |
| 5655 | if (fp) fclose (fp); | 5668 | if (fp) fclose (fp); |
| 5656 | UNGCPRO; | ||
| 5657 | return 0; | 5669 | return 0; |
| 5658 | } | 5670 | } |
| 5659 | 5671 | ||
| @@ -5663,7 +5675,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5663 | { | 5675 | { |
| 5664 | fn_png_destroy_read_struct (&png_ptr, NULL, NULL); | 5676 | fn_png_destroy_read_struct (&png_ptr, NULL, NULL); |
| 5665 | if (fp) fclose (fp); | 5677 | if (fp) fclose (fp); |
| 5666 | UNGCPRO; | ||
| 5667 | return 0; | 5678 | return 0; |
| 5668 | } | 5679 | } |
| 5669 | 5680 | ||
| @@ -5673,7 +5684,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5673 | { | 5684 | { |
| 5674 | fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); | 5685 | fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); |
| 5675 | if (fp) fclose (fp); | 5686 | if (fp) fclose (fp); |
| 5676 | UNGCPRO; | ||
| 5677 | return 0; | 5687 | return 0; |
| 5678 | } | 5688 | } |
| 5679 | 5689 | ||
| @@ -5687,7 +5697,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5687 | xfree (pixels); | 5697 | xfree (pixels); |
| 5688 | xfree (rows); | 5698 | xfree (rows); |
| 5689 | if (fp) fclose (fp); | 5699 | if (fp) fclose (fp); |
| 5690 | UNGCPRO; | ||
| 5691 | return 0; | 5700 | return 0; |
| 5692 | } | 5701 | } |
| 5693 | 5702 | ||
| @@ -5912,7 +5921,6 @@ png_load (struct frame *f, struct image *img) | |||
| 5912 | x_destroy_x_image (mask_img); | 5921 | x_destroy_x_image (mask_img); |
| 5913 | } | 5922 | } |
| 5914 | 5923 | ||
| 5915 | UNGCPRO; | ||
| 5916 | return 1; | 5924 | return 1; |
| 5917 | } | 5925 | } |
| 5918 | 5926 | ||
| @@ -6313,13 +6321,10 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6313 | int rc; | 6321 | int rc; |
| 6314 | unsigned long *colors; | 6322 | unsigned long *colors; |
| 6315 | int width, height; | 6323 | int width, height; |
| 6316 | struct gcpro gcpro1; | ||
| 6317 | 6324 | ||
| 6318 | /* Open the JPEG file. */ | 6325 | /* Open the JPEG file. */ |
| 6319 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 6326 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 6320 | specified_data = image_spec_value (img->spec, QCdata, NULL); | 6327 | specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 6321 | file = Qnil; | ||
| 6322 | GCPRO1 (file); | ||
| 6323 | 6328 | ||
| 6324 | if (NILP (specified_data)) | 6329 | if (NILP (specified_data)) |
| 6325 | { | 6330 | { |
| @@ -6327,7 +6332,6 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6327 | if (!STRINGP (file)) | 6332 | if (!STRINGP (file)) |
| 6328 | { | 6333 | { |
| 6329 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 6334 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 6330 | UNGCPRO; | ||
| 6331 | return 0; | 6335 | return 0; |
| 6332 | } | 6336 | } |
| 6333 | 6337 | ||
| @@ -6335,10 +6339,14 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6335 | if (fp == NULL) | 6339 | if (fp == NULL) |
| 6336 | { | 6340 | { |
| 6337 | image_error ("Cannot open `%s'", file, Qnil); | 6341 | image_error ("Cannot open `%s'", file, Qnil); |
| 6338 | UNGCPRO; | ||
| 6339 | return 0; | 6342 | return 0; |
| 6340 | } | 6343 | } |
| 6341 | } | 6344 | } |
| 6345 | else if (!STRINGP (specified_data)) | ||
| 6346 | { | ||
| 6347 | image_error ("Invalid image data `%s'", specified_data, Qnil); | ||
| 6348 | return 0; | ||
| 6349 | } | ||
| 6342 | 6350 | ||
| 6343 | /* Customize libjpeg's error handling to call my_error_exit when an | 6351 | /* Customize libjpeg's error handling to call my_error_exit when an |
| 6344 | error is detected. This function will perform a longjmp. | 6352 | error is detected. This function will perform a longjmp. |
| @@ -6367,8 +6375,6 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6367 | 6375 | ||
| 6368 | /* Free pixmap and colors. */ | 6376 | /* Free pixmap and colors. */ |
| 6369 | x_clear_image (f, img); | 6377 | x_clear_image (f, img); |
| 6370 | |||
| 6371 | UNGCPRO; | ||
| 6372 | return 0; | 6378 | return 0; |
| 6373 | } | 6379 | } |
| 6374 | 6380 | ||
| @@ -6466,7 +6472,6 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6466 | /* Put the image into the pixmap. */ | 6472 | /* Put the image into the pixmap. */ |
| 6467 | x_put_x_image (f, ximg, img->pixmap, width, height); | 6473 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 6468 | x_destroy_x_image (ximg); | 6474 | x_destroy_x_image (ximg); |
| 6469 | UNGCPRO; | ||
| 6470 | return 1; | 6475 | return 1; |
| 6471 | } | 6476 | } |
| 6472 | 6477 | ||
| @@ -6741,14 +6746,11 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6741 | uint32 *buf; | 6746 | uint32 *buf; |
| 6742 | int rc, rc2; | 6747 | int rc, rc2; |
| 6743 | XImagePtr ximg; | 6748 | XImagePtr ximg; |
| 6744 | struct gcpro gcpro1; | ||
| 6745 | tiff_memory_source memsrc; | 6749 | tiff_memory_source memsrc; |
| 6746 | Lisp_Object image; | 6750 | Lisp_Object image; |
| 6747 | 6751 | ||
| 6748 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 6752 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 6749 | specified_data = image_spec_value (img->spec, QCdata, NULL); | 6753 | specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 6750 | file = Qnil; | ||
| 6751 | GCPRO1 (file); | ||
| 6752 | 6754 | ||
| 6753 | fn_TIFFSetErrorHandler (tiff_error_handler); | 6755 | fn_TIFFSetErrorHandler (tiff_error_handler); |
| 6754 | fn_TIFFSetWarningHandler (tiff_warning_handler); | 6756 | fn_TIFFSetWarningHandler (tiff_warning_handler); |
| @@ -6760,7 +6762,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6760 | if (!STRINGP (file)) | 6762 | if (!STRINGP (file)) |
| 6761 | { | 6763 | { |
| 6762 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 6764 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 6763 | UNGCPRO; | ||
| 6764 | return 0; | 6765 | return 0; |
| 6765 | } | 6766 | } |
| 6766 | 6767 | ||
| @@ -6770,12 +6771,17 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6770 | if (tiff == NULL) | 6771 | if (tiff == NULL) |
| 6771 | { | 6772 | { |
| 6772 | image_error ("Cannot open `%s'", file, Qnil); | 6773 | image_error ("Cannot open `%s'", file, Qnil); |
| 6773 | UNGCPRO; | ||
| 6774 | return 0; | 6774 | return 0; |
| 6775 | } | 6775 | } |
| 6776 | } | 6776 | } |
| 6777 | else | 6777 | else |
| 6778 | { | 6778 | { |
| 6779 | if (!STRINGP (specified_data)) | ||
| 6780 | { | ||
| 6781 | image_error ("Invalid image data `%s'", specified_data, Qnil); | ||
| 6782 | return 0; | ||
| 6783 | } | ||
| 6784 | |||
| 6779 | /* Memory source! */ | 6785 | /* Memory source! */ |
| 6780 | memsrc.bytes = SDATA (specified_data); | 6786 | memsrc.bytes = SDATA (specified_data); |
| 6781 | memsrc.len = SBYTES (specified_data); | 6787 | memsrc.len = SBYTES (specified_data); |
| @@ -6794,7 +6800,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6794 | if (!tiff) | 6800 | if (!tiff) |
| 6795 | { | 6801 | { |
| 6796 | image_error ("Cannot open memory source for `%s'", img->spec, Qnil); | 6802 | image_error ("Cannot open memory source for `%s'", img->spec, Qnil); |
| 6797 | UNGCPRO; | ||
| 6798 | return 0; | 6803 | return 0; |
| 6799 | } | 6804 | } |
| 6800 | } | 6805 | } |
| @@ -6808,7 +6813,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6808 | image_error ("Invalid image number `%s' in image `%s'", | 6813 | image_error ("Invalid image number `%s' in image `%s'", |
| 6809 | image, img->spec); | 6814 | image, img->spec); |
| 6810 | fn_TIFFClose (tiff); | 6815 | fn_TIFFClose (tiff); |
| 6811 | UNGCPRO; | ||
| 6812 | return 0; | 6816 | return 0; |
| 6813 | } | 6817 | } |
| 6814 | } | 6818 | } |
| @@ -6822,7 +6826,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6822 | { | 6826 | { |
| 6823 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); | 6827 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); |
| 6824 | fn_TIFFClose (tiff); | 6828 | fn_TIFFClose (tiff); |
| 6825 | UNGCPRO; | ||
| 6826 | return 0; | 6829 | return 0; |
| 6827 | } | 6830 | } |
| 6828 | 6831 | ||
| @@ -6844,7 +6847,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6844 | { | 6847 | { |
| 6845 | image_error ("Error reading TIFF image `%s'", img->spec, Qnil); | 6848 | image_error ("Error reading TIFF image `%s'", img->spec, Qnil); |
| 6846 | xfree (buf); | 6849 | xfree (buf); |
| 6847 | UNGCPRO; | ||
| 6848 | return 0; | 6850 | return 0; |
| 6849 | } | 6851 | } |
| 6850 | 6852 | ||
| @@ -6852,7 +6854,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6852 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 6854 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| 6853 | { | 6855 | { |
| 6854 | xfree (buf); | 6856 | xfree (buf); |
| 6855 | UNGCPRO; | ||
| 6856 | return 0; | 6857 | return 0; |
| 6857 | } | 6858 | } |
| 6858 | 6859 | ||
| @@ -6893,7 +6894,6 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6893 | x_destroy_x_image (ximg); | 6894 | x_destroy_x_image (ximg); |
| 6894 | xfree (buf); | 6895 | xfree (buf); |
| 6895 | 6896 | ||
| 6896 | UNGCPRO; | ||
| 6897 | return 1; | 6897 | return 1; |
| 6898 | } | 6898 | } |
| 6899 | 6899 | ||
| @@ -7099,7 +7099,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7099 | ColorMapObject *gif_color_map; | 7099 | ColorMapObject *gif_color_map; |
| 7100 | unsigned long pixel_colors[256]; | 7100 | unsigned long pixel_colors[256]; |
| 7101 | GifFileType *gif; | 7101 | GifFileType *gif; |
| 7102 | struct gcpro gcpro1; | ||
| 7103 | Lisp_Object image; | 7102 | Lisp_Object image; |
| 7104 | int ino, image_height, image_width; | 7103 | int ino, image_height, image_width; |
| 7105 | gif_memory_source memsrc; | 7104 | gif_memory_source memsrc; |
| @@ -7107,8 +7106,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7107 | 7106 | ||
| 7108 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 7107 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 7109 | specified_data = image_spec_value (img->spec, QCdata, NULL); | 7108 | specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 7110 | file = Qnil; | ||
| 7111 | GCPRO1 (file); | ||
| 7112 | 7109 | ||
| 7113 | if (NILP (specified_data)) | 7110 | if (NILP (specified_data)) |
| 7114 | { | 7111 | { |
| @@ -7116,7 +7113,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7116 | if (!STRINGP (file)) | 7113 | if (!STRINGP (file)) |
| 7117 | { | 7114 | { |
| 7118 | image_error ("Cannot find image file `%s'", specified_file, Qnil); | 7115 | image_error ("Cannot find image file `%s'", specified_file, Qnil); |
| 7119 | UNGCPRO; | ||
| 7120 | return 0; | 7116 | return 0; |
| 7121 | } | 7117 | } |
| 7122 | 7118 | ||
| @@ -7126,12 +7122,17 @@ gif_load (struct frame *f, struct image *img) | |||
| 7126 | if (gif == NULL) | 7122 | if (gif == NULL) |
| 7127 | { | 7123 | { |
| 7128 | image_error ("Cannot open `%s'", file, Qnil); | 7124 | image_error ("Cannot open `%s'", file, Qnil); |
| 7129 | UNGCPRO; | ||
| 7130 | return 0; | 7125 | return 0; |
| 7131 | } | 7126 | } |
| 7132 | } | 7127 | } |
| 7133 | else | 7128 | else |
| 7134 | { | 7129 | { |
| 7130 | if (!STRINGP (specified_data)) | ||
| 7131 | { | ||
| 7132 | image_error ("Invalid image data `%s'", specified_data, Qnil); | ||
| 7133 | return 0; | ||
| 7134 | } | ||
| 7135 | |||
| 7135 | /* Read from memory! */ | 7136 | /* Read from memory! */ |
| 7136 | current_gif_memory_src = &memsrc; | 7137 | current_gif_memory_src = &memsrc; |
| 7137 | memsrc.bytes = SDATA (specified_data); | 7138 | memsrc.bytes = SDATA (specified_data); |
| @@ -7143,7 +7144,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7143 | if (!gif) | 7144 | if (!gif) |
| 7144 | { | 7145 | { |
| 7145 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); | 7146 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
| 7146 | UNGCPRO; | ||
| 7147 | return 0; | 7147 | return 0; |
| 7148 | } | 7148 | } |
| 7149 | } | 7149 | } |
| @@ -7153,7 +7153,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7153 | { | 7153 | { |
| 7154 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); | 7154 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); |
| 7155 | fn_DGifCloseFile (gif); | 7155 | fn_DGifCloseFile (gif); |
| 7156 | UNGCPRO; | ||
| 7157 | return 0; | 7156 | return 0; |
| 7158 | } | 7157 | } |
| 7159 | 7158 | ||
| @@ -7163,7 +7162,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7163 | { | 7162 | { |
| 7164 | image_error ("Error reading `%s'", img->spec, Qnil); | 7163 | image_error ("Error reading `%s'", img->spec, Qnil); |
| 7165 | fn_DGifCloseFile (gif); | 7164 | fn_DGifCloseFile (gif); |
| 7166 | UNGCPRO; | ||
| 7167 | return 0; | 7165 | return 0; |
| 7168 | } | 7166 | } |
| 7169 | 7167 | ||
| @@ -7174,7 +7172,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7174 | image_error ("Invalid image number `%s' in image `%s'", | 7172 | image_error ("Invalid image number `%s' in image `%s'", |
| 7175 | image, img->spec); | 7173 | image, img->spec); |
| 7176 | fn_DGifCloseFile (gif); | 7174 | fn_DGifCloseFile (gif); |
| 7177 | UNGCPRO; | ||
| 7178 | return 0; | 7175 | return 0; |
| 7179 | } | 7176 | } |
| 7180 | 7177 | ||
| @@ -7196,7 +7193,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7196 | { | 7193 | { |
| 7197 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); | 7194 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); |
| 7198 | fn_DGifCloseFile (gif); | 7195 | fn_DGifCloseFile (gif); |
| 7199 | UNGCPRO; | ||
| 7200 | return 0; | 7196 | return 0; |
| 7201 | } | 7197 | } |
| 7202 | 7198 | ||
| @@ -7204,7 +7200,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7204 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 7200 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| 7205 | { | 7201 | { |
| 7206 | fn_DGifCloseFile (gif); | 7202 | fn_DGifCloseFile (gif); |
| 7207 | UNGCPRO; | ||
| 7208 | return 0; | 7203 | return 0; |
| 7209 | } | 7204 | } |
| 7210 | 7205 | ||
| @@ -7323,7 +7318,6 @@ gif_load (struct frame *f, struct image *img) | |||
| 7323 | x_put_x_image (f, ximg, img->pixmap, width, height); | 7318 | x_put_x_image (f, ximg, img->pixmap, width, height); |
| 7324 | x_destroy_x_image (ximg); | 7319 | x_destroy_x_image (ximg); |
| 7325 | 7320 | ||
| 7326 | UNGCPRO; | ||
| 7327 | return 1; | 7321 | return 1; |
| 7328 | } | 7322 | } |
| 7329 | 7323 | ||
| @@ -7342,6 +7336,522 @@ gif_load (struct frame *f, struct image *img) | |||
| 7342 | #endif /* HAVE_GIF */ | 7336 | #endif /* HAVE_GIF */ |
| 7343 | 7337 | ||
| 7344 | 7338 | ||
| 7339 | /*********************************************************************** | ||
| 7340 | imagemagick | ||
| 7341 | ***********************************************************************/ | ||
| 7342 | #if defined (HAVE_IMAGEMAGICK) | ||
| 7343 | Lisp_Object Vimagemagick_render_type; | ||
| 7344 | |||
| 7345 | /* The symbol `imagemagick' identifying images of this type. */ | ||
| 7346 | |||
| 7347 | Lisp_Object Qimagemagick; | ||
| 7348 | Lisp_Object Vimagemagick_render_type; | ||
| 7349 | |||
| 7350 | /* Indices of image specification fields in imagemagick_format, below. */ | ||
| 7351 | |||
| 7352 | enum imagemagick_keyword_index | ||
| 7353 | { | ||
| 7354 | IMAGEMAGICK_TYPE, | ||
| 7355 | IMAGEMAGICK_DATA, | ||
| 7356 | IMAGEMAGICK_FILE, | ||
| 7357 | IMAGEMAGICK_ASCENT, | ||
| 7358 | IMAGEMAGICK_MARGIN, | ||
| 7359 | IMAGEMAGICK_RELIEF, | ||
| 7360 | IMAGEMAGICK_ALGORITHM, | ||
| 7361 | IMAGEMAGICK_HEURISTIC_MASK, | ||
| 7362 | IMAGEMAGICK_MASK, | ||
| 7363 | IMAGEMAGICK_BACKGROUND, | ||
| 7364 | IMAGEMAGICK_HEIGHT, | ||
| 7365 | IMAGEMAGICK_WIDTH, | ||
| 7366 | IMAGEMAGICK_ROTATION, | ||
| 7367 | IMAGEMAGICK_CROP, | ||
| 7368 | IMAGEMAGICK_LAST | ||
| 7369 | }; | ||
| 7370 | |||
| 7371 | /* Vector of image_keyword structures describing the format | ||
| 7372 | of valid user-defined image specifications. */ | ||
| 7373 | |||
| 7374 | static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] = | ||
| 7375 | { | ||
| 7376 | {":type", IMAGE_SYMBOL_VALUE, 1}, | ||
| 7377 | {":data", IMAGE_STRING_VALUE, 0}, | ||
| 7378 | {":file", IMAGE_STRING_VALUE, 0}, | ||
| 7379 | {":ascent", IMAGE_ASCENT_VALUE, 0}, | ||
| 7380 | {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, | ||
| 7381 | {":relief", IMAGE_INTEGER_VALUE, 0}, | ||
| 7382 | {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 7383 | {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 7384 | {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | ||
| 7385 | {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, | ||
| 7386 | {":height", IMAGE_INTEGER_VALUE, 0}, | ||
| 7387 | {":width", IMAGE_INTEGER_VALUE, 0}, | ||
| 7388 | {":rotation", IMAGE_NUMBER_VALUE, 0}, | ||
| 7389 | {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0} | ||
| 7390 | }; | ||
| 7391 | /* Free X resources of imagemagick image IMG which is used on frame F. */ | ||
| 7392 | |||
| 7393 | static void | ||
| 7394 | imagemagick_clear_image (struct frame *f, | ||
| 7395 | struct image *img) | ||
| 7396 | { | ||
| 7397 | x_clear_image (f, img); | ||
| 7398 | } | ||
| 7399 | |||
| 7400 | |||
| 7401 | |||
| 7402 | /* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do | ||
| 7403 | this by calling parse_image_spec and supplying the keywords that | ||
| 7404 | identify the IMAGEMAGICK format. */ | ||
| 7405 | |||
| 7406 | static int | ||
| 7407 | imagemagick_image_p (Lisp_Object object) | ||
| 7408 | { | ||
| 7409 | struct image_keyword fmt[IMAGEMAGICK_LAST]; | ||
| 7410 | memcpy (fmt, imagemagick_format, sizeof fmt); | ||
| 7411 | |||
| 7412 | if (!parse_image_spec (object, fmt, IMAGEMAGICK_LAST, Qimagemagick)) | ||
| 7413 | return 0; | ||
| 7414 | |||
| 7415 | /* Must specify either the :data or :file keyword. */ | ||
| 7416 | return fmt[IMAGEMAGICK_FILE].count + fmt[IMAGEMAGICK_DATA].count == 1; | ||
| 7417 | } | ||
| 7418 | |||
| 7419 | /* The GIF library also defines DrawRectangle, but its never used in Emacs. | ||
| 7420 | Therefore rename the function so it doesnt collide with ImageMagick. */ | ||
| 7421 | #define DrawRectangle DrawRectangleGif | ||
| 7422 | #include <wand/MagickWand.h> | ||
| 7423 | |||
| 7424 | /* imagemagick_load_image is a helper function for imagemagick_load, | ||
| 7425 | which does the actual loading given contents and size, apart from | ||
| 7426 | frame and image structures, passed from imagemagick_load. | ||
| 7427 | |||
| 7428 | Uses librimagemagick to do most of the image processing. | ||
| 7429 | |||
| 7430 | non-zero when successful. | ||
| 7431 | */ | ||
| 7432 | |||
| 7433 | static int | ||
| 7434 | imagemagick_load_image (/* Pointer to emacs frame structure. */ | ||
| 7435 | struct frame *f, | ||
| 7436 | /* Pointer to emacs image structure. */ | ||
| 7437 | struct image *img, | ||
| 7438 | /* String containing the IMAGEMAGICK data to | ||
| 7439 | be parsed. */ | ||
| 7440 | unsigned char *contents, | ||
| 7441 | /* Size of data in bytes. */ | ||
| 7442 | unsigned int size, | ||
| 7443 | /* Filename, either pass filename or | ||
| 7444 | contents/size. */ | ||
| 7445 | unsigned char *filename) | ||
| 7446 | { | ||
| 7447 | unsigned long width; | ||
| 7448 | unsigned long height; | ||
| 7449 | |||
| 7450 | MagickBooleanType | ||
| 7451 | status; | ||
| 7452 | |||
| 7453 | XImagePtr ximg; | ||
| 7454 | Lisp_Object specified_bg; | ||
| 7455 | XColor background; | ||
| 7456 | int x; | ||
| 7457 | int y; | ||
| 7458 | |||
| 7459 | MagickWand *image_wand; | ||
| 7460 | MagickWand *ping_wand; | ||
| 7461 | PixelIterator *iterator; | ||
| 7462 | PixelWand **pixels; | ||
| 7463 | MagickPixelPacket pixel; | ||
| 7464 | Lisp_Object image; | ||
| 7465 | Lisp_Object value; | ||
| 7466 | Lisp_Object crop, geometry; | ||
| 7467 | long ino; | ||
| 7468 | int desired_width, desired_height; | ||
| 7469 | double rotation; | ||
| 7470 | int imagemagick_rendermethod; | ||
| 7471 | int pixelwidth; | ||
| 7472 | ImageInfo *image_info; | ||
| 7473 | ExceptionInfo *exception; | ||
| 7474 | Image * im_image; | ||
| 7475 | |||
| 7476 | |||
| 7477 | /* Handle image index for image types who can contain more than one | ||
| 7478 | image. Interface :index is same as for GIF. First we "ping" the | ||
| 7479 | image to see how many sub-images it contains. Pinging is faster | ||
| 7480 | than loading the image to find out things about it. */ | ||
| 7481 | image = image_spec_value (img->spec, QCindex, NULL); | ||
| 7482 | ino = INTEGERP (image) ? XFASTINT (image) : 0; | ||
| 7483 | ping_wand = NewMagickWand (); | ||
| 7484 | MagickSetResolution (ping_wand, 2, 2); | ||
| 7485 | if (filename != NULL) | ||
| 7486 | { | ||
| 7487 | status = MagickPingImage (ping_wand, filename); | ||
| 7488 | } | ||
| 7489 | else | ||
| 7490 | { | ||
| 7491 | status = MagickPingImageBlob (ping_wand, contents, size); | ||
| 7492 | } | ||
| 7493 | |||
| 7494 | if (ino >= MagickGetNumberImages (ping_wand)) | ||
| 7495 | { | ||
| 7496 | image_error ("Invalid image number `%s' in image `%s'", | ||
| 7497 | image, img->spec); | ||
| 7498 | DestroyMagickWand (ping_wand); | ||
| 7499 | return 0; | ||
| 7500 | } | ||
| 7501 | |||
| 7502 | if (MagickGetNumberImages(ping_wand) > 1) | ||
| 7503 | img->data.lisp_val = | ||
| 7504 | Fcons (Qcount, | ||
| 7505 | Fcons (make_number (MagickGetNumberImages (ping_wand)), | ||
| 7506 | img->data.lisp_val)); | ||
| 7507 | |||
| 7508 | DestroyMagickWand (ping_wand); | ||
| 7509 | /* Now, after pinging, we know how many images are inside the | ||
| 7510 | file. If its not a bundle, just one. */ | ||
| 7511 | |||
| 7512 | if (filename != NULL) | ||
| 7513 | { | ||
| 7514 | image_info = CloneImageInfo ((ImageInfo *) NULL); | ||
| 7515 | (void) strcpy (image_info->filename, filename); | ||
| 7516 | image_info->number_scenes = 1; | ||
| 7517 | image_info->scene = ino; | ||
| 7518 | exception = AcquireExceptionInfo (); | ||
| 7519 | |||
| 7520 | im_image = ReadImage (image_info, exception); | ||
| 7521 | CatchException (exception); | ||
| 7522 | |||
| 7523 | image_wand = NewMagickWandFromImage (im_image); | ||
| 7524 | } | ||
| 7525 | else | ||
| 7526 | { | ||
| 7527 | image_wand = NewMagickWand (); | ||
| 7528 | status = MagickReadImageBlob (image_wand, contents, size); | ||
| 7529 | } | ||
| 7530 | image_error ("im read failed", Qnil, Qnil); | ||
| 7531 | if (status == MagickFalse) goto imagemagick_error; | ||
| 7532 | |||
| 7533 | /* If width and/or height is set in the display spec assume we want | ||
| 7534 | to scale to those values. if either h or w is unspecified, the | ||
| 7535 | unspecified should be calculated from the specified to preserve | ||
| 7536 | aspect ratio. */ | ||
| 7537 | |||
| 7538 | value = image_spec_value (img->spec, QCwidth, NULL); | ||
| 7539 | desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); | ||
| 7540 | value = image_spec_value (img->spec, QCheight, NULL); | ||
| 7541 | desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); | ||
| 7542 | |||
| 7543 | height = MagickGetImageHeight (image_wand); | ||
| 7544 | width = MagickGetImageWidth (image_wand); | ||
| 7545 | |||
| 7546 | if(desired_width != -1 && desired_height == -1) | ||
| 7547 | { | ||
| 7548 | /* w known, calculate h. */ | ||
| 7549 | desired_height = (double) desired_width / width * height; | ||
| 7550 | } | ||
| 7551 | if(desired_width == -1 && desired_height != -1) | ||
| 7552 | { | ||
| 7553 | /* h known, calculate w. */ | ||
| 7554 | desired_width = (double) desired_height / height * width; | ||
| 7555 | } | ||
| 7556 | if(desired_width != -1 && desired_height != -1) | ||
| 7557 | { | ||
| 7558 | status = MagickScaleImage (image_wand, desired_width, desired_height); | ||
| 7559 | if (status == MagickFalse) | ||
| 7560 | { | ||
| 7561 | image_error ("Imagemagick scale failed", Qnil, Qnil); | ||
| 7562 | goto imagemagick_error; | ||
| 7563 | } | ||
| 7564 | } | ||
| 7565 | |||
| 7566 | |||
| 7567 | /* crop behaves similar to image slicing in Emacs but is more memory | ||
| 7568 | efficient. */ | ||
| 7569 | crop = image_spec_value (img->spec, QCcrop, NULL); | ||
| 7570 | |||
| 7571 | if (CONSP (crop) && INTEGERP (XCAR (crop))) | ||
| 7572 | { | ||
| 7573 | /* After some testing, it seems MagickCropImage is the fastest | ||
| 7574 | crop function in ImageMagick. This crop function seems to do | ||
| 7575 | less copying than the alternatives, but it still reads the | ||
| 7576 | entire image into memory before croping, which is aparently | ||
| 7577 | difficult to avoid when using imagemagick. */ | ||
| 7578 | |||
| 7579 | int w, h, x, y; | ||
| 7580 | w = XFASTINT (XCAR (crop)); | ||
| 7581 | crop = XCDR (crop); | ||
| 7582 | if (CONSP (crop) && INTEGERP (XCAR (crop))) | ||
| 7583 | { | ||
| 7584 | h = XFASTINT (XCAR (crop)); | ||
| 7585 | crop = XCDR (crop); | ||
| 7586 | if (CONSP (crop) && INTEGERP (XCAR (crop))) | ||
| 7587 | { | ||
| 7588 | x = XFASTINT (XCAR (crop)); | ||
| 7589 | crop = XCDR (crop); | ||
| 7590 | if (CONSP (crop) && INTEGERP (XCAR (crop))) | ||
| 7591 | { | ||
| 7592 | y = XFASTINT (XCAR (crop)); | ||
| 7593 | MagickCropImage (image_wand, w, h, x, y); | ||
| 7594 | } | ||
| 7595 | } | ||
| 7596 | } | ||
| 7597 | } | ||
| 7598 | |||
| 7599 | /* Furthermore :rotation. we need background color and angle for | ||
| 7600 | rotation. */ | ||
| 7601 | /* | ||
| 7602 | TODO background handling for rotation specified_bg = | ||
| 7603 | image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP | ||
| 7604 | (specified_bg). */ | ||
| 7605 | value = image_spec_value (img->spec, QCrotation, NULL); | ||
| 7606 | if (FLOATP (value)) | ||
| 7607 | { | ||
| 7608 | PixelWand* background = NewPixelWand (); | ||
| 7609 | PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ | ||
| 7610 | |||
| 7611 | rotation = extract_float (value); | ||
| 7612 | |||
| 7613 | status = MagickRotateImage (image_wand, background, rotation); | ||
| 7614 | DestroyPixelWand (background); | ||
| 7615 | if (status == MagickFalse) | ||
| 7616 | { | ||
| 7617 | image_error ("Imagemagick image rotate failed", Qnil, Qnil); | ||
| 7618 | goto imagemagick_error; | ||
| 7619 | } | ||
| 7620 | } | ||
| 7621 | |||
| 7622 | /* Finaly we are done manipulating the image, figure out resulting | ||
| 7623 | width, height, and then transfer ownerwship to Emacs. */ | ||
| 7624 | height = MagickGetImageHeight (image_wand); | ||
| 7625 | width = MagickGetImageWidth (image_wand); | ||
| 7626 | if (status == MagickFalse) | ||
| 7627 | { | ||
| 7628 | image_error ("Imagemagick image get size failed", Qnil, Qnil); | ||
| 7629 | goto imagemagick_error; | ||
| 7630 | } | ||
| 7631 | |||
| 7632 | if (! check_image_size (f, width, height)) | ||
| 7633 | { | ||
| 7634 | image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); | ||
| 7635 | goto imagemagick_error; | ||
| 7636 | } | ||
| 7637 | |||
| 7638 | /* We can now get a valid pixel buffer from the imagemagick file, if all | ||
| 7639 | went ok. */ | ||
| 7640 | |||
| 7641 | init_color_table (); | ||
| 7642 | imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) | ||
| 7643 | ? XFASTINT (Vimagemagick_render_type) : 0); | ||
| 7644 | if (imagemagick_rendermethod == 0) | ||
| 7645 | { | ||
| 7646 | /* Try to create a x pixmap to hold the imagemagick pixmap. */ | ||
| 7647 | if (!x_create_x_image_and_pixmap (f, width, height, 0, | ||
| 7648 | &ximg, &img->pixmap)) | ||
| 7649 | { | ||
| 7650 | image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); | ||
| 7651 | goto imagemagick_error; | ||
| 7652 | } | ||
| 7653 | |||
| 7654 | /* Copy imagegmagick image to x with primitive yet robust pixel | ||
| 7655 | pusher loop. This has been tested a lot with many different | ||
| 7656 | images. */ | ||
| 7657 | |||
| 7658 | /* Copy pixels from the imagemagick image structure to the x image map. */ | ||
| 7659 | iterator = NewPixelIterator (image_wand); | ||
| 7660 | if (iterator == (PixelIterator *) NULL) | ||
| 7661 | { | ||
| 7662 | image_error ("Imagemagick pixel iterator creation failed", | ||
| 7663 | Qnil, Qnil); | ||
| 7664 | goto imagemagick_error; | ||
| 7665 | } | ||
| 7666 | |||
| 7667 | for (y = 0; y < (long) MagickGetImageHeight (image_wand); y++) | ||
| 7668 | { | ||
| 7669 | pixels = PixelGetNextIteratorRow (iterator, &width); | ||
| 7670 | if (pixels == (PixelWand **) NULL) | ||
| 7671 | break; | ||
| 7672 | for (x = 0; x < (long) width; x++) | ||
| 7673 | { | ||
| 7674 | PixelGetMagickColor (pixels[x], &pixel); | ||
| 7675 | XPutPixel (ximg, x, y, | ||
| 7676 | lookup_rgb_color (f, | ||
| 7677 | pixel.red, | ||
| 7678 | pixel.green, | ||
| 7679 | pixel.blue)); | ||
| 7680 | } | ||
| 7681 | } | ||
| 7682 | DestroyPixelIterator (iterator); | ||
| 7683 | } | ||
| 7684 | |||
| 7685 | if (imagemagick_rendermethod == 1) | ||
| 7686 | { | ||
| 7687 | /* Magicexportimage is normaly faster than pixelpushing. This | ||
| 7688 | method is also well tested. Some aspects of this method are | ||
| 7689 | ad-hoc and needs to be more researched. */ | ||
| 7690 | int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ | ||
| 7691 | char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ | ||
| 7692 | /* Try to create a x pixmap to hold the imagemagick pixmap. */ | ||
| 7693 | if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, | ||
| 7694 | &ximg, &img->pixmap)) | ||
| 7695 | { | ||
| 7696 | image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); | ||
| 7697 | goto imagemagick_error; | ||
| 7698 | } | ||
| 7699 | |||
| 7700 | |||
| 7701 | /* Oddly, the below code doesnt seem to work:*/ | ||
| 7702 | /* switch(ximg->bitmap_unit){ */ | ||
| 7703 | /* case 8: */ | ||
| 7704 | /* pixelwidth=CharPixel; */ | ||
| 7705 | /* break; */ | ||
| 7706 | /* case 16: */ | ||
| 7707 | /* pixelwidth=ShortPixel; */ | ||
| 7708 | /* break; */ | ||
| 7709 | /* case 32: */ | ||
| 7710 | /* pixelwidth=LongPixel; */ | ||
| 7711 | /* break; */ | ||
| 7712 | /* } */ | ||
| 7713 | /* | ||
| 7714 | Here im just guessing the format of the bitmap. | ||
| 7715 | happens to work fine for: | ||
| 7716 | - bw djvu images | ||
| 7717 | on rgb display. | ||
| 7718 | seems about 3 times as fast as pixel pushing(not carefully measured) | ||
| 7719 | */ | ||
| 7720 | pixelwidth = CharPixel;/*??? TODO figure out*/ | ||
| 7721 | #ifdef HAVE_MAGICKEXPORTIMAGEPIXELS | ||
| 7722 | MagickExportImagePixels (image_wand, | ||
| 7723 | 0, 0, | ||
| 7724 | width, height, | ||
| 7725 | exportdepth, | ||
| 7726 | pixelwidth, | ||
| 7727 | /*&(img->pixmap));*/ | ||
| 7728 | ximg->data); | ||
| 7729 | #else | ||
| 7730 | image_error ("You dont have MagickExportImagePixels, upgrade ImageMagick!", | ||
| 7731 | Qnil, Qnil); | ||
| 7732 | #endif | ||
| 7733 | } | ||
| 7734 | |||
| 7735 | |||
| 7736 | #ifdef COLOR_TABLE_SUPPORT | ||
| 7737 | /* Remember colors allocated for this image. */ | ||
| 7738 | img->colors = colors_in_color_table (&img->ncolors); | ||
| 7739 | free_color_table (); | ||
| 7740 | #endif /* COLOR_TABLE_SUPPORT */ | ||
| 7741 | |||
| 7742 | |||
| 7743 | img->width = width; | ||
| 7744 | img->height = height; | ||
| 7745 | |||
| 7746 | /* Put the image into the pixmap, then free the X image and its | ||
| 7747 | buffer. */ | ||
| 7748 | x_put_x_image (f, ximg, img->pixmap, width, height); | ||
| 7749 | x_destroy_x_image (ximg); | ||
| 7750 | |||
| 7751 | |||
| 7752 | /* Final cleanup. image_wand should be the only resource left. */ | ||
| 7753 | DestroyMagickWand (image_wand); | ||
| 7754 | |||
| 7755 | return 1; | ||
| 7756 | |||
| 7757 | imagemagick_error: | ||
| 7758 | /* TODO more cleanup. */ | ||
| 7759 | image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); | ||
| 7760 | return 0; | ||
| 7761 | } | ||
| 7762 | |||
| 7763 | |||
| 7764 | /* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if | ||
| 7765 | successful. this function will go into the imagemagick_type structure, and | ||
| 7766 | the prototype thus needs to be compatible with that structure. */ | ||
| 7767 | |||
| 7768 | static int | ||
| 7769 | imagemagick_load (struct frame *f, | ||
| 7770 | struct image *img) | ||
| 7771 | { | ||
| 7772 | int success_p = 0; | ||
| 7773 | Lisp_Object file_name; | ||
| 7774 | |||
| 7775 | /* If IMG->spec specifies a file name, create a non-file spec from it. */ | ||
| 7776 | file_name = image_spec_value (img->spec, QCfile, NULL); | ||
| 7777 | if (STRINGP (file_name)) | ||
| 7778 | { | ||
| 7779 | Lisp_Object file; | ||
| 7780 | |||
| 7781 | file = x_find_image_file (file_name); | ||
| 7782 | if (!STRINGP (file)) | ||
| 7783 | { | ||
| 7784 | image_error ("Cannot find image file `%s'", file_name, Qnil); | ||
| 7785 | return 0; | ||
| 7786 | } | ||
| 7787 | success_p = imagemagick_load_image (f, img, 0, 0, SDATA (file)); | ||
| 7788 | } | ||
| 7789 | /* Else its not a file, its a lisp object. Load the image from a | ||
| 7790 | lisp object rather than a file. */ | ||
| 7791 | else | ||
| 7792 | { | ||
| 7793 | Lisp_Object data; | ||
| 7794 | |||
| 7795 | data = image_spec_value (img->spec, QCdata, NULL); | ||
| 7796 | if (!STRINGP (data)) | ||
| 7797 | { | ||
| 7798 | image_error ("Invalid image data `%s'", data, Qnil); | ||
| 7799 | return 0; | ||
| 7800 | } | ||
| 7801 | success_p = imagemagick_load_image (f, img, SDATA (data), | ||
| 7802 | SBYTES (data), NULL); | ||
| 7803 | } | ||
| 7804 | |||
| 7805 | return success_p; | ||
| 7806 | } | ||
| 7807 | |||
| 7808 | /* Structure describing the image type `imagemagick'. Its the same | ||
| 7809 | type of structure defined for all image formats, handled by Emacs | ||
| 7810 | image functions. See struct image_type in dispextern.h. */ | ||
| 7811 | |||
| 7812 | static struct image_type imagemagick_type = | ||
| 7813 | { | ||
| 7814 | /* An identifier showing that this is an image structure for the | ||
| 7815 | IMAGEMAGICK format. */ | ||
| 7816 | &Qimagemagick, | ||
| 7817 | /* Handle to a function that can be used to identify a IMAGEMAGICK | ||
| 7818 | file. */ | ||
| 7819 | imagemagick_image_p, | ||
| 7820 | /* Handle to function used to load a IMAGEMAGICK file. */ | ||
| 7821 | imagemagick_load, | ||
| 7822 | /* Handle to function to free resources for IMAGEMAGICK. */ | ||
| 7823 | imagemagick_clear_image, | ||
| 7824 | /* An internal field to link to the next image type in a list of | ||
| 7825 | image types, will be filled in when registering the format. */ | ||
| 7826 | NULL | ||
| 7827 | }; | ||
| 7828 | |||
| 7829 | |||
| 7830 | |||
| 7831 | |||
| 7832 | DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, | ||
| 7833 | doc: /* Return image file types supported by ImageMagick. | ||
| 7834 | Since ImageMagick recognizes a lot of file-types that clash with Emacs, | ||
| 7835 | such as .c, we want to be able to alter the list at the lisp level. */) | ||
| 7836 | (void) | ||
| 7837 | { | ||
| 7838 | Lisp_Object typelist = Qnil; | ||
| 7839 | unsigned long numf; | ||
| 7840 | ExceptionInfo ex; | ||
| 7841 | char **imtypes = GetMagickList ("*", &numf, &ex); | ||
| 7842 | int i; | ||
| 7843 | Lisp_Object Qimagemagicktype; | ||
| 7844 | for (i = 0; i < numf; i++) | ||
| 7845 | { | ||
| 7846 | Qimagemagicktype = intern (imtypes[i]); | ||
| 7847 | typelist = Fcons (Qimagemagicktype, typelist); | ||
| 7848 | } | ||
| 7849 | return typelist; | ||
| 7850 | } | ||
| 7851 | |||
| 7852 | #endif /* defined (HAVE_IMAGEMAGICK) */ | ||
| 7853 | |||
| 7854 | |||
| 7345 | 7855 | ||
| 7346 | /*********************************************************************** | 7856 | /*********************************************************************** |
| 7347 | SVG | 7857 | SVG |
| @@ -7534,14 +8044,11 @@ svg_load (struct frame *f, struct image *img) | |||
| 7534 | Lisp_Object file; | 8044 | Lisp_Object file; |
| 7535 | unsigned char *contents; | 8045 | unsigned char *contents; |
| 7536 | int size; | 8046 | int size; |
| 7537 | struct gcpro gcpro1; | ||
| 7538 | 8047 | ||
| 7539 | file = x_find_image_file (file_name); | 8048 | file = x_find_image_file (file_name); |
| 7540 | GCPRO1 (file); | ||
| 7541 | if (!STRINGP (file)) | 8049 | if (!STRINGP (file)) |
| 7542 | { | 8050 | { |
| 7543 | image_error ("Cannot find image file `%s'", file_name, Qnil); | 8051 | image_error ("Cannot find image file `%s'", file_name, Qnil); |
| 7544 | UNGCPRO; | ||
| 7545 | return 0; | 8052 | return 0; |
| 7546 | } | 8053 | } |
| 7547 | 8054 | ||
| @@ -7550,13 +8057,11 @@ svg_load (struct frame *f, struct image *img) | |||
| 7550 | if (contents == NULL) | 8057 | if (contents == NULL) |
| 7551 | { | 8058 | { |
| 7552 | image_error ("Error loading SVG image `%s'", img->spec, Qnil); | 8059 | image_error ("Error loading SVG image `%s'", img->spec, Qnil); |
| 7553 | UNGCPRO; | ||
| 7554 | return 0; | 8060 | return 0; |
| 7555 | } | 8061 | } |
| 7556 | /* If the file was slurped into memory properly, parse it. */ | 8062 | /* If the file was slurped into memory properly, parse it. */ |
| 7557 | success_p = svg_load_image (f, img, contents, size); | 8063 | success_p = svg_load_image (f, img, contents, size); |
| 7558 | xfree (contents); | 8064 | xfree (contents); |
| 7559 | UNGCPRO; | ||
| 7560 | } | 8065 | } |
| 7561 | /* Else its not a file, its a lisp object. Load the image from a | 8066 | /* Else its not a file, its a lisp object. Load the image from a |
| 7562 | lisp object rather than a file. */ | 8067 | lisp object rather than a file. */ |
| @@ -7565,6 +8070,11 @@ svg_load (struct frame *f, struct image *img) | |||
| 7565 | Lisp_Object data; | 8070 | Lisp_Object data; |
| 7566 | 8071 | ||
| 7567 | data = image_spec_value (img->spec, QCdata, NULL); | 8072 | data = image_spec_value (img->spec, QCdata, NULL); |
| 8073 | if (!STRINGP (data)) | ||
| 8074 | { | ||
| 8075 | image_error ("Invalid image data `%s'", data, Qnil); | ||
| 8076 | return 0; | ||
| 8077 | } | ||
| 7568 | success_p = svg_load_image (f, img, SDATA (data), SBYTES (data)); | 8078 | success_p = svg_load_image (f, img, SDATA (data), SBYTES (data)); |
| 7569 | } | 8079 | } |
| 7570 | 8080 | ||
| @@ -7864,7 +8374,6 @@ gs_load (struct frame *f, struct image *img) | |||
| 7864 | { | 8374 | { |
| 7865 | char buffer[100]; | 8375 | char buffer[100]; |
| 7866 | Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; | 8376 | Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; |
| 7867 | struct gcpro gcpro1, gcpro2; | ||
| 7868 | Lisp_Object frame; | 8377 | Lisp_Object frame; |
| 7869 | double in_width, in_height; | 8378 | double in_width, in_height; |
| 7870 | Lisp_Object pixel_colors = Qnil; | 8379 | Lisp_Object pixel_colors = Qnil; |
| @@ -7874,10 +8383,10 @@ gs_load (struct frame *f, struct image *img) | |||
| 7874 | = 1/72 in, xdpi and ydpi are stored in the frame's X display | 8383 | = 1/72 in, xdpi and ydpi are stored in the frame's X display |
| 7875 | info. */ | 8384 | info. */ |
| 7876 | pt_width = image_spec_value (img->spec, QCpt_width, NULL); | 8385 | pt_width = image_spec_value (img->spec, QCpt_width, NULL); |
| 7877 | in_width = XFASTINT (pt_width) / 72.0; | 8386 | in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0; |
| 7878 | img->width = in_width * FRAME_X_DISPLAY_INFO (f)->resx; | 8387 | img->width = in_width * FRAME_X_DISPLAY_INFO (f)->resx; |
| 7879 | pt_height = image_spec_value (img->spec, QCpt_height, NULL); | 8388 | pt_height = image_spec_value (img->spec, QCpt_height, NULL); |
| 7880 | in_height = XFASTINT (pt_height) / 72.0; | 8389 | in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0; |
| 7881 | img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy; | 8390 | img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy; |
| 7882 | 8391 | ||
| 7883 | if (!check_image_size (f, img->width, img->height)) | 8392 | if (!check_image_size (f, img->width, img->height)) |
| @@ -7906,8 +8415,6 @@ gs_load (struct frame *f, struct image *img) | |||
| 7906 | if successful. We do not record_unwind_protect here because | 8415 | if successful. We do not record_unwind_protect here because |
| 7907 | other places in redisplay like calling window scroll functions | 8416 | other places in redisplay like calling window scroll functions |
| 7908 | don't either. Let the Lisp loader use `unwind-protect' instead. */ | 8417 | don't either. Let the Lisp loader use `unwind-protect' instead. */ |
| 7909 | GCPRO2 (window_and_pixmap_id, pixel_colors); | ||
| 7910 | |||
| 7911 | sprintf (buffer, "%lu %lu", | 8418 | sprintf (buffer, "%lu %lu", |
| 7912 | (unsigned long) FRAME_X_WINDOW (f), | 8419 | (unsigned long) FRAME_X_WINDOW (f), |
| 7913 | (unsigned long) img->pixmap); | 8420 | (unsigned long) img->pixmap); |
| @@ -7928,7 +8435,6 @@ gs_load (struct frame *f, struct image *img) | |||
| 7928 | make_number (img->height), | 8435 | make_number (img->height), |
| 7929 | window_and_pixmap_id, | 8436 | window_and_pixmap_id, |
| 7930 | pixel_colors); | 8437 | pixel_colors); |
| 7931 | UNGCPRO; | ||
| 7932 | return PROCESSP (img->data.lisp_val); | 8438 | return PROCESSP (img->data.lisp_val); |
| 7933 | } | 8439 | } |
| 7934 | 8440 | ||
| @@ -8117,6 +8623,16 @@ of `image-library-alist', which see). */) | |||
| 8117 | return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries); | 8623 | return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries); |
| 8118 | #endif | 8624 | #endif |
| 8119 | 8625 | ||
| 8626 | #if defined (HAVE_IMAGEMAGICK) | ||
| 8627 | if (EQ (type, Qimagemagick)) | ||
| 8628 | { | ||
| 8629 | /* MagickWandGenesis() initalizes the imagemagick library. */ | ||
| 8630 | MagickWandGenesis (); | ||
| 8631 | return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, | ||
| 8632 | libraries); | ||
| 8633 | } | ||
| 8634 | #endif | ||
| 8635 | |||
| 8120 | #ifdef HAVE_GHOSTSCRIPT | 8636 | #ifdef HAVE_GHOSTSCRIPT |
| 8121 | if (EQ (type, Qpostscript)) | 8637 | if (EQ (type, Qpostscript)) |
| 8122 | return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); | 8638 | return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); |
| @@ -8202,6 +8718,12 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8202 | staticpro (&QCheuristic_mask); | 8718 | staticpro (&QCheuristic_mask); |
| 8203 | QCindex = intern_c_string (":index"); | 8719 | QCindex = intern_c_string (":index"); |
| 8204 | staticpro (&QCindex); | 8720 | staticpro (&QCindex); |
| 8721 | QCgeometry = intern (":geometry"); | ||
| 8722 | staticpro (&QCgeometry); | ||
| 8723 | QCcrop = intern (":crop"); | ||
| 8724 | staticpro (&QCcrop); | ||
| 8725 | QCrotation = intern (":rotation"); | ||
| 8726 | staticpro (&QCrotation); | ||
| 8205 | QCmatrix = intern_c_string (":matrix"); | 8727 | QCmatrix = intern_c_string (":matrix"); |
| 8206 | staticpro (&QCmatrix); | 8728 | staticpro (&QCmatrix); |
| 8207 | QCcolor_adjustment = intern_c_string (":color-adjustment"); | 8729 | QCcolor_adjustment = intern_c_string (":color-adjustment"); |
| @@ -8262,6 +8784,12 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8262 | ADD_IMAGE_TYPE (Qpng); | 8784 | ADD_IMAGE_TYPE (Qpng); |
| 8263 | #endif | 8785 | #endif |
| 8264 | 8786 | ||
| 8787 | #if defined (HAVE_IMAGEMAGICK) | ||
| 8788 | Qimagemagick = intern ("imagemagick"); | ||
| 8789 | staticpro (&Qimagemagick); | ||
| 8790 | ADD_IMAGE_TYPE (Qimagemagick); | ||
| 8791 | #endif | ||
| 8792 | |||
| 8265 | #if defined (HAVE_RSVG) | 8793 | #if defined (HAVE_RSVG) |
| 8266 | Qsvg = intern_c_string ("svg"); | 8794 | Qsvg = intern_c_string ("svg"); |
| 8267 | staticpro (&Qsvg); | 8795 | staticpro (&Qsvg); |
| @@ -8278,6 +8806,9 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8278 | #endif /* HAVE_RSVG */ | 8806 | #endif /* HAVE_RSVG */ |
| 8279 | 8807 | ||
| 8280 | defsubr (&Sinit_image_library); | 8808 | defsubr (&Sinit_image_library); |
| 8809 | #ifdef HAVE_IMAGEMAGICK | ||
| 8810 | defsubr (&Simagemagick_types); | ||
| 8811 | #endif | ||
| 8281 | defsubr (&Sclear_image_cache); | 8812 | defsubr (&Sclear_image_cache); |
| 8282 | defsubr (&Simage_flush); | 8813 | defsubr (&Simage_flush); |
| 8283 | defsubr (&Simage_size); | 8814 | defsubr (&Simage_size); |
| @@ -8308,6 +8839,11 @@ The value can also be nil, meaning the cache is never cleared. | |||
| 8308 | 8839 | ||
| 8309 | The function `clear-image-cache' disregards this variable. */); | 8840 | The function `clear-image-cache' disregards this variable. */); |
| 8310 | Vimage_cache_eviction_delay = make_number (300); | 8841 | Vimage_cache_eviction_delay = make_number (300); |
| 8842 | #ifdef HAVE_IMAGEMAGICK | ||
| 8843 | DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type, | ||
| 8844 | doc: /* Choose between ImageMagick render methods. */); | ||
| 8845 | #endif | ||
| 8846 | |||
| 8311 | } | 8847 | } |
| 8312 | 8848 | ||
| 8313 | void | 8849 | void |
diff --git a/src/insdel.c b/src/insdel.c index 00025808e37..2ccc0b8eaac 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -74,7 +74,7 @@ Lisp_Object combine_after_change_buffer; | |||
| 74 | 74 | ||
| 75 | Lisp_Object Qinhibit_modification_hooks; | 75 | Lisp_Object Qinhibit_modification_hooks; |
| 76 | 76 | ||
| 77 | extern Lisp_Object Vselect_active_regions, Vsaved_region_selection; | 77 | extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly; |
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | /* Check all markers in the current buffer, looking for something invalid. */ | 80 | /* Check all markers in the current buffer, looking for something invalid. */ |
| @@ -2050,10 +2050,12 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, | |||
| 2050 | #endif /* not CLASH_DETECTION */ | 2050 | #endif /* not CLASH_DETECTION */ |
| 2051 | 2051 | ||
| 2052 | /* If `select-active-regions' is non-nil, save the region text. */ | 2052 | /* If `select-active-regions' is non-nil, save the region text. */ |
| 2053 | if (!NILP (Vselect_active_regions) | 2053 | if (!NILP (current_buffer->mark_active) |
| 2054 | && !NILP (current_buffer->mark_active) | 2054 | && NILP (Vsaved_region_selection) |
| 2055 | && !NILP (Vtransient_mark_mode) | 2055 | && (EQ (Vselect_active_regions, Qonly) |
| 2056 | && NILP (Vsaved_region_selection)) | 2056 | ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) |
| 2057 | : (!NILP (Vselect_active_regions) | ||
| 2058 | && !NILP (Vtransient_mark_mode)))) | ||
| 2057 | { | 2059 | { |
| 2058 | int b = XINT (Fmarker_position (current_buffer->mark)); | 2060 | int b = XINT (Fmarker_position (current_buffer->mark)); |
| 2059 | int e = XINT (make_number (PT)); | 2061 | int e = XINT (make_number (PT)); |
diff --git a/src/keyboard.c b/src/keyboard.c index aaa9306eded..95fc275ffe8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -368,7 +368,7 @@ Lisp_Object Vselect_active_regions; | |||
| 368 | Used by the `select-active-regions' feature. */ | 368 | Used by the `select-active-regions' feature. */ |
| 369 | Lisp_Object Vsaved_region_selection; | 369 | Lisp_Object Vsaved_region_selection; |
| 370 | 370 | ||
| 371 | Lisp_Object Qx_set_selection, QPRIMARY, Qlazy; | 371 | Lisp_Object Qx_set_selection, QPRIMARY, Qhandle_switch_frame; |
| 372 | 372 | ||
| 373 | Lisp_Object Qself_insert_command; | 373 | Lisp_Object Qself_insert_command; |
| 374 | Lisp_Object Qforward_char; | 374 | Lisp_Object Qforward_char; |
| @@ -1493,6 +1493,11 @@ cancel_hourglass_unwind (Lisp_Object arg) | |||
| 1493 | } | 1493 | } |
| 1494 | #endif | 1494 | #endif |
| 1495 | 1495 | ||
| 1496 | /* FIXME: This is wrong rather than test window-system, we should call | ||
| 1497 | a new set-selection, which will then dispatch to x-set-selection, or | ||
| 1498 | tty-set-selection, or w32-set-selection, ... */ | ||
| 1499 | EXFUN (Fwindow_system, 1); | ||
| 1500 | |||
| 1496 | Lisp_Object | 1501 | Lisp_Object |
| 1497 | command_loop_1 (void) | 1502 | command_loop_1 (void) |
| 1498 | { | 1503 | { |
| @@ -1790,27 +1795,36 @@ command_loop_1 (void) | |||
| 1790 | Vtransient_mark_mode = Qnil; | 1795 | Vtransient_mark_mode = Qnil; |
| 1791 | else if (EQ (Vtransient_mark_mode, Qonly)) | 1796 | else if (EQ (Vtransient_mark_mode, Qonly)) |
| 1792 | Vtransient_mark_mode = Qidentity; | 1797 | Vtransient_mark_mode = Qidentity; |
| 1793 | else if (EQ (Vselect_active_regions, Qlazy) | ||
| 1794 | ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) | ||
| 1795 | : (!NILP (Vselect_active_regions) | ||
| 1796 | && !NILP (Vtransient_mark_mode))) | ||
| 1797 | { | ||
| 1798 | /* Set window selection. If `select-active-regions' is | ||
| 1799 | `lazy', only do it for temporarily active regions. */ | ||
| 1800 | int beg = XINT (Fmarker_position (current_buffer->mark)); | ||
| 1801 | int end = XINT (make_number (PT)); | ||
| 1802 | if (beg < end) | ||
| 1803 | call2 (Qx_set_selection, QPRIMARY, | ||
| 1804 | make_buffer_string (beg, end, 0)); | ||
| 1805 | else if (beg > end) | ||
| 1806 | call2 (Qx_set_selection, QPRIMARY, | ||
| 1807 | make_buffer_string (end, beg, 0)); | ||
| 1808 | } | ||
| 1809 | 1798 | ||
| 1810 | if (!NILP (Vdeactivate_mark)) | 1799 | if (!NILP (Vdeactivate_mark)) |
| 1800 | /* If `select-active-regions' is non-nil, this call to | ||
| 1801 | `deactivate-mark' also sets the PRIMARY selection. */ | ||
| 1811 | call0 (Qdeactivate_mark); | 1802 | call0 (Qdeactivate_mark); |
| 1812 | else if (current_buffer != prev_buffer || MODIFF != prev_modiff) | 1803 | else |
| 1813 | call1 (Vrun_hooks, intern ("activate-mark-hook")); | 1804 | { |
| 1805 | /* Even if not deactivating the mark, set PRIMARY if | ||
| 1806 | `select-active-regions' is non-nil. */ | ||
| 1807 | if (!NILP (Fwindow_system (Qnil)) | ||
| 1808 | && (EQ (Vselect_active_regions, Qonly) | ||
| 1809 | ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) | ||
| 1810 | : (!NILP (Vselect_active_regions) | ||
| 1811 | && !NILP (Vtransient_mark_mode))) | ||
| 1812 | && !EQ (Vthis_command, Qhandle_switch_frame)) | ||
| 1813 | { | ||
| 1814 | int beg = XINT (Fmarker_position (current_buffer->mark)); | ||
| 1815 | int end = XINT (make_number (PT)); | ||
| 1816 | if (beg < end) | ||
| 1817 | call2 (Qx_set_selection, QPRIMARY, | ||
| 1818 | make_buffer_string (beg, end, 0)); | ||
| 1819 | else if (beg > end) | ||
| 1820 | call2 (Qx_set_selection, QPRIMARY, | ||
| 1821 | make_buffer_string (end, beg, 0)); | ||
| 1822 | /* Don't set empty selections. */ | ||
| 1823 | } | ||
| 1824 | |||
| 1825 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) | ||
| 1826 | call1 (Vrun_hooks, intern ("activate-mark-hook")); | ||
| 1827 | } | ||
| 1814 | 1828 | ||
| 1815 | Vsaved_region_selection = Qnil; | 1829 | Vsaved_region_selection = Qnil; |
| 1816 | } | 1830 | } |
| @@ -4941,9 +4955,9 @@ char const *lispy_function_keys[] = | |||
| 4941 | 0, /* VK_OEM_102 0xE2 */ | 4955 | 0, /* VK_OEM_102 0xE2 */ |
| 4942 | "ico-help", /* VK_ICO_HELP 0xE3 */ | 4956 | "ico-help", /* VK_ICO_HELP 0xE3 */ |
| 4943 | "ico-00", /* VK_ICO_00 0xE4 */ | 4957 | "ico-00", /* VK_ICO_00 0xE4 */ |
| 4944 | 0, /* VK_PROCESSKEY 0xE5 */ | 4958 | 0, /* VK_PROCESSKEY 0xE5 - used by IME */ |
| 4945 | "ico-clear", /* VK_ICO_CLEAR 0xE6 */ | 4959 | "ico-clear", /* VK_ICO_CLEAR 0xE6 */ |
| 4946 | "packet", /* VK_PACKET 0xE7 */ | 4960 | 0, /* VK_PACKET 0xE7 - used to pass unicode chars */ |
| 4947 | 0, /* 0xE8 */ | 4961 | 0, /* 0xE8 */ |
| 4948 | "reset", /* VK_OEM_RESET 0xE9 */ | 4962 | "reset", /* VK_OEM_RESET 0xE9 */ |
| 4949 | "jump", /* VK_OEM_JUMP 0xEA */ | 4963 | "jump", /* VK_OEM_JUMP 0xEA */ |
| @@ -8285,12 +8299,15 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8285 | return 0; | 8299 | return 0; |
| 8286 | } | 8300 | } |
| 8287 | else if (EQ (key, QChelp)) | 8301 | else if (EQ (key, QChelp)) |
| 8288 | /* `:help HELP-STRING'. */ | 8302 | /* `:help HELP-STRING'. */ |
| 8289 | PROP (TOOL_BAR_ITEM_HELP) = value; | 8303 | PROP (TOOL_BAR_ITEM_HELP) = value; |
| 8290 | else if (EQ (key, QClabel)) | 8304 | else if (EQ (key, QClabel)) |
| 8291 | { | 8305 | { |
| 8306 | const char *bad_label = "!!?GARBLED ITEM?!!"; | ||
| 8292 | /* `:label LABEL-STRING'. */ | 8307 | /* `:label LABEL-STRING'. */ |
| 8293 | PROP (TOOL_BAR_ITEM_LABEL) = value; | 8308 | PROP (TOOL_BAR_ITEM_HELP) = STRINGP (value) |
| 8309 | ? value | ||
| 8310 | : make_string (bad_label, strlen (bad_label)); | ||
| 8294 | have_label = 1; | 8311 | have_label = 1; |
| 8295 | } | 8312 | } |
| 8296 | else if (EQ (key, QCfilter)) | 8313 | else if (EQ (key, QCfilter)) |
| @@ -8328,39 +8345,41 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8328 | Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); | 8345 | Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); |
| 8329 | const char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : ""; | 8346 | const char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : ""; |
| 8330 | const char *caption = STRINGP (capt) ? (char *) SDATA (capt) : ""; | 8347 | const char *caption = STRINGP (capt) ? (char *) SDATA (capt) : ""; |
| 8331 | char buf[64]; | 8348 | EMACS_INT max_lbl = 2 * tool_bar_max_label_size; |
| 8332 | EMACS_INT max_lbl = 2*tool_bar_max_label_size; | 8349 | char *buf = (char *) xmalloc (max_lbl + 1); |
| 8333 | Lisp_Object new_lbl; | 8350 | Lisp_Object new_lbl; |
| 8351 | size_t caption_len = strlen (caption); | ||
| 8334 | 8352 | ||
| 8335 | if (strlen (caption) < max_lbl && caption[0] != '\0') | 8353 | if (caption_len <= max_lbl && caption[0] != '\0') |
| 8336 | { | 8354 | { |
| 8337 | strcpy (buf, caption); | 8355 | strcpy (buf, caption); |
| 8338 | while (buf[0] != '\0' && buf[strlen (buf) -1] == '.') | 8356 | while (caption_len > 0 && buf[caption_len - 1] == '.') |
| 8339 | buf[strlen (buf)-1] = '\0'; | 8357 | caption_len--; |
| 8340 | if (strlen (buf) <= max_lbl) | 8358 | buf[caption_len] = '\0'; |
| 8341 | caption = buf; | 8359 | label = caption = buf; |
| 8342 | } | 8360 | } |
| 8343 | 8361 | ||
| 8344 | if (strlen (caption) <= max_lbl) | ||
| 8345 | label = caption; | ||
| 8346 | |||
| 8347 | if (strlen (label) <= max_lbl && label[0] != '\0') | 8362 | if (strlen (label) <= max_lbl && label[0] != '\0') |
| 8348 | { | 8363 | { |
| 8349 | int i; | 8364 | int i; |
| 8350 | if (label != buf) strcpy (buf, label); | 8365 | if (label != buf) |
| 8366 | strcpy (buf, label); | ||
| 8351 | 8367 | ||
| 8352 | for (i = 0; i < strlen (buf); ++i) | 8368 | for (i = 0; buf[i] != '\0'; ++i) |
| 8353 | { | 8369 | if (buf[i] == '-') |
| 8354 | if (buf[i] == '-') buf[i] = ' '; | 8370 | buf[i] = ' '; |
| 8355 | } | ||
| 8356 | label = buf; | 8371 | label = buf; |
| 8357 | 8372 | ||
| 8358 | } | 8373 | } |
| 8359 | else label = ""; | 8374 | else |
| 8375 | label = ""; | ||
| 8360 | 8376 | ||
| 8361 | new_lbl = Fupcase_initials (make_string (label, strlen (label))); | 8377 | new_lbl = Fupcase_initials (make_string (label, strlen (label))); |
| 8362 | if (SCHARS (new_lbl) <= tool_bar_max_label_size) | 8378 | if (SCHARS (new_lbl) <= tool_bar_max_label_size) |
| 8363 | PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; | 8379 | PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; |
| 8380 | else | ||
| 8381 | PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0); | ||
| 8382 | free (buf); | ||
| 8364 | } | 8383 | } |
| 8365 | 8384 | ||
| 8366 | /* If got a filter apply it on binding. */ | 8385 | /* If got a filter apply it on binding. */ |
| @@ -10333,13 +10352,12 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 10333 | (Lisp_Object prefixarg) | 10352 | (Lisp_Object prefixarg) |
| 10334 | { | 10353 | { |
| 10335 | Lisp_Object function; | 10354 | Lisp_Object function; |
| 10336 | char buf[40]; | ||
| 10337 | int saved_last_point_position; | 10355 | int saved_last_point_position; |
| 10338 | Lisp_Object saved_keys, saved_last_point_position_buffer; | 10356 | Lisp_Object saved_keys, saved_last_point_position_buffer; |
| 10339 | Lisp_Object bindings, value; | 10357 | Lisp_Object bindings, value; |
| 10340 | struct gcpro gcpro1, gcpro2, gcpro3; | 10358 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 10341 | #ifdef HAVE_WINDOW_SYSTEM | 10359 | #ifdef HAVE_WINDOW_SYSTEM |
| 10342 | /* The call to Fcompleting_read wil start and cancel the hourglass, | 10360 | /* The call to Fcompleting_read will start and cancel the hourglass, |
| 10343 | but if the hourglass was already scheduled, this means that no | 10361 | but if the hourglass was already scheduled, this means that no |
| 10344 | hourglass will be shown for the actual M-x command itself. | 10362 | hourglass will be shown for the actual M-x command itself. |
| 10345 | So we restart it if it is already scheduled. Note that checking | 10363 | So we restart it if it is already scheduled. Note that checking |
| @@ -10352,31 +10370,9 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 10352 | XVECTOR (this_command_keys)->contents); | 10370 | XVECTOR (this_command_keys)->contents); |
| 10353 | saved_last_point_position_buffer = last_point_position_buffer; | 10371 | saved_last_point_position_buffer = last_point_position_buffer; |
| 10354 | saved_last_point_position = last_point_position; | 10372 | saved_last_point_position = last_point_position; |
| 10355 | buf[0] = 0; | ||
| 10356 | GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer); | 10373 | GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer); |
| 10357 | 10374 | ||
| 10358 | if (EQ (prefixarg, Qminus)) | 10375 | function = call0 (intern ("read-extended-command")); |
| 10359 | strcpy (buf, "- "); | ||
| 10360 | else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4) | ||
| 10361 | strcpy (buf, "C-u "); | ||
| 10362 | else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg))) | ||
| 10363 | sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg))); | ||
| 10364 | else if (INTEGERP (prefixarg)) | ||
| 10365 | sprintf (buf, "%ld ", (long) XINT (prefixarg)); | ||
| 10366 | |||
| 10367 | /* This isn't strictly correct if execute-extended-command | ||
| 10368 | is bound to anything else. Perhaps it should use | ||
| 10369 | this_command_keys? */ | ||
| 10370 | strcat (buf, "M-x "); | ||
| 10371 | |||
| 10372 | /* Prompt with buf, and then read a string, completing from and | ||
| 10373 | restricting to the set of all defined commands. Don't provide | ||
| 10374 | any initial input. Save the command read on the extended-command | ||
| 10375 | history list. */ | ||
| 10376 | function = Fcompleting_read (build_string (buf), | ||
| 10377 | Vobarray, Qcommandp, | ||
| 10378 | Qt, Qnil, Qextended_command_history, Qnil, | ||
| 10379 | Qnil); | ||
| 10380 | 10376 | ||
| 10381 | #ifdef HAVE_WINDOW_SYSTEM | 10377 | #ifdef HAVE_WINDOW_SYSTEM |
| 10382 | if (hstarted) start_hourglass (); | 10378 | if (hstarted) start_hourglass (); |
| @@ -11494,11 +11490,11 @@ init_keyboard (void) | |||
| 11494 | Emacs on SIGINT when there are no termcap frames on the | 11490 | Emacs on SIGINT when there are no termcap frames on the |
| 11495 | controlling terminal. */ | 11491 | controlling terminal. */ |
| 11496 | signal (SIGINT, interrupt_signal); | 11492 | signal (SIGINT, interrupt_signal); |
| 11497 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 11493 | #ifndef DOS_NT |
| 11498 | /* For systems with SysV TERMIO, C-g is set up for both SIGINT and | 11494 | /* For systems with SysV TERMIO, C-g is set up for both SIGINT and |
| 11499 | SIGQUIT and we can't tell which one it will give us. */ | 11495 | SIGQUIT and we can't tell which one it will give us. */ |
| 11500 | signal (SIGQUIT, interrupt_signal); | 11496 | signal (SIGQUIT, interrupt_signal); |
| 11501 | #endif /* HAVE_TERMIO */ | 11497 | #endif /* not DOS_NT */ |
| 11502 | } | 11498 | } |
| 11503 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ | 11499 | /* Note SIGIO has been undef'd if FIONREAD is missing. */ |
| 11504 | #ifdef SIGIO | 11500 | #ifdef SIGIO |
| @@ -11713,8 +11709,8 @@ syms_of_keyboard (void) | |||
| 11713 | staticpro (&Qx_set_selection); | 11709 | staticpro (&Qx_set_selection); |
| 11714 | QPRIMARY = intern_c_string ("PRIMARY"); | 11710 | QPRIMARY = intern_c_string ("PRIMARY"); |
| 11715 | staticpro (&QPRIMARY); | 11711 | staticpro (&QPRIMARY); |
| 11716 | Qlazy = intern_c_string ("lazy"); | 11712 | Qhandle_switch_frame = intern_c_string ("handle-switch-frame"); |
| 11717 | staticpro (&Qlazy); | 11713 | staticpro (&Qhandle_switch_frame); |
| 11718 | 11714 | ||
| 11719 | Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char"); | 11715 | Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char"); |
| 11720 | staticpro (&Qinput_method_exit_on_first_char); | 11716 | staticpro (&Qinput_method_exit_on_first_char); |
| @@ -12326,16 +12322,11 @@ and tool-bar buttons. */); | |||
| 12326 | DEFVAR_LISP ("select-active-regions", | 12322 | DEFVAR_LISP ("select-active-regions", |
| 12327 | &Vselect_active_regions, | 12323 | &Vselect_active_regions, |
| 12328 | doc: /* If non-nil, an active region automatically becomes the window selection. | 12324 | doc: /* If non-nil, an active region automatically becomes the window selection. |
| 12329 | This takes effect only when Transient Mark mode is enabled. | 12325 | If the value is `only', only temporarily active regions (usually made |
| 12330 | 12326 | by mouse-dragging or shift-selection) set the window selection. | |
| 12331 | If the value is `lazy', Emacs only sets the window selection during | ||
| 12332 | `deactivate-mark'; unless the region is temporarily active | ||
| 12333 | (e.g. mouse-drags or shift-selection), in which case it sets the | ||
| 12334 | window selection after each command. | ||
| 12335 | 12327 | ||
| 12336 | For other non-nil value, Emacs sets the window selection after every | 12328 | This takes effect only when Transient Mark mode is enabled. */); |
| 12337 | command. */); | 12329 | Vselect_active_regions = Qt; |
| 12338 | Vselect_active_regions = Qlazy; | ||
| 12339 | 12330 | ||
| 12340 | DEFVAR_LISP ("saved-region-selection", | 12331 | DEFVAR_LISP ("saved-region-selection", |
| 12341 | &Vsaved_region_selection, | 12332 | &Vsaved_region_selection, |
diff --git a/src/keyboard.h b/src/keyboard.h index 693137b08f4..a3bb46f4454 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -318,10 +318,7 @@ extern Lisp_Object unuse_menu_items (Lisp_Object dummy); | |||
| 318 | #define ENCODE_MENU_STRING(str) (str) | 318 | #define ENCODE_MENU_STRING(str) (str) |
| 319 | #endif | 319 | #endif |
| 320 | 320 | ||
| 321 | #if defined (HAVE_NS) || defined (HAVE_NTGUI) | 321 | #if defined (HAVE_NS) || defined (HAVE_NTGUI) || defined (USE_GTK) |
| 322 | |||
| 323 | typedef void * XtPointer; | ||
| 324 | typedef unsigned char Boolean; | ||
| 325 | 322 | ||
| 326 | /* Definitions copied from lwlib.h */ | 323 | /* Definitions copied from lwlib.h */ |
| 327 | 324 | ||
| @@ -338,32 +335,35 @@ typedef struct _widget_value | |||
| 338 | { | 335 | { |
| 339 | /* name of widget */ | 336 | /* name of widget */ |
| 340 | Lisp_Object lname; | 337 | Lisp_Object lname; |
| 341 | char* name; | 338 | const char* name; |
| 342 | /* value (meaning depend on widget type) */ | 339 | /* value (meaning depend on widget type) */ |
| 343 | char* value; | 340 | const char* value; |
| 344 | /* keyboard equivalent. no implications for XtTranslations */ | 341 | /* keyboard equivalent. no implications for XtTranslations */ |
| 345 | Lisp_Object lkey; | 342 | Lisp_Object lkey; |
| 346 | char* key; | 343 | const char* key; |
| 347 | /* Help string or nil if none. | 344 | /* Help string or nil if none. |
| 348 | GC finds this string through the frame's menu_bar_vector | 345 | GC finds this string through the frame's menu_bar_vector |
| 349 | or through menu_items. */ | 346 | or through menu_items. */ |
| 350 | Lisp_Object help; | 347 | Lisp_Object help; |
| 351 | /* true if enabled */ | 348 | /* true if enabled */ |
| 352 | Boolean enabled; | 349 | unsigned char enabled; |
| 353 | /* true if selected */ | 350 | /* true if selected */ |
| 354 | Boolean selected; | 351 | unsigned char selected; |
| 355 | /* The type of a button. */ | 352 | /* The type of a button. */ |
| 356 | enum button_type button_type; | 353 | enum button_type button_type; |
| 357 | #if defined (HAVE_NTGUI) | 354 | #if defined (HAVE_NTGUI) |
| 358 | /* true if menu title */ | 355 | /* true if menu title */ |
| 359 | Boolean title; | 356 | unsigned char title; |
| 360 | #endif | 357 | #endif |
| 361 | /* Contents of the sub-widgets, also selected slot for checkbox */ | 358 | /* Contents of the sub-widgets, also selected slot for checkbox */ |
| 362 | struct _widget_value* contents; | 359 | struct _widget_value* contents; |
| 363 | /* data passed to callback */ | 360 | /* data passed to callback */ |
| 364 | XtPointer call_data; | 361 | void *call_data; |
| 365 | /* next one in the list */ | 362 | /* next one in the list */ |
| 366 | struct _widget_value* next; | 363 | struct _widget_value* next; |
| 364 | #ifdef USE_GTK | ||
| 365 | struct _widget_value *free_list; | ||
| 366 | #endif | ||
| 367 | } widget_value; | 367 | } widget_value; |
| 368 | 368 | ||
| 369 | #endif /* HAVE_NS || HAVE_NTGUI */ | 369 | #endif /* HAVE_NS || HAVE_NTGUI */ |
| @@ -440,6 +440,9 @@ extern int ignore_mouse_drag_p; | |||
| 440 | 440 | ||
| 441 | extern Lisp_Object Vdouble_click_time; | 441 | extern Lisp_Object Vdouble_click_time; |
| 442 | 442 | ||
| 443 | /* The primary selection. */ | ||
| 444 | extern Lisp_Object QPRIMARY; | ||
| 445 | |||
| 443 | /* Forward declaration for prototypes. */ | 446 | /* Forward declaration for prototypes. */ |
| 444 | struct input_event; | 447 | struct input_event; |
| 445 | 448 | ||
diff --git a/src/lisp.h b/src/lisp.h index 94851d157d1..d44c05c661f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2542,7 +2542,6 @@ EXFUN (Ffillarray, 2); | |||
| 2542 | EXFUN (Fnconc, MANY); | 2542 | EXFUN (Fnconc, MANY); |
| 2543 | EXFUN (Fmapcar, 2); | 2543 | EXFUN (Fmapcar, 2); |
| 2544 | EXFUN (Fmapconcat, 3); | 2544 | EXFUN (Fmapconcat, 3); |
| 2545 | EXFUN (Fy_or_n_p, 1); | ||
| 2546 | extern Lisp_Object do_yes_or_no_p (Lisp_Object); | 2545 | extern Lisp_Object do_yes_or_no_p (Lisp_Object); |
| 2547 | EXFUN (Frequire, 3); | 2546 | EXFUN (Frequire, 3); |
| 2548 | EXFUN (Fprovide, 2); | 2547 | EXFUN (Fprovide, 2); |
| @@ -3607,6 +3606,11 @@ extern char *x_get_keysym_name (int); | |||
| 3607 | EXFUN (Fmsdos_downcase_filename, 1); | 3606 | EXFUN (Fmsdos_downcase_filename, 1); |
| 3608 | #endif | 3607 | #endif |
| 3609 | 3608 | ||
| 3609 | #ifdef HAVE_LIBXML2 | ||
| 3610 | /* Defined in xml.c */ | ||
| 3611 | extern void syms_of_xml (void); | ||
| 3612 | #endif | ||
| 3613 | |||
| 3610 | #ifdef HAVE_MENUS | 3614 | #ifdef HAVE_MENUS |
| 3611 | /* Defined in (x|w32)fns.c, nsfns.m... */ | 3615 | /* Defined in (x|w32)fns.c, nsfns.m... */ |
| 3612 | extern int have_menus_p (void); | 3616 | extern int have_menus_p (void); |
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index fc86ae6cb0c..8d99d6cedfe 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -1357,6 +1357,7 @@ $(BLD)/sysdep.$(O) : \ | |||
| 1357 | $(SRC)/frame.h \ | 1357 | $(SRC)/frame.h \ |
| 1358 | $(SRC)/keyboard.h \ | 1358 | $(SRC)/keyboard.h \ |
| 1359 | $(SRC)/process.h \ | 1359 | $(SRC)/process.h \ |
| 1360 | $(SRC)/sysselect.h \ | ||
| 1360 | $(SRC)/syssignal.h \ | 1361 | $(SRC)/syssignal.h \ |
| 1361 | $(SRC)/systime.h \ | 1362 | $(SRC)/systime.h \ |
| 1362 | $(SRC)/systty.h \ | 1363 | $(SRC)/systty.h \ |
diff --git a/src/marker.c b/src/marker.c index 911d2e57706..b5ea80562df 100644 --- a/src/marker.c +++ b/src/marker.c | |||
| @@ -806,16 +806,18 @@ marker_byte_position (Lisp_Object marker) | |||
| 806 | return i; | 806 | return i; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 1, 2, 0, | 809 | DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 0, 2, 0, |
| 810 | doc: /* Return a new marker pointing at the same place as MARKER. | 810 | doc: /* Return a new marker pointing at the same place as MARKER. |
| 811 | If argument is a number, makes a new marker pointing | 811 | If argument is a number, makes a new marker pointing |
| 812 | at that position in the current buffer. | 812 | at that position in the current buffer. |
| 813 | If MARKER is not specified, the new marker does not point anywhere. | ||
| 813 | The optional argument TYPE specifies the insertion type of the new marker; | 814 | The optional argument TYPE specifies the insertion type of the new marker; |
| 814 | see `marker-insertion-type'. */) | 815 | see `marker-insertion-type'. */) |
| 815 | (register Lisp_Object marker, Lisp_Object type) | 816 | (register Lisp_Object marker, Lisp_Object type) |
| 816 | { | 817 | { |
| 817 | register Lisp_Object new; | 818 | register Lisp_Object new; |
| 818 | 819 | ||
| 820 | if (!NILP (marker)) | ||
| 819 | CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker); | 821 | CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker); |
| 820 | 822 | ||
| 821 | new = Fmake_marker (); | 823 | new = Fmake_marker (); |
diff --git a/src/menu.c b/src/menu.c index ab20a47fba6..05a296e45fc 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1065,7 +1065,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1065 | Lisp_Object keymap, tem; | 1065 | Lisp_Object keymap, tem; |
| 1066 | int xpos = 0, ypos = 0; | 1066 | int xpos = 0, ypos = 0; |
| 1067 | Lisp_Object title; | 1067 | Lisp_Object title; |
| 1068 | char *error_name = NULL; | 1068 | const char *error_name = NULL; |
| 1069 | Lisp_Object selection = Qnil; | 1069 | Lisp_Object selection = Qnil; |
| 1070 | FRAME_PTR f = NULL; | 1070 | FRAME_PTR f = NULL; |
| 1071 | Lisp_Object x, y, window; | 1071 | Lisp_Object x, y, window; |
diff --git a/src/menu.h b/src/menu.h index c8691169ccb..5e62327da9f 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -46,11 +46,11 @@ extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y); | |||
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, | 48 | extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, |
| 49 | Lisp_Object, char **); | 49 | Lisp_Object, const char **); |
| 50 | extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, | 50 | extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, |
| 51 | Lisp_Object, char **); | 51 | Lisp_Object, const char **); |
| 52 | extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, | 52 | extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, |
| 53 | Lisp_Object, char **, EMACS_UINT); | 53 | Lisp_Object, const char **, EMACS_UINT); |
| 54 | #endif /* MENU_H */ | 54 | #endif /* MENU_H */ |
| 55 | 55 | ||
| 56 | /* arch-tag: c32b2778-724d-4e85-81d7-45f98530a988 | 56 | /* arch-tag: c32b2778-724d-4e85-81d7-45f98530a988 |
diff --git a/src/msdos.c b/src/msdos.c index ad529d00dea..086cad2ff84 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -68,8 +68,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | #include <pc.h> | 68 | #include <pc.h> |
| 69 | #include <ctype.h> | 69 | #include <ctype.h> |
| 70 | /* #include <process.h> */ | 70 | /* #include <process.h> */ |
| 71 | /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ | 71 | /* Damn that local process.h! Instead we can define P_WAIT and |
| 72 | spawnve ourselves. */ | ||
| 72 | #define P_WAIT 1 | 73 | #define P_WAIT 1 |
| 74 | extern int spawnve (int, const char *, char *const [], char *const []); | ||
| 73 | 75 | ||
| 74 | #ifndef _USE_LFN | 76 | #ifndef _USE_LFN |
| 75 | #define _USE_LFN 0 | 77 | #define _USE_LFN 0 |
| @@ -827,7 +829,7 @@ IT_set_face (int face) | |||
| 827 | bg = tem2; | 829 | bg = tem2; |
| 828 | } | 830 | } |
| 829 | if (tty->termscript) | 831 | if (tty->termscript) |
| 830 | fprintf (tty->termscript, "<FACE %d: %d/%d[FG:%d/BG:%d]>", face, | 832 | fprintf (tty->termscript, "<FACE %d: %lu/%lu[FG:%lu/BG:%lu]>", face, |
| 831 | fp->foreground, fp->background, fg, bg); | 833 | fp->foreground, fp->background, fg, bg); |
| 832 | if (fg >= 0 && fg < 16) | 834 | if (fg >= 0 && fg < 16) |
| 833 | { | 835 | { |
| @@ -859,12 +861,6 @@ IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) | |||
| 859 | struct frame *sf; | 861 | struct frame *sf; |
| 860 | unsigned char *conversion_buffer; | 862 | unsigned char *conversion_buffer; |
| 861 | 863 | ||
| 862 | /* Do we need to consider conversion of unibyte characters to | ||
| 863 | multibyte? */ | ||
| 864 | int convert_unibyte_characters | ||
| 865 | = (NILP (current_buffer->enable_multibyte_characters) | ||
| 866 | && unibyte_display_via_language_environment); | ||
| 867 | |||
| 868 | /* If terminal_coding does any conversion, use it, otherwise use | 864 | /* If terminal_coding does any conversion, use it, otherwise use |
| 869 | safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here | 865 | safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
| 870 | because it always returns 1 if terminal_coding.src_multibyte is 1. */ | 866 | because it always returns 1 if terminal_coding.src_multibyte is 1. */ |
| @@ -1180,8 +1176,6 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos) | |||
| 1180 | static void | 1176 | static void |
| 1181 | IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) | 1177 | IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) |
| 1182 | { | 1178 | { |
| 1183 | struct frame *f = XFRAME (w->frame); | ||
| 1184 | struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 1185 | struct glyph_row *row; | 1179 | struct glyph_row *row; |
| 1186 | 1180 | ||
| 1187 | if (mode_line_p) | 1181 | if (mode_line_p) |
| @@ -1192,7 +1186,7 @@ IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) | |||
| 1192 | if (row->enabled_p) | 1186 | if (row->enabled_p) |
| 1193 | { | 1187 | { |
| 1194 | struct glyph *glyph, *end; | 1188 | struct glyph *glyph, *end; |
| 1195 | Lisp_Object help, map; | 1189 | Lisp_Object help; |
| 1196 | 1190 | ||
| 1197 | /* Find the glyph under X. */ | 1191 | /* Find the glyph under X. */ |
| 1198 | glyph = (row->glyphs[TEXT_AREA] | 1192 | glyph = (row->glyphs[TEXT_AREA] |
| @@ -1873,6 +1867,8 @@ IT_delete_glyphs (struct frame *f, int n) | |||
| 1873 | void | 1867 | void |
| 1874 | x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | 1868 | x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) |
| 1875 | { | 1869 | { |
| 1870 | extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); | ||
| 1871 | |||
| 1876 | set_menu_bar_lines (f, value, oldval); | 1872 | set_menu_bar_lines (f, value, oldval); |
| 1877 | } | 1873 | } |
| 1878 | 1874 | ||
| @@ -1939,7 +1935,7 @@ IT_set_terminal_modes (struct terminal *term) | |||
| 1939 | already point to the relocated buffer address returned by | 1935 | already point to the relocated buffer address returned by |
| 1940 | the Int 10h/AX=FEh call above. DJGPP v2.02 and later sets | 1936 | the Int 10h/AX=FEh call above. DJGPP v2.02 and later sets |
| 1941 | ScreenPrimary to that address at startup under DOS/V. */ | 1937 | ScreenPrimary to that address at startup under DOS/V. */ |
| 1942 | if (regs.x.es != (ScreenPrimary >> 4) & 0xffff) | 1938 | if (regs.x.es != ((ScreenPrimary >> 4) & 0xffff)) |
| 1943 | screen_old_address = ScreenPrimary; | 1939 | screen_old_address = ScreenPrimary; |
| 1944 | screen_virtual_segment = regs.x.es; | 1940 | screen_virtual_segment = regs.x.es; |
| 1945 | screen_virtual_offset = regs.x.di; | 1941 | screen_virtual_offset = regs.x.di; |
| @@ -2056,6 +2052,8 @@ DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors, | |||
| 2056 | frame colors are reversed. */ | 2052 | frame colors are reversed. */ |
| 2057 | initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); | 2053 | initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); |
| 2058 | initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); | 2054 | initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); |
| 2055 | |||
| 2056 | return Qnil; | ||
| 2059 | } | 2057 | } |
| 2060 | 2058 | ||
| 2061 | void | 2059 | void |
| @@ -2071,7 +2069,6 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) | |||
| 2071 | int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); | 2069 | int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); |
| 2072 | int redraw = 0, fg_set = 0, bg_set = 0; | 2070 | int redraw = 0, fg_set = 0, bg_set = 0; |
| 2073 | unsigned long orig_fg, orig_bg; | 2071 | unsigned long orig_fg, orig_bg; |
| 2074 | Lisp_Object frame_bg, frame_fg; | ||
| 2075 | struct tty_display_info *tty = FRAME_TTY (f); | 2072 | struct tty_display_info *tty = FRAME_TTY (f); |
| 2076 | 2073 | ||
| 2077 | /* If we are creating a new frame, begin with the original screen colors | 2074 | /* If we are creating a new frame, begin with the original screen colors |
| @@ -2195,9 +2192,10 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) | |||
| 2195 | IT_set_cursor_type (f, val); | 2192 | IT_set_cursor_type (f, val); |
| 2196 | if (tty->termscript) | 2193 | if (tty->termscript) |
| 2197 | fprintf (tty->termscript, "<CTYPE: %s>\n", | 2194 | fprintf (tty->termscript, "<CTYPE: %s>\n", |
| 2198 | EQ (val, Qbar) || EQ (val, Qhbar) | 2195 | EQ (val, Qbar) |
| 2199 | || CONSP (val) && (EQ (XCAR (val), Qbar) | 2196 | || EQ (val, Qhbar) |
| 2200 | || EQ (XCAR (val), Qhbar)) | 2197 | || (CONSP (val) && (EQ (XCAR (val), Qbar) |
| 2198 | || EQ (XCAR (val), Qhbar))) | ||
| 2201 | ? "bar" : "box"); | 2199 | ? "bar" : "box"); |
| 2202 | } | 2200 | } |
| 2203 | else if (EQ (prop, Qtty_type)) | 2201 | else if (EQ (prop, Qtty_type)) |
| @@ -2214,8 +2212,6 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist) | |||
| 2214 | the current frame colors. */ | 2212 | the current frame colors. */ |
| 2215 | if (reverse) | 2213 | if (reverse) |
| 2216 | { | 2214 | { |
| 2217 | Lisp_Object frame; | ||
| 2218 | |||
| 2219 | if (!fg_set) | 2215 | if (!fg_set) |
| 2220 | { | 2216 | { |
| 2221 | FRAME_FOREGROUND_PIXEL (f) = orig_bg; | 2217 | FRAME_FOREGROUND_PIXEL (f) = orig_bg; |
| @@ -2532,11 +2528,11 @@ static struct keyboard_layout_list | |||
| 2532 | struct dos_keyboard_map *keyboard_map; | 2528 | struct dos_keyboard_map *keyboard_map; |
| 2533 | } keyboard_layout_list[] = | 2529 | } keyboard_layout_list[] = |
| 2534 | { | 2530 | { |
| 2535 | 1, &us_keyboard, | 2531 | { 1, &us_keyboard }, |
| 2536 | 33, &fr_keyboard, | 2532 | { 33, &fr_keyboard }, |
| 2537 | 39, &it_keyboard, | 2533 | { 39, &it_keyboard }, |
| 2538 | 45, &dk_keyboard, | 2534 | { 45, &dk_keyboard }, |
| 2539 | 81, &jp_keyboard | 2535 | { 81, &jp_keyboard } |
| 2540 | }; | 2536 | }; |
| 2541 | 2537 | ||
| 2542 | static struct dos_keyboard_map *keyboard; | 2538 | static struct dos_keyboard_map *keyboard; |
| @@ -2581,17 +2577,17 @@ static struct | |||
| 2581 | unsigned char keypad_code; /* keypad code */ | 2577 | unsigned char keypad_code; /* keypad code */ |
| 2582 | unsigned char editkey_code; /* edit key */ | 2578 | unsigned char editkey_code; /* edit key */ |
| 2583 | } keypad_translate_map[] = { | 2579 | } keypad_translate_map[] = { |
| 2584 | '0', '0', 0xb0, /* kp-0 */ 0x63, /* insert */ | 2580 | { '0', '0', 0xb0, /* kp-0 */ 0x63 /* insert */ }, |
| 2585 | '1', '1', 0xb1, /* kp-1 */ 0x57, /* end */ | 2581 | { '1', '1', 0xb1, /* kp-1 */ 0x57 /* end */ }, |
| 2586 | '2', '2', 0xb2, /* kp-2 */ 0x54, /* down */ | 2582 | { '2', '2', 0xb2, /* kp-2 */ 0x54 /* down */ }, |
| 2587 | '3', '3', 0xb3, /* kp-3 */ 0x56, /* next */ | 2583 | { '3', '3', 0xb3, /* kp-3 */ 0x56 /* next */ }, |
| 2588 | '4', '4', 0xb4, /* kp-4 */ 0x51, /* left */ | 2584 | { '4', '4', 0xb4, /* kp-4 */ 0x51 /* left */ }, |
| 2589 | '5', '5', 0xb5, /* kp-5 */ 0xb5, /* kp-5 */ | 2585 | { '5', '5', 0xb5, /* kp-5 */ 0xb5 /* kp-5 */ }, |
| 2590 | '6', '6', 0xb6, /* kp-6 */ 0x53, /* right */ | 2586 | { '6', '6', 0xb6, /* kp-6 */ 0x53 /* right */ }, |
| 2591 | '7', '7', 0xb7, /* kp-7 */ 0x50, /* home */ | 2587 | { '7', '7', 0xb7, /* kp-7 */ 0x50 /* home */ }, |
| 2592 | '8', '8', 0xb8, /* kp-8 */ 0x52, /* up */ | 2588 | { '8', '8', 0xb8, /* kp-8 */ 0x52 /* up */ }, |
| 2593 | '9', '9', 0xb9, /* kp-9 */ 0x55, /* prior */ | 2589 | { '9', '9', 0xb9, /* kp-9 */ 0x55 /* prior */ }, |
| 2594 | '.', '-', 0xae, /* kp-decimal */ 0xff /* delete */ | 2590 | { '.', '-', 0xae, /* kp-decimal */ 0xff /* delete */} |
| 2595 | }; | 2591 | }; |
| 2596 | 2592 | ||
| 2597 | static struct | 2593 | static struct |
| @@ -2599,11 +2595,11 @@ static struct | |||
| 2599 | unsigned char char_code; /* normal code */ | 2595 | unsigned char char_code; /* normal code */ |
| 2600 | unsigned char keypad_code; /* keypad code */ | 2596 | unsigned char keypad_code; /* keypad code */ |
| 2601 | } grey_key_translate_map[] = { | 2597 | } grey_key_translate_map[] = { |
| 2602 | '/', 0xaf, /* kp-decimal */ | 2598 | { '/', 0xaf /* kp-decimal */ }, |
| 2603 | '*', 0xaa, /* kp-multiply */ | 2599 | { '*', 0xaa /* kp-multiply */ }, |
| 2604 | '-', 0xad, /* kp-subtract */ | 2600 | { '-', 0xad /* kp-subtract */ }, |
| 2605 | '+', 0xab, /* kp-add */ | 2601 | { '+', 0xab /* kp-add */ }, |
| 2606 | '\r', 0x8d /* kp-enter */ | 2602 | { '\r', 0x8d /* kp-enter */ } |
| 2607 | }; | 2603 | }; |
| 2608 | 2604 | ||
| 2609 | static unsigned short | 2605 | static unsigned short |
| @@ -3129,7 +3125,6 @@ dos_rawgetc (void) | |||
| 3129 | break; | 3125 | break; |
| 3130 | } | 3126 | } |
| 3131 | 3127 | ||
| 3132 | make_event: | ||
| 3133 | if (code == 0) | 3128 | if (code == 0) |
| 3134 | continue; | 3129 | continue; |
| 3135 | 3130 | ||
| @@ -3237,14 +3232,14 @@ dos_rawgetc (void) | |||
| 3237 | /* If only one button is pressed, wait 100 msec and | 3232 | /* If only one button is pressed, wait 100 msec and |
| 3238 | check again. This way, Speedy Gonzales isn't | 3233 | check again. This way, Speedy Gonzales isn't |
| 3239 | punished, while the slow get their chance. */ | 3234 | punished, while the slow get their chance. */ |
| 3240 | if (press && mouse_pressed (1-but, &x2, &y2) | 3235 | if ((press && mouse_pressed (1-but, &x2, &y2)) |
| 3241 | || !press && mouse_released (1-but, &x2, &y2)) | 3236 | || (!press && mouse_released (1-but, &x2, &y2))) |
| 3242 | button_num = 2; | 3237 | button_num = 2; |
| 3243 | else | 3238 | else |
| 3244 | { | 3239 | { |
| 3245 | delay (100); | 3240 | delay (100); |
| 3246 | if (press && mouse_pressed (1-but, &x2, &y2) | 3241 | if ((press && mouse_pressed (1-but, &x2, &y2)) |
| 3247 | || !press && mouse_released (1-but, &x2, &y2)) | 3242 | || (!press && mouse_released (1-but, &x2, &y2))) |
| 3248 | button_num = 2; | 3243 | button_num = 2; |
| 3249 | } | 3244 | } |
| 3250 | } | 3245 | } |
| @@ -3680,10 +3675,12 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3680 | if (0 <= dy && dy < state[i].menu->count) | 3675 | if (0 <= dy && dy < state[i].menu->count) |
| 3681 | { | 3676 | { |
| 3682 | if (!state[i].menu->submenu[dy]) | 3677 | if (!state[i].menu->submenu[dy]) |
| 3683 | if (state[i].menu->panenumber[dy]) | 3678 | { |
| 3684 | result = XM_SUCCESS; | 3679 | if (state[i].menu->panenumber[dy]) |
| 3685 | else | 3680 | result = XM_SUCCESS; |
| 3686 | result = XM_IA_SELECT; | 3681 | else |
| 3682 | result = XM_IA_SELECT; | ||
| 3683 | } | ||
| 3687 | *pane = state[i].pane - 1; | 3684 | *pane = state[i].pane - 1; |
| 3688 | *selidx = dy; | 3685 | *selidx = dy; |
| 3689 | /* We hit some part of a menu, so drop extra menus that | 3686 | /* We hit some part of a menu, so drop extra menus that |
| @@ -4181,7 +4178,7 @@ dos_ttraw (struct tty_display_info *tty) | |||
| 4181 | /* If we are called for the initial terminal, it's too early to do | 4178 | /* If we are called for the initial terminal, it's too early to do |
| 4182 | anything, and termscript isn't set up. */ | 4179 | anything, and termscript isn't set up. */ |
| 4183 | if (tty->terminal->type == output_initial) | 4180 | if (tty->terminal->type == output_initial) |
| 4184 | return; | 4181 | return 2; |
| 4185 | 4182 | ||
| 4186 | break_stat = getcbrk (); | 4183 | break_stat = getcbrk (); |
| 4187 | setcbrk (0); | 4184 | setcbrk (0); |
| @@ -4367,7 +4364,7 @@ run_msdos_command (unsigned char **argv, const char *working_dir, | |||
| 4367 | result = 0; /* emulate Unixy shell behavior with empty cmd line */ | 4364 | result = 0; /* emulate Unixy shell behavior with empty cmd line */ |
| 4368 | } | 4365 | } |
| 4369 | else | 4366 | else |
| 4370 | result = spawnve (P_WAIT, argv[0], argv, envv); | 4367 | result = spawnve (P_WAIT, argv[0], (char **)argv, envv); |
| 4371 | 4368 | ||
| 4372 | dup2 (inbak, 0); | 4369 | dup2 (inbak, 0); |
| 4373 | dup2 (outbak, 1); | 4370 | dup2 (outbak, 1); |
diff --git a/src/nsfns.m b/src/nsfns.m index aac2ef0ed3a..576131e0bdf 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -1041,6 +1041,7 @@ frame_parm_handler ns_frame_parm_handlers[] = | |||
| 1041 | x_set_font_backend, /* generic OK */ | 1041 | x_set_font_backend, /* generic OK */ |
| 1042 | x_set_alpha, | 1042 | x_set_alpha, |
| 1043 | 0, /* x_set_sticky */ | 1043 | 0, /* x_set_sticky */ |
| 1044 | 0, /* x_set_tool_bar_position */ | ||
| 1044 | }; | 1045 | }; |
| 1045 | 1046 | ||
| 1046 | 1047 | ||
diff --git a/src/nsfont.m b/src/nsfont.m index aaa5999e048..115986774d8 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -161,7 +161,9 @@ static NSFontDescriptor | |||
| 161 | 161 | ||
| 162 | /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */ | 162 | /* Converts NSFont descriptor to FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, etc.. */ |
| 163 | static Lisp_Object | 163 | static Lisp_Object |
| 164 | ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style) | 164 | ns_descriptor_to_entity (NSFontDescriptor *desc, |
| 165 | Lisp_Object extra, | ||
| 166 | const char *style) | ||
| 165 | { | 167 | { |
| 166 | Lisp_Object font_entity = font_make_entity (); | 168 | Lisp_Object font_entity = font_make_entity (); |
| 167 | /* NSString *psName = [desc postscriptName]; */ | 169 | /* NSString *psName = [desc postscriptName]; */ |
diff --git a/src/nsimage.m b/src/nsimage.m index 13761ba5f71..a42950d1f52 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -83,19 +83,21 @@ int | |||
| 83 | ns_load_image (struct frame *f, struct image *img, | 83 | ns_load_image (struct frame *f, struct image *img, |
| 84 | Lisp_Object spec_file, Lisp_Object spec_data) | 84 | Lisp_Object spec_file, Lisp_Object spec_data) |
| 85 | { | 85 | { |
| 86 | EmacsImage *eImg; | 86 | EmacsImage *eImg = nil; |
| 87 | NSSize size; | 87 | NSSize size; |
| 88 | 88 | ||
| 89 | NSTRACE (ns_load_image); | 89 | NSTRACE (ns_load_image); |
| 90 | 90 | ||
| 91 | if (NILP (spec_data)) | 91 | if (STRINGP (spec_file)) |
| 92 | { | 92 | { |
| 93 | eImg = [EmacsImage allocInitFromFile: spec_file]; | 93 | eImg = [EmacsImage allocInitFromFile: spec_file]; |
| 94 | } | 94 | } |
| 95 | else | 95 | else if (STRINGP (spec_data)) |
| 96 | { | 96 | { |
| 97 | NSData *data = [NSData dataWithBytes: SDATA (spec_data) | 97 | NSData *data; |
| 98 | length: SBYTES (spec_data)]; | 98 | |
| 99 | data = [NSData dataWithBytes: SDATA (spec_data) | ||
| 100 | length: SBYTES (spec_data)]; | ||
| 99 | eImg = [[EmacsImage alloc] initWithData: data]; | 101 | eImg = [[EmacsImage alloc] initWithData: data]; |
| 100 | [eImg setPixmapData]; | 102 | [eImg setPixmapData]; |
| 101 | } | 103 | } |
diff --git a/src/nsmenu.m b/src/nsmenu.m index c7ea6bb90fd..9534aec8f2b 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -600,9 +600,9 @@ name_is_separator ( const char *name) | |||
| 600 | NSMenuItem get ignored. For now we try to display a super-single letter | 600 | NSMenuItem get ignored. For now we try to display a super-single letter |
| 601 | combo, and return the others as strings to be appended to the item title. | 601 | combo, and return the others as strings to be appended to the item title. |
| 602 | (This is signaled by setting keyEquivModMask to 0 for now.) */ | 602 | (This is signaled by setting keyEquivModMask to 0 for now.) */ |
| 603 | -(NSString *)parseKeyEquiv: (char *)key | 603 | -(NSString *)parseKeyEquiv: (const char *)key |
| 604 | { | 604 | { |
| 605 | char *tpos = key; | 605 | const char *tpos = key; |
| 606 | keyEquivModMask = NSCommandKeyMask; | 606 | keyEquivModMask = NSCommandKeyMask; |
| 607 | 607 | ||
| 608 | if (!key || !strlen (key)) | 608 | if (!key || !strlen (key)) |
| @@ -719,7 +719,7 @@ name_is_separator ( const char *name) | |||
| 719 | 719 | ||
| 720 | 720 | ||
| 721 | /* adds an empty submenu and returns it */ | 721 | /* adds an empty submenu and returns it */ |
| 722 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f | 722 | - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f |
| 723 | { | 723 | { |
| 724 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 724 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| 725 | NSMenuItem *item = [self addItemWithTitle: titleStr | 725 | NSMenuItem *item = [self addItemWithTitle: titleStr |
| @@ -773,7 +773,7 @@ name_is_separator ( const char *name) | |||
| 773 | 773 | ||
| 774 | Lisp_Object | 774 | Lisp_Object |
| 775 | ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 775 | ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 776 | Lisp_Object title, char **error) | 776 | Lisp_Object title, const char **error) |
| 777 | { | 777 | { |
| 778 | EmacsMenu *pmenu; | 778 | EmacsMenu *pmenu; |
| 779 | NSPoint p; | 779 | NSPoint p; |
| @@ -836,7 +836,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 836 | { | 836 | { |
| 837 | /* Create a new pane. */ | 837 | /* Create a new pane. */ |
| 838 | Lisp_Object pane_name, prefix; | 838 | Lisp_Object pane_name, prefix; |
| 839 | char *pane_string; | 839 | const char *pane_string; |
| 840 | 840 | ||
| 841 | pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); | 841 | pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
| 842 | prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); | 842 | prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
| @@ -1033,7 +1033,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1033 | struct image *img; | 1033 | struct image *img; |
| 1034 | Lisp_Object image; | 1034 | Lisp_Object image; |
| 1035 | Lisp_Object helpObj; | 1035 | Lisp_Object helpObj; |
| 1036 | char *helpText; | 1036 | const char *helpText; |
| 1037 | 1037 | ||
| 1038 | /* If image is a vector, choose the image according to the | 1038 | /* If image is a vector, choose the image according to the |
| 1039 | button state. */ | 1039 | button state. */ |
| @@ -1153,7 +1153,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1153 | } | 1153 | } |
| 1154 | 1154 | ||
| 1155 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 1155 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx |
| 1156 | helpText: (char *)help enabled: (BOOL)enabled | 1156 | helpText: (const char *)help enabled: (BOOL)enabled |
| 1157 | { | 1157 | { |
| 1158 | /* 1) come up w/identifier */ | 1158 | /* 1) come up w/identifier */ |
| 1159 | NSString *identifier | 1159 | NSString *identifier |
diff --git a/src/nsselect.m b/src/nsselect.m index 23dede9c38e..9e434515edf 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -33,10 +33,11 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 33 | #include "lisp.h" | 33 | #include "lisp.h" |
| 34 | #include "nsterm.h" | 34 | #include "nsterm.h" |
| 35 | #include "termhooks.h" | 35 | #include "termhooks.h" |
| 36 | #include "keyboard.h" | ||
| 36 | 37 | ||
| 37 | #define CUT_BUFFER_SUPPORT | 38 | #define CUT_BUFFER_SUPPORT |
| 38 | 39 | ||
| 39 | Lisp_Object QPRIMARY, QSECONDARY, QTEXT, QFILE_NAME; | 40 | Lisp_Object QCLIPBOARD, QSECONDARY, QTEXT, QFILE_NAME; |
| 40 | 41 | ||
| 41 | static Lisp_Object Vns_sent_selection_hooks; | 42 | static Lisp_Object Vns_sent_selection_hooks; |
| 42 | static Lisp_Object Vns_lost_selection_hooks; | 43 | static Lisp_Object Vns_lost_selection_hooks; |
| @@ -45,6 +46,8 @@ static Lisp_Object Vselection_converter_alist; | |||
| 45 | 46 | ||
| 46 | static Lisp_Object Qforeign_selection; | 47 | static Lisp_Object Qforeign_selection; |
| 47 | 48 | ||
| 49 | /* NSGeneralPboard is pretty much analogous to X11 CLIPBOARD */ | ||
| 50 | NSString *NXPrimaryPboard; | ||
| 48 | NSString *NXSecondaryPboard; | 51 | NSString *NXSecondaryPboard; |
| 49 | 52 | ||
| 50 | 53 | ||
| @@ -60,7 +63,8 @@ static NSString * | |||
| 60 | symbol_to_nsstring (Lisp_Object sym) | 63 | symbol_to_nsstring (Lisp_Object sym) |
| 61 | { | 64 | { |
| 62 | CHECK_SYMBOL (sym); | 65 | CHECK_SYMBOL (sym); |
| 63 | if (EQ (sym, QPRIMARY)) return NSGeneralPboard; | 66 | if (EQ (sym, QCLIPBOARD)) return NSGeneralPboard; |
| 67 | if (EQ (sym, QPRIMARY)) return NXPrimaryPboard; | ||
| 64 | if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; | 68 | if (EQ (sym, QSECONDARY)) return NXSecondaryPboard; |
| 65 | if (EQ (sym, QTEXT)) return NSStringPboardType; | 69 | if (EQ (sym, QTEXT)) return NSStringPboardType; |
| 66 | return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)]; | 70 | return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)]; |
| @@ -71,6 +75,8 @@ static Lisp_Object | |||
| 71 | ns_string_to_symbol (NSString *t) | 75 | ns_string_to_symbol (NSString *t) |
| 72 | { | 76 | { |
| 73 | if ([t isEqualToString: NSGeneralPboard]) | 77 | if ([t isEqualToString: NSGeneralPboard]) |
| 78 | return QCLIPBOARD; | ||
| 79 | if ([t isEqualToString: NXPrimaryPboard]) | ||
| 74 | return QPRIMARY; | 80 | return QPRIMARY; |
| 75 | if ([t isEqualToString: NXSecondaryPboard]) | 81 | if ([t isEqualToString: NXSecondaryPboard]) |
| 76 | return QSECONDARY; | 82 | return QSECONDARY; |
| @@ -536,13 +542,14 @@ DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal, | |||
| 536 | void | 542 | void |
| 537 | nxatoms_of_nsselect (void) | 543 | nxatoms_of_nsselect (void) |
| 538 | { | 544 | { |
| 539 | NXSecondaryPboard = @"Selection"; | 545 | NXPrimaryPboard = @"Selection"; |
| 546 | NXSecondaryPboard = @"Secondary"; | ||
| 540 | } | 547 | } |
| 541 | 548 | ||
| 542 | void | 549 | void |
| 543 | syms_of_nsselect (void) | 550 | syms_of_nsselect (void) |
| 544 | { | 551 | { |
| 545 | QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); | 552 | QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); |
| 546 | QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); | 553 | QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); |
| 547 | QTEXT = intern ("TEXT"); staticpro (&QTEXT); | 554 | QTEXT = intern ("TEXT"); staticpro (&QTEXT); |
| 548 | QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME); | 555 | QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME); |
diff --git a/src/nsterm.h b/src/nsterm.h index 9b7f0accad1..21b18f15cae 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -114,10 +114,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 114 | - initWithTitle: (NSString *)title frame: (struct frame *)f; | 114 | - initWithTitle: (NSString *)title frame: (struct frame *)f; |
| 115 | - (void)setFrame: (struct frame *)f; | 115 | - (void)setFrame: (struct frame *)f; |
| 116 | - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */ | 116 | - (void)menuNeedsUpdate: (NSMenu *)menu; /* (delegate method) */ |
| 117 | - (NSString *)parseKeyEquiv: (char *)key; | 117 | - (NSString *)parseKeyEquiv: (const char *)key; |
| 118 | - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr; | 118 | - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr; |
| 119 | - (void)fillWithWidgetValue: (void *)wvptr; | 119 | - (void)fillWithWidgetValue: (void *)wvptr; |
| 120 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f; | 120 | - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f; |
| 121 | - (void) clear; | 121 | - (void) clear; |
| 122 | - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f | 122 | - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f |
| 123 | keymaps: (int)keymaps; | 123 | keymaps: (int)keymaps; |
| @@ -144,7 +144,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 144 | - (void) clearActive; | 144 | - (void) clearActive; |
| 145 | - (BOOL) changed; | 145 | - (BOOL) changed; |
| 146 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 146 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx |
| 147 | helpText: (char *)help | 147 | helpText: (const char *)help |
| 148 | enabled: (BOOL)enabled; | 148 | enabled: (BOOL)enabled; |
| 149 | /* delegate methods */ | 149 | /* delegate methods */ |
| 150 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar | 150 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar |
diff --git a/src/nsterm.m b/src/nsterm.m index 88d47d41972..f0efb948ab9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1792,6 +1792,9 @@ ns_define_frame_cursor (struct frame *f, Cursor cursor) | |||
| 1792 | EmacsView *view = FRAME_NS_VIEW (f); | 1792 | EmacsView *view = FRAME_NS_VIEW (f); |
| 1793 | FRAME_POINTER_TYPE (f) = cursor; | 1793 | FRAME_POINTER_TYPE (f) = cursor; |
| 1794 | [[view window] invalidateCursorRectsForView: view]; | 1794 | [[view window] invalidateCursorRectsForView: view]; |
| 1795 | /* Redisplay assumes this function also draws the changed frame | ||
| 1796 | cursor, but this function doesn't, so do it explicitly. */ | ||
| 1797 | x_update_cursor (f, 1); | ||
| 1795 | } | 1798 | } |
| 1796 | } | 1799 | } |
| 1797 | 1800 | ||
| @@ -2248,6 +2251,11 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2248 | struct frame *f = WINDOW_XFRAME (w); | 2251 | struct frame *f = WINDOW_XFRAME (w); |
| 2249 | struct glyph *phys_cursor_glyph; | 2252 | struct glyph *phys_cursor_glyph; |
| 2250 | int overspill; | 2253 | int overspill; |
| 2254 | struct glyph *cursor_glyph; | ||
| 2255 | |||
| 2256 | /* If cursor is out of bounds, don't draw garbage. This can happen | ||
| 2257 | in mini-buffer windows when switching between echo area glyphs | ||
| 2258 | and mini-buffer. */ | ||
| 2251 | 2259 | ||
| 2252 | NSTRACE (dumpcursor); | 2260 | NSTRACE (dumpcursor); |
| 2253 | //fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = %d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width); | 2261 | //fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = %d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width); |
| @@ -2325,6 +2333,13 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2325 | case BAR_CURSOR: | 2333 | case BAR_CURSOR: |
| 2326 | s = r; | 2334 | s = r; |
| 2327 | s.size.width = min (cursor_width, 2); //FIXME(see above) | 2335 | s.size.width = min (cursor_width, 2); //FIXME(see above) |
| 2336 | |||
| 2337 | /* If the character under cursor is R2L, draw the bar cursor | ||
| 2338 | on the right of its glyph, rather than on the left. */ | ||
| 2339 | cursor_glyph = get_phys_cursor_glyph (w); | ||
| 2340 | if ((cursor_glyph->resolved_level & 1) != 0) | ||
| 2341 | s.origin.x += cursor_glyph->pixel_width - s.size.width; | ||
| 2342 | |||
| 2328 | NSRectFill (s); | 2343 | NSRectFill (s); |
| 2329 | break; | 2344 | break; |
| 2330 | } | 2345 | } |
diff --git a/src/process.c b/src/process.c index 4a658623077..f348dca7d35 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -31,9 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #ifdef HAVE_INTTYPES_H | 31 | #ifdef HAVE_INTTYPES_H |
| 32 | #include <inttypes.h> | 32 | #include <inttypes.h> |
| 33 | #endif | 33 | #endif |
| 34 | #ifdef STDC_HEADERS | ||
| 35 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| 36 | #endif | ||
| 37 | 35 | ||
| 38 | #ifdef HAVE_UNISTD_H | 36 | #ifdef HAVE_UNISTD_H |
| 39 | #include <unistd.h> | 37 | #include <unistd.h> |
| @@ -61,9 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 61 | 59 | ||
| 62 | #if defined(HAVE_SYS_IOCTL_H) | 60 | #if defined(HAVE_SYS_IOCTL_H) |
| 63 | #include <sys/ioctl.h> | 61 | #include <sys/ioctl.h> |
| 64 | #if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5) | ||
| 65 | #include <fcntl.h> | ||
| 66 | #endif /* HAVE_PTYS and no O_NDELAY */ | ||
| 67 | #if defined(HAVE_NET_IF_H) | 62 | #if defined(HAVE_NET_IF_H) |
| 68 | #include <net/if.h> | 63 | #include <net/if.h> |
| 69 | #endif /* HAVE_NET_IF_H */ | 64 | #endif /* HAVE_NET_IF_H */ |
| @@ -182,16 +177,9 @@ extern Lisp_Object QCfilter; | |||
| 182 | 177 | ||
| 183 | extern const char *get_operating_system_release (void); | 178 | extern const char *get_operating_system_release (void); |
| 184 | 179 | ||
| 185 | /* Serial processes require termios or Windows. */ | ||
| 186 | #if defined (HAVE_TERMIOS) || defined (WINDOWSNT) | ||
| 187 | #define HAVE_SERIAL | ||
| 188 | #endif | ||
| 189 | |||
| 190 | #ifdef HAVE_SERIAL | ||
| 191 | /* From sysdep.c or w32.c */ | 180 | /* From sysdep.c or w32.c */ |
| 192 | extern int serial_open (char *port); | 181 | extern int serial_open (char *port); |
| 193 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); | 182 | extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); |
| 194 | #endif | ||
| 195 | 183 | ||
| 196 | #ifndef HAVE_H_ERRNO | 184 | #ifndef HAVE_H_ERRNO |
| 197 | extern int h_errno; | 185 | extern int h_errno; |
| @@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1903 | setpgrp (); | 1891 | setpgrp (); |
| 1904 | #endif /* USG */ | 1892 | #endif /* USG */ |
| 1905 | #endif /* not HAVE_SETSID */ | 1893 | #endif /* not HAVE_SETSID */ |
| 1906 | #if defined (HAVE_TERMIOS) && defined (LDISC1) | 1894 | #if defined (LDISC1) |
| 1907 | if (pty_flag && xforkin >= 0) | 1895 | if (pty_flag && xforkin >= 0) |
| 1908 | { | 1896 | { |
| 1909 | struct termios t; | 1897 | struct termios t; |
| @@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */) | |||
| 2569 | } | 2557 | } |
| 2570 | 2558 | ||
| 2571 | 2559 | ||
| 2572 | #ifdef HAVE_SERIAL | ||
| 2573 | DEFUN ("serial-process-configure", | 2560 | DEFUN ("serial-process-configure", |
| 2574 | Fserial_process_configure, | 2561 | Fserial_process_configure, |
| 2575 | Sserial_process_configure, | 2562 | Sserial_process_configure, |
| @@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 2865 | UNGCPRO; | 2852 | UNGCPRO; |
| 2866 | return proc; | 2853 | return proc; |
| 2867 | } | 2854 | } |
| 2868 | #endif /* HAVE_SERIAL */ | ||
| 2869 | 2855 | ||
| 2870 | /* Create a network stream/datagram client/server process. Treated | 2856 | /* Create a network stream/datagram client/server process. Treated |
| 2871 | exactly like a normal process when reading and writing. Primary | 2857 | exactly like a normal process when reading and writing. Primary |
| @@ -5801,9 +5787,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5801 | /* If possible, send signals to the entire pgrp | 5787 | /* If possible, send signals to the entire pgrp |
| 5802 | by sending an input character to it. */ | 5788 | by sending an input character to it. */ |
| 5803 | 5789 | ||
| 5804 | /* TERMIOS is the latest and bestest, and seems most likely to | ||
| 5805 | work. If the system has it, use it. */ | ||
| 5806 | #ifdef HAVE_TERMIOS | ||
| 5807 | struct termios t; | 5790 | struct termios t; |
| 5808 | cc_t *sig_char = NULL; | 5791 | cc_t *sig_char = NULL; |
| 5809 | 5792 | ||
| @@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5835 | } | 5818 | } |
| 5836 | /* If we can't send the signal with a character, | 5819 | /* If we can't send the signal with a character, |
| 5837 | fall through and send it another way. */ | 5820 | fall through and send it another way. */ |
| 5838 | #else /* ! HAVE_TERMIOS */ | ||
| 5839 | |||
| 5840 | /* On Berkeley descendants, the following IOCTL's retrieve the | ||
| 5841 | current control characters. */ | ||
| 5842 | #if defined (TIOCGLTC) && defined (TIOCGETC) | ||
| 5843 | |||
| 5844 | struct tchars c; | ||
| 5845 | struct ltchars lc; | ||
| 5846 | |||
| 5847 | switch (signo) | ||
| 5848 | { | ||
| 5849 | case SIGINT: | ||
| 5850 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5851 | send_process (proc, &c.t_intrc, 1, Qnil); | ||
| 5852 | return; | ||
| 5853 | case SIGQUIT: | ||
| 5854 | ioctl (p->infd, TIOCGETC, &c); | ||
| 5855 | send_process (proc, &c.t_quitc, 1, Qnil); | ||
| 5856 | return; | ||
| 5857 | #ifdef SIGTSTP | ||
| 5858 | case SIGTSTP: | ||
| 5859 | ioctl (p->infd, TIOCGLTC, &lc); | ||
| 5860 | send_process (proc, &lc.t_suspc, 1, Qnil); | ||
| 5861 | return; | ||
| 5862 | #endif /* ! defined (SIGTSTP) */ | ||
| 5863 | } | ||
| 5864 | |||
| 5865 | #else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5866 | |||
| 5867 | /* On SYSV descendants, the TCGETA ioctl retrieves the current control | ||
| 5868 | characters. */ | ||
| 5869 | #ifdef TCGETA | ||
| 5870 | struct termio t; | ||
| 5871 | switch (signo) | ||
| 5872 | { | ||
| 5873 | case SIGINT: | ||
| 5874 | ioctl (p->infd, TCGETA, &t); | ||
| 5875 | send_process (proc, &t.c_cc[VINTR], 1, Qnil); | ||
| 5876 | return; | ||
| 5877 | case SIGQUIT: | ||
| 5878 | ioctl (p->infd, TCGETA, &t); | ||
| 5879 | send_process (proc, &t.c_cc[VQUIT], 1, Qnil); | ||
| 5880 | return; | ||
| 5881 | #ifdef SIGTSTP | ||
| 5882 | case SIGTSTP: | ||
| 5883 | ioctl (p->infd, TCGETA, &t); | ||
| 5884 | send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); | ||
| 5885 | return; | ||
| 5886 | #endif /* ! defined (SIGTSTP) */ | ||
| 5887 | } | ||
| 5888 | #else /* ! defined (TCGETA) */ | ||
| 5889 | Your configuration files are messed up. | ||
| 5890 | /* If your system configuration files define SIGNALS_VIA_CHARACTERS, | ||
| 5891 | you'd better be using one of the alternatives above! */ | ||
| 5892 | #endif /* ! defined (TCGETA) */ | ||
| 5893 | #endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */ | ||
| 5894 | /* In this case, the code above should alway return. */ | ||
| 5895 | abort (); | ||
| 5896 | #endif /* ! defined HAVE_TERMIOS */ | ||
| 5897 | 5821 | ||
| 5898 | /* The code above may fall through if it can't | 5822 | /* The code above may fall through if it can't |
| 5899 | handle the signal. */ | 5823 | handle the signal. */ |
| @@ -6065,10 +5989,9 @@ traffic. */) | |||
| 6065 | #ifdef WINDOWSNT | 5989 | #ifdef WINDOWSNT |
| 6066 | if (fd_info[ p->infd ].flags & FILE_SERIAL) | 5990 | if (fd_info[ p->infd ].flags & FILE_SERIAL) |
| 6067 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); | 5991 | PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); |
| 6068 | #endif | 5992 | #else /* not WINDOWSNT */ |
| 6069 | #ifdef HAVE_TERMIOS | ||
| 6070 | tcflush (p->infd, TCIFLUSH); | 5993 | tcflush (p->infd, TCIFLUSH); |
| 6071 | #endif | 5994 | #endif /* not WINDOWSNT */ |
| 6072 | } | 5995 | } |
| 6073 | p->command = Qnil; | 5996 | p->command = Qnil; |
| 6074 | return process; | 5997 | return process; |
| @@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */) | |||
| 6282 | send_process (proc, "\004", 1, Qnil); | 6205 | send_process (proc, "\004", 1, Qnil); |
| 6283 | else if (EQ (XPROCESS (proc)->type, Qserial)) | 6206 | else if (EQ (XPROCESS (proc)->type, Qserial)) |
| 6284 | { | 6207 | { |
| 6285 | #ifdef HAVE_TERMIOS | 6208 | #ifndef WINDOWSNT |
| 6286 | if (tcdrain (XPROCESS (proc)->outfd) != 0) | 6209 | if (tcdrain (XPROCESS (proc)->outfd) != 0) |
| 6287 | error ("tcdrain() failed: %s", emacs_strerror (errno)); | 6210 | error ("tcdrain() failed: %s", emacs_strerror (errno)); |
| 6288 | #endif | 6211 | #endif /* not WINDOWSNT */ |
| 6289 | /* Do nothing on Windows because writes are blocking. */ | 6212 | /* Do nothing on Windows because writes are blocking. */ |
| 6290 | } | 6213 | } |
| 6291 | else | 6214 | else |
| @@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */); | |||
| 7672 | defsubr (&Slist_processes); | 7595 | defsubr (&Slist_processes); |
| 7673 | defsubr (&Sprocess_list); | 7596 | defsubr (&Sprocess_list); |
| 7674 | defsubr (&Sstart_process); | 7597 | defsubr (&Sstart_process); |
| 7675 | #ifdef HAVE_SERIAL | ||
| 7676 | defsubr (&Sserial_process_configure); | 7598 | defsubr (&Sserial_process_configure); |
| 7677 | defsubr (&Smake_serial_process); | 7599 | defsubr (&Smake_serial_process); |
| 7678 | #endif /* HAVE_SERIAL */ | ||
| 7679 | defsubr (&Sset_network_process_option); | 7600 | defsubr (&Sset_network_process_option); |
| 7680 | defsubr (&Smake_network_process); | 7601 | defsubr (&Smake_network_process); |
| 7681 | defsubr (&Sformat_network_address); | 7602 | defsubr (&Sformat_network_address); |
diff --git a/src/process.h b/src/process.h index 6d4832ffde8..35b01aba6a4 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -142,7 +142,7 @@ extern int synch_process_alive; | |||
| 142 | to Fcall_process. */ | 142 | to Fcall_process. */ |
| 143 | 143 | ||
| 144 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ | 144 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ |
| 145 | extern char *synch_process_death; | 145 | extern const char *synch_process_death; |
| 146 | 146 | ||
| 147 | /* Nonzero => this is the signal number that terminated the subprocess. */ | 147 | /* Nonzero => this is the signal number that terminated the subprocess. */ |
| 148 | extern int synch_process_termsig; | 148 | extern int synch_process_termsig; |
diff --git a/src/puresize.h b/src/puresize.h index 682e8926135..3c7f92228a0 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -87,7 +87,6 @@ extern EMACS_INT pure[]; | |||
| 87 | && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) | 87 | && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) |
| 88 | 88 | ||
| 89 | #else /* not VIRT_ADDR_VARIES */ | 89 | #else /* not VIRT_ADDR_VARIES */ |
| 90 | #ifdef PNTR_COMPARISON_TYPE | ||
| 91 | /* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */ | 90 | /* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */ |
| 92 | 91 | ||
| 93 | extern char my_edata[]; | 92 | extern char my_edata[]; |
| @@ -95,14 +94,6 @@ extern char my_edata[]; | |||
| 95 | #define PURE_P(obj) \ | 94 | #define PURE_P(obj) \ |
| 96 | ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata) | 95 | ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata) |
| 97 | 96 | ||
| 98 | #else /* not VIRT_ADDRESS_VARIES, not PNTR_COMPARISON_TYPE */ | ||
| 99 | |||
| 100 | extern char my_edata[]; | ||
| 101 | |||
| 102 | #define PURE_P(obj) \ | ||
| 103 | (XPNTR (obj) < (unsigned int) my_edata) | ||
| 104 | |||
| 105 | #endif /* PNTR_COMPARISON_TYPE */ | ||
| 106 | #endif /* VIRT_ADDRESS_VARIES */ | 97 | #endif /* VIRT_ADDRESS_VARIES */ |
| 107 | 98 | ||
| 108 | /* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f | 99 | /* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f |
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h index 84920f888e1..0a3d48db639 100644 --- a/src/s/aix4-2.h +++ b/src/s/aix4-2.h | |||
| @@ -55,10 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 55 | 55 | ||
| 56 | /* Special items needed to make Emacs run on this system. */ | 56 | /* Special items needed to make Emacs run on this system. */ |
| 57 | 57 | ||
| 58 | /* The following definition seems to be needed in AIX version 3.1.6.8. | ||
| 59 | It may not have been needed in certain earlier versions. */ | ||
| 60 | #define HAVE_TCATTR | ||
| 61 | |||
| 62 | /* AIX doesn't define this. */ | 58 | /* AIX doesn't define this. */ |
| 63 | #define unix 1 | 59 | #define unix 1 |
| 64 | 60 | ||
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h index ee0fa9abe02..d34ff16104b 100644 --- a/src/s/hpux10-20.h +++ b/src/s/hpux10-20.h | |||
| @@ -35,9 +35,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ | 35 | if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ |
| 36 | #define FIRST_PTY_LETTER 'p' | 36 | #define FIRST_PTY_LETTER 'p' |
| 37 | 37 | ||
| 38 | /* Define HAVE_TERMIO if the system provides sysV-style ioctls | 38 | #define HAVE_TERMIOS |
| 39 | for terminal control. */ | 39 | #define NO_TERMIO |
| 40 | #define HAVE_TERMIO | 40 | |
| 41 | #define ORDINARY_LINK | ||
| 41 | 42 | ||
| 42 | /* Define HAVE_PTYS if the system supports pty devices. */ | 43 | /* Define HAVE_PTYS if the system supports pty devices. */ |
| 43 | #define HAVE_PTYS | 44 | #define HAVE_PTYS |
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index f61fae57eff..4ae5f32e873 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h | |||
| @@ -106,7 +106,6 @@ struct sigaction { | |||
| 106 | #define HAVE_SOUND 1 | 106 | #define HAVE_SOUND 1 |
| 107 | #define LISP_FLOAT_TYPE 1 | 107 | #define LISP_FLOAT_TYPE 1 |
| 108 | 108 | ||
| 109 | #undef HAVE_SYS_SELECT_H | ||
| 110 | #define HAVE_SYS_TIMEB_H 1 | 109 | #define HAVE_SYS_TIMEB_H 1 |
| 111 | #define HAVE_SYS_TIME_H 1 | 110 | #define HAVE_SYS_TIME_H 1 |
| 112 | #define HAVE_UNISTD_H 1 | 111 | #define HAVE_UNISTD_H 1 |
diff --git a/src/s/unixware.h b/src/s/unixware.h index ac989d48e2c..81b1b3d97fa 100644 --- a/src/s/unixware.h +++ b/src/s/unixware.h | |||
| @@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include "usg5-4-common.h" | 22 | #include "usg5-4-common.h" |
| 23 | 23 | ||
| 24 | /* fnf@cygnus.com says these exist. */ | ||
| 25 | #define HAVE_TCATTR | ||
| 26 | /* #define HAVE_GETWD (appears to be buggy on SVR4.2) */ | 24 | /* #define HAVE_GETWD (appears to be buggy on SVR4.2) */ |
| 27 | #undef HAVE_GETWD | 25 | #undef HAVE_GETWD |
| 28 | 26 | ||
diff --git a/src/syntax.c b/src/syntax.c index 9b707c6c3b7..f0a7dca42dc 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -34,6 +34,60 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | 34 | ||
| 35 | #include "syntax.h" | 35 | #include "syntax.h" |
| 36 | #include "intervals.h" | 36 | #include "intervals.h" |
| 37 | #include "category.h" | ||
| 38 | |||
| 39 | /* Then there are seven single-bit flags that have the following meanings: | ||
| 40 | 1. This character is the first of a two-character comment-start sequence. | ||
| 41 | 2. This character is the second of a two-character comment-start sequence. | ||
| 42 | 3. This character is the first of a two-character comment-end sequence. | ||
| 43 | 4. This character is the second of a two-character comment-end sequence. | ||
| 44 | 5. This character is a prefix, for backward-prefix-chars. | ||
| 45 | 6. The char is part of a delimiter for comments of style "b". | ||
| 46 | 7. This character is part of a nestable comment sequence. | ||
| 47 | 8. The char is part of a delimiter for comments of style "c". | ||
| 48 | Note that any two-character sequence whose first character has flag 1 | ||
| 49 | and whose second character has flag 2 will be interpreted as a comment start. | ||
| 50 | |||
| 51 | bit 6 and 8 are used to discriminate between different comment styles. | ||
| 52 | Languages such as C++ allow two orthogonal syntax start/end pairs | ||
| 53 | and bit 6 is used to determine whether a comment-end or Scommentend | ||
| 54 | ends style a or b. Comment markers can start style a, b, c, or bc. | ||
| 55 | Style a is always the default. | ||
| 56 | For 2-char comment markers, the style b flag is only looked up on the second | ||
| 57 | char of the comment marker and on the first char of the comment ender. | ||
| 58 | For style c (like to for the nested flag), the flag can be placed on any | ||
| 59 | one of the chars. | ||
| 60 | */ | ||
| 61 | |||
| 62 | /* These macros extract specific flags from an integer | ||
| 63 | that holds the syntax code and the flags. */ | ||
| 64 | |||
| 65 | #define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1) | ||
| 66 | |||
| 67 | #define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1) | ||
| 68 | |||
| 69 | #define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1) | ||
| 70 | |||
| 71 | #define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1) | ||
| 72 | |||
| 73 | #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) | ||
| 74 | |||
| 75 | #define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) | ||
| 76 | #define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2) | ||
| 77 | /* FLAGS should be the flags of the main char of the comment marker, e.g. | ||
| 78 | the second for comstart and the first for comend. */ | ||
| 79 | #define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ | ||
| 80 | (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ | ||
| 81 | | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \ | ||
| 82 | | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags)) | ||
| 83 | |||
| 84 | #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) | ||
| 85 | |||
| 86 | /* These macros extract a particular flag for a given character. */ | ||
| 87 | |||
| 88 | #define SYNTAX_COMEND_FIRST(c) \ | ||
| 89 | (SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c))) | ||
| 90 | #define SYNTAX_PREFIX(c) (SYNTAX_FLAGS_PREFIX (SYNTAX_WITH_FLAGS (c))) | ||
| 37 | 91 | ||
| 38 | /* We use these constants in place for comment-style and | 92 | /* We use these constants in place for comment-style and |
| 39 | string-ender-char to distinguish comments/strings started by | 93 | string-ender-char to distinguish comments/strings started by |
| @@ -41,7 +95,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | 95 | ||
| 42 | #define ST_COMMENT_STYLE (256 + 1) | 96 | #define ST_COMMENT_STYLE (256 + 1) |
| 43 | #define ST_STRING_STYLE (256 + 2) | 97 | #define ST_STRING_STYLE (256 + 2) |
| 44 | #include "category.h" | ||
| 45 | 98 | ||
| 46 | Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error; | 99 | Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error; |
| 47 | 100 | ||
| @@ -106,6 +159,11 @@ static void scan_sexps_forward (struct lisp_parse_state *, | |||
| 106 | int, Lisp_Object, int); | 159 | int, Lisp_Object, int); |
| 107 | static int in_classes (int, Lisp_Object); | 160 | static int in_classes (int, Lisp_Object); |
| 108 | 161 | ||
| 162 | /* Whether the syntax of the character C has the prefix flag set. */ | ||
| 163 | int syntax_prefix_flag_p (int c) | ||
| 164 | { | ||
| 165 | return SYNTAX_PREFIX (c); | ||
| 166 | } | ||
| 109 | 167 | ||
| 110 | struct gl_state_s gl_state; /* Global state of syntax parser. */ | 168 | struct gl_state_s gl_state; /* Global state of syntax parser. */ |
| 111 | 169 | ||
| @@ -514,7 +572,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 514 | /* Check for 2-char comment markers. */ | 572 | /* Check for 2-char comment markers. */ |
| 515 | com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax) | 573 | com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
| 516 | && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax) | 574 | && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax) |
| 517 | && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax) | 575 | && (comstyle |
| 576 | == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax, syntax)) | ||
| 518 | && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax) | 577 | && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax) |
| 519 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); | 578 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); |
| 520 | com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) | 579 | com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) |
| @@ -543,7 +602,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 543 | && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) | 602 | && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) |
| 544 | || ((com2end || comnested) | 603 | || ((com2end || comnested) |
| 545 | && SYNTAX_FLAGS_COMSTART_SECOND (syntax) | 604 | && SYNTAX_FLAGS_COMSTART_SECOND (syntax) |
| 546 | && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (syntax) | 605 | && (comstyle |
| 606 | == SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_syntax)) | ||
| 547 | && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax))) | 607 | && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax))) |
| 548 | goto lossage; | 608 | goto lossage; |
| 549 | /* UPDATE_SYNTAX_TABLE_FORWARD (next + 1); */ | 609 | /* UPDATE_SYNTAX_TABLE_FORWARD (next + 1); */ |
| @@ -563,7 +623,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 563 | code = Scomment; | 623 | code = Scomment; |
| 564 | /* Ignore comment starters of a different style. */ | 624 | /* Ignore comment starters of a different style. */ |
| 565 | else if (code == Scomment | 625 | else if (code == Scomment |
| 566 | && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax) | 626 | && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) |
| 567 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested)) | 627 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested)) |
| 568 | continue; | 628 | continue; |
| 569 | 629 | ||
| @@ -613,7 +673,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 613 | break; | 673 | break; |
| 614 | 674 | ||
| 615 | case Sendcomment: | 675 | case Sendcomment: |
| 616 | if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle | 676 | if (SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == comstyle |
| 617 | && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)) | 677 | && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)) |
| 618 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested) | 678 | || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested) |
| 619 | /* This is the same style of comment ender as ours. */ | 679 | /* This is the same style of comment ender as ours. */ |
| @@ -930,6 +990,10 @@ text property. */) | |||
| 930 | case 'n': | 990 | case 'n': |
| 931 | val |= 1 << 22; | 991 | val |= 1 << 22; |
| 932 | break; | 992 | break; |
| 993 | |||
| 994 | case 'c': | ||
| 995 | val |= 1 << 23; | ||
| 996 | break; | ||
| 933 | } | 997 | } |
| 934 | 998 | ||
| 935 | if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) | 999 | if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) |
| @@ -969,12 +1033,13 @@ Defined flags are the characters 1, 2, 3, 4, b, p, and n. | |||
| 969 | 3 means CHAR is the start of a two-char comment end sequence. | 1033 | 3 means CHAR is the start of a two-char comment end sequence. |
| 970 | 4 means CHAR is the second character of such a sequence. | 1034 | 4 means CHAR is the second character of such a sequence. |
| 971 | 1035 | ||
| 972 | There can be up to two orthogonal comment sequences. This is to support | 1036 | There can be several orthogonal comment sequences. This is to support |
| 973 | language modes such as C++. By default, all comment sequences are of style | 1037 | language modes such as C++. By default, all comment sequences are of style |
| 974 | a, but you can set the comment sequence style to b (on the second character | 1038 | a, but you can set the comment sequence style to b (on the second character |
| 975 | of a comment-start, or the first character of a comment-end sequence) using | 1039 | of a comment-start, and the first character of a comment-end sequence) and/or |
| 976 | this flag: | 1040 | c (on any of its chars) using this flag: |
| 977 | b means CHAR is part of comment sequence b. | 1041 | b means CHAR is part of comment sequence b. |
| 1042 | c means CHAR is part of comment sequence c. | ||
| 978 | n means CHAR is part of a nestable comment sequence. | 1043 | n means CHAR is part of a nestable comment sequence. |
| 979 | 1044 | ||
| 980 | p means CHAR is a prefix character for `backward-prefix-chars'; | 1045 | p means CHAR is a prefix character for `backward-prefix-chars'; |
| @@ -1017,7 +1082,9 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1017 | (Lisp_Object syntax) | 1082 | (Lisp_Object syntax) |
| 1018 | { | 1083 | { |
| 1019 | register enum syntaxcode code; | 1084 | register enum syntaxcode code; |
| 1020 | char desc, start1, start2, end1, end2, prefix, comstyle, comnested; | 1085 | int syntax_code; |
| 1086 | char desc, start1, start2, end1, end2, prefix, | ||
| 1087 | comstyleb, comstylec, comnested; | ||
| 1021 | char str[2]; | 1088 | char str[2]; |
| 1022 | Lisp_Object first, match_lisp, value = syntax; | 1089 | Lisp_Object first, match_lisp, value = syntax; |
| 1023 | 1090 | ||
| @@ -1048,14 +1115,16 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1048 | return syntax; | 1115 | return syntax; |
| 1049 | } | 1116 | } |
| 1050 | 1117 | ||
| 1051 | code = (enum syntaxcode) (XINT (first) & 0377); | 1118 | syntax_code = XINT (first); |
| 1052 | start1 = (XINT (first) >> 16) & 1; | 1119 | code = (enum syntaxcode) (syntax_code & 0377); |
| 1053 | start2 = (XINT (first) >> 17) & 1; | 1120 | start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); |
| 1054 | end1 = (XINT (first) >> 18) & 1; | 1121 | start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; |
| 1055 | end2 = (XINT (first) >> 19) & 1; | 1122 | end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code); |
| 1056 | prefix = (XINT (first) >> 20) & 1; | 1123 | end2 = SYNTAX_FLAGS_COMEND_SECOND (syntax_code); |
| 1057 | comstyle = (XINT (first) >> 21) & 1; | 1124 | prefix = SYNTAX_FLAGS_PREFIX (syntax_code); |
| 1058 | comnested = (XINT (first) >> 22) & 1; | 1125 | comstyleb = SYNTAX_FLAGS_COMMENT_STYLEB (syntax_code); |
| 1126 | comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code); | ||
| 1127 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code); | ||
| 1059 | 1128 | ||
| 1060 | if ((int) code < 0 || (int) code >= (int) Smax) | 1129 | if ((int) code < 0 || (int) code >= (int) Smax) |
| 1061 | { | 1130 | { |
| @@ -1084,8 +1153,10 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1084 | 1153 | ||
| 1085 | if (prefix) | 1154 | if (prefix) |
| 1086 | insert ("p", 1); | 1155 | insert ("p", 1); |
| 1087 | if (comstyle) | 1156 | if (comstyleb) |
| 1088 | insert ("b", 1); | 1157 | insert ("b", 1); |
| 1158 | if (comstylec) | ||
| 1159 | insert ("c", 1); | ||
| 1089 | if (comnested) | 1160 | if (comnested) |
| 1090 | insert ("n", 1); | 1161 | insert ("n", 1); |
| 1091 | 1162 | ||
| @@ -1145,8 +1216,10 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1145 | insert_string (",\n\t is the first character of a comment-end sequence"); | 1216 | insert_string (",\n\t is the first character of a comment-end sequence"); |
| 1146 | if (end2) | 1217 | if (end2) |
| 1147 | insert_string (",\n\t is the second character of a comment-end sequence"); | 1218 | insert_string (",\n\t is the second character of a comment-end sequence"); |
| 1148 | if (comstyle) | 1219 | if (comstyleb) |
| 1149 | insert_string (" (comment style b)"); | 1220 | insert_string (" (comment style b)"); |
| 1221 | if (comstylec) | ||
| 1222 | insert_string (" (comment style c)"); | ||
| 1150 | if (comnested) | 1223 | if (comnested) |
| 1151 | insert_string (" (nestable)"); | 1224 | insert_string (" (nestable)"); |
| 1152 | 1225 | ||
| @@ -2060,7 +2133,7 @@ in_classes (int c, Lisp_Object iso_classes) | |||
| 2060 | FROM_BYTE is the bytepos corresponding to FROM. | 2133 | FROM_BYTE is the bytepos corresponding to FROM. |
| 2061 | Do not move past STOP (a charpos). | 2134 | Do not move past STOP (a charpos). |
| 2062 | The comment over which we have to jump is of style STYLE | 2135 | The comment over which we have to jump is of style STYLE |
| 2063 | (either SYNTAX_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). | 2136 | (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). |
| 2064 | NESTING should be positive to indicate the nesting at the beginning | 2137 | NESTING should be positive to indicate the nesting at the beginning |
| 2065 | for nested comments and should be zero or negative else. | 2138 | for nested comments and should be zero or negative else. |
| 2066 | ST_COMMENT_STYLE cannot be nested. | 2139 | ST_COMMENT_STYLE cannot be nested. |
| @@ -2087,7 +2160,7 @@ forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | |||
| 2087 | { | 2160 | { |
| 2088 | register int c, c1; | 2161 | register int c, c1; |
| 2089 | register enum syntaxcode code; | 2162 | register enum syntaxcode code; |
| 2090 | register int syntax; | 2163 | register int syntax, other_syntax; |
| 2091 | 2164 | ||
| 2092 | if (nesting <= 0) nesting = -1; | 2165 | if (nesting <= 0) nesting = -1; |
| 2093 | 2166 | ||
| @@ -2109,7 +2182,7 @@ forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | |||
| 2109 | syntax = SYNTAX_WITH_FLAGS (c); | 2182 | syntax = SYNTAX_WITH_FLAGS (c); |
| 2110 | code = syntax & 0xff; | 2183 | code = syntax & 0xff; |
| 2111 | if (code == Sendcomment | 2184 | if (code == Sendcomment |
| 2112 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style | 2185 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style |
| 2113 | && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? | 2186 | && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? |
| 2114 | (nesting > 0 && --nesting == 0) : nesting < 0)) | 2187 | (nesting > 0 && --nesting == 0) : nesting < 0)) |
| 2115 | /* we have encountered a comment end of the same style | 2188 | /* we have encountered a comment end of the same style |
| @@ -2125,7 +2198,7 @@ forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | |||
| 2125 | if (nesting > 0 | 2198 | if (nesting > 0 |
| 2126 | && code == Scomment | 2199 | && code == Scomment |
| 2127 | && SYNTAX_FLAGS_COMMENT_NESTED (syntax) | 2200 | && SYNTAX_FLAGS_COMMENT_NESTED (syntax) |
| 2128 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style) | 2201 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style) |
| 2129 | /* we have encountered a nested comment of the same style | 2202 | /* we have encountered a nested comment of the same style |
| 2130 | as the comment sequence which began this comment section */ | 2203 | as the comment sequence which began this comment section */ |
| 2131 | nesting++; | 2204 | nesting++; |
| @@ -2134,11 +2207,13 @@ forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | |||
| 2134 | 2207 | ||
| 2135 | forw_incomment: | 2208 | forw_incomment: |
| 2136 | if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax) | 2209 | if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax) |
| 2137 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style | ||
| 2138 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2210 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| 2139 | SYNTAX_COMEND_SECOND (c1)) | 2211 | other_syntax = SYNTAX_WITH_FLAGS (c1), |
| 2212 | SYNTAX_FLAGS_COMEND_SECOND (other_syntax)) | ||
| 2213 | && SYNTAX_FLAGS_COMMENT_STYLE (syntax, other_syntax) == style | ||
| 2140 | && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) || | 2214 | && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
| 2141 | SYNTAX_COMMENT_NESTED (c1)) ? nesting > 0 : nesting < 0)) | 2215 | SYNTAX_FLAGS_COMMENT_NESTED (other_syntax)) |
| 2216 | ? nesting > 0 : nesting < 0)) | ||
| 2142 | { | 2217 | { |
| 2143 | if (--nesting <= 0) | 2218 | if (--nesting <= 0) |
| 2144 | /* we have encountered a comment end of the same style | 2219 | /* we have encountered a comment end of the same style |
| @@ -2155,10 +2230,11 @@ forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | |||
| 2155 | && from < stop | 2230 | && from < stop |
| 2156 | && SYNTAX_FLAGS_COMSTART_FIRST (syntax) | 2231 | && SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
| 2157 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2232 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| 2158 | SYNTAX_COMMENT_STYLE (c1) == style | 2233 | other_syntax = SYNTAX_WITH_FLAGS (c1), |
| 2159 | && SYNTAX_COMSTART_SECOND (c1)) | 2234 | SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax) == style |
| 2235 | && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) | ||
| 2160 | && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) || | 2236 | && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
| 2161 | SYNTAX_COMMENT_NESTED (c1))) | 2237 | SYNTAX_FLAGS_COMMENT_NESTED (other_syntax))) |
| 2162 | /* we have encountered a nested comment of the same style | 2238 | /* we have encountered a nested comment of the same style |
| 2163 | as the comment sequence which began this comment | 2239 | as the comment sequence which began this comment |
| 2164 | section */ | 2240 | section */ |
| @@ -2209,7 +2285,7 @@ between them, return t; otherwise return nil. */) | |||
| 2209 | { | 2285 | { |
| 2210 | do | 2286 | do |
| 2211 | { | 2287 | { |
| 2212 | int comstart_first; | 2288 | int comstart_first, syntax, other_syntax; |
| 2213 | 2289 | ||
| 2214 | if (from == stop) | 2290 | if (from == stop) |
| 2215 | { | 2291 | { |
| @@ -2218,15 +2294,17 @@ between them, return t; otherwise return nil. */) | |||
| 2218 | return Qnil; | 2294 | return Qnil; |
| 2219 | } | 2295 | } |
| 2220 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2296 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2297 | syntax = SYNTAX_WITH_FLAGS (c); | ||
| 2221 | code = SYNTAX (c); | 2298 | code = SYNTAX (c); |
| 2222 | comstart_first = SYNTAX_COMSTART_FIRST (c); | 2299 | comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); |
| 2223 | comnested = SYNTAX_COMMENT_NESTED (c); | 2300 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 2224 | comstyle = SYNTAX_COMMENT_STYLE (c); | 2301 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
| 2225 | INC_BOTH (from, from_byte); | 2302 | INC_BOTH (from, from_byte); |
| 2226 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2303 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2227 | if (from < stop && comstart_first | 2304 | if (from < stop && comstart_first |
| 2228 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2305 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| 2229 | SYNTAX_COMSTART_SECOND (c1))) | 2306 | other_syntax = SYNTAX_WITH_FLAGS (c1), |
| 2307 | SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))) | ||
| 2230 | { | 2308 | { |
| 2231 | /* We have encountered a comment start sequence and we | 2309 | /* We have encountered a comment start sequence and we |
| 2232 | are ignoring all text inside comments. We must record | 2310 | are ignoring all text inside comments. We must record |
| @@ -2234,8 +2312,9 @@ between them, return t; otherwise return nil. */) | |||
| 2234 | only a comment end of the same style actually ends | 2312 | only a comment end of the same style actually ends |
| 2235 | the comment section. */ | 2313 | the comment section. */ |
| 2236 | code = Scomment; | 2314 | code = Scomment; |
| 2237 | comstyle = SYNTAX_COMMENT_STYLE (c1); | 2315 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2238 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 2316 | comnested |
| 2317 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2239 | INC_BOTH (from, from_byte); | 2318 | INC_BOTH (from, from_byte); |
| 2240 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2319 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2241 | } | 2320 | } |
| @@ -2271,7 +2350,7 @@ between them, return t; otherwise return nil. */) | |||
| 2271 | { | 2350 | { |
| 2272 | while (1) | 2351 | while (1) |
| 2273 | { | 2352 | { |
| 2274 | int quoted; | 2353 | int quoted, syntax; |
| 2275 | 2354 | ||
| 2276 | if (from <= stop) | 2355 | if (from <= stop) |
| 2277 | { | 2356 | { |
| @@ -2284,15 +2363,17 @@ between them, return t; otherwise return nil. */) | |||
| 2284 | /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from). */ | 2363 | /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from). */ |
| 2285 | quoted = char_quoted (from, from_byte); | 2364 | quoted = char_quoted (from, from_byte); |
| 2286 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2365 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2366 | syntax = SYNTAX_WITH_FLAGS (c); | ||
| 2287 | code = SYNTAX (c); | 2367 | code = SYNTAX (c); |
| 2288 | comstyle = 0; | 2368 | comstyle = 0; |
| 2289 | comnested = SYNTAX_COMMENT_NESTED (c); | 2369 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 2290 | if (code == Sendcomment) | 2370 | if (code == Sendcomment) |
| 2291 | comstyle = SYNTAX_COMMENT_STYLE (c); | 2371 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
| 2292 | if (from > stop && SYNTAX_COMEND_SECOND (c) | 2372 | if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
| 2293 | && prev_char_comend_first (from, from_byte) | 2373 | && prev_char_comend_first (from, from_byte) |
| 2294 | && !char_quoted (from - 1, dec_bytepos (from_byte))) | 2374 | && !char_quoted (from - 1, dec_bytepos (from_byte))) |
| 2295 | { | 2375 | { |
| 2376 | int other_syntax; | ||
| 2296 | /* We must record the comment style encountered so that | 2377 | /* We must record the comment style encountered so that |
| 2297 | later, we can match only the proper comment begin | 2378 | later, we can match only the proper comment begin |
| 2298 | sequence of the same style. */ | 2379 | sequence of the same style. */ |
| @@ -2301,8 +2382,10 @@ between them, return t; otherwise return nil. */) | |||
| 2301 | /* Calling char_quoted, above, set up global syntax position | 2382 | /* Calling char_quoted, above, set up global syntax position |
| 2302 | at the new value of FROM. */ | 2383 | at the new value of FROM. */ |
| 2303 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2384 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2304 | comstyle = SYNTAX_COMMENT_STYLE (c1); | 2385 | other_syntax = SYNTAX_WITH_FLAGS (c1); |
| 2305 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 2386 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2387 | comnested | ||
| 2388 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2306 | } | 2389 | } |
| 2307 | 2390 | ||
| 2308 | if (code == Scomment_fence) | 2391 | if (code == Scomment_fence) |
| @@ -2349,7 +2432,7 @@ between them, return t; otherwise return nil. */) | |||
| 2349 | { | 2432 | { |
| 2350 | /* Failure: we should go back to the end of this | 2433 | /* Failure: we should go back to the end of this |
| 2351 | not-quite-endcomment. */ | 2434 | not-quite-endcomment. */ |
| 2352 | if (SYNTAX(c) != code) | 2435 | if (SYNTAX (c) != code) |
| 2353 | /* It was a two-char Sendcomment. */ | 2436 | /* It was a two-char Sendcomment. */ |
| 2354 | INC_BOTH (from, from_byte); | 2437 | INC_BOTH (from, from_byte); |
| 2355 | goto leave; | 2438 | goto leave; |
| @@ -2423,21 +2506,23 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2423 | { | 2506 | { |
| 2424 | while (from < stop) | 2507 | while (from < stop) |
| 2425 | { | 2508 | { |
| 2426 | int comstart_first, prefix; | 2509 | int comstart_first, prefix, syntax, other_syntax; |
| 2427 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2510 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2428 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2511 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2512 | syntax = SYNTAX_WITH_FLAGS (c); | ||
| 2429 | code = SYNTAX_WITH_MULTIBYTE_CHECK (c); | 2513 | code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
| 2430 | comstart_first = SYNTAX_COMSTART_FIRST (c); | 2514 | comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); |
| 2431 | comnested = SYNTAX_COMMENT_NESTED (c); | 2515 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 2432 | comstyle = SYNTAX_COMMENT_STYLE (c); | 2516 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
| 2433 | prefix = SYNTAX_PREFIX (c); | 2517 | prefix = SYNTAX_FLAGS_PREFIX (syntax); |
| 2434 | if (depth == min_depth) | 2518 | if (depth == min_depth) |
| 2435 | last_good = from; | 2519 | last_good = from; |
| 2436 | INC_BOTH (from, from_byte); | 2520 | INC_BOTH (from, from_byte); |
| 2437 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2521 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2438 | if (from < stop && comstart_first | 2522 | if (from < stop && comstart_first |
| 2439 | && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2523 | && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| 2440 | SYNTAX_COMSTART_SECOND (c)) | 2524 | other_syntax = SYNTAX_WITH_FLAGS (c), |
| 2525 | SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) | ||
| 2441 | && parse_sexp_ignore_comments) | 2526 | && parse_sexp_ignore_comments) |
| 2442 | { | 2527 | { |
| 2443 | /* we have encountered a comment start sequence and we | 2528 | /* we have encountered a comment start sequence and we |
| @@ -2446,9 +2531,9 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2446 | only a comment end of the same style actually ends | 2531 | only a comment end of the same style actually ends |
| 2447 | the comment section */ | 2532 | the comment section */ |
| 2448 | code = Scomment; | 2533 | code = Scomment; |
| 2449 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2534 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2450 | comstyle = SYNTAX_COMMENT_STYLE (c1); | 2535 | comnested |
| 2451 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 2536 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2452 | INC_BOTH (from, from_byte); | 2537 | INC_BOTH (from, from_byte); |
| 2453 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2538 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2454 | } | 2539 | } |
| @@ -2592,29 +2677,34 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2592 | { | 2677 | { |
| 2593 | while (from > stop) | 2678 | while (from > stop) |
| 2594 | { | 2679 | { |
| 2680 | int syntax; | ||
| 2595 | DEC_BOTH (from, from_byte); | 2681 | DEC_BOTH (from, from_byte); |
| 2596 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2682 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2597 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2683 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2684 | syntax= SYNTAX_WITH_FLAGS (c); | ||
| 2598 | code = SYNTAX_WITH_MULTIBYTE_CHECK (c); | 2685 | code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
| 2599 | if (depth == min_depth) | 2686 | if (depth == min_depth) |
| 2600 | last_good = from; | 2687 | last_good = from; |
| 2601 | comstyle = 0; | 2688 | comstyle = 0; |
| 2602 | comnested = SYNTAX_COMMENT_NESTED (c); | 2689 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 2603 | if (code == Sendcomment) | 2690 | if (code == Sendcomment) |
| 2604 | comstyle = SYNTAX_COMMENT_STYLE (c); | 2691 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
| 2605 | if (from > stop && SYNTAX_COMEND_SECOND (c) | 2692 | if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
| 2606 | && prev_char_comend_first (from, from_byte) | 2693 | && prev_char_comend_first (from, from_byte) |
| 2607 | && parse_sexp_ignore_comments) | 2694 | && parse_sexp_ignore_comments) |
| 2608 | { | 2695 | { |
| 2609 | /* We must record the comment style encountered so that | 2696 | /* We must record the comment style encountered so that |
| 2610 | later, we can match only the proper comment begin | 2697 | later, we can match only the proper comment begin |
| 2611 | sequence of the same style. */ | 2698 | sequence of the same style. */ |
| 2699 | int c1, other_syntax; | ||
| 2612 | DEC_BOTH (from, from_byte); | 2700 | DEC_BOTH (from, from_byte); |
| 2613 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2701 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2614 | code = Sendcomment; | 2702 | code = Sendcomment; |
| 2615 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2703 | c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2616 | comstyle = SYNTAX_COMMENT_STYLE (c1); | 2704 | other_syntax = SYNTAX_WITH_FLAGS (c1); |
| 2617 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 2705 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2706 | comnested | ||
| 2707 | = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | ||
| 2618 | } | 2708 | } |
| 2619 | 2709 | ||
| 2620 | /* Quoting turns anything except a comment-ender | 2710 | /* Quoting turns anything except a comment-ender |
| @@ -2625,7 +2715,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf | |||
| 2625 | DEC_BOTH (from, from_byte); | 2715 | DEC_BOTH (from, from_byte); |
| 2626 | code = Sword; | 2716 | code = Sword; |
| 2627 | } | 2717 | } |
| 2628 | else if (SYNTAX_PREFIX (c)) | 2718 | else if (SYNTAX_FLAGS_PREFIX (syntax)) |
| 2629 | continue; | 2719 | continue; |
| 2630 | 2720 | ||
| 2631 | switch (SWITCH_ENUM_CAST (code)) | 2721 | switch (SWITCH_ENUM_CAST (code)) |
| @@ -2949,8 +3039,11 @@ do { prev_from = from; \ | |||
| 2949 | oldstate = Fcdr (oldstate); | 3039 | oldstate = Fcdr (oldstate); |
| 2950 | oldstate = Fcdr (oldstate); | 3040 | oldstate = Fcdr (oldstate); |
| 2951 | tem = Fcar (oldstate); | 3041 | tem = Fcar (oldstate); |
| 2952 | state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table) | 3042 | state.comstyle = (NILP (tem) |
| 2953 | ? ST_COMMENT_STYLE : 1); | 3043 | ? 0 |
| 3044 | : (EQ (tem, Qsyntax_table) | ||
| 3045 | ? ST_COMMENT_STYLE | ||
| 3046 | : INTEGERP (tem) ? XINT (tem) : 1)); | ||
| 2954 | 3047 | ||
| 2955 | oldstate = Fcdr (oldstate); | 3048 | oldstate = Fcdr (oldstate); |
| 2956 | tem = Fcar (oldstate); | 3049 | tem = Fcar (oldstate); |
| @@ -2995,22 +3088,25 @@ do { prev_from = from; \ | |||
| 2995 | 3088 | ||
| 2996 | while (from < end) | 3089 | while (from < end) |
| 2997 | { | 3090 | { |
| 3091 | int syntax; | ||
| 2998 | INC_FROM; | 3092 | INC_FROM; |
| 2999 | code = prev_from_syntax & 0xff; | 3093 | code = prev_from_syntax & 0xff; |
| 3000 | 3094 | ||
| 3001 | if (from < end | 3095 | if (from < end |
| 3002 | && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) | 3096 | && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) |
| 3003 | && (c1 = FETCH_CHAR (from_byte), | 3097 | && (c1 = FETCH_CHAR (from_byte), |
| 3004 | SYNTAX_COMSTART_SECOND (c1))) | 3098 | syntax = SYNTAX_WITH_FLAGS (c1), |
| 3099 | SYNTAX_FLAGS_COMSTART_SECOND (syntax))) | ||
| 3005 | /* Duplicate code to avoid a complex if-expression | 3100 | /* Duplicate code to avoid a complex if-expression |
| 3006 | which causes trouble for the SGI compiler. */ | 3101 | which causes trouble for the SGI compiler. */ |
| 3007 | { | 3102 | { |
| 3008 | /* Record the comment style we have entered so that only | 3103 | /* Record the comment style we have entered so that only |
| 3009 | the comment-end sequence of the same style actually | 3104 | the comment-end sequence of the same style actually |
| 3010 | terminates the comment section. */ | 3105 | terminates the comment section. */ |
| 3011 | state.comstyle = SYNTAX_COMMENT_STYLE (c1); | 3106 | state.comstyle |
| 3107 | = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); | ||
| 3012 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); | 3108 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); |
| 3013 | comnested = comnested || SYNTAX_COMMENT_NESTED (c1); | 3109 | comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 3014 | state.incomment = comnested ? 1 : -1; | 3110 | state.incomment = comnested ? 1 : -1; |
| 3015 | state.comstr_start = prev_from; | 3111 | state.comstr_start = prev_from; |
| 3016 | INC_FROM; | 3112 | INC_FROM; |
| @@ -3028,7 +3124,7 @@ do { prev_from = from; \ | |||
| 3028 | } | 3124 | } |
| 3029 | else if (code == Scomment) | 3125 | else if (code == Scomment) |
| 3030 | { | 3126 | { |
| 3031 | state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax); | 3127 | state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax, 0); |
| 3032 | state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? | 3128 | state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? |
| 3033 | 1 : -1); | 3129 | 1 : -1); |
| 3034 | state.comstr_start = prev_from; | 3130 | state.comstr_start = prev_from; |
| @@ -3221,8 +3317,7 @@ Value is a list of elements describing final state of parsing: | |||
| 3221 | else an integer (the current comment nesting). | 3317 | else an integer (the current comment nesting). |
| 3222 | 5. t if following a quote character. | 3318 | 5. t if following a quote character. |
| 3223 | 6. the minimum paren-depth encountered during this scan. | 3319 | 6. the minimum paren-depth encountered during this scan. |
| 3224 | 7. t if in a comment of style b; symbol `syntax-table' if the comment | 3320 | 7. style of comment, if any. |
| 3225 | should be terminated by a generic comment delimiter. | ||
| 3226 | 8. character address of start of comment or string; nil if not in one. | 3321 | 8. character address of start of comment or string; nil if not in one. |
| 3227 | 9. Intermediate data for continuation of parsing (subject to change). | 3322 | 9. Intermediate data for continuation of parsing (subject to change). |
| 3228 | If third arg TARGETDEPTH is non-nil, parsing stops if the depth | 3323 | If third arg TARGETDEPTH is non-nil, parsing stops if the depth |
| @@ -3258,8 +3353,10 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | |||
| 3258 | SET_PT (state.location); | 3353 | SET_PT (state.location); |
| 3259 | 3354 | ||
| 3260 | return Fcons (make_number (state.depth), | 3355 | return Fcons (make_number (state.depth), |
| 3261 | Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart), | 3356 | Fcons (state.prevlevelstart < 0 |
| 3262 | Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart), | 3357 | ? Qnil : make_number (state.prevlevelstart), |
| 3358 | Fcons (state.thislevelstart < 0 | ||
| 3359 | ? Qnil : make_number (state.thislevelstart), | ||
| 3263 | Fcons (state.instring >= 0 | 3360 | Fcons (state.instring >= 0 |
| 3264 | ? (state.instring == ST_STRING_STYLE | 3361 | ? (state.instring == ST_STRING_STYLE |
| 3265 | ? Qt : make_number (state.instring)) : Qnil, | 3362 | ? Qt : make_number (state.instring)) : Qnil, |
| @@ -3270,8 +3367,9 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | |||
| 3270 | Fcons (make_number (state.mindepth), | 3367 | Fcons (make_number (state.mindepth), |
| 3271 | Fcons ((state.comstyle | 3368 | Fcons ((state.comstyle |
| 3272 | ? (state.comstyle == ST_COMMENT_STYLE | 3369 | ? (state.comstyle == ST_COMMENT_STYLE |
| 3273 | ? Qsyntax_table : Qt) : | 3370 | ? Qsyntax_table |
| 3274 | Qnil), | 3371 | : make_number (state.comstyle)) |
| 3372 | : Qnil), | ||
| 3275 | Fcons (((state.incomment | 3373 | Fcons (((state.incomment |
| 3276 | || (state.instring >= 0)) | 3374 | || (state.instring >= 0)) |
| 3277 | ? make_number (state.comstr_start) | 3375 | ? make_number (state.comstr_start) |
diff --git a/src/syntax.h b/src/syntax.h index 9eaf553f2e5..48146572d19 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -128,56 +128,9 @@ extern Lisp_Object syntax_temp; | |||
| 128 | : Qnil)) | 128 | : Qnil)) |
| 129 | #endif | 129 | #endif |
| 130 | 130 | ||
| 131 | /* Then there are seven single-bit flags that have the following meanings: | ||
| 132 | 1. This character is the first of a two-character comment-start sequence. | ||
| 133 | 2. This character is the second of a two-character comment-start sequence. | ||
| 134 | 3. This character is the first of a two-character comment-end sequence. | ||
| 135 | 4. This character is the second of a two-character comment-end sequence. | ||
| 136 | 5. This character is a prefix, for backward-prefix-chars. | ||
| 137 | 6. see below | ||
| 138 | 7. This character is part of a nestable comment sequence. | ||
| 139 | Note that any two-character sequence whose first character has flag 1 | ||
| 140 | and whose second character has flag 2 will be interpreted as a comment start. | ||
| 141 | 131 | ||
| 142 | bit 6 is used to discriminate between two different comment styles. | 132 | /* Whether the syntax of the character C has the prefix flag set. */ |
| 143 | Languages such as C++ allow two orthogonal syntax start/end pairs | 133 | extern int syntax_prefix_flag_p (int c); |
| 144 | and bit 6 is used to determine whether a comment-end or Scommentend | ||
| 145 | ends style a or b. Comment start sequences can start style a or b. | ||
| 146 | Style a is always the default. | ||
| 147 | */ | ||
| 148 | |||
| 149 | /* These macros extract a particular flag for a given character. */ | ||
| 150 | |||
| 151 | #define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1) | ||
| 152 | |||
| 153 | #define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1) | ||
| 154 | |||
| 155 | #define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1) | ||
| 156 | |||
| 157 | #define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1) | ||
| 158 | |||
| 159 | #define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1) | ||
| 160 | |||
| 161 | #define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1) | ||
| 162 | |||
| 163 | #define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1) | ||
| 164 | |||
| 165 | /* These macros extract specific flags from an integer | ||
| 166 | that holds the syntax code and the flags. */ | ||
| 167 | |||
| 168 | #define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1) | ||
| 169 | |||
| 170 | #define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1) | ||
| 171 | |||
| 172 | #define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1) | ||
| 173 | |||
| 174 | #define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1) | ||
| 175 | |||
| 176 | #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) | ||
| 177 | |||
| 178 | #define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1) | ||
| 179 | |||
| 180 | #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) | ||
| 181 | 134 | ||
| 182 | /* This array, indexed by a character, contains the syntax code which that | 135 | /* This array, indexed by a character, contains the syntax code which that |
| 183 | character signifies (as a char). For example, | 136 | character signifies (as a char). For example, |
diff --git a/src/sysdep.c b/src/sysdep.c index 2ae3c509522..e7d35d46bf7 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -35,15 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | #include "lisp.h" | 37 | #include "lisp.h" |
| 38 | /* Including stdlib.h isn't necessarily enough to get srandom | ||
| 39 | declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2. */ | ||
| 40 | |||
| 41 | /* The w32 build defines select stuff in w32.h, which is included by | ||
| 42 | sys/select.h (included below). */ | ||
| 43 | #ifndef WINDOWSNT | ||
| 44 | #include "sysselect.h" | 38 | #include "sysselect.h" |
| 45 | #endif | ||
| 46 | |||
| 47 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| 48 | 40 | ||
| 49 | #ifdef WINDOWSNT | 41 | #ifdef WINDOWSNT |
| @@ -84,17 +76,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 84 | #include <fcntl.h> | 76 | #include <fcntl.h> |
| 85 | #endif | 77 | #endif |
| 86 | 78 | ||
| 87 | #ifndef MSDOS | ||
| 88 | #include <sys/ioctl.h> | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #include "systty.h" | 79 | #include "systty.h" |
| 92 | #include "syswait.h" | 80 | #include "syswait.h" |
| 93 | 81 | ||
| 94 | #if defined (USG) | 82 | #ifdef HAVE_SYS_UTSNAME_H |
| 95 | #include <sys/utsname.h> | 83 | #include <sys/utsname.h> |
| 96 | #include <memory.h> | 84 | #include <memory.h> |
| 97 | #endif /* USG */ | 85 | #endif /* HAVE_SYS_UTSNAME_H */ |
| 98 | 86 | ||
| 99 | #include "keyboard.h" | 87 | #include "keyboard.h" |
| 100 | #include "frame.h" | 88 | #include "frame.h" |
| @@ -149,17 +137,6 @@ static const int baud_convert[] = | |||
| 149 | 1800, 2400, 4800, 9600, 19200, 38400 | 137 | 1800, 2400, 4800, 9600, 19200, 38400 |
| 150 | }; | 138 | }; |
| 151 | 139 | ||
| 152 | #ifdef HAVE_SPEED_T | ||
| 153 | #include <termios.h> | ||
| 154 | #else | ||
| 155 | #if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T) | ||
| 156 | #else | ||
| 157 | #if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX) | ||
| 158 | #include <termios.h> | ||
| 159 | #endif | ||
| 160 | #endif | ||
| 161 | #endif | ||
| 162 | |||
| 163 | int emacs_ospeed; | 140 | int emacs_ospeed; |
| 164 | 141 | ||
| 165 | void croak (char *) NO_RETURN; | 142 | void croak (char *) NO_RETURN; |
| @@ -308,32 +285,11 @@ init_baud_rate (int fd) | |||
| 308 | #ifdef DOS_NT | 285 | #ifdef DOS_NT |
| 309 | emacs_ospeed = 15; | 286 | emacs_ospeed = 15; |
| 310 | #else /* not DOS_NT */ | 287 | #else /* not DOS_NT */ |
| 311 | #ifdef HAVE_TERMIOS | ||
| 312 | struct termios sg; | 288 | struct termios sg; |
| 313 | 289 | ||
| 314 | sg.c_cflag = B9600; | 290 | sg.c_cflag = B9600; |
| 315 | tcgetattr (fd, &sg); | 291 | tcgetattr (fd, &sg); |
| 316 | emacs_ospeed = cfgetospeed (&sg); | 292 | emacs_ospeed = cfgetospeed (&sg); |
| 317 | #else /* not TERMIOS */ | ||
| 318 | #ifdef HAVE_TERMIO | ||
| 319 | struct termio sg; | ||
| 320 | |||
| 321 | sg.c_cflag = B9600; | ||
| 322 | #ifdef HAVE_TCATTR | ||
| 323 | tcgetattr (fd, &sg); | ||
| 324 | #else | ||
| 325 | ioctl (fd, TCGETA, &sg); | ||
| 326 | #endif | ||
| 327 | emacs_ospeed = sg.c_cflag & CBAUD; | ||
| 328 | #else /* neither TERMIOS nor TERMIO */ | ||
| 329 | struct sgttyb sg; | ||
| 330 | |||
| 331 | sg.sg_ospeed = B9600; | ||
| 332 | if (ioctl (fd, TIOCGETP, &sg) < 0) | ||
| 333 | abort (); | ||
| 334 | emacs_ospeed = sg.sg_ospeed; | ||
| 335 | #endif /* not HAVE_TERMIO */ | ||
| 336 | #endif /* not HAVE_TERMIOS */ | ||
| 337 | #endif /* not DOS_NT */ | 293 | #endif /* not DOS_NT */ |
| 338 | } | 294 | } |
| 339 | 295 | ||
| @@ -417,7 +373,7 @@ wait_for_termination (int pid) | |||
| 417 | void | 373 | void |
| 418 | flush_pending_output (int channel) | 374 | flush_pending_output (int channel) |
| 419 | { | 375 | { |
| 420 | #ifdef HAVE_TERMIOS | 376 | #ifndef DOS_NT |
| 421 | /* If we try this, we get hit with SIGTTIN, because | 377 | /* If we try this, we get hit with SIGTTIN, because |
| 422 | the child's tty belongs to the child's pgrp. */ | 378 | the child's tty belongs to the child's pgrp. */ |
| 423 | #else | 379 | #else |
| @@ -447,8 +403,6 @@ child_setup_tty (int out) | |||
| 447 | struct emacs_tty s; | 403 | struct emacs_tty s; |
| 448 | 404 | ||
| 449 | EMACS_GET_TTY (out, &s); | 405 | EMACS_GET_TTY (out, &s); |
| 450 | |||
| 451 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | ||
| 452 | s.main.c_oflag |= OPOST; /* Enable output postprocessing */ | 406 | s.main.c_oflag |= OPOST; /* Enable output postprocessing */ |
| 453 | s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ | 407 | s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ |
| 454 | #ifdef NLDLY | 408 | #ifdef NLDLY |
| @@ -526,19 +480,7 @@ child_setup_tty (int out) | |||
| 526 | s.main.c_cc[VTIME] = 0; | 480 | s.main.c_cc[VTIME] = 0; |
| 527 | #endif | 481 | #endif |
| 528 | 482 | ||
| 529 | #else /* not HAVE_TERMIO */ | ||
| 530 | |||
| 531 | s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE | ||
| 532 | | CBREAK | TANDEM); | ||
| 533 | s.main.sg_flags |= LPASS8; | ||
| 534 | s.main.sg_erase = 0377; | ||
| 535 | s.main.sg_kill = 0377; | ||
| 536 | s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ | ||
| 537 | |||
| 538 | #endif /* not HAVE_TERMIO */ | ||
| 539 | |||
| 540 | EMACS_SET_TTY (out, &s, 0); | 483 | EMACS_SET_TTY (out, &s, 0); |
| 541 | |||
| 542 | #endif /* not WINDOWSNT */ | 484 | #endif /* not WINDOWSNT */ |
| 543 | } | 485 | } |
| 544 | #endif /* MSDOS */ | 486 | #endif /* MSDOS */ |
| @@ -841,38 +783,11 @@ int | |||
| 841 | emacs_get_tty (int fd, struct emacs_tty *settings) | 783 | emacs_get_tty (int fd, struct emacs_tty *settings) |
| 842 | { | 784 | { |
| 843 | /* Retrieve the primary parameters - baud rate, character size, etcetera. */ | 785 | /* Retrieve the primary parameters - baud rate, character size, etcetera. */ |
| 844 | #ifdef HAVE_TCATTR | 786 | #ifndef DOS_NT |
| 845 | /* We have those nifty POSIX tcmumbleattr functions. */ | 787 | /* We have those nifty POSIX tcmumbleattr functions. */ |
| 846 | memset (&settings->main, 0, sizeof (settings->main)); | 788 | memset (&settings->main, 0, sizeof (settings->main)); |
| 847 | if (tcgetattr (fd, &settings->main) < 0) | 789 | if (tcgetattr (fd, &settings->main) < 0) |
| 848 | return -1; | 790 | return -1; |
| 849 | |||
| 850 | #else | ||
| 851 | #ifdef HAVE_TERMIO | ||
| 852 | /* The SYSV-style interface? */ | ||
| 853 | if (ioctl (fd, TCGETA, &settings->main) < 0) | ||
| 854 | return -1; | ||
| 855 | |||
| 856 | #else | ||
| 857 | #ifndef DOS_NT | ||
| 858 | /* I give up - I hope you have the BSD ioctls. */ | ||
| 859 | if (ioctl (fd, TIOCGETP, &settings->main) < 0) | ||
| 860 | return -1; | ||
| 861 | #endif /* not DOS_NT */ | ||
| 862 | #endif | ||
| 863 | #endif | ||
| 864 | |||
| 865 | /* Suivant - Do we have to get struct ltchars data? */ | ||
| 866 | #ifdef HAVE_LTCHARS | ||
| 867 | if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0) | ||
| 868 | return -1; | ||
| 869 | #endif | ||
| 870 | |||
| 871 | /* How about a struct tchars and a wordful of lmode bits? */ | ||
| 872 | #ifdef HAVE_TCHARS | ||
| 873 | if (ioctl (fd, TIOCGETC, &settings->tchars) < 0 | ||
| 874 | || ioctl (fd, TIOCLGET, &settings->lmode) < 0) | ||
| 875 | return -1; | ||
| 876 | #endif | 791 | #endif |
| 877 | 792 | ||
| 878 | /* We have survived the tempest. */ | 793 | /* We have survived the tempest. */ |
| @@ -888,7 +803,7 @@ int | |||
| 888 | emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) | 803 | emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) |
| 889 | { | 804 | { |
| 890 | /* Set the primary parameters - baud rate, character size, etcetera. */ | 805 | /* Set the primary parameters - baud rate, character size, etcetera. */ |
| 891 | #ifdef HAVE_TCATTR | 806 | #ifndef DOS_NT |
| 892 | int i; | 807 | int i; |
| 893 | /* We have those nifty POSIX tcmumbleattr functions. | 808 | /* We have those nifty POSIX tcmumbleattr functions. |
| 894 | William J. Smith <wjs@wiis.wang.com> writes: | 809 | William J. Smith <wjs@wiis.wang.com> writes: |
| @@ -926,34 +841,6 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) | |||
| 926 | else | 841 | else |
| 927 | continue; | 842 | continue; |
| 928 | } | 843 | } |
| 929 | |||
| 930 | #else | ||
| 931 | #ifdef HAVE_TERMIO | ||
| 932 | /* The SYSV-style interface? */ | ||
| 933 | if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0) | ||
| 934 | return -1; | ||
| 935 | |||
| 936 | #else | ||
| 937 | #ifndef DOS_NT | ||
| 938 | /* I give up - I hope you have the BSD ioctls. */ | ||
| 939 | if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0) | ||
| 940 | return -1; | ||
| 941 | #endif /* not DOS_NT */ | ||
| 942 | |||
| 943 | #endif | ||
| 944 | #endif | ||
| 945 | |||
| 946 | /* Suivant - Do we have to get struct ltchars data? */ | ||
| 947 | #ifdef HAVE_LTCHARS | ||
| 948 | if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0) | ||
| 949 | return -1; | ||
| 950 | #endif | ||
| 951 | |||
| 952 | /* How about a struct tchars and a wordful of lmode bits? */ | ||
| 953 | #ifdef HAVE_TCHARS | ||
| 954 | if (ioctl (fd, TIOCSETC, &settings->tchars) < 0 | ||
| 955 | || ioctl (fd, TIOCLSET, &settings->lmode) < 0) | ||
| 956 | return -1; | ||
| 957 | #endif | 844 | #endif |
| 958 | 845 | ||
| 959 | /* We have survived the tempest. */ | 846 | /* We have survived the tempest. */ |
| @@ -976,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8]; | |||
| 976 | char _sobuf[BUFSIZ]; | 863 | char _sobuf[BUFSIZ]; |
| 977 | #endif | 864 | #endif |
| 978 | 865 | ||
| 979 | #ifdef HAVE_LTCHARS | ||
| 980 | static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1}; | ||
| 981 | #endif | ||
| 982 | #ifdef HAVE_TCHARS | ||
| 983 | static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1}; | ||
| 984 | #endif | ||
| 985 | |||
| 986 | /* Initialize the terminal mode on all tty devices that are currently | 866 | /* Initialize the terminal mode on all tty devices that are currently |
| 987 | open. */ | 867 | open. */ |
| 988 | 868 | ||
| @@ -1016,7 +896,7 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1016 | 896 | ||
| 1017 | tty = *tty_out->old_tty; | 897 | tty = *tty_out->old_tty; |
| 1018 | 898 | ||
| 1019 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 899 | #if !defined (DOS_NT) |
| 1020 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); | 900 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); |
| 1021 | 901 | ||
| 1022 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ | 902 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ |
| @@ -1088,12 +968,11 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1088 | of C-z */ | 968 | of C-z */ |
| 1089 | #endif /* VSWTCH */ | 969 | #endif /* VSWTCH */ |
| 1090 | 970 | ||
| 1091 | #if defined (__mips__) || defined (HAVE_TCATTR) | ||
| 1092 | #ifdef VSUSP | 971 | #ifdef VSUSP |
| 1093 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ | 972 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off handling of C-z. */ |
| 1094 | #endif /* VSUSP */ | 973 | #endif /* VSUSP */ |
| 1095 | #ifdef V_DSUSP | 974 | #ifdef V_DSUSP |
| 1096 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ | 975 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y. */ |
| 1097 | #endif /* V_DSUSP */ | 976 | #endif /* V_DSUSP */ |
| 1098 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ | 977 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ |
| 1099 | tty.main.c_cc[VDSUSP] = CDISABLE; | 978 | tty.main.c_cc[VDSUSP] = CDISABLE; |
| @@ -1129,7 +1008,6 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1129 | tty.main.c_cc[VSTOP] = CDISABLE; | 1008 | tty.main.c_cc[VSTOP] = CDISABLE; |
| 1130 | #endif /* VSTOP */ | 1009 | #endif /* VSTOP */ |
| 1131 | } | 1010 | } |
| 1132 | #endif /* mips or HAVE_TCATTR */ | ||
| 1133 | 1011 | ||
| 1134 | #ifdef AIX | 1012 | #ifdef AIX |
| 1135 | tty.main.c_cc[VSTRT] = CDISABLE; | 1013 | tty.main.c_cc[VSTRT] = CDISABLE; |
| @@ -1152,41 +1030,8 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1152 | tty.main.c_iflag &= ~IGNBRK; | 1030 | tty.main.c_iflag &= ~IGNBRK; |
| 1153 | tty.main.c_iflag &= ~BRKINT; | 1031 | tty.main.c_iflag &= ~BRKINT; |
| 1154 | #endif | 1032 | #endif |
| 1155 | #else /* if not HAVE_TERMIO */ | ||
| 1156 | #ifndef DOS_NT | ||
| 1157 | XSETINT (Vtty_erase_char, tty.main.sg_erase); | ||
| 1158 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); | ||
| 1159 | if (meta_key) | ||
| 1160 | tty.main.sg_flags |= ANYP; | ||
| 1161 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; | ||
| 1162 | #endif /* not DOS_NT */ | 1033 | #endif /* not DOS_NT */ |
| 1163 | #endif /* not HAVE_TERMIO */ | ||
| 1164 | |||
| 1165 | /* If going to use CBREAK mode, we must request C-g to interrupt | ||
| 1166 | and turn off start and stop chars, etc. If not going to use | ||
| 1167 | CBREAK mode, do this anyway so as to turn off local flow | ||
| 1168 | control for user coming over network on 4.2; in this case, | ||
| 1169 | only t_stopc and t_startc really matter. */ | ||
| 1170 | #ifndef HAVE_TERMIO | ||
| 1171 | #ifdef HAVE_TCHARS | ||
| 1172 | /* Note: if not using CBREAK mode, it makes no difference how we | ||
| 1173 | set this */ | ||
| 1174 | tty.tchars = new_tchars; | ||
| 1175 | tty.tchars.t_intrc = quit_char; | ||
| 1176 | if (tty_out->flow_control) | ||
| 1177 | { | ||
| 1178 | tty.tchars.t_startc = '\021'; | ||
| 1179 | tty.tchars.t_stopc = '\023'; | ||
| 1180 | } | ||
| 1181 | 1034 | ||
| 1182 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; | ||
| 1183 | |||
| 1184 | #endif /* HAVE_TCHARS */ | ||
| 1185 | #endif /* not HAVE_TERMIO */ | ||
| 1186 | |||
| 1187 | #ifdef HAVE_LTCHARS | ||
| 1188 | tty.ltchars = new_ltchars; | ||
| 1189 | #endif /* HAVE_LTCHARS */ | ||
| 1190 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ | 1035 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ |
| 1191 | if (!tty_out->term_initted) | 1036 | if (!tty_out->term_initted) |
| 1192 | internal_terminal_init (); | 1037 | internal_terminal_init (); |
| @@ -1205,7 +1050,7 @@ init_sys_modes (struct tty_display_info *tty_out) | |||
| 1205 | if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); | 1050 | if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); |
| 1206 | #endif | 1051 | #endif |
| 1207 | 1052 | ||
| 1208 | #if defined (HAVE_TERMIOS) || defined (HPUX) | 1053 | #if !defined (DOS_NT) |
| 1209 | #ifdef TCOON | 1054 | #ifdef TCOON |
| 1210 | if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); | 1055 | if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); |
| 1211 | #endif | 1056 | #endif |
| @@ -2688,7 +2533,7 @@ strsignal (int code) | |||
| 2688 | } | 2533 | } |
| 2689 | #endif /* HAVE_STRSIGNAL */ | 2534 | #endif /* HAVE_STRSIGNAL */ |
| 2690 | 2535 | ||
| 2691 | #ifdef HAVE_TERMIOS | 2536 | #ifndef DOS_NT |
| 2692 | /* For make-serial-process */ | 2537 | /* For make-serial-process */ |
| 2693 | int | 2538 | int |
| 2694 | serial_open (char *port) | 2539 | serial_open (char *port) |
| @@ -2717,9 +2562,6 @@ serial_open (char *port) | |||
| 2717 | 2562 | ||
| 2718 | return fd; | 2563 | return fd; |
| 2719 | } | 2564 | } |
| 2720 | #endif /* TERMIOS */ | ||
| 2721 | |||
| 2722 | #ifdef HAVE_TERMIOS | ||
| 2723 | 2565 | ||
| 2724 | #if !defined (HAVE_CFMAKERAW) | 2566 | #if !defined (HAVE_CFMAKERAW) |
| 2725 | /* Workaround for targets which are missing cfmakeraw. */ | 2567 | /* Workaround for targets which are missing cfmakeraw. */ |
| @@ -2906,7 +2748,7 @@ serial_configure (struct Lisp_Process *p, | |||
| 2906 | p->childp = childp2; | 2748 | p->childp = childp2; |
| 2907 | 2749 | ||
| 2908 | } | 2750 | } |
| 2909 | #endif /* TERMIOS */ | 2751 | #endif /* not DOS_NT */ |
| 2910 | 2752 | ||
| 2911 | /* System depended enumeration of and access to system processes a-la ps(1). */ | 2753 | /* System depended enumeration of and access to system processes a-la ps(1). */ |
| 2912 | 2754 | ||
diff --git a/src/sysselect.h b/src/sysselect.h index ddb3e91f2e3..0c90814390c 100644 --- a/src/sysselect.h +++ b/src/sysselect.h | |||
| @@ -27,6 +27,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | #endif | 27 | #endif |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | /* The w32 build defines select stuff in w32.h, which is included | ||
| 31 | where w32 needs it, but not where sysselect.h is included. The w32 | ||
| 32 | definitions in w32.h are incompatible with the below. */ | ||
| 33 | #ifndef WINDOWSNT | ||
| 30 | #ifdef FD_SET | 34 | #ifdef FD_SET |
| 31 | #ifdef FD_SETSIZE | 35 | #ifdef FD_SETSIZE |
| 32 | #define MAXDESC FD_SETSIZE | 36 | #define MAXDESC FD_SETSIZE |
| @@ -44,6 +48,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 44 | #define FD_ISSET(n, p) (*(p) & (1 << (n))) | 48 | #define FD_ISSET(n, p) (*(p) & (1 << (n))) |
| 45 | #define FD_ZERO(p) (*(p) = 0) | 49 | #define FD_ZERO(p) (*(p) = 0) |
| 46 | #endif /* no FD_SET */ | 50 | #endif /* no FD_SET */ |
| 51 | #endif /* not WINDOWSNT */ | ||
| 47 | 52 | ||
| 48 | #if !defined (HAVE_SELECT) | 53 | #if !defined (HAVE_SELECT) |
| 49 | #define select sys_select | 54 | #define select sys_select |
diff --git a/src/systty.h b/src/systty.h index 39feef9c3d0..8c46411cedb 100644 --- a/src/systty.h +++ b/src/systty.h | |||
| @@ -17,34 +17,17 @@ GNU General Public License for more details. | |||
| 17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | #ifdef HAVE_TERMIOS | ||
| 21 | #define HAVE_TCATTR | ||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
| 25 | /* Include the proper files. */ | 20 | /* Include the proper files. */ |
| 26 | #ifdef HAVE_TERMIO | 21 | #ifndef DOS_NT |
| 27 | #ifndef NO_TERMIO | 22 | #ifndef NO_TERMIO |
| 28 | #include <termio.h> | 23 | #include <termio.h> |
| 29 | #endif /* not NO_TERMIO */ | 24 | #endif /* not NO_TERMIO */ |
| 30 | #include <fcntl.h> | ||
| 31 | #else /* not HAVE_TERMIO */ | ||
| 32 | #ifdef HAVE_TERMIOS | ||
| 33 | #ifndef NO_TERMIO | ||
| 34 | #include <termio.h> | ||
| 35 | #endif | ||
| 36 | #include <termios.h> | 25 | #include <termios.h> |
| 37 | #include <fcntl.h> | 26 | #include <fcntl.h> |
| 38 | #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | ||
| 39 | #ifndef DOS_NT | ||
| 40 | #include <sgtty.h> | ||
| 41 | #endif /* not DOS_NT */ | 27 | #endif /* not DOS_NT */ |
| 42 | #endif /* not HAVE_TERMIOS */ | ||
| 43 | #endif /* not HAVE_TERMIO */ | ||
| 44 | 28 | ||
| 45 | #ifdef __GNU_LIBRARY__ | 29 | #ifdef HAVE_SYS_IOCTL_H |
| 46 | #include <sys/ioctl.h> | 30 | #include <sys/ioctl.h> |
| 47 | #include <termios.h> | ||
| 48 | #endif | 31 | #endif |
| 49 | 32 | ||
| 50 | #ifdef HPUX | 33 | #ifdef HPUX |
| @@ -74,17 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 74 | #undef SIGIO | 57 | #undef SIGIO |
| 75 | #endif | 58 | #endif |
| 76 | 59 | ||
| 77 | /* On TERMIOS systems, the tcmumbleattr calls take care of these | ||
| 78 | parameters, and it's a bad idea to use them (on AIX, it makes the | ||
| 79 | tty hang for a long time). */ | ||
| 80 | #if defined (TIOCGLTC) && !defined (HAVE_TERMIOS) | ||
| 81 | #define HAVE_LTCHARS | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #if defined (TIOCGETC) && !defined (HAVE_TERMIOS) | ||
| 85 | #define HAVE_TCHARS | ||
| 86 | #endif | ||
| 87 | |||
| 88 | 60 | ||
| 89 | /* Try to establish the correct character to disable terminal functions | 61 | /* Try to establish the correct character to disable terminal functions |
| 90 | in a system-independent manner. Note that USG (at least) define | 62 | in a system-independent manner. Note that USG (at least) define |
| @@ -111,60 +83,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 111 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) | 83 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) |
| 112 | #endif | 84 | #endif |
| 113 | 85 | ||
| 114 | #ifdef HAVE_TERMIO | ||
| 115 | #ifdef TCOUTQ | ||
| 116 | #undef EMACS_OUTQSIZE | ||
| 117 | #define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size))) | ||
| 118 | #endif | ||
| 119 | #endif | ||
| 120 | |||
| 121 | 86 | ||
| 122 | /* Manipulate a terminal's current process group. */ | 87 | /* Manipulate a terminal's current process group. */ |
| 123 | 88 | ||
| 124 | /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current | 89 | /* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's |
| 125 | controlling process group. | ||
| 126 | |||
| 127 | EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's | ||
| 128 | current process group. Return -1 if there is an error. | 90 | current process group. Return -1 if there is an error. |
| 129 | 91 | ||
| 130 | EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's | 92 | EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's |
| 131 | current process group to *PGID. Return -1 if there is an error. */ | 93 | current process group to *PGID. Return -1 if there is an error. */ |
| 132 | 94 | ||
| 133 | /* HPUX tty process group stuff doesn't work, says the anonymous voice | 95 | #ifndef DOS_NT |
| 134 | from the past. */ | ||
| 135 | #ifndef HPUX | ||
| 136 | #ifdef TIOCGPGRP | ||
| 137 | #define EMACS_HAVE_TTY_PGRP | ||
| 138 | #else | ||
| 139 | #ifdef HAVE_TERMIOS | ||
| 140 | #define EMACS_HAVE_TTY_PGRP | ||
| 141 | #endif /* HAVE_TERMIOS */ | ||
| 142 | #endif /* TIOCGPGRP */ | ||
| 143 | #endif /* not HPUX */ | ||
| 144 | |||
| 145 | #ifdef EMACS_HAVE_TTY_PGRP | ||
| 146 | |||
| 147 | #if defined (HAVE_TERMIOS) | ||
| 148 | |||
| 149 | #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) | 96 | #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) |
| 150 | #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) | 97 | #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) |
| 151 | 98 | #endif /* not DOS_NT */ | |
| 152 | #else /* not HAVE_TERMIOS */ | ||
| 153 | #ifdef TIOCSPGRP | ||
| 154 | |||
| 155 | #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid))) | ||
| 156 | #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid))) | ||
| 157 | |||
| 158 | #endif /* TIOCSPGRP */ | ||
| 159 | #endif /* HAVE_TERMIOS */ | ||
| 160 | |||
| 161 | #else /* not EMACS_SET_TTY_PGRP */ | ||
| 162 | |||
| 163 | /* Just ignore this for now and hope for the best */ | ||
| 164 | #define EMACS_GET_TTY_PGRP(fd, pgid) 0 | ||
| 165 | #define EMACS_SET_TTY_PGRP(fd, pgif) 0 | ||
| 166 | |||
| 167 | #endif /* not EMACS_SET_TTY_PGRP */ | ||
| 168 | 99 | ||
| 169 | /* EMACS_GETPGRP (arg) returns the process group of the process. */ | 100 | /* EMACS_GETPGRP (arg) returns the process group of the process. */ |
| 170 | 101 | ||
| @@ -207,32 +138,11 @@ struct emacs_tty { | |||
| 207 | 138 | ||
| 208 | /* There is always one of the following elements, so there is no need | 139 | /* There is always one of the following elements, so there is no need |
| 209 | for dummy get and set definitions. */ | 140 | for dummy get and set definitions. */ |
| 210 | #ifdef HAVE_TCATTR | 141 | #ifndef DOS_NT |
| 211 | struct termios main; | 142 | struct termios main; |
| 212 | #else /* not HAVE_TCATTR */ | 143 | #else /* DOS_NT */ |
| 213 | #ifdef HAVE_TERMIO | ||
| 214 | struct termio main; | ||
| 215 | #else /* not HAVE_TERMIO */ | ||
| 216 | #ifdef DOS_NT | ||
| 217 | int main; | 144 | int main; |
| 218 | #else /* not DOS_NT */ | 145 | #endif /* DOS_NT */ |
| 219 | struct sgttyb main; | ||
| 220 | #endif /* not DOS_NT */ | ||
| 221 | #endif /* not HAVE_TERMIO */ | ||
| 222 | #endif /* not HAVE_TCATTR */ | ||
| 223 | |||
| 224 | /* If we have TERMIOS, we don't need to do this - they're taken care of | ||
| 225 | by the tc*attr calls. */ | ||
| 226 | #ifndef HAVE_TERMIOS | ||
| 227 | #ifdef HAVE_LTCHARS | ||
| 228 | struct ltchars ltchars; | ||
| 229 | #endif /* HAVE_LTCHARS */ | ||
| 230 | |||
| 231 | #ifdef HAVE_TCHARS | ||
| 232 | struct tchars tchars; | ||
| 233 | int lmode; | ||
| 234 | #endif /* HAVE_TCHARS */ | ||
| 235 | #endif /* not defined HAVE_TERMIOS */ | ||
| 236 | }; | 146 | }; |
| 237 | 147 | ||
| 238 | /* Define EMACS_GET_TTY and EMACS_SET_TTY, | 148 | /* Define EMACS_GET_TTY and EMACS_SET_TTY, |
| @@ -249,7 +159,7 @@ extern int emacs_set_tty (int, struct emacs_tty *, int); | |||
| 249 | 159 | ||
| 250 | /* Define EMACS_TTY_TABS_OK. */ | 160 | /* Define EMACS_TTY_TABS_OK. */ |
| 251 | 161 | ||
| 252 | #ifdef HAVE_TERMIOS | 162 | #ifndef DOS_NT |
| 253 | 163 | ||
| 254 | #ifdef TABDLY | 164 | #ifdef TABDLY |
| 255 | #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | 165 | #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) |
| @@ -257,21 +167,9 @@ extern int emacs_set_tty (int, struct emacs_tty *, int); | |||
| 257 | #define EMACS_TTY_TABS_OK(p) 1 | 167 | #define EMACS_TTY_TABS_OK(p) 1 |
| 258 | #endif /* not TABDLY */ | 168 | #endif /* not TABDLY */ |
| 259 | 169 | ||
| 260 | #else /* not def HAVE_TERMIOS */ | 170 | #else /* DOS_NT */ |
| 261 | #ifdef HAVE_TERMIO | ||
| 262 | |||
| 263 | #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) | ||
| 264 | |||
| 265 | #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */ | ||
| 266 | |||
| 267 | #ifdef DOS_NT | ||
| 268 | #define EMACS_TTY_TABS_OK(p) 0 | 171 | #define EMACS_TTY_TABS_OK(p) 0 |
| 269 | #else /* not DOS_NT */ | 172 | #endif /* DOS_NT */ |
| 270 | #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS) | ||
| 271 | #endif /* not DOS_NT */ | ||
| 272 | |||
| 273 | #endif /* not def HAVE_TERMIO */ | ||
| 274 | #endif /* not def HAVE_TERMIOS */ | ||
| 275 | 173 | ||
| 276 | /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 | 174 | /* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 |
| 277 | (do not change this comment) */ | 175 | (do not change this comment) */ |
diff --git a/src/term.c b/src/term.c index 4f326234956..f090cdd2792 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -31,9 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include <unistd.h> | 31 | #include <unistd.h> |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #if HAVE_TERMIOS_H | ||
| 35 | #include <termios.h> /* For TIOCNOTTY. */ | ||
| 36 | #endif | ||
| 37 | #ifdef HAVE_SYS_IOCTL_H | 34 | #ifdef HAVE_SYS_IOCTL_H |
| 38 | #include <sys/ioctl.h> | 35 | #include <sys/ioctl.h> |
| 39 | #endif | 36 | #endif |
| @@ -692,7 +689,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi | |||
| 692 | encode_terminal_src_size); | 689 | encode_terminal_src_size); |
| 693 | buf = encode_terminal_src + nbytes; | 690 | buf = encode_terminal_src + nbytes; |
| 694 | } | 691 | } |
| 695 | if (char_charset (c, charset_list, NULL)) | 692 | if (CHAR_BYTE8_P (c) |
| 693 | || char_charset (c, charset_list, NULL)) | ||
| 696 | { | 694 | { |
| 697 | /* Store the multibyte form of C at BUF. */ | 695 | /* Store the multibyte form of C at BUF. */ |
| 698 | buf += CHAR_STRING (c, buf); | 696 | buf += CHAR_STRING (c, buf); |
| @@ -1617,18 +1615,15 @@ produce_glyphs (struct it *it) | |||
| 1617 | goto done; | 1615 | goto done; |
| 1618 | } | 1616 | } |
| 1619 | 1617 | ||
| 1620 | /* Maybe translate single-byte characters to multibyte. */ | 1618 | if (it->char_to_display >= 040 && it->char_to_display < 0177) |
| 1621 | it->char_to_display = it->c; | ||
| 1622 | |||
| 1623 | if (it->c >= 040 && it->c < 0177) | ||
| 1624 | { | 1619 | { |
| 1625 | it->pixel_width = it->nglyphs = 1; | 1620 | it->pixel_width = it->nglyphs = 1; |
| 1626 | if (it->glyph_row) | 1621 | if (it->glyph_row) |
| 1627 | append_glyph (it); | 1622 | append_glyph (it); |
| 1628 | } | 1623 | } |
| 1629 | else if (it->c == '\n') | 1624 | else if (it->char_to_display == '\n') |
| 1630 | it->pixel_width = it->nglyphs = 0; | 1625 | it->pixel_width = it->nglyphs = 0; |
| 1631 | else if (it->c == '\t') | 1626 | else if (it->char_to_display == '\t') |
| 1632 | { | 1627 | { |
| 1633 | int absolute_x = (it->current_x | 1628 | int absolute_x = (it->current_x |
| 1634 | + it->continuation_lines_width); | 1629 | + it->continuation_lines_width); |
| @@ -1659,32 +1654,19 @@ produce_glyphs (struct it *it) | |||
| 1659 | it->pixel_width = nspaces; | 1654 | it->pixel_width = nspaces; |
| 1660 | it->nglyphs = nspaces; | 1655 | it->nglyphs = nspaces; |
| 1661 | } | 1656 | } |
| 1662 | else if (CHAR_BYTE8_P (it->c)) | 1657 | else if (CHAR_BYTE8_P (it->char_to_display)) |
| 1663 | { | 1658 | { |
| 1664 | if (unibyte_display_via_language_environment | 1659 | /* Coming here means that we must send the raw 8-bit byte as is |
| 1665 | && (it->c >= 0240)) | 1660 | to the terminal. Although there's no way to know how many |
| 1666 | { | 1661 | columns it occupies on a screen, it is a good assumption that |
| 1667 | it->char_to_display = BYTE8_TO_CHAR (it->c); | 1662 | a single byte code has 1-column width. */ |
| 1668 | it->pixel_width = CHAR_WIDTH (it->char_to_display); | 1663 | it->pixel_width = it->nglyphs = 1; |
| 1669 | it->nglyphs = it->pixel_width; | 1664 | if (it->glyph_row) |
| 1670 | if (it->glyph_row) | 1665 | append_glyph (it); |
| 1671 | append_glyph (it); | ||
| 1672 | } | ||
| 1673 | else | ||
| 1674 | { | ||
| 1675 | /* Coming here means that it->c is from display table, thus | ||
| 1676 | we must send the raw 8-bit byte as is to the terminal. | ||
| 1677 | Although there's no way to know how many columns it | ||
| 1678 | occupies on a screen, it is a good assumption that a | ||
| 1679 | single byte code has 1-column width. */ | ||
| 1680 | it->pixel_width = it->nglyphs = 1; | ||
| 1681 | if (it->glyph_row) | ||
| 1682 | append_glyph (it); | ||
| 1683 | } | ||
| 1684 | } | 1666 | } |
| 1685 | else | 1667 | else |
| 1686 | { | 1668 | { |
| 1687 | it->pixel_width = CHAR_WIDTH (it->c); | 1669 | it->pixel_width = CHAR_WIDTH (it->char_to_display); |
| 1688 | it->nglyphs = it->pixel_width; | 1670 | it->nglyphs = it->pixel_width; |
| 1689 | 1671 | ||
| 1690 | if (it->glyph_row) | 1672 | if (it->glyph_row) |
| @@ -1920,7 +1902,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 1920 | else | 1902 | else |
| 1921 | abort (); | 1903 | abort (); |
| 1922 | 1904 | ||
| 1923 | temp_it.c = GLYPH_CHAR (glyph); | 1905 | temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); |
| 1924 | temp_it.face_id = GLYPH_FACE (glyph); | 1906 | temp_it.face_id = GLYPH_FACE (glyph); |
| 1925 | temp_it.len = CHAR_BYTES (temp_it.c); | 1907 | temp_it.len = CHAR_BYTES (temp_it.c); |
| 1926 | 1908 | ||
diff --git a/src/unexcoff.c b/src/unexcoff.c index ed319ec8e7f..cb4b8d603b5 100644 --- a/src/unexcoff.c +++ b/src/unexcoff.c | |||
| @@ -74,12 +74,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 74 | * of Dell Computer Corporation. james@bigtex.cactus.org. | 74 | * of Dell Computer Corporation. james@bigtex.cactus.org. |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | #ifndef emacs | ||
| 78 | #define PERROR(arg) perror (arg); return -1 | ||
| 79 | #else | ||
| 80 | #include <config.h> | 77 | #include <config.h> |
| 81 | #define PERROR(file) report_error (file, new) | 78 | #define PERROR(file) report_error (file, new) |
| 82 | #endif | ||
| 83 | 79 | ||
| 84 | #ifndef CANNOT_DUMP /* all rest of file! */ | 80 | #ifndef CANNOT_DUMP /* all rest of file! */ |
| 85 | 81 | ||
| @@ -88,6 +84,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 88 | #ifdef MSDOS | 84 | #ifdef MSDOS |
| 89 | #include <fcntl.h> /* for O_RDONLY, O_RDWR */ | 85 | #include <fcntl.h> /* for O_RDONLY, O_RDWR */ |
| 90 | #include <crt0.h> /* for _crt0_startup_flags and its bits */ | 86 | #include <crt0.h> /* for _crt0_startup_flags and its bits */ |
| 87 | #include <sys/exceptn.h> | ||
| 91 | static int save_djgpp_startup_flags; | 88 | static int save_djgpp_startup_flags; |
| 92 | #define filehdr external_filehdr | 89 | #define filehdr external_filehdr |
| 93 | #define scnhdr external_scnhdr | 90 | #define scnhdr external_scnhdr |
| @@ -132,8 +129,7 @@ struct aouthdr | |||
| 132 | #endif | 129 | #endif |
| 133 | 130 | ||
| 134 | 131 | ||
| 135 | extern char *start_of_text (); /* Start of text */ | 132 | extern char *start_of_data (void); /* Start of initialized data */ |
| 136 | extern char *start_of_data (); /* Start of initialized data */ | ||
| 137 | 133 | ||
| 138 | static long block_copy_start; /* Old executable start point */ | 134 | static long block_copy_start; /* Old executable start point */ |
| 139 | static struct filehdr f_hdr; /* File header */ | 135 | static struct filehdr f_hdr; /* File header */ |
| @@ -155,45 +151,33 @@ static int pagemask; | |||
| 155 | 151 | ||
| 156 | #define ADDR_CORRECT(x) ((char *)(x) - (char*)0) | 152 | #define ADDR_CORRECT(x) ((char *)(x) - (char*)0) |
| 157 | 153 | ||
| 158 | #ifdef emacs | ||
| 159 | |||
| 160 | #include <setjmp.h> | 154 | #include <setjmp.h> |
| 161 | #include "lisp.h" | 155 | #include "lisp.h" |
| 162 | 156 | ||
| 163 | static | 157 | static void |
| 164 | report_error (file, fd) | 158 | report_error (const char *file, int fd) |
| 165 | char *file; | ||
| 166 | int fd; | ||
| 167 | { | 159 | { |
| 168 | if (fd) | 160 | if (fd) |
| 169 | close (fd); | 161 | close (fd); |
| 170 | report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil)); | 162 | report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil)); |
| 171 | } | 163 | } |
| 172 | #endif /* emacs */ | ||
| 173 | 164 | ||
| 174 | #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 | 165 | #define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 |
| 175 | #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 | 166 | #define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 |
| 176 | #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 | 167 | #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 |
| 177 | 168 | ||
| 178 | static | 169 | static void |
| 179 | report_error_1 (fd, msg, a1, a2) | 170 | report_error_1 (int fd, const char *msg, int a1, int a2) |
| 180 | int fd; | ||
| 181 | char *msg; | ||
| 182 | int a1, a2; | ||
| 183 | { | 171 | { |
| 184 | close (fd); | 172 | close (fd); |
| 185 | #ifdef emacs | ||
| 186 | error (msg, a1, a2); | 173 | error (msg, a1, a2); |
| 187 | #else | ||
| 188 | fprintf (stderr, msg, a1, a2); | ||
| 189 | fprintf (stderr, "\n"); | ||
| 190 | #endif | ||
| 191 | } | 174 | } |
| 192 | 175 | ||
| 193 | static int make_hdr (); | 176 | static int make_hdr (int, int, unsigned, unsigned, unsigned, |
| 194 | static int copy_text_and_data (); | 177 | const char *, const char *); |
| 195 | static int copy_sym (); | 178 | static int copy_text_and_data (int, int); |
| 196 | static void mark_x (); | 179 | static int copy_sym (int, int, const char *, const char *); |
| 180 | static void mark_x (const char *); | ||
| 197 | 181 | ||
| 198 | /* **************************************************************** | 182 | /* **************************************************************** |
| 199 | * make_hdr | 183 | * make_hdr |
| @@ -202,13 +186,9 @@ static void mark_x (); | |||
| 202 | * Modify the text and data sizes. | 186 | * Modify the text and data sizes. |
| 203 | */ | 187 | */ |
| 204 | static int | 188 | static int |
| 205 | make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | 189 | make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, |
| 206 | int new, a_out; | 190 | unsigned entry_address, const char *a_name, const char *new_name) |
| 207 | unsigned data_start, bss_start, entry_address; | ||
| 208 | char *a_name; | ||
| 209 | char *new_name; | ||
| 210 | { | 191 | { |
| 211 | int tem; | ||
| 212 | auto struct scnhdr f_thdr; /* Text section header */ | 192 | auto struct scnhdr f_thdr; /* Text section header */ |
| 213 | auto struct scnhdr f_dhdr; /* Data section header */ | 193 | auto struct scnhdr f_dhdr; /* Data section header */ |
| 214 | auto struct scnhdr f_bhdr; /* Bss section header */ | 194 | auto struct scnhdr f_bhdr; /* Bss section header */ |
| @@ -319,9 +299,6 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | |||
| 319 | to correspond to what we want to dump. */ | 299 | to correspond to what we want to dump. */ |
| 320 | 300 | ||
| 321 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); | 301 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); |
| 322 | f_ohdr.text_start = (long) start_of_text (); | ||
| 323 | f_ohdr.tsize = data_start - f_ohdr.text_start; | ||
| 324 | f_ohdr.data_start = data_start; | ||
| 325 | f_ohdr.dsize = bss_start - f_ohdr.data_start; | 302 | f_ohdr.dsize = bss_start - f_ohdr.data_start; |
| 326 | f_ohdr.bsize = bss_end - bss_start; | 303 | f_ohdr.bsize = bss_end - bss_start; |
| 327 | f_thdr.s_size = f_ohdr.tsize; | 304 | f_thdr.s_size = f_ohdr.tsize; |
| @@ -379,12 +356,10 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | |||
| 379 | 356 | ||
| 380 | } | 357 | } |
| 381 | 358 | ||
| 382 | write_segment (new, ptr, end) | 359 | void |
| 383 | int new; | 360 | write_segment (int new, const char *ptr, const char *end) |
| 384 | register char *ptr, *end; | ||
| 385 | { | 361 | { |
| 386 | register int i, nwrite, ret; | 362 | register int i, nwrite, ret; |
| 387 | char buf[80]; | ||
| 388 | /* This is the normal amount to write at once. | 363 | /* This is the normal amount to write at once. |
| 389 | It is the size of block that NFS uses. */ | 364 | It is the size of block that NFS uses. */ |
| 390 | int writesize = 1 << 13; | 365 | int writesize = 1 << 13; |
| @@ -417,16 +392,6 @@ write_segment (new, ptr, end) | |||
| 417 | nwrite = pagesize; | 392 | nwrite = pagesize; |
| 418 | write (new, zeros, nwrite); | 393 | write (new, zeros, nwrite); |
| 419 | } | 394 | } |
| 420 | #if 0 /* Now that we have can ask `write' to write more than a page, | ||
| 421 | it is legit for write do less than the whole amount specified. */ | ||
| 422 | else if (nwrite != ret) | ||
| 423 | { | ||
| 424 | sprintf (buf, | ||
| 425 | "unexec write failure: addr 0x%x, fileno %d, size 0x%x, wrote 0x%x, errno %d", | ||
| 426 | ptr, new, nwrite, ret, errno); | ||
| 427 | PERROR (buf); | ||
| 428 | } | ||
| 429 | #endif | ||
| 430 | i += nwrite; | 395 | i += nwrite; |
| 431 | ptr += nwrite; | 396 | ptr += nwrite; |
| 432 | } | 397 | } |
| @@ -437,8 +402,7 @@ write_segment (new, ptr, end) | |||
| 437 | * Copy the text and data segments from memory to the new a.out | 402 | * Copy the text and data segments from memory to the new a.out |
| 438 | */ | 403 | */ |
| 439 | static int | 404 | static int |
| 440 | copy_text_and_data (new, a_out) | 405 | copy_text_and_data (int new, int a_out) |
| 441 | int new, a_out; | ||
| 442 | { | 406 | { |
| 443 | register char *end; | 407 | register char *end; |
| 444 | register char *ptr; | 408 | register char *ptr; |
| @@ -482,9 +446,7 @@ copy_text_and_data (new, a_out) | |||
| 482 | * Copy the relocation information and symbol table from the a.out to the new | 446 | * Copy the relocation information and symbol table from the a.out to the new |
| 483 | */ | 447 | */ |
| 484 | static int | 448 | static int |
| 485 | copy_sym (new, a_out, a_name, new_name) | 449 | copy_sym (int new, int a_out, const char *a_name, const char *new_name) |
| 486 | int new, a_out; | ||
| 487 | char *a_name, *new_name; | ||
| 488 | { | 450 | { |
| 489 | char page[1024]; | 451 | char page[1024]; |
| 490 | int n; | 452 | int n; |
| @@ -520,8 +482,7 @@ copy_sym (new, a_out, a_name, new_name) | |||
| 520 | * After successfully building the new a.out, mark it executable | 482 | * After successfully building the new a.out, mark it executable |
| 521 | */ | 483 | */ |
| 522 | static void | 484 | static void |
| 523 | mark_x (name) | 485 | mark_x (const char *name) |
| 524 | char *name; | ||
| 525 | { | 486 | { |
| 526 | struct stat sbuf; | 487 | struct stat sbuf; |
| 527 | int um; | 488 | int um; |
| @@ -561,10 +522,8 @@ mark_x (name) | |||
| 561 | a reasonable size buffer. But I don't have time to work on such | 522 | a reasonable size buffer. But I don't have time to work on such |
| 562 | things, so I am installing it as submitted to me. -- RMS. */ | 523 | things, so I am installing it as submitted to me. -- RMS. */ |
| 563 | 524 | ||
| 564 | adjust_lnnoptrs (writedesc, readdesc, new_name) | 525 | int |
| 565 | int writedesc; | 526 | adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name) |
| 566 | int readdesc; | ||
| 567 | char *new_name; | ||
| 568 | { | 527 | { |
| 569 | register int nsyms; | 528 | register int nsyms; |
| 570 | register int new; | 529 | register int new; |
| @@ -606,31 +565,16 @@ adjust_lnnoptrs (writedesc, readdesc, new_name) | |||
| 606 | return 0; | 565 | return 0; |
| 607 | } | 566 | } |
| 608 | 567 | ||
| 609 | extern unsigned start __asm__ ("start"); | ||
| 610 | |||
| 611 | /* | ||
| 612 | * Return the address of the start of the text segment prior to | ||
| 613 | * doing an unexec. After unexec the return value is undefined. | ||
| 614 | * See crt0.c for further explanation and _start. | ||
| 615 | * | ||
| 616 | */ | ||
| 617 | |||
| 618 | char * | ||
| 619 | start_of_text (void) | ||
| 620 | { | ||
| 621 | return ((char *) &start); | ||
| 622 | } | ||
| 623 | |||
| 624 | /* **************************************************************** | 568 | /* **************************************************************** |
| 625 | * unexec | 569 | * unexec |
| 626 | * | 570 | * |
| 627 | * driving logic. | 571 | * driving logic. |
| 628 | */ | 572 | */ |
| 629 | unexec (new_name, a_name, data_start, bss_start, entry_address) | 573 | int |
| 630 | char *new_name, *a_name; | 574 | unexec (const char *new_name, const char *a_name, |
| 631 | unsigned data_start, bss_start, entry_address; | 575 | unsigned data_start, unsigned bss_start, unsigned entry_address) |
| 632 | { | 576 | { |
| 633 | int new, a_out = -1; | 577 | int new = -1, a_out = -1; |
| 634 | 578 | ||
| 635 | if (a_name && (a_out = open (a_name, O_RDONLY)) < 0) | 579 | if (a_name && (a_out = open (a_name, O_RDONLY)) < 0) |
| 636 | { | 580 | { |
| @@ -648,7 +592,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address) | |||
| 648 | ) | 592 | ) |
| 649 | { | 593 | { |
| 650 | close (new); | 594 | close (new); |
| 651 | /* unlink (new_name); /* Failed, unlink new a.out */ | ||
| 652 | return -1; | 595 | return -1; |
| 653 | } | 596 | } |
| 654 | 597 | ||
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index ef43e9bef12..5c450e062c6 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -267,7 +267,7 @@ unexec_copy (off_t dest, off_t src, ssize_t count) | |||
| 267 | /* Debugging and informational messages routines. */ | 267 | /* Debugging and informational messages routines. */ |
| 268 | 268 | ||
| 269 | static void | 269 | static void |
| 270 | unexec_error (char *format, ...) | 270 | unexec_error (const char *format, ...) |
| 271 | { | 271 | { |
| 272 | va_list ap; | 272 | va_list ap; |
| 273 | 273 | ||
diff --git a/src/w16select.c b/src/w16select.c index 384b82ceff1..ef1b974752b 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -456,7 +456,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 456 | (Lisp_Object string, Lisp_Object frame) | 456 | (Lisp_Object string, Lisp_Object frame) |
| 457 | { | 457 | { |
| 458 | unsigned ok = 1, put_status = 0; | 458 | unsigned ok = 1, put_status = 0; |
| 459 | int nbytes, charset_info, no_crlf_conversion; | 459 | int nbytes, no_crlf_conversion; |
| 460 | unsigned char *src, *dst = NULL; | 460 | unsigned char *src, *dst = NULL; |
| 461 | 461 | ||
| 462 | CHECK_STRING (string); | 462 | CHECK_STRING (string); |
| @@ -494,9 +494,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 494 | { | 494 | { |
| 495 | /* We must encode contents of STRING according to what | 495 | /* We must encode contents of STRING according to what |
| 496 | clipboard-coding-system specifies. */ | 496 | clipboard-coding-system specifies. */ |
| 497 | int bufsize; | ||
| 498 | struct coding_system coding; | 497 | struct coding_system coding; |
| 499 | unsigned char *htext2; | ||
| 500 | Lisp_Object coding_system = | 498 | Lisp_Object coding_system = |
| 501 | NILP (Vnext_selection_coding_system) ? | 499 | NILP (Vnext_selection_coding_system) ? |
| 502 | Vselection_coding_system : Vnext_selection_coding_system; | 500 | Vselection_coding_system : Vnext_selection_coding_system; |
| @@ -567,7 +565,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 567 | unsigned data_size, truelen; | 565 | unsigned data_size, truelen; |
| 568 | unsigned char *htext = NULL; | 566 | unsigned char *htext = NULL; |
| 569 | Lisp_Object ret = Qnil; | 567 | Lisp_Object ret = Qnil; |
| 570 | int no_crlf_conversion, require_decoding = 0; | 568 | int require_decoding = 0; |
| 571 | 569 | ||
| 572 | if (NILP (frame)) | 570 | if (NILP (frame)) |
| 573 | frame = Fselected_frame (); | 571 | frame = Fselected_frame (); |
| @@ -608,8 +606,6 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 608 | } | 606 | } |
| 609 | if (require_decoding) | 607 | if (require_decoding) |
| 610 | { | 608 | { |
| 611 | int bufsize; | ||
| 612 | unsigned char *buf; | ||
| 613 | struct coding_system coding; | 609 | struct coding_system coding; |
| 614 | Lisp_Object coding_system = Vnext_selection_coding_system; | 610 | Lisp_Object coding_system = Vnext_selection_coding_system; |
| 615 | 611 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index d1f21e8acdd..f91ad948828 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -3109,9 +3109,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3109 | HIMC context; | 3109 | HIMC context; |
| 3110 | struct window *w; | 3110 | struct window *w; |
| 3111 | 3111 | ||
| 3112 | if (!context) | ||
| 3113 | break; | ||
| 3114 | |||
| 3115 | f = x_window_to_frame (dpyinfo, hwnd); | 3112 | f = x_window_to_frame (dpyinfo, hwnd); |
| 3116 | w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 3113 | w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
| 3117 | 3114 | ||
| @@ -3129,6 +3126,10 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3129 | - WINDOW_MODE_LINE_HEIGHT (w)); | 3126 | - WINDOW_MODE_LINE_HEIGHT (w)); |
| 3130 | 3127 | ||
| 3131 | context = get_ime_context_fn (hwnd); | 3128 | context = get_ime_context_fn (hwnd); |
| 3129 | |||
| 3130 | if (!context) | ||
| 3131 | break; | ||
| 3132 | |||
| 3132 | set_ime_composition_window_fn (context, &form); | 3133 | set_ime_composition_window_fn (context, &form); |
| 3133 | release_ime_context_fn (hwnd, context); | 3134 | release_ime_context_fn (hwnd, context); |
| 3134 | } | 3135 | } |
| @@ -6812,6 +6813,7 @@ frame_parm_handler w32_frame_parm_handlers[] = | |||
| 6812 | x_set_font_backend, | 6813 | x_set_font_backend, |
| 6813 | x_set_alpha, | 6814 | x_set_alpha, |
| 6814 | 0, /* x_set_sticky */ | 6815 | 0, /* x_set_sticky */ |
| 6816 | 0, /* x_set_tool_bar_position */ | ||
| 6815 | }; | 6817 | }; |
| 6816 | 6818 | ||
| 6817 | void | 6819 | void |
diff --git a/src/w32menu.c b/src/w32menu.c index 919f8505da8..0ed9bffe70c 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -72,10 +72,16 @@ typedef BOOL (WINAPI * SetMenuItemInfoA_Proc) ( | |||
| 72 | IN UINT, | 72 | IN UINT, |
| 73 | IN BOOL, | 73 | IN BOOL, |
| 74 | IN LPCMENUITEMINFOA); | 74 | IN LPCMENUITEMINFOA); |
| 75 | typedef int (WINAPI * MessageBoxW_Proc) ( | ||
| 76 | IN HWND window, | ||
| 77 | IN WCHAR *text, | ||
| 78 | IN WCHAR *caption, | ||
| 79 | IN UINT type); | ||
| 75 | 80 | ||
| 76 | GetMenuItemInfoA_Proc get_menu_item_info = NULL; | 81 | GetMenuItemInfoA_Proc get_menu_item_info = NULL; |
| 77 | SetMenuItemInfoA_Proc set_menu_item_info = NULL; | 82 | SetMenuItemInfoA_Proc set_menu_item_info = NULL; |
| 78 | AppendMenuW_Proc unicode_append_menu = NULL; | 83 | AppendMenuW_Proc unicode_append_menu = NULL; |
| 84 | MessageBoxW_Proc unicode_message_box = NULL; | ||
| 79 | 85 | ||
| 80 | Lisp_Object Qdebug_on_next_call; | 86 | Lisp_Object Qdebug_on_next_call; |
| 81 | 87 | ||
| @@ -99,6 +105,8 @@ static int is_simple_dialog (Lisp_Object); | |||
| 99 | static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); | 105 | static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); |
| 100 | #endif | 106 | #endif |
| 101 | 107 | ||
| 108 | static void utf8to16 (unsigned char *, int, WCHAR *); | ||
| 109 | |||
| 102 | void w32_free_menu_strings (HWND); | 110 | void w32_free_menu_strings (HWND); |
| 103 | 111 | ||
| 104 | 112 | ||
| @@ -412,12 +420,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 412 | 420 | ||
| 413 | set_buffer_internal_1 (XBUFFER (buffer)); | 421 | set_buffer_internal_1 (XBUFFER (buffer)); |
| 414 | 422 | ||
| 415 | /* Run the Lucid hook. */ | 423 | /* Run the hooks. */ |
| 416 | safe_run_hooks (Qactivate_menubar_hook); | 424 | safe_run_hooks (Qactivate_menubar_hook); |
| 417 | /* If it has changed current-menubar from previous value, | ||
| 418 | really recompute the menubar from the value. */ | ||
| 419 | if (! NILP (Vlucid_menu_bar_dirty_flag)) | ||
| 420 | call0 (Qrecompute_lucid_menubar); | ||
| 421 | safe_run_hooks (Qmenu_bar_update_hook); | 425 | safe_run_hooks (Qmenu_bar_update_hook); |
| 422 | FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); | 426 | FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); |
| 423 | 427 | ||
| @@ -662,7 +666,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 662 | 666 | ||
| 663 | Lisp_Object | 667 | Lisp_Object |
| 664 | w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 668 | w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 665 | Lisp_Object title, char **error) | 669 | Lisp_Object title, const char **error) |
| 666 | { | 670 | { |
| 667 | int i; | 671 | int i; |
| 668 | int menu_item_selection; | 672 | int menu_item_selection; |
| @@ -1220,30 +1224,73 @@ simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header) | |||
| 1220 | { | 1224 | { |
| 1221 | int answer; | 1225 | int answer; |
| 1222 | UINT type; | 1226 | UINT type; |
| 1223 | char *text, *title; | ||
| 1224 | Lisp_Object lispy_answer = Qnil, temp = XCAR (contents); | 1227 | Lisp_Object lispy_answer = Qnil, temp = XCAR (contents); |
| 1225 | 1228 | ||
| 1226 | if (STRINGP (temp)) | 1229 | type = MB_YESNO; |
| 1227 | text = SDATA (temp); | 1230 | |
| 1228 | else | 1231 | /* Since we only handle Yes/No dialogs, and we already checked |
| 1229 | text = ""; | 1232 | is_simple_dialog, we don't need to worry about checking contents |
| 1233 | to see what type of dialog to use. */ | ||
| 1230 | 1234 | ||
| 1231 | if (NILP (header)) | 1235 | /* Use unicode if possible, so any language can be displayed. */ |
| 1236 | if (unicode_message_box) | ||
| 1232 | { | 1237 | { |
| 1233 | title = "Question"; | 1238 | WCHAR *text, *title; |
| 1234 | type = MB_ICONQUESTION; | 1239 | |
| 1240 | if (STRINGP (temp)) | ||
| 1241 | { | ||
| 1242 | char *utf8_text = SDATA (ENCODE_UTF_8 (temp)); | ||
| 1243 | /* Be pessimistic about the number of characters needed. | ||
| 1244 | Remember characters outside the BMP will take more than | ||
| 1245 | one utf16 word, so we cannot simply use the character | ||
| 1246 | length of temp. */ | ||
| 1247 | int utf8_len = strlen (utf8_text); | ||
| 1248 | text = alloca ((utf8_len + 1) * sizeof (WCHAR)); | ||
| 1249 | utf8to16 (utf8_text, utf8_len, text); | ||
| 1250 | } | ||
| 1251 | else | ||
| 1252 | { | ||
| 1253 | text = L""; | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | if (NILP (header)) | ||
| 1257 | { | ||
| 1258 | title = L"Question"; | ||
| 1259 | type |= MB_ICONQUESTION; | ||
| 1260 | } | ||
| 1261 | else | ||
| 1262 | { | ||
| 1263 | title = L"Information"; | ||
| 1264 | type |= MB_ICONINFORMATION; | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | answer = unicode_message_box (FRAME_W32_WINDOW (f), text, title, type); | ||
| 1235 | } | 1268 | } |
| 1236 | else | 1269 | else |
| 1237 | { | 1270 | { |
| 1238 | title = "Information"; | 1271 | char *text, *title; |
| 1239 | type = MB_ICONINFORMATION; | ||
| 1240 | } | ||
| 1241 | type |= MB_YESNO; | ||
| 1242 | 1272 | ||
| 1243 | /* Since we only handle Yes/No dialogs, and we already checked | 1273 | /* Fall back on ANSI message box, but at least use system |
| 1244 | is_simple_dialog, we don't need to worry about checking contents | 1274 | encoding so questions representable by the system codepage |
| 1245 | to see what type of dialog to use. */ | 1275 | are encoded properly. */ |
| 1246 | answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type); | 1276 | if (STRINGP (temp)) |
| 1277 | text = SDATA (ENCODE_SYSTEM (temp)); | ||
| 1278 | else | ||
| 1279 | text = ""; | ||
| 1280 | |||
| 1281 | if (NILP (header)) | ||
| 1282 | { | ||
| 1283 | title = "Question"; | ||
| 1284 | type |= MB_ICONQUESTION; | ||
| 1285 | } | ||
| 1286 | else | ||
| 1287 | { | ||
| 1288 | title = "Information"; | ||
| 1289 | type |= MB_ICONINFORMATION; | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | answer = MessageBox (FRAME_W32_WINDOW (f), text, title, type); | ||
| 1293 | } | ||
| 1247 | 1294 | ||
| 1248 | if (answer == IDYES) | 1295 | if (answer == IDYES) |
| 1249 | lispy_answer = build_string ("Yes"); | 1296 | lispy_answer = build_string ("Yes"); |
| @@ -1280,9 +1327,9 @@ simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header) | |||
| 1280 | 1327 | ||
| 1281 | /* Is this item a separator? */ | 1328 | /* Is this item a separator? */ |
| 1282 | static int | 1329 | static int |
| 1283 | name_is_separator (char *name) | 1330 | name_is_separator (const char *name) |
| 1284 | { | 1331 | { |
| 1285 | char *start = name; | 1332 | const char *start = name; |
| 1286 | 1333 | ||
| 1287 | /* Check if name string consists of only dashes ('-'). */ | 1334 | /* Check if name string consists of only dashes ('-'). */ |
| 1288 | while (*name == '-') name++; | 1335 | while (*name == '-') name++; |
| @@ -1360,7 +1407,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) | |||
| 1360 | strcat (out_string, wv->key); | 1407 | strcat (out_string, wv->key); |
| 1361 | } | 1408 | } |
| 1362 | else | 1409 | else |
| 1363 | out_string = wv->name; | 1410 | out_string = (char *)wv->name; |
| 1364 | 1411 | ||
| 1365 | /* Quote any special characters within the menu item's text and | 1412 | /* Quote any special characters within the menu item's text and |
| 1366 | key binding. */ | 1413 | key binding. */ |
| @@ -1697,6 +1744,7 @@ globals_of_w32menu (void) | |||
| 1697 | get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA"); | 1744 | get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA"); |
| 1698 | set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA"); | 1745 | set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA"); |
| 1699 | unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW"); | 1746 | unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW"); |
| 1747 | unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, "MessageBoxW"); | ||
| 1700 | } | 1748 | } |
| 1701 | 1749 | ||
| 1702 | /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0 | 1750 | /* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0 |
diff --git a/src/w32term.c b/src/w32term.c index fc03034b14b..992538e0e88 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -2106,17 +2106,34 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2106 | if (s->hl == DRAW_CURSOR | 2106 | if (s->hl == DRAW_CURSOR |
| 2107 | && !x_stretch_cursor_p) | 2107 | && !x_stretch_cursor_p) |
| 2108 | { | 2108 | { |
| 2109 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2109 | /* If `x-stretch-cursor' is nil, don't draw a block cursor as |
| 2110 | as wide as the stretch glyph. */ | 2110 | wide as the stretch glyph. */ |
| 2111 | int width, background_width = s->background_width; | 2111 | int width, background_width = s->background_width; |
| 2112 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | 2112 | int x = s->x; |
| 2113 | 2113 | ||
| 2114 | if (x < left_x) | 2114 | if (!s->row->reversed_p) |
| 2115 | { | 2115 | { |
| 2116 | background_width -= left_x - x; | 2116 | int left_x = window_box_left_offset (s->w, TEXT_AREA); |
| 2117 | x = left_x; | 2117 | |
| 2118 | if (x < left_x) | ||
| 2119 | { | ||
| 2120 | background_width -= left_x - x; | ||
| 2121 | x = left_x; | ||
| 2122 | } | ||
| 2123 | } | ||
| 2124 | else | ||
| 2125 | { | ||
| 2126 | /* In R2L rows, draw the cursor on the right edge of the | ||
| 2127 | stretch glyph. */ | ||
| 2128 | int right_x = window_box_right_offset (s->w, TEXT_AREA); | ||
| 2129 | |||
| 2130 | if (x + background_width > right_x) | ||
| 2131 | background_width -= x - right_x; | ||
| 2132 | x += background_width; | ||
| 2118 | } | 2133 | } |
| 2119 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | 2134 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); |
| 2135 | if (s->row->reversed_p) | ||
| 2136 | x -= width; | ||
| 2120 | 2137 | ||
| 2121 | /* Draw cursor. */ | 2138 | /* Draw cursor. */ |
| 2122 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); | 2139 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| @@ -2130,7 +2147,10 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2130 | RECT r; | 2147 | RECT r; |
| 2131 | HDC hdc = s->hdc; | 2148 | HDC hdc = s->hdc; |
| 2132 | 2149 | ||
| 2133 | x += width; | 2150 | if (!s->row->reversed_p) |
| 2151 | x += width; | ||
| 2152 | else | ||
| 2153 | x = s->x; | ||
| 2134 | if (s->row->mouse_face_p | 2154 | if (s->row->mouse_face_p |
| 2135 | && cursor_in_mouse_face_p (s->w)) | 2155 | && cursor_in_mouse_face_p (s->w)) |
| 2136 | { | 2156 | { |
| @@ -4877,6 +4897,11 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, | |||
| 4877 | 4897 | ||
| 4878 | w->phys_cursor_width = width; | 4898 | w->phys_cursor_width = width; |
| 4879 | 4899 | ||
| 4900 | /* If the character under cursor is R2L, draw the bar cursor | ||
| 4901 | on the right of its glyph, rather than on the left. */ | ||
| 4902 | if ((cursor_glyph->resolved_level & 1) != 0) | ||
| 4903 | x += cursor_glyph->pixel_width - width; | ||
| 4904 | |||
| 4880 | w32_fill_area (f, hdc, cursor_color, x, | 4905 | w32_fill_area (f, hdc, cursor_color, x, |
| 4881 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 4906 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 4882 | width, row->height); | 4907 | width, row->height); |
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 9edd6353ba3..05cc8346a50 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c | |||
| @@ -180,17 +180,18 @@ uniscribe_otf_capability (struct font *font) | |||
| 180 | 180 | ||
| 181 | /* Uniscribe implementation of shape for font backend. | 181 | /* Uniscribe implementation of shape for font backend. |
| 182 | 182 | ||
| 183 | Shape text in LGSTRING. See the docstring of `font-make-gstring' | 183 | Shape text in LGSTRING. See the docstring of |
| 184 | for the format of LGSTRING. If the (N+1)th element of LGSTRING | 184 | `composition-get-gstring' for the format of LGSTRING. If the |
| 185 | is nil, input of shaping is from the 1st to (N)th elements. In | 185 | (N+1)th element of LGSTRING is nil, input of shaping is from the |
| 186 | each input glyph, FROM, TO, CHAR, and CODE are already set. | 186 | 1st to (N)th elements. In each input glyph, FROM, TO, CHAR, and |
| 187 | CODE are already set. | ||
| 187 | 188 | ||
| 188 | This function updates all fields of the input glyphs. If the | 189 | This function updates all fields of the input glyphs. If the |
| 189 | output glyphs (M) are more than the input glyphs (N), (N+1)th | 190 | output glyphs (M) are more than the input glyphs (N), (N+1)th |
| 190 | through (M)th elements of LGSTRING are updated possibly by making | 191 | through (M)th elements of LGSTRING are updated possibly by making |
| 191 | a new glyph object and storing it in LGSTRING. If (M) is greater | 192 | a new glyph object and storing it in LGSTRING. If (M) is greater |
| 192 | than the length of LGSTRING, nil should be return. In that case, | 193 | than the length of LGSTRING, nil should be returned. In that case, |
| 193 | this function is called again with the larger LGSTRING. */ | 194 | this function is called again with a larger LGSTRING. */ |
| 194 | static Lisp_Object | 195 | static Lisp_Object |
| 195 | uniscribe_shape (Lisp_Object lgstring) | 196 | uniscribe_shape (Lisp_Object lgstring) |
| 196 | { | 197 | { |
| @@ -217,6 +218,9 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 217 | max_glyphs = nchars = LGSTRING_GLYPH_LEN (lgstring); | 218 | max_glyphs = nchars = LGSTRING_GLYPH_LEN (lgstring); |
| 218 | done_glyphs = 0; | 219 | done_glyphs = 0; |
| 219 | chars = (wchar_t *) alloca (nchars * sizeof (wchar_t)); | 220 | chars = (wchar_t *) alloca (nchars * sizeof (wchar_t)); |
| 221 | /* FIXME: This loop assumes that characters in the input LGSTRING | ||
| 222 | are all inside the BMP. Need to encode characters beyond the BMP | ||
| 223 | as UTF-16. */ | ||
| 220 | for (i = 0; i < nchars; i++) | 224 | for (i = 0; i < nchars; i++) |
| 221 | { | 225 | { |
| 222 | /* lgstring can be bigger than the number of characters in it, in | 226 | /* lgstring can be bigger than the number of characters in it, in |
| @@ -248,9 +252,6 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 248 | return Qnil; | 252 | return Qnil; |
| 249 | } | 253 | } |
| 250 | 254 | ||
| 251 | /* TODO: When we get BIDI support, we need to call ScriptLayout here. | ||
| 252 | Requires that we know the surrounding context. */ | ||
| 253 | |||
| 254 | glyphs = alloca (max_glyphs * sizeof (WORD)); | 255 | glyphs = alloca (max_glyphs * sizeof (WORD)); |
| 255 | clusters = alloca (nchars * sizeof (WORD)); | 256 | clusters = alloca (nchars * sizeof (WORD)); |
| 256 | attributes = alloca (max_glyphs * sizeof (SCRIPT_VISATTR)); | 257 | attributes = alloca (max_glyphs * sizeof (SCRIPT_VISATTR)); |
| @@ -259,8 +260,12 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 259 | 260 | ||
| 260 | for (i = 0; i < nitems; i++) | 261 | for (i = 0; i < nitems; i++) |
| 261 | { | 262 | { |
| 262 | int nglyphs, nchars_in_run, rtl = items[i].a.fRTL ? -1 : 1; | 263 | int nglyphs, nchars_in_run; |
| 263 | nchars_in_run = items[i+1].iCharPos - items[i].iCharPos; | 264 | nchars_in_run = items[i+1].iCharPos - items[i].iCharPos; |
| 265 | /* Force ScriptShape to generate glyphs in the same order as | ||
| 266 | they are in the input LGSTRING, which is in the logical | ||
| 267 | order. */ | ||
| 268 | items[i].a.fLogicalOrder = 1; | ||
| 264 | 269 | ||
| 265 | /* Context may be NULL here, in which case the cache should be | 270 | /* Context may be NULL here, in which case the cache should be |
| 266 | used without needing to select the font. */ | 271 | used without needing to select the font. */ |
| @@ -321,7 +326,7 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 321 | { | 326 | { |
| 322 | int j, nclusters, from, to; | 327 | int j, nclusters, from, to; |
| 323 | 328 | ||
| 324 | from = rtl > 0 ? 0 : nchars_in_run - 1; | 329 | from = 0; |
| 325 | to = from; | 330 | to = from; |
| 326 | 331 | ||
| 327 | for (j = 0; j < nglyphs; j++) | 332 | for (j = 0; j < nglyphs; j++) |
| @@ -342,22 +347,19 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 342 | gl = glyphs[j]; | 347 | gl = glyphs[j]; |
| 343 | LGLYPH_SET_CODE (lglyph, gl); | 348 | LGLYPH_SET_CODE (lglyph, gl); |
| 344 | 349 | ||
| 345 | /* Detect clusters, for linking codes back to characters. */ | 350 | /* Detect clusters, for linking codes back to |
| 351 | characters. */ | ||
| 346 | if (attributes[j].fClusterStart) | 352 | if (attributes[j].fClusterStart) |
| 347 | { | 353 | { |
| 348 | while (from >= 0 && from < nchars_in_run | 354 | while (from < nchars_in_run && clusters[from] < j) |
| 349 | && clusters[from] < j) | 355 | from++; |
| 350 | from += rtl; | 356 | if (from >= nchars_in_run) |
| 351 | if (from < 0) | ||
| 352 | from = to = 0; | ||
| 353 | else if (from >= nchars_in_run) | ||
| 354 | from = to = nchars_in_run - 1; | 357 | from = to = nchars_in_run - 1; |
| 355 | else | 358 | else |
| 356 | { | 359 | { |
| 357 | int k; | 360 | int k; |
| 358 | to = rtl > 0 ? nchars_in_run - 1 : 0; | 361 | to = nchars_in_run - 1; |
| 359 | for (k = from + rtl; k >= 0 && k < nchars_in_run; | 362 | for (k = from + 1; k < nchars_in_run; k++) |
| 360 | k += rtl) | ||
| 361 | { | 363 | { |
| 362 | if (clusters[k] > j) | 364 | if (clusters[k] > j) |
| 363 | { | 365 | { |
| @@ -486,6 +488,10 @@ uniscribe_encode_char (struct font *font, int c) | |||
| 486 | SCRIPT_VISATTR attrs[2]; | 488 | SCRIPT_VISATTR attrs[2]; |
| 487 | int nglyphs; | 489 | int nglyphs; |
| 488 | 490 | ||
| 491 | /* Force ScriptShape to generate glyphs in the logical | ||
| 492 | order. */ | ||
| 493 | items[0].a.fLogicalOrder = 1; | ||
| 494 | |||
| 489 | result = ScriptShape (context, &(uniscribe_font->cache), | 495 | result = ScriptShape (context, &(uniscribe_font->cache), |
| 490 | ch, len, 2, &(items[0].a), | 496 | ch, len, 2, &(items[0].a), |
| 491 | glyphs, clusters, attrs, &nglyphs); | 497 | glyphs, clusters, attrs, &nglyphs); |
diff --git a/src/xdisp.c b/src/xdisp.c index 80df99fee48..2ec271cdb6b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -217,7 +217,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 217 | glyph with suitably computed width. Both the blanks and the | 217 | glyph with suitably computed width. Both the blanks and the |
| 218 | stretch glyph are given the face of the background of the line. | 218 | stretch glyph are given the face of the background of the line. |
| 219 | This way, the terminal-specific back-end can still draw the glyphs | 219 | This way, the terminal-specific back-end can still draw the glyphs |
| 220 | left to right, even for R2L lines. */ | 220 | left to right, even for R2L lines. |
| 221 | |||
| 222 | Note one important detail mentioned above: that the bidi reordering | ||
| 223 | engine, driven by the iterator, produces characters in R2L rows | ||
| 224 | starting at the character that will be the rightmost on display. | ||
| 225 | As far as the iterator is concerned, the geometry of such rows is | ||
| 226 | still left to right, i.e. the iterator "thinks" the first character | ||
| 227 | is at the leftmost pixel position. The iterator does not know that | ||
| 228 | PRODUCE_GLYPHS reverses the order of the glyphs that the iterator | ||
| 229 | delivers. This is important when functions from the the move_it_* | ||
| 230 | family are used to get to certain screen position or to match | ||
| 231 | screen coordinates with buffer coordinates: these functions use the | ||
| 232 | iterator geometry, which is left to right even in R2L paragraphs. | ||
| 233 | This works well with most callers of move_it_*, because they need | ||
| 234 | to get to a specific column, and columns are still numbered in the | ||
| 235 | reading order, i.e. the rightmost character in a R2L paragraph is | ||
| 236 | still column zero. But some callers do not get well with this; a | ||
| 237 | notable example is mouse clicks that need to find the character | ||
| 238 | that corresponds to certain pixel coordinates. See | ||
| 239 | buffer_posn_from_coords in dispnew.c for how this is handled. */ | ||
| 221 | 240 | ||
| 222 | #include <config.h> | 241 | #include <config.h> |
| 223 | #include <stdio.h> | 242 | #include <stdio.h> |
| @@ -1208,7 +1227,7 @@ window_box_left_offset (struct window *w, int area) | |||
| 1208 | 1227 | ||
| 1209 | 1228 | ||
| 1210 | /* Return the window-relative coordinate of the right edge of display | 1229 | /* Return the window-relative coordinate of the right edge of display |
| 1211 | area AREA of window W. AREA < 0 means return the left edge of the | 1230 | area AREA of window W. AREA < 0 means return the right edge of the |
| 1212 | whole window, to the left of the right fringe of W. */ | 1231 | whole window, to the left of the right fringe of W. */ |
| 1213 | 1232 | ||
| 1214 | INLINE int | 1233 | INLINE int |
| @@ -1238,7 +1257,7 @@ window_box_left (struct window *w, int area) | |||
| 1238 | 1257 | ||
| 1239 | 1258 | ||
| 1240 | /* Return the frame-relative coordinate of the right edge of display | 1259 | /* Return the frame-relative coordinate of the right edge of display |
| 1241 | area AREA of window W. AREA < 0 means return the left edge of the | 1260 | area AREA of window W. AREA < 0 means return the right edge of the |
| 1242 | whole window, to the left of the right fringe of W. */ | 1261 | whole window, to the left of the right fringe of W. */ |
| 1243 | 1262 | ||
| 1244 | INLINE int | 1263 | INLINE int |
| @@ -3158,7 +3177,7 @@ compute_stop_pos (struct it *it) | |||
| 3158 | { | 3177 | { |
| 3159 | register INTERVAL iv, next_iv; | 3178 | register INTERVAL iv, next_iv; |
| 3160 | Lisp_Object object, limit, position; | 3179 | Lisp_Object object, limit, position; |
| 3161 | EMACS_INT charpos, bytepos; | 3180 | EMACS_INT charpos, bytepos, stoppos; |
| 3162 | 3181 | ||
| 3163 | /* If nowhere else, stop at the end. */ | 3182 | /* If nowhere else, stop at the end. */ |
| 3164 | it->stop_charpos = it->end_charpos; | 3183 | it->stop_charpos = it->end_charpos; |
| @@ -3248,8 +3267,12 @@ compute_stop_pos (struct it *it) | |||
| 3248 | } | 3267 | } |
| 3249 | } | 3268 | } |
| 3250 | 3269 | ||
| 3270 | if (it->bidi_p && it->bidi_it.scan_dir < 0) | ||
| 3271 | stoppos = -1; | ||
| 3272 | else | ||
| 3273 | stoppos = it->stop_charpos; | ||
| 3251 | composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, | 3274 | composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, |
| 3252 | it->stop_charpos, it->string); | 3275 | stoppos, it->string); |
| 3253 | 3276 | ||
| 3254 | xassert (STRINGP (it->string) | 3277 | xassert (STRINGP (it->string) |
| 3255 | || (it->stop_charpos >= BEGV | 3278 | || (it->stop_charpos >= BEGV |
| @@ -5739,10 +5762,23 @@ get_next_display_element (struct it *it) | |||
| 5739 | struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte); | 5762 | struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte); |
| 5740 | enum { char_is_other = 0, char_is_nbsp, char_is_soft_hyphen } | 5763 | enum { char_is_other = 0, char_is_nbsp, char_is_soft_hyphen } |
| 5741 | nbsp_or_shy = char_is_other; | 5764 | nbsp_or_shy = char_is_other; |
| 5742 | int decoded = it->c; | 5765 | int c = it->c; /* This is the character to display. */ |
| 5766 | |||
| 5767 | if (! it->multibyte_p && ! ASCII_CHAR_P (c)) | ||
| 5768 | { | ||
| 5769 | xassert (SINGLE_BYTE_CHAR_P (c)); | ||
| 5770 | if (unibyte_display_via_language_environment) | ||
| 5771 | { | ||
| 5772 | c = DECODE_CHAR (unibyte, c); | ||
| 5773 | if (c < 0) | ||
| 5774 | c = BYTE8_TO_CHAR (it->c); | ||
| 5775 | } | ||
| 5776 | else | ||
| 5777 | c = BYTE8_TO_CHAR (it->c); | ||
| 5778 | } | ||
| 5743 | 5779 | ||
| 5744 | if (it->dp | 5780 | if (it->dp |
| 5745 | && (dv = DISP_CHAR_VECTOR (it->dp, it->c), | 5781 | && (dv = DISP_CHAR_VECTOR (it->dp, c), |
| 5746 | VECTORP (dv))) | 5782 | VECTORP (dv))) |
| 5747 | { | 5783 | { |
| 5748 | struct Lisp_Vector *v = XVECTOR (dv); | 5784 | struct Lisp_Vector *v = XVECTOR (dv); |
| @@ -5768,21 +5804,10 @@ get_next_display_element (struct it *it) | |||
| 5768 | goto get_next; | 5804 | goto get_next; |
| 5769 | } | 5805 | } |
| 5770 | 5806 | ||
| 5771 | if (unibyte_display_via_language_environment | 5807 | if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) |
| 5772 | && !ASCII_CHAR_P (it->c)) | 5808 | nbsp_or_shy = (c == 0xA0 ? char_is_nbsp |
| 5773 | decoded = DECODE_CHAR (unibyte, it->c); | 5809 | : c == 0xAD ? char_is_soft_hyphen |
| 5774 | 5810 | : char_is_other); | |
| 5775 | if (it->c >= 0x80 && ! NILP (Vnobreak_char_display)) | ||
| 5776 | { | ||
| 5777 | if (it->multibyte_p) | ||
| 5778 | nbsp_or_shy = (it->c == 0xA0 ? char_is_nbsp | ||
| 5779 | : it->c == 0xAD ? char_is_soft_hyphen | ||
| 5780 | : char_is_other); | ||
| 5781 | else if (unibyte_display_via_language_environment) | ||
| 5782 | nbsp_or_shy = (decoded == 0xA0 ? char_is_nbsp | ||
| 5783 | : decoded == 0xAD ? char_is_soft_hyphen | ||
| 5784 | : char_is_other); | ||
| 5785 | } | ||
| 5786 | 5811 | ||
| 5787 | /* Translate control characters into `\003' or `^C' form. | 5812 | /* Translate control characters into `\003' or `^C' form. |
| 5788 | Control characters coming from a display table entry are | 5813 | Control characters coming from a display table entry are |
| @@ -5790,27 +5815,23 @@ get_next_display_element (struct it *it) | |||
| 5790 | the translation. This could easily be changed but I | 5815 | the translation. This could easily be changed but I |
| 5791 | don't believe that it is worth doing. | 5816 | don't believe that it is worth doing. |
| 5792 | 5817 | ||
| 5793 | If it->multibyte_p is nonzero, non-printable non-ASCII | 5818 | NBSP and SOFT-HYPEN are property translated too. |
| 5794 | characters are also translated to octal form. | ||
| 5795 | 5819 | ||
| 5796 | If it->multibyte_p is zero, eight-bit characters that | 5820 | Non-printable characters and raw-byte characters are also |
| 5797 | don't have corresponding multibyte char code are also | ||
| 5798 | translated to octal form. */ | 5821 | translated to octal form. */ |
| 5799 | if ((it->c < ' ' | 5822 | if (((c < ' ' || c == 127) /* ASCII control chars */ |
| 5800 | ? (it->area != TEXT_AREA | 5823 | ? (it->area != TEXT_AREA |
| 5801 | /* In mode line, treat \n, \t like other crl chars. */ | 5824 | /* In mode line, treat \n, \t like other crl chars. */ |
| 5802 | || (it->c != '\t' | 5825 | || (c != '\t' |
| 5803 | && it->glyph_row | 5826 | && it->glyph_row |
| 5804 | && (it->glyph_row->mode_line_p || it->avoid_cursor_p)) | 5827 | && (it->glyph_row->mode_line_p || it->avoid_cursor_p)) |
| 5805 | || (it->c != '\n' && it->c != '\t')) | 5828 | || (c != '\n' && c != '\t')) |
| 5806 | : (nbsp_or_shy | 5829 | : (nbsp_or_shy |
| 5807 | || (it->multibyte_p | 5830 | || CHAR_BYTE8_P (c) |
| 5808 | ? ! CHAR_PRINTABLE_P (it->c) | 5831 | || ! CHAR_PRINTABLE_P (c)))) |
| 5809 | : (! unibyte_display_via_language_environment | ||
| 5810 | ? it->c >= 0x80 | ||
| 5811 | : (decoded >= 0x80 && decoded < 0xA0)))))) | ||
| 5812 | { | 5832 | { |
| 5813 | /* IT->c is a control character which must be displayed | 5833 | /* C is a control character, NBSP, SOFT-HYPEN, raw-byte, |
| 5834 | or a non-printable character which must be displayed | ||
| 5814 | either as '\003' or as `^C' where the '\\' and '^' | 5835 | either as '\003' or as `^C' where the '\\' and '^' |
| 5815 | can be defined in the display table. Fill | 5836 | can be defined in the display table. Fill |
| 5816 | IT->ctl_chars with glyphs for what we have to | 5837 | IT->ctl_chars with glyphs for what we have to |
| @@ -5822,7 +5843,7 @@ get_next_display_element (struct it *it) | |||
| 5822 | 5843 | ||
| 5823 | /* Handle control characters with ^. */ | 5844 | /* Handle control characters with ^. */ |
| 5824 | 5845 | ||
| 5825 | if (it->c < 128 && it->ctl_arrow_p) | 5846 | if (ASCII_CHAR_P (c) && it->ctl_arrow_p) |
| 5826 | { | 5847 | { |
| 5827 | int g; | 5848 | int g; |
| 5828 | 5849 | ||
| @@ -5855,7 +5876,7 @@ get_next_display_element (struct it *it) | |||
| 5855 | } | 5876 | } |
| 5856 | 5877 | ||
| 5857 | XSETINT (it->ctl_chars[0], g); | 5878 | XSETINT (it->ctl_chars[0], g); |
| 5858 | XSETINT (it->ctl_chars[1], it->c ^ 0100); | 5879 | XSETINT (it->ctl_chars[1], c ^ 0100); |
| 5859 | ctl_len = 2; | 5880 | ctl_len = 2; |
| 5860 | goto display_control; | 5881 | goto display_control; |
| 5861 | } | 5882 | } |
| @@ -5870,7 +5891,7 @@ get_next_display_element (struct it *it) | |||
| 5870 | face_id = merge_faces (it->f, Qnobreak_space, 0, | 5891 | face_id = merge_faces (it->f, Qnobreak_space, 0, |
| 5871 | it->face_id); | 5892 | it->face_id); |
| 5872 | 5893 | ||
| 5873 | it->c = ' '; | 5894 | c = ' '; |
| 5874 | XSETINT (it->ctl_chars[0], ' '); | 5895 | XSETINT (it->ctl_chars[0], ' '); |
| 5875 | ctl_len = 1; | 5896 | ctl_len = 1; |
| 5876 | goto display_control; | 5897 | goto display_control; |
| @@ -5916,7 +5937,6 @@ get_next_display_element (struct it *it) | |||
| 5916 | if (EQ (Vnobreak_char_display, Qt) | 5937 | if (EQ (Vnobreak_char_display, Qt) |
| 5917 | && nbsp_or_shy == char_is_soft_hyphen) | 5938 | && nbsp_or_shy == char_is_soft_hyphen) |
| 5918 | { | 5939 | { |
| 5919 | it->c = '-'; | ||
| 5920 | XSETINT (it->ctl_chars[0], '-'); | 5940 | XSETINT (it->ctl_chars[0], '-'); |
| 5921 | ctl_len = 1; | 5941 | ctl_len = 1; |
| 5922 | goto display_control; | 5942 | goto display_control; |
| @@ -5928,55 +5948,25 @@ get_next_display_element (struct it *it) | |||
| 5928 | if (nbsp_or_shy) | 5948 | if (nbsp_or_shy) |
| 5929 | { | 5949 | { |
| 5930 | XSETINT (it->ctl_chars[0], escape_glyph); | 5950 | XSETINT (it->ctl_chars[0], escape_glyph); |
| 5931 | it->c = (nbsp_or_shy == char_is_nbsp ? ' ' : '-'); | 5951 | c = (nbsp_or_shy == char_is_nbsp ? ' ' : '-'); |
| 5932 | XSETINT (it->ctl_chars[1], it->c); | 5952 | XSETINT (it->ctl_chars[1], c); |
| 5933 | ctl_len = 2; | 5953 | ctl_len = 2; |
| 5934 | goto display_control; | 5954 | goto display_control; |
| 5935 | } | 5955 | } |
| 5936 | 5956 | ||
| 5937 | { | 5957 | { |
| 5938 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 5958 | char str[10]; |
| 5939 | int len; | 5959 | int len, i; |
| 5940 | int i; | ||
| 5941 | 5960 | ||
| 5942 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ | 5961 | if (CHAR_BYTE8_P (c)) |
| 5943 | if (CHAR_BYTE8_P (it->c)) | 5962 | /* Display \200 instead of \17777600. */ |
| 5944 | { | 5963 | c = CHAR_TO_BYTE8 (c); |
| 5945 | str[0] = CHAR_TO_BYTE8 (it->c); | 5964 | len = sprintf (str, "%03o", c); |
| 5946 | len = 1; | ||
| 5947 | } | ||
| 5948 | else if (it->c < 256) | ||
| 5949 | { | ||
| 5950 | str[0] = it->c; | ||
| 5951 | len = 1; | ||
| 5952 | } | ||
| 5953 | else | ||
| 5954 | { | ||
| 5955 | /* It's an invalid character, which shouldn't | ||
| 5956 | happen actually, but due to bugs it may | ||
| 5957 | happen. Let's print the char as is, there's | ||
| 5958 | not much meaningful we can do with it. */ | ||
| 5959 | str[0] = it->c; | ||
| 5960 | str[1] = it->c >> 8; | ||
| 5961 | str[2] = it->c >> 16; | ||
| 5962 | str[3] = it->c >> 24; | ||
| 5963 | len = 4; | ||
| 5964 | } | ||
| 5965 | 5965 | ||
| 5966 | XSETINT (it->ctl_chars[0], escape_glyph); | ||
| 5966 | for (i = 0; i < len; i++) | 5967 | for (i = 0; i < len; i++) |
| 5967 | { | 5968 | XSETINT (it->ctl_chars[i + 1], str[i]); |
| 5968 | int g; | 5969 | ctl_len = len + 1; |
| 5969 | XSETINT (it->ctl_chars[i * 4], escape_glyph); | ||
| 5970 | /* Insert three more glyphs into IT->ctl_chars for | ||
| 5971 | the octal display of the character. */ | ||
| 5972 | g = ((str[i] >> 6) & 7) + '0'; | ||
| 5973 | XSETINT (it->ctl_chars[i * 4 + 1], g); | ||
| 5974 | g = ((str[i] >> 3) & 7) + '0'; | ||
| 5975 | XSETINT (it->ctl_chars[i * 4 + 2], g); | ||
| 5976 | g = (str[i] & 7) + '0'; | ||
| 5977 | XSETINT (it->ctl_chars[i * 4 + 3], g); | ||
| 5978 | } | ||
| 5979 | ctl_len = len * 4; | ||
| 5980 | } | 5970 | } |
| 5981 | 5971 | ||
| 5982 | display_control: | 5972 | display_control: |
| @@ -5991,6 +5981,11 @@ get_next_display_element (struct it *it) | |||
| 5991 | it->ellipsis_p = 0; | 5981 | it->ellipsis_p = 0; |
| 5992 | goto get_next; | 5982 | goto get_next; |
| 5993 | } | 5983 | } |
| 5984 | it->char_to_display = c; | ||
| 5985 | } | ||
| 5986 | else if (success_p) | ||
| 5987 | { | ||
| 5988 | it->char_to_display = it->c; | ||
| 5994 | } | 5989 | } |
| 5995 | } | 5990 | } |
| 5996 | 5991 | ||
| @@ -6017,7 +6012,8 @@ get_next_display_element (struct it *it) | |||
| 6017 | : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) | 6012 | : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) |
| 6018 | : IT_CHARPOS (*it)); | 6013 | : IT_CHARPOS (*it)); |
| 6019 | 6014 | ||
| 6020 | it->face_id = FACE_FOR_CHAR (it->f, face, it->c, pos, it->string); | 6015 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, pos, |
| 6016 | it->string); | ||
| 6021 | } | 6017 | } |
| 6022 | } | 6018 | } |
| 6023 | #endif | 6019 | #endif |
| @@ -10839,7 +10835,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 10839 | enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; | 10835 | enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; |
| 10840 | int mouse_down_p, rc; | 10836 | int mouse_down_p, rc; |
| 10841 | 10837 | ||
| 10842 | /* Function note_mouse_highlight is called with negative x(y | 10838 | /* Function note_mouse_highlight is called with negative X/Y |
| 10843 | values when mouse moves outside of the frame. */ | 10839 | values when mouse moves outside of the frame. */ |
| 10844 | if (x <= 0 || y <= 0) | 10840 | if (x <= 0 || y <= 0) |
| 10845 | { | 10841 | { |
| @@ -16458,15 +16454,19 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) | |||
| 16458 | 16454 | ||
| 16459 | /* Get the next character. */ | 16455 | /* Get the next character. */ |
| 16460 | if (multibyte_p) | 16456 | if (multibyte_p) |
| 16461 | it.c = string_char_and_length (p, &it.len); | 16457 | it.c = it.char_to_display = string_char_and_length (p, &it.len); |
| 16462 | else | 16458 | else |
| 16463 | it.c = *p, it.len = 1; | 16459 | { |
| 16460 | it.c = it.char_to_display = *p, it.len = 1; | ||
| 16461 | if (! ASCII_CHAR_P (it.c)) | ||
| 16462 | it.char_to_display = BYTE8_TO_CHAR (it.c); | ||
| 16463 | } | ||
| 16464 | p += it.len; | 16464 | p += it.len; |
| 16465 | 16465 | ||
| 16466 | /* Get its face. */ | 16466 | /* Get its face. */ |
| 16467 | ilisp = make_number (p - arrow_string); | 16467 | ilisp = make_number (p - arrow_string); |
| 16468 | face = Fget_text_property (ilisp, Qface, overlay_arrow_string); | 16468 | face = Fget_text_property (ilisp, Qface, overlay_arrow_string); |
| 16469 | it.face_id = compute_char_face (f, it.c, face); | 16469 | it.face_id = compute_char_face (f, it.char_to_display, face); |
| 16470 | 16470 | ||
| 16471 | /* Compute its width, get its glyphs. */ | 16471 | /* Compute its width, get its glyphs. */ |
| 16472 | n_glyphs_before = it.glyph_row->used[TEXT_AREA]; | 16472 | n_glyphs_before = it.glyph_row->used[TEXT_AREA]; |
| @@ -16698,6 +16698,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 16698 | append_space_for_newline has been called. */ | 16698 | append_space_for_newline has been called. */ |
| 16699 | enum display_element_type saved_what = it->what; | 16699 | enum display_element_type saved_what = it->what; |
| 16700 | int saved_c = it->c, saved_len = it->len; | 16700 | int saved_c = it->c, saved_len = it->len; |
| 16701 | int saved_char_to_display = it->char_to_display; | ||
| 16701 | int saved_x = it->current_x; | 16702 | int saved_x = it->current_x; |
| 16702 | int saved_face_id = it->face_id; | 16703 | int saved_face_id = it->face_id; |
| 16703 | struct text_pos saved_pos; | 16704 | struct text_pos saved_pos; |
| @@ -16710,7 +16711,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 16710 | it->what = IT_CHARACTER; | 16711 | it->what = IT_CHARACTER; |
| 16711 | memset (&it->position, 0, sizeof it->position); | 16712 | memset (&it->position, 0, sizeof it->position); |
| 16712 | it->object = make_number (0); | 16713 | it->object = make_number (0); |
| 16713 | it->c = ' '; | 16714 | it->c = it->char_to_display = ' '; |
| 16714 | it->len = 1; | 16715 | it->len = 1; |
| 16715 | 16716 | ||
| 16716 | if (default_face_p) | 16717 | if (default_face_p) |
| @@ -16731,6 +16732,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 16731 | it->face_id = saved_face_id; | 16732 | it->face_id = saved_face_id; |
| 16732 | it->len = saved_len; | 16733 | it->len = saved_len; |
| 16733 | it->c = saved_c; | 16734 | it->c = saved_c; |
| 16735 | it->char_to_display = saved_char_to_display; | ||
| 16734 | return 1; | 16736 | return 1; |
| 16735 | } | 16737 | } |
| 16736 | } | 16738 | } |
| @@ -16863,7 +16865,7 @@ extend_face_to_end_of_line (struct it *it) | |||
| 16863 | it->what = IT_CHARACTER; | 16865 | it->what = IT_CHARACTER; |
| 16864 | memset (&it->position, 0, sizeof it->position); | 16866 | memset (&it->position, 0, sizeof it->position); |
| 16865 | it->object = make_number (0); | 16867 | it->object = make_number (0); |
| 16866 | it->c = ' '; | 16868 | it->c = it->char_to_display = ' '; |
| 16867 | it->len = 1; | 16869 | it->len = 1; |
| 16868 | /* The last row's blank glyphs should get the default face, to | 16870 | /* The last row's blank glyphs should get the default face, to |
| 16869 | avoid painting the rest of the window with the region face, | 16871 | avoid painting the rest of the window with the region face, |
| @@ -17962,16 +17964,22 @@ See also `bidi-paragraph-direction'. */) | |||
| 17962 | struct bidi_it itb; | 17964 | struct bidi_it itb; |
| 17963 | EMACS_INT pos = BUF_PT (buf); | 17965 | EMACS_INT pos = BUF_PT (buf); |
| 17964 | EMACS_INT bytepos = BUF_PT_BYTE (buf); | 17966 | EMACS_INT bytepos = BUF_PT_BYTE (buf); |
| 17967 | int c; | ||
| 17965 | 17968 | ||
| 17966 | if (buf != current_buffer) | 17969 | if (buf != current_buffer) |
| 17967 | set_buffer_temp (buf); | 17970 | set_buffer_temp (buf); |
| 17968 | /* Find previous non-empty line. */ | 17971 | /* bidi_paragraph_init finds the base direction of the paragraph |
| 17972 | by searching forward from paragraph start. We need the base | ||
| 17973 | direction of the current or _previous_ paragraph, so we need | ||
| 17974 | to make sure we are within that paragraph. To that end, find | ||
| 17975 | the previous non-empty line. */ | ||
| 17969 | if (pos >= ZV && pos > BEGV) | 17976 | if (pos >= ZV && pos > BEGV) |
| 17970 | { | 17977 | { |
| 17971 | pos--; | 17978 | pos--; |
| 17972 | bytepos = CHAR_TO_BYTE (pos); | 17979 | bytepos = CHAR_TO_BYTE (pos); |
| 17973 | } | 17980 | } |
| 17974 | while (FETCH_BYTE (bytepos) == '\n') | 17981 | while ((c = FETCH_BYTE (bytepos)) == '\n' |
| 17982 | || c == ' ' || c == '\t' || c == '\f') | ||
| 17975 | { | 17983 | { |
| 17976 | if (bytepos <= BEGV_BYTE) | 17984 | if (bytepos <= BEGV_BYTE) |
| 17977 | break; | 17985 | break; |
| @@ -17983,6 +17991,7 @@ See also `bidi-paragraph-direction'. */) | |||
| 17983 | itb.charpos = pos; | 17991 | itb.charpos = pos; |
| 17984 | itb.bytepos = bytepos; | 17992 | itb.bytepos = bytepos; |
| 17985 | itb.first_elt = 1; | 17993 | itb.first_elt = 1; |
| 17994 | itb.separator_limit = -1; | ||
| 17986 | 17995 | ||
| 17987 | bidi_paragraph_init (NEUTRAL_DIR, &itb); | 17996 | bidi_paragraph_init (NEUTRAL_DIR, &itb); |
| 17988 | if (buf != current_buffer) | 17997 | if (buf != current_buffer) |
| @@ -20460,7 +20469,12 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, | |||
| 20460 | 20469 | ||
| 20461 | if (face->font) | 20470 | if (face->font) |
| 20462 | { | 20471 | { |
| 20463 | unsigned code = face->font->driver->encode_char (face->font, glyph->u.ch); | 20472 | unsigned code; |
| 20473 | |||
| 20474 | if (CHAR_BYTE8_P (glyph->u.ch)) | ||
| 20475 | code = CHAR_TO_BYTE8 (glyph->u.ch); | ||
| 20476 | else | ||
| 20477 | code = face->font->driver->encode_char (face->font, glyph->u.ch); | ||
| 20464 | 20478 | ||
| 20465 | if (code != FONT_INVALID_CODE) | 20479 | if (code != FONT_INVALID_CODE) |
| 20466 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); | 20480 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); |
| @@ -20475,6 +20489,26 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, | |||
| 20475 | } | 20489 | } |
| 20476 | 20490 | ||
| 20477 | 20491 | ||
| 20492 | /* Get glyph code of character C in FONT in the two-byte form CHAR2B. | ||
| 20493 | Retunr 1 if FONT has a glyph for C, otherwise return 0. */ | ||
| 20494 | |||
| 20495 | static INLINE int | ||
| 20496 | get_char_glyph_code (int c, struct font *font, XChar2b *char2b) | ||
| 20497 | { | ||
| 20498 | unsigned code; | ||
| 20499 | |||
| 20500 | if (CHAR_BYTE8_P (c)) | ||
| 20501 | code = CHAR_TO_BYTE8 (c); | ||
| 20502 | else | ||
| 20503 | code = font->driver->encode_char (font, c); | ||
| 20504 | |||
| 20505 | if (code == FONT_INVALID_CODE) | ||
| 20506 | return 0; | ||
| 20507 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); | ||
| 20508 | return 1; | ||
| 20509 | } | ||
| 20510 | |||
| 20511 | |||
| 20478 | /* Fill glyph string S with composition components specified by S->cmp. | 20512 | /* Fill glyph string S with composition components specified by S->cmp. |
| 20479 | 20513 | ||
| 20480 | BASE_FACE is the base face of the composition. | 20514 | BASE_FACE is the base face of the composition. |
| @@ -21879,10 +21913,14 @@ produce_stretch_glyph (struct it *it) | |||
| 21879 | { | 21913 | { |
| 21880 | int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) | 21914 | int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) |
| 21881 | - IT_BYTEPOS (*it)); | 21915 | - IT_BYTEPOS (*it)); |
| 21882 | it2.c = STRING_CHAR_AND_LENGTH (p, it2.len); | 21916 | it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len); |
| 21883 | } | 21917 | } |
| 21884 | else | 21918 | else |
| 21885 | it2.c = *p, it2.len = 1; | 21919 | { |
| 21920 | it2.c = it2.char_to_display = *p, it2.len = 1; | ||
| 21921 | if (! ASCII_CHAR_P (it2.c)) | ||
| 21922 | it2.char_to_display = BYTE8_TO_CHAR (it2.c); | ||
| 21923 | } | ||
| 21886 | 21924 | ||
| 21887 | it2.glyph_row = NULL; | 21925 | it2.glyph_row = NULL; |
| 21888 | it2.what = IT_CHARACTER; | 21926 | it2.what = IT_CHARACTER; |
| @@ -22052,49 +22090,12 @@ x_produce_glyphs (struct it *it) | |||
| 22052 | if (it->what == IT_CHARACTER) | 22090 | if (it->what == IT_CHARACTER) |
| 22053 | { | 22091 | { |
| 22054 | XChar2b char2b; | 22092 | XChar2b char2b; |
| 22055 | struct font *font; | ||
| 22056 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 22093 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| 22057 | struct font_metrics *pcm; | 22094 | struct font *font = face->font; |
| 22058 | int font_not_found_p; | 22095 | int font_not_found_p = font == NULL; |
| 22096 | struct font_metrics *pcm = NULL; | ||
| 22059 | int boff; /* baseline offset */ | 22097 | int boff; /* baseline offset */ |
| 22060 | /* We may change it->multibyte_p upon unibyte<->multibyte | ||
| 22061 | conversion. So, save the current value now and restore it | ||
| 22062 | later. | ||
| 22063 | |||
| 22064 | Note: It seems that we don't have to record multibyte_p in | ||
| 22065 | struct glyph because the character code itself tells whether | ||
| 22066 | or not the character is multibyte. Thus, in the future, we | ||
| 22067 | must consider eliminating the field `multibyte_p' in the | ||
| 22068 | struct glyph. */ | ||
| 22069 | int saved_multibyte_p = it->multibyte_p; | ||
| 22070 | |||
| 22071 | /* Maybe translate single-byte characters to multibyte, or the | ||
| 22072 | other way. */ | ||
| 22073 | it->char_to_display = it->c; | ||
| 22074 | if (!ASCII_BYTE_P (it->c) | ||
| 22075 | && ! it->multibyte_p) | ||
| 22076 | { | ||
| 22077 | if (SINGLE_BYTE_CHAR_P (it->c) | ||
| 22078 | && unibyte_display_via_language_environment) | ||
| 22079 | { | ||
| 22080 | struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte); | ||
| 22081 | |||
| 22082 | /* get_next_display_element assures that this decoding | ||
| 22083 | never fails. */ | ||
| 22084 | it->char_to_display = DECODE_CHAR (unibyte, it->c); | ||
| 22085 | it->multibyte_p = 1; | ||
| 22086 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, | ||
| 22087 | -1, Qnil); | ||
| 22088 | face = FACE_FROM_ID (it->f, it->face_id); | ||
| 22089 | } | ||
| 22090 | } | ||
| 22091 | |||
| 22092 | /* Get font to use. Encode IT->char_to_display. */ | ||
| 22093 | get_char_face_and_encoding (it->f, it->char_to_display, it->face_id, | ||
| 22094 | &char2b, it->multibyte_p, 0); | ||
| 22095 | font = face->font; | ||
| 22096 | 22098 | ||
| 22097 | font_not_found_p = font == NULL; | ||
| 22098 | if (font_not_found_p) | 22099 | if (font_not_found_p) |
| 22099 | { | 22100 | { |
| 22100 | /* When no suitable font found, display an empty box based | 22101 | /* When no suitable font found, display an empty box based |
| @@ -22114,16 +22115,12 @@ x_produce_glyphs (struct it *it) | |||
| 22114 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; | 22115 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; |
| 22115 | } | 22116 | } |
| 22116 | 22117 | ||
| 22117 | if (it->char_to_display >= ' ' | 22118 | if (it->char_to_display != '\n' && it->char_to_display != '\t') |
| 22118 | && (!it->multibyte_p || it->char_to_display < 128)) | ||
| 22119 | { | 22119 | { |
| 22120 | /* Either unibyte or ASCII. */ | ||
| 22121 | int stretched_p; | 22120 | int stretched_p; |
| 22122 | 22121 | ||
| 22123 | it->nglyphs = 1; | 22122 | it->nglyphs = 1; |
| 22124 | 22123 | ||
| 22125 | pcm = get_per_char_metric (it->f, font, &char2b); | ||
| 22126 | |||
| 22127 | if (it->override_ascent >= 0) | 22124 | if (it->override_ascent >= 0) |
| 22128 | { | 22125 | { |
| 22129 | it->ascent = it->override_ascent; | 22126 | it->ascent = it->override_ascent; |
| @@ -22136,6 +22133,15 @@ x_produce_glyphs (struct it *it) | |||
| 22136 | it->descent = FONT_DESCENT (font) - boff; | 22133 | it->descent = FONT_DESCENT (font) - boff; |
| 22137 | } | 22134 | } |
| 22138 | 22135 | ||
| 22136 | if (! font_not_found_p | ||
| 22137 | && get_char_glyph_code (it->char_to_display, font, &char2b)) | ||
| 22138 | { | ||
| 22139 | pcm = get_per_char_metric (it->f, font, &char2b); | ||
| 22140 | if (pcm->width == 0 | ||
| 22141 | && pcm->rbearing == 0 && pcm->lbearing == 0) | ||
| 22142 | pcm = NULL; | ||
| 22143 | } | ||
| 22144 | |||
| 22139 | if (pcm) | 22145 | if (pcm) |
| 22140 | { | 22146 | { |
| 22141 | it->phys_ascent = pcm->ascent + boff; | 22147 | it->phys_ascent = pcm->ascent + boff; |
| @@ -22147,7 +22153,7 @@ x_produce_glyphs (struct it *it) | |||
| 22147 | it->glyph_not_available_p = 1; | 22153 | it->glyph_not_available_p = 1; |
| 22148 | it->phys_ascent = it->ascent; | 22154 | it->phys_ascent = it->ascent; |
| 22149 | it->phys_descent = it->descent; | 22155 | it->phys_descent = it->descent; |
| 22150 | it->pixel_width = FONT_WIDTH (font); | 22156 | it->pixel_width = font->space_width; |
| 22151 | } | 22157 | } |
| 22152 | 22158 | ||
| 22153 | if (it->constrain_row_ascent_descent_p) | 22159 | if (it->constrain_row_ascent_descent_p) |
| @@ -22321,7 +22327,7 @@ x_produce_glyphs (struct it *it) | |||
| 22321 | } | 22327 | } |
| 22322 | } | 22328 | } |
| 22323 | } | 22329 | } |
| 22324 | else if (it->char_to_display == '\t') | 22330 | else /* i.e. (it->char_to_display == '\t') */ |
| 22325 | { | 22331 | { |
| 22326 | if (font->space_width > 0) | 22332 | if (font->space_width > 0) |
| 22327 | { | 22333 | { |
| @@ -22352,85 +22358,6 @@ x_produce_glyphs (struct it *it) | |||
| 22352 | it->nglyphs = 1; | 22358 | it->nglyphs = 1; |
| 22353 | } | 22359 | } |
| 22354 | } | 22360 | } |
| 22355 | else | ||
| 22356 | { | ||
| 22357 | /* A multi-byte character. Assume that the display width of the | ||
| 22358 | character is the width of the character multiplied by the | ||
| 22359 | width of the font. */ | ||
| 22360 | |||
| 22361 | /* If we found a font, this font should give us the right | ||
| 22362 | metrics. If we didn't find a font, use the frame's | ||
| 22363 | default font and calculate the width of the character by | ||
| 22364 | multiplying the width of font by the width of the | ||
| 22365 | character. */ | ||
| 22366 | |||
| 22367 | pcm = get_per_char_metric (it->f, font, &char2b); | ||
| 22368 | |||
| 22369 | if (font_not_found_p || !pcm) | ||
| 22370 | { | ||
| 22371 | int char_width = CHAR_WIDTH (it->char_to_display); | ||
| 22372 | |||
| 22373 | if (char_width == 0) | ||
| 22374 | /* This is a non spacing character. But, as we are | ||
| 22375 | going to display an empty box, the box must occupy | ||
| 22376 | at least one column. */ | ||
| 22377 | char_width = 1; | ||
| 22378 | it->glyph_not_available_p = 1; | ||
| 22379 | it->pixel_width = font->space_width * char_width; | ||
| 22380 | it->phys_ascent = FONT_BASE (font) + boff; | ||
| 22381 | it->phys_descent = FONT_DESCENT (font) - boff; | ||
| 22382 | } | ||
| 22383 | else | ||
| 22384 | { | ||
| 22385 | it->pixel_width = pcm->width; | ||
| 22386 | it->phys_ascent = pcm->ascent + boff; | ||
| 22387 | it->phys_descent = pcm->descent - boff; | ||
| 22388 | if (it->glyph_row | ||
| 22389 | && (pcm->lbearing < 0 | ||
| 22390 | || pcm->rbearing > pcm->width)) | ||
| 22391 | it->glyph_row->contains_overlapping_glyphs_p = 1; | ||
| 22392 | } | ||
| 22393 | it->nglyphs = 1; | ||
| 22394 | it->ascent = FONT_BASE (font) + boff; | ||
| 22395 | it->descent = FONT_DESCENT (font) - boff; | ||
| 22396 | if (face->box != FACE_NO_BOX) | ||
| 22397 | { | ||
| 22398 | int thick = face->box_line_width; | ||
| 22399 | |||
| 22400 | if (thick > 0) | ||
| 22401 | { | ||
| 22402 | it->ascent += thick; | ||
| 22403 | it->descent += thick; | ||
| 22404 | } | ||
| 22405 | else | ||
| 22406 | thick = - thick; | ||
| 22407 | |||
| 22408 | if (it->start_of_box_run_p) | ||
| 22409 | it->pixel_width += thick; | ||
| 22410 | if (it->end_of_box_run_p) | ||
| 22411 | it->pixel_width += thick; | ||
| 22412 | } | ||
| 22413 | |||
| 22414 | /* If face has an overline, add the height of the overline | ||
| 22415 | (1 pixel) and a 1 pixel margin to the character height. */ | ||
| 22416 | if (face->overline_p) | ||
| 22417 | it->ascent += overline_margin; | ||
| 22418 | |||
| 22419 | take_vertical_position_into_account (it); | ||
| 22420 | |||
| 22421 | if (it->ascent < 0) | ||
| 22422 | it->ascent = 0; | ||
| 22423 | if (it->descent < 0) | ||
| 22424 | it->descent = 0; | ||
| 22425 | |||
| 22426 | if (it->glyph_row) | ||
| 22427 | append_glyph (it); | ||
| 22428 | if (it->pixel_width == 0) | ||
| 22429 | /* We assure that all visible glyphs have at least 1-pixel | ||
| 22430 | width. */ | ||
| 22431 | it->pixel_width = 1; | ||
| 22432 | } | ||
| 22433 | it->multibyte_p = saved_multibyte_p; | ||
| 22434 | } | 22361 | } |
| 22435 | else if (it->what == IT_COMPOSITION && it->cmp_it.ch < 0) | 22362 | else if (it->what == IT_COMPOSITION && it->cmp_it.ch < 0) |
| 22436 | { | 22363 | { |
| @@ -22526,7 +22453,7 @@ x_produce_glyphs (struct it *it) | |||
| 22526 | } | 22453 | } |
| 22527 | else | 22454 | else |
| 22528 | { | 22455 | { |
| 22529 | width = FONT_WIDTH (font); | 22456 | width = font->space_width; |
| 22530 | ascent = FONT_BASE (font); | 22457 | ascent = FONT_BASE (font); |
| 22531 | descent = FONT_DESCENT (font); | 22458 | descent = FONT_DESCENT (font); |
| 22532 | lbearing = 0; | 22459 | lbearing = 0; |
diff --git a/src/xfns.c b/src/xfns.c index bc28ccd3a63..cb6733e8fa1 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -648,12 +648,16 @@ int | |||
| 648 | x_defined_color (struct frame *f, const char *color_name, | 648 | x_defined_color (struct frame *f, const char *color_name, |
| 649 | XColor *color, int alloc_p) | 649 | XColor *color, int alloc_p) |
| 650 | { | 650 | { |
| 651 | int success_p; | 651 | int success_p = 0; |
| 652 | Display *dpy = FRAME_X_DISPLAY (f); | 652 | Display *dpy = FRAME_X_DISPLAY (f); |
| 653 | Colormap cmap = FRAME_X_COLORMAP (f); | 653 | Colormap cmap = FRAME_X_COLORMAP (f); |
| 654 | 654 | ||
| 655 | BLOCK_INPUT; | 655 | BLOCK_INPUT; |
| 656 | success_p = XParseColor (dpy, cmap, color_name, color); | 656 | #ifdef USE_GTK |
| 657 | success_p = xg_check_special_colors (f, color_name, color); | ||
| 658 | #endif | ||
| 659 | if (!success_p) | ||
| 660 | success_p = XParseColor (dpy, cmap, color_name, color); | ||
| 657 | if (success_p && alloc_p) | 661 | if (success_p && alloc_p) |
| 658 | success_p = x_alloc_nearest_color (f, cmap, color); | 662 | success_p = x_alloc_nearest_color (f, cmap, color); |
| 659 | UNBLOCK_INPUT; | 663 | UNBLOCK_INPUT; |
| @@ -3388,6 +3392,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3388 | "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN); | 3392 | "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN); |
| 3389 | x_default_parameter (f, parms, Qfullscreen, Qnil, | 3393 | x_default_parameter (f, parms, Qfullscreen, Qnil, |
| 3390 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | 3394 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); |
| 3395 | x_default_parameter (f, parms, Qtool_bar_position, | ||
| 3396 | f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL); | ||
| 3391 | 3397 | ||
| 3392 | /* Compute the size of the X window. */ | 3398 | /* Compute the size of the X window. */ |
| 3393 | window_prompting = x_figure_window_size (f, parms, 1); | 3399 | window_prompting = x_figure_window_size (f, parms, 1); |
| @@ -5233,7 +5239,7 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 5233 | /* When using system tooltip, tip_frame is the Emacs frame on which | 5239 | /* When using system tooltip, tip_frame is the Emacs frame on which |
| 5234 | the tip is shown. */ | 5240 | the tip is shown. */ |
| 5235 | f = XFRAME (frame); | 5241 | f = XFRAME (frame); |
| 5236 | if (xg_hide_tooltip (f)) | 5242 | if (FRAME_LIVE_P (f) && xg_hide_tooltip (f)) |
| 5237 | frame = Qnil; | 5243 | frame = Qnil; |
| 5238 | #endif | 5244 | #endif |
| 5239 | 5245 | ||
diff --git a/src/xmenu.c b/src/xmenu.c index 0b24a8f2bd6..68b442388a5 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -111,7 +111,7 @@ Lisp_Object Qdebug_on_next_call; | |||
| 111 | 111 | ||
| 112 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 112 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 113 | static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, | 113 | static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, |
| 114 | char **); | 114 | const char **); |
| 115 | #endif | 115 | #endif |
| 116 | 116 | ||
| 117 | static int update_frame_menubar (struct frame *); | 117 | static int update_frame_menubar (struct frame *); |
| @@ -312,7 +312,7 @@ for instance using the window manager, then this produces a quit and | |||
| 312 | #else | 312 | #else |
| 313 | { | 313 | { |
| 314 | Lisp_Object title; | 314 | Lisp_Object title; |
| 315 | char *error_name; | 315 | const char *error_name; |
| 316 | Lisp_Object selection; | 316 | Lisp_Object selection; |
| 317 | int specpdl_count = SPECPDL_INDEX (); | 317 | int specpdl_count = SPECPDL_INDEX (); |
| 318 | 318 | ||
| @@ -1600,7 +1600,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, | |||
| 1600 | 1600 | ||
| 1601 | Lisp_Object | 1601 | Lisp_Object |
| 1602 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 1602 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 1603 | Lisp_Object title, char **error, EMACS_UINT timestamp) | 1603 | Lisp_Object title, const char **error, EMACS_UINT timestamp) |
| 1604 | { | 1604 | { |
| 1605 | int i; | 1605 | int i; |
| 1606 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; | 1606 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
| @@ -1664,7 +1664,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 1664 | { | 1664 | { |
| 1665 | /* Create a new pane. */ | 1665 | /* Create a new pane. */ |
| 1666 | Lisp_Object pane_name, prefix; | 1666 | Lisp_Object pane_name, prefix; |
| 1667 | char *pane_string; | 1667 | const char *pane_string; |
| 1668 | 1668 | ||
| 1669 | pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); | 1669 | pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
| 1670 | prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); | 1670 | prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
| @@ -1976,12 +1976,16 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) | |||
| 1976 | 1976 | ||
| 1977 | #endif /* not USE_GTK */ | 1977 | #endif /* not USE_GTK */ |
| 1978 | 1978 | ||
| 1979 | static char * button_names [] = { | 1979 | static const char * button_names [] = { |
| 1980 | "button1", "button2", "button3", "button4", "button5", | 1980 | "button1", "button2", "button3", "button4", "button5", |
| 1981 | "button6", "button7", "button8", "button9", "button10" }; | 1981 | "button6", "button7", "button8", "button9", "button10" }; |
| 1982 | 1982 | ||
| 1983 | static Lisp_Object | 1983 | static Lisp_Object |
| 1984 | xdialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, char **error_name) | 1984 | xdialog_show (FRAME_PTR f, |
| 1985 | int keymaps, | ||
| 1986 | Lisp_Object title, | ||
| 1987 | Lisp_Object header, | ||
| 1988 | const char **error_name) | ||
| 1985 | { | 1989 | { |
| 1986 | int i, nb_buttons=0; | 1990 | int i, nb_buttons=0; |
| 1987 | char dialog_name[6]; | 1991 | char dialog_name[6]; |
| @@ -2008,7 +2012,7 @@ xdialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, c | |||
| 2008 | representing the text label and buttons. */ | 2012 | representing the text label and buttons. */ |
| 2009 | { | 2013 | { |
| 2010 | Lisp_Object pane_name, prefix; | 2014 | Lisp_Object pane_name, prefix; |
| 2011 | char *pane_string; | 2015 | const char *pane_string; |
| 2012 | pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; | 2016 | pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
| 2013 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; | 2017 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
| 2014 | pane_string = (NILP (pane_name) | 2018 | pane_string = (NILP (pane_name) |
| @@ -2239,7 +2243,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 2239 | 2243 | ||
| 2240 | Lisp_Object | 2244 | Lisp_Object |
| 2241 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 2245 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 2242 | Lisp_Object title, char **error, EMACS_UINT timestamp) | 2246 | Lisp_Object title, const char **error, EMACS_UINT timestamp) |
| 2243 | { | 2247 | { |
| 2244 | Window root; | 2248 | Window root; |
| 2245 | XMenu *menu; | 2249 | XMenu *menu; |
diff --git a/src/xml.c b/src/xml.c new file mode 100644 index 00000000000..c1098b15a20 --- /dev/null +++ b/src/xml.c | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | /* Interface to libxml2. | ||
| 2 | Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | #ifdef HAVE_LIBXML2 | ||
| 22 | |||
| 23 | #include <setjmp.h> | ||
| 24 | #include <libxml/tree.h> | ||
| 25 | #include <libxml/parser.h> | ||
| 26 | #include <libxml/HTMLparser.h> | ||
| 27 | |||
| 28 | #include "lisp.h" | ||
| 29 | #include "buffer.h" | ||
| 30 | |||
| 31 | Lisp_Object make_dom (xmlNode *node) | ||
| 32 | { | ||
| 33 | if (node->type == XML_ELEMENT_NODE) { | ||
| 34 | Lisp_Object result = Fcons (intern (node->name), Qnil); | ||
| 35 | xmlNode *child; | ||
| 36 | xmlAttr *property; | ||
| 37 | |||
| 38 | /* First add the attributes. */ | ||
| 39 | property = node->properties; | ||
| 40 | while (property != NULL) { | ||
| 41 | if (property->children && | ||
| 42 | property->children->content) { | ||
| 43 | char *pname = xmalloc (strlen (property->name) + 2); | ||
| 44 | *pname = ':'; | ||
| 45 | strcpy(pname + 1, property->name); | ||
| 46 | result = Fcons (Fcons (intern (pname), | ||
| 47 | build_string(property->children->content)), | ||
| 48 | result); | ||
| 49 | xfree (pname); | ||
| 50 | } | ||
| 51 | property = property->next; | ||
| 52 | } | ||
| 53 | /* Then add the children of the node. */ | ||
| 54 | child = node->children; | ||
| 55 | while (child != NULL) { | ||
| 56 | result = Fcons (make_dom (child), result); | ||
| 57 | child = child->next; | ||
| 58 | } | ||
| 59 | return Fnreverse (result); | ||
| 60 | } else if (node->type == XML_TEXT_NODE) { | ||
| 61 | Lisp_Object content = Qnil; | ||
| 62 | |||
| 63 | if (node->content) | ||
| 64 | content = build_string (node->content); | ||
| 65 | |||
| 66 | return Fcons (intern (node->name), content); | ||
| 67 | } else | ||
| 68 | return Qnil; | ||
| 69 | } | ||
| 70 | |||
| 71 | static Lisp_Object | ||
| 72 | parse_buffer (Lisp_Object string, Lisp_Object base_url, int htmlp) | ||
| 73 | { | ||
| 74 | xmlDoc *doc; | ||
| 75 | xmlNode *node; | ||
| 76 | Lisp_Object result; | ||
| 77 | int ibeg, iend; | ||
| 78 | char *burl = ""; | ||
| 79 | |||
| 80 | LIBXML_TEST_VERSION; | ||
| 81 | |||
| 82 | CHECK_STRING (string); | ||
| 83 | |||
| 84 | if (! NILP (base_url)) { | ||
| 85 | CHECK_STRING (base_url); | ||
| 86 | burl = SDATA (base_url); | ||
| 87 | } | ||
| 88 | |||
| 89 | if (htmlp) | ||
| 90 | doc = htmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", | ||
| 91 | HTML_PARSE_RECOVER|HTML_PARSE_NONET| | ||
| 92 | HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); | ||
| 93 | else | ||
| 94 | doc = xmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", | ||
| 95 | XML_PARSE_NONET|XML_PARSE_NOWARNING| | ||
| 96 | XML_PARSE_NOERROR); | ||
| 97 | |||
| 98 | if (doc != NULL) { | ||
| 99 | node = xmlDocGetRootElement (doc); | ||
| 100 | if (node != NULL) | ||
| 101 | result = make_dom (node); | ||
| 102 | |||
| 103 | xmlFreeDoc (doc); | ||
| 104 | xmlCleanupParser (); | ||
| 105 | } | ||
| 106 | |||
| 107 | return result; | ||
| 108 | } | ||
| 109 | |||
| 110 | DEFUN ("html-parse-string", Fhtml_parse_string, Shtml_parse_string, | ||
| 111 | 0, 2, 0, | ||
| 112 | doc: /* Parse the string as an HTML document and return the parse tree. | ||
| 113 | If BASE-URL is non-nil, it will be used to expand relative URLs in | ||
| 114 | the HTML document.*/) | ||
| 115 | (Lisp_Object string, Lisp_Object base_url) | ||
| 116 | { | ||
| 117 | return parse_buffer (string, base_url, 1); | ||
| 118 | } | ||
| 119 | |||
| 120 | DEFUN ("xml-parse-string", Fxml_parse_string, Sxml_parse_string, | ||
| 121 | 0, 2, 0, | ||
| 122 | doc: /* Parse the string as an XML document and return the parse tree. | ||
| 123 | If BASE-URL is non-nil, it will be used to expand relative URLs in | ||
| 124 | the XML document.*/) | ||
| 125 | (Lisp_Object string, Lisp_Object base_url) | ||
| 126 | { | ||
| 127 | return parse_buffer (string, base_url, 0); | ||
| 128 | } | ||
| 129 | |||
| 130 | |||
| 131 | /*********************************************************************** | ||
| 132 | Initialization | ||
| 133 | ***********************************************************************/ | ||
| 134 | void | ||
| 135 | syms_of_xml (void) | ||
| 136 | { | ||
| 137 | defsubr (&Shtml_parse_string); | ||
| 138 | defsubr (&Sxml_parse_string); | ||
| 139 | } | ||
| 140 | |||
| 141 | #endif /* HAVE_LIBXML2 */ | ||
diff --git a/src/xrdb.c b/src/xrdb.c index e0d948fd3a6..d81f08747ac 100644 --- a/src/xrdb.c +++ b/src/xrdb.c | |||
| @@ -334,16 +334,17 @@ static XrmDatabase | |||
| 334 | get_system_app (const char *class) | 334 | get_system_app (const char *class) |
| 335 | { | 335 | { |
| 336 | XrmDatabase db = NULL; | 336 | XrmDatabase db = NULL; |
| 337 | char *path; | 337 | const char *path; |
| 338 | char *p; | ||
| 338 | 339 | ||
| 339 | path = getenv ("XFILESEARCHPATH"); | 340 | path = getenv ("XFILESEARCHPATH"); |
| 340 | if (! path) path = PATH_X_DEFAULTS; | 341 | if (! path) path = PATH_X_DEFAULTS; |
| 341 | 342 | ||
| 342 | path = search_magic_path (path, class, 0, 0); | 343 | p = search_magic_path (path, class, 0, 0); |
| 343 | if (path) | 344 | if (p) |
| 344 | { | 345 | { |
| 345 | db = XrmGetFileDatabase (path); | 346 | db = XrmGetFileDatabase (p); |
| 346 | xfree (path); | 347 | xfree (p); |
| 347 | } | 348 | } |
| 348 | 349 | ||
| 349 | return db; | 350 | return db; |
| @@ -360,7 +361,7 @@ get_fallback (Display *display) | |||
| 360 | static XrmDatabase | 361 | static XrmDatabase |
| 361 | get_user_app (const char *class) | 362 | get_user_app (const char *class) |
| 362 | { | 363 | { |
| 363 | char *path; | 364 | const char *path; |
| 364 | char *file = 0; | 365 | char *file = 0; |
| 365 | char *free_it = 0; | 366 | char *free_it = 0; |
| 366 | 367 | ||
diff --git a/src/xselect.c b/src/xselect.c index 9f15c7c2d99..7479f245a77 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -83,8 +83,6 @@ static void lisp_data_to_selection_data (Display *, Lisp_Object, | |||
| 83 | unsigned char **, Atom *, | 83 | unsigned char **, Atom *, |
| 84 | unsigned *, int *, int *); | 84 | unsigned *, int *, int *); |
| 85 | static Lisp_Object clean_local_selection_data (Lisp_Object); | 85 | static Lisp_Object clean_local_selection_data (Lisp_Object); |
| 86 | static void initialize_cut_buffers (Display *, Window); | ||
| 87 | |||
| 88 | 86 | ||
| 89 | /* Printing traces to stderr. */ | 87 | /* Printing traces to stderr. */ |
| 90 | 88 | ||
| @@ -105,9 +103,7 @@ static void initialize_cut_buffers (Display *, Window); | |||
| 105 | #endif | 103 | #endif |
| 106 | 104 | ||
| 107 | 105 | ||
| 108 | #define CUT_BUFFER_SUPPORT | 106 | Lisp_Object QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, |
| 109 | |||
| 110 | Lisp_Object QPRIMARY, QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, | ||
| 111 | QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, | 107 | QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, |
| 112 | QATOM_PAIR; | 108 | QATOM_PAIR; |
| 113 | 109 | ||
| @@ -116,11 +112,6 @@ Lisp_Object QUTF8_STRING; /* This is a type of selection. */ | |||
| 116 | 112 | ||
| 117 | Lisp_Object Qcompound_text_with_extensions; | 113 | Lisp_Object Qcompound_text_with_extensions; |
| 118 | 114 | ||
| 119 | #ifdef CUT_BUFFER_SUPPORT | ||
| 120 | Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3, | ||
| 121 | QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7; | ||
| 122 | #endif | ||
| 123 | |||
| 124 | static Lisp_Object Vx_lost_selection_functions; | 115 | static Lisp_Object Vx_lost_selection_functions; |
| 125 | static Lisp_Object Vx_sent_selection_functions; | 116 | static Lisp_Object Vx_sent_selection_functions; |
| 126 | static Lisp_Object Qforeign_selection; | 117 | static Lisp_Object Qforeign_selection; |
| @@ -270,16 +261,6 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Display *display, Lisp_Object | |||
| 270 | if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; | 261 | if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; |
| 271 | if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; | 262 | if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; |
| 272 | if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; | 263 | if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; |
| 273 | #ifdef CUT_BUFFER_SUPPORT | ||
| 274 | if (EQ (sym, QCUT_BUFFER0)) return XA_CUT_BUFFER0; | ||
| 275 | if (EQ (sym, QCUT_BUFFER1)) return XA_CUT_BUFFER1; | ||
| 276 | if (EQ (sym, QCUT_BUFFER2)) return XA_CUT_BUFFER2; | ||
| 277 | if (EQ (sym, QCUT_BUFFER3)) return XA_CUT_BUFFER3; | ||
| 278 | if (EQ (sym, QCUT_BUFFER4)) return XA_CUT_BUFFER4; | ||
| 279 | if (EQ (sym, QCUT_BUFFER5)) return XA_CUT_BUFFER5; | ||
| 280 | if (EQ (sym, QCUT_BUFFER6)) return XA_CUT_BUFFER6; | ||
| 281 | if (EQ (sym, QCUT_BUFFER7)) return XA_CUT_BUFFER7; | ||
| 282 | #endif | ||
| 283 | if (!SYMBOLP (sym)) abort (); | 264 | if (!SYMBOLP (sym)) abort (); |
| 284 | 265 | ||
| 285 | TRACE1 (" XInternAtom %s", (char *) SDATA (SYMBOL_NAME (sym))); | 266 | TRACE1 (" XInternAtom %s", (char *) SDATA (SYMBOL_NAME (sym))); |
| @@ -315,24 +296,6 @@ x_atom_to_symbol (Display *dpy, Atom atom) | |||
| 315 | return QINTEGER; | 296 | return QINTEGER; |
| 316 | case XA_ATOM: | 297 | case XA_ATOM: |
| 317 | return QATOM; | 298 | return QATOM; |
| 318 | #ifdef CUT_BUFFER_SUPPORT | ||
| 319 | case XA_CUT_BUFFER0: | ||
| 320 | return QCUT_BUFFER0; | ||
| 321 | case XA_CUT_BUFFER1: | ||
| 322 | return QCUT_BUFFER1; | ||
| 323 | case XA_CUT_BUFFER2: | ||
| 324 | return QCUT_BUFFER2; | ||
| 325 | case XA_CUT_BUFFER3: | ||
| 326 | return QCUT_BUFFER3; | ||
| 327 | case XA_CUT_BUFFER4: | ||
| 328 | return QCUT_BUFFER4; | ||
| 329 | case XA_CUT_BUFFER5: | ||
| 330 | return QCUT_BUFFER5; | ||
| 331 | case XA_CUT_BUFFER6: | ||
| 332 | return QCUT_BUFFER6; | ||
| 333 | case XA_CUT_BUFFER7: | ||
| 334 | return QCUT_BUFFER7; | ||
| 335 | #endif | ||
| 336 | } | 299 | } |
| 337 | 300 | ||
| 338 | dpyinfo = x_display_info_for_display (dpy); | 301 | dpyinfo = x_display_info_for_display (dpy); |
| @@ -2258,195 +2221,6 @@ and t is the same as `SECONDARY'. */) | |||
| 2258 | } | 2221 | } |
| 2259 | 2222 | ||
| 2260 | 2223 | ||
| 2261 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2262 | |||
| 2263 | /* Ensure that all 8 cut buffers exist. ICCCM says we gotta... */ | ||
| 2264 | static void | ||
| 2265 | initialize_cut_buffers (Display *display, Window window) | ||
| 2266 | { | ||
| 2267 | unsigned char *data = (unsigned char *) ""; | ||
| 2268 | BLOCK_INPUT; | ||
| 2269 | #define FROB(atom) XChangeProperty (display, window, atom, XA_STRING, 8, \ | ||
| 2270 | PropModeAppend, data, 0) | ||
| 2271 | FROB (XA_CUT_BUFFER0); | ||
| 2272 | FROB (XA_CUT_BUFFER1); | ||
| 2273 | FROB (XA_CUT_BUFFER2); | ||
| 2274 | FROB (XA_CUT_BUFFER3); | ||
| 2275 | FROB (XA_CUT_BUFFER4); | ||
| 2276 | FROB (XA_CUT_BUFFER5); | ||
| 2277 | FROB (XA_CUT_BUFFER6); | ||
| 2278 | FROB (XA_CUT_BUFFER7); | ||
| 2279 | #undef FROB | ||
| 2280 | UNBLOCK_INPUT; | ||
| 2281 | } | ||
| 2282 | |||
| 2283 | |||
| 2284 | #define CHECK_CUT_BUFFER(symbol) \ | ||
| 2285 | do { CHECK_SYMBOL ((symbol)); \ | ||
| 2286 | if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ | ||
| 2287 | && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ | ||
| 2288 | && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ | ||
| 2289 | && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ | ||
| 2290 | signal_error ("Doesn't name a cut buffer", (symbol)); \ | ||
| 2291 | } while (0) | ||
| 2292 | |||
| 2293 | DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, | ||
| 2294 | Sx_get_cut_buffer_internal, 1, 1, 0, | ||
| 2295 | doc: /* Returns the value of the named cut buffer (typically CUT_BUFFER0). */) | ||
| 2296 | (Lisp_Object buffer) | ||
| 2297 | { | ||
| 2298 | Window window; | ||
| 2299 | Atom buffer_atom; | ||
| 2300 | unsigned char *data = NULL; | ||
| 2301 | int bytes; | ||
| 2302 | Atom type; | ||
| 2303 | int format; | ||
| 2304 | unsigned long size; | ||
| 2305 | Lisp_Object ret; | ||
| 2306 | Display *display; | ||
| 2307 | struct x_display_info *dpyinfo; | ||
| 2308 | struct frame *sf = SELECTED_FRAME (); | ||
| 2309 | |||
| 2310 | check_x (); | ||
| 2311 | |||
| 2312 | if (! FRAME_X_P (sf)) | ||
| 2313 | return Qnil; | ||
| 2314 | |||
| 2315 | display = FRAME_X_DISPLAY (sf); | ||
| 2316 | dpyinfo = FRAME_X_DISPLAY_INFO (sf); | ||
| 2317 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2318 | CHECK_CUT_BUFFER (buffer); | ||
| 2319 | buffer_atom = symbol_to_x_atom (dpyinfo, display, buffer); | ||
| 2320 | |||
| 2321 | x_get_window_property (display, window, buffer_atom, &data, &bytes, | ||
| 2322 | &type, &format, &size, 0); | ||
| 2323 | |||
| 2324 | if (!data || !format) | ||
| 2325 | { | ||
| 2326 | xfree (data); | ||
| 2327 | return Qnil; | ||
| 2328 | } | ||
| 2329 | |||
| 2330 | if (format != 8 || type != XA_STRING) | ||
| 2331 | signal_error ("Cut buffer doesn't contain 8-bit data", | ||
| 2332 | list2 (x_atom_to_symbol (display, type), | ||
| 2333 | make_number (format))); | ||
| 2334 | |||
| 2335 | ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); | ||
| 2336 | /* Use xfree, not XFree, because x_get_window_property | ||
| 2337 | calls xmalloc itself. */ | ||
| 2338 | xfree (data); | ||
| 2339 | return ret; | ||
| 2340 | } | ||
| 2341 | |||
| 2342 | |||
| 2343 | DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, | ||
| 2344 | Sx_store_cut_buffer_internal, 2, 2, 0, | ||
| 2345 | doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0). */) | ||
| 2346 | (Lisp_Object buffer, Lisp_Object string) | ||
| 2347 | { | ||
| 2348 | Window window; | ||
| 2349 | Atom buffer_atom; | ||
| 2350 | unsigned char *data; | ||
| 2351 | int bytes; | ||
| 2352 | int bytes_remaining; | ||
| 2353 | int max_bytes; | ||
| 2354 | Display *display; | ||
| 2355 | struct frame *sf = SELECTED_FRAME (); | ||
| 2356 | |||
| 2357 | check_x (); | ||
| 2358 | |||
| 2359 | if (! FRAME_X_P (sf)) | ||
| 2360 | return Qnil; | ||
| 2361 | |||
| 2362 | display = FRAME_X_DISPLAY (sf); | ||
| 2363 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2364 | |||
| 2365 | max_bytes = SELECTION_QUANTUM (display); | ||
| 2366 | if (max_bytes > MAX_SELECTION_QUANTUM) | ||
| 2367 | max_bytes = MAX_SELECTION_QUANTUM; | ||
| 2368 | |||
| 2369 | CHECK_CUT_BUFFER (buffer); | ||
| 2370 | CHECK_STRING (string); | ||
| 2371 | buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (sf), | ||
| 2372 | display, buffer); | ||
| 2373 | data = (unsigned char *) SDATA (string); | ||
| 2374 | bytes = SBYTES (string); | ||
| 2375 | bytes_remaining = bytes; | ||
| 2376 | |||
| 2377 | if (! FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized) | ||
| 2378 | { | ||
| 2379 | initialize_cut_buffers (display, window); | ||
| 2380 | FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized = 1; | ||
| 2381 | } | ||
| 2382 | |||
| 2383 | BLOCK_INPUT; | ||
| 2384 | |||
| 2385 | /* Don't mess up with an empty value. */ | ||
| 2386 | if (!bytes_remaining) | ||
| 2387 | XChangeProperty (display, window, buffer_atom, XA_STRING, 8, | ||
| 2388 | PropModeReplace, data, 0); | ||
| 2389 | |||
| 2390 | while (bytes_remaining) | ||
| 2391 | { | ||
| 2392 | int chunk = (bytes_remaining < max_bytes | ||
| 2393 | ? bytes_remaining : max_bytes); | ||
| 2394 | XChangeProperty (display, window, buffer_atom, XA_STRING, 8, | ||
| 2395 | (bytes_remaining == bytes | ||
| 2396 | ? PropModeReplace | ||
| 2397 | : PropModeAppend), | ||
| 2398 | data, chunk); | ||
| 2399 | data += chunk; | ||
| 2400 | bytes_remaining -= chunk; | ||
| 2401 | } | ||
| 2402 | UNBLOCK_INPUT; | ||
| 2403 | return string; | ||
| 2404 | } | ||
| 2405 | |||
| 2406 | |||
| 2407 | DEFUN ("x-rotate-cut-buffers-internal", Fx_rotate_cut_buffers_internal, | ||
| 2408 | Sx_rotate_cut_buffers_internal, 1, 1, 0, | ||
| 2409 | doc: /* Rotate the values of the cut buffers by N steps. | ||
| 2410 | Positive N means shift the values forward, negative means backward. */) | ||
| 2411 | (Lisp_Object n) | ||
| 2412 | { | ||
| 2413 | Window window; | ||
| 2414 | Atom props[8]; | ||
| 2415 | Display *display; | ||
| 2416 | struct frame *sf = SELECTED_FRAME (); | ||
| 2417 | |||
| 2418 | check_x (); | ||
| 2419 | |||
| 2420 | if (! FRAME_X_P (sf)) | ||
| 2421 | return Qnil; | ||
| 2422 | |||
| 2423 | display = FRAME_X_DISPLAY (sf); | ||
| 2424 | window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ | ||
| 2425 | CHECK_NUMBER (n); | ||
| 2426 | if (XINT (n) == 0) | ||
| 2427 | return n; | ||
| 2428 | if (! FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized) | ||
| 2429 | { | ||
| 2430 | initialize_cut_buffers (display, window); | ||
| 2431 | FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized = 1; | ||
| 2432 | } | ||
| 2433 | |||
| 2434 | props[0] = XA_CUT_BUFFER0; | ||
| 2435 | props[1] = XA_CUT_BUFFER1; | ||
| 2436 | props[2] = XA_CUT_BUFFER2; | ||
| 2437 | props[3] = XA_CUT_BUFFER3; | ||
| 2438 | props[4] = XA_CUT_BUFFER4; | ||
| 2439 | props[5] = XA_CUT_BUFFER5; | ||
| 2440 | props[6] = XA_CUT_BUFFER6; | ||
| 2441 | props[7] = XA_CUT_BUFFER7; | ||
| 2442 | BLOCK_INPUT; | ||
| 2443 | XRotateWindowProperties (display, window, props, 8, XINT (n)); | ||
| 2444 | UNBLOCK_INPUT; | ||
| 2445 | return n; | ||
| 2446 | } | ||
| 2447 | |||
| 2448 | #endif | ||
| 2449 | |||
| 2450 | /*********************************************************************** | 2224 | /*********************************************************************** |
| 2451 | Drag and drop support | 2225 | Drag and drop support |
| 2452 | ***********************************************************************/ | 2226 | ***********************************************************************/ |
| @@ -2596,6 +2370,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2596 | { | 2370 | { |
| 2597 | struct frame *f = check_x_frame (frame); | 2371 | struct frame *f = check_x_frame (frame); |
| 2598 | char *name = 0; | 2372 | char *name = 0; |
| 2373 | char empty[] = ""; | ||
| 2599 | Lisp_Object ret = Qnil; | 2374 | Lisp_Object ret = Qnil; |
| 2600 | Display *dpy = FRAME_X_DISPLAY (f); | 2375 | Display *dpy = FRAME_X_DISPLAY (f); |
| 2601 | Atom atom; | 2376 | Atom atom; |
| @@ -2612,7 +2387,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2612 | 2387 | ||
| 2613 | BLOCK_INPUT; | 2388 | BLOCK_INPUT; |
| 2614 | x_catch_errors (dpy); | 2389 | x_catch_errors (dpy); |
| 2615 | name = atom ? XGetAtomName (dpy, atom) : ""; | 2390 | name = atom ? XGetAtomName (dpy, atom) : empty; |
| 2616 | had_errors = x_had_errors_p (dpy); | 2391 | had_errors = x_had_errors_p (dpy); |
| 2617 | x_uncatch_errors (); | 2392 | x_uncatch_errors (); |
| 2618 | 2393 | ||
| @@ -2849,12 +2624,6 @@ syms_of_xselect (void) | |||
| 2849 | defsubr (&Sx_selection_owner_p); | 2624 | defsubr (&Sx_selection_owner_p); |
| 2850 | defsubr (&Sx_selection_exists_p); | 2625 | defsubr (&Sx_selection_exists_p); |
| 2851 | 2626 | ||
| 2852 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2853 | defsubr (&Sx_get_cut_buffer_internal); | ||
| 2854 | defsubr (&Sx_store_cut_buffer_internal); | ||
| 2855 | defsubr (&Sx_rotate_cut_buffers_internal); | ||
| 2856 | #endif | ||
| 2857 | |||
| 2858 | defsubr (&Sx_get_atom_name); | 2627 | defsubr (&Sx_get_atom_name); |
| 2859 | defsubr (&Sx_send_client_message); | 2628 | defsubr (&Sx_send_client_message); |
| 2860 | defsubr (&Sx_register_dnd_atom); | 2629 | defsubr (&Sx_register_dnd_atom); |
| @@ -2936,17 +2705,6 @@ A value of 0 means wait as long as necessary. This is initialized from the | |||
| 2936 | Qcompound_text_with_extensions = intern_c_string ("compound-text-with-extensions"); | 2705 | Qcompound_text_with_extensions = intern_c_string ("compound-text-with-extensions"); |
| 2937 | staticpro (&Qcompound_text_with_extensions); | 2706 | staticpro (&Qcompound_text_with_extensions); |
| 2938 | 2707 | ||
| 2939 | #ifdef CUT_BUFFER_SUPPORT | ||
| 2940 | QCUT_BUFFER0 = intern_c_string ("CUT_BUFFER0"); staticpro (&QCUT_BUFFER0); | ||
| 2941 | QCUT_BUFFER1 = intern_c_string ("CUT_BUFFER1"); staticpro (&QCUT_BUFFER1); | ||
| 2942 | QCUT_BUFFER2 = intern_c_string ("CUT_BUFFER2"); staticpro (&QCUT_BUFFER2); | ||
| 2943 | QCUT_BUFFER3 = intern_c_string ("CUT_BUFFER3"); staticpro (&QCUT_BUFFER3); | ||
| 2944 | QCUT_BUFFER4 = intern_c_string ("CUT_BUFFER4"); staticpro (&QCUT_BUFFER4); | ||
| 2945 | QCUT_BUFFER5 = intern_c_string ("CUT_BUFFER5"); staticpro (&QCUT_BUFFER5); | ||
| 2946 | QCUT_BUFFER6 = intern_c_string ("CUT_BUFFER6"); staticpro (&QCUT_BUFFER6); | ||
| 2947 | QCUT_BUFFER7 = intern_c_string ("CUT_BUFFER7"); staticpro (&QCUT_BUFFER7); | ||
| 2948 | #endif | ||
| 2949 | |||
| 2950 | Qforeign_selection = intern_c_string ("foreign-selection"); | 2708 | Qforeign_selection = intern_c_string ("foreign-selection"); |
| 2951 | staticpro (&Qforeign_selection); | 2709 | staticpro (&Qforeign_selection); |
| 2952 | } | 2710 | } |
diff --git a/src/xsmfns.c b/src/xsmfns.c index 0096110bd46..79dccfa55e1 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -87,7 +87,7 @@ Lisp_Object Vx_session_previous_id; | |||
| 87 | /* The option to start Emacs without the splash screen when | 87 | /* The option to start Emacs without the splash screen when |
| 88 | restarting Emacs. */ | 88 | restarting Emacs. */ |
| 89 | 89 | ||
| 90 | #define NOSPLASH_OPT "--no-splash" | 90 | static char NOSPLASH_OPT[] = "--no-splash"; |
| 91 | 91 | ||
| 92 | /* The option to make Emacs start in the given directory. */ | 92 | /* The option to make Emacs start in the given directory. */ |
| 93 | 93 | ||
| @@ -198,14 +198,14 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 198 | SmPropValue values[20]; | 198 | SmPropValue values[20]; |
| 199 | int val_idx = 0; | 199 | int val_idx = 0; |
| 200 | int props_idx = 0; | 200 | int props_idx = 0; |
| 201 | 201 | int i; | |
| 202 | char *cwd = NULL; | 202 | char *cwd = NULL; |
| 203 | char *smid_opt, *chdir_opt = NULL; | 203 | char *smid_opt, *chdir_opt = NULL; |
| 204 | 204 | ||
| 205 | /* How to start a new instance of Emacs. */ | 205 | /* How to start a new instance of Emacs. */ |
| 206 | props[props_idx] = &prop_ptr[props_idx]; | 206 | props[props_idx] = &prop_ptr[props_idx]; |
| 207 | props[props_idx]->name = SmCloneCommand; | 207 | props[props_idx]->name = xstrdup (SmCloneCommand); |
| 208 | props[props_idx]->type = SmLISTofARRAY8; | 208 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); |
| 209 | props[props_idx]->num_vals = 1; | 209 | props[props_idx]->num_vals = 1; |
| 210 | props[props_idx]->vals = &values[val_idx++]; | 210 | props[props_idx]->vals = &values[val_idx++]; |
| 211 | props[props_idx]->vals[0].length = strlen (emacs_program); | 211 | props[props_idx]->vals[0].length = strlen (emacs_program); |
| @@ -214,8 +214,8 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 214 | 214 | ||
| 215 | /* The name of the program. */ | 215 | /* The name of the program. */ |
| 216 | props[props_idx] = &prop_ptr[props_idx]; | 216 | props[props_idx] = &prop_ptr[props_idx]; |
| 217 | props[props_idx]->name = SmProgram; | 217 | props[props_idx]->name = xstrdup (SmProgram); |
| 218 | props[props_idx]->type = SmARRAY8; | 218 | props[props_idx]->type = xstrdup (SmARRAY8); |
| 219 | props[props_idx]->num_vals = 1; | 219 | props[props_idx]->num_vals = 1; |
| 220 | props[props_idx]->vals = &values[val_idx++]; | 220 | props[props_idx]->vals = &values[val_idx++]; |
| 221 | props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name)); | 221 | props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name)); |
| @@ -224,8 +224,8 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 224 | 224 | ||
| 225 | /* How to restart Emacs. */ | 225 | /* How to restart Emacs. */ |
| 226 | props[props_idx] = &prop_ptr[props_idx]; | 226 | props[props_idx] = &prop_ptr[props_idx]; |
| 227 | props[props_idx]->name = SmRestartCommand; | 227 | props[props_idx]->name = xstrdup (SmRestartCommand); |
| 228 | props[props_idx]->type = SmLISTofARRAY8; | 228 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); |
| 229 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */ | 229 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir */ |
| 230 | props[props_idx]->num_vals = 4; | 230 | props[props_idx]->num_vals = 4; |
| 231 | props[props_idx]->vals = &values[val_idx]; | 231 | props[props_idx]->vals = &values[val_idx]; |
| @@ -258,8 +258,8 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 258 | 258 | ||
| 259 | /* User id. */ | 259 | /* User id. */ |
| 260 | props[props_idx] = &prop_ptr[props_idx]; | 260 | props[props_idx] = &prop_ptr[props_idx]; |
| 261 | props[props_idx]->name = SmUserID; | 261 | props[props_idx]->name = xstrdup (SmUserID); |
| 262 | props[props_idx]->type = SmARRAY8; | 262 | props[props_idx]->type = xstrdup (SmARRAY8); |
| 263 | props[props_idx]->num_vals = 1; | 263 | props[props_idx]->num_vals = 1; |
| 264 | props[props_idx]->vals = &values[val_idx++]; | 264 | props[props_idx]->vals = &values[val_idx++]; |
| 265 | props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name)); | 265 | props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name)); |
| @@ -270,8 +270,8 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 270 | if (cwd) | 270 | if (cwd) |
| 271 | { | 271 | { |
| 272 | props[props_idx] = &prop_ptr[props_idx]; | 272 | props[props_idx] = &prop_ptr[props_idx]; |
| 273 | props[props_idx]->name = SmCurrentDirectory; | 273 | props[props_idx]->name = xstrdup (SmCurrentDirectory); |
| 274 | props[props_idx]->type = SmARRAY8; | 274 | props[props_idx]->type = xstrdup (SmARRAY8); |
| 275 | props[props_idx]->num_vals = 1; | 275 | props[props_idx]->num_vals = 1; |
| 276 | props[props_idx]->vals = &values[val_idx++]; | 276 | props[props_idx]->vals = &values[val_idx++]; |
| 277 | props[props_idx]->vals[0].length = strlen (cwd); | 277 | props[props_idx]->vals[0].length = strlen (cwd); |
| @@ -286,6 +286,11 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 286 | xfree (chdir_opt); | 286 | xfree (chdir_opt); |
| 287 | 287 | ||
| 288 | free (cwd); | 288 | free (cwd); |
| 289 | for (i = 0; i < props_idx; ++i) | ||
| 290 | { | ||
| 291 | xfree (props[i]->type); | ||
| 292 | xfree (props[i]->name); | ||
| 293 | } | ||
| 289 | 294 | ||
| 290 | /* See if we maybe shall interact with the user. */ | 295 | /* See if we maybe shall interact with the user. */ |
| 291 | if (interactStyle != SmInteractStyleAny | 296 | if (interactStyle != SmInteractStyleAny |
diff --git a/src/xterm.c b/src/xterm.c index e6bf82ab5a5..2ebe8a80378 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -301,6 +301,9 @@ static Lisp_Object xg_default_icon_file; | |||
| 301 | Lisp_Object Qx_gtk_map_stock; | 301 | Lisp_Object Qx_gtk_map_stock; |
| 302 | #endif | 302 | #endif |
| 303 | 303 | ||
| 304 | /* Some functions take this as char *, not const char *. */ | ||
| 305 | static char emacs_class[] = EMACS_CLASS; | ||
| 306 | |||
| 304 | /* Used in x_flush. */ | 307 | /* Used in x_flush. */ |
| 305 | 308 | ||
| 306 | extern XrmDatabase x_load_resources (Display *, const char *, const char *, | 309 | extern XrmDatabase x_load_resources (Display *, const char *, const char *, |
| @@ -2432,17 +2435,34 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2432 | if (s->hl == DRAW_CURSOR | 2435 | if (s->hl == DRAW_CURSOR |
| 2433 | && !x_stretch_cursor_p) | 2436 | && !x_stretch_cursor_p) |
| 2434 | { | 2437 | { |
| 2435 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2438 | /* If `x-stretch-cursor' is nil, don't draw a block cursor as |
| 2436 | as wide as the stretch glyph. */ | 2439 | wide as the stretch glyph. */ |
| 2437 | int width, background_width = s->background_width; | 2440 | int width, background_width = s->background_width; |
| 2438 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | 2441 | int x = s->x; |
| 2439 | 2442 | ||
| 2440 | if (x < left_x) | 2443 | if (!s->row->reversed_p) |
| 2441 | { | 2444 | { |
| 2442 | background_width -= left_x - x; | 2445 | int left_x = window_box_left_offset (s->w, TEXT_AREA); |
| 2443 | x = left_x; | 2446 | |
| 2447 | if (x < left_x) | ||
| 2448 | { | ||
| 2449 | background_width -= left_x - x; | ||
| 2450 | x = left_x; | ||
| 2451 | } | ||
| 2452 | } | ||
| 2453 | else | ||
| 2454 | { | ||
| 2455 | /* In R2L rows, draw the cursor on the right edge of the | ||
| 2456 | stretch glyph. */ | ||
| 2457 | int right_x = window_box_right_offset (s->w, TEXT_AREA); | ||
| 2458 | |||
| 2459 | if (x + background_width > right_x) | ||
| 2460 | background_width -= x - right_x; | ||
| 2461 | x += background_width; | ||
| 2444 | } | 2462 | } |
| 2445 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | 2463 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); |
| 2464 | if (s->row->reversed_p) | ||
| 2465 | x -= width; | ||
| 2446 | 2466 | ||
| 2447 | /* Draw cursor. */ | 2467 | /* Draw cursor. */ |
| 2448 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); | 2468 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| @@ -2455,7 +2475,10 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2455 | XRectangle r; | 2475 | XRectangle r; |
| 2456 | GC gc; | 2476 | GC gc; |
| 2457 | 2477 | ||
| 2458 | x += width; | 2478 | if (!s->row->reversed_p) |
| 2479 | x += width; | ||
| 2480 | else | ||
| 2481 | x = s->x; | ||
| 2459 | if (s->row->mouse_face_p | 2482 | if (s->row->mouse_face_p |
| 2460 | && cursor_in_mouse_face_p (s->w)) | 2483 | && cursor_in_mouse_face_p (s->w)) |
| 2461 | { | 2484 | { |
| @@ -7129,14 +7152,20 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 7129 | 7152 | ||
| 7130 | if (kind == BAR_CURSOR) | 7153 | if (kind == BAR_CURSOR) |
| 7131 | { | 7154 | { |
| 7155 | int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 7156 | |||
| 7132 | if (width < 0) | 7157 | if (width < 0) |
| 7133 | width = FRAME_CURSOR_WIDTH (f); | 7158 | width = FRAME_CURSOR_WIDTH (f); |
| 7134 | width = min (cursor_glyph->pixel_width, width); | 7159 | width = min (cursor_glyph->pixel_width, width); |
| 7135 | 7160 | ||
| 7136 | w->phys_cursor_width = width; | 7161 | w->phys_cursor_width = width; |
| 7137 | 7162 | ||
| 7138 | XFillRectangle (dpy, window, gc, | 7163 | /* If the character under cursor is R2L, draw the bar cursor |
| 7139 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), | 7164 | on the right of its glyph, rather than on the left. */ |
| 7165 | if ((cursor_glyph->resolved_level & 1) != 0) | ||
| 7166 | x += cursor_glyph->pixel_width - width; | ||
| 7167 | |||
| 7168 | XFillRectangle (dpy, window, gc, x, | ||
| 7140 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 7169 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 7141 | width, row->height); | 7170 | width, row->height); |
| 7142 | } | 7171 | } |
| @@ -7872,7 +7901,7 @@ xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name) | |||
| 7872 | if (dpyinfo->xim) | 7901 | if (dpyinfo->xim) |
| 7873 | XCloseIM (dpyinfo->xim); | 7902 | XCloseIM (dpyinfo->xim); |
| 7874 | xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, | 7903 | xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, |
| 7875 | EMACS_CLASS); | 7904 | emacs_class); |
| 7876 | dpyinfo->xim = xim; | 7905 | dpyinfo->xim = xim; |
| 7877 | 7906 | ||
| 7878 | if (xim) | 7907 | if (xim) |
| @@ -7973,7 +8002,7 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name) | |||
| 7973 | xim_inst->resource_name = (char *) xmalloc (len + 1); | 8002 | xim_inst->resource_name = (char *) xmalloc (len + 1); |
| 7974 | memcpy (xim_inst->resource_name, resource_name, len + 1); | 8003 | memcpy (xim_inst->resource_name, resource_name, len + 1); |
| 7975 | XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, | 8004 | XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
| 7976 | resource_name, EMACS_CLASS, | 8005 | resource_name, emacs_class, |
| 7977 | xim_instantiate_callback, | 8006 | xim_instantiate_callback, |
| 7978 | /* This is XPointer in XFree86 | 8007 | /* This is XPointer in XFree86 |
| 7979 | but (XPointer *) on Tru64, at | 8008 | but (XPointer *) on Tru64, at |
| @@ -7998,7 +8027,7 @@ xim_close_dpy (struct x_display_info *dpyinfo) | |||
| 7998 | #ifdef HAVE_X11R6_XIM | 8027 | #ifdef HAVE_X11R6_XIM |
| 7999 | if (dpyinfo->display) | 8028 | if (dpyinfo->display) |
| 8000 | XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, | 8029 | XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
| 8001 | NULL, EMACS_CLASS, | 8030 | NULL, emacs_class, |
| 8002 | xim_instantiate_callback, NULL); | 8031 | xim_instantiate_callback, NULL); |
| 8003 | xfree (dpyinfo->xim_callback_data->resource_name); | 8032 | xfree (dpyinfo->xim_callback_data->resource_name); |
| 8004 | xfree (dpyinfo->xim_callback_data); | 8033 | xfree (dpyinfo->xim_callback_data); |
| @@ -9709,6 +9738,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 9709 | } | 9738 | } |
| 9710 | else | 9739 | else |
| 9711 | { | 9740 | { |
| 9741 | static char display_opt[] = "--display"; | ||
| 9742 | static char name_opt[] = "--name"; | ||
| 9743 | |||
| 9712 | for (argc = 0; argc < NUM_ARGV; ++argc) | 9744 | for (argc = 0; argc < NUM_ARGV; ++argc) |
| 9713 | argv[argc] = 0; | 9745 | argv[argc] = 0; |
| 9714 | 9746 | ||
| @@ -9717,11 +9749,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 9717 | 9749 | ||
| 9718 | if (! NILP (display_name)) | 9750 | if (! NILP (display_name)) |
| 9719 | { | 9751 | { |
| 9720 | argv[argc++] = "--display"; | 9752 | argv[argc++] = display_opt; |
| 9721 | argv[argc++] = SDATA (display_name); | 9753 | argv[argc++] = SDATA (display_name); |
| 9722 | } | 9754 | } |
| 9723 | 9755 | ||
| 9724 | argv[argc++] = "--name"; | 9756 | argv[argc++] = name_opt; |
| 9725 | argv[argc++] = resource_name; | 9757 | argv[argc++] = resource_name; |
| 9726 | 9758 | ||
| 9727 | XSetLocaleModifiers (""); | 9759 | XSetLocaleModifiers (""); |
| @@ -9744,7 +9776,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 9744 | 9776 | ||
| 9745 | /* Load our own gtkrc if it exists. */ | 9777 | /* Load our own gtkrc if it exists. */ |
| 9746 | { | 9778 | { |
| 9747 | char *file = "~/.emacs.d/gtkrc"; | 9779 | const char *file = "~/.emacs.d/gtkrc"; |
| 9748 | Lisp_Object s, abs_file; | 9780 | Lisp_Object s, abs_file; |
| 9749 | 9781 | ||
| 9750 | s = make_string (file, strlen (file)); | 9782 | s = make_string (file, strlen (file)); |
| @@ -10092,8 +10124,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10092 | dpyinfo->Xatom_net_wm_name | 10124 | dpyinfo->Xatom_net_wm_name |
| 10093 | = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); | 10125 | = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); |
| 10094 | 10126 | ||
| 10095 | dpyinfo->cut_buffers_initialized = 0; | ||
| 10096 | |||
| 10097 | dpyinfo->x_dnd_atoms_size = 8; | 10127 | dpyinfo->x_dnd_atoms_size = 8; |
| 10098 | dpyinfo->x_dnd_atoms_length = 0; | 10128 | dpyinfo->x_dnd_atoms_length = 0; |
| 10099 | dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) | 10129 | dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) |
diff --git a/src/xterm.h b/src/xterm.h index 972bfb50dc3..d884945f985 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -299,8 +299,6 @@ struct x_display_info | |||
| 299 | /* Atom used in XEmbed client messages. */ | 299 | /* Atom used in XEmbed client messages. */ |
| 300 | Atom Xatom_XEMBED; | 300 | Atom Xatom_XEMBED; |
| 301 | 301 | ||
| 302 | int cut_buffers_initialized; /* Whether we're sure they all exist */ | ||
| 303 | |||
| 304 | /* The frame (if any) which has the X window that has keyboard focus. | 302 | /* The frame (if any) which has the X window that has keyboard focus. |
| 305 | Zero if none. This is examined by Ffocus_frame in xfns.c. Note | 303 | Zero if none. This is examined by Ffocus_frame in xfns.c. Note |
| 306 | that a mere EnterNotify event can set this; if you need to know the | 304 | that a mere EnterNotify event can set this; if you need to know the |