summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2004-06-28 07:56:49 +0000
committerMiles Bader <miles@gnu.org>2004-06-28 07:56:49 +0000
commit327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801 (patch)
tree21de188e13b5e41a79bb50040933072ae0235217 /src
parent852f73b7fa7b71910282eacb6263b3ecfd4ee783 (diff)
parent376de73927383d6062483db10b8a82448505f52b (diff)
downloademacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.tar.gz
emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.tar.bz2
emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221 Restore deleted tagline in etc/TUTORIAL.ru * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229 Remove TeX output files from the archive * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248 src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264 Update from CVS: lispref/display.texi: emacs -> Emacs. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275 Update from CVS: man/makefile.w32-in: Revert last change * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296 Allow restarting an existing debugger session that's exited * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328 Update from CVS: src/.gdbinit (xsymbol): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345 Tweak source regexps so that building in place won't cause problems * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352 Update from CVS: lisp/flymake.el: New file. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362 Support " [...]" style defaults in minibuffer-electric-default-mode * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363 (read-number): Use canonical format for default in prompt. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368 Improve display-supports-face-attributes-p on non-ttys * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369 Rewrite face-differs-from-default-p * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370 Move `display-supports-face-attributes-p' entirely into C code * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372 Simplify face-differs-from-default-p; don't consider :stipple. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374 (tty_supports_face_attributes_p): Ensure attributes differ from default * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377 (Fdisplay_supports_face_attributes_p): Work around bootstrapping problem * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381 Face merging cleanups * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385 src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396 Tweak arch tagging to make build/install-in-place less annoying * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397 Work around vc-arch problems when building eshell * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399 Tweak directory permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401 More build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403 Yet more build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410 Make sure image types are initialized for lookup too * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416 Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/.arch-inventory9
-rw-r--r--src/.gdbinit22
-rw-r--r--src/ChangeLog1257
-rw-r--r--src/abbrev.c2
-rw-r--r--src/alloc.c132
-rw-r--r--src/atimer.c2
-rw-r--r--src/atimer.h2
-rw-r--r--src/blockinput.h5
-rw-r--r--src/buffer.c45
-rw-r--r--src/buffer.h21
-rw-r--r--src/callint.c4
-rw-r--r--src/callproc.c4
-rw-r--r--src/casefiddle.c13
-rw-r--r--src/ccl.c37
-rw-r--r--src/charset.c8
-rw-r--r--src/data.c42
-rw-r--r--src/dispextern.h61
-rw-r--r--src/dispnew.c24
-rw-r--r--src/doc.c2
-rw-r--r--src/editfns.c41
-rw-r--r--src/emacs.c10
-rw-r--r--src/eval.c26
-rw-r--r--src/fileio.c92
-rw-r--r--src/fns.c74
-rw-r--r--src/fontset.c64
-rw-r--r--src/gtkutil.c188
-rw-r--r--src/image.c790
-rw-r--r--src/indent.c3
-rw-r--r--src/insdel.c4
-rw-r--r--src/intervals.c12
-rw-r--r--src/keyboard.c133
-rw-r--r--src/keymap.c233
-rw-r--r--src/keymap.h5
-rw-r--r--src/lisp.h92
-rw-r--r--src/lread.c21
-rw-r--r--src/macfns.c401
-rw-r--r--src/macgui.h15
-rw-r--r--src/macmenu.c21
-rw-r--r--src/macterm.c1542
-rw-r--r--src/macterm.h14
-rw-r--r--src/makefile.nt1232
-rw-r--r--src/makefile.w32-in74
-rw-r--r--src/mem-limits.h6
-rw-r--r--src/minibuf.c91
-rw-r--r--src/msdos.c55
-rw-r--r--src/print.c68
-rw-r--r--src/process.c108
-rw-r--r--src/regex.c170
-rw-r--r--src/regex.h43
-rw-r--r--src/search.c10
-rw-r--r--src/syntax.c196
-rw-r--r--src/syntax.h24
-rw-r--r--src/syssignal.h3
-rw-r--r--src/textprop.c23
-rw-r--r--src/undo.c22
-rw-r--r--src/w32.c14
-rw-r--r--src/w32console.c130
-rw-r--r--src/w32fns.c267
-rw-r--r--src/w32heap.c3
-rw-r--r--src/w32inevt.c12
-rw-r--r--src/w32menu.c14
-rw-r--r--src/w32proc.c10
-rw-r--r--src/w32select.c11
-rw-r--r--src/w32term.c198
-rw-r--r--src/w32term.h7
-rw-r--r--src/window.c126
-rw-r--r--src/window.h8
-rw-r--r--src/xdisp.c512
-rw-r--r--src/xfaces.c969
-rw-r--r--src/xfns.c7
-rw-r--r--src/xselect.c4
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c163
-rw-r--r--src/xterm.h5
74 files changed, 6044 insertions, 4016 deletions
diff --git a/src/.arch-inventory b/src/.arch-inventory
new file mode 100644
index 00000000000..a98d4c9932f
--- /dev/null
+++ b/src/.arch-inventory
@@ -0,0 +1,9 @@
+# Source files which don't match the usual naming conventions, mostly dot files
+source ^\.(gdbinit|dbxinit)$
+
+# Auto-generated files, which ignore
+precious ^(config\.stamp|config\.h|epaths\.h)$
+
+backup ^(stamp-oldxmenu|prefix-args|temacs|emacs|emacs-[0-9.]*)$
+
+# arch-tag: 277cc7ae-b3f5-44af-abf1-84c073164543
diff --git a/src/.gdbinit b/src/.gdbinit
index 9e4e674c740..943481d419e 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -81,7 +81,7 @@ end
define xvectype
xgetptr $
set $size = ((struct Lisp_Vector *) $ptr)->size
- output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
+ output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
echo \n
end
document xvectype
@@ -186,9 +186,10 @@ Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value
end
define xsymbol
- xgetptr $
+ set $sym = $
+ xgetptr $sym
print (struct Lisp_Symbol *) $ptr
- xprintsym $
+ xprintsym $sym
echo \n
end
document xsymbol
@@ -199,7 +200,7 @@ end
define xstring
xgetptr $
print (struct Lisp_String *) $ptr
- output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
+ xprintstr $
echo \n
end
document xstring
@@ -210,7 +211,7 @@ end
define xvector
xgetptr $
print (struct Lisp_Vector *) $ptr
- output ($->size > 50) ? 0 : ($->contents[0])@($->size)
+ output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag)
echo \n
end
document xvector
@@ -289,7 +290,7 @@ end
define xboolvector
xgetptr $
print (struct Lisp_Bool_Vector *) $ptr
- output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
+ output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8)
echo \n
end
document xboolvector
@@ -372,12 +373,17 @@ document xscrollbar
Print $ as a scrollbar pointer.
end
+define xprintstr
+ set $data = $arg0->data
+ output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte)
+end
+
define xprintsym
xgetptr $arg0
set $sym = (struct Lisp_Symbol *) $ptr
xgetptr $sym->xname
set $sym_name = (struct Lisp_String *) $ptr
- output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte)
+ xprintstr $sym_name
end
document xprintsym
Print argument as a symbol.
@@ -418,7 +424,7 @@ define xbacktrace
if $type == Lisp_Vectorlike
xgetptr (*$bt->function)
set $size = ((struct Lisp_Vector *) $ptr)->size
- output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
+ output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
else
printf "Lisp type %d", $type
end
diff --git a/src/ChangeLog b/src/ChangeLog
index c9cf12dc159..00822d9d277 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,1130 @@
+2004-06-20 Richard M. Stallman <rms@gnu.org>
+
+ * xfaces.c (Finternal_copy_lisp_face): Small cleanup; doc fix.
+
+ * search.c (match_limit): Cleaner err msg when no match data available.
+
+ * window.c (syms_of_window): Doc fix.
+
+ * keyboard.c (command_loop_1): Handle values `only' and `identity'
+ for Vtransient_mark_mode.
+
+ * buffer.c (syms_of_buffer): Doc fix.
+
+2004-06-21 David Kastrup <dak@gnu.org>
+
+ * minibuf.c (Ftry_completion, Fall_completions): Do lazy binding
+ and unbinding of `case-fold-search' according to
+ `completion-ignore-case' around calls of string-match and
+ predicates, respectively. Should give satisfactory performance
+ in all relevant cases.
+
+2004-06-17 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * xterm.c (x_draw_image_foreground_1): Subtract slice.x/y from
+ clip_x/y_origin.
+
+ * fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca.
+
+ * macfns.c (Fx_display_color_cells): Do not limit return value to 256.
+
+ * macterm.c (mac_initialize_display_info): Initialize n_planes correctly
+ on Mac OSX.
+
+2004-06-16 Luc Teirlinck <teirllm@auburn.edu>
+
+ * buffer.c (syms_of_buffer): Clarify `fill-column' docstring.
+
+2004-06-16 Kim F. Storm <storm@cua.dk>
+
+ * dispextern.h (Vimage_types): Remove extern.
+
+2004-06-16 Miles Bader <miles@gnu.org>
+
+ * image.c (lookup_image_type): Initialize image type if necessary.
+
+2004-06-15 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (try_cursor_movement): Exclude header line from scroll
+ margin at top of window.
+ (try_window_reusing_current_matrix): Calculate proper cursor position
+ after scrolling up with non-zero scroll margin, as the old cursor
+ position corresponds to value of PT before executing this command.
+ (try_window_id): Consider scroll margin at bottom of window too;
+ otherwise we fail to scroll when hl-line-mode is enabled.
+
+ * syntax.c (skip_chars): Only recognize [:class:] when it has the
+ proper format and class is a lower-case word.
+
+2004-06-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (xg_get_image_for_pixmap): New function.
+ (xg_get_gdk_pixmap_and_mask): Removed.
+ (update_frame_tool_bar): Call xg_get_image_for_pixmap instead of
+ xg_get_gdk_pixmap_and_mask.
+
+ * xterm.h (struct x_display_info): Typo in comment fixed.
+
+2004-06-14 Juanma Barranquero <lektu@terra.es>
+
+ * dispextern.h (Vimage_types): Make it conditional on
+ HAVE_WINDOW_SYSTEM.
+
+ * image.c (Vimage_types): Move from xdisp.c.
+ (Vimage_type_cache): New variable.
+ (define_image_type): New argument indicating whether an image
+ library was loaded; cache loaded status and return t on success,
+ nil otherwise.
+ (CACHE_IMAGE_TYPE, ADD_IMAGE_TYPE): New macros.
+ (w32_delayed_load): New function to load an image library from a
+ list of possible filenames.
+ (init_xpm_functions, init_png_functions, init_jpeg_functions)
+ (init_tiff_functions, init_gif_functions): Use `w32_delayed_load'.
+ (CHECK_LIB_AVAILABLE): Call `define_image_library' with new
+ argument.
+ (Finit_image_library): New function, extracted from `init_image'.
+ Try to initialize an image library on demand and cache whether we
+ were successful or not.
+ (syms_of_image): Initialize `Vimage_types' and
+ `Vimage_type_cache'. Add recognized image types to Vimage_types.
+ Export `init-image-library'.
+ (init_image): Remove initialization of all image types, except xbm
+ and pbm.
+
+ * xdisp.c (Vimage_types): Delete (moved to image.c).
+
+2004-06-14 Andreas Schwab <schwab@suse.de>
+
+ * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
+ Avoid calling specbind when completion-regexp-list is empty.
+
+2004-06-13 Richard M. Stallman <rms@gnu.org>
+
+ * regex.h (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t)
+ (re_wctype, re_iswctype, re_wctype_to_bit):
+ Non-function definitions moved here from regex.c.
+
+ * regex.c (re_wctype, re_iswctype): Function defs longer static.
+ (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t)
+ (re_wctype, re_iswctype, re_wctype_to_bit):
+ Non-function definitions moved to regex.h.
+
+ * window.c (Fselect_window): Doc fix.
+
+ * syntax.c: Include regex.h.
+ (skip_chars): New arg HANDLE_ISO_CLASSES. Callers changed.
+ If requested, make a list of classes, then check the scanned
+ chars for membership in them.
+ (in_classes): New function.
+ Doc fix.
+
+ * keyboard.c (cmd_error): Don't call any_kboard_state
+ if inside a recursive edit level.
+
+2004-06-13 Lorentey K,Aa(Broly <lorentey@elte.hu>
+
+ * keyboard.c (command_loop): Call any_kboard_state before
+ command_loop_2 when at top level.
+
+2004-06-13 Andreas Schwab <schwab@suse.de>
+
+ * print.c (print_object): Always use %ld for printing EMACS_INT.
+
+ * keyboard.c (cancel_hourglass_unwind): Return a value.
+ (modify_event_symbol): Always use %ld for printing EMACS_INT.
+ (Fexecute_extended_command): Likewise.
+
+ * syntax.h (SYNTAX_ENTRY_FOLLOW_PARENT): Rename local variable to
+ avoid clashes.
+ (SYNTAX): Likewise.
+ (SYNTAX_WITH_FLAGS): Likewise.
+ (SYNTAX_MATCH): Likewise.
+
+ * syntax.c (char_quoted): Avoid warning about undefined operation.
+ (find_defun_start): Likewise.
+ (scan_lists): Likewise.
+ (INC_FROM): Likewise.
+ (scan_sexps_forward): Likewise.
+
+ * image.c: Include <ctype.h>.
+
+ * xfaces.c (face_attr_equal_p): Declare parameters.
+
+2004-06-13 Kenichi Handa <handa@m17n.org>
+
+ * ccl.c (CCL_READ_CHAR): If hit EOF, set REG to -1.
+
+2004-06-12 Matthew Mundell <matt@mundell.ukfsn.org>
+
+ * eval.c (Fdefun): Signal an error if NAME is not a symbol.
+
+2004-06-12 Kenichi Handa <handa@m17n.org>
+
+ * ccl.c (CCL_CALL_FOR_MAP_INSTRUCTION): Save eof_ic in
+ ccl_prog_stack_struct and update it.
+ (CCL_INVALID_CMD): If CCL_DEBUG is defined, call ccl_debug_hook.
+ (CCL_READ_CHAR): Get instruction counter from eof_ic, not from
+ ccl->eof_ic on EOF.
+ (ccl_debug_hook): New function.
+ (struct ccl_prog_stack): New member eof_ic.
+ (ccl_driver): Handle EOF in subrountine call correctly.
+
+2004-06-11 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (decode_coding_string): Check CODING_FINISH_INTERRUPT.
+
+2004-06-11 Kim F. Storm <storm@cua.dk>
+
+ * emacs.c (shut_down_emacs): Inhibit redisplay during shutdown.
+
+2004-06-11 Juanma Barranquero <lektu@terra.es>
+
+ * keyboard.c (Fposn_at_point): Doc fix.
+
+2004-06-11 David Kastrup <dak@gnu.org>
+
+ * search.c (match_limit): Don't flag an error if match-data
+ exceeding the allocated search_regs.num_regs gets requested, just
+ return Qnil.
+
+2004-06-08 Miles Bader <miles@gnu.org>
+
+ * xfaces.c (push_named_merge_point): Return 0 when a cycle is detected.
+
+2004-06-07 Juanma Barranquero <lektu@terra.es>
+
+ * editfns.c (Fuser_login_name, Ffloat_time, Fencode_time)
+ (Fcurrent_time_string, Fcurrent_time_zone)
+ (Finsert_buffer_substring, Ftranspose_regions): Doc fixes.
+
+2004-06-07 Miles Bader <miles@gnu.org>
+
+ * xfaces.c (struct named_merge_point): New type.
+ (push_named_merge_point): New function.
+ (merge_named_face): New function.
+ (merge_face_ref, face_at_buffer_position, face_at_string_position):
+ Use `merge_named_face'.
+ (merge_face_inheritance): Function removed.
+ (merge_face_ref): Renamed from `merge_face_vector_with_property'.
+ Add new `err_msgs' and `named_merge_points' args. Return error
+ status. Only print error messages if ERR_MSGS is true. Don't try to
+ do :inherit attribute validation.
+ (merge_face_heights): Handle `unspecified' in both directions.
+ (merge_face_vectors): Rename `cycle_check' arg to `named_merge_points'.
+ Call `merge_face_ref' instead of `merge_face_inheritance'.
+ (Fdisplay_supports_face_attributes_p, Fface_attributes_as_vector)
+ (compute_char_face, face_at_buffer_position)
+ (face_at_string_position): Call `merge_face_ref' instead of
+ `merge_face_vector_with_property'.
+
+2004-06-07 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (find_safe_codings): Check NILP (safe_codings) only at
+ the necessary places.
+
+2004-06-07 Kim F. Storm <storm@cua.dk>
+
+ * process.c (Fdelete_process): Undo 2004-05-28 change.
+ Instead, call status_notify also for network process.
+ (status_message): Use process instead of status as arg.
+ Give messages "deleted" or "connection broken by remote peer" for
+ an exited network process.
+ (status_notify): Change call to status_message.
+ (read_process_output): Increase readmax to 4096. Do not increase
+ buffer size for datagram channels (default is now large enough).
+
+2004-06-06 Steven Tamm <tamm@Steven-Tamms-Computer.local>
+
+ * macfns.c (x_create_tip_frame): Fix Mac OS X 10.1 compilation
+ problem due to newly defined variable.
+
+2004-06-06 Miles Bader <miles@gnu.org>
+
+ * xfaces.c (Fdisplay_supports_face_attributes_p): Give up
+ immediately if non-interactive or not initialized.
+
+2004-06-05 Richard M. Stallman <rms@gnu.org>
+
+ * minibuf.c (Fcompleting_read): Doc fix.
+
+2004-06-05 Andreas Schwab <schwab@suse.de>
+
+ * macfns.c (x_create_tip_frame): Fix declaration after statement.
+
+2004-06-05 Juanma Barranquero <lektu@terra.es>
+
+ * keymap.c (Fdescribe_vector): Fix docstring.
+ (Fkey_description, Fglobal_key_binding): Fix typo in docstring.
+
+2004-06-05 Miles Bader <miles@gnu.org>
+
+ * xfaces.c (tty_supports_face_attributes_p): Make sure the specified
+ attributes have different values than the default face.
+
+2004-06-04 Eli Zaretskii <eliz@gnu.org>
+
+ * xfaces.c (x_supports_face_attributes_p): Make this function
+ conditional on HAVE_WINDOW_SYSTEM.
+ (Fdisplay_supports_face_attributes_p) [HAVE_WINDOW_SYSTEM]: Don't
+ call x_supports_face_attributes_p if it was not compiled in.
+
+2004-06-04 Miles Bader <miles@gnu.org>
+
+ * xfaces.c (tty_supports_face_attributes_p): New function, mostly
+ from Ftty_supports_face_attributes_p.
+ (x_supports_face_attributes_p): New function.
+ (Ftty_supports_face_attributes_p): Function deleted.
+ (Fdisplay_supports_face_attributes_p): New function.
+ (syms_of_xfaces): Initialize Sdisplay_supports_face_attributes_p.
+ (face_attr_equal_p): New function.
+ (lface_equal_p): Use it.
+
+2004-06-03 Juanma Barranquero <lektu@terra.es>
+
+ * w32fns.c (Fx_display_grayscale_p, Fw32_send_sys_command)
+ (Vw32_color_map): Fix typo in docstring.
+ (Fx_create_frame, Fw32_find_bdf_fonts, Fx_show_tip)
+ (Fw32_unregister_hot_key, Fw32_reconstruct_hot_key):
+ Make argument names match their use in docstring.
+
+2004-06-02 Juanma Barranquero <lektu@terra.es>
+
+ Work around bugs/problems with MinGW builds of graphics libraries
+ called from MSVC builds of Emacs.
+
+ * image.c (lookup_image): Make pointer to img static.
+ (png_read_from_memory): Disable "global" optimization.
+
+2004-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * mem-limits.h (EXCEEDS_LISP_PTR) [USE_LSB_TAG]: Never true.
+
+2004-05-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * macfns.c: Don't include ccl.h.
+ [MAC_OSX]: Don't include QuickTime/QuickTime.h.
+ [!MAC_OSX]: Don't include alloca.h, Windows.h, Gestalt.h, or
+ TextUtils.h.
+ (Fx_create_frame): Sync with xfns.c. Initialize cursor
+ descriptors.
+ (Fx_display_mm_height, Fx_display_mm_width): Calculate length from
+ display height/width.
+ (compute_tip_xy, Vx_max_tooltip_size): Declare.
+ (unwind_create_tip_frame, compute_tip_xy): New functions.
+ (x_create_tip_frame, Fx_show_tip, Fx_hide_tip): Sync with xfns.c.
+ (syms_of_macfns): Initialize Qcancel_timer, Vx_max_tooltip_size,
+ and last_show_tip_args.
+
+ * macgui.h [!MAC_OSX]: Include Gestalt.h.
+ (Cursor, No_Cursor): New defines.
+ [!TARGET_API_MAC_CARBON] (SetPortWindowPort): New compatibility
+ macro.
+ [!TARGET_API_MAC_CARBON] (arrow_cursor): Declare.
+
+ * macmenu.c (mac_menu_show, mac_dialog): Use SetPortWindowPort.
+
+ * macterm.c: Don't include Gestalt.h.
+ (enum mouse_tracking_type, mouse_tracking_in_progress): Remove.
+ (XDrawLine, XClearArea, XClearWindow, mac_draw_bitmap)
+ (mac_set_clip_rectangle, mac_reset_clipping, XCreatePixmap)
+ (XFillRectangle, mac_draw_rectangle, mac_draw_string_common)
+ (mac_copy_area, mac_copy_area_with_mask, x_update_end)
+ (construct_mouse_click, XTmouse_position)
+ (x_scroll_bar_report_motion, x_calc_absolute_position)
+ (do_mouse_moved, do_zoom_window, mac_do_receive_drag)
+ (XTread_socket, make_mac_frame): Use SetPortWindowPort.
+ (note_mouse_movement): Clear the mouse face and reset the pointer
+ shape when the pointer goes outside the frame without grabbing.
+ (mac_front_window): New function.
+ (mac_window_to_frame): New macro.
+ (XTmouse_position, x_scroll_bar_report_motion, do_window_update)
+ (do_window_activate, do_window_deactivate, do_app_resume)
+ (do_app_suspend, do_mouse_moved, do_menu_choice, do_grow_window)
+ (do_zoom_window, mac_do_receive_drag, XTread_socket)
+ (mac_check_for_quit_char): Use mac_front_window and/or
+ mac_window_to_frame.
+ (x_scroll_bar_handle_click): Set `(PORTION . WHOLE)' part in a
+ scroll-bar click event.
+ (mac_define_frame_cursor): Change the pointer shape.
+ (x_free_frame_resources): Reset tip_window to NULL when it is
+ disposed.
+ [!TARGET_API_MAC_CARBON] (arrow_cursor): New variable.
+ [!TARGET_API_MAC_CARBON] (do_init_managers): Initialize
+ arrow_cursor.
+ (do_window_update): Don't do anything if the updated window is the
+ tooltip window.
+ (do_mouse_moved): Handle mouse movement events here (previously in
+ XTread_socket). Clear the mouse face if
+ dpyinfo->mouse_face_hidden is set.
+ (do_os_event, do_events): Remove (now in XTread_socket).
+ (XTread_socket): Immediately return if interrupt_input_blocked.
+ Loop until all the events in the queue are processed. Rearrange
+ codes for mouse grabbing. Add tooltip support. Include the
+ contents of do_os_event and do_events. Remove mouse movement
+ handling (now in do_mouse_moved). Add the case where
+ Vmouse_highlight has an integer value.
+ (NewMacWindow): Remove.
+ (make_mac_frame): Do what NewMacWindow previously did. Don't do
+ excess initializations.
+ (make_mac_terminal_frame): Previous initializations in
+ make_mac_frame are moved here.
+ (mac_initialize_display_info): Initialize
+ dpyinfo->mouse_face_overlay and dpyinfo->mouse_face_hidden.
+
+ * xdisp.c [MAC_OS] (No_Cursor): Remove variable.
+ (define_frame_cursor1): Don't treat HAVE_CARBON as a special case.
+
+2004-05-29 Richard M. Stallman <rms@gnu.org>
+
+ * lisp.h (truncate_undo_list): Update decl.
+
+ * alloc.c (undo_outer_limit): New variable.
+ (syms_of_alloc): Defvar it.
+ (Fgarbage_collect): Pass undo_outer_limit to truncate_undo_list.
+
+ * undo.c (truncate_undo_list): New arg LIMITSIZE.
+
+ * alloc.c (lisp_align_malloc): Check for base == 0
+ regardless of HAVE_POSIX_MEMALIGN.
+ Clean up HAVE_POSIX_MEMALIGN handling of `err'.
+
+2004-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * alloc.c: Undo Kim's recent changes and fix the same bug differently.
+ (marker_blocks_pending_free): Remove.
+ (Fgarbage_collect): Sweep after cleaning up undo-lists.
+ Mark the undo lists after claning them up.
+ Don't free block in marker_blocks_pending_free.
+ (mark_buffer): Don't mark undo_list.
+ (gc_sweep): Sweep hash-tables and strings first.
+ Do free marker blocks that are empty.
+
+2004-05-28 Jim Blandy <jimb@redhat.com>
+
+ * regex.c (print_partial_compiled_pattern): Add missing 'break'
+ after 'case wordend'. For symbeg and symend, print to stderr,
+ like the other cases.
+
+2004-05-28 Noah Friedman <friedman@splode.com>
+
+ * process.c (Fdelete_process): Do not call remove_process.
+
+2004-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * alloc.c (struct backtrace): Remove.
+ (Fgarbage_collect): Use the new mark_backtrace.
+
+ * eval.c (mark_backtrace): New function.
+
+ * minibuf.c (run_exit_minibuf_hook): New function.
+ (read_minibuf_unwind): Don't run exit-minibuffer-hook any more.
+ (read_minibuf): Use separate unwind handler to run exit-minibuf-hook.
+
+2004-05-27 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (back_to_previous_visible_line_start): Skip backwards
+ over display properties, e.g. images, that replace buffer text.
+
+2004-05-25 Kim F. Storm <storm@cua.dk>
+
+ * alloc.c (marker_blocks_pending_free): New var.
+ (gc_sweep): Store free marker blocks on that list.
+ (Fgarbage_collect): Free them after undo-list cleanup.
+
+ * process.c (wait_reading_process_input): Check connect_wait_mask
+ before actually accepting connection in case it has already been
+ accepted due to recursion.
+
+2004-05-23 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> (tiny change)
+
+ * coding.c (Fset_safe_terminal_coding_system_internal):
+ Set suppress_error in safe_terminal_coding, not terminal_coding.
+
+2004-05-22 Richard M. Stallman <rms@gnu.org>
+
+ * alloc.c (Fmake_string): Doc fix.
+
+ * buffer.c (clone_per_buffer_values): Copy the alist of local vars,
+ and the alist pairs too.
+
+ * casefiddle.c (casify_object): Return OBJ unchanged if not real char.
+
+ * emacs.c (main): Update copyright year.
+
+ * fileio.c (Fread_file_name): Expand DIR if not absolute.
+
+ * insdel.c (del_range_2, replace_range): Don't write an anchor
+ if the gap is empty.
+
+ * xdisp.c (try_scrolling): If scroll-up-aggressively or
+ scroll-down-aggressively is small but positive, put point
+ near the screen edge.
+
+2004-05-22 Juanma Barranquero <lektu@terra.es>
+
+ * keymap.c (Fdefine_key): Doc fix.
+
+2004-05-22 Kim F. Storm <storm@cua.dk>
+
+ * alloc.c (struct backtrace): Add debug_on_exit member.
+ (Fgarbage_collect): Clear out buffer undo_list markers after gc_sweep.
+ Identify those markers as Lisp_Misc_Free objects. Clear car and cdr of
+ the removed cons cells.
+ (mark_object): Undo previous change - disallow Lisp_Misc_Free objects.
+ (gc_sweep): Clear cons_blocks before sweeping strings, so we don't have
+ any cons cells pointing to unallocated stings.
+ Do not lisp_free any marker blocks, as there may still be pointers
+ to them from buffer undo lists at this stage of GC.
+
+ * keyboard.c (struct backtrace): Add debug_on_exit member.
+ (Fcommand_execute): Clear it.
+
+2004-05-20 Luc Teirlinck <teirllm@auburn.edu>
+
+ * intervals.c (lookup_char_property): Do not prematurely return nil.
+
+2004-05-19 Jim Blandy <jimb@redhat.com>
+
+ Add support for new '\_<' and '\_>' regexp operators, matching the
+ beginning and end of symbols.
+
+ * regex.c (enum syntaxcode): Add Ssymbol.
+ (init_syntax_once): Set the syntax for '_' to Ssymbol, not Sword.
+ (re_opcode_t): New opcodes `symbeg' and `symend'.
+ (print_partial_compiled_pattern): Print the new opcodes properly.
+ (regex_compile): Parse the new operators.
+ (analyse_first): Skip sym(beg|end) (they match only the empty string).
+ (mutually_exclusive_p): `symend' is mutually exclusive with \s_ and
+ \sw; `symbeg' is mutually exclusive with \S_ and \Sw.
+ (re_match_2_internal): Match symbeg and symend.
+
+ * search.c (trivial_regexp_p): \_ is no longer a trivial regexp.
+
+2004-05-19 Kim F. Storm <storm@cua.dk>
+
+ * .gdbinit (xsymbol): Fix last change.
+
+2004-05-18 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * .gdbinit (xprintstr): New fun.
+ (xstring, xprintsym): Use it.
+
+ * w32proc.c (create_child): Use INTMASK.
+
+ * alloc.c (Fgarbage_collect): Do all the marking before flushing
+ unmarked elements of the undo list.
+
+2004-05-18 David Ponce <david@dponce.com>
+
+ * print.c (print): Reset print_depth before to call print_object.
+
+2004-05-18 Jason Rumney <jasonr@gnu.org>
+
+ * w32console.c: Prefix RIF functions with w32con_ to avoid
+ namespace clash with functions in term.c and w32term.c.
+
+ * w32menu.c (add_menu_item, w32_menu_display_help)
+ [USE_LISP_UNION_TYPE]: Cast from Lisp_Object using i member.
+
+ * w32term.h (display_x_get_resource, vga_stdcolor_name): Add prototype.
+
+2004-05-18 Eli Zaretskii <eliz@gnu.org>
+
+ * lisp.h (DECL_ALIGN): Remove restriction on MS-DOS systems.
+
+ * msdos.c (syms_of_msdos): Initialize dos-unsupported-char-glyph
+ with make_number.
+ (IT_write_glyphs): Extract glyph from dos-unsupported-char-glyph
+ with XINT.
+
+2004-05-18 Kim F. Storm <storm@cua.dk>
+
+ * blockinput.h (INPUT_BLOCKED_P): New macros.
+
+ * keyboard.c (Frecursive_edit): Return immediately if input blocked.
+ (Ftop_level): Unblock input if blocked.
+
+ * buffer.h (GET_OVERLAYS_AT): New macro.
+ * msdos.c (IT_note_mouse_highlight): Use it.
+ * textprop.c (get_char_property_and_overlay): Use it.
+ * xdisp.c (next_overlay_change, note_mouse_highlight): Use it.
+ * xfaces.c (face_at_buffer_position): Use it.
+
+ * print.c (print_object): Increase buf size.
+
+2004-05-17 Jason Rumney <jasonr@gnu.org>
+
+ * w32fns.c (Fw32_register_hot_key, Fw32_unregister_hot_key)
+ (Fw32_toggle_lock_key) [USE_LISP_UNION_TYPE]: Cast from
+ Lisp_Object using i member.
+ (w32_quit_key): Rename from Vw32_quit_key, and make an int.
+ (syms_of_w32fns, globals_of_w32fns): Use Lisp_Object and int
+ consistently.
+
+ * w32proc.c (create_child): Use make_number instead of masking pid.
+
+ * w32fns.c (w32_color_map_lookup): Return a Lisp_Object.
+ (x_to_w32_charset, w32_to_x_charset, w32_to_all_x_charsets):
+ Use EQ to compare Lisp_Objects.
+ (w32_parse_hot_key): Use int for lisp_modifiers consistently.
+
+ * w32term.c (w32_num_mouse_buttons): Rename from
+ Vw32_num_mouse_buttons and make it an int.
+
+ * w32.c (init_environment): Use it.
+
+ * w32fns.c (w32_wnd_proc): Likewise.
+
+ * w32proc.c (w32_pipe_read_delay): Rename from
+ Vw32_pipe_read_delay and make it an int.
+
+ * w32.c (_sys_read_ahead): Use it.
+
+ * lisp.h (egetenv) [USE_CRT_DLL]: Remove condition.
+
+ * w32proc.c (create_child) [USE_LSB_TAG]: Don't try to mask pid.
+
+ * w32inevt.c (w32_console_mouse_position, do_mouse_event)
+ (key_event): Don't mix Lisp_Object and int.
+
+ * w32heap.c (init_heap) [USE_LSB_TAG]: Don't check heap location.
+
+ * keyboard.c (kbd_buffer_get_event): Don't use event->code and
+ modifiers in language change event.
+
+2004-05-17 Kim F. Storm <storm@cua.dk>
+
+ * alloc.c (mark_object): Ignore Lisp_Misc_Free objects.
+ Such objects may be freed markers which still exist on an undo list.
+
+2004-05-16 Juanma Barranquero <lektu@terra.es>
+
+ * data.c (Fset_default): Make argument names match their use in
+ docstring.
+
+2004-05-15 Andreas Schwab <schwab@suse.de>
+
+ * emacs.c (gdb_array_mark_flag): Define.
+ * .gdbinit: Mask off gdb_array_mark_flag from vector sizes.
+
+2004-05-15 Eli Zaretskii <eliz@gnu.org>
+
+ * lisp.h (DECL_ALIGN) [MSDOS]: Don't define DECL_ALIGN to use
+ __attribute__((__aligned__)), so that USE_LSB_TAG would not become
+ defined for the MS-DOS build.
+
+2004-05-14 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * w32fns.c (Fw32_define_rgb_color): Avoid XSET.
+
+2004-05-14 Kenichi Handa <handa@m17n.org>
+
+ * ccl.c (Fccl_execute_on_string): Fix setting elements of STATUS.
+
+2004-05-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * lisp.h (Vx_resource_name, Vx_resource_class): Move from xfns.c
+ section to frame.c section.
+ (Fxw_display_color_p, Fx_file_dialog): Declare if
+ HAVE_WINDOW_SYSTEM defined.
+
+ * macfns.c (Fx_create_frame): Fix int/Lisp_Object mixup.
+
+ * macmenu.c (set_frame_menubar): Use NILP to test a lisp value.
+
+ * macterm.c (mac_get_emulated_btn, mac_event_to_emacs_modifiers)
+ (mac_get_mouse_btn): Use NILP and EQ to test/compare lisp values.
+ (XTread_socket): Fix int/Lisp_Object mixup.
+ (mac_check_for_quit_char): Fix pointer/Lisp_Object mixup.
+
+ * macterm.h (struct frame, struct face, struct image)
+ (display_x_get_resource, Fx_display_color_p)
+ (Fx_display_grayscale_p, Fx_display_planes, x_free_gcs):
+ Add prototypes.
+
+2004-05-14 Kim F. Storm <storm@cua.dk>
+
+ * process.c (wait_reading_process_input): Make reentrant.
+ Make Available and Connecting non-static. Save and restore value
+ of waiting_for_user_input_p.
+
+2004-05-13 Kim F. Storm <storm@cua.dk>
+
+ * keyboard.c (mark_kboards): Don't mark x and y members
+ that are overloaded in selection request events.
+
+2004-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * lisp.h (USE_LSB_TAG): Make it the default when it is known to work.
+
+2004-05-13 Glenn Morris <gmorris@ast.cam.ac.uk>
+
+ * window.c (Fdisplay_buffer, Fsplit_window)
+ (split-height-threshold): Doc fix.
+
+2004-05-13 Juanma Barranquero <lektu@terra.es>
+
+ * xfaces.c (Ftty_supports_face_attributes_p)
+ (Finternal_copy_lisp_face): Fix typo in docstring.
+ (Finternal_get_lisp_face_attribute): Fix docstring.
+
+2004-05-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * xfns.c (syms_of_xfns): Provide x-toolkit also for GTK.
+
+2004-05-11 Steven Tamm <steventamm@mac.com>
+
+ * macfns.c (Fx_create_frame): Default to using tool-bar by
+ setting tool-bar-lines to 1 in default-frame-alist.
+
+2004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * image.c (xpm_scan, xpm_make_color_table_v, xpm_put_color_table_v)
+ (xpm_get_color_table_v, xpm_make_color_table_h)
+ (xpm_put_color_table_h, xpm_get_color_table_h)
+ (xpm_str_to_color_key, xpm_load_image, xpm_load)
+ (syms_of_image): Support XPM on Carbon Emacs. Does not
+ depend on libXpm, but only supports XPM version 3 without extensions.
+
+2004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * macterm.c (x_flush, XTframe_up_to_date): Use FRAME_MAC_P
+ instead of FRAME_X_P
+
+2004-05-11 Kim F. Storm <storm@cua.dk>
+
+ * process.c (read_process_output): Grow decoding_buf when needed;
+ this could cause a crash in allocate_string and compact_small_strings.
+
+2004-04-29 Jim Blandy <jimb@redhat.com>
+
+ * regex.c (mutually_exclusive_p): In 'case wordbeg', compare op2
+ against proper opcode.
+
+2004-05-10 Juanma Barranquero <lektu@terra.es>
+
+ * process.c (Fstart_process): Fix docstring.
+
+ * charset.c (Fget_unused_iso_final_char): Fix typos in docstring.
+ (Fchar_bytes, Fchar_width, Fstring_width, Fchar_direction)
+ (Fsplit_char, Fchar_charset): Make argument names match their use
+ in docstring.
+
+2004-05-10 Richard M. Stallman <rms@gnu.org>
+
+ * print.c (print_preprocess): Use being_printed, loop_count and
+ halftail to detect overdeep nesting and cyclic cdr chains.
+
+2004-05-10 Andreas Schwab <schwab@suse.de>
+
+ * lisp.h: Declare Fmake_symbolic_link.
+
+ * fileio.c (Frename_file): Remove extra argument in call to
+ Fmake_symbolic_link.
+
+2004-05-10 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (calc_line_height_property): Use string position when
+ object is a string.
+
+2004-05-10 Kenichi Handa <handa@m17n.org>
+
+ * print.c (temp_output_buffer_setup): Bind inhibit-read-only and
+ inhibit-modification-hooks to t temporarily before calling
+ Ferase_buffer.
+
+ * xfns.c (x_create_tip_frame): Bind inhibit-read-only and
+ inhibit-modification-hooks to t temporarily before calling
+ Ferase_buffer.
+
+ * w32fns.c (x_create_tip_frame): Bind inhibit-read-only and
+ inhibit-modification-hooks to t temporarily before calling
+ Ferase_buffer.
+
+ * fns.c (count_combining): Delete it.
+ (concat): Don't check combining bytes.
+
+2004-05-09 Jason Rumney <jasonr@gnu.org>
+
+ * w32fns.c (Vw32_ansi_code_page): New Lisp variable.
+ (globals_of_w32fns): Set it.
+
+2004-05-09 Piet van Oostrum <piet@cs.uu.nl> (tiny change)
+
+ * data.c (Fquo): Simplify.
+
+2004-05-08 Peter Whaite <emacs@whaite.ca> (tiny change)
+
+ * data.c (Fquo): If any argument is float, do the computation in
+ floating point.
+
+2004-05-08 Juanma Barranquero <lektu@terra.es>
+
+ * process.c (Fwaiting_for_user_input_p, Fmake_network_process)
+ (Fset_process_query_on_exit_flag, Vprocess_adaptive_read_buffering):
+ Fix spelling of Emacs on docstring.
+ (Fset_process_coding_system, Fprocess_coding_system)
+ (Fset_process_filter_multibyte, Fprocess_filter_multibyte_p):
+ Make argument names match their use in docstring.
+ (Fprocess_id, Fprocess_query_on_exit_flag, Finterrupt_process):
+ Fix docstring.
+
+ * editfns.c (Finsert_buffer_substring): Make argument names match their
+ use in docstring.
+
+ * syntax.c (Fmodify_syntax_entry): Fix docstring.
+
+2004-05-07 Steven Tamm <steventamm@mac.com>
+
+ * macterm.c (mac_check_for_quit_char): Adding BLOCK_INPUT
+ around call to ReceiveEvent to avoid certain crashes.
+
+2004-05-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * macterm.c (mac_draw_line_to_pixmap, XCreatePixmapFromBitmapData)
+ (mac_fill_rectangle_to_pixmap, mac_draw_rectangle_to_pixmap)
+ (mac_copy_area_to_pixmap, mac_copy_area_with_mask_to_pixmap):
+ Save/restore the current graphics port and device handle when
+ drawing into an offscreen graphics world.
+
+ * image.c [MAC_OS] (XPutPixel, XGetPixel, image_load_qt_1)
+ (gif_load): Likewise.
+
+2004-05-07 Juanma Barranquero <lektu@terra.es>
+
+ * window.c (Fset_window_buffer): Fix docstring.
+
+2004-05-06 Thien-Thi Nguyen <ttn@gnu.org>
+
+ * emacs.c (main) [VMS]: Fix var ref.
+
+2004-05-06 Romain Francoise <romain@orebokech.com> (tiny change)
+
+ * data.c (Fsetq_default): Fix docstring.
+
+2004-05-06 Jason Rumney <jasonr@gnu.org>
+
+ * image.c (Display) [HAVE_NTGUI]: Redefine while loading xpm.h
+ to avoid name clash.
+
+2004-05-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * fileio.c (barf_or_query_if_file_exists): Use lstat.
+ (Frename_file): Handle renaming of symlinks across file systems.
+ (Frename_file): Put symlink handling inside #ifdef S_IFLNK.
+
+2004-05-04 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (Qtotal): New var.
+ (syms_of_xdisp): Intern and staticpro it.
+ (calc_line_height_property): New arg total. Set it if
+ line-spacing property has format (total . VALUE).
+ (x_produce_glyphs): Ignore line-spacing if line-height is 0.
+ Handle total line-spacing property.
+
+2004-05-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (xg_update_scrollbar_pos): Call XClearWindow to clear
+ "under" scroll bar when size/position changes.
+
+2004-05-03 Jason Rumney <jasonr@gnu.org>
+
+ * makefile.nt: Remove.
+
+2004-05-02 Eli Zaretskii <eliz@gnu.org>
+
+ * syntax.h (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY_INT):
+ Avoid compiler warnings.
+
+ * Makefile.in (region-cache.o): Depend on config.h.
+
+2004-05-02 Romain Francoise <romain@orebokech.com> (tiny change)
+
+ * indent.c (compute_motion): Save vpos in prev_vpos when dealing
+ with continuation lines, too.
+
+2004-05-02 Thien-Thi Nguyen <ttn@gnu.org>
+
+ * syssignal.h (init_signals): Move decl outside `#ifdef POSIX_SIGNALS'.
+
+2004-05-01 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * xdisp.c (calc_line_height_property): YAILOM (yet another
+ int/Lisp_Object mixup).
+
+2004-05-01 Eli Zaretskii <eliz@gnu.org>
+
+ * msdos.c (top-level): Add "#pragma pack(0)" after <dir.h>, to
+ undo bad effect of pack(4) in some versions of system headers.
+
+2004-05-01 Jason Rumney <jasonr@gnu.org>
+
+ * w32term.c (x_draw_hollow_cursor): Sync with xterm.c
+
+2004-04-30 Kim F. Storm <storm@cua.dk>
+
+ * buffer.c (syms_of_buffer) <line-spacing>: Allow float value.
+ (syms_of_buffer) <cursor-type>: Doc fix.
+
+ * dispextern.h (struct it): Remove member use_default_face.
+ Add members override_ascent, override_descent, override_boff.
+
+ * xdisp.c (init_iterator): Handle line-spacing float value.
+ Initialize override_ascent member.
+ (append_space_for_newline): Reset override_ascent.
+ Remove use_default_face.
+ (calc_line_height_property): New function to calculate value of
+ line-height and line-spacing properties. Look at overlays, too.
+ Set override_ascent, override_descent, override_boff members when
+ using another face than the current face. Float values are now
+ relative to the frame default font, by default; accept a cons
+ of ratio and face name to specify value relative to a specific face.
+ (x_produce_glyphs): Use calc_line_height_property.
+ Use override_ascent etc. when set to handle different face heights.
+ A negative line-spacing property value is interpreted as a total
+ line height, rather than inter-line spacing.
+ (note_mouse_highlight): Allocate room for 40 overlays initially.
+
+2004-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * data.c (Fsubr_name): New fun.
+ (syms_of_data): Defsubr it.
+
+2004-04-29 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (null_glyph_slice): New var.
+ (append_glyph, append_composite_glyph, append_stretch_glyph):
+ Use it to initialize glyph slice.
+
+2004-04-27 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * xdisp.c (x_produce_glyphs): Fix the proverbial int/Lisp_Object mixup.
+ (on_hot_spot_p): Make sure we always return a value.
+ (Flookup_image_map): Remove unused var ix and iy.
+ (note_mode_line_or_margin_highlight): Remove unused var `image'.
+
+2004-04-27 Eli Zaretskii <eliz@gnu.org>
+
+ * msdos.c (init_environment): If one of the TMP... environment
+ variables is set to a drive letter without a trailing slash,
+ append a slash.
+
+2004-04-27 Matthew Mundell <matt@mundell.ukfsn.org>
+
+ * editfns.c (lisp_time_argument): Provide externally.
+
+ * fileio.c (Fset_file_times): New function.
+ (syms_of_fileio): Intern and staticpro it.
+
+2004-04-27 Kim F. Storm <storm@cua.dk>
+
+ * xdisp.c (x_produce_glyphs): Fix last change; handle newline in
+ header line strings.
+
+ * dispextern.h (struct it): New member use_default_face.
+
+ * xdisp.c (Qline_height): New variable.
+ (syms_of_xdisp): Intern and staticpro it.
+ (append_space_for_newline): Partially undo 2004-04-25 change;
+ add default_face_p arg, and restore callers.
+ Clear it->use_default_face after use.
+ (x_produce_glyphs): Set default font for ascii char if
+ it->use_default_font is set. Change line-spacing property to set
+ just extra line spacing. Handle new line-height property.
+
+2004-04-26 Andreas Schwab <schwab@suse.de>
+
+ * print.c (print_object): Print non-ascii characters in bool
+ vector representation as octal escapes.
+
+ * lisp.h (BOOL_VECTOR_BITS_PER_CHAR): Define.
+ * print.c (print_object): Use it instead of BITS_PER_CHAR for
+ bool vectors.
+ * lread.c (read1): Likewise.
+ * alloc.c (Fmake_bool_vector): Likewise.
+ * data.c (Faref, Faset): Likewise.
+ * fns.c (Fcopy_sequence, concat, internal_equal, Ffillarray)
+ (mapcar1): Likewise.
+
+2004-04-26 Steven Tamm <tamm@Steven-Tamms-Computer.local>
+
+ * lread.c (init_lread): Fixing typo HAVE_CARBON test logic
+
+2004-04-26 Miles Bader <miles@gnu.org>
+
+ * lisp.h (CYCLE_CHECK): Macro moved from xfaces.c.
+
+2004-04-26 Juanma Barranquero <lektu@terra.es>
+
+ * buffer.c (Fpop_to_buffer): Fix docstring.
+
+2004-04-26 Steven Tamm <steventamm@mac.com>
+
+ * lread.c (init_lread): Don't display missing lisp directory
+ warnings with Carbon Emacs because self-contained bundled Emacs
+ may be built without correct installation path.
+
+2004-04-25 Kim F. Storm <storm@cua.dk>
+
+ * macterm.c (x_draw_hollow_cursor): Fix height of box for narrow lines.
+
+ * xterm.c (x_draw_hollow_cursor): Fix height of box for narrow lines.
+
+ * xdisp.c (append_space_for_newline): Rename from append_space.
+ Remove DEFAULT_FACE_P arg; always use current face. Callers changed.
+ (x_produce_glyphs): Handle line-spacing property on newline char.
+ If value is t, adjust ascent and descent to fit current row height.
+ If value is an integer or float, set extra_line_spacing to integer
+ value, or to float value x current line height.
+
+2004-04-23 Kenichi Handa <handa@m17n.org>
+
+ * fontset.c (Finternal_char_font): If POSITION is nil, return
+ font for displaying CH with the default face.
+
+2004-04-23 Juanma Barranquero <lektu@terra.es>
+
+ * makefile.w32-in: Add "-*- makefile -*-" mode tag.
+
+2004-04-21 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * lisp.h (XINT) [EXPLICIT_SIGN_EXTEND && !NO_UNION_TYPE]:
+ Don't make assumptions about the relative place of i and val.
+ (EQ) [!NO_UNION_TYPE]: Don't forget to check the type match as well.
+
+2004-04-21 Kim F. Storm <storm@cua.dk>
+
+ * dispextern.h (struct glyph_slice): New struct.
+ (struct glyph): New member slice.
+ (GLYPH_SLICE_EQUAL_P): New macro.
+ (GLYPH_EQUAL_P): Use it.
+ (struct glyph_string): New member slice.
+ (struct it_slice): New struct.
+ (struct it): New member slice, add member to stack too.
+ New member constrain_row_ascent_descent_p.
+ (image_ascent): Add prototype.
+
+ * dispnew.c (buffer_posn_from_coords): Return full image width
+ and height even for image slices (posn is relative to full image).
+ (marginal_area_string): Adjust x0,y0 for image slice.
+
+ * image.c (image_ascent): Add slice arg; calculate ascent for
+ image slice (or full image).
+
+ * keyboard.c (Fposn_at_x_y, Fposn_at_point): New defuns.
+ (syms_of_keyboard): Defsubr them.
+
+ * lisp.h (pos_visible_p): Fix prototype.
+
+ * macterm.c (x_draw_relief_rect): Add top_p and bot_p args.
+ (x_draw_glyph_string_box): Fix call to x_draw_relief_rect.
+ (x_draw_image_foreground, x_draw_image_relief)
+ (x_draw_image_foreground_1, x_draw_image_glyph_string):
+ Draw sliced images.
+
+ * w32term.c (w32_draw_relief_rect): Add top_p and bot_p args.
+ (x_draw_glyph_string_box): Fix call to x_draw_relief_rect.
+ (x_draw_image_foreground, x_draw_image_relief)
+ (w32_draw_image_foreground_1, x_draw_image_glyph_string):
+ Draw sliced images.
+
+ * w32term.h (image_ascent): Remove prototype.
+
+ * window.c (Fpos_visible_in_window_p): Return pixel position if
+ PARTIALLY arg is non-nil. Simplify. Doc fix.
+ (Fwindow_vscroll, Fset_window_vscroll): Add optional PIXEL_P arg
+ to return/set vscroll in pixels.
+
+ * window.h (Fwindow_vscroll, Fset_window_vscroll): Fix EXFUN.
+
+ * xdisp.c (Qslice): New variable.
+ (syms_of_xdisp): Intern and staticpro it.
+ (pos_visible_p): Return pixel position in new x and y args.
+ (init_iterator): Reset it->slice info.
+ (handle_display_prop): Parse (slice ...) property.
+ (push_it, pop_it): Save/restore slice info.
+ (make_cursor_line_fully_visible): Fix 2004-04-14 change. Do not
+ force repositioning of tall row if window is vscrolled, as that
+ would reset vscroll.
+ (append_space): Set it->constrain_row_ascent_descent_p to avoid
+ increasing row height if row is non-empty.
+ (fill_image_glyph_string): Copy slice info.
+ (take_vertical_position_into_account): Simplify.
+ (produce_image_glyph): Handle iterator slice info, setup glyph
+ slice info. Do not force minimum line height.
+ (x_produce_glyphs): If it->constrain_row_ascent_descent_p is set,
+ do not increase height (ascent/descent) of non-empty row when
+ adding normal character glyph; instead reduce glyph ascent/descent
+ appropriately; if row is higher than current glyph, adjust glyph
+ descent/ascent to reposition glyph within the existing row.
+ Likewise, when char is newline, only set ascent/descent if row is
+ currently empty.
+ (note_mouse_highlight): Handle hotspots with sliced image.
+
+ * xterm.c (x_draw_relief_rect): Add top_p and bot_p args.
+ (x_draw_glyph_string_box): Fix call to x_draw_relief_rect.
+ (x_draw_image_foreground, x_draw_image_relief)
+ (x_draw_image_foreground_1, x_draw_image_glyph_string):
+ Draw sliced images.
+
+ * xterm.h (image_ascent): Remove prototype.
+
+2004-04-20 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * keymap.c (Fkey_description): Fix the usual int/Lisp_Object mixup.
+
+2004-04-20 John Paul Wallington <jpw@gnu.org>
+
+ * fns.c (Fassoc, Feql): Fix indentation.
+
+ * fontset.c (regularize_fontname): Rename from regulalize_fontname.
+
+2004-04-19 John Paul Wallington <jpw@gnu.org>
+
+ * fns.c (Feql): New function.
+ (syms_of_fns): Defsubr it.
+
+2004-04-18 Jason Rumney <jasonr@gnu.org>
+
+ * w32select.c (Fw32_set_clipboard_data): Get sequence number
+ after closing the clipboard.
+
+2004-04-16 Luc Teirlinck <teirllm@auburn.edu>
+
+ * buffer.c (Fbuffer_base_buffer): Doc fix.
+
+2004-04-17 Kim F. Storm <storm@cua.dk>
+
+ * keymap.c (Fkey_description): Add optional PREFIX arg.
+ Combine prefix with KEYS to make up the full key sequence to describe.
+ Correlate meta_prefix_char and following (simple) key to describe
+ as meta modifier. All callers changed.
+ (describe_map): Rename arg `keys' to `prefix'. Remove local
+ `elt_prefix' var. Use Fkey_description with prefix instead of
+ elt_prefix combined with Fsingle_key_description.
+ (describe_vector): Declare static. Replace arg `elt_prefix' with
+ `prefix'. Add KEYMAP_P arg. Add local var `elt_prefix'; use it
+ if !KEYMAP_P. Use Fkey_description with prefix instead of
+ Fsingle_key_description.
+
+ * keymap.h (Fkey_description): Fix prototype.
+ (describe_vector): Remove prototype.
+
+ * xdisp.c (update_overlay_arrows): Fix handling of up_to_date < 0.
+
+ * image.c (PNG_BG_COLOR_SHIFT): Remove.
+ (png_load): Fix calculation of transparent background color on X
+ and W32 platforms.
+
+2004-04-16 Juanma Barranquero <lektu@terra.es>
+
+ * xdisp.c (try_scrolling): Make sure `scroll-conservatively' is
+ not too large before computing how much to scroll.
+
+2004-04-15 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * dired.c (Ffile_attributes): Don't pass extra nil arg to file-handler.
+
2004-04-14 Luc Teirlinck <teirllm@auburn.edu>
* fileio.c (Fverify_visited_file_modtime, Fvisited_file_modtime):
@@ -30,6 +1157,11 @@
centering_position = 0.
Clear desired matrix before retrying with centering_position = 0.
+2004-04-13 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * syntax.c (scan_lists): Simplify backward string scan.
+ Fix off-by-one boundary check for string and comment fences.
+
2004-04-13 Joe Buehler <jbuehler@hekimian.com>
* sheap.c, unexcw.c: New files.
@@ -573,7 +1705,7 @@
* macterm.c (XTread_socket): Remove bufp_r and
numcharsp args. Add hold_quit arg.
- Rework to use just one, local, inev input_event. Store inev
+ Rework to use just one, local, inev input_event. Store inev
directly in fifo using kbd_buffer_store_event_hold.
* sysdep.c (BUFFER_SIZE_FACTOR): Remove.
@@ -589,14 +1721,14 @@
* w32inevt.c (w32_console_read_socket): Remove bufp_r and
numcharsp args. Add hold_quit arg.
- Rework to use just one, local, inev input_event. Store inev
+ Rework to use just one, local, inev input_event. Store inev
directly in fifo using kbd_buffer_store_event_hold.
* w32inevt.h (w32_console_mouse_position): Fix prototype.
* w32term.c (w32_read_socket): Remove bufp_r and numcharsp args.
- Add hold_quit arg. Rework to use just one, local, inev
- input_event. Store inev directly in fifo using
+ Add hold_quit arg. Rework to use just one, local, inev
+ input_event. Store inev directly in fifo using
kbd_buffer_store_event_hold. Update count in one place.
Postpone call to gen_help_event until inev is stored; use new
local do_help for this.
@@ -615,8 +1747,8 @@
(current_hold_quit) [USE_GTK]: Add.
(event_handler_gdk): Adapt to new handle_one_xevent.
(handle_one_xevent): Remove bufp_r and numcharsp args.
- Add hold_quit arg. Rework to use just one, local, inev
- input_event. Store inev directly in fifo using
+ Add hold_quit arg. Rework to use just one, local, inev
+ input_event. Store inev directly in fifo using
kbd_buffer_store_event_hold. Update count in one place.
Postpone call to gen_help_event until inev is stored; use new
local do_help for this.
@@ -628,7 +1760,7 @@
`goto done' to clarify code flow in deeply nested blocks.
(x_dispatch_event): Simplify as handle_one_xevent now calls
kbd_buffer_store_event itself.
- (XTread_socket): Remove bufp_r and numcharsp args. Add hold_quit
+ (XTread_socket): Remove bufp_r and numcharsp args. Add hold_quit
arg. Call handle_one_xevent with new arglist. Store event from
x_session_check_input in fifo.
[USE_GTK]: Setup current_hold_quit.
@@ -1047,7 +2179,7 @@
2004-02-09 Sam Steingold <sds@gnu.org>
- * w32term.c (w32_draw_fringe_bitmap): Fixed a typo in the last patch.
+ * w32term.c (w32_draw_fringe_bitmap): Fix a typo in the last patch.
2004-02-09 Kim F. Storm <storm@cua.dk>
@@ -1181,7 +2313,7 @@
completion-regexp-list. Define Qcase_fold_search and staticpro it.
(read_minibuf): Fix initial comment.
(Ftry_completion, Fall_completions, Ftest_completion): Bind
- case-fold-serach to the value of completion-ignore-case when
+ case-fold-search to the value of completion-ignore-case when
checking completion-regexp-list.
(Fdisplay_completion_list): Make it handle arguments that are
symbols. Doc fix.
@@ -1557,7 +2689,7 @@
(marginal_area_string): Fix prototypes.
* keyboard.h (POSN_POSN, POSN_SET_POSN): Rename macros from
- POSN_BUFFER_POSN and POSN_SET_BUFFER_POSN. All uses changed.
+ POSN_BUFFER_POSN and POSN_SET_BUFFER_POSN. All uses changed.
(POSN_INBUFFER_P, POSN_BUFFER_POSN): New macros.
* keyboard.c (make_lispy_position): Use modified mode_line_string,
@@ -1724,7 +2856,7 @@
control frame pointer shape. Detect image hot-spots for pointer
and help_echo properties. Use define_frame_cursor1.
(note_mouse_highlight): Use Vvoid_text_area_pointer.
- (syms_of_xdisp): Defsubr new defun. Intern and staticpro new variables.
+ (syms_of_xdisp): Defsubr new defun. Intern and staticpro new variables.
DEFVAR_LISP Vvoid_text_area_pointer instead of Vshow_text_cursor_in_void.
* xfaces.c (cache_face): Abort if c->size exceeds MAX_FACE_ID.
@@ -1845,7 +2977,7 @@
(glyph_to_pixel_coords): Don't use negative hpos.
(x_y_to_hpos_vpos): Fix for partially visible first glyph.
(append_stretch_glyph): Change ascent arg to be actual value
- in pixels rather than ratio to height. Callers changed.
+ in pixels rather than ratio to height. Callers changed.
(calc_pixel_width_or_height): New aux function, implementing
pixel based artihmetic for glyph widths and heights.
(produce_stretch_glyph): Use calc_pixel_width_or_height for
@@ -2047,7 +3179,7 @@
x_display_info_for_display instead. Use Display in xev instead
of GDK_DISPLAY.
(x_dispatch_event): Call x_display_info_for_display.
- (XTread_socket): Move GTK part out of loop. current_dpyinfo removed.
+ (XTread_socket): Move GTK part out of loop. current_dpyinfo removed.
(x_connection_closed): Call xg_display_close for GTK.
(x_term_init): Call xg_display_open for additional displays.
Initiate dpyinfo->xg_cursor with call to xg_create_default_cursor
@@ -2954,7 +4086,7 @@
2003-07-09 Kim F. Storm <storm@cua.dk>
- * xterm.c (use_xim) [!USE_XIM]: Default to disable XIM if emacs
+ * xterm.c (use_xim) [!USE_XIM]: Default to disable XIM if Emacs
was configured with --without-xim.
(x_term_init) [!USE_XIM]: Use `useXIM' resource to turn on XIM.
@@ -3549,7 +4681,7 @@
from x/w32/macterm.h files. All uses changed. Also change code
which referred to f->output_data...->pixel_height.
(FRAME_PIXEL_WIDTH): Renamed from PIXEL_WIDTH and moved
- from x/w32/macterm.h files. All uses changed. Also change code
+ from x/w32/macterm.h files. All uses changed. Also change code
which referred to f->output_data...->pixel_width.
(FRAME_LINES): Renamed from FRAME_HEIGHT. All uses changed.
Also change code which referred to f->height.
@@ -3811,7 +4943,7 @@
window to only preserve the display margins in one of the windows.
When splitting horizontally, call adjust_window_margins on both
windows to ensure that the text area of the new windows is non too
- narrow. This fixes a bug which could cause emacs to trap if the
+ narrow. This fixes a bug which could cause Emacs to trap if the
width of the split window was less than the width of the display
margins.
(window_box_text_cols): Renamed from window_internal_width.
@@ -3842,7 +4974,7 @@
(Fset_window_margins): Do nothing if display margins are not
really changed. Otherwise, call adjust_window_margins to ensure
the text area doesn't get too narrow. This fixes a bug which
- could cause emacs to trap if setting display margins wider than
+ could cause Emacs to trap if setting display margins wider than
the width of the window.
(Fset_window_fringes): New defun to allow user to specifically set
this window's fringe widths and position vs. display margins.
@@ -3859,7 +4991,7 @@
* xdisp.c: Make (many) trivial substitutions for renamed and
new macros in dispextern.h, frame.h and window.h.
(window_box_width): Adapt to per-window fringes and scroll bars,
- and new fringe vs. display margin position. Note that returned
+ and new fringe vs. display margin position. Note that returned
value is no longer guaranteed to be a whole multiple of the frame
column width, since per-window fringes may now be any width.
(window_box_left_offset): New function like window_box_left, but
@@ -4609,7 +5741,7 @@
* xfns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
parameters now defined in frame.h and frame.c.
- (Vx_resource_name): Remove. Use generic var.
+ (Vx_resource_name): Remove. Use generic var.
(enum x_frame_parms): Remove (bogus, unused enum).
(check_x_display_info): Make non-static (for frame.c).
(struct x_frame_parm_table, x_frame_parms): Remove.
@@ -4629,7 +5761,7 @@
(syms_of_xfns): Don't intern/staticpro removed vars.
* xterm.c: Remove unnecessary extern declarations.
- (x_fullscreen_adjust): Remove. Use generic instead.
+ (x_fullscreen_adjust): Remove. Use generic instead.
(x_redisplay_interface): Add x_frame_parm_handlers member.
* w32gui.h (XrmDatabase): New (dummy) typedef.
@@ -4641,7 +5773,7 @@
* w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
parameters now defined in frame.h and frame.c.
- (Vx_resource_name): Remove. Use generic var.
+ (Vx_resource_name): Remove. Use generic var.
(enum x_frame_parms): Remove (bogus, unused enum).
(check_x_display_info): Make non-static (for frame.c).
(struct x_frame_parm_table, x_frame_parms): Remove.
@@ -4674,7 +5806,7 @@
* macfns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
parameters now defined in frame.h and frame.c.
- (Vx_resource_name): Remove. Use generic var.
+ (Vx_resource_name): Remove. Use generic var.
(check_x_display_info): Make non-static (for frame.c).
(struct x_frame_parm_table, x_frame_parms): Remove.
(init_x_parm_symbols, x_set_frame_parameters, x_report_frame_params)
@@ -5655,7 +6787,7 @@
[HAVE_XPM]: Avoid clashes with XColor, XImage and Pixel
definitions in xpm.h.
(init_xpm_functions): New function.
- (xpm_load): Sync with xfns.c. Adapt for Windows version of libXpm.
+ (xpm_load): Sync with xfns.c. Adapt for Windows version of libXpm.
(init_external_image_libraries): Try to load libXpm.dll.
* fileio.c (Fcopy_file) [WINDOWSNT]: Reverse logic for setting
@@ -5684,8 +6816,8 @@
* w32fns.c (DrawText): Kludge to avoid a redefinition on Windows
when including gif_lib.h.
(init_gif_functions, init_tiff_functions): New functions.
- (gif_load, tiff_load): Sync with xfns.c version. Adjust colors for
- Windows. Disable color table lookups. Call library functions
+ (gif_load, tiff_load): Sync with xfns.c version. Adjust colors for
+ Windows. Disable color table lookups. Call library functions
through pointers determined at runtime.
(init_external_image_libraries): Try to load libungif.dll and
libtiff.dll.
@@ -5751,8 +6883,8 @@
* w32fns.c (init_jpeg_functions, jpeg_resync_to_restart_wrapper):
New functions.
- (jpeg_load): Sync with xfns.c version. Adjust colors for Windows.
- Disable color table lookups. Call jpeg library functions
+ (jpeg_load): Sync with xfns.c version. Adjust colors for Windows.
+ Disable color table lookups. Call jpeg library functions
through pointers determined at runtime.
(init_external_image_libraries): Try to load jpeg.dll.
@@ -5789,8 +6921,8 @@
* w32fns.c (XPutPixel): Handle monochrome images; used for masks.
[HAVE_PNG]: Sync with xfns.c version.
- (png_load): Adjust colors for Windows. Use Windows
- bitmaps. Disable color table lookups.
+ (png_load): Adjust colors for Windows. Use Windows
+ bitmaps. Disable color table lookups.
(DEF_IMGLIB_FN, LOAD_IMGLIB_FN): New macros.
(init_png_functions): New function.
(png_read_from_memory, png_load): Call png library functions
@@ -5887,7 +7019,7 @@
2003-01-21 David Ponce <david@dponce.com>
* w32term.c (w32_encode_char): For DIM=1 charset, set
- ccl->reg[2] to -1 before calling ccl_driver. (Sync. with xterm.c
+ ccl->reg[2] to -1 before calling ccl_driver. (Sync. with xterm.c
x_encode_char change by Kenichi Handa <handa@m17n.org> on
2002-09-30.)
(w32_draw_relief_rect): Declare all args.
@@ -6420,7 +7552,7 @@
only if g_b_init_get_sid_identifier_authority is equal to 0.
On initialization set g_b_init_get_sid_identifier_authority equal to 1.
- * w32fns.c (globals_of_w32fns): New function. Used to initialize
+ * w32fns.c (globals_of_w32fns): New function. Used to initialize
those global variables that must always be initialized on startup
even when the global variable initialized is non zero.
Its primary purpose at this time is to initialize the global variable
@@ -6431,7 +7563,7 @@
* w32fns.c (syms_of_w32fns): Call globals_of_w32fns.
- * w32menu.c (globals_of_w32menu): New function. Used to
+ * w32menu.c (globals_of_w32menu): New function. Used to
initialize those global variables that must always be initialized
on startup even when the global variable initialized is non zero.
Its primary purpose at this time is to initialize the global
@@ -7116,7 +8248,7 @@
* process.c (Fformat_network_address): New function.
(syms_of_process): Defsubr it.
(list_processes_1): Use it to format :local/:remote address if
- service/host is not set; before emacs would crash in that case.
+ service/host is not set; before Emacs would crash in that case.
(Fmake_network_process): Don't use Ffind_operation_coding_system
to setup coding system if host or service is not set.
@@ -7779,7 +8911,7 @@
* msdos.c (croak): Add `void' to definition.
- * sysdep.c [MSDOS] (request_sigio, unrequest_sigio):
+ * sysdep.c (request_sigio, unrequest_sigio) [MSDOS]:
Don't define them, they are defined in msdos.c.
* mem-limits.h [MSDOS]: Declare etext.
@@ -7789,7 +8921,7 @@
2002-08-19 Kim F. Storm <storm@cua.dk>
- * keyboard.c (Fclear_this_command_keys): Added optional arg
+ * keyboard.c (Fclear_this_command_keys): Add optional arg
KEEP-RECORD to avoid clearing lossage when we just want to clear
the current key sequence (kmacro needs this).
@@ -8181,12 +9313,11 @@
2002-07-19 Juanma Barranquero <lektu@terra.es>
- * fileio.c (Ffile_name_as_directory): Fix argument name in docstring.
- (file_name_as_directory): Use literal '/' instead of DIRECTORY_SEP.
-
* xdisp.c (syms_of_xdisp): Remove redundant deprecation info.
* fileio.c (syms_of_fileio): Likewise.
+ (Ffile_name_as_directory): Fix argument name in docstring.
+ (file_name_as_directory): Use literal '/' instead of DIRECTORY_SEP.
2002-07-18 Richard M. Stallman <rms@gnu.org>
@@ -8423,8 +9554,8 @@
2002-07-10 Juanma Barranquero <lektu@terra.es>
- * lisp.h (SPECPDL_INDEX): Rename from BINDING_STACK_SIZE. All callers
- changed.
+ * lisp.h (SPECPDL_INDEX): Rename from BINDING_STACK_SIZE.
+ All callers changed.
2002-07-09 Stefan Monnier <monnier@cs.yale.edu>
@@ -8654,7 +9785,7 @@
2002-06-21 Pavel Jan,Am(Bk <Pavel@Janik.cz>
* m/pmax.h (START_FILES): Define START_FILES for NetBSD and
- OpenBSD. Add support for mipseb-*-netbsd* machines.
+ OpenBSD. Add support for mipseb-*-netbsd* machines.
2002-06-17 Andrew Choi <akochoi@shaw.ca>
@@ -10056,7 +11187,7 @@
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
- (read_process_output): Handle datagram sockets. Use 2k buffer for them.
+ (read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
@@ -11442,7 +12573,7 @@
2001-12-14 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (EMACSLOADPATH): Define.
- ($(EMACS)): Run `list-load-path-shadows' after dumping emacs.
+ ($(EMACS)): Run `list-load-path-shadows' after dumping Emacs.
(bootstrap-temacs): Remove dependency on bootstrap-clean.
2001-12-13 Eli Zaretskii <eliz@is.elta.co.il>
@@ -11642,7 +12773,7 @@
2001-12-01 Jason Rumney <jasonr@gnu.org>
- * window.c (Qleft_fringe, Qright_fringe): Remove. Now in frame.c.
+ * window.c (Qleft_fringe, Qright_fringe): Remove. Now in frame.c.
* w32term.h (WM_MOUSELEAVE, TME_LEAVE, TRACKMOUSEEVENT)
[!WM_MOUSELEAVE]: Define.
@@ -11694,7 +12825,7 @@
* xterm.c (zv_height, zv_bits, zv_period): Changed zv bitmap to
fill fringe evenly with small dashes.
- (x_draw_fringe_bitmap): Clear background if necessary. Align and
+ (x_draw_fringe_bitmap): Clear background if necessary. Align and
clip the new ZV bitmap to avoid jitter between rows.
(x_draw_row_fringe_bitmaps): Rely on x_draw_fringe_bitmap to clear
background. Don't draw fringe bitmaps if fringe width is zero.
@@ -11759,7 +12890,7 @@
menu items. From David Ponce <dponce@wanadoo.fr>.
(w32_dialog_show) [HAVE_DIALOGS]: Compile whole function
conditionally.
- (w32_menu_display_help): New argument OWNER. Rewritten to store a
+ (w32_menu_display_help): New argument OWNER. Rewritten to store a
help event in the owner frame's keyboard buffer.
* w32fns.c (w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
@@ -11836,9 +12967,9 @@
* abbrev.c (Fexpand_abbrev): Use Frun_hooks instead of Vrun_hooks.
- * buffer.c (Fkill_buffer): Use Frun_hooks, not Vrun_hooks.
+ * buffer.c (Fkill_buffer): Likewise.
- * print.c (temp_output_buffer_setup): Use Frun_hooks, not Vrun_hooks.
+ * print.c (temp_output_buffer_setup): Likewise.
2001-11-25 Stefan Monnier <monnier@cs.yale.edu>
@@ -11875,7 +13006,7 @@
(my_create_tip_window): Assign tip_window.
(x_create_tip_frame): Use same defaults as X.
(compute_tip_xy): Remove unused variable. Use full screen width.
- (Fx_show_tip): Do not double height. Call ShowWindow directly.
+ (Fx_show_tip): Do not double height. Call ShowWindow directly.
* w32term.c (x_after_update_window_line): Doc fix.
(w32_read_socket): Doc fix. Avoid SET_FRAME_GARBAGED for tip
@@ -12112,9 +13243,9 @@
`bitmaps':
* dispextern.h (FRINGE_FACE_ID): Renamed from BITMAP_AREA_FACE_ID.
- Comments fixed. Use renamed symbols.
+ Comments fixed. Use renamed symbols.
- * dispnew.c: Comment fix. Use renamed symbols.
+ * dispnew.c: Comment fix. Use renamed symbols.
* frame.h (FRAME_FRINGE_COLS): Renamed from FRAME_FLAGS_AREA_COLS.
(FRAME_FRINGE_WIDTH): Renamed from FRAME_FLAGS_AREA_WIDTH.
@@ -12124,13 +13255,13 @@
* w32fns.c: Use renamed symbols.
- * w32term.c: Comment fixes. Use renamed symbols.
+ * w32term.c: Comment fixes. Use renamed symbols.
(fringe_bitmap_type): Renamed from bitmap_type.
(NO_FRINGE_BITMAP): Renamed from NO_BITMAP.
(w32_draw_fringe_bitmap): Renamed from w32_draw_bitmap.
(x_draw_row_fringe_bitmaps): Renamed from x_draw_row_bitmaps.
- * w32term.h: Comment fixes. Use renamed symbols.
+ * w32term.h: Comment fixes. Use renamed symbols.
(fringes_extra): Renamed from flags_areas_extra.
(FRAME_FRINGE_BITMAP_WIDTH): Renamed from FRAME_FLAGS_BITMAP_WIDTH.
(FRAME_FRINGE_BITMAP_HEIGHT): Renamed from FRAME_FLAGS_BITMAP_HEIGHT.
@@ -12143,22 +13274,22 @@
* widget.c: Use renamed symbols.
- * window.c: Comment fixes. Use renamed symbols.
+ * window.c: Comment fixes. Use renamed symbols.
(coordinates-in-window-p): Doc fix.
- * xdisp.c: Comment fixes. Use renamed symbols.
+ * xdisp.c: Comment fixes. Use renamed symbols.
* xfaces.c (realize_basic_faces): Use FRINGE_FACE_ID.
* xfns.c: Use renamed symbols.
- * xterm.c: Comment fixes. Use renamed symbols.
+ * xterm.c: Comment fixes. Use renamed symbols.
(fringe_bitmap_type): Renamed from bitmap_type.
(NO_FRINGE_BITMAP): Renamed from NO_BITMAP.
(x_draw_fringe_bitmap): Renamed from x_draw_bitmap.
(x_draw_row_fringe_bitmaps): Renamed from x_draw_row_bitmaps.
- * xterm.h: Comment fixes. Use renamed symbols.
+ * xterm.h: Comment fixes. Use renamed symbols.
(fringes_extra): Renamed from flags_areas_extra.
(FRAME_FRINGE_BITMAP_WIDTH): Renamed from FRAME_FLAGS_BITMAP_WIDTH.
(FRAME_FRINGE_BITMAP_HEIGHT): Renamed from FRAME_FLAGS_BITMAP_HEIGHT.
@@ -12276,8 +13407,8 @@
2001-11-12 Jason Rumney <jasonr@gnu.org>
* w32console.c, w32fns.c, w32menu.c, w32proc.c, w32select.c,
- * w32term.c: Change doc-string comments to `new style'.
- [w/`doc:' keyword]. Doc fixes.
+ * w32term.c: Change doc-string comments to `new style'
+ [w/`doc:' keyword]. Doc fixes.
* w32fns.c: Don't define max.
(Fx_open_connection): Only execute once.
@@ -12312,7 +13443,7 @@
2001-11-10 Jason Rumney <jasonr@gnu.org>
* w32fns.c (enum_font_cb2): Use leading @ on face name to detect
- vertical fonts. Allow them if face name is explicitly specified.
+ vertical fonts. Allow them if face name is explicitly specified.
Do not give up if we find a font that cannot be converted to an xlfd.
2001-11-10 Gerd Moellmann <gerd@gnu.org>
@@ -12739,7 +13870,7 @@
2001-10-28 Pavel Jan,Am(Bk <Pavel@Janik.cz>
- * emacs.c: Use argv[0] instead of emacs when -t was specified.
+ * emacs.c: Use argv[0] instead of "emacs" when -t was specified.
* keyboard.c: Change doc-string comments to `new style' [w/`doc:'
keyword].
@@ -13122,7 +14253,7 @@
full-width rows.
(x_dump_glyph_string): Put in #if GLYPH_DEBUG.
(w32_draw_relief_rect): Extend left shadow to the bottom and left;
- change bottom shadow accordingly. Some cleanup.
+ change bottom shadow accordingly. Some cleanup.
(x_update_window_end): Handle overwritten mouse face
also for tool bar windows.
(show_mouse_face): Set the glyph row's mouse_face_p flag also when
@@ -13168,7 +14299,7 @@
(Fv_max_tooltip_size): New variable.
(syns_of_xfns): DEFVAR_LISP it.
(Fx_show_tip): Add parameter TEXT. Set the tip frame's root
- window buffer to *tip* right after creating the frame. Set frame's
+ window buffer to *tip* right after creating the frame. Set frame's
window_width. Use a maximum tooltip size specified by
Vx_max_tooltip_size, if that has valid contents.
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
diff --git a/src/abbrev.c b/src/abbrev.c
index 54ea8f1128e..086a58021fb 100644
--- a/src/abbrev.c
+++ b/src/abbrev.c
@@ -1,5 +1,5 @@
/* Primitives for word-abbrev mode.
- Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001
+ Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/alloc.c b/src/alloc.c
index e427c1f5676..ea7886dd4dc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -155,6 +155,7 @@ int malloc_sbrk_unused;
EMACS_INT undo_limit;
EMACS_INT undo_strong_limit;
+EMACS_INT undo_outer_limit;
/* Number of live and free conses etc. */
@@ -256,6 +257,7 @@ EMACS_INT gcs_done; /* accumulated GCs */
static void mark_buffer P_ ((Lisp_Object));
extern void mark_kboards P_ ((void));
+extern void mark_backtrace P_ ((void));
static void gc_sweep P_ ((void));
static void mark_glyph_matrix P_ ((struct glyph_matrix *));
static void mark_face_cache P_ ((struct face_cache *));
@@ -753,17 +755,20 @@ lisp_align_malloc (nbytes, type)
#ifdef HAVE_POSIX_MEMALIGN
{
int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES);
- abase = err ? (base = NULL) : base;
+ if (err)
+ base = NULL;
+ abase = base;
}
#else
base = malloc (ABLOCKS_BYTES);
abase = ALIGN (base, BLOCK_ALIGN);
+#endif
+
if (base == 0)
{
UNBLOCK_INPUT;
memory_full ();
}
-#endif
aligned = (base == abase);
if (!aligned)
@@ -844,7 +849,7 @@ lisp_align_free (block)
free_ablock = ablock;
/* Update busy count. */
ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase));
-
+
if (2 > (long) ABLOCKS_BUSY (abase))
{ /* All the blocks are free. */
int i = 0, aligned = (long) ABLOCKS_BUSY (abase);
@@ -1893,8 +1898,9 @@ compact_small_strings ()
DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
- doc: /* Return a newly created string of length LENGTH, with each element being INIT.
-Both LENGTH and INIT must be numbers. */)
+ doc: /* Return a newly created string of length LENGTH, with INIT in each element.
+LENGTH must be an integer.
+INIT must be an integer that represents a character. */)
(length, init)
Lisp_Object length, init;
{
@@ -1949,10 +1955,11 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
CHECK_NATNUM (length);
- bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR;
+ bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR;
length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value;
- length_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1) / BITS_PER_CHAR);
+ length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
/* We must allocate one more elements than LENGTH_IN_ELTS for the
slot `size' of the struct Lisp_Bool_Vector. */
@@ -1969,9 +1976,9 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
p->data[i] = real_init;
/* Clear the extraneous bits in the last byte. */
- if (XINT (length) != length_in_chars * BITS_PER_CHAR)
+ if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
XBOOL_VECTOR (val)->data[length_in_chars - 1]
- &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1;
+ &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
return val;
}
@@ -2333,7 +2340,6 @@ free_cons (ptr)
cons_free_list = ptr;
}
-
DEFUN ("cons", Fcons, Scons, 2, 2, 0,
doc: /* Create a new cons, give it CAR and CDR as components, and return it. */)
(car, cdr)
@@ -4233,18 +4239,6 @@ struct catchtag
struct catchtag *next;
};
-struct backtrace
-{
- struct backtrace *next;
- Lisp_Object *function;
- Lisp_Object *args; /* Points to vector of args. */
- int nargs; /* Length of vector. */
- /* If nargs is UNEVALLED, args points to slot holding list of
- unevalled args. */
- char evalargs;
-};
-
-
/***********************************************************************
Protection from GC
@@ -4279,7 +4273,6 @@ returns nil, because real GC can't be done. */)
register struct specbinding *bind;
struct catchtag *catch;
struct handler *handler;
- register struct backtrace *backlist;
char stack_top_variable;
register int i;
int message_p;
@@ -4348,7 +4341,7 @@ returns nil, because real GC can't be done. */)
if (! EQ (nextb->undo_list, Qt))
nextb->undo_list
= truncate_undo_list (nextb->undo_list, undo_limit,
- undo_strong_limit);
+ undo_strong_limit, undo_outer_limit);
/* Shrink buffer gaps, but skip indirect and dead buffers. */
if (nextb->base_buffer == 0 && !NILP (nextb->name))
@@ -4408,20 +4401,23 @@ returns nil, because real GC can't be done. */)
mark_object (handler->handler);
mark_object (handler->var);
}
- for (backlist = backtrace_list; backlist; backlist = backlist->next)
- {
- mark_object (*backlist->function);
-
- if (backlist->nargs == UNEVALLED || backlist->nargs == MANY)
- i = 0;
- else
- i = backlist->nargs - 1;
- for (; i >= 0; i--)
- mark_object (backlist->args[i]);
- }
+ mark_backtrace ();
mark_kboards ();
- /* Look thru every buffer's undo list
+#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
+ mark_stack ();
+#endif
+
+#ifdef USE_GTK
+ {
+ extern void xg_mark_data ();
+ xg_mark_data ();
+ }
+#endif
+
+ /* Everything is now marked, except for the things that require special
+ finalization, i.e. the undo_list.
+ Look thru every buffer's undo list
for elements that update markers that were not marked,
and delete them. */
{
@@ -4459,22 +4455,14 @@ returns nil, because real GC can't be done. */)
}
}
}
+ /* Now that we have stripped the elements that need not be in the
+ undo_list any more, we can finally mark the list. */
+ mark_object (nextb->undo_list);
nextb = nextb->next;
}
}
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
- mark_stack ();
-#endif
-
-#ifdef USE_GTK
- {
- extern void xg_mark_data ();
- xg_mark_data ();
- }
-#endif
-
gc_sweep ();
/* Clear the mark bits that we set in certain root slots. */
@@ -5043,41 +5031,9 @@ mark_buffer (buf)
MARK_INTERVAL_TREE (BUF_INTERVALS (buffer));
- if (CONSP (buffer->undo_list))
- {
- Lisp_Object tail;
- tail = buffer->undo_list;
-
- /* We mark the undo list specially because
- its pointers to markers should be weak. */
-
- while (CONSP (tail))
- {
- register struct Lisp_Cons *ptr = XCONS (tail);
-
- if (CONS_MARKED_P (ptr))
- break;
- CONS_MARK (ptr);
- if (GC_CONSP (ptr->car)
- && !CONS_MARKED_P (XCONS (ptr->car))
- && GC_MARKERP (XCAR (ptr->car)))
- {
- CONS_MARK (XCONS (ptr->car));
- mark_object (XCDR (ptr->car));
- }
- else
- mark_object (ptr->car);
-
- if (CONSP (ptr->cdr))
- tail = ptr->cdr;
- else
- break;
- }
-
- mark_object (XCDR (tail));
- }
- else
- mark_object (buffer->undo_list);
+ /* For now, we just don't mark the undo_list. It's done later in
+ a special way just before the sweep phase, and after stripping
+ some of its elements that are not needed any more. */
if (buffer->overlays_before)
{
@@ -5671,12 +5627,20 @@ which includes both saved text and other data. */);
DEFVAR_INT ("undo-strong-limit", &undo_strong_limit,
doc: /* Don't keep more than this much size of undo information.
-A command which pushes past this size is itself forgotten.
-This limit is applied when garbage collection happens.
+A previous command which pushes the undo list past this size
+is entirely forgotten when GC happens.
The size is counted as the number of bytes occupied,
which includes both saved text and other data. */);
undo_strong_limit = 30000;
+ DEFVAR_INT ("undo-outer-limit", &undo_outer_limit,
+ doc: /* Don't keep more than this much size of undo information.
+If the current command has produced more than this much undo information,
+GC discards it. This is a last-ditch limit to prevent memory overflow.
+The size is counted as the number of bytes occupied,
+which includes both saved text and other data. */);
+ undo_outer_limit = 300000;
+
DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
doc: /* Non-nil means display messages at start and end of garbage collection. */);
garbage_collection_messages = 0;
diff --git a/src/atimer.c b/src/atimer.c
index 2ddc7427f56..7e78bdad9c0 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -1,5 +1,5 @@
/* Asynchronous timers.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/atimer.h b/src/atimer.h
index 3ecc97e5511..f987a47a6bd 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -1,5 +1,5 @@
/* Asynchronous timers.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/blockinput.h b/src/blockinput.h
index eba192c9863..a4c8a9b9c22 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -1,5 +1,5 @@
/* blockinput.h - interface to blocking complicated interrupt-driven input.
- Copyright (C) 1989, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1993, 2004 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -97,6 +97,9 @@ extern int pending_atimers;
#define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0)
#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
+/* In critical section ? */
+#define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
+
/* Defined in keyboard.c */
/* Don't use a prototype here; it causes trouble in some files. */
extern void reinvoke_input_signal ();
diff --git a/src/buffer.c b/src/buffer.c
index 4c7e709adb5..bd4e061b05f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -488,7 +488,7 @@ static void
clone_per_buffer_values (from, to)
struct buffer *from, *to;
{
- Lisp_Object to_buffer;
+ Lisp_Object to_buffer, tem;
int offset;
XSETBUFFER (to_buffer, to);
@@ -515,6 +515,14 @@ clone_per_buffer_values (from, to)
to->overlays_before = copy_overlays (to, from->overlays_before);
to->overlays_after = copy_overlays (to, from->overlays_after);
+
+ /* Copy the alist of local variables,
+ and all the alist elements too. */
+ to->local_var_alist
+ = Fcopy_sequence (from->local_var_alist);
+ for (tem = to->local_var_alist; CONSP (tem);
+ tem = XCDR (tem))
+ XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem))));
}
@@ -833,7 +841,8 @@ No argument or nil as argument means use the current buffer. */)
DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
0, 1, 0,
doc: /* Return the base buffer of indirect buffer BUFFER.
-If BUFFER is not indirect, return nil. */)
+If BUFFER is not indirect, return nil.
+BUFFER defaults to the current buffer. */)
(buffer)
register Lisp_Object buffer;
{
@@ -1683,7 +1692,7 @@ DEFUN ("pop-to-buffer", Fpop_to_buffer, Spop_to_buffer, 1, 3, 0,
doc: /* Select buffer BUFFER in some window, preferably a different one.
If BUFFER is nil, then some other buffer is chosen.
If `pop-up-windows' is non-nil, windows can be split to do this.
-If optional second arg OTHER-WINDOW is nil, insist on finding another
+If optional second arg OTHER-WINDOW is non-nil, insist on finding another
window even if BUFFER is already visible in the selected window,
and ignore `same-window-regexps' and `same-window-buffer-names'.
This uses the function `display-buffer' as a subroutine; see the documentation
@@ -2145,7 +2154,7 @@ current buffer is cleared. */)
GPT = GPT_BYTE;
TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE);
-
+
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
tail->charpos = tail->bytepos;
@@ -3354,7 +3363,7 @@ fix_start_end_in_overlays (start, end)
if (endpos < start)
break;
-
+
if (endpos < end
|| (startpos >= start && startpos < end))
{
@@ -3397,7 +3406,7 @@ fix_start_end_in_overlays (start, end)
{
startpos = endpos;
Fset_marker (OVERLAY_START (overlay), make_number (startpos),
- Qnil);
+ Qnil);
}
if (startpos >= end)
@@ -4208,7 +4217,7 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
add_overlay_mod_hooklist (prop, overlay);
}
}
-
+
for (tail = current_buffer->overlays_after; tail; tail = tail->next)
{
int startpos, endpos;
@@ -5444,7 +5453,7 @@ nil here means use current buffer's major mode. */);
DEFVAR_PER_BUFFER ("fill-column", &current_buffer->fill_column,
make_number (Lisp_Int),
doc: /* *Column beyond which automatic line-wrapping should happen.
-Interactively, you can set this using \\[set-fill-column]. */);
+Interactively, you can set the buffer local value using \\[set-fill-column]. */);
DEFVAR_PER_BUFFER ("left-margin", &current_buffer->left_margin,
make_number (Lisp_Int),
@@ -5854,7 +5863,11 @@ If the buffer has never been shown in a window, the value is nil. */);
doc: /* *Non-nil means deactivate the mark when the buffer contents change.
Non-nil also enables highlighting of the region whenever the mark is active.
The variable `highlight-nonselected-windows' controls whether to highlight
-all windows or just the selected window. */);
+all windows or just the selected window.
+
+If the value is `lambda', that enables Transient Mark mode temporarily
+until the next buffer modification. If a command sets the value to `only',
+that enables Transient Mark mode for the following command only. */);
Vtransient_mark_mode = Qnil;
DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only,
@@ -5871,9 +5884,13 @@ Values are interpreted as follows:
t use the cursor specified for the frame
nil don't display a cursor
- bar display a bar cursor with default width
- (bar . WIDTH) display a bar cursor with width WIDTH
- ANYTHING ELSE display a box cursor.
+ box display a filled box cursor
+ hollow display a hollow box cursor
+ bar display a vertical bar cursor with default width
+ (bar . WIDTH) display a vertical bar cursor with width WIDTH
+ hbar display a horisontal bar cursor with default width
+ (hbar . WIDTH) display a horisontal bar cursor with width WIDTH
+ ANYTHING ELSE display a hollow box cursor.
When the buffer is displayed in a nonselected window,
this variable has no effect; the cursor appears as a hollow box. */);
@@ -5881,7 +5898,9 @@ this variable has no effect; the cursor appears as a hollow box. */);
DEFVAR_PER_BUFFER ("line-spacing",
&current_buffer->extra_line_spacing, Qnil,
doc: /* Additional space to put between lines when displaying a buffer.
-The space is measured in pixels, and put below lines on window systems. */);
+The space is measured in pixels, and put below lines on window systems.
+If value is a floating point number, it specifies the spacing relative
+to the default frame line height. */);
DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions,
doc: /* List of functions called with no args to query before killing a buffer. */);
diff --git a/src/buffer.h b/src/buffer.h
index 0755db25f9f..47f00560824 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,5 +1,5 @@
/* Header file for the buffer manipulation primitives.
- Copyright (C) 1985, 86, 93, 94, 95, 97, 1998, 1999, 2000, 01, 2003
+ Copyright (C) 1985,86,93,94,95,97,98,99,2000,01,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -827,6 +827,25 @@ extern void buffer_slot_type_mismatch P_ ((int));
extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
extern void mmap_set_vars P_ ((int));
+/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
+ If NEXTP is non-NULL, return next overlay there.
+ See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */
+
+#define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \
+ do { \
+ int maxlen = 40; \
+ overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+ noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
+ nextp, NULL, chrq); \
+ if (noverlays > maxlen) \
+ { \
+ maxlen = noverlays; \
+ overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+ noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
+ nextp, NULL, chrq); \
+ } \
+ } while (0)
+
EXFUN (Fbuffer_live_p, 1);
EXFUN (Fbuffer_name, 1);
EXFUN (Fget_file_buffer, 1);
diff --git a/src/callint.c b/src/callint.c
index 50090db8b28..a3e4984fd16 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -612,7 +612,7 @@ supply if the command inquires which events were used to invoke it. */)
Qnil, Qnil, Qnil, Qnil);
unbind_to (speccount1, Qnil);
teml = args[i];
- visargs[i] = Fkey_description (teml);
+ visargs[i] = Fkey_description (teml, Qnil);
/* If the key sequence ends with a down-event,
discard the following up-event. */
@@ -639,7 +639,7 @@ supply if the command inquires which events were used to invoke it. */)
args[i] = Fread_key_sequence (build_string (callint_message),
Qnil, Qt, Qnil, Qnil);
teml = args[i];
- visargs[i] = Fkey_description (teml);
+ visargs[i] = Fkey_description (teml, Qnil);
unbind_to (speccount1, Qnil);
/* If the key sequence ends with a down-event,
diff --git a/src/callproc.c b/src/callproc.c
index 2b610d53a1d..7632d491944 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,5 +1,5 @@
/* Synchronous subprocess invocation for GNU Emacs.
- Copyright (C) 1985,86,87,88,93,94,95,99, 2000, 2001
+ Copyright (C) 1985,86,87,88,93,94,95,99, 2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -222,7 +222,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
register int pid;
char buf[16384];
char *bufptr = buf;
- int bufsize = 16384;
+ int bufsize = sizeof buf;
int count = SPECPDL_INDEX ();
register const unsigned char **new_argv
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 341e3b313a3..4b38e441cf3 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -1,5 +1,6 @@
/* GNU Emacs case conversion functions.
- Copyright (C) 1985, 1994, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -53,11 +54,19 @@ casify_object (flag, obj)
int flags = XINT (obj) & flagbits;
int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
+ /* If the character has higher bits set
+ above the flags, return it unchanged.
+ It is not a real character. */
+ if ((unsigned) XFASTINT (obj) > (unsigned) flagbits)
+ return obj;
+
c1 = XFASTINT (obj) & ~flagbits;
if (! multibyte)
MAKE_CHAR_MULTIBYTE (c1);
c = DOWNCASE (c1);
- if (inword || c == c1)
+ if (inword)
+ XSETFASTINT (obj, c | flags);
+ else if (c == (XFASTINT (obj) & ~flagbits))
{
if (! inword)
c = UPCASE1 (c1);
diff --git a/src/ccl.c b/src/ccl.c
index 5eac485bf2c..71a08fdf7c7 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -634,14 +634,17 @@ do \
{ \
ccl_prog = ccl_prog_stack_struct[0].ccl_prog; \
ic = ccl_prog_stack_struct[0].ic; \
+ eof_ic = ccl_prog_stack_struct[0].eof_ic; \
} \
CCL_INVALID_CMD; \
} \
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog; \
ccl_prog_stack_struct[stack_idx].ic = (ret_ic); \
+ ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; \
stack_idx++; \
ccl_prog = called_ccl.prog; \
ic = CCL_HEADER_MAIN; \
+ eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); \
goto ccl_repeat; \
} \
while (0)
@@ -718,14 +721,29 @@ while (0)
/* Terminate CCL program because of invalid command. Should not occur
in the normal case. */
+#ifndef CCL_DEBUG
+
+#define CCL_INVALID_CMD \
+do \
+ { \
+ ccl->status = CCL_STAT_INVALID_CMD; \
+ goto ccl_error_handler; \
+ } \
+while(0)
+
+#else
+
#define CCL_INVALID_CMD \
do \
{ \
+ ccl_debug_hook (this_ic); \
ccl->status = CCL_STAT_INVALID_CMD; \
goto ccl_error_handler; \
} \
while(0)
+#endif
+
/* Encode one character CH to multibyte form and write to the current
output buffer. If CH is less than 256, CH is written as is. */
#define CCL_WRITE_CHAR(ch) \
@@ -762,6 +780,7 @@ while(0)
r = *src++; \
else if (ccl->last_block) \
{ \
+ r = -1; \
ic = ccl->eof_ic; \
goto ccl_repeat; \
} \
@@ -807,12 +826,20 @@ while(0)
#define CCL_DEBUG_BACKTRACE_LEN 256
int ccl_backtrace_table[CCL_DEBUG_BACKTRACE_LEN];
int ccl_backtrace_idx;
+
+int
+ccl_debug_hook (int ic)
+{
+ return ic;
+}
+
#endif
struct ccl_prog_stack
{
Lisp_Object *ccl_prog; /* Pointer to an array of CCL code. */
int ic; /* Instruction Counter. */
+ int eof_ic; /* Instruction Counter to jump on EOF. */
};
/* For the moment, we only support depth 256 of stack. */
@@ -837,8 +864,10 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
/* Instruction counter of the current CCL code. */
int this_ic = 0;
struct charset *charset;
+ int eof_ic = ccl->eof_ic;
+ int eof_hit = 0;
- if (ic >= ccl->eof_ic)
+ if (ic >= eof_ic)
ic = CCL_HEADER_MAIN;
if (ccl->buf_magnification == 0) /* We can't read/produce any bytes. */
@@ -1042,15 +1071,18 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
{
ccl_prog = ccl_prog_stack_struct[0].ccl_prog;
ic = ccl_prog_stack_struct[0].ic;
+ eof_ic = ccl_prog_stack_struct[0].eof_ic;
}
CCL_INVALID_CMD;
}
ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
ccl_prog_stack_struct[stack_idx].ic = ic;
+ ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic;
stack_idx++;
ccl_prog = XVECTOR (AREF (slot, 1))->contents;
ic = CCL_HEADER_MAIN;
+ eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]);
}
break;
@@ -1080,6 +1112,9 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
stack_idx--;
ccl_prog = ccl_prog_stack_struct[stack_idx].ccl_prog;
ic = ccl_prog_stack_struct[stack_idx].ic;
+ eof_ic = ccl_prog_stack_struct[stack_idx].eof_ic;
+ if (eof_hit)
+ ic = eof_ic;
break;
}
if (src)
diff --git a/src/charset.c b/src/charset.c
index a4967c65a9a..97f1c701cf8 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,8 +1,8 @@
/* Basic character set support.
Copyright (C) 1995, 97, 98, 2000, 2001 Electrotechnical Laboratory, JAPAN.
Licensed to the Free Software Foundation.
- Copyright (C) 2001 Free Software Foundation, Inc.
- Copyright (C) 2003
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
@@ -1267,7 +1267,7 @@ Optional third argument DEUNIFY, if non-nil, means to de-unify CHARSET. */)
DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char,
Sget_unused_iso_final_char, 2, 2, 0,
doc: /*
-Return an unsed ISO final char for a charset of DIMENISION and CHARS.
+Return an unused ISO final char for a charset of DIMENISION and CHARS.
DIMENSION is the number of bytes to represent a character: 1 or 2.
CHARS is the number of characters in a dimension: 94 or 96.
@@ -1873,7 +1873,7 @@ CHAR in the charset. */)
DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0,
- doc: /* Return the charset of highest priority that contains CHAR. */)
+ doc: /* Return the charset of highest priority that contains CH. */)
(ch)
Lisp_Object ch;
{
diff --git a/src/data.c b/src/data.c
index 92e1c75dee4..935c4348bb7 100644
--- a/src/data.c
+++ b/src/data.c
@@ -761,6 +761,19 @@ function with `&rest' args, or `unevalled' for a special form. */)
return Fcons (make_number (minargs), make_number (maxargs));
}
+DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0,
+ doc: /* Return name of subroutine SUBR.
+SUBR must be a built-in function. */)
+ (subr)
+ Lisp_Object subr;
+{
+ const char *name;
+ if (!SUBRP (subr))
+ wrong_type_argument (Qsubrp, subr);
+ name = XSUBR (subr)->symbol_name;
+ return make_string (name, strlen (name));
+}
+
DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
doc: /* Return the interactive form of CMD or nil if none.
CMD must be a command. Value, if non-nil, is a list
@@ -1394,7 +1407,7 @@ local bindings in certain buffers. */)
}
DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
- doc: /* Set SYMBOL's default value to VAL. SYMBOL and VAL are evaluated.
+ doc: /* Set SYMBOL's default value to VALUE. SYMBOL and VALUE are evaluated.
The default value is seen in buffers that do not have their own values
for this variable. */)
(symbol, value)
@@ -1455,11 +1468,11 @@ The default value of a variable is seen in buffers
that do not have their own values for the variable.
More generally, you can use multiple variables and values, as in
- (setq-default SYMBOL VALUE SYMBOL VALUE...)
-This sets each SYMBOL's default value to the corresponding VALUE.
-The VALUE for the Nth SYMBOL can refer to the new default values
-of previous SYMs.
-usage: (setq-default SYMBOL VALUE [SYMBOL VALUE...]) */)
+ (setq-default VAR VALUE VAR VALUE...)
+This sets each VAR's default value to the corresponding VALUE.
+The VALUE for the Nth VAR can refer to the new default values
+of previous VARs.
+usage: (setq-default VAR VALUE [VAR VALUE...]) */)
(args)
Lisp_Object args;
{
@@ -1946,8 +1959,8 @@ or a byte-code object. IDX starts at 0. */)
if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
args_out_of_range (array, idx);
- val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR];
- return (val & (1 << (idxval % BITS_PER_CHAR)) ? Qt : Qnil);
+ val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR];
+ return (val & (1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR)) ? Qt : Qnil);
}
else if (CHAR_TABLE_P (array))
{
@@ -2005,13 +2018,13 @@ bool-vector. IDX starts at 0. */)
if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
args_out_of_range (array, idx);
- val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR];
+ val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR];
if (! NILP (newelt))
- val |= 1 << (idxval % BITS_PER_CHAR);
+ val |= 1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR);
else
- val &= ~(1 << (idxval % BITS_PER_CHAR));
- XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR] = val;
+ val &= ~(1 << (idxval % BOOL_VECTOR_BITS_PER_CHAR));
+ XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR] = val;
}
else if (CHAR_TABLE_P (array))
{
@@ -2581,6 +2594,10 @@ usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */)
int nargs;
Lisp_Object *args;
{
+ int argnum;
+ for (argnum = 2; argnum < nargs; argnum++)
+ if (FLOATP (args[argnum]))
+ return float_arith_driver (0, 0, Adiv, nargs, args);
return arith_driver (Adiv, nargs, args);
}
@@ -3215,6 +3232,7 @@ syms_of_data ()
defsubr (&Slognot);
defsubr (&Sbyteorder);
defsubr (&Ssubr_arity);
+ defsubr (&Ssubr_name);
XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;
diff --git a/src/dispextern.h b/src/dispextern.h
index f2cd03e968a..11395cb7f00 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1,5 +1,5 @@
/* Interface definitions for display code.
- Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -274,6 +274,17 @@ enum glyph_type
};
+/* Structure describing how to use partial glyphs (images slicing) */
+
+struct glyph_slice
+{
+ unsigned x : 16;
+ unsigned y : 16;
+ unsigned width : 16;
+ unsigned height : 16;
+};
+
+
/* Glyphs.
Be extra careful when changing this structure! Esp. make sure that
@@ -352,6 +363,8 @@ struct glyph
w32_char_font_type. Otherwise it equals FONT_TYPE_UNKNOWN. */
unsigned font_type : 3;
+ struct glyph_slice slice;
+
/* A union of sub-structures for different glyph types. */
union
{
@@ -390,11 +403,20 @@ struct glyph
#define CHAR_GLYPH_SPACE_P(GLYPH) \
(GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH)
+/* Are glyph slices of glyphs *X and *Y equal */
+
+#define GLYPH_SLICE_EQUAL_P(X, Y) \
+ ((X)->slice.x == (Y)->slice.x \
+ && (X)->slice.y == (Y)->slice.y \
+ && (X)->slice.width == (Y)->slice.width \
+ && (X)->slice.height == (Y)->slice.height)
+
/* Are glyphs *X and *Y displayed equal? */
#define GLYPH_EQUAL_P(X, Y) \
((X)->type == (Y)->type \
&& (X)->u.val == (Y)->u.val \
+ && GLYPH_SLICE_EQUAL_P (X, Y) \
&& (X)->face_id == (Y)->face_id \
&& (X)->padding_p == (Y)->padding_p \
&& (X)->left_box_line_p == (Y)->left_box_line_p \
@@ -1143,6 +1165,9 @@ struct glyph_string
/* Image, if any. */
struct image *img;
+ /* Slice */
+ struct glyph_slice slice;
+
struct glyph_string *next, *prev;
};
@@ -1604,7 +1629,7 @@ extern int face_change_count;
width and height of the bitmap, DH is the height adjustment (if
bitmap is periodic). X and Y are frame coordinates of the area to
display the bitmap, DY is relative offset of the bitmap into that
- area. BX, NX, BY, NY specifies the area to clear if the bitmap
+ area. BX, NX, BY, NY specifies the area to clear if the bitmap
does not fill the entire area. FACE is the fringe face. */
struct draw_fringe_bitmap_params
@@ -1716,6 +1741,15 @@ enum prop_idx
};
+struct it_slice
+{
+ Lisp_Object x;
+ Lisp_Object y;
+ Lisp_Object width;
+ Lisp_Object height;
+};
+
+
struct it
{
/* The window in which we iterate over current_buffer (or a string). */
@@ -1828,6 +1862,7 @@ struct it
unsigned multibyte_p : 1;
unsigned string_from_display_prop_p : 1;
unsigned display_ellipsis_p : 1;
+ struct it_slice slice;
Lisp_Object space_width;
short voffset;
Lisp_Object font_height;
@@ -1882,6 +1917,10 @@ struct it
skipped due to selective display. */
unsigned face_before_selective_p : 1;
+ /* If 1, adjust current glyph so it does not increase current row
+ descent/ascent (line-height property). Reset after this glyph. */
+ unsigned constrain_row_ascent_descent_p : 1;
+
/* The ID of the default face to use. One of DEFAULT_FACE_ID,
MODE_LINE_FACE_ID, etc, depending on what we are displaying. */
int base_face_id;
@@ -1907,6 +1946,9 @@ struct it
/* If what == IT_IMAGE, the id of the image to display. */
int image_id;
+ /* Values from `slice' property. */
+ struct it_slice slice;
+
/* Value of the `space-width' property, if any; nil if none. */
Lisp_Object space_width;
@@ -1945,6 +1987,10 @@ struct it
only.) */
int extra_line_spacing;
+ /* Override font height information for this glyph.
+ Used if override_ascent >= 0. Cleared after this glyph. */
+ int override_ascent, override_descent, override_boff;
+
/* If non-null, glyphs are produced in glyph_row with each call to
produce_glyphs. */
struct glyph_row *glyph_row;
@@ -2176,7 +2222,7 @@ struct redisplay_interface
struct charset *charset,
int *two_byte_p));
-/* Compute left and right overhang of glyph string S.
+/* Compute left and right overhang of glyph string S.
A NULL pointer if platform does not support this. */
void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s));
@@ -2204,7 +2250,7 @@ struct redisplay_interface
void (*draw_vertical_window_border) P_ ((struct window *w,
int x, int y0, int y1));
-/* Shift display of frame F to make room for inserted glyphs.
+/* Shift display of frame F to make room for inserted glyphs.
The area at pixel (X,Y) of width WIDTH and height HEIGHT is
shifted right by SHIFT_BY pixels. */
void (*shift_glyphs_for_insert) P_ ((struct frame *f,
@@ -2518,12 +2564,11 @@ extern Lisp_Object Qtool_bar;
extern Lisp_Object Vshow_trailing_whitespace;
extern int mode_line_in_non_selected_windows;
extern int redisplaying_p;
-extern Lisp_Object Vimage_types;
extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object));
extern int help_echo_showing_p;
extern int current_mode_line_height, current_header_line_height;
extern Lisp_Object help_echo_string, help_echo_window;
-extern Lisp_Object help_echo_object, previous_help_echo_string;
+extern Lisp_Object help_echo_object, previous_help_echo_string;
extern int help_echo_pos;
extern struct frame *last_mouse_frame;
extern int last_tool_bar_item;
@@ -2633,6 +2678,8 @@ unsigned long image_background P_ ((struct image *, struct frame *,
int image_background_transparent P_ ((struct image *, struct frame *,
XImagePtr_or_DC mask));
+int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *));
+
#endif
/* Defined in sysdep.c */
@@ -2741,7 +2788,7 @@ extern int required_matrix_height P_ ((struct window *));
extern Lisp_Object buffer_posn_from_coords P_ ((struct window *,
int *, int *,
struct display_pos *,
- Lisp_Object *,
+ Lisp_Object *,
int *, int *, int *, int *));
extern Lisp_Object mode_line_string P_ ((struct window *, enum window_part,
int *, int *, int *,
diff --git a/src/dispnew.c b/src/dispnew.c
index f06a54164d6..8edc8993a05 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5716,6 +5716,9 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
struct text_pos startp;
Lisp_Object string;
struct glyph_row *row;
+#ifdef HAVE_WINDOW_SYSTEM
+ struct image *img = 0;
+#endif
int x0, x1;
current_buffer = XBUFFER (w->buffer);
@@ -5741,7 +5744,6 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
#ifdef HAVE_WINDOW_SYSTEM
if (it.what == IT_IMAGE)
{
- struct image *img;
if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL
&& !NILP (img->spec))
*object = img->spec;
@@ -5754,12 +5756,22 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
if (it.hpos < row->used[TEXT_AREA])
{
struct glyph *glyph = row->glyphs[TEXT_AREA] + it.hpos;
- *width = glyph->pixel_width;
- *height = glyph->ascent + glyph->descent;
#ifdef HAVE_WINDOW_SYSTEM
- if (glyph->type == IMAGE_GLYPH)
- *dy -= row->ascent - glyph->ascent;
+ if (img)
+ {
+ *dy -= row->ascent - glyph->ascent;
+ *dx += glyph->slice.x;
+ *dy += glyph->slice.y;
+ /* Image slices positions are still relative to the entire image */
+ *width = img->width;
+ *height = img->height;
+ }
+ else
#endif
+ {
+ *width = glyph->pixel_width;
+ *height = glyph->ascent + glyph->descent;
+ }
}
else
{
@@ -5925,6 +5937,8 @@ marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
if (img != NULL)
*object = img->spec;
y0 -= row->ascent - glyph->ascent;
+ x0 += glyph->slice.x;
+ y0 += glyph->slice.y;
}
#endif
}
diff --git a/src/doc.c b/src/doc.c
index e670ad1797a..2e66c5cea46 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -808,7 +808,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
}
else
{ /* function is on a key */
- tem = Fkey_description (tem);
+ tem = Fkey_description (tem, Qnil);
goto subst_string;
}
}
diff --git a/src/editfns.c b/src/editfns.c
index e7a01b24b76..130dffa77de 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -73,7 +73,7 @@ static int tm_diff P_ ((struct tm *, struct tm *));
static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
static void update_buffer_properties P_ ((int, int));
static Lisp_Object region_limit P_ ((int));
-static int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
+int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
static size_t emacs_memftimeu P_ ((char *, size_t, const char *,
size_t, const struct tm *, int));
static void general_insert_function P_ ((void (*) (const unsigned char *, int),
@@ -1213,7 +1213,7 @@ If POS is out of range, the value is nil. */)
DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 1, 0,
doc: /* Return the name under which the user logged in, as a string.
This is based on the effective uid, not the real uid.
-Also, if the environment variable LOGNAME or USER is set,
+Also, if the environment variables LOGNAME or USER are set,
that determines the value of this function.
If optional argument UID is an integer, return the login name of the user
@@ -1372,7 +1372,7 @@ resolution finer than a second. */)
}
-static int
+int
lisp_time_argument (specified_time, result, usec)
Lisp_Object specified_time;
time_t *result;
@@ -1425,7 +1425,7 @@ lisp_time_argument (specified_time, result, usec)
DEFUN ("float-time", Ffloat_time, Sfloat_time, 0, 1, 0,
doc: /* Return the current time, as a float number of seconds since the epoch.
-If an argument is given, it specifies a time to convert to float
+If SPECIFIED-TIME is given, it is the time to convert to float
instead of the current time. The argument should have the forms:
(HIGH . LOW) or (HIGH LOW USEC) or (HIGH LOW . USEC).
Thus, you can use times obtained from `current-time'
@@ -1655,7 +1655,7 @@ are used as SECOND through YEAR, and the *last* argument is used as ZONE.
The intervening arguments are ignored.
This feature lets (apply 'encode-time (decode-time ...)) work.
-Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed;
+Out-of-range values for SECOND, MINUTE, HOUR, DAY, or MONTH are allowed;
for example, a DAY of 0 means the day preceding the given month.
Year numbers less than 100 are treated just like other year numbers.
If you want them to stand for years in this century, you must do that yourself.
@@ -1740,8 +1740,8 @@ The format is `Sun Sep 16 01:03:52 1973'.
However, see also the functions `decode-time' and `format-time-string'
which provide a much more powerful and general facility.
-If an argument is given, it specifies a time to format
-instead of the current time. The argument should have the form:
+If SPECIFIED-TIME is given, it is a time to format instead
+of the current time. The argument should have the form:
(HIGH . LOW)
or the form:
(HIGH LOW . IGNORED).
@@ -1796,7 +1796,7 @@ This returns a list of the form (OFFSET NAME).
OFFSET is an integer number of seconds ahead of UTC (east of Greenwich).
A negative value means west of Greenwich.
NAME is a string giving the name of the time zone.
-If an argument is given, it specifies when the time zone offset is determined
+If SPECIFIED-TIME is given, the time zone offset is determined from it
instead of using the current time. The argument should have the form:
(HIGH . LOW)
or the form:
@@ -2365,21 +2365,21 @@ of the buffer. */)
DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_substring,
1, 3, 0,
- doc: /* Insert before point a substring of the contents of buffer BUFFER.
+ doc: /* Insert before point a substring of the contents of BUFFER.
BUFFER may be a buffer or a buffer name.
-Arguments START and END are character numbers specifying the substring.
-They default to the beginning and the end of BUFFER. */)
- (buf, start, end)
- Lisp_Object buf, start, end;
+Arguments START and END are character positions specifying the substring.
+They default to the values of (point-min) and (point-max) in BUFFER. */)
+ (buffer, start, end)
+ Lisp_Object buffer, start, end;
{
register int b, e, temp;
register struct buffer *bp, *obuf;
- Lisp_Object buffer;
+ Lisp_Object buf;
- buffer = Fget_buffer (buf);
- if (NILP (buffer))
- nsberror (buf);
- bp = XBUFFER (buffer);
+ buf = Fget_buffer (buffer);
+ if (NILP (buf))
+ nsberror (buffer);
+ bp = XBUFFER (buf);
if (NILP (bp->name))
error ("Selecting deleted buffer");
@@ -2983,6 +2983,7 @@ It returns the number of characters changed. */)
DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
doc: /* Delete the text between point and mark.
+
When called from a program, expects two arguments,
positions (integers or markers) specifying the stretch to be deleted. */)
(start, end)
@@ -4043,11 +4044,11 @@ transpose_markers (start1, end1, start2, end2,
}
DEFUN ("transpose-regions", Ftranspose_regions, Stranspose_regions, 4, 5, 0,
- doc: /* Transpose region START1 to END1 with START2 to END2.
+ doc: /* Transpose region STARTR1 to ENDR1 with STARTR2 to ENDR2.
The regions may not be overlapping, because the size of the buffer is
never changed in a transposition.
-Optional fifth arg LEAVE_MARKERS, if non-nil, means don't update
+Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
any markers that happen to be located in the regions.
Transposing beyond buffer boundaries is an error. */)
diff --git a/src/emacs.c b/src/emacs.c
index b27b460fba0..d348eb86d29 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -104,6 +104,7 @@ EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
EMACS_INT gdb_data_seg_bits = 0;
#endif
EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
+EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG;
/* Command line args from shell, as list of strings. */
Lisp_Object Vcommand_line_args;
@@ -205,6 +206,8 @@ extern Lisp_Object Vwindow_system;
extern Lisp_Object Vauto_save_list_file_name;
+extern Lisp_Object Vinhibit_redisplay;
+
#ifdef USG_SHARED_LIBRARIES
/* If nonzero, this is the place to put the end of the writable segment
at startup. */
@@ -847,7 +850,7 @@ main (argc, argv
else
{
printf ("GNU Emacs %s\n", SDATA (tem));
- printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
+ printf ("Copyright (C) 2004 Free Software Foundation, Inc.\n");
printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
printf ("You may redistribute copies of Emacs\n");
printf ("under the terms of the GNU General Public License.\n");
@@ -894,7 +897,7 @@ main (argc, argv
/* If -map specified, map the data file in. */
{
char *file;
- if (argmatch (argv, argc, "-map", "--map-data", 3, &mapin_file, &skip_args))
+ if (argmatch (argv, argc, "-map", "--map-data", 3, &file, &skip_args))
mapin_data (file);
}
@@ -2016,6 +2019,9 @@ shut_down_emacs (sig, no_x, stuff)
/* Prevent running of hooks from now on. */
Vrun_hooks = Qnil;
+ /* Don't update display from now on. */
+ Vinhibit_redisplay = Qt;
+
/* If we are controlling the terminal, reset terminal modes. */
#ifdef EMACS_HAVE_TTY_PGRP
{
diff --git a/src/eval.c b/src/eval.c
index 0326a828a81..096755f9c77 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -617,6 +617,7 @@ usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */)
register Lisp_Object defn;
fn_name = Fcar (args);
+ CHECK_SYMBOL (fn_name);
defn = Fcons (Qlambda, Fcdr (args));
if (!NILP (Vpurify_flag))
defn = Fpurecopy (defn);
@@ -1220,7 +1221,7 @@ VAR may be nil; then you do not get access to the signal information.
The value of the last BODY form is returned from the condition-case.
See also the function `signal' for more info.
-usage: (condition-case VAR BODYFORM HANDLERS...) */)
+usage: (condition-case VAR BODYFORM &rest HANDLERS) */)
(args)
Lisp_Object args;
{
@@ -1235,10 +1236,10 @@ usage: (condition-case VAR BODYFORM HANDLERS...) */)
handlers = Fcdr (Fcdr (args));
CHECK_SYMBOL (var);
- for (val = handlers; ! NILP (val); val = Fcdr (val))
+ for (val = handlers; CONSP (val); val = XCDR (val))
{
Lisp_Object tem;
- tem = Fcar (val);
+ tem = XCAR (val);
if (! (NILP (tem)
|| (CONSP (tem)
&& (SYMBOLP (XCAR (tem))
@@ -3243,6 +3244,25 @@ If NFRAMES is more than the number of frames, the value is nil. */)
void
+mark_backtrace ()
+{
+ register struct backtrace *backlist;
+ register int i;
+
+ for (backlist = backtrace_list; backlist; backlist = backlist->next)
+ {
+ mark_object (*backlist->function);
+
+ if (backlist->nargs == UNEVALLED || backlist->nargs == MANY)
+ i = 0;
+ else
+ i = backlist->nargs - 1;
+ for (; i >= 0; i--)
+ mark_object (backlist->args[i]);
+ }
+}
+
+void
syms_of_eval ()
{
DEFVAR_INT ("max-specpdl-size", &max_specpdl_size,
diff --git a/src/fileio.c b/src/fileio.c
index 722370ea5ce..42f3949c917 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,5 +1,5 @@
/* File IO for GNU Emacs.
- Copyright (C) 1985,86,87,88,93,94,95,96,97,98,99,2000,01,2003
+ Copyright (C) 1985,86,87,88,93,94,95,96,97,98,99,2000,01,03,2004
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -324,6 +324,7 @@ Lisp_Object Qfile_regular_p;
Lisp_Object Qfile_accessible_directory_p;
Lisp_Object Qfile_modes;
Lisp_Object Qset_file_modes;
+Lisp_Object Qset_file_times;
Lisp_Object Qfile_newer_than_file_p;
Lisp_Object Qinsert_file_contents;
Lisp_Object Qwrite_region;
@@ -2349,7 +2350,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
/* stat is a good way to tell whether the file exists,
regardless of what access permissions it has. */
- if (stat (SDATA (encoded_filename), &statbuf) >= 0)
+ if (lstat (SDATA (encoded_filename), &statbuf) >= 0)
{
if (! interactive)
Fsignal (Qfile_already_exists,
@@ -2684,11 +2685,11 @@ This is what happens in interactive use with M-x. */)
Lisp_Object args[2];
#endif
Lisp_Object handler;
- struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- Lisp_Object encoded_file, encoded_newname;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+ Lisp_Object encoded_file, encoded_newname, symlink_target;
- encoded_file = encoded_newname = Qnil;
- GCPRO4 (file, newname, encoded_file, encoded_newname);
+ symlink_target = encoded_file = encoded_newname = Qnil;
+ GCPRO5 (file, newname, encoded_file, encoded_newname, symlink_target);
CHECK_STRING (file);
CHECK_STRING (newname);
file = Fexpand_file_name (file, Qnil);
@@ -2725,10 +2726,17 @@ This is what happens in interactive use with M-x. */)
{
if (errno == EXDEV)
{
- Fcopy_file (file, newname,
- /* We have already prompted if it was an integer,
- so don't have copy-file prompt again. */
- NILP (ok_if_already_exists) ? Qnil : Qt, Qt);
+#ifdef S_IFLNK
+ symlink_target = Ffile_symlink_p (file);
+ if (! NILP (symlink_target))
+ Fmake_symbolic_link (symlink_target, newname,
+ NILP (ok_if_already_exists) ? Qnil : Qt);
+ else
+#endif
+ Fcopy_file (file, newname,
+ /* We have already prompted if it was an integer,
+ so don't have copy-file prompt again. */
+ NILP (ok_if_already_exists) ? Qnil : Qt, Qt);
Fdelete_file (file);
}
else
@@ -3439,7 +3447,59 @@ The value is an integer. */)
XSETINT (value, (~ realmask) & 0777);
return value;
}
+
+extern int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
+
+DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
+ doc: /* Set times of file FILENAME to TIME.
+Set both access and modification times.
+Return t on success, else nil.
+Use the current time if TIME is nil. TIME is in the format of
+`current-time'. */)
+ (filename, time)
+ Lisp_Object filename, time;
+{
+ Lisp_Object absname, encoded_absname;
+ Lisp_Object handler;
+ time_t sec;
+ int usec;
+
+ if (! lisp_time_argument (time, &sec, &usec))
+ error ("Invalid time specification");
+
+ absname = Fexpand_file_name (filename, current_buffer->directory);
+
+ /* If the file name has special constructs in it,
+ call the corresponding file handler. */
+ handler = Ffind_file_name_handler (absname, Qset_file_times);
+ if (!NILP (handler))
+ return call3 (handler, Qset_file_times, absname, time);
+
+ encoded_absname = ENCODE_FILE (absname);
+
+ {
+ EMACS_TIME t;
+
+ EMACS_SET_SECS (t, sec);
+ EMACS_SET_USECS (t, usec);
+
+ if (set_file_times (SDATA (encoded_absname), t, t))
+ {
+#ifdef DOS_NT
+ struct stat st;
+
+ /* Setting times on a directory always fails. */
+ if (stat (SDATA (encoded_absname), &st) == 0
+ && (st.st_mode & S_IFMT) == S_IFDIR)
+ return Qnil;
+#endif
+ report_file_error ("Setting file times", Fcons (absname, Qnil));
+ return Qnil;
+ }
+ }
+ return Qt;
+}
#ifdef __NetBSD__
#define unix 42
@@ -6051,10 +6111,13 @@ provides a file dialog box. */)
if (NILP (dir))
dir = current_buffer->directory;
+ if (NILP (Ffile_name_absolute_p (dir)))
+ dir = Fexpand_file_name (dir, Qnil);
if (NILP (default_filename))
- default_filename = !NILP (initial)
- ? Fexpand_file_name (initial, dir)
- : current_buffer->filename;
+ default_filename
+ = (!NILP (initial)
+ ? Fexpand_file_name (initial, dir)
+ : current_buffer->filename);
/* If dir starts with user's homedir, change that to ~. */
homedir = (char *) egetenv ("HOME");
@@ -6255,6 +6318,7 @@ syms_of_fileio ()
Qfile_accessible_directory_p = intern ("file-accessible-directory-p");
Qfile_modes = intern ("file-modes");
Qset_file_modes = intern ("set-file-modes");
+ Qset_file_times = intern ("set-file-times");
Qfile_newer_than_file_p = intern ("file-newer-than-file-p");
Qinsert_file_contents = intern ("insert-file-contents");
Qwrite_region = intern ("write-region");
@@ -6288,6 +6352,7 @@ syms_of_fileio ()
staticpro (&Qfile_accessible_directory_p);
staticpro (&Qfile_modes);
staticpro (&Qset_file_modes);
+ staticpro (&Qset_file_times);
staticpro (&Qfile_newer_than_file_p);
staticpro (&Qinsert_file_contents);
staticpro (&Qwrite_region);
@@ -6511,6 +6576,7 @@ a non-nil value. */);
defsubr (&Sfile_regular_p);
defsubr (&Sfile_modes);
defsubr (&Sset_file_modes);
+ defsubr (&Sset_file_times);
defsubr (&Sset_default_file_modes);
defsubr (&Sdefault_file_modes);
defsubr (&Sfile_newer_than_file_p);
diff --git a/src/fns.c b/src/fns.c
index 017f8124013..5e20687494c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,5 +1,5 @@
/* Random utility Lisp functions.
- Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 98, 99, 2000, 2001, 02, 2003
+ Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 98, 99, 2000, 2001, 02, 03, 2004
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -473,7 +473,8 @@ with the original. */)
{
Lisp_Object val;
int size_in_chars
- = (XBOOL_VECTOR (arg)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
+ = ((XBOOL_VECTOR (arg)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
val = Fmake_bool_vector (Flength (arg), Qnil);
bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data,
@@ -486,29 +487,6 @@ with the original. */)
return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0);
}
-#if 0 /* unused */
-/* In string STR of length LEN, see if bytes before STR[I] combine
- with bytes after STR[I] to form a single character. If so, return
- the number of bytes after STR[I] which combine in this way.
- Otherwize, return 0. */
-
-static int
-count_combining (str, len, i)
- unsigned char *str;
- int len, i;
-{
- int j = i - 1, bytes;
-
- if (i == 0 || i == len || CHAR_HEAD_P (str[i]))
- return 0;
- while (j >= 0 && !CHAR_HEAD_P (str[j])) j--;
- if (j < 0 || ! BASE_LEADING_CODE_P (str[j]))
- return 0;
- PARSE_MULTIBYTE_SEQ (str + j, len - j, bytes);
- return (bytes <= i - j ? 0 : bytes - (i - j));
-}
-#endif
-
/* This structure holds information of an argument of `concat' that is
a string and has text properties to be copied. */
struct textprop_rec
@@ -682,6 +660,7 @@ concat (nargs, args, target_type, last_special)
}
toindex_byte += thislen_byte;
toindex += thisleni;
+ STRING_SET_CHARS (val, SCHARS (val));
}
/* Copy a single-byte string to a multibyte string. */
else if (STRINGP (this) && STRINGP (val))
@@ -735,8 +714,8 @@ concat (nargs, args, target_type, last_special)
else if (BOOL_VECTOR_P (this))
{
int byte;
- byte = XBOOL_VECTOR (this)->data[thisindex / BITS_PER_CHAR];
- if (byte & (1 << (thisindex % BITS_PER_CHAR)))
+ byte = XBOOL_VECTOR (this)->data[thisindex / BOOL_VECTOR_BITS_PER_CHAR];
+ if (byte & (1 << (thisindex % BOOL_VECTOR_BITS_PER_CHAR)))
elt = Qt;
else
elt = Qnil;
@@ -993,16 +972,24 @@ string_make_unibyte (string)
Lisp_Object string;
{
unsigned char *buf;
+ Lisp_Object ret;
if (! STRING_MULTIBYTE (string))
return string;
- buf = (unsigned char *) alloca (SCHARS (string));
+ /* We can not use alloca here, because string might be very long.
+ For example when selecting megabytes of text and then pasting it to
+ another application. */
+ buf = (unsigned char *) xmalloc (SCHARS (string));
copy_text (SDATA (string), buf, SBYTES (string),
1, 0);
- return make_unibyte_string (buf, SCHARS (string));
+ ret = make_unibyte_string (buf, SCHARS (string));
+
+ xfree (buf);
+
+ return ret;
}
DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte,
@@ -1475,7 +1462,7 @@ assq_no_quit (key, list)
DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0,
doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST.
The value is actually the first element of LIST whose car equals KEY. */)
- (key, list)
+ (key, list)
Lisp_Object key, list;
{
Lisp_Object result, car;
@@ -2050,6 +2037,18 @@ The PLIST is modified by side effects. */)
return plist;
}
+DEFUN ("eql", Feql, Seql, 2, 2, 0,
+ doc: /* Return t if the two args are the same Lisp object.
+Floating-point numbers of equal value are `eql', but they may not be `eq'. */)
+ (obj1, obj2)
+ Lisp_Object obj1, obj2;
+{
+ if (FLOATP (obj1))
+ return internal_equal (obj1, obj2, 0, 0) ? Qt : Qnil;
+ else
+ return EQ (obj1, obj2) ? Qt : Qnil;
+}
+
DEFUN ("equal", Fequal, Sequal, 2, 2, 0,
doc: /* Return t if two Lisp objects have similar structure and contents.
They must have the same data type.
@@ -2148,7 +2147,8 @@ internal_equal (o1, o2, depth, props)
if (BOOL_VECTOR_P (o1))
{
int size_in_chars
- = (XBOOL_VECTOR (o1)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
+ = ((XBOOL_VECTOR (o1)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
return 0;
@@ -2260,7 +2260,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
{
register unsigned char *p = XBOOL_VECTOR (array)->data;
int size_in_chars
- = (XBOOL_VECTOR (array)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
+ = ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
charval = (! NILP (item) ? -1 : 0);
for (index = 0; index < size_in_chars - 1; index++)
@@ -2268,8 +2269,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
if (index < size_in_chars)
{
/* Mask out bits beyond the vector size. */
- if (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)
- charval &= (1 << (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)) - 1;
+ if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)
+ charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
p[index] = charval;
}
}
@@ -2398,8 +2399,8 @@ mapcar1 (leni, vals, fn, seq)
for (i = 0; i < leni; i++)
{
int byte;
- byte = XBOOL_VECTOR (seq)->data[i / BITS_PER_CHAR];
- if (byte & (1 << (i % BITS_PER_CHAR)))
+ byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR];
+ if (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR)))
dummy = Qt;
else
dummy = Qnil;
@@ -5203,6 +5204,7 @@ used if both `use-dialog-box' and this variable are non-nil. */);
defsubr (&Sput);
defsubr (&Slax_plist_get);
defsubr (&Slax_plist_put);
+ defsubr (&Seql);
defsubr (&Sequal);
defsubr (&Sequal_including_properties);
defsubr (&Sfillarray);
diff --git a/src/fontset.c b/src/fontset.c
index 4212a40541e..016c62f0e50 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1712,7 +1712,10 @@ If the named font is not yet loaded, return nil. */)
/* Return a cons (FONT-NAME . GLYPH-CODE).
FONT-NAME is the font name for the character at POSITION in the current
buffer. This is computed from all the text properties and overlays
- that apply to POSITION.
+ that apply to POSITION. POSTION may be nil, in which case,
+ FONT-NAME is the font name for display the character CH with the
+ default face.
+
GLYPH-CODE is the glyph code in the font to use for the character.
If the 2nd optional arg CH is non-nil, it is a character to check
@@ -1725,7 +1728,8 @@ If the named font is not yet loaded, return nil. */)
(2) The character code is invalid.
- (3) The current buffer is not displayed in any window.
+ (3) If POSITION is not nil, and the current buffer is not displayed
+ in any window.
In addition, the returned font name may not take into account of
such redisplay engine hooks as what used in jit-lock-mode if
@@ -1740,39 +1744,53 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
int pos, pos_byte, dummy;
int face_id;
int c;
- Lisp_Object window;
- struct window *w;
struct frame *f;
struct face *face;
Lisp_Object charset, rfont_def;
- int charset_id;
-
- CHECK_NUMBER_COERCE_MARKER (position);
- pos = XINT (position);
- if (pos < BEGV || pos >= ZV)
- args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
- pos_byte = CHAR_TO_BYTE (pos);
- if (NILP (ch))
- c = FETCH_CHAR (pos_byte);
- else
+ int id;
+
+ if (NILP (position))
{
CHECK_CHARACTER (ch);
c = XINT (ch);
+ f = XFRAME (selected_frame);
+ face_id = DEFAULT_FACE_ID;
+ pos = -1;
+ }
+ else
+ {
+ Lisp_Object window;
+ struct window *w;
+
+ CHECK_NUMBER_COERCE_MARKER (position);
+ pos = XINT (position);
+ if (pos < BEGV || pos >= ZV)
+ args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
+ pos_byte = CHAR_TO_BYTE (pos);
+ if (NILP (ch))
+ c = FETCH_CHAR (pos_byte);
+ else
+ {
+ CHECK_NATNUM (ch);
+ c = XINT (ch);
+ }
+ window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
+ if (NILP (window))
+ return Qnil;
+ w = XWINDOW (window);
+ f = XFRAME (w->frame);
+ face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
}
- window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
- if (NILP (window))
+ if (! CHAR_VALID_P (c, 0))
return Qnil;
- w = XWINDOW (window);
- f = XFRAME (w->frame);
- face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
+ face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
face = FACE_FROM_ID (f, face_id);
charset = Fget_char_property (position, Qcharset, Qnil);
if (CHARSETP (charset))
- charset_id = XINT (CHARSET_SYMBOL_ID (charset));
+ id = XINT (CHARSET_SYMBOL_ID (charset));
else
- charset_id = -1;
- rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset),
- c, face, charset_id);
+ id = -1;
+ rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset), c, face, id);
if (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3)))
{
Lisp_Object font_def;
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 4d0b50573f7..84aa9f46d4d 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -229,23 +229,100 @@ xg_create_default_cursor (dpy)
return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
}
-/* For the image defined in IMG, make and return a GdkPixmap for
- the pixmap in *GPIX, and a GdkBitmap for the mask in *GMASK.
- If IMG has no mask, *GMASK is set to NULL.
- The image is defined on the display where frame F is. */
-static void
-xg_get_gdk_pixmap_and_mask (f, img, gpix, gmask)
+/* For the image defined in IMG, make and return a GtkImage. For displays with
+ 8 planes or less we must make a GdkPixbuf and apply the mask manually.
+ Otherwise the highlightning and dimming the tool bar code in GTK does
+ will look bad. For display with more than 8 planes we just use the
+ pixmap and mask directly. For monochrome displays, GTK doesn't seem
+ able to use external pixmaps, it looks bad whatever we do.
+ The image is defined on the display where frame F is.
+ WIDGET is used to find the GdkColormap to use for the GdkPixbuf.
+ If OLD_WIDGET is NULL, a new widget is constructed and returned.
+ If OLD_WIDGET is not NULL, that widget is modified. */
+static GtkWidget *
+xg_get_image_for_pixmap (f, img, widget, old_widget)
FRAME_PTR f;
struct image *img;
- GdkPixmap **gpix;
- GdkBitmap **gmask;
+ GtkWidget *widget;
+ GtkImage *old_widget;
{
+ GdkPixmap *gpix;
+ GdkPixmap *gmask;
GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
- *gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap);
- *gmask = img->mask ?
- (GdkBitmap*) gdk_pixmap_foreign_new_for_display (gdpy, img->mask)
- : 0;
+ gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap);
+ gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0;
+
+ if (x_screen_planes (f) > 8 || x_screen_planes (f) == 1)
+ {
+ if (! old_widget)
+ old_widget = GTK_IMAGE (gtk_image_new_from_pixmap (gpix, gmask));
+ else
+ gtk_image_set_from_pixmap (old_widget, gpix, gmask);
+ }
+ else
+ {
+ int x, y, width, height, rowstride, mask_rowstride;
+ GdkPixbuf *icon_buf, *tmp_buf;
+ guchar *pixels;
+ guchar *mask_pixels;
+
+ gdk_drawable_get_size (gpix, &width, &height);
+ tmp_buf = gdk_pixbuf_get_from_drawable (NULL,
+ gpix,
+ gtk_widget_get_colormap (widget),
+ 0, 0, 0, 0, width, height);
+ icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0);
+ g_object_unref (G_OBJECT (tmp_buf));
+
+ if (gmask)
+ {
+ GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL,
+ gmask,
+ NULL,
+ 0, 0, 0, 0,
+ width, height);
+ guchar *pixels = gdk_pixbuf_get_pixels (icon_buf);
+ guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf);
+ int rowstride = gdk_pixbuf_get_rowstride (icon_buf);
+ int mask_rowstride = gdk_pixbuf_get_rowstride (mask_buf);
+ int y;
+
+ for (y = 0; y < height; ++y)
+ {
+ guchar *iconptr, *maskptr;
+ int x;
+
+ iconptr = pixels + y * rowstride;
+ maskptr = mask_pixels + y * mask_rowstride;
+
+ for (x = 0; x < width; ++x)
+ {
+ /* In a bitmap, RGB is either 255/255/255 or 0/0/0. Checking
+ just R is sufficient. */
+ if (maskptr[0] == 0)
+ iconptr[3] = 0; /* 0, 1, 2 is R, G, B. 3 is alpha. */
+
+ iconptr += rowstride/width;
+ maskptr += mask_rowstride/width;
+ }
+ }
+
+ g_object_unref (G_OBJECT (gmask));
+ g_object_unref (G_OBJECT (mask_buf));
+ }
+
+ g_object_unref (G_OBJECT (gpix));
+
+ if (! old_widget)
+ old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf));
+ else
+ gtk_image_set_from_pixbuf (old_widget, icon_buf);
+
+ g_object_unref (G_OBJECT (icon_buf));
+ }
+
+ return GTK_WIDGET (old_widget);
}
@@ -2760,18 +2837,16 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height,
if (wscroll)
{
GtkWidget *wfixed = f->output_data.x->edit_widget;
- int winextra = canon_width > width ? (canon_width - width) / 2 : 0;
- int bottom = top + height;
- gint slider_width;
- int oldtop, oldleft, oldbottom;
- GtkRequisition req;
+ gtk_container_set_reallocate_redraws (GTK_CONTAINER (wfixed), TRUE);
- /* Get old values. */
- xg_find_top_left_in_fixed (wscroll, wfixed, &oldleft, &oldtop);
- gtk_widget_size_request (wscroll, &req);
- oldbottom = oldtop + req.height;
+ /* Move and resize to new values. */
+ gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top);
+ gtk_widget_set_size_request (wscroll, width, height);
+ /* Must force out update so changed scroll bars gets redrawn. */
+ gdk_window_process_all_updates ();
+
/* Scroll bars in GTK has a fixed width, so if we say width 16, it
will only be its fixed width (14 is default) anyway, the rest is
blank. We are drawing the mode line across scroll bars when
@@ -2799,62 +2874,7 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height,
the scroll bar and the edge of the window and between the scroll
bar and the fringe. */
- if (oldtop != -1 && oldleft != -1)
- {
- int gtkextral, gtkextrah;
- int xl, xr, wbl, wbr;
- int bottomdiff, topdiff;
-
- gtk_widget_style_get (wscroll, "slider_width", &slider_width, NULL);
- gtkextral = width > slider_width ? (width - slider_width) / 2 : 0;
- gtkextrah = gtkextral ? (width - slider_width - gtkextral) : 0;
-
- xl = real_left;
- wbl = gtkextral + winextra;
- wbr = gtkextrah + winextra;
- xr = left + gtkextral + slider_width;
- bottomdiff = abs (oldbottom - bottom);
- topdiff = abs (oldtop - top);
-
- if (oldleft != left)
- {
- gdk_window_clear_area (wfixed->window, xl, top, wbl, height);
- gdk_window_clear_area (wfixed->window, xr, top, wbr, height);
- }
-
- if (oldtop > top)
- {
- gdk_window_clear_area (wfixed->window, xl, top, wbl, topdiff);
- gdk_window_clear_area (wfixed->window, xr, top, wbr, topdiff);
- }
- else if (oldtop < top)
- {
- gdk_window_clear_area (wfixed->window, xl, oldtop, wbl, topdiff);
- gdk_window_clear_area (wfixed->window, xr, oldtop, wbr, topdiff);
- }
-
- if (oldbottom > bottom)
- {
- gdk_window_clear_area (wfixed->window, xl, bottom, wbl,
- bottomdiff);
- gdk_window_clear_area (wfixed->window, xr, bottom, wbr,
- bottomdiff);
- }
- else if (oldbottom < bottom)
- {
- gdk_window_clear_area (wfixed->window, xl, oldbottom, wbl,
- bottomdiff);
- gdk_window_clear_area (wfixed->window, xr, oldbottom, wbr,
- bottomdiff);
- }
- }
-
- /* Move and resize to new values. */
- gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top);
- gtk_widget_set_size_request (wscroll, width, height);
-
- /* Must force out update so changed scroll bars gets redrawn. */
- gdk_window_process_all_updates ();
+ XClearWindow (FRAME_X_DISPLAY (f), GTK_WIDGET_TO_X_WIN (wscroll));
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
@@ -3262,12 +3282,8 @@ update_frame_tool_bar (f)
if (! wicon)
{
- GdkPixmap *gpix;
- GdkBitmap *gmask;
- GtkWidget *w;
+ GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
- xg_get_gdk_pixmap_and_mask (f, img, &gpix, &gmask);
- w = gtk_image_new_from_pixmap (gpix, gmask);
gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget),
0, 0, 0,
w,
@@ -3324,13 +3340,7 @@ update_frame_tool_bar (f)
g_list_free (chlist);
if (old_img != img->pixmap)
- {
- GdkPixmap *gpix;
- GdkBitmap *gmask;
-
- xg_get_gdk_pixmap_and_mask (f, img, &gpix, &gmask);
- gtk_image_set_from_pixmap (wimage, gpix, gmask);
- }
+ (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
(gpointer)img->pixmap);
diff --git a/src/image.c b/src/image.c
index 34db5e53367..438e132807f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include <signal.h>
#include <stdio.h>
#include <math.h>
+#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -51,7 +52,6 @@ Boston, MA 02111-1307, USA. */
typedef struct x_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y)
#define NO_PIXMAP None
-#define PNG_BG_COLOR_SHIFT 0
#define RGB_PIXEL_COLOR unsigned long
@@ -69,7 +69,6 @@ typedef struct x_bitmap_record Bitmap_Record;
typedef struct w32_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) GetPixel(ximg, x, y)
#define NO_PIXMAP 0
-#define PNG_BG_COLOR_SHIFT 0
#define RGB_PIXEL_COLOR COLORREF
@@ -104,7 +103,6 @@ typedef struct mac_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y)
#define NO_PIXMAP 0
-#define PNG_BG_COLOR_SHIFT 8
#define RGB_PIXEL_COLOR unsigned long
@@ -177,14 +175,19 @@ XPutPixel (ximage, x, y, pixel)
int x, y;
unsigned long pixel;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
RGBColor color;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximage, NULL);
color.red = RED16_FROM_ULONG (pixel);
color.green = GREEN16_FROM_ULONG (pixel);
color.blue = BLUE16_FROM_ULONG (pixel);
SetCPixel (x, y, &color);
+
+ SetGWorld (old_port, old_gdh);
}
static unsigned long
@@ -192,11 +195,16 @@ XGetPixel (ximage, x, y)
XImagePtr ximage;
int x, y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
RGBColor color;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximage, NULL);
GetCPixel (x, y, &color);
+
+ SetGWorld (old_port, old_gdh);
return RGB_TO_ULONG (color.red >> 8, color.green >> 8, color.blue >> 8);
}
@@ -206,7 +214,7 @@ XDestroyImage (ximg)
{
UnlockPixels (GetGWorldPixMap (ximg));
}
-#endif
+#endif /* MAC_OS */
/* Functions to access the contents of a bitmap, given an id. */
@@ -598,6 +606,14 @@ x_create_bitmap_mask (f, id)
static struct image_type *image_types;
+/* A list of symbols, one for each supported image type. */
+
+Lisp_Object Vimage_types;
+
+/* Cache for delayed-loading image types. */
+
+static Lisp_Object Vimage_type_cache;
+
/* The symbol `xbm' which is used as the type symbol for XBM images. */
Lisp_Object Qxbm;
@@ -622,7 +638,7 @@ Lisp_Object Vimage_cache_eviction_delay;
/* Function prototypes. */
-static void define_image_type P_ ((struct image_type *type));
+static Lisp_Object define_image_type P_ ((struct image_type *type, int loaded));
static struct image_type *lookup_image_type P_ ((Lisp_Object symbol));
static void image_error P_ ((char *format, Lisp_Object, Lisp_Object));
static void x_laplace P_ ((struct frame *, struct image *));
@@ -630,21 +646,37 @@ static void x_emboss P_ ((struct frame *, struct image *));
static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
Lisp_Object));
+#define CACHE_IMAGE_TYPE(type, status) \
+ do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0)
+
+#define ADD_IMAGE_TYPE(type) \
+ do { Vimage_types = Fcons (type, Vimage_types); } while (0)
/* Define a new image type from TYPE. This adds a copy of TYPE to
- image_types and adds the symbol *TYPE->type to Vimage_types. */
+ image_types and caches the loading status of TYPE. */
-static void
-define_image_type (type)
+static Lisp_Object
+define_image_type (type, loaded)
struct image_type *type;
+ int loaded;
{
- /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
- The initialized data segment is read-only. */
- struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
- bcopy (type, p, sizeof *p);
- p->next = image_types;
- image_types = p;
- Vimage_types = Fcons (*p->type, Vimage_types);
+ Lisp_Object success;
+
+ if (!loaded)
+ success = Qnil;
+ else
+ {
+ /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
+ The initialized data segment is read-only. */
+ struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
+ bcopy (type, p, sizeof *p);
+ p->next = image_types;
+ image_types = p;
+ success = Qt;
+ }
+
+ CACHE_IMAGE_TYPE(*type->type, success);
+ return success;
}
@@ -657,6 +689,10 @@ lookup_image_type (symbol)
{
struct image_type *type;
+ /* We must initialize the image-type if it hasn't been already. */
+ if (NILP (Finit_image_library (symbol)))
+ return 0; /* unimplemented */
+
for (type = image_types; type; type = type->next)
if (EQ (symbol, *type->type))
break;
@@ -1079,13 +1115,21 @@ prepare_image_for_display (f, img)
drawn in face FACE. */
int
-image_ascent (img, face)
+image_ascent (img, face, slice)
struct image *img;
struct face *face;
+ struct glyph_slice *slice;
{
- int height = img->height + img->vmargin;
+ int height;
int ascent;
+ if (slice->height == img->height)
+ height = img->height + img->vmargin;
+ else if (slice->y == 0)
+ height = slice->height + img->vmargin;
+ else
+ height = slice->height;
+
if (img->ascent == CENTERED_IMAGE_ASCENT)
{
if (face->font)
@@ -1172,7 +1216,7 @@ four_corners_best (ximg, width, height)
/* Return the `background' field of IMG. If IMG doesn't have one yet,
it is guessed heuristically. If non-zero, XIMG is an existing
XImage object (or device context with the image selected on W32) to
- use for the heuristic. */
+ use for the heuristic. */
RGB_PIXEL_COLOR
image_background (img, f, ximg)
@@ -1205,7 +1249,7 @@ image_background (img, f, ximg)
if (free_ximg)
Destroy_Image (ximg, prev);
-
+
img->background_valid = 1;
}
@@ -1581,6 +1625,11 @@ lookup_image (f, spec)
Lisp_Object spec;
{
struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+#ifdef _MSC_VER
+ /* Work around a problem with MinGW builds of graphics libraries
+ not honoring calling conventions. */
+ static
+#endif
struct image *img;
int i;
unsigned hash;
@@ -1768,6 +1817,33 @@ forall_images_in_image_cache (f, fn)
if (!fn_##func) return 0; \
}
+/* Load a DLL implementing an image type.
+ The `image-library-alist' variable associates a symbol,
+ identifying an image type, to a list of possible filenames.
+ The function returns NULL if no library could be loaded for
+ the given image type, or if the library was previously loaded;
+ else the handle of the DLL. */
+static HMODULE
+w32_delayed_load (Lisp_Object libraries, Lisp_Object type)
+{
+ HMODULE library = NULL;
+
+ if (CONSP (libraries) && NILP (Fassq (type, Vimage_type_cache)))
+ {
+ Lisp_Object dlls = Fassq (type, libraries);
+
+ if (CONSP (dlls))
+ for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls))
+ {
+ CHECK_STRING_CAR (dlls);
+ if (library = LoadLibrary (SDATA (XCAR (dlls))))
+ break;
+ }
+ }
+
+ return library;
+}
+
#endif /* HAVE_NTGUI */
static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
@@ -2191,6 +2267,10 @@ image_load_qt_1 (f, img, type, fss, dh)
goto error;
if (draw_all_pixels != graphicsImporterDrawsAllPixels)
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
+
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximg, NULL);
bg_color.red = color.red;
bg_color.green = color.green;
@@ -2202,6 +2282,7 @@ image_load_qt_1 (f, img, type, fss, dh)
#else
EraseRect (&(ximg->portRect));
#endif
+ SetGWorld (old_port, old_gdh);
}
GraphicsImportSetGWorld (gi, ximg, NULL);
GraphicsImportDraw (gi);
@@ -2990,7 +3071,7 @@ xbm_load_image (f, img, contents, end)
non_default_colors = 1;
}
- Create_Pixmap_From_Bitmap_Data (f, img, data,
+ Create_Pixmap_From_Bitmap_Data (f, img, data,
foreground, background,
non_default_colors);
xfree (data);
@@ -3164,28 +3245,36 @@ xbm_load (f, img)
XPM images
***********************************************************************/
-#ifdef HAVE_XPM
+#if defined (HAVE_XPM) || defined (MAC_OS)
static int xpm_image_p P_ ((Lisp_Object object));
static int xpm_load P_ ((struct frame *f, struct image *img));
static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
+#endif /* HAVE_XPM || MAC_OS */
+
+#ifdef HAVE_XPM
#ifdef HAVE_NTGUI
/* Indicate to xpm.h that we don't have Xlib. */
#define FOR_MSW
/* simx.h in xpm defines XColor and XImage differently than Emacs. */
+/* It also defines Display the same way as Emacs, but gcc 3.3 still barfs. */
#define XColor xpm_XColor
#define XImage xpm_XImage
+#define Display xpm_Display
#define PIXEL_ALREADY_TYPEDEFED
#include "X11/xpm.h"
#undef FOR_MSW
#undef XColor
#undef XImage
+#undef Display
#undef PIXEL_ALREADY_TYPEDEFED
#else
#include "X11/xpm.h"
#endif /* HAVE_NTGUI */
+#endif /* HAVE_XPM */
+#if defined (HAVE_XPM) || defined (MAC_OS)
/* The symbol `xpm' identifying XPM-format images. */
Lisp_Object Qxpm;
@@ -3455,13 +3544,12 @@ DEF_IMGLIB_FN (XpmCreateImageFromBuffer);
DEF_IMGLIB_FN (XpmReadFileToImage);
DEF_IMGLIB_FN (XImageFree);
-
static int
-init_xpm_functions (void)
+init_xpm_functions (Lisp_Object libraries)
{
HMODULE library;
- if (!(library = LoadLibrary ("libXpm.dll")))
+ if (!(library = w32_delayed_load (libraries, Qxpm)))
return 0;
LOAD_IMGLIB_FN (library, XpmFreeAttributes);
@@ -3513,10 +3601,13 @@ xpm_image_p (object)
|| xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)));
}
+#endif /* HAVE_XPM || MAC_OS */
/* Load image IMG which will be displayed on frame F. Value is
non-zero if successful. */
+#ifdef HAVE_XPM
+
static int
xpm_load (f, img)
struct frame *f;
@@ -3748,6 +3839,467 @@ xpm_load (f, img)
#endif /* HAVE_XPM */
+#ifdef MAC_OS
+
+/* XPM support functions for Mac OS where libxpm is not available.
+ Only XPM version 3 (without any extensions) is supported. */
+
+static int xpm_scan P_ ((unsigned char **, unsigned char *,
+ unsigned char **, int *));
+static Lisp_Object xpm_make_color_table_v
+ P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object),
+ Lisp_Object (**) (Lisp_Object, unsigned char *, int)));
+static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *,
+ int, Lisp_Object));
+static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object,
+ unsigned char *, int));
+static Lisp_Object xpm_make_color_table_h
+ P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object),
+ Lisp_Object (**) (Lisp_Object, unsigned char *, int)));
+static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *,
+ int, Lisp_Object));
+static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object,
+ unsigned char *, int));
+static int xpm_str_to_color_key P_ ((char *));
+static int xpm_load_image P_ ((struct frame *, struct image *,
+ unsigned char *, unsigned char *));
+
+/* Tokens returned from xpm_scan. */
+
+enum xpm_token
+{
+ XPM_TK_IDENT = 256,
+ XPM_TK_STRING,
+ XPM_TK_EOF
+};
+
+/* Scan an XPM data and return a character (< 256) or a token defined
+ by enum xpm_token above. *S and END are the start (inclusive) and
+ the end (exclusive) addresses of the data, respectively. Advance
+ *S while scanning. If token is either XPM_TK_IDENT or
+ XPM_TK_STRING, *BEG and *LEN are set to the start address and the
+ length of the corresponding token, respectively. */
+
+static int
+xpm_scan (s, end, beg, len)
+ unsigned char **s, *end, **beg;
+ int *len;
+{
+ int c;
+
+ while (*s < end)
+ {
+ /* Skip white-space. */
+ while (*s < end && (c = *(*s)++, isspace (c)))
+ ;
+
+ /* gnus-pointer.xpm uses '-' in its identifier.
+ sb-dir-plus.xpm uses '+' in its identifier. */
+ if (isalpha (c) || c == '_' || c == '-' || c == '+')
+ {
+ *beg = *s - 1;
+ while (*s < end &&
+ (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+'))
+ ++*s;
+ *len = *s - *beg;
+ return XPM_TK_IDENT;
+ }
+ else if (c == '"')
+ {
+ *beg = *s;
+ while (*s < end && **s != '"')
+ ++*s;
+ *len = *s - *beg;
+ if (*s < end)
+ ++*s;
+ return XPM_TK_STRING;
+ }
+ else if (c == '/')
+ {
+ if (*s < end && **s == '*')
+ {
+ /* C-style comment. */
+ ++*s;
+ do
+ {
+ while (*s < end && *(*s)++ != '*')
+ ;
+ }
+ while (*s < end && **s != '/');
+ if (*s < end)
+ ++*s;
+ }
+ else
+ return c;
+ }
+ else
+ return c;
+ }
+
+ return XPM_TK_EOF;
+}
+
+/* Functions for color table lookup in XPM data. A Key is a string
+ specifying the color of each pixel in XPM data. A value is either
+ an integer that specifies a pixel color, Qt that specifies
+ transparency, or Qnil for the unspecified color. If the length of
+ the key string is one, a vector is used as a table. Otherwise, a
+ hash table is used. */
+
+static Lisp_Object
+xpm_make_color_table_v (put_func, get_func)
+ void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object);
+ Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int);
+{
+ *put_func = xpm_put_color_table_v;
+ *get_func = xpm_get_color_table_v;
+ return Fmake_vector (make_number (256), Qnil);
+}
+
+static void
+xpm_put_color_table_v (color_table, chars_start, chars_len, color)
+ Lisp_Object color_table;
+ unsigned char *chars_start;
+ int chars_len;
+ Lisp_Object color;
+{
+ XVECTOR (color_table)->contents[*chars_start] = color;
+}
+
+static Lisp_Object
+xpm_get_color_table_v (color_table, chars_start, chars_len)
+ Lisp_Object color_table;
+ unsigned char *chars_start;
+ int chars_len;
+{
+ return XVECTOR (color_table)->contents[*chars_start];
+}
+
+static Lisp_Object
+xpm_make_color_table_h (put_func, get_func)
+ void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object);
+ Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int);
+{
+ *put_func = xpm_put_color_table_h;
+ *get_func = xpm_get_color_table_h;
+ return make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
+ make_float (DEFAULT_REHASH_SIZE),
+ make_float (DEFAULT_REHASH_THRESHOLD),
+ Qnil, Qnil, Qnil);
+}
+
+static void
+xpm_put_color_table_h (color_table, chars_start, chars_len, color)
+ Lisp_Object color_table;
+ unsigned char *chars_start;
+ int chars_len;
+ Lisp_Object color;
+{
+ struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
+ unsigned hash_code;
+ Lisp_Object chars = make_unibyte_string (chars_start, chars_len);
+
+ hash_lookup (table, chars, &hash_code);
+ hash_put (table, chars, color, hash_code);
+}
+
+static Lisp_Object
+xpm_get_color_table_h (color_table, chars_start, chars_len)
+ Lisp_Object color_table;
+ unsigned char *chars_start;
+ int chars_len;
+{
+ struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
+ int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len),
+ NULL);
+
+ return i >= 0 ? HASH_VALUE (table, i) : Qnil;
+}
+
+enum xpm_color_key {
+ XPM_COLOR_KEY_S,
+ XPM_COLOR_KEY_M,
+ XPM_COLOR_KEY_G4,
+ XPM_COLOR_KEY_G,
+ XPM_COLOR_KEY_C
+};
+
+static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
+
+static int
+xpm_str_to_color_key (s)
+ char *s;
+{
+ int i;
+
+ for (i = 0;
+ i < sizeof xpm_color_key_strings / sizeof xpm_color_key_strings[0];
+ i++)
+ if (strcmp (xpm_color_key_strings[i], s) == 0)
+ return i;
+ return -1;
+}
+
+static int
+xpm_load_image (f, img, contents, end)
+ struct frame *f;
+ struct image *img;
+ unsigned char *contents, *end;
+{
+ unsigned char *s = contents, *beg, *str;
+ unsigned char buffer[BUFSIZ];
+ int width, height, x, y;
+ int num_colors, chars_per_pixel;
+ int len, LA1;
+ void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object);
+ Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int);
+ Lisp_Object frame, color_symbols, color_table;
+ int best_key, have_mask = 0;
+ XImagePtr ximg = NULL, mask_img = NULL;
+
+#define match() \
+ LA1 = xpm_scan (&s, end, &beg, &len)
+
+#define expect(TOKEN) \
+ if (LA1 != (TOKEN)) \
+ goto failure; \
+ else \
+ match ()
+
+#define expect_ident(IDENT) \
+ if (LA1 == XPM_TK_IDENT \
+ && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \
+ match (); \
+ else \
+ goto failure
+
+ if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0))
+ goto failure;
+ s += 9;
+ match();
+ expect_ident ("static");
+ expect_ident ("char");
+ expect ('*');
+ expect (XPM_TK_IDENT);
+ expect ('[');
+ expect (']');
+ expect ('=');
+ expect ('{');
+ expect (XPM_TK_STRING);
+ if (len >= BUFSIZ)
+ goto failure;
+ memcpy (buffer, beg, len);
+ buffer[len] = '\0';
+ if (sscanf (buffer, "%d %d %d %d", &width, &height,
+ &num_colors, &chars_per_pixel) != 4
+ || width <= 0 || height <= 0
+ || num_colors <= 0 || chars_per_pixel <= 0)
+ goto failure;
+ expect (',');
+
+ XSETFRAME (frame, f);
+ if (!NILP (Fxw_display_color_p (frame)))
+ best_key = XPM_COLOR_KEY_C;
+ else if (!NILP (Fx_display_grayscale_p (frame)))
+ best_key = (XFASTINT (Fx_display_planes (frame)) > 2
+ ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4);
+ else
+ best_key = XPM_COLOR_KEY_M;
+
+ color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
+ if (chars_per_pixel == 1)
+ color_table = xpm_make_color_table_v (&put_color_table,
+ &get_color_table);
+ else
+ color_table = xpm_make_color_table_h (&put_color_table,
+ &get_color_table);
+
+ while (num_colors-- > 0)
+ {
+ unsigned char *color, *max_color;
+ int key, next_key, max_key = 0;
+ Lisp_Object symbol_color = Qnil, color_val;
+ XColor cdef;
+
+ expect (XPM_TK_STRING);
+ if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel)
+ goto failure;
+ memcpy (buffer, beg + chars_per_pixel, len - chars_per_pixel);
+ buffer[len - chars_per_pixel] = '\0';
+
+ str = strtok (buffer, " \t");
+ if (str == NULL)
+ goto failure;
+ key = xpm_str_to_color_key (str);
+ if (key < 0)
+ goto failure;
+ do
+ {
+ color = strtok (NULL, " \t");
+ if (color == NULL)
+ goto failure;
+
+ while (str = strtok (NULL, " \t"))
+ {
+ next_key = xpm_str_to_color_key (str);
+ if (next_key >= 0)
+ break;
+ color[strlen (color)] = ' ';
+ }
+
+ if (key == XPM_COLOR_KEY_S)
+ {
+ if (NILP (symbol_color))
+ symbol_color = build_string (color);
+ }
+ else if (max_key < key && key <= best_key)
+ {
+ max_key = key;
+ max_color = color;
+ }
+ key = next_key;
+ }
+ while (str);
+
+ color_val = Qnil;
+ if (!NILP (color_symbols) && !NILP (symbol_color))
+ {
+ Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
+
+ if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
+ if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
+ color_val = Qt;
+ else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+ &cdef, 0))
+ color_val = make_number (cdef.pixel);
+ }
+ if (NILP (color_val) && max_key > 0)
+ if (xstricmp (max_color, "None") == 0)
+ color_val = Qt;
+ else if (x_defined_color (f, max_color, &cdef, 0))
+ color_val = make_number (cdef.pixel);
+ if (!NILP (color_val))
+ (*put_color_table) (color_table, beg, chars_per_pixel, color_val);
+
+ expect (',');
+ }
+
+ if (!x_create_x_image_and_pixmap (f, width, height, 0,
+ &ximg, &img->pixmap)
+ || !x_create_x_image_and_pixmap (f, width, height, 1,
+ &mask_img, &img->mask))
+ {
+ image_error ("Out of memory (%s)", img->spec, Qnil);
+ goto error;
+ }
+
+ for (y = 0; y < height; y++)
+ {
+ expect (XPM_TK_STRING);
+ str = beg;
+ if (len < width * chars_per_pixel)
+ goto failure;
+ for (x = 0; x < width; x++, str += chars_per_pixel)
+ {
+ Lisp_Object color_val =
+ (*get_color_table) (color_table, str, chars_per_pixel);
+
+ XPutPixel (ximg, x, y,
+ (INTEGERP (color_val) ? XINT (color_val)
+ : FRAME_FOREGROUND_PIXEL (f)));
+ XPutPixel (mask_img, x, y,
+ (!EQ (color_val, Qt) ? PIX_MASK_DRAW (f)
+ : (have_mask = 1, PIX_MASK_RETAIN (f))));
+ }
+ if (y + 1 < height)
+ expect (',');
+ }
+
+ img->width = width;
+ img->height = height;
+
+ x_put_x_image (f, ximg, img->pixmap, width, height);
+ x_destroy_x_image (ximg);
+ if (have_mask)
+ {
+ x_put_x_image (f, mask_img, img->mask, width, height);
+ x_destroy_x_image (mask_img);
+ }
+ else
+ {
+ x_destroy_x_image (mask_img);
+ Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+ img->mask = NO_PIXMAP;
+ }
+
+ return 1;
+
+ failure:
+ image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+ error:
+ x_destroy_x_image (ximg);
+ x_destroy_x_image (mask_img);
+ x_clear_image (f, img);
+ return 0;
+
+#undef match
+#undef expect
+#undef expect_ident
+}
+
+static int
+xpm_load (f, img)
+ struct frame *f;
+ struct image *img;
+{
+ int success_p = 0;
+ Lisp_Object file_name;
+
+ /* If IMG->spec specifies a file name, create a non-file spec from it. */
+ file_name = image_spec_value (img->spec, QCfile, NULL);
+ if (STRINGP (file_name))
+ {
+ Lisp_Object file;
+ unsigned char *contents;
+ int size;
+ struct gcpro gcpro1;
+
+ file = x_find_image_file (file_name);
+ GCPRO1 (file);
+ if (!STRINGP (file))
+ {
+ image_error ("Cannot find image file `%s'", file_name, Qnil);
+ UNGCPRO;
+ return 0;
+ }
+
+ contents = slurp_file (SDATA (file), &size);
+ if (contents == NULL)
+ {
+ image_error ("Error loading XPM image `%s'", img->spec, Qnil);
+ UNGCPRO;
+ return 0;
+ }
+
+ success_p = xpm_load_image (f, img, contents, contents + size);
+ xfree (contents);
+ UNGCPRO;
+ }
+ else
+ {
+ Lisp_Object data;
+
+ data = image_spec_value (img->spec, QCdata, NULL);
+ success_p = xpm_load_image (f, img, SDATA (data),
+ SDATA (data) + SBYTES (data));
+ }
+
+ return success_p;
+}
+
+#endif /* MAC_OS */
+
+
/***********************************************************************
Color table
@@ -3857,7 +4409,7 @@ lookup_rgb_color (f, r, g, b)
/* Assemble the pixel color. */
return pr | pg | pb;
}
-
+
for (p = ct_table[i]; p; p = p->next)
if (p->r == r && p->g == g && p->b == b)
break;
@@ -4968,7 +5520,7 @@ pbm_load (f, img)
x_destroy_x_image (ximg);
/* X and W32 versions did it here, MAC version above. ++kfs
- img->width = width;
+ img->width = width;
img->height = height; */
UNGCPRO;
@@ -5091,21 +5643,12 @@ DEF_IMGLIB_FN (png_read_end);
DEF_IMGLIB_FN (png_error);
static int
-init_png_functions (void)
+init_png_functions (Lisp_Object libraries)
{
HMODULE library;
- /* Ensure zlib is loaded. Try debug version first. */
- if (!LoadLibrary ("zlibd.dll")
- && !LoadLibrary ("zlib.dll"))
- return 0;
-
/* Try loading libpng under probable names. */
- if (!(library = LoadLibrary ("libpng13d.dll"))
- && !(library = LoadLibrary ("libpng13.dll"))
- && !(library = LoadLibrary ("libpng12d.dll"))
- && !(library = LoadLibrary ("libpng12.dll"))
- && !(library = LoadLibrary ("libpng.dll")))
+ if (!(library = w32_delayed_load (libraries, Qpng)))
return 0;
LOAD_IMGLIB_FN (library, png_get_io_ptr);
@@ -5196,6 +5739,12 @@ struct png_memory_storage
PNG_PTR is a pointer to the PNG control structure. Copy LENGTH
bytes from the input to DATA. */
+#ifdef _MSC_VER
+ /* Work around a problem with MinGW builds of graphics libraries
+ not honoring calling conventions. */
+#pragma optimize("g", off)
+#endif
+
static void
png_read_from_memory (png_ptr, data, length)
png_structp png_ptr;
@@ -5212,6 +5761,11 @@ png_read_from_memory (png_ptr, data, length)
tbr->index = tbr->index + length;
}
+#ifdef _MSC_VER
+/* Restore normal optimization, as specified on the command line. */
+#pragma optimize("", on)
+#endif
+
/* Load PNG image IMG for use on frame F. Value is non-zero if
successful. */
@@ -5412,9 +5966,9 @@ png_load (f, img)
png_color_16 user_bg;
bzero (&user_bg, sizeof user_bg);
- user_bg.red = color.red >> PNG_BG_COLOR_SHIFT;
- user_bg.green = color.green >> PNG_BG_COLOR_SHIFT;
- user_bg.blue = color.blue >> PNG_BG_COLOR_SHIFT;
+ user_bg.red = color.red >> 8;
+ user_bg.green = color.green >> 8;
+ user_bg.blue = color.blue >> 8;
fn_png_set_background (png_ptr, &user_bg,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
@@ -5438,9 +5992,9 @@ png_load (f, img)
x_query_color (f, &color);
bzero (&frame_background, sizeof frame_background);
- frame_background.red = color.red;
- frame_background.green = color.green;
- frame_background.blue = color.blue;
+ frame_background.red = color.red >> 8;
+ frame_background.green = color.green >> 8;
+ frame_background.blue = color.blue >> 8;
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_NTGUI
@@ -5451,9 +6005,9 @@ png_load (f, img)
x_query_color (f, &color);
#endif
bzero (&frame_background, sizeof frame_background);
- frame_background.red = 256 * GetRValue (color);
- frame_background.green = 256 * GetGValue (color);
- frame_background.blue = 256 * GetBValue (color);
+ frame_background.red = GetRValue (color);
+ frame_background.green = GetGValue (color);
+ frame_background.blue = GetBValue (color);
#endif /* HAVE_NTGUI */
#ifdef MAC_OS
@@ -5738,13 +6292,11 @@ DEF_IMGLIB_FN (jpeg_std_error);
DEF_IMGLIB_FN (jpeg_resync_to_restart);
static int
-init_jpeg_functions (void)
+init_jpeg_functions (Lisp_Object libraries)
{
HMODULE library;
- if (!(library = LoadLibrary ("libjpeg.dll"))
- && !(library = LoadLibrary ("jpeg-62.dll"))
- && !(library = LoadLibrary ("jpeg.dll")))
+ if (!(library = w32_delayed_load (libraries, Qjpeg)))
return 0;
LOAD_IMGLIB_FN (library, jpeg_finish_decompress);
@@ -6175,11 +6727,11 @@ DEF_IMGLIB_FN (TIFFReadRGBAImage);
DEF_IMGLIB_FN (TIFFClose);
static int
-init_tiff_functions (void)
+init_tiff_functions (Lisp_Object libraries)
{
HMODULE library;
- if (!(library = LoadLibrary ("libtiff.dll")))
+ if (!(library = w32_delayed_load (libraries, Qtiff)))
return 0;
LOAD_IMGLIB_FN (library, TIFFSetErrorHandler);
@@ -6595,11 +7147,11 @@ DEF_IMGLIB_FN (DGifOpen);
DEF_IMGLIB_FN (DGifOpenFileName);
static int
-init_gif_functions (void)
+init_gif_functions (Lisp_Object libraries)
{
HMODULE library;
- if (!(library = LoadLibrary ("libungif.dll")))
+ if (!(library = w32_delayed_load (libraries, Qgif)))
return 0;
LOAD_IMGLIB_FN (library, DGifCloseFile);
@@ -6875,6 +7427,8 @@ gif_load (f, img)
TimeValue time;
struct gcpro gcpro1;
int ino;
+ CGrafPtr old_port;
+ GDHandle old_gdh;
specified_file = image_spec_value (img->spec, QCfile, NULL);
specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -6992,11 +7546,13 @@ gif_load (f, img)
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
goto error;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximg, NULL);
bg_color.red = color.red;
bg_color.green = color.green;
bg_color.blue = color.blue;
RGBBackColor (&bg_color);
+ SetGWorld (old_port, old_gdh);
SetMovieActive (movie, TRUE);
SetMovieGWorld (movie, ximg, NULL);
SampleNumToMediaTime (media, ino + 1, &time, NULL);
@@ -7368,9 +7924,81 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
Initialization
***********************************************************************/
+#ifdef HAVE_NTGUI
+/* Image types that rely on external libraries are loaded dynamically
+ if the library is available. */
+#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn) \
+ define_image_type (image_type, init_lib_fn (libraries))
+#else
+#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn) \
+ define_image_type (image_type, TRUE)
+#endif /* HAVE_NTGUI */
+
+DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0,
+ doc: /* Initialize image library implementing image type TYPE.
+Return non-nil if TYPE is a supported image type.
+
+Image types pbm and xbm are prebuilt; other types are loaded here.
+Libraries to load are specified in alist LIBRARIES (usually, the value
+of `image-library-alist', which see. */)
+ (type, libraries)
+{
+ Lisp_Object tested;
+
+ /* Don't try to reload the library. */
+ tested = Fassq (type, Vimage_type_cache);
+ if (CONSP (tested))
+ return XCDR (tested);
+
+#if defined (HAVE_XPM) || defined (MAC_OS)
+ if (EQ (type, Qxpm))
+ return CHECK_LIB_AVAILABLE(&xpm_type, init_xpm_functions);
+#endif
+
+#if defined (HAVE_JPEG) || defined (MAC_OS)
+ if (EQ (type, Qjpeg))
+ return CHECK_LIB_AVAILABLE(&jpeg_type, init_jpeg_functions);
+#endif
+
+#if defined (HAVE_TIFF) || defined (MAC_OS)
+ if (EQ (type, Qtiff))
+ return CHECK_LIB_AVAILABLE(&tiff_type, init_tiff_functions);
+#endif
+
+#if defined (HAVE_GIF) || defined (MAC_OS)
+ if (EQ (type, Qgif))
+ return CHECK_LIB_AVAILABLE(&gif_type, init_gif_functions);
+#endif
+
+#if defined (HAVE_PNG) || defined (MAC_OS)
+ if (EQ (type, Qpng))
+ return CHECK_LIB_AVAILABLE(&png_type, init_png_functions);
+#endif
+
+#ifdef HAVE_GHOSTSCRIPT
+ if (EQ (type, Qpostscript))
+ return CHECK_LIB_AVAILABLE(&gs_type, init_gs_functions);
+#endif
+
+ /* If the type is not recognized, avoid testing it ever again. */
+ CACHE_IMAGE_TYPE(type, Qnil);
+ return Qnil;
+}
+
void
syms_of_image ()
{
+ /* Must be defined now becase we're going to update it below, while
+ defining the supported image types. */
+ DEFVAR_LISP ("image-types", &Vimage_types,
+ doc: /* List of potentially supported image types.
+Each element of the list is a symbol for a image type, like 'jpeg or 'png.
+To check whether it is really supported, use `image-type-available-p'. */);
+ Vimage_types = Qnil;
+
+ Vimage_type_cache = Qnil;
+ staticpro (&Vimage_type_cache);
+
QCascent = intern (":ascent");
staticpro (&QCascent);
QCmargin = intern (":margin");
@@ -7404,6 +8032,7 @@ syms_of_image ()
Qpostscript = intern ("postscript");
staticpro (&Qpostscript);
#ifdef HAVE_GHOSTSCRIPT
+ ADD_IMAGE_TYPE(Qpostscript);
QCloader = intern (":loader");
staticpro (&QCloader);
QCbounding_box = intern (":bounding-box");
@@ -7416,35 +8045,43 @@ syms_of_image ()
Qpbm = intern ("pbm");
staticpro (&Qpbm);
+ ADD_IMAGE_TYPE(Qpbm);
Qxbm = intern ("xbm");
staticpro (&Qxbm);
+ ADD_IMAGE_TYPE(Qxbm);
-#ifdef HAVE_XPM
+#if defined (HAVE_XPM) || defined (MAC_OS)
Qxpm = intern ("xpm");
staticpro (&Qxpm);
+ ADD_IMAGE_TYPE(Qxpm);
#endif
#if defined (HAVE_JPEG) || defined (MAC_OS)
Qjpeg = intern ("jpeg");
staticpro (&Qjpeg);
+ ADD_IMAGE_TYPE(Qjpeg);
#endif
#if defined (HAVE_TIFF) || defined (MAC_OS)
Qtiff = intern ("tiff");
staticpro (&Qtiff);
+ ADD_IMAGE_TYPE(Qtiff);
#endif
#if defined (HAVE_GIF) || defined (MAC_OS)
Qgif = intern ("gif");
staticpro (&Qgif);
+ ADD_IMAGE_TYPE(Qgif);
#endif
#if defined (HAVE_PNG) || defined (MAC_OS)
Qpng = intern ("png");
staticpro (&Qpng);
+ ADD_IMAGE_TYPE(Qpng);
#endif
+ defsubr (&Sinit_image_library);
defsubr (&Sclear_image_cache);
defsubr (&Simage_size);
defsubr (&Simage_mask_p);
@@ -7472,52 +8109,13 @@ meaning don't clear the cache. */);
Vimage_cache_eviction_delay = make_number (30 * 60);
}
-
-#ifdef HAVE_NTGUI
-/* Image types that rely on external libraries are loaded dynamically
- if the library is available. */
-#define IF_LIB_AVAILABLE(init_lib_fn) if (init_lib_fn())
-#else
-#define IF_LIB_AVAILABLE(init_func) /* Load unconditionally */
-#endif /* HAVE_NTGUI */
-
void
init_image ()
{
image_types = NULL;
- Vimage_types = Qnil;
-
- define_image_type (&xbm_type);
- define_image_type (&pbm_type);
-#ifdef HAVE_XPM
- IF_LIB_AVAILABLE(init_xpm_functions)
- define_image_type (&xpm_type);
-#endif
-
-#if defined (HAVE_JPEG) || defined (MAC_OS)
- IF_LIB_AVAILABLE(init_jpeg_functions)
- define_image_type (&jpeg_type);
-#endif
-
-#if defined (HAVE_TIFF) || defined (MAC_OS)
- IF_LIB_AVAILABLE(init_tiff_functions)
- define_image_type (&tiff_type);
-#endif
-
-#if defined (HAVE_GIF) || defined (MAC_OS)
- IF_LIB_AVAILABLE(init_gif_functions)
- define_image_type (&gif_type);
-#endif
-
-#if defined (HAVE_PNG) || defined (MAC_OS)
- IF_LIB_AVAILABLE(init_png_functions)
- define_image_type (&png_type);
-#endif
-
-#ifdef HAVE_GHOSTSCRIPT
- define_image_type (&gs_type);
-#endif
+ define_image_type (&xbm_type, TRUE);
+ define_image_type (&pbm_type, TRUE);
#ifdef MAC_OS
/* Animated gifs use QuickTime Movie Toolbox. So initialize it here. */
diff --git a/src/indent.c b/src/indent.c
index 15e433b03d9..a5de1431e4b 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,5 +1,5 @@
/* Indentation functions.
- Copyright (C) 1985,86,87,88,93,94,95,98,2000,01,02,2003
+ Copyright (C) 1985,86,87,88,93,94,95,98,2000,01,02,03,2004
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -1407,6 +1407,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
vpos++;
contin_hpos = prev_hpos;
prev_hpos = 0;
+ prev_vpos = vpos;
}
}
diff --git a/src/insdel.c b/src/insdel.c
index b1ba5a554a8..5a4dc5b64a8 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1589,7 +1589,7 @@ replace_range (from, to, new, prepare, inherit, markers)
Z_BYTE -= nbytes_del;
GPT = from;
GPT_BYTE = from_byte;
- *(GPT_ADDR) = 0; /* Put an anchor. */
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
if (GPT_BYTE < GPT)
abort ();
@@ -1872,7 +1872,7 @@ del_range_2 (from, from_byte, to, to_byte, ret_string)
Z -= nchars_del;
GPT = from;
GPT_BYTE = from_byte;
- *(GPT_ADDR) = 0; /* Put an anchor. */
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
if (GPT_BYTE < GPT)
abort ();
diff --git a/src/intervals.c b/src/intervals.c
index d87b361a223..ade15360c9f 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1899,11 +1899,13 @@ lookup_char_property (plist, prop, textprop)
return fallback;
/* Check for alternative properties */
tail = Fassq (prop, Vchar_property_alias_alist);
- if (NILP (tail))
- return tail;
- tail = XCDR (tail);
- for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail))
- fallback = Fplist_get (plist, XCAR (tail));
+ if (! NILP (tail))
+ {
+ tail = XCDR (tail);
+ for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail))
+ fallback = Fplist_get (plist, XCAR (tail));
+ }
+
if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties))
fallback = Fplist_get (Vdefault_text_properties, prop);
return fallback;
diff --git a/src/keyboard.c b/src/keyboard.c
index 62017cec7b3..469b15fb683 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -117,6 +117,8 @@ struct backtrace
args points to slot holding list of
unevalled args */
char evalargs;
+ /* Nonzero means call value of debugger when done with this operation. */
+ char debug_on_exit;
};
#ifdef MULTI_KBOARD
@@ -679,6 +681,8 @@ static SIGTYPE interrupt_signal P_ ((int signalnum));
to support it. */
static int cannot_suspend;
+extern Lisp_Object Qidentity, Qonly;
+
/* Install the string STR as the beginning of the string of echoing,
so that it serves as a prompt for the next character.
Also start echoing. */
@@ -996,6 +1000,11 @@ This function is called by the editor initialization to begin editing. */)
int count = SPECPDL_INDEX ();
Lisp_Object buffer;
+ /* If we enter while input is blocked, don't lock up here.
+ This may happen through the debugger during redisplay. */
+ if (INPUT_BLOCKED_P)
+ return Qnil;
+
command_loop_level++;
update_mode_lines = 1;
@@ -1151,7 +1160,8 @@ cmd_error (data)
Vinhibit_quit = Qnil;
#ifdef MULTI_KBOARD
- any_kboard_state ();
+ if (command_loop_level == 0 && minibuf_level == 0)
+ any_kboard_state ();
#endif
return make_number (0);
@@ -1240,6 +1250,10 @@ command_loop ()
while (1)
{
internal_catch (Qtop_level, top_level_1, Qnil);
+ /* Reset single_kboard in case top-level set it while
+ evaluating an -f option, or we are stuck there for some
+ other reason. */
+ any_kboard_state ();
internal_catch (Qtop_level, command_loop_2, Qnil);
executing_macro = Qnil;
@@ -1294,6 +1308,12 @@ DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "",
if (display_hourglass_p)
cancel_hourglass ();
#endif
+
+ /* Unblock input if we enter with input blocked. This may happen if
+ redisplay traps e.g. during tool-bar update with input blocked. */
+ while (INPUT_BLOCKED_P)
+ UNBLOCK_INPUT;
+
return Fthrow (Qtop_level, Qnil);
}
@@ -1804,6 +1824,16 @@ command_loop_1 ()
call1 (Vrun_hooks, intern ("activate-mark-hook"));
}
+ /* Setting transient-mark-mode to `only' is a way of
+ turning it on for just one command. */
+ if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
+ {
+ if (EQ (Vtransient_mark_mode, Qidentity))
+ Vtransient_mark_mode = Qnil;
+ if (EQ (Vtransient_mark_mode, Qonly))
+ Vtransient_mark_mode = Qidentity;
+ }
+
finalize:
if (current_buffer == prev_buffer
@@ -3967,9 +3997,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
else if (event->kind == LANGUAGE_CHANGE_EVENT)
{
/* Make an event (language-change (FRAME CHARSET LCID)). */
- obj = Fcons (event->modifiers, Qnil);
- obj = Fcons (event->code, obj);
- obj = Fcons (event->frame_or_window, obj);
+ obj = Fcons (event->frame_or_window, Qnil);
obj = Fcons (Qlanguage_change, Fcons (obj, Qnil));
kbd_fetch_ptr = event + 1;
}
@@ -6245,14 +6273,8 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
{
int len = SBYTES (name_alist_or_stem);
char *buf = (char *) alloca (len + 50);
- if (sizeof (int) == sizeof (EMACS_INT))
- sprintf (buf, "%s-%d", SDATA (name_alist_or_stem),
- XINT (symbol_int) + 1);
- else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem),
- XINT (symbol_int) + 1);
- else
- abort ();
+ sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem),
+ (long) XINT (symbol_int) + 1);
value = intern (buf);
}
else if (name_table != 0 && name_table[symbol_num])
@@ -7409,7 +7431,7 @@ parse_menu_item (item, notreal, inmenubar)
newcache = chkcache;
if (chkcache)
{
- tem = Fkey_description (tem);
+ tem = Fkey_description (tem, Qnil);
if (CONSP (prefix))
{
if (STRINGP (XCAR (prefix)))
@@ -9667,6 +9689,7 @@ a special event, so ignore the prefix argument and don't clear it. */)
backtrace.args = &cmd;
backtrace.nargs = 1;
backtrace.evalargs = 0;
+ backtrace.debug_on_exit = 0;
tem = Fcall_interactively (cmd, record_flag, keys);
@@ -9703,23 +9726,9 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4)
strcpy (buf, "C-u ");
else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg)))
- {
- if (sizeof (int) == sizeof (EMACS_INT))
- sprintf (buf, "%d ", XINT (XCAR (prefixarg)));
- else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
- else
- abort ();
- }
+ sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
else if (INTEGERP (prefixarg))
- {
- if (sizeof (int) == sizeof (EMACS_INT))
- sprintf (buf, "%d ", XINT (prefixarg));
- else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%ld ", (long) XINT (prefixarg));
- else
- abort ();
- }
+ sprintf (buf, "%ld ", (long) XINT (prefixarg));
/* This isn't strictly correct if execute-extended-command
is bound to anything else. Perhaps it should use
@@ -9807,7 +9816,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
int count = SPECPDL_INDEX ();
record_unwind_protect (pop_message_unwind, Qnil);
- binding = Fkey_description (bindings);
+ binding = Fkey_description (bindings, Qnil);
newmessage
= (char *) alloca (SCHARS (SYMBOL_NAME (function))
@@ -10490,6 +10499,61 @@ The elements of this list correspond to the arguments of
return Flist (sizeof (val) / sizeof (val[0]), val);
}
+DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 3, 0,
+ doc: /* Return position information for pixel coordinates X and Y.
+By default, X and Y are relative to text area of the selected window.
+Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window.
+
+The return value is similar to a mouse click position:
+ (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
+ IMAGE (DX . DY) (WIDTH . HEIGHT))
+The `posn-' functions access elements of such lists. */)
+ (x, y, frame_or_window)
+ Lisp_Object x, y, frame_or_window;
+{
+ if (NILP (frame_or_window))
+ frame_or_window = selected_window;
+
+ if (WINDOWP (frame_or_window))
+ {
+ struct window *w;
+
+ CHECK_LIVE_WINDOW (frame_or_window);
+
+ w = XWINDOW (frame_or_window);
+ XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x))
+ + window_box_left_offset (w, TEXT_AREA)));
+ XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
+ frame_or_window = w->frame;
+ }
+
+ CHECK_LIVE_FRAME (frame_or_window);
+
+ return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0);
+}
+
+DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0,
+ doc: /* Return position information for buffer POS in WINDOW.
+POS defaults to point in WINDOW; WINDOW defaults to the selected window.
+
+Return nil if position is not visible in window. Otherwise,
+the return value is similar to that returned by `event-start' for
+a mouse click at the upper left corner of the glyph corresponding
+to the given buffer position:
+ (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
+ IMAGE (DX . DY) (WIDTH . HEIGHT))
+The `posn-' functions access elements of such lists. */*/)
+ (pos, window)
+ Lisp_Object pos, window;
+{
+ Lisp_Object tem;
+
+ tem = Fpos_visible_in_window_p (pos, window, Qt);
+ if (!NILP (tem))
+ tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window);
+ return tem;
+}
+
/*
* Set up a new kboard object with reasonable initial values.
@@ -10913,6 +10977,8 @@ syms_of_keyboard ()
defsubr (&Sset_input_mode);
defsubr (&Scurrent_input_mode);
defsubr (&Sexecute_extended_command);
+ defsubr (&Sposn_at_point);
+ defsubr (&Sposn_at_x_y);
DEFVAR_LISP ("last-command-char", &last_command_char,
doc: /* Last input event that was part of a command. */);
@@ -11357,8 +11423,11 @@ mark_kboards ()
{
if (event == kbd_buffer + KBD_BUFFER_SIZE)
event = kbd_buffer;
- mark_object (event->x);
- mark_object (event->y);
+ if (event->kind != SELECTION_REQUEST_EVENT)
+ {
+ mark_object (event->x);
+ mark_object (event->y);
+ }
mark_object (event->frame_or_window);
mark_object (event->arg);
}
diff --git a/src/keymap.c b/src/keymap.c
index 62ea237b85c..fbf1263a71b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -122,6 +122,9 @@ static void describe_translation P_ ((Lisp_Object, Lisp_Object));
static void describe_map P_ ((Lisp_Object, Lisp_Object,
void (*) P_ ((Lisp_Object, Lisp_Object)),
int, Lisp_Object, Lisp_Object*, int));
+static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
+ void (*) (Lisp_Object, Lisp_Object), int,
+ Lisp_Object, Lisp_Object, int *, int, int));
static void silly_event_symbol_error P_ ((Lisp_Object));
/* Keymap object support - constructors and predicates. */
@@ -1098,15 +1101,15 @@ event type that has no other definition in this keymap.
DEF is anything that can be a key's definition:
nil (means key is undefined in this keymap),
- a command (a Lisp function suitable for interactive calling)
+ a command (a Lisp function suitable for interactive calling),
a string (treated as a keyboard macro),
a keymap (to define a prefix key),
- a symbol. When the key is looked up, the symbol will stand for its
+ a symbol (when the key is looked up, the symbol will stand for its
function definition, which should at that time be one of the above,
- or another symbol whose function definition is used, etc.
+ or another symbol whose function definition is used, etc.),
a cons (STRING . DEFN), meaning that DEFN is the definition
(DEFN should be a valid definition in its own right),
- or a cons (KEYMAP . CHAR), meaning use definition of CHAR in map KEYMAP.
+ or a cons (MAP . CHAR), meaning use definition of CHAR in keymap MAP.
If KEYMAP is a sparse keymap with a binding for KEY, the existing
binding is altered. If there is no binding for KEY, the new pair
@@ -1193,7 +1196,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
/* We must use Fkey_description rather than just passing key to
error; key might be a vector, not a string. */
error ("Key sequence %s uses invalid prefix characters",
- SDATA (Fkey_description (key)));
+ SDATA (Fkey_description (key, Qnil)));
}
}
@@ -1653,7 +1656,7 @@ DEFUN ("global-key-binding", Fglobal_key_binding, Sglobal_key_binding, 1, 2, 0,
doc: /* Return the binding for command KEYS in current global keymap only.
KEYS is a string, a sequence of keystrokes.
The binding is probably a symbol with a function definition.
-This function's return values are the same as those of lookup-key
+This function's return values are the same as those of `lookup-key'
\(which see).
If optional argument ACCEPT-DEFAULT is non-nil, recognize default
@@ -1974,78 +1977,109 @@ Lisp_Object Qsingle_key_description, Qkey_description;
/* This function cannot GC. */
-DEFUN ("key-description", Fkey_description, Skey_description, 1, 1, 0,
+DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0,
doc: /* Return a pretty description of key-sequence KEYS.
-Control characters turn into "C-foo" sequences, meta into "M-foo"
+Optional arg PREFIX is the sequence of keys leading up to KEYS.
+Control characters turn into "C-foo" sequences, meta into "M-foo",
spaces are put between sequence elements, etc. */)
- (keys)
- Lisp_Object keys;
+ (keys, prefix)
+ Lisp_Object keys, prefix;
{
int len = 0;
int i, i_byte;
- Lisp_Object sep;
- Lisp_Object *args = NULL;
+ Lisp_Object *args;
+ int size = XINT (Flength (keys));
+ Lisp_Object list;
+ Lisp_Object sep = build_string (" ");
+ Lisp_Object key;
+ int add_meta = 0;
+
+ if (!NILP (prefix))
+ size += XINT (Flength (prefix));
+
+ /* This has one extra element at the end that we don't pass to Fconcat. */
+ args = (Lisp_Object *) alloca (size * 4 * sizeof (Lisp_Object));
- if (STRINGP (keys))
+ /* In effect, this computes
+ (mapconcat 'single-key-description keys " ")
+ but we shouldn't use mapconcat because it can do GC. */
+
+ next_list:
+ if (!NILP (prefix))
+ list = prefix, prefix = Qnil;
+ else if (!NILP (keys))
+ list = keys, keys = Qnil;
+ else
{
- Lisp_Object vector;
- vector = Fmake_vector (Flength (keys), Qnil);
- for (i = 0, i_byte = 0; i < SCHARS (keys); )
+ if (add_meta)
{
- int c;
- int i_before = i;
-
- FETCH_STRING_CHAR_ADVANCE (c, keys, i, i_byte);
- if (SINGLE_BYTE_CHAR_P (c) && (c & 0200))
- c ^= 0200 | meta_modifier;
- XSETFASTINT (AREF (vector, i_before), c);
+ args[len] = Fsingle_key_description (meta_prefix_char, Qnil);
+ len += 2;
}
- keys = vector;
+ else if (len == 0)
+ return empty_string;
+ return Fconcat (len - 1, args);
}
- if (VECTORP (keys))
- {
- /* In effect, this computes
- (mapconcat 'single-key-description keys " ")
- but we shouldn't use mapconcat because it can do GC. */
+ if (STRINGP (list))
+ size = SCHARS (list);
+ else if (VECTORP (list))
+ size = XVECTOR (list)->size;
+ else if (CONSP (list))
+ size = XINT (Flength (list));
+ else
+ wrong_type_argument (Qarrayp, list);
- len = XVECTOR (keys)->size;
- sep = build_string (" ");
- /* This has one extra element at the end that we don't pass to Fconcat. */
- args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object));
+ i = i_byte = 0;
- for (i = 0; i < len; i++)
+ while (i < size)
+ {
+ if (STRINGP (list))
{
- args[i * 2] = Fsingle_key_description (AREF (keys, i), Qnil);
- args[i * 2 + 1] = sep;
+ int c;
+ FETCH_STRING_CHAR_ADVANCE (c, list, i, i_byte);
+ if (SINGLE_BYTE_CHAR_P (c) && (c & 0200))
+ c ^= 0200 | meta_modifier;
+ XSETFASTINT (key, c);
+ }
+ else if (VECTORP (list))
+ {
+ key = AREF (list, i++);
+ }
+ else
+ {
+ key = XCAR (list);
+ list = XCDR (list);
+ i++;
}
- }
- else if (CONSP (keys))
- {
- /* In effect, this computes
- (mapconcat 'single-key-description keys " ")
- but we shouldn't use mapconcat because it can do GC. */
-
- len = XFASTINT (Flength (keys));
- sep = build_string (" ");
- /* This has one extra element at the end that we don't pass to Fconcat. */
- args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object));
- for (i = 0; i < len; i++)
+ if (add_meta)
+ {
+ if (!INTEGERP (key)
+ || EQ (key, meta_prefix_char)
+ || (XINT (key) & meta_modifier))
+ {
+ args[len++] = Fsingle_key_description (meta_prefix_char, Qnil);
+ args[len++] = sep;
+ if (EQ (key, meta_prefix_char))
+ continue;
+ }
+ else
+ XSETINT (key, (XINT (key) | meta_modifier) & ~0x80);
+ add_meta = 0;
+ }
+ else if (EQ (key, meta_prefix_char))
{
- args[i * 2] = Fsingle_key_description (XCAR (keys), Qnil);
- args[i * 2 + 1] = sep;
- keys = XCDR (keys);
+ add_meta = 1;
+ continue;
}
+ args[len++] = Fsingle_key_description (key, Qnil);
+ args[len++] = sep;
}
- else
- keys = wrong_type_argument (Qarrayp, keys);
-
- if (len == 0)
- return empty_string;
- return Fconcat (len * 2 - 1, args);
+ goto next_list;
}
+
char *
push_key_description (c, p, force_multibyte)
register unsigned int c;
@@ -2926,7 +2960,7 @@ key binding\n\
if (!NILP (prefix))
{
insert_string (" Starting With ");
- insert1 (Fkey_description (prefix));
+ insert1 (Fkey_description (prefix, Qnil));
}
insert_string (":\n");
}
@@ -3051,7 +3085,7 @@ describe_translation (definition, args)
}
else if (STRINGP (definition) || VECTORP (definition))
{
- insert1 (Fkey_description (definition));
+ insert1 (Fkey_description (definition, Qnil));
insert_string ("\n");
}
else if (KEYMAPP (definition))
@@ -3061,20 +3095,19 @@ describe_translation (definition, args)
}
/* Describe the contents of map MAP, assuming that this map itself is
- reached by the sequence of prefix keys KEYS (a string or vector).
+ reached by the sequence of prefix keys PREFIX (a string or vector).
PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */
static void
-describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
+describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu)
register Lisp_Object map;
- Lisp_Object keys;
+ Lisp_Object prefix;
void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
int partial;
Lisp_Object shadow;
Lisp_Object *seen;
int nomenu;
{
- Lisp_Object elt_prefix;
Lisp_Object tail, definition, event;
Lisp_Object tem;
Lisp_Object suppress;
@@ -3084,15 +3117,6 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
suppress = Qnil;
- if (!NILP (keys) && XFASTINT (Flength (keys)) > 0)
- {
- /* Call Fkey_description first, to avoid GC bug for the other string. */
- tem = Fkey_description (keys);
- elt_prefix = concat2 (tem, build_string (" "));
- }
- else
- elt_prefix = Qnil;
-
if (partial)
suppress = intern ("suppress-keymap");
@@ -3102,7 +3126,7 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
kludge = Fmake_vector (make_number (1), Qnil);
definition = Qnil;
- GCPRO3 (elt_prefix, definition, kludge);
+ GCPRO3 (prefix, definition, kludge);
for (tail = map; CONSP (tail); tail = XCDR (tail))
{
@@ -3111,13 +3135,13 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
if (VECTORP (XCAR (tail))
|| CHAR_TABLE_P (XCAR (tail)))
describe_vector (XCAR (tail),
- elt_prefix, Qnil, elt_describer, partial, shadow, map,
- (int *)0, 0);
+ prefix, Qnil, elt_describer, partial, shadow, map,
+ (int *)0, 0, 1);
else if (CONSP (XCAR (tail)))
{
event = XCAR (XCAR (tail));
- /* Ignore bindings whose "keys" are not really valid events.
+ /* Ignore bindings whose "prefix" are not really valid events.
(We get these in the frames and buffers menu.) */
if (!(SYMBOLP (event) || INTEGERP (event)))
continue;
@@ -3156,11 +3180,8 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
first = 0;
}
- if (!NILP (elt_prefix))
- insert1 (elt_prefix);
-
/* THIS gets the string to describe the character EVENT. */
- insert1 (Fsingle_key_description (event, Qnil));
+ insert1 (Fkey_description (kludge, prefix));
/* Print a description of the definition of this character.
elt_describer will take care of spacing out far enough
@@ -3173,9 +3194,9 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu)
using an inherited keymap. So skip anything we've already
encountered. */
tem = Fassq (tail, *seen);
- if (CONSP (tem) && !NILP (Fequal (XCAR (tem), keys)))
+ if (CONSP (tem) && !NILP (Fequal (XCAR (tem), prefix)))
break;
- *seen = Fcons (Fcons (tail, keys), *seen);
+ *seen = Fcons (Fcons (tail, prefix), *seen);
}
}
@@ -3193,7 +3214,8 @@ describe_vector_princ (elt, fun)
DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0,
doc: /* Insert a description of contents of VECTOR.
-This is text showing the elements of vector matched against indices. */)
+This is text showing the elements of vector matched against indices.
+DESCRIBER is the output function used; nil means use `princ'. */)
(vector, describer)
Lisp_Object vector, describer;
{
@@ -3203,7 +3225,7 @@ This is text showing the elements of vector matched against indices. */)
specbind (Qstandard_output, Fcurrent_buffer ());
CHECK_VECTOR_OR_CHAR_TABLE (vector);
describe_vector (vector, Qnil, describer, describe_vector_princ, 0,
- Qnil, Qnil, (int *)0, 0);
+ Qnil, Qnil, (int *)0, 0, 0);
return unbind_to (count, Qnil);
}
@@ -3237,42 +3259,60 @@ This is text showing the elements of vector matched against indices. */)
ARGS is simply passed as the second argument to ELT_DESCRIBER.
INDICES and CHAR_TABLE_DEPTH are ignored. They will be removed in
- the near future. */
+ the near future.
-void
-describe_vector (vector, elt_prefix, args, elt_describer,
+ KEYMAP_P is 1 if vector is known to be a keymap, so map ESC to M-.
+
+ ARGS is simply passed as the second argument to ELT_DESCRIBER. */
+
+static void
+describe_vector (vector, prefix, args, elt_describer,
partial, shadow, entire_map,
- indices, char_table_depth)
+ indices, char_table_depth, keymap_p)
register Lisp_Object vector;
- Lisp_Object elt_prefix, args;
+ Lisp_Object prefix, args;
void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
int partial;
Lisp_Object shadow;
Lisp_Object entire_map;
int *indices;
int char_table_depth;
+ int keymap_p;
{
Lisp_Object definition;
Lisp_Object tem2;
+ Lisp_Object elt_prefix = Qnil;
int i;
Lisp_Object suppress;
Lisp_Object kludge;
- struct gcpro gcpro1, gcpro2, gcpro3;
+ int first = 1;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
/* Range of elements to be handled. */
int from, to;
Lisp_Object character;
int starting_i;
- int first = 1;
suppress = Qnil;
definition = Qnil;
+ if (!keymap_p)
+ {
+ /* Call Fkey_description first, to avoid GC bug for the other string. */
+ if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0)
+ {
+ Lisp_Object tem;
+ tem = Fkey_description (prefix, Qnil);
+ elt_prefix = concat2 (tem, build_string (" "));
+ }
+ prefix = Qnil;
+ }
+
/* This vector gets used to present single keys to Flookup_key. Since
that is done once per vector element, we don't want to cons up a
fresh vector every time. */
kludge = Fmake_vector (make_number (1), Qnil);
- GCPRO3 (elt_prefix, definition, kludge);
+ GCPRO4 (elt_prefix, prefix, definition, kludge);
if (partial)
suppress = intern ("suppress-keymap");
@@ -3308,13 +3348,13 @@ describe_vector (vector, elt_prefix, args, elt_describer,
}
character = make_number (starting_i);
+ ASET (kludge, 0, character);
/* If this binding is shadowed by some other map, ignore it. */
if (!NILP (shadow))
{
Lisp_Object tem;
- ASET (kludge, 0, character);
tem = shadow_lookup (shadow, kludge, Qt);
if (!NILP (tem)) continue;
@@ -3326,7 +3366,6 @@ describe_vector (vector, elt_prefix, args, elt_describer,
{
Lisp_Object tem;
- ASET (kludge, 0, character);
tem = Flookup_key (entire_map, kludge, Qt);
if (!EQ (tem, definition))
@@ -3343,7 +3382,7 @@ describe_vector (vector, elt_prefix, args, elt_describer,
if (!NILP (elt_prefix))
insert1 (elt_prefix);
- insert1 (Fsingle_key_description (character, Qnil));
+ insert1 (Fkey_description (kludge, prefix));
/* Find all consecutive characters or rows that have the same
definition. But, for elements of a top level char table, if
@@ -3371,10 +3410,12 @@ describe_vector (vector, elt_prefix, args, elt_describer,
{
insert (" .. ", 4);
+ ASET (kludge, 0, make_number (i));
+
if (!NILP (elt_prefix))
insert1 (elt_prefix);
- insert1 (Fsingle_key_description (make_number (i), Qnil));
+ insert1 (Fkey_description (kludge, prefix));
}
/* Print a description of the definition of this character.
diff --git a/src/keymap.h b/src/keymap.h
index 2a34061593f..214ba605c76 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -30,15 +30,12 @@ EXFUN (Fdefine_key, 3);
EXFUN (Flookup_key, 3);
EXFUN (Fcommand_remapping, 1);
EXFUN (Fkey_binding, 3);
-EXFUN (Fkey_description, 1);
+EXFUN (Fkey_description, 2);
EXFUN (Fsingle_key_description, 2);
EXFUN (Fwhere_is_internal, 5);
extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
-extern void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
- void (*) (Lisp_Object, Lisp_Object), int,
- Lisp_Object, Lisp_Object, int *, int));
extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object,
char *, int, int, int));
extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **));
diff --git a/src/lisp.h b/src/lisp.h
index 6f248df0a3c..7e39313a7fc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -279,26 +279,57 @@ enum pvec_type
/* For convenience, we also store the number of elements in these bits. */
#define PSEUDOVECTOR_SIZE_MASK 0x1ff
+
+/* Number of bits to put in each character in the internal representation
+ of bool vectors. This should not vary across implementations. */
+#define BOOL_VECTOR_BITS_PER_CHAR 8
/***** Select the tagging scheme. *****/
+/* There are basically two options that control the tagging scheme:
+ - NO_UNION_TYPE says that Lisp_Object should be an integer instead
+ of a union.
+ - USE_LSB_TAG means that we can assume the least 3 bits of pointers are
+ always 0, and we can thus use them to hold tag bits, without
+ restricting our addressing space.
+
+ If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus
+ restricting our possible address range. Currently USE_LSB_TAG is not
+ allowed together with a union. This is not due to any fundamental
+ technical (or political ;-) problem: nobody wrote the code to do it yet.
+
+ USE_LSB_TAG not only requires the least 3 bits of pointers returned by
+ malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
+ on the few static Lisp_Objects used: all the defsubr as well
+ as the two special buffers buffer_defaults and buffer_local_symbols. */
/* First, try and define DECL_ALIGN(type,var) which declares a static
variable VAR of type TYPE with the added requirement that it be
TYPEBITS-aligned. */
-#if defined USE_LSB_TAG && !defined DECL_ALIGN
+#ifndef DECL_ALIGN
/* What compiler directive should we use for non-gcc compilers? -stef */
# if defined (__GNUC__)
# define DECL_ALIGN(type, var) \
type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
-# else
-# error "USE_LSB_TAG used without defining DECL_ALIGN"
# endif
#endif
-#ifndef USE_LSB_TAG
+/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */
+#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX
+/* We also need to be able to specify mult-of-8 alignment on static vars. */
+# if defined DECL_ALIGN
+/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */
+# if defined NO_UNION_TYPE
+# define USE_LSB_TAG
+# endif
+# endif
+#endif
+
/* Just remove the alignment annotation if we don't use it. */
-#undef DECL_ALIGN
-#define DECL_ALIGN(type, var) type var
+#ifndef DECL_ALIGN
+# ifdef USE_LSB_TAG
+# error "USE_LSB_TAG used without defining DECL_ALIGN"
+# endif
+# define DECL_ALIGN(type, var) type var
#endif
@@ -383,7 +414,7 @@ enum pvec_type
#ifdef EXPLICIT_SIGN_EXTEND
/* Make sure we sign-extend; compilers have been known to fail to do so. */
-#define XINT(a) (((a).i << (BITS_PER_EMACS_INT - VALBITS)) \
+#define XINT(a) (((a).s.val << (BITS_PER_EMACS_INT - VALBITS)) \
>> (BITS_PER_EMACS_INT - VALBITS))
#else
#define XINT(a) ((a).s.val)
@@ -401,7 +432,7 @@ enum pvec_type
extern Lisp_Object make_number ();
#endif
-#define EQ(x, y) ((x).s.val == (y).s.val)
+#define EQ(x, y) ((x).s.val == (y).s.val && (x).s.type == (y).s.type)
#endif /* NO_UNION_TYPE */
@@ -2408,7 +2439,8 @@ void set_frame_cursor_types P_ ((struct frame *, Lisp_Object));
extern void syms_of_xdisp P_ ((void));
extern void init_xdisp P_ ((void));
extern Lisp_Object safe_eval P_ ((Lisp_Object));
-extern int pos_visible_p P_ ((struct window *, int, int *, int));
+extern int pos_visible_p P_ ((struct window *, int, int *,
+ int *, int *, int));
/* Defined in vm-limit.c. */
extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
@@ -2779,6 +2811,7 @@ extern void syms_of_fileio P_ ((void));
EXFUN (Fmake_temp_name, 1);
extern void init_fileio_once P_ ((void));
extern Lisp_Object make_temp_name P_ ((Lisp_Object, int));
+EXFUN (Fmake_symbolic_link, 3);
/* Defined in abbrev.c */
@@ -2892,6 +2925,10 @@ extern int indented_beyond_p P_ ((int, int, double));
extern void syms_of_indent P_ ((void));
/* defined in frame.c */
+#ifdef HAVE_WINDOW_SYSTEM
+extern Lisp_Object Vx_resource_name;
+extern Lisp_Object Vx_resource_class;
+#endif /* HAVE_WINDOW_SYSTEM */
extern Lisp_Object Qvisible;
extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object));
extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object));
@@ -3013,7 +3050,7 @@ extern void syms_of_macros P_ ((void));
/* defined in undo.c */
extern Lisp_Object Qinhibit_read_only;
EXFUN (Fundo_boundary, 0);
-extern Lisp_Object truncate_undo_list P_ ((Lisp_Object, int, int));
+extern Lisp_Object truncate_undo_list P_ ((Lisp_Object, int, int, int));
extern void record_marker_adjustment P_ ((Lisp_Object, int));
extern void record_insert P_ ((int, int));
extern void record_delete P_ ((int, Lisp_Object));
@@ -3115,11 +3152,12 @@ extern int getloadavg P_ ((double *, int));
#ifdef HAVE_X_WINDOWS
/* Defined in xfns.c */
extern void syms_of_xfns P_ ((void));
-extern Lisp_Object Vx_resource_name;
-extern Lisp_Object Vx_resource_class;
+#endif /* HAVE_X_WINDOWS */
+#ifdef HAVE_WINDOW_SYSTEM
+/* Defined in xfns.c, w32fns.c, or macfns.c */
EXFUN (Fxw_display_color_p, 1);
EXFUN (Fx_file_dialog, 4);
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
/* Defined in xsmfns.c */
extern void syms_of_xsmfns P_ ((void));
@@ -3145,9 +3183,7 @@ extern void xfree P_ ((POINTER_TYPE *));
extern char *xstrdup P_ ((const char *));
-#ifndef USE_CRT_DLL
extern char *egetenv P_ ((char *));
-#endif
/* Set up the name of the machine we're running on. */
extern void init_system_name P_ ((void));
@@ -3228,6 +3264,32 @@ extern Lisp_Object Vdirectory_sep_char;
? make_float (val) \
: make_number ((EMACS_INT)(val)))
+
+/* Checks the `cycle check' variable CHECK to see if it indicates that
+ EL is part of a cycle; CHECK must be either Qnil or a value returned
+ by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of
+ elements after which a cycle might be suspected; after that many
+ elements, this macro begins consing in order to keep more precise
+ track of elements.
+
+ Returns nil if a cycle was detected, otherwise a new value for CHECK
+ that includes EL.
+
+ CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so
+ the caller should make sure that's ok. */
+
+#define CYCLE_CHECK(check, el, suspicious) \
+ (NILP (check) \
+ ? make_number (0) \
+ : (INTEGERP (check) \
+ ? (XFASTINT (check) < (suspicious) \
+ ? make_number (XFASTINT (check) + 1) \
+ : Fcons (el, Qnil)) \
+ : (!NILP (Fmemq ((el), (check))) \
+ ? Qnil \
+ : Fcons ((el), (check)))))
+
+
#endif /* EMACS_LISP_H */
/* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e
diff --git a/src/lread.c b/src/lread.c
index dd6e3f322a6..d3014eb7eb6 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2122,8 +2122,9 @@ read1 (readcharfun, pch, first_in_list)
if (c == '"')
{
Lisp_Object tmp, val;
- int size_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1)
- / BITS_PER_CHAR);
+ int size_in_chars
+ = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
UNREAD (c);
tmp = read1 (readcharfun, pch, first_in_list);
@@ -2134,7 +2135,7 @@ read1 (readcharfun, pch, first_in_list)
Accept such input in case it came from an old
version. */
&& ! (XFASTINT (length)
- == (SCHARS (tmp) - 1) * BITS_PER_CHAR)))
+ == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)))
Fsignal (Qinvalid_read_syntax,
Fcons (make_string ("#&...", 5), Qnil));
@@ -2142,9 +2143,9 @@ read1 (readcharfun, pch, first_in_list)
bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
size_in_chars);
/* Clear the extraneous bits in the last byte. */
- if (XINT (length) != size_in_chars * BITS_PER_CHAR)
+ if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
XBOOL_VECTOR (val)->data[size_in_chars - 1]
- &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1;
+ &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
return val;
}
Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&...", 5),
@@ -3814,11 +3815,15 @@ init_lread ()
}
#endif
-#ifndef WINDOWSNT
+#if (!(defined(WINDOWSNT) || (defined(HAVE_CARBON))))
/* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
almost never correct, thereby causing a warning to be printed out that
confuses users. Since PATH_LOADSEARCH is always overridden by the
- EMACSLOADPATH environment variable below, disable the warning on NT. */
+ EMACSLOADPATH environment variable below, disable the warning on NT.
+ Also, when using the "self-contained" option for Carbon Emacs for MacOSX,
+ the "standard" paths may not exist and would be overridden by
+ EMACSLOADPATH as on NT. Since this depends on how the executable
+ was build and packaged, turn off the warnings in general */
/* Warn if dirs in the *standard* path don't exist. */
if (!turn_off_warning)
@@ -3840,7 +3845,7 @@ init_lread ()
}
}
}
-#endif /* WINDOWSNT */
+#endif /* !(WINDOWSNT || HAVE_CARBON) */
/* If the EMACSLOADPATH environment variable is set, use its value.
This doesn't apply if we're dumping. */
diff --git a/src/macfns.c b/src/macfns.c
index dbb8adb3fe1..ec014e772e3 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1,5 +1,5 @@
/* Graphical user interface functions for Mac OS.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
#include "epaths.h"
#include "termhooks.h"
#include "coding.h"
-#include "ccl.h"
#include "systime.h"
/* #include "bitmaps/gray.xbm" */
@@ -59,17 +58,6 @@ static unsigned char gray_bits[] = {
#include <stdlib.h>
#include <string.h>
-#ifndef MAC_OSX
-#include <alloca.h>
-#endif
-
-#ifdef MAC_OSX
-#include <QuickTime/QuickTime.h>
-#else /* not MAC_OSX */
-#include <Windows.h>
-#include <Gestalt.h>
-#include <TextUtils.h>
-#endif /* not MAC_OSX */
/*extern void free_frame_menubar ();
extern double atof ();
@@ -2580,8 +2568,6 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output));
bzero (f->output_data.mac, sizeof (struct mac_output));
FRAME_FONTSET (f) = -1;
- f->output_data.mac->scroll_bar_foreground_pixel = -1;
- f->output_data.mac->scroll_bar_background_pixel = -1;
record_unwind_protect (unwind_create_frame, frame);
f->icon_name
@@ -2598,7 +2584,7 @@ This function is an internal primitive--use `make-frame' instead. */)
if (!NILP (parent))
{
- f->output_data.mac->parent_desc = (Window) parent;
+ f->output_data.mac->parent_desc = (Window) XFASTINT (parent);
f->output_data.mac->explicit_parent = 1;
}
else
@@ -2708,7 +2694,7 @@ This function is an internal primitive--use `make-frame' instead. */)
x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
"menuBar", "MenuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qtool_bar_lines, make_number (0),
+ x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
"toolBar", "ToolBar", RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
@@ -2717,25 +2703,32 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
- /* MAC_TODO: specify 1 below when toolbars are implemented. */
- window_prompting = x_figure_window_size (f, parms, 0);
+#if TARGET_API_MAC_CARBON
+ f->output_data.mac->text_cursor = kThemeIBeamCursor;
+ f->output_data.mac->nontext_cursor = kThemeArrowCursor;
+ f->output_data.mac->modeline_cursor = kThemeArrowCursor;
+ f->output_data.mac->hand_cursor = kThemePointingHandCursor;
+ f->output_data.mac->hourglass_cursor = kThemeWatchCursor;
+ f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor;
+#else
+ f->output_data.mac->text_cursor = GetCursor (iBeamCursor);
+ f->output_data.mac->nontext_cursor = &arrow_cursor;
+ f->output_data.mac->modeline_cursor = &arrow_cursor;
+ f->output_data.mac->hand_cursor = &arrow_cursor;
+ f->output_data.mac->hourglass_cursor = GetCursor (watchCursor);
+ f->output_data.mac->horizontal_drag_cursor = &arrow_cursor;
+#endif
+
+ /* Compute the size of the window. */
+ window_prompting = x_figure_window_size (f, parms, 1);
tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
f->no_split = minibuffer_only || EQ (tem, Qt);
- /* Create the window. Add the tool-bar height to the initial frame
- height so that the user gets a text display area of the size he
- specified with -g or via the registry. Later changes of the
- tool-bar height don't change the frame size. This is done so that
- users can create tall Emacs frames without having to guess how
- tall the tool-bar will get. */
- FRAME_LINES (f) += FRAME_TOOL_BAR_LINES (f);
-
/* mac_window (f, window_prompting, minibuffer_only); */
make_mac_frame (f);
x_icon (f, parms);
-
x_make_gc (f);
/* Now consider the frame official. */
@@ -2754,7 +2747,8 @@ This function is an internal primitive--use `make-frame' instead. */)
x_default_parameter (f, parms, Qcursor_type, Qbox,
"cursorType", "CursorType", RES_TYPE_SYMBOL);
x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
- "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
+ "scrollBarWidth", "ScrollBarWidth",
+ RES_TYPE_NUMBER);
/* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
Change will not be effected unless different from the current
@@ -2762,13 +2756,10 @@ This function is an internal primitive--use `make-frame' instead. */)
width = FRAME_COLS (f);
height = FRAME_LINES (f);
- FRAME_LINES (f) = 0;
SET_FRAME_COLS (f, 0);
+ FRAME_LINES (f) = 0;
change_frame_size (f, height, width, 1, 0, 0);
- /* Set up faces after all frame parameters are known. */
- call1 (Qface_set_after_frame_default, frame);
-
#if 0 /* MAC_TODO: when we have window manager hints */
/* Tell the server what size and position, etc, we want, and how
badly we want them. This should be done after we have the menu
@@ -2948,8 +2939,8 @@ If omitted or nil, that stands for the selected frame's display. */)
{
struct mac_display_info *dpyinfo = check_x_display_info (display);
- /* MAC_TODO: check whether this is right */
- return make_number (dpyinfo->n_planes >= 8 ? 256 : 1 << dpyinfo->n_planes - 1);
+ /* We force 24+ bit depths to 24-bit to prevent an overflow. */
+ return make_number (1 << min (dpyinfo->n_planes, 24));
}
DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
@@ -3025,11 +3016,8 @@ If omitted or nil, that stands for the selected frame's display. */)
/* MAC_TODO: this is an approximation, and only of the main display */
struct mac_display_info *dpyinfo = check_x_display_info (display);
- short h, v;
- ScreenRes (&h, &v);
-
- return make_number ((int) (v / 72.0 * 25.4));
+ return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy));
}
DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -3043,11 +3031,8 @@ If omitted or nil, that stands for the selected frame's display. */)
/* MAC_TODO: this is an approximation, and only of the main display */
struct mac_display_info *dpyinfo = check_x_display_info (display);
- short h, v;
-
- ScreenRes (&h, &v);
- return make_number ((int) (h / 72.0 * 25.4));
+ return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
}
DEFUN ("x-display-backing-store", Fx_display_backing_store,
@@ -3595,9 +3580,11 @@ hide_hourglass ()
***********************************************************************/
static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,
- Lisp_Object));
+ Lisp_Object, Lisp_Object));
+static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
+ Lisp_Object, int, int, int *, int *));
-/* The frame of a currently visible tooltip, or null. */
+/* The frame of a currently visible tooltip. */
Lisp_Object tip_frame;
@@ -3612,15 +3599,42 @@ Window tip_window;
Lisp_Object last_show_tip_args;
+/* Maximum size for tooltips; a cons (COLUMNS . ROWS). */
+
+Lisp_Object Vx_max_tooltip_size;
+
+
+static Lisp_Object
+unwind_create_tip_frame (frame)
+ Lisp_Object frame;
+{
+ Lisp_Object deleted;
+
+ deleted = unwind_create_frame (frame);
+ if (EQ (deleted, Qt))
+ {
+ tip_window = NULL;
+ tip_frame = Qnil;
+ }
+
+ return deleted;
+}
+
+
/* Create a frame for a tooltip on the display described by DPYINFO.
- PARMS is a list of frame parameters. Value is the frame. */
+ PARMS is a list of frame parameters. TEXT is the string to
+ display in the tip frame. Value is the frame.
+
+ Note that functions called here, esp. x_default_parameter can
+ signal errors, for instance when a specified color name is
+ undefined. We have to make sure that we're in a consistent state
+ when this happens. */
static Lisp_Object
-x_create_tip_frame (dpyinfo, parms)
+x_create_tip_frame (dpyinfo, parms, text)
struct mac_display_info *dpyinfo;
- Lisp_Object parms;
+ Lisp_Object parms, text;
{
-#if 0 /* MAC_TODO : Mac version */
struct frame *f;
Lisp_Object frame, tem;
Lisp_Object name;
@@ -3629,8 +3643,11 @@ x_create_tip_frame (dpyinfo, parms)
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3;
struct kboard *kb;
+ int face_change_count_before = face_change_count;
+ Lisp_Object buffer;
+ struct buffer *old_buffer;
- check_x ();
+ check_mac ();
/* Use this general default value to start with until we know if
this frame has a specified name. */
@@ -3643,7 +3660,7 @@ x_create_tip_frame (dpyinfo, parms)
#endif
/* Get the name of the frame to use for resource lookup. */
- name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
+ name = mac_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
if (!STRINGP (name)
&& !EQ (name, Qunbound)
&& !NILP (name))
@@ -3652,31 +3669,50 @@ x_create_tip_frame (dpyinfo, parms)
frame = Qnil;
GCPRO3 (parms, name, frame);
- tip_frame = f = make_frame (1);
+ f = make_frame (1);
XSETFRAME (frame, f);
+
+ buffer = Fget_buffer_create (build_string (" *tip*"));
+ Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
+ old_buffer = current_buffer;
+ set_buffer_internal_1 (XBUFFER (buffer));
+ current_buffer->truncate_lines = Qnil;
+ specbind (Qinhibit_read_only, Qt);
+ specbind (Qinhibit_modification_hooks, Qt);
+ Ferase_buffer ();
+ Finsert (1, &text);
+ set_buffer_internal_1 (old_buffer);
+
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
+ record_unwind_protect (unwind_create_tip_frame, frame);
- f->output_method = output_w32;
- f->output_data.w32 =
- (struct w32_output *) xmalloc (sizeof (struct w32_output));
- bzero (f->output_data.w32, sizeof (struct w32_output));
-#if 0
- f->output_data.w32->icon_bitmap = -1;
-#endif
- FRAME_FONTSET (f) = -1;
+ /* By setting the output method, we're essentially saying that
+ the frame is live, as per FRAME_LIVE_P. If we get a signal
+ from this point on, x_destroy_window might screw up reference
+ counts etc. */
+ f->output_method = output_mac;
+ f->output_data.mac =
+ (struct mac_output *) xmalloc (sizeof (struct mac_output));
+ bzero (f->output_data.mac, sizeof (struct mac_output));
+
+ FRAME_FONTSET (f) = -1;
f->icon_name = Qnil;
+#if 0 /* GLYPH_DEBUG TODO: image support. */
+ image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
+ dpyinfo_refcount = dpyinfo->reference_count;
+#endif /* GLYPH_DEBUG */
#ifdef MULTI_KBOARD
FRAME_KBOARD (f) = kb;
#endif
- f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
- f->output_data.w32->explicit_parent = 0;
+ f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
+ f->output_data.mac->explicit_parent = 0;
/* Set the name; the functions to which we pass f expect the name to
be set. */
if (EQ (name, Qunbound) || NILP (name))
{
- f->name = build_string (dpyinfo->x_id_name);
+ f->name = build_string (dpyinfo->mac_id_name);
f->explicit_name = 0;
}
else
@@ -3687,12 +3723,12 @@ x_create_tip_frame (dpyinfo, parms)
specbind (Qx_resource_name, name);
}
- /* Extract the window parameters from the supplied values
- that are needed to determine window geometry. */
+ /* Extract the window parameters from the supplied values that are
+ needed to determine window geometry. */
{
Lisp_Object font;
- font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
+ font = mac_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
BLOCK_INPUT;
/* First, try whatever font the caller has specified. */
@@ -3706,22 +3742,16 @@ x_create_tip_frame (dpyinfo, parms)
}
/* Try out a font which we hope has bold and italic variations. */
- if (!STRINGP (font))
- font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
- if (!STRINGP (font))
- font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
- if (! STRINGP (font))
- font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
if (! STRINGP (font))
- /* This was formerly the first thing tried, but it finds too many fonts
- and takes too long. */
- font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
+ font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
/* If those didn't work, look for something which will at least work. */
if (! STRINGP (font))
- font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
+ font = x_new_font (f, "-*-monaco-*-12-*-mac-roman");
+ if (! STRINGP (font))
+ font = x_new_font (f, "-*-courier-*-10-*-mac-roman");
UNBLOCK_INPUT;
if (! STRINGP (font))
- font = build_string ("fixed");
+ error ("Cannot find any usable font");
x_default_parameter (f, parms, Qfont, font,
"font", "Font", RES_TYPE_STRING);
@@ -3737,7 +3767,7 @@ x_create_tip_frame (dpyinfo, parms)
{
Lisp_Object value;
- value = w32_get_arg (parms, Qinternal_border_width,
+ value = mac_get_arg (parms, Qinternal_border_width,
"internalBorder", "internalBorder", RES_TYPE_NUMBER);
if (! EQ (value, Qunbound))
parms = Fcons (Fcons (Qinternal_border_width, value),
@@ -3768,34 +3798,28 @@ x_create_tip_frame (dpyinfo, parms)
happen. */
init_frame_faces (f);
- f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
+ f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
window_prompting = x_figure_window_size (f, parms, 0);
{
- XSetWindowAttributes attrs;
- unsigned long mask;
+ Rect r;
BLOCK_INPUT;
- mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
- /* Window managers looks at the override-redirect flag to
- determine whether or net to give windows a decoration (Xlib
- 3.2.8). */
- attrs.override_redirect = True;
- attrs.save_under = True;
- attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f);
- /* Arrange for getting MapNotify and UnmapNotify events. */
- attrs.event_mask = StructureNotifyMask;
- tip_window
- = FRAME_W32_WINDOW (f)
- = XCreateWindow (FRAME_W32_DISPLAY (f),
- FRAME_W32_DISPLAY_INFO (f)->root_window,
- /* x, y, width, height */
- 0, 0, 1, 1,
- /* Border. */
- 1,
- CopyFromParent, InputOutput, CopyFromParent,
- mask, &attrs);
+ SetRect (&r, 0, 0, 1, 1);
+ if (CreateNewWindow (kHelpWindowClass,
+#ifdef MAC_OS_X_VERSION_10_2
+ kWindowIgnoreClicksAttribute |
+#endif
+ kWindowNoActivatesAttribute,
+ &r, &tip_window) == noErr)
+ {
+ FRAME_MAC_WINDOW (f) = tip_window;
+ SetWRefCon (tip_window, (long) f->output_data.mac);
+ /* so that update events can find this mac_output struct */
+ f->output_data.mac->mFP = f;
+ ShowWindow (tip_window);
+ }
UNBLOCK_INPUT;
}
@@ -3813,8 +3837,8 @@ x_create_tip_frame (dpyinfo, parms)
FRAME_LINES (f). */
width = FRAME_COLS (f);
height = FRAME_LINES (f);
- FRAME_LINES (f) = 0;
SET_FRAME_COLS (f, 0);
+ FRAME_LINES (f) = 0;
change_frame_size (f, height, width, 1, 0, 0);
/* Add `tooltip' frame parameter's default value. */
@@ -3822,6 +3846,26 @@ x_create_tip_frame (dpyinfo, parms)
Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
Qnil));
+ /* Set up faces after all frame parameters are known. This call
+ also merges in face attributes specified for new frames.
+
+ Frame parameters may be changed if .Xdefaults contains
+ specifications for the default font. For example, if there is an
+ `Emacs.default.attributeBackground: pink', the `background-color'
+ attribute of the frame get's set, which let's the internal border
+ of the tooltip frame appear in pink. Prevent this. */
+ {
+ Lisp_Object bg = Fframe_parameter (frame, Qbackground_color);
+
+ /* Set tip_frame here, so that */
+ tip_frame = frame;
+ call1 (Qface_set_after_frame_default, frame);
+
+ if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
+ Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg),
+ Qnil));
+ }
+
f->no_split = 1;
UNGCPRO;
@@ -3833,17 +3877,80 @@ x_create_tip_frame (dpyinfo, parms)
/* Now that the frame is official, it counts as a reference to
its display. */
- FRAME_W32_DISPLAY_INFO (f)->reference_count++;
+ FRAME_MAC_DISPLAY_INFO (f)->reference_count++;
+ /* Setting attributes of faces of the tooltip frame from resources
+ and similar will increment face_change_count, which leads to the
+ clearing of all current matrices. Since this isn't necessary
+ here, avoid it by resetting face_change_count to the value it
+ had before we created the tip frame. */
+ face_change_count = face_change_count_before;
+
+ /* Discard the unwind_protect. */
return unbind_to (count, frame);
-#endif /* MAC_TODO */
- return Qnil;
+}
+
+
+/* Compute where to display tip frame F. PARMS is the list of frame
+ parameters for F. DX and DY are specified offsets from the current
+ location of the mouse. WIDTH and HEIGHT are the width and height
+ of the tooltip. Return coordinates relative to the root window of
+ the display in *ROOT_X, and *ROOT_Y. */
+
+static void
+compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
+ struct frame *f;
+ Lisp_Object parms, dx, dy;
+ int width, height;
+ int *root_x, *root_y;
+{
+ Lisp_Object left, top;
+
+ /* User-specified position? */
+ left = Fcdr (Fassq (Qleft, parms));
+ top = Fcdr (Fassq (Qtop, parms));
+
+ /* Move the tooltip window where the mouse pointer is. Resize and
+ show it. */
+ if (!INTEGERP (left) || !INTEGERP (top))
+ {
+ Point mouse_pos;
+
+ BLOCK_INPUT;
+ GetMouse (&mouse_pos);
+ LocalToGlobal (&mouse_pos);
+ *root_x = mouse_pos.h;
+ *root_y = mouse_pos.v;
+ UNBLOCK_INPUT;
+ }
+
+ if (INTEGERP (top))
+ *root_y = XINT (top);
+ else if (*root_y + XINT (dy) - height < 0)
+ *root_y -= XINT (dy);
+ else
+ {
+ *root_y -= height;
+ *root_y += XINT (dy);
+ }
+
+ if (INTEGERP (left))
+ *root_x = XINT (left);
+ else if (*root_x + XINT (dx) + width <= FRAME_MAC_DISPLAY_INFO (f)->width)
+ /* It fits to the right of the pointer. */
+ *root_x += XINT (dx);
+ else if (width + XINT (dx) <= *root_x)
+ /* It fits to the left of the pointer. */
+ *root_x -= width + XINT (dx);
+ else
+ /* Put it left-justified on the screen -- it ought to fit that way. */
+ *root_x = 0;
}
DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
- doc : /* Show STRING in a "tooltip" window on frame FRAME.
-A tooltip window is a small window displaying a string.
+ doc: /* Show STRING in a "tooltip" window on frame FRAME.
+A tooltip window is a small X window displaying a string.
FRAME nil or omitted means use the selected frame.
@@ -3859,19 +3966,19 @@ displayed at the mouse position, with offset DX added (default is 5 if
DX isn't specified). Likewise for the y-position; if a `top' frame
parameter is specified, it determines the y-position of the tooltip
window, otherwise it is displayed at the mouse position, with offset
-DY added (default is 10). */)
- (string, frame, parms, timeout, dx, dy)
+DY added (default is -10).
+
+A tooltip's maximum size is specified by `x-max-tooltip-size'.
+Text larger than the specified size is clipped. */)
+ (string, frame, parms, timeout, dx, dy)
Lisp_Object string, frame, parms, timeout, dx, dy;
{
struct frame *f;
struct window *w;
- Window root, child;
- Lisp_Object buffer, top, left;
+ int root_x, root_y;
struct buffer *old_buffer;
struct text_pos pos;
int i, width, height;
- int root_x, root_y, win_x, win_y;
- unsigned pmask;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
int old_windows_or_buffers_changed = windows_or_buffers_changed;
int count = SPECPDL_INDEX ();
@@ -3920,13 +4027,11 @@ DY added (default is 10). */)
call1 (Qcancel_timer, timer);
}
-#if 0 /* MAC_TODO : Mac specifics */
BLOCK_INPUT;
- compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
- XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- root_x, root_y - FRAME_PIXEL_HEIGHT (f));
+ compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
+ FRAME_PIXEL_HEIGHT (f), &root_x, &root_y);
+ MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false);
UNBLOCK_INPUT;
-#endif /* MAC_TODO */
goto start_timer;
}
}
@@ -3953,26 +4058,36 @@ DY added (default is 10). */)
/* Create a frame for the tooltip, and record it in the global
variable tip_frame. */
- frame = x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f), parms);
+ frame = x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f), parms, string);
f = XFRAME (frame);
- /* Set up the frame's root window. Currently we use a size of 80
- columns x 40 lines. If someone wants to show a larger tip, he
- will loose. I don't think this is a realistic case. */
+ /* Set up the frame's root window. */
w = XWINDOW (FRAME_ROOT_WINDOW (f));
w->left_col = w->top_line = make_number (0);
- w->total_cols = make_number (80);
- w->total_lines = make_number (40);
+
+ if (CONSP (Vx_max_tooltip_size)
+ && INTEGERP (XCAR (Vx_max_tooltip_size))
+ && XINT (XCAR (Vx_max_tooltip_size)) > 0
+ && INTEGERP (XCDR (Vx_max_tooltip_size))
+ && XINT (XCDR (Vx_max_tooltip_size)) > 0)
+ {
+ w->total_cols = XCAR (Vx_max_tooltip_size);
+ w->total_lines = XCDR (Vx_max_tooltip_size);
+ }
+ else
+ {
+ w->total_cols = make_number (80);
+ w->total_lines = make_number (40);
+ }
+
+ FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
adjust_glyphs (f);
w->pseudo_window_p = 1;
/* Display the tooltip text in a temporary buffer. */
- buffer = Fget_buffer_create (build_string (" *tip*"));
- Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
old_buffer = current_buffer;
- set_buffer_internal_1 (XBUFFER (buffer));
- Ferase_buffer ();
- Finsert (1, &string);
+ set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
+ current_buffer->truncate_lines = Qnil;
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -3993,7 +4108,7 @@ DY added (default is 10). */)
/* Let the row go over the full width of the frame. */
row->full_width_p = 1;
- /* There's a glyph at the end of rows that is use to place
+ /* There's a glyph at the end of rows that is used to place
the cursor there. Don't include the width of this glyph. */
if (row->used[TEXT_AREA])
{
@@ -4014,17 +4129,13 @@ DY added (default is 10). */)
/* Move the tooltip window where the mouse pointer is. Resize and
show it. */
-#if 0 /* TODO : Mac specifics */
- compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
+ compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
BLOCK_INPUT;
- XQueryPointer (FRAME_W32_DISPLAY (f), FRAME_W32_DISPLAY_INFO (f)->root_window,
- &root, &child, &root_x, &root_y, &win_x, &win_y, &pmask);
- XMoveResizeWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
- root_x + 5, root_y - height - 5, width, height);
- XMapRaised (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
+ MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false);
+ SizeWindow (FRAME_MAC_WINDOW (f), width, height, true);
+ BringToFront (FRAME_MAC_WINDOW (f));
UNBLOCK_INPUT;
-#endif /* MAC_TODO */
/* Draw into the window. */
w->must_be_updated_p = 1;
@@ -4046,8 +4157,8 @@ DY added (default is 10). */)
DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
doc: /* Hide the current tooltip window, if there is any.
-Value is t is tooltip was open, nil otherwise. */)
- ()
+Value is t if tooltip was open, nil otherwise. */)
+ ()
{
int count;
Lisp_Object deleted, frame, timer;
@@ -4249,7 +4360,8 @@ syms_of_macfns ()
staticpro (&Qsuppress_icon);
Qundefined_color = intern ("undefined-color");
staticpro (&Qundefined_color);
- /* This is the end of symbol initialization. */
+ Qcancel_timer = intern ("cancel-timer");
+ staticpro (&Qcancel_timer);
Qhyper = intern ("hyper");
staticpro (&Qhyper);
@@ -4265,6 +4377,7 @@ syms_of_macfns ()
staticpro (&Qcontrol);
Qshift = intern ("shift");
staticpro (&Qshift);
+ /* This is the end of symbol initialization. */
/* Text property `display' should be nonsticky by default. */
Vtext_property_default_nonsticky
@@ -4314,6 +4427,11 @@ or when you set the mouse color. */);
doc: /* A string indicating the foreground color of the cursor box. */);
Vx_cursor_fore_pixel = Qnil;
+ DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size,
+ doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS).
+Text larger than this is clipped. */);
+ Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
+
DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
doc: /* Non-nil if no window manager is in use.
Emacs doesn't try to figure this out; this is always nil
@@ -4386,6 +4504,9 @@ Chinese, Japanese, and Korean. */);
tip_frame = Qnil;
staticpro (&tip_frame);
+ last_show_tip_args = Qnil;
+ staticpro (&last_show_tip_args);
+
#if 0 /* MAC_TODO */
defsubr (&Sx_file_dialog);
#endif
diff --git a/src/macgui.h b/src/macgui.h
index 2bb346e9d30..58081df52b4 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -57,16 +57,27 @@ typedef unsigned long Time;
#undef init_process
#define init_process emacs_init_process
#undef INFINITY
-typedef struct OpaqueWindowPtr* Window;
#else
#include <QuickDraw.h> /* for WindowPtr */
#include <QDOffscreen.h> /* for GWorldPtr */
#include <Controls.h> /* for ControlHandle in xdisp.c */
-typedef WindowPtr Window;
+#include <Gestalt.h>
#endif
typedef GWorldPtr Pixmap;
+#if TARGET_API_MAC_CARBON
+typedef struct OpaqueWindowPtr *Window;
+#define Cursor ThemeCursor
+#define No_Cursor (-1)
+#else
+typedef WindowPtr Window;
+#define SetPortWindowPort(w) SetPort(w)
+#define Cursor CursHandle
+#define No_Cursor (0)
+extern CursPtr arrow_cursor;
+#endif
+
#define FACE_DEFAULT (~0)
diff --git a/src/macmenu.c b/src/macmenu.c
index 06b1b16cf41..d205ee3b877 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1424,7 +1424,8 @@ set_frame_menubar (f, first_time, deep_p)
for (i = 0; i < previous_menu_items_used; i++)
if (menu_items_used == i
- || (!Fequal (previous_items[i], XVECTOR (menu_items)->contents[i])))
+ || (NILP (Fequal (previous_items[i],
+ XVECTOR (menu_items)->contents[i]))))
break;
if (i == menu_items_used && i == previous_menu_items_used && i != 0)
{
@@ -1783,11 +1784,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
pos.h = x;
pos.v = y;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
-#else
- SetPort (FRAME_MAC_WINDOW (f));
-#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
LocalToGlobal (&pos);
@@ -1941,11 +1938,7 @@ mac_dialog (widget_value *wv)
window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowPtr) -1);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (window_ptr));
-#else
- SetPort (window_ptr);
-#endif
+ SetPortWindowPort (window_ptr);
TextFont (0);
/* Left and right margins in the dialog are 13 pixels each.*/
@@ -1963,11 +1956,7 @@ mac_dialog (widget_value *wv)
SizeWindow (window_ptr, dialog_width, 78, 0);
ShowWindow (window_ptr);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (window_ptr));
-#else
- SetPort (window_ptr);
-#endif
+ SetPortWindowPort (window_ptr);
TextFont (0);
diff --git a/src/macterm.c b/src/macterm.c
index 44029032bbd..360dccd4f16 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -53,7 +53,6 @@ Boston, MA 02111-1307, USA. */
#if defined (__MRC__) || (__MSL__ >= 0x6000)
#include <ControlDefinitions.h>
#endif
-#include <Gestalt.h>
#if __profile__
#include <profiler.h>
@@ -196,14 +195,6 @@ static Lisp_Object last_mouse_scroll_bar;
static Time last_mouse_movement_time;
-enum mouse_tracking_type {
- mouse_tracking_none,
- mouse_tracking_mouse_movement,
- mouse_tracking_scroll_bar
-};
-
-enum mouse_tracking_type mouse_tracking_in_progress = mouse_tracking_none;
-
struct scroll_bar *tracked_scroll_bar = NULL;
/* Incremented by XTread_socket whenever it really tries to read
@@ -294,7 +285,6 @@ void deactivate_scroll_bars (FRAME_PTR);
static int is_emacs_window (WindowPtr);
-extern int image_ascent (struct image *, struct face *);
int x_bitmap_icon (struct frame *, Lisp_Object);
void x_make_frame_visible (struct frame *);
@@ -311,7 +301,7 @@ XFreePixmap (display, pixmap)
Display *display; /* not used */
Pixmap pixmap;
{
- DisposeGWorld (pixmap);
+ DisposeGWorld (pixmap);
}
@@ -365,11 +355,7 @@ XDrawLine (display, w, gc, x1, y1, x2, y2)
GC gc;
int x1, y1, x2, y2;
{
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (gc);
@@ -384,6 +370,10 @@ mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2)
GC gc;
int x1, y1, x2, y2;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
+
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
@@ -392,6 +382,8 @@ mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2)
MoveTo (x1, y1);
LineTo (x2, y2);
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
/* Mac version of XClearArea. */
@@ -411,11 +403,7 @@ XClearArea (display, w, x, y, width, height, exposures)
xgc.foreground = mwp->x_compatible.foreground_pixel;
xgc.background = mwp->x_compatible.background_pixel;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (&xgc);
SetRect (&r, x, y, x + width, y + height);
@@ -436,11 +424,7 @@ XClearWindow (display, w)
xgc.foreground = mwp->x_compatible.foreground_pixel;
xgc.background = mwp->x_compatible.background_pixel;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (&xgc);
@@ -475,11 +459,7 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p)
bitmap.baseAddr = (char *)bits;
SetRect (&(bitmap.bounds), 0, 0, width, height);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (gc);
SetRect (&r, x, y, x + width, y + height);
@@ -504,11 +484,7 @@ mac_set_clip_rectangle (display, w, r)
WindowPtr w;
Rect *r;
{
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
ClipRect (r);
}
@@ -523,11 +499,7 @@ mac_reset_clipping (display, w)
{
Rect r;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
SetRect (&r, -32767, -32767, 32767, 32767);
ClipRect (&r);
@@ -596,11 +568,7 @@ XCreatePixmap (display, w, width, height, depth)
Rect r;
QDErr err;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
SetRect (&r, 0, 0, width, height);
err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0);
@@ -621,11 +589,14 @@ XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth)
{
Pixmap pixmap;
BitMap bitmap;
+ CGrafPtr old_port;
+ GDHandle old_gdh;
pixmap = XCreatePixmap (display, w, width, height, depth);
if (pixmap == NULL)
return NULL;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (pixmap, NULL);
mac_create_bitmap_from_bitmap_data (&bitmap, data, width, height);
mac_set_forecolor (fg);
@@ -639,6 +610,7 @@ XCreatePixmapFromBitmapData (display, w, data, width, height, fg, bg, depth)
&bitmap.bounds, &bitmap.bounds, srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (pixmap));
+ SetGWorld (old_port, old_gdh);
mac_free_bitmap (&bitmap);
return pixmap;
@@ -657,11 +629,7 @@ XFillRectangle (display, w, gc, x, y, width, height)
{
Rect r;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (gc);
SetRect (&r, x, y, x + width, y + height);
@@ -678,8 +646,11 @@ mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height)
int x, y;
unsigned int width, height;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
SetRect (&r, x, y, x + width, y + height);
@@ -687,6 +658,8 @@ mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height)
LockPixels (GetGWorldPixMap (p));
PaintRect (&r); /* using foreground color of gc */
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
@@ -702,11 +675,7 @@ mac_draw_rectangle (display, w, gc, x, y, width, height)
{
Rect r;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (gc);
SetRect (&r, x, y, x + width + 1, y + height + 1);
@@ -725,8 +694,11 @@ mac_draw_rectangle_to_pixmap (display, p, gc, x, y, width, height)
int x, y;
unsigned int width, height;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
SetRect (&r, x, y, x + width + 1, y + height + 1);
@@ -734,6 +706,8 @@ mac_draw_rectangle_to_pixmap (display, p, gc, x, y, width, height)
LockPixels (GetGWorldPixMap (p));
FrameRect (&r); /* using foreground color of gc */
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
@@ -747,11 +721,7 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
char *buf;
int nchars, mode, bytes_per_char;
{
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
mac_set_colors (gc);
@@ -842,11 +812,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x,
{
Rect src_r, dest_r;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (dest));
-#else
- SetPort (dest);
-#endif
+ SetPortWindowPort (dest);
SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -882,11 +848,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y,
{
Rect src_r, dest_r;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (dest));
-#else
- SetPort (dest);
-#endif
+ SetPortWindowPort (dest);
SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -946,7 +908,7 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y)
SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
- SetPort (GetWindowPort (w));
+ SetPortWindowPort (w);
ForeColor (blackColor);
BackColor (whiteColor);
@@ -1004,8 +966,11 @@ mac_copy_area_to_pixmap (display, src, dest, gc, src_x, src_y, width, height,
unsigned int width, height;
int dest_x, dest_y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect src_r, dest_r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (dest, NULL);
ForeColor (blackColor);
BackColor (whiteColor);
@@ -1024,6 +989,8 @@ mac_copy_area_to_pixmap (display, src, dest, gc, src_x, src_y, width, height,
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (dest));
UnlockPixels (GetGWorldPixMap (src));
+
+ SetGWorld (old_port, old_gdh);
}
@@ -1037,8 +1004,11 @@ mac_copy_area_with_mask_to_pixmap (display, src, mask, dest, gc, src_x, src_y,
unsigned int width, height;
int dest_x, dest_y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect src_r, dest_r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (dest, NULL);
ForeColor (blackColor);
BackColor (whiteColor);
@@ -1059,6 +1029,8 @@ mac_copy_area_with_mask_to_pixmap (display, src, mask, dest, gc, src_x, src_y,
UnlockPixels (GetGWorldPixMap (dest));
UnlockPixels (GetGWorldPixMap (mask));
UnlockPixels (GetGWorldPixMap (src));
+
+ SetGWorld (old_port, old_gdh);
}
@@ -1181,7 +1153,7 @@ x_flush (f)
FOR_EACH_FRAME (rest, frame)
x_flush (XFRAME (frame));
}
- else if (FRAME_X_P (f))
+ else if (FRAME_MAC_P (f))
XFlush (FRAME_MAC_DISPLAY (f));
UNBLOCK_INPUT;
#endif /* TARGET_API_MAC_CARBON */
@@ -1261,7 +1233,7 @@ x_update_window_begin (w)
{
int i;
- for (i = 0; i < w->desired_matrix->nrows; ++i)
+ for (i = 0; i < w->desired_matrix->nrows; ++i)
if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
break;
@@ -1283,7 +1255,7 @@ mac_draw_vertical_window_border (w, x, y0, y1)
int x, y0, y1;
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
-
+
XDrawLine (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
f->output_data.mac->normal_gc, x, y0, x, y1);
}
@@ -1356,11 +1328,7 @@ x_update_end (f)
/* Reset the background color of Mac OS Window to that of the frame after
update so that it is used by Mac Toolbox to clear the update region before
an update event is generated. */
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
-#else
- SetPort (FRAME_MAC_WINDOW (f));
-#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
@@ -1381,7 +1349,7 @@ static void
XTframe_up_to_date (f)
struct frame *f;
{
- if (FRAME_X_P (f))
+ if (FRAME_MAC_P (f))
{
struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
@@ -1525,7 +1493,7 @@ x_draw_fringe_bitmap (w, row, p)
: face->foreground);
gcv.background = face->background;
- mac_draw_bitmap (display, window, &gcv, p->x, p->y,
+ mac_draw_bitmap (display, window, &gcv, p->x, p->y,
p->wd, p->h, bits, p->overlay_p);
}
@@ -1759,7 +1727,8 @@ static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
int, int, int));
static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
- int, int, int, int, Rect *));
+ int, int, int, int, int, int,
+ Rect *));
static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
int, int, int, Rect *));
@@ -2483,9 +2452,10 @@ x_setup_relief_colors (s)
static void
x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
- raised_p, left_p, right_p, clip_rect)
+ raised_p, top_p, bot_p, left_p, right_p, clip_rect)
struct frame *f;
- int left_x, top_y, right_x, bottom_y, width, left_p, right_p, raised_p;
+ int left_x, top_y, right_x, bottom_y, width;
+ int top_p, bot_p, left_p, right_p, raised_p;
Rect *clip_rect;
{
Display *dpy = FRAME_MAC_DISPLAY (f);
@@ -2500,10 +2470,11 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
mac_set_clip_rectangle (dpy, window, clip_rect);
/* Top. */
- for (i = 0; i < width; ++i)
- XDrawLine (dpy, window, gc,
- left_x + i * left_p, top_y + i,
- right_x - i * right_p, top_y + i);
+ if (top_p)
+ for (i = 0; i < width; ++i)
+ XDrawLine (dpy, window, gc,
+ left_x + i * left_p, top_y + i,
+ right_x - i * right_p, top_y + i);
/* Left. */
if (left_p)
@@ -2520,10 +2491,11 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
clip_rect);
/* Bottom. */
- for (i = 0; i < width; ++i)
- XDrawLine (dpy, window, gc,
- left_x + i * left_p, bottom_y - i,
- right_x - i * right_p, bottom_y - i);
+ if (bot_p)
+ for (i = 0; i < width; ++i)
+ XDrawLine (dpy, window, gc,
+ left_x + i * left_p, bottom_y - i,
+ right_x - i * right_p, bottom_y - i);
/* Right. */
if (right_p)
@@ -2629,7 +2601,7 @@ x_draw_glyph_string_box (s)
{
x_setup_relief_colors (s);
x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
- width, raised_p, left_p, right_p, &clip_rect);
+ width, raised_p, 1, 1, left_p, right_p, &clip_rect);
}
}
@@ -2640,21 +2612,22 @@ static void
x_draw_image_foreground (s)
struct glyph_string *s;
{
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->img->pixmap)
{
@@ -2667,11 +2640,12 @@ x_draw_image_foreground (s)
CONVERT_TO_XRECT (clip_rect, nr);
image_rect.x = x;
image_rect.y = y;
- image_rect.width = s->img->width;
- image_rect.height = s->img->height;
+ image_rect.width = s->slice.width;
+ image_rect.height = s->slice.height;
if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
mac_copy_area_with_mask (s->display, s->img->pixmap, s->img->mask,
- s->window, s->gc, r.x - x, r.y - y,
+ s->window, s->gc,
+ s->slice.x + r.x - x, s->slice.y + r.y - y,
r.width, r.height, r.x, r.y);
}
else
@@ -2683,11 +2657,12 @@ x_draw_image_foreground (s)
CONVERT_TO_XRECT (clip_rect, nr);
image_rect.x = x;
image_rect.y = y;
- image_rect.width = s->img->width;
- image_rect.height = s->img->height;
+ image_rect.width = s->slice.width;
+ image_rect.height = s->slice.height;
if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
mac_copy_area (s->display, s->img->pixmap, s->window, s->gc,
- r.x - x, r.y - y, r.width, r.height, r.x, r.y);
+ s->slice.x + r.x - x, s->slice.y + r.y - y,
+ r.width, r.height, r.x, r.y);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2699,15 +2674,17 @@ x_draw_image_foreground (s)
{
int r = s->img->relief;
if (r < 0) r = -r;
- mac_draw_rectangle (s->display, s->window, s->gc, x - r, y - r,
- s->img->width + r*2 - 1, s->img->height + r*2 - 1);
+ mac_draw_rectangle (s->display, s->window, s->gc,
+ x - r, y - r,
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
}
else
/* Draw a rectangle if image could not be loaded. */
mac_draw_rectangle (s->display, s->window, s->gc, x, y,
- s->img->width - 1, s->img->height - 1);
+ s->slice.width - 1, s->slice.height - 1);
}
@@ -2719,21 +2696,22 @@ x_draw_image_relief (s)
{
int x0, y0, x1, y1, thick, raised_p;
Rect r;
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->hl == DRAW_IMAGE_SUNKEN
|| s->hl == DRAW_IMAGE_RAISED)
@@ -2749,12 +2727,17 @@ x_draw_image_relief (s)
x0 = x - thick;
y0 = y - thick;
- x1 = x + s->img->width + thick - 1;
- y1 = y + s->img->height + thick - 1;
+ x1 = x + s->slice.width + thick - 1;
+ y1 = y + s->slice.height + thick - 1;
x_setup_relief_colors (s);
get_glyph_string_clip_rect (s, &r);
- x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
+ x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
+ s->slice.y == 0,
+ s->slice.y + s->slice.height == s->img->height,
+ s->slice.x == 0,
+ s->slice.x + s->slice.width == s->img->width,
+ &r);
}
@@ -2765,33 +2748,37 @@ x_draw_image_foreground_1 (s, pixmap)
struct glyph_string *s;
Pixmap pixmap;
{
- int x;
- int y = s->ybase - s->y - image_ascent (s->img, s->face);
+ int x = 0;
+ int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = abs (s->face->box_line_width);
- else
- x = 0;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->img->pixmap)
{
if (s->img->mask)
mac_copy_area_with_mask_to_pixmap (s->display, s->img->pixmap,
s->img->mask, pixmap, s->gc,
- 0, 0, s->img->width, s->img->height,
+ s->slice.x, s->slice.y,
+ s->slice.width, s->slice.height,
x, y);
else
{
mac_copy_area_to_pixmap (s->display, s->img->pixmap, pixmap, s->gc,
- 0, 0, s->img->width, s->img->height, x, y);
+ s->slice.x, s->slice.y,
+ s->slice.width, s->slice.height,
+ x, y);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2804,15 +2791,15 @@ x_draw_image_foreground_1 (s, pixmap)
int r = s->img->relief;
if (r < 0) r = -r;
mac_draw_rectangle (s->display, s->window, s->gc, x - r, y - r,
- s->img->width + r*2 - 1,
- s->img->height + r*2 - 1);
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
}
else
/* Draw a rectangle if image could not be loaded. */
mac_draw_rectangle_to_pixmap (s->display, pixmap, s->gc, x, y,
- s->img->width - 1, s->img->height - 1);
+ s->slice.width - 1, s->slice.height - 1);
}
@@ -2869,19 +2856,21 @@ x_draw_image_glyph_string (s)
taller than image or if image has a clip mask to reduce
flickering. */
s->stippled_p = s->face->stipple != 0;
- if (height > s->img->height
+ if (height > s->slice.height
|| s->img->hmargin
|| s->img->vmargin
|| s->img->mask
|| s->img->pixmap == 0
|| s->width != s->background_width)
{
- if (box_line_hwidth && s->first_glyph->left_box_line_p)
- x = s->x + box_line_hwidth;
- else
- x = s->x;
+ x = s->x;
+ if (s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += box_line_hwidth;
- y = s->y + box_line_vwidth;
+ y = s->y;
+ if (s->slice.y == 0)
+ y += box_line_vwidth;
if (s->img->mask)
{
@@ -3695,11 +3684,7 @@ construct_mouse_click (result, event, f)
mouseLoc = event->where;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
-#else
- SetPort (FRAME_MAC_WINDOW (f));
-#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
GlobalToLocal (&mouseLoc);
XSETINT (result->x, mouseLoc.h);
@@ -3728,6 +3713,7 @@ note_mouse_movement (frame, pos)
FRAME_PTR frame;
Point *pos;
{
+ struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (frame);
#if TARGET_API_MAC_CARBON
Rect r;
#endif
@@ -3742,9 +3728,17 @@ note_mouse_movement (frame, pos)
if (!PtInRect (*pos, &FRAME_MAC_WINDOW (frame)->portRect))
#endif
{
- frame->mouse_moved = 1;
- last_mouse_scroll_bar = Qnil;
- note_mouse_highlight (frame, -1, -1);
+ if (frame == dpyinfo->mouse_face_mouse_frame)
+ /* This case corresponds to LeaveNotify in X11. */
+ {
+ /* If we move outside the frame, then we're certainly no
+ longer on any text in the frame. */
+ clear_mouse_face (dpyinfo);
+ dpyinfo->mouse_face_mouse_frame = 0;
+ if (!dpyinfo->grabbed)
+ rif->define_frame_cursor (frame,
+ frame->output_data.mac->nontext_cursor);
+ }
}
/* Has the mouse moved off the glyph it was on at the last sighting? */
else if (pos->h < last_mouse_glyph.left
@@ -3842,7 +3836,7 @@ glyph_rect (f, x, y, rect)
/* x is to the right of the last glyph in the row. */
rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
- /* Shouldn't this be a pixel value?
+ /* Shouldn't this be a pixel value?
WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
++KFS */
rect->right = WINDOW_RIGHT_EDGE_COL (w);
@@ -3892,6 +3886,23 @@ remember_mouse_glyph (f1, gx, gy)
}
+static WindowPtr
+mac_front_window ()
+{
+#if TARGET_API_MAC_CARBON
+ return GetFrontWindowOfClass (kDocumentWindowClass, true);
+#else
+ WindowPtr front_window = FrontWindow ();
+
+ if (tip_window && front_window == tip_window)
+ return GetNextWindow (front_window);
+ else
+ return front_window;
+#endif
+}
+
+#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
+
/* Return the current position of the mouse.
*fp should be a frame which indicates which display to ask about.
@@ -3923,12 +3934,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
{
Point mouse_pos;
int ignore1, ignore2;
- WindowPtr wp = FrontWindow ();
+ WindowPtr wp = mac_front_window ();
struct frame *f;
Lisp_Object frame, tail;
if (is_emacs_window(wp))
- f = ((mac_output *) GetWRefCon (wp))->mFP;
+ f = mac_window_to_frame (wp);
BLOCK_INPUT;
@@ -3942,11 +3953,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
last_mouse_scroll_bar = Qnil;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (wp));
-#else
- SetPort (wp);
-#endif
+ SetPortWindowPort (wp);
GetMouse (&mouse_pos);
@@ -3984,7 +3991,7 @@ mac_handle_tool_bar_click (f, button_event)
if (button_event->what == mouseDown)
handle_tool_bar_click (f, x, y, 1, 0);
else
- handle_tool_bar_click (f, x, y, 0,
+ handle_tool_bar_click (f, x, y, 0,
x_mac_to_emacs_modifiers (FRAME_MAC_DISPLAY_INFO (f),
button_event->modifiers));
}
@@ -4441,6 +4448,8 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp)
EventRecord *er;
struct input_event *bufp;
{
+ int win_y, top_range;
+
if (! GC_WINDOWP (bar->window))
abort ();
@@ -4475,6 +4484,24 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp)
bufp->part = scroll_bar_handle;
break;
}
+
+ win_y = XINT (bufp->y) - XINT (bar->top);
+ top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (0/*dummy*/, XINT (bar->height));
+
+ win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER;
+
+ win_y -= 24;
+
+ if (! NILP (bar->dragging))
+ win_y -= XINT (bar->dragging);
+
+ if (win_y < 0)
+ win_y = 0;
+ if (win_y > top_range)
+ win_y = top_range;
+
+ XSETINT (bufp->x, win_y);
+ XSETINT (bufp->y, top_range);
}
@@ -4524,16 +4551,12 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
unsigned long *time;
{
struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
- WindowPtr wp = FrontWindow ();
+ WindowPtr wp = mac_front_window ();
Point mouse_pos;
- struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP;
+ struct frame *f = mac_window_to_frame (wp);
int win_y, top_range;
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (wp));
-#else
- SetPort (wp);
-#endif
+ SetPortWindowPort (wp);
GetMouse (&mouse_pos);
@@ -4645,7 +4668,8 @@ x_draw_hollow_cursor (w, row)
/* Compute the proper height and ascent of the rectangle, based
on the actual glyph. Using the full height of the row looks
bad when there are tall images on that row. */
- h = max (FRAME_LINE_HEIGHT (f), cursor_glyph->ascent + cursor_glyph->descent);
+ h = max (min (FRAME_LINE_HEIGHT (f), row->height),
+ cursor_glyph->ascent + cursor_glyph->descent);
if (h < row->height)
y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
h--;
@@ -4759,7 +4783,11 @@ mac_define_frame_cursor (f, cursor)
struct frame *f;
Cursor cursor;
{
- /* MAC TODO */
+#if TARGET_API_MAC_CARBON
+ SetThemeCursor (cursor);
+#else
+ SetCursor (*cursor);
+#endif
}
@@ -4933,7 +4961,7 @@ x_new_font (f, fontname)
if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
{
int wid = FRAME_COLUMN_WIDTH (f);
- FRAME_CONFIG_SCROLL_BAR_COLS (f)
+ FRAME_CONFIG_SCROLL_BAR_COLS (f)
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
}
else
@@ -5027,11 +5055,7 @@ x_calc_absolute_position (f)
GrafPtr savePort;
GetPort (&savePort);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
-#else
- SetPort (FRAME_MAC_WINDOW (f));
-#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
#if TARGET_API_MAC_CARBON
{
@@ -5406,10 +5430,15 @@ x_free_frame_resources (f)
struct frame *f;
{
struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
+ WindowPtr wp = FRAME_MAC_WINDOW (f);
BLOCK_INPUT;
- DisposeWindow (FRAME_MAC_WINDOW (f));
+ DisposeWindow (wp);
+ if (wp == tip_window)
+ /* Neither WaitNextEvent nor ReceiveNextEvent receives `window
+ closed' event. So we reset tip_window here. */
+ tip_window = NULL;
free_frame_menubar (f);
@@ -5826,7 +5855,7 @@ decode_mac_font_name (char *name, int size, short scriptcode)
break;
case smKorean:
coding_system = Qeuc_kr;
- break;
+ break;
default:
return;
}
@@ -6277,7 +6306,7 @@ mac_do_list_fonts (pattern, maxnames)
if (fast_string_match (pattern_regex, fontname) >= 0)
{
font_list = Fcons (fontname, font_list);
-
+
n_fonts++;
if (maxnames > 0 && n_fonts >= maxnames)
break;
@@ -6933,6 +6962,11 @@ Lisp_Object drag_and_drop_file_list;
Point saved_menu_event_location;
+#if !TARGET_API_MAC_CARBON
+/* Place holder for the default arrow cursor. */
+CursPtr arrow_cursor;
+#endif
+
/* Apple Events */
static void init_required_apple_events (void);
static pascal OSErr
@@ -6982,12 +7016,12 @@ static int
mac_get_emulated_btn ( UInt32 modifiers )
{
int result = 0;
- if (Vmac_emulate_three_button_mouse != Qnil) {
- int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse);
+ if (!NILP (Vmac_emulate_three_button_mouse)) {
+ int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse);
if (modifiers & controlKey)
result = cmdIs3 ? 2 : 1;
else if (modifiers & optionKey)
- result = cmdIs3 ? 1 : 2;
+ result = cmdIs3 ? 1 : 2;
}
return result;
}
@@ -7001,7 +7035,7 @@ mac_event_to_emacs_modifiers (EventRef eventRef)
UInt32 mods = 0;
GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
sizeof (UInt32), NULL, &mods);
- if (Vmac_emulate_three_button_mouse != Qnil &&
+ if (!NILP (Vmac_emulate_three_button_mouse) &&
GetEventClass(eventRef) == kEventClassMouse)
{
mods &= ~(optionKey & cmdKey);
@@ -7020,7 +7054,7 @@ mac_get_mouse_btn (EventRef ref)
switch (result)
{
case kEventMouseButtonPrimary:
- if (Vmac_emulate_three_button_mouse == Qnil)
+ if (NILP (Vmac_emulate_three_button_mouse))
return 0;
else {
UInt32 mods = 0;
@@ -7119,6 +7153,8 @@ do_init_managers (void)
InitCursor ();
#if !TARGET_API_MAC_CARBON
+ arrow_cursor = &qd.arrow;
+
/* set up some extra stack space for use by emacs */
SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC));
@@ -7147,8 +7183,12 @@ do_check_ram_size (void)
static void
do_window_update (WindowPtr win)
{
- struct mac_output *mwp = (mac_output *) GetWRefCon (win);
- struct frame *f = mwp->mFP;
+ struct frame *f = mac_window_to_frame (win);
+
+ if (win == tip_window)
+ /* The tooltip has been drawn already. Avoid the
+ SET_FRAME_GARBAGED below. */
+ return;
if (f)
{
@@ -7199,13 +7239,11 @@ is_emacs_window (WindowPtr win)
static void
do_window_activate (WindowPtr win)
{
- mac_output *mwp;
struct frame *f;
if (is_emacs_window (win))
{
- mwp = (mac_output *) GetWRefCon (win);
- f = mwp->mFP;
+ f = mac_window_to_frame (win);
if (f)
{
@@ -7218,13 +7256,11 @@ do_window_activate (WindowPtr win)
static void
do_window_deactivate (WindowPtr win)
{
- mac_output *mwp;
struct frame *f;
if (is_emacs_window (win))
{
- mwp = (mac_output *) GetWRefCon (win);
- f = mwp->mFP;
+ f = mac_window_to_frame (win);
if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame)
{
@@ -7238,14 +7274,12 @@ static void
do_app_resume ()
{
WindowPtr wp;
- mac_output *mwp;
struct frame *f;
- wp = FrontWindow();
+ wp = mac_front_window ();
if (is_emacs_window (wp))
{
- mwp = (mac_output *) GetWRefCon (wp);
- f = mwp->mFP;
+ f = mac_window_to_frame (wp);
if (f)
{
@@ -7262,14 +7296,12 @@ static void
do_app_suspend ()
{
WindowPtr wp;
- mac_output *mwp;
struct frame *f;
- wp = FrontWindow();
+ wp = mac_front_window ();
if (is_emacs_window (wp))
{
- mwp = (mac_output *) GetWRefCon (wp);
- f = mwp->mFP;
+ f = mac_window_to_frame (wp);
if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame)
{
@@ -7284,67 +7316,38 @@ do_app_suspend ()
static void
-do_mouse_moved (Point mouse_pos)
+do_mouse_moved (mouse_pos, f)
+ Point mouse_pos;
+ FRAME_PTR *f;
{
- WindowPtr wp = FrontWindow ();
- struct frame *f;
+ WindowPtr wp = mac_front_window ();
+ struct x_display_info *dpyinfo;
if (is_emacs_window (wp))
{
- f = ((mac_output *) GetWRefCon (wp))->mFP;
+ *f = mac_window_to_frame (wp);
+ dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (wp));
-#else
- SetPort (wp);
-#endif
+ if (dpyinfo->mouse_face_hidden)
+ {
+ dpyinfo->mouse_face_hidden = 0;
+ clear_mouse_face (dpyinfo);
+ }
- GlobalToLocal (&mouse_pos);
-
- note_mouse_movement (f, &mouse_pos);
- }
-}
+ SetPortWindowPort (wp);
+ GlobalToLocal (&mouse_pos);
-static void
-do_os_event (EventRecord *erp)
-{
- switch((erp->message >> 24) & 0x000000FF)
- {
- case suspendResumeMessage:
- if((erp->message & resumeFlag) == 1)
- do_app_resume ();
+ if (dpyinfo->grabbed && tracked_scroll_bar)
+ x_scroll_bar_note_movement (tracked_scroll_bar,
+ mouse_pos.v
+ - XINT (tracked_scroll_bar->top),
+ TickCount() * (1000 / 60));
else
- do_app_suspend ();
- break;
-
- case mouseMovedMessage:
- do_mouse_moved (erp->where);
- break;
+ note_mouse_movement (*f, &mouse_pos);
}
}
-static void
-do_events (EventRecord *erp)
-{
- switch (erp->what)
- {
- case updateEvt:
- do_window_update ((WindowPtr) erp->message);
- break;
-
- case osEvt:
- do_os_event (erp);
- break;
-
- case activateEvt:
- if ((erp->modifiers & activeFlag) != 0)
- do_window_activate ((WindowPtr) erp->message);
- else
- do_window_deactivate ((WindowPtr) erp->message);
- break;
- }
-}
static void
do_apple_menu (SInt16 menu_item)
@@ -7382,8 +7385,7 @@ do_menu_choice (SInt32 menu_choice)
default:
{
- WindowPtr wp = FrontWindow ();
- struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP;
+ struct frame *f = mac_window_to_frame (mac_front_window ());
MenuHandle menu = GetMenuHandle (menu_id);
if (menu)
{
@@ -7408,8 +7410,7 @@ do_grow_window (WindowPtr w, EventRecord *e)
long grow_size;
Rect limit_rect;
int rows, columns;
- mac_output *mwp = (mac_output *) GetWRefCon (w);
- struct frame *f = mwp->mFP;
+ struct frame *f = mac_window_to_frame (w);
SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE);
@@ -7438,16 +7439,11 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
Rect zoom_rect, port_rect;
Point top_left;
int w_title_height, columns, rows, width, height, dummy, x, y;
- mac_output *mwp = (mac_output *) GetWRefCon (w);
- struct frame *f = mwp->mFP;
+ struct frame *f = mac_window_to_frame (w);
GetPort (&save_port);
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (w));
-#else
- SetPort (w);
-#endif
+ SetPortWindowPort (w);
/* Clear window to avoid flicker. */
#if TARGET_API_MAC_CARBON
@@ -7500,7 +7496,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
}
#endif /* not TARGET_API_MAC_CARBON */
- ZoomWindow (w, zoom_in_or_out, w == FrontWindow ());
+ ZoomWindow (w, zoom_in_or_out, w == mac_front_window ());
/* retrieve window size and update application values */
#if TARGET_API_MAC_CARBON
@@ -7510,7 +7506,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
#endif
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
- x_set_window_size (mwp->mFP, 0, columns, rows);
+ x_set_window_size (f, 0, columns, rows);
SetPort (save_port);
}
@@ -7841,8 +7837,8 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
{
struct input_event event;
Lisp_Object frame;
- struct frame *f = ((mac_output *) GetWRefCon(window))->mFP;
- SetPort (GetWindowPort (window));
+ struct frame *f = mac_window_to_frame (window);
+ SetPortWindowPort (window);
GlobalToLocal (&mouse);
event.kind = DRAG_N_DROP_EVENT;
@@ -8016,26 +8012,26 @@ keycode_to_xkeysym (int keyCode, int *xKeySym)
/* Emacs calls this whenever it wants to read an input event from the
user. */
int
-XTread_socket (int sd, int expected, struct input_event *hold_quit)
+XTread_socket (sd, expected, hold_quit)
+ int sd, expected;
+ struct input_event *hold_quit;
{
struct input_event inev;
int count = 0;
#if USE_CARBON_EVENTS
- OSStatus rneResult;
EventRef eventRef;
- EventMouseButton mouseBtn;
+ EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget ();
+#else
+ EventMask event_mask;
#endif
EventRecord er;
- int the_modifiers;
- EventMask event_mask;
+ struct mac_display_info *dpyinfo = &one_mac_display_info;
-#if 0
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
return -1;
}
-#endif
interrupt_input_pending = 0;
BLOCK_INPUT;
@@ -8057,26 +8053,33 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
if (terminate_flag)
Fkill_emacs (make_number (1));
- /* It is necessary to set this (additional) argument slot of an
- event to nil because keyboard.c protects incompletely processed
- event from being garbage collected by placing them in the
- kbd_buffer_gcpro vector. */
- EVENT_INIT (inev);
- inev.kind = NO_EVENT;
- inev.arg = Qnil;
-
+#if !USE_CARBON_EVENTS
event_mask = everyEvent;
if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
event_mask -= highLevelEventMask;
-#if USE_CARBON_EVENTS
- rneResult = ReceiveNextEvent (0, NULL,
- expected
- ? TicksToEventTime (app_sleep_time)
- : 0,
- kEventRemoveFromQueue, &eventRef);
- if (!rneResult)
+ while (WaitNextEvent (event_mask, &er,
+ (expected ? app_sleep_time : 0L), NULL))
+#else
+ while (!ReceiveNextEvent (0, NULL,
+ (expected ? TicksToEventTime (app_sleep_time) : 0),
+ kEventRemoveFromQueue, &eventRef))
+#endif /* !USE_CARBON_EVENTS */
{
+ int do_help = 0;
+ struct frame *f;
+
+ expected = 0;
+
+ /* It is necessary to set this (additional) argument slot of an
+ event to nil because keyboard.c protects incompletely
+ processed event from being garbage collected by placing them
+ in the kbd_buffer_gcpro vector. */
+ EVENT_INIT (inev);
+ inev.kind = NO_EVENT;
+ inev.arg = Qnil;
+
+#if USE_CARBON_EVENTS
/* Handle new events */
if (!mac_convert_event_ref (eventRef, &er))
switch (GetEventClass (eventRef))
@@ -8086,13 +8089,12 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
{
SInt32 delta;
Point point;
- WindowPtr window_ptr = FrontNonFloatingWindow ();
- struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr);
+ WindowPtr window_ptr = mac_front_window ();
+
if (!IsValidWindowPtr (window_ptr))
{
SysBeep(1);
- UNBLOCK_INPUT;
- return 0;
+ break;
}
GetEventParameter(eventRef, kEventParamMouseWheelDelta,
@@ -8103,457 +8105,557 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
NULL, &point);
inev.kind = WHEEL_EVENT;
inev.code = 0;
- inev.modifiers = (mac_event_to_emacs_modifiers(eventRef)
+ inev.modifiers = (mac_event_to_emacs_modifiers (eventRef)
| ((delta < 0) ? down_modifier
: up_modifier));
- SetPort (GetWindowPort (window_ptr));
+ SetPortWindowPort (window_ptr);
GlobalToLocal (&point);
XSETINT (inev.x, point.h);
XSETINT (inev.y, point.v);
- XSETFRAME (inev.frame_or_window, mwp->mFP);
+ XSETFRAME (inev.frame_or_window,
+ mac_window_to_frame (window_ptr));
inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60);
}
else
- SendEventToEventTarget (eventRef, GetEventDispatcherTarget ());
+ SendEventToEventTarget (eventRef, toolbox_dispatcher);
break;
default:
/* Send the event to the appropriate receiver. */
- SendEventToEventTarget (eventRef, GetEventDispatcherTarget ());
+ SendEventToEventTarget (eventRef, toolbox_dispatcher);
}
else
-#else
- if (WaitNextEvent (event_mask, &er, (expected ? app_sleep_time : 0L), NULL))
#endif /* USE_CARBON_EVENTS */
- switch (er.what)
- {
- case mouseDown:
- case mouseUp:
+ switch (er.what)
{
- WindowPtr window_ptr = FrontWindow ();
- SInt16 part_code;
+ case mouseDown:
+ case mouseUp:
+ {
+ WindowPtr window_ptr;
+ SInt16 part_code;
+ int tool_bar_p = 0;
+
+ if (dpyinfo->grabbed && last_mouse_frame
+ && FRAME_LIVE_P (last_mouse_frame))
+ {
+ window_ptr = FRAME_MAC_WINDOW (last_mouse_frame);
+ part_code = inContent;
+ }
+ else
+ {
+ window_ptr = FrontWindow ();
+ if (tip_window && window_ptr == tip_window)
+ {
+ HideWindow (tip_window);
+ window_ptr = FrontWindow ();
+ }
#if USE_CARBON_EVENTS
- /* This is needed to send mouse events like aqua window buttons
- to the correct handler. */
- if (eventNotHandledErr != SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) {
- break;
- }
+ /* This is needed to send mouse events like aqua
+ window buttons to the correct handler. */
+ if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+ != eventNotHandledErr)
+ break;
- if (!is_emacs_window(window_ptr))
- break;
+ if (!is_emacs_window (window_ptr))
+ break;
#endif
+ part_code = FindWindow (er.where, &window_ptr);
+ }
+
+ switch (part_code)
+ {
+ case inMenuBar:
+ if (er.what == mouseDown)
+ {
+ f = mac_window_to_frame (mac_front_window ());
+ saved_menu_event_location = er.where;
+ inev.kind = MENU_BAR_ACTIVATE_EVENT;
+ XSETFRAME (inev.frame_or_window, f);
+ }
+ break;
- if (mouse_tracking_in_progress == mouse_tracking_scroll_bar
- && er.what == mouseUp)
- {
- struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr);
- Point mouse_loc = er.where;
+ case inContent:
+ if (window_ptr != mac_front_window ())
+ SelectWindow (window_ptr);
+ else
+ {
+ SInt16 control_part_code;
+ ControlHandle ch;
+ Point mouse_loc = er.where;
- /* Convert to local coordinates of new window. */
+ f = mac_window_to_frame (window_ptr);
+ /* convert to local coordinates of new window */
+ SetPortWindowPort (window_ptr);
+
+ GlobalToLocal (&mouse_loc);
#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (window_ptr));
+ ch = FindControlUnderMouse (mouse_loc, window_ptr,
+ &control_part_code);
#else
- SetPort (window_ptr);
+ control_part_code = FindControl (mouse_loc, window_ptr,
+ &ch);
#endif
- GlobalToLocal (&mouse_loc);
-
#if USE_CARBON_EVENTS
- inev.code = mac_get_mouse_btn (eventRef);
+ inev.code = mac_get_mouse_btn (eventRef);
+ inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
#else
- inev.code = mac_get_emulate_btn (er.modifiers);
+ inev.code = mac_get_emulated_btn (er.modifiers);
+ inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
#endif
- inev.kind = SCROLL_BAR_CLICK_EVENT;
- inev.frame_or_window = tracked_scroll_bar->window;
- inev.part = scroll_bar_handle;
-#if USE_CARBON_EVENTS
- inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
+ XSETINT (inev.x, mouse_loc.h);
+ XSETINT (inev.y, mouse_loc.v);
+ inev.timestamp = er.when * (1000 / 60);
+ /* ticks to milliseconds */
+
+ if (dpyinfo->grabbed && tracked_scroll_bar
+#if TARGET_API_MAC_CARBON
+ || ch != 0
#else
- inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
+ || control_part_code != 0
#endif
- inev.modifiers |= up_modifier;
- inev.timestamp = er.when * (1000 / 60);
- /* ticks to milliseconds */
+ )
+ {
+ struct scroll_bar *bar;
+
+ if (dpyinfo->grabbed && tracked_scroll_bar)
+ {
+ bar = tracked_scroll_bar;
+ control_part_code = kControlIndicatorPart;
+ }
+ else
+ bar = (struct scroll_bar *) GetControlReference (ch);
+ x_scroll_bar_handle_click (bar, control_part_code,
+ &er, &inev);
+ if (er.what == mouseDown
+ && control_part_code == kControlIndicatorPart)
+ tracked_scroll_bar = bar;
+ else
+ tracked_scroll_bar = NULL;
+ }
+ else
+ {
+ Lisp_Object window;
+ int x = mouse_loc.h;
+ int y = mouse_loc.v;
+
+ window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
+ if (EQ (window, f->tool_bar_window))
+ {
+ if (er.what == mouseDown)
+ handle_tool_bar_click (f, x, y, 1, 0);
+ else
+ handle_tool_bar_click (f, x, y, 0,
+ inev.modifiers);
+ tool_bar_p = 1;
+ }
+ else
+ {
+ XSETFRAME (inev.frame_or_window, f);
+ inev.kind = MOUSE_CLICK_EVENT;
+ }
+ }
+
+ if (er.what == mouseDown)
+ {
+ dpyinfo->grabbed |= (1 << inev.code);
+ last_mouse_frame = f;
+ /* Ignore any mouse motion that happened
+ before this event; any subsequent
+ mouse-movement Emacs events should reflect
+ only motion after the ButtonPress. */
+ if (f != 0)
+ f->mouse_moved = 0;
+
+ if (!tool_bar_p)
+ last_tool_bar_item = -1;
+ }
+ else
+ {
+ if (dpyinfo->grabbed & (1 << inev.code) == 0)
+ /* If a button is released though it was not
+ previously pressed, that would be because
+ of multi-button emulation. */
+ dpyinfo->grabbed = 0;
+ else
+ dpyinfo->grabbed &= ~(1 << inev.code);
+ }
+
+ switch (er.what)
+ {
+ case mouseDown:
+ inev.modifiers |= down_modifier;
+ break;
+ case mouseUp:
+ inev.modifiers |= up_modifier;
+ break;
+ }
+ }
+ break;
- XSETINT (inev.x, tracked_scroll_bar->left + 2);
- XSETINT (inev.y, mouse_loc.v - 24);
- tracked_scroll_bar->dragging = Qnil;
- mouse_tracking_in_progress = mouse_tracking_none;
- tracked_scroll_bar = NULL;
- break;
- }
+ case inDrag:
+#if TARGET_API_MAC_CARBON
+ if (er.what == mouseDown)
+ {
+ BitMap bm;
- part_code = FindWindow (er.where, &window_ptr);
+ GetQDGlobalsScreenBits (&bm);
+ DragWindow (window_ptr, er.where, &bm.bounds);
+ }
+#else /* not TARGET_API_MAC_CARBON */
+ DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
+#endif /* not TARGET_API_MAC_CARBON */
+ break;
- switch (part_code)
- {
- case inMenuBar:
- if (er.what == mouseDown)
- {
- struct frame *f = ((mac_output *)
- GetWRefCon (FrontWindow ()))->mFP;
- saved_menu_event_location = er.where;
- inev.kind = MENU_BAR_ACTIVATE_EVENT;
- XSETFRAME (inev.frame_or_window, f);
- }
- break;
+ case inGoAway:
+ if (TrackGoAway (window_ptr, er.where))
+ {
+ inev.kind = DELETE_WINDOW_EVENT;
+ XSETFRAME (inev.frame_or_window,
+ mac_window_to_frame (window_ptr));
+ }
+ break;
- case inContent:
- if (window_ptr != FrontWindow ())
- SelectWindow (window_ptr);
- else
- {
- SInt16 control_part_code;
- ControlHandle ch;
- struct mac_output *mwp = (mac_output *)
- GetWRefCon (window_ptr);
- Point mouse_loc = er.where;
-
- /* convert to local coordinates of new window */
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (window_ptr));
-#else
- SetPort (window_ptr);
-#endif
+ /* window resize handling added --ben */
+ case inGrow:
+ if (er.what == mouseDown)
+ {
+ do_grow_window(window_ptr, &er);
+ break;
+ }
- GlobalToLocal (&mouse_loc);
-#if TARGET_API_MAC_CARBON
- ch = FindControlUnderMouse (mouse_loc, window_ptr,
- &control_part_code);
-#else
- control_part_code = FindControl (mouse_loc, window_ptr, &ch);
-#endif
+ /* window zoom handling added --ben */
+ case inZoomIn:
+ case inZoomOut:
+ if (TrackBox (window_ptr, er.where, part_code))
+ do_zoom_window (window_ptr, part_code);
+ break;
-#if USE_CARBON_EVENTS
- inev.code = mac_get_mouse_btn (eventRef);
-#else
- inev.code = mac_get_emulate_btn (er.modifiers);
-#endif
- XSETINT (inev.x, mouse_loc.h);
- XSETINT (inev.y, mouse_loc.v);
- inev.timestamp = er.when * (1000 / 60);
- /* ticks to milliseconds */
+ default:
+ break;
+ }
+ }
+ break;
-#if TARGET_API_MAC_CARBON
- if (ch != 0)
-#else
- if (control_part_code != 0)
-#endif
- {
- struct scroll_bar *bar = (struct scroll_bar *)
- GetControlReference (ch);
- x_scroll_bar_handle_click (bar, control_part_code, &er,
- &inev);
- if (er.what == mouseDown
- && control_part_code == kControlIndicatorPart)
- {
- mouse_tracking_in_progress
- = mouse_tracking_scroll_bar;
- tracked_scroll_bar = bar;
- }
- else
- {
- mouse_tracking_in_progress = mouse_tracking_none;
- tracked_scroll_bar = NULL;
- }
- }
- else
- {
- Lisp_Object window;
-
- XSETFRAME (inev.frame_or_window, mwp->mFP);
- if (er.what == mouseDown)
- mouse_tracking_in_progress
- = mouse_tracking_mouse_movement;
- else
- mouse_tracking_in_progress = mouse_tracking_none;
- window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1);
-
- if (EQ (window, mwp->mFP->tool_bar_window))
- {
- if (er.what == mouseDown)
- handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0);
- else
- handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0,
+ case updateEvt:
#if USE_CARBON_EVENTS
- mac_event_to_emacs_modifiers (eventRef)
-#else
- er.modifiers
+ if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+ != eventNotHandledErr)
+ break;
#endif
- );
- break;
- }
- else
- inev.kind = MOUSE_CLICK_EVENT;
- }
+ do_window_update ((WindowPtr) er.message);
+ break;
+ case osEvt:
#if USE_CARBON_EVENTS
- inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
-#else
- inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
+ if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+ != eventNotHandledErr)
+ break;
#endif
-
- switch (er.what)
- {
- case mouseDown:
- inev.modifiers |= down_modifier;
- break;
- case mouseUp:
- inev.modifiers |= up_modifier;
- break;
- }
- }
- break;
-
- case inDrag:
-#if TARGET_API_MAC_CARBON
- if (er.what == mouseDown)
- {
- BitMap bm;
-
- GetQDGlobalsScreenBits (&bm);
- DragWindow (window_ptr, er.where, &bm.bounds);
- }
-#else /* not TARGET_API_MAC_CARBON */
- DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
-#endif /* not TARGET_API_MAC_CARBON */
+ switch ((er.message >> 24) & 0x000000FF)
+ {
+ case suspendResumeMessage:
+ if ((er.message & resumeFlag) == 1)
+ do_app_resume ();
+ else
+ do_app_suspend ();
break;
- case inGoAway:
- if (TrackGoAway (window_ptr, er.where))
- {
- inev.kind = DELETE_WINDOW_EVENT;
- XSETFRAME (inev.frame_or_window,
- ((mac_output *) GetWRefCon (window_ptr))->mFP);
- }
- break;
+ case mouseMovedMessage:
+ previous_help_echo_string = help_echo_string;
+ help_echo_string = help_echo_object = help_echo_window = Qnil;
+ help_echo_pos = -1;
- /* window resize handling added --ben */
- case inGrow:
- if (er.what == mouseDown)
- {
- do_grow_window(window_ptr, &er);
- break;
- }
-
- /* window zoom handling added --ben */
- case inZoomIn:
- case inZoomOut:
- if (TrackBox (window_ptr, er.where, part_code))
- do_zoom_window (window_ptr, part_code);
- break;
+ do_mouse_moved (er.where, &f);
- default:
+ /* If the contents of the global variable
+ help_echo_string has changed, generate a
+ HELP_EVENT. */
+ if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
+ do_help = 1;
break;
}
- }
- break;
+ break;
+
+ case activateEvt:
+ {
+ WindowPtr window_ptr = (WindowPtr) er.message;
- case updateEvt:
- case osEvt:
- case activateEvt:
#if USE_CARBON_EVENTS
- if (eventNotHandledErr == SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()))
+ if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+ != eventNotHandledErr)
+ break;
#endif
- do_events (&er);
- break;
+ if (window_ptr == tip_window)
+ {
+ HideWindow (tip_window);
+ break;
+ }
- case keyDown:
- case autoKey:
- {
- int keycode = (er.message & keyCodeMask) >> 8;
- int xkeysym;
+ if ((er.modifiers & activeFlag) != 0)
+ {
+ Point mouse_loc = er.where;
-#if USE_CARBON_EVENTS
- /* When using Carbon Events, we need to pass raw keyboard events
- to the TSM ourselves. If TSM handles it, it will pass back
- noErr, otherwise it will pass back "eventNotHandledErr" and
- we can process it normally. */
- if ((!NILP (Vmac_pass_command_to_system)
- || !(er.modifiers & cmdKey))
- && (!NILP (Vmac_pass_control_to_system)
- || !(er.modifiers & controlKey)))
- {
- OSStatus err;
- err = SendEventToEventTarget (eventRef,
- GetEventDispatcherTarget ());
- if (err != eventNotHandledErr)
- break;
- }
-#endif
+ do_window_activate (window_ptr);
- if (!IsValidWindowPtr (FrontNonFloatingWindow ()))
- {
- SysBeep (1);
- UNBLOCK_INPUT;
- return 0;
- }
+ SetPortWindowPort (window_ptr);
+ GlobalToLocal (&mouse_loc);
+ /* activateEvt counts as mouse movement,
+ so update things that depend on mouse position. */
+ note_mouse_movement (mac_window_to_frame (window_ptr),
+ &mouse_loc);
+ }
+ else
+ {
+ do_window_deactivate (window_ptr);
- ObscureCursor ();
+ f = mac_window_to_frame (window_ptr);
+ if (f == dpyinfo->mouse_face_mouse_frame)
+ {
+ /* If we move outside the frame, then we're
+ certainly no longer on any text in the
+ frame. */
+ clear_mouse_face (dpyinfo);
+ dpyinfo->mouse_face_mouse_frame = 0;
+ }
- if (keycode_to_xkeysym (keycode, &xkeysym))
- {
- inev.code = 0xff00 | xkeysym;
- inev.kind = NON_ASCII_KEYSTROKE_EVENT;
- }
- else
- {
- if (er.modifiers & (controlKey |
- (NILP (Vmac_command_key_is_meta) ? optionKey
- : cmdKey)))
- {
- /* This code comes from Keyboard Resource, Appendix
- C of IM - Text. This is necessary since shift is
- ignored in KCHR table translation when option or
- command is pressed. It also does not translate
- correctly control-shift chars like C-% so mask off
- shift here also */
- int new_modifiers = er.modifiers & 0xe600;
- /* mask off option and command */
- int new_keycode = keycode | new_modifiers;
- Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
- unsigned long some_state = 0;
- inev.code = KeyTranslate (kchr_ptr, new_keycode,
- &some_state) & 0xff;
- }
- else
- inev.code = er.message & charCodeMask;
- inev.kind = ASCII_KEYSTROKE_EVENT;
- }
- }
+ /* Generate a nil HELP_EVENT to cancel a help-echo.
+ Do it only if there's something to cancel.
+ Otherwise, the startup message is cleared when the
+ mouse leaves the frame. */
+ if (any_help_event_p)
+ do_help = -1;
+ }
+ }
+ break;
- /* If variable mac-convert-keyboard-input-to-latin-1 is non-nil,
- convert non-ASCII characters typed at the Mac keyboard
- (presumed to be in the Mac Roman encoding) to iso-latin-1
- encoding before they are passed to Emacs. This enables the
- Mac keyboard to be used to enter non-ASCII iso-latin-1
- characters directly. */
- if (mac_keyboard_text_encoding != kTextEncodingMacRoman
- && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128)
+ case keyDown:
+ case autoKey:
{
- static TECObjectRef converter = NULL;
- OSStatus the_err = noErr;
- OSStatus convert_status = noErr;
+ int keycode = (er.message & keyCodeMask) >> 8;
+ int xkeysym;
- if (converter == NULL)
+#if USE_CARBON_EVENTS
+ /* When using Carbon Events, we need to pass raw keyboard
+ events to the TSM ourselves. If TSM handles it, it
+ will pass back noErr, otherwise it will pass back
+ "eventNotHandledErr" and we can process it
+ normally. */
+ if ((!NILP (Vmac_pass_command_to_system)
+ || !(er.modifiers & cmdKey))
+ && (!NILP (Vmac_pass_control_to_system)
+ || !(er.modifiers & controlKey)))
+ if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+ != eventNotHandledErr)
+ break;
+#endif
+
+#if TARGET_API_MAC_CARBON
+ if (!IsValidWindowPtr (mac_front_window ()))
{
- the_err = TECCreateConverter (&converter,
- kTextEncodingMacRoman,
- mac_keyboard_text_encoding);
- current_mac_keyboard_text_encoding
- = mac_keyboard_text_encoding;
+ SysBeep (1);
+ break;
}
- else if (mac_keyboard_text_encoding
- != current_mac_keyboard_text_encoding)
+#endif
+
+ ObscureCursor ();
+
+ if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
{
- /* Free the converter for the current encoding before
- creating a new one. */
- TECDisposeConverter (converter);
- the_err = TECCreateConverter (&converter,
- kTextEncodingMacRoman,
- mac_keyboard_text_encoding);
- current_mac_keyboard_text_encoding
- = mac_keyboard_text_encoding;
+ clear_mouse_face (dpyinfo);
+ dpyinfo->mouse_face_hidden = 1;
}
- if (the_err == noErr)
+ if (keycode_to_xkeysym (keycode, &xkeysym))
{
- unsigned char ch = inev.code;
- ByteCount actual_input_length, actual_output_length;
- unsigned char outch;
-
- convert_status = TECConvertText (converter, &ch, 1,
- &actual_input_length,
- &outch, 1,
- &actual_output_length);
- if (convert_status == noErr
- && actual_input_length == 1
- && actual_output_length == 1)
- inev.code = outch;
+ inev.code = 0xff00 | xkeysym;
+ inev.kind = NON_ASCII_KEYSTROKE_EVENT;
+ }
+ else
+ {
+ if (er.modifiers & (controlKey |
+ (NILP (Vmac_command_key_is_meta) ? optionKey
+ : cmdKey)))
+ {
+ /* This code comes from Keyboard Resource,
+ Appendix C of IM - Text. This is necessary
+ since shift is ignored in KCHR table
+ translation when option or command is pressed.
+ It also does not translate correctly
+ control-shift chars like C-% so mask off shift
+ here also */
+ int new_modifiers = er.modifiers & 0xe600;
+ /* mask off option and command */
+ int new_keycode = keycode | new_modifiers;
+ Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
+ unsigned long some_state = 0;
+ inev.code = KeyTranslate (kchr_ptr, new_keycode,
+ &some_state) & 0xff;
+ }
+ else
+ inev.code = er.message & charCodeMask;
+ inev.kind = ASCII_KEYSTROKE_EVENT;
}
}
+ /* If variable mac-convert-keyboard-input-to-latin-1 is
+ non-nil, convert non-ASCII characters typed at the Mac
+ keyboard (presumed to be in the Mac Roman encoding) to
+ iso-latin-1 encoding before they are passed to Emacs.
+ This enables the Mac keyboard to be used to enter
+ non-ASCII iso-latin-1 characters directly. */
+ if (mac_keyboard_text_encoding != kTextEncodingMacRoman
+ && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128)
+ {
+ static TECObjectRef converter = NULL;
+ OSStatus the_err = noErr;
+ OSStatus convert_status = noErr;
+
+ if (converter == NULL)
+ {
+ the_err = TECCreateConverter (&converter,
+ kTextEncodingMacRoman,
+ mac_keyboard_text_encoding);
+ current_mac_keyboard_text_encoding
+ = mac_keyboard_text_encoding;
+ }
+ else if (mac_keyboard_text_encoding
+ != current_mac_keyboard_text_encoding)
+ {
+ /* Free the converter for the current encoding
+ before creating a new one. */
+ TECDisposeConverter (converter);
+ the_err = TECCreateConverter (&converter,
+ kTextEncodingMacRoman,
+ mac_keyboard_text_encoding);
+ current_mac_keyboard_text_encoding
+ = mac_keyboard_text_encoding;
+ }
+
+ if (the_err == noErr)
+ {
+ unsigned char ch = inev.code;
+ ByteCount actual_input_length, actual_output_length;
+ unsigned char outch;
+
+ convert_status = TECConvertText (converter, &ch, 1,
+ &actual_input_length,
+ &outch, 1,
+ &actual_output_length);
+ if (convert_status == noErr
+ && actual_input_length == 1
+ && actual_output_length == 1)
+ inev.code = outch;
+ }
+ }
+
#if USE_CARBON_EVENTS
- inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
+ inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
#else
- inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
+ inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
#endif
+ XSETFRAME (inev.frame_or_window,
+ mac_window_to_frame (mac_front_window ()));
+ inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
+ break;
- {
- mac_output *mwp
- = (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
- XSETFRAME (inev.frame_or_window, mwp->mFP);
- }
-
- inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
- break;
-
- case kHighLevelEvent:
- drag_and_drop_file_list = Qnil;
+ case kHighLevelEvent:
+ drag_and_drop_file_list = Qnil;
- AEProcessAppleEvent(&er);
+ AEProcessAppleEvent(&er);
- /* Build a DRAG_N_DROP_EVENT type event as is done in
- constuct_drag_n_drop in w32term.c. */
- if (!NILP (drag_and_drop_file_list))
- {
- struct frame *f = NULL;
- WindowPtr wp;
- Lisp_Object frame;
+ /* Build a DRAG_N_DROP_EVENT type event as is done in
+ constuct_drag_n_drop in w32term.c. */
+ if (!NILP (drag_and_drop_file_list))
+ {
+ struct frame *f = NULL;
+ WindowPtr wp;
+ Lisp_Object frame;
- wp = FrontNonFloatingWindow ();
+ wp = mac_front_window ();
- if (!wp)
- {
- struct frame *f = XFRAME (XCAR (Vframe_list));
- CollapseWindow (FRAME_MAC_WINDOW (f), false);
- wp = FrontNonFloatingWindow ();
- }
+ if (!wp)
+ {
+ struct frame *f = XFRAME (XCAR (Vframe_list));
+ CollapseWindow (FRAME_MAC_WINDOW (f), false);
+ wp = mac_front_window ();
+ }
- if (wp && is_emacs_window(wp))
- f = ((mac_output *) GetWRefCon (wp))->mFP;
+ if (wp && is_emacs_window (wp))
+ f = mac_window_to_frame (wp);
- inev.kind = DRAG_N_DROP_EVENT;
- inev.code = 0;
- inev.timestamp = er.when * (1000 / 60);
+ inev.kind = DRAG_N_DROP_EVENT;
+ inev.code = 0;
+ inev.timestamp = er.when * (1000 / 60);
/* ticks to milliseconds */
#if USE_CARBON_EVENTS
- inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
+ inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
#else
- inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
+ inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
#endif
- XSETINT (inev.x, 0);
- XSETINT (inev.y, 0);
+ XSETINT (inev.x, 0);
+ XSETINT (inev.y, 0);
- XSETFRAME (frame, f);
- inev.frame_or_window = Fcons (frame, drag_and_drop_file_list);
+ XSETFRAME (frame, f);
+ inev.frame_or_window = Fcons (frame, drag_and_drop_file_list);
- /* Regardless of whether Emacs was suspended or in the
- foreground, ask it to redraw its entire screen.
- Otherwise parts of the screen can be left in an
- inconsistent state. */
- if (wp)
+ /* Regardless of whether Emacs was suspended or in the
+ foreground, ask it to redraw its entire screen.
+ Otherwise parts of the screen can be left in an
+ inconsistent state. */
+ if (wp)
#if TARGET_API_MAC_CARBON
- {
- Rect r;
+ {
+ Rect r;
- GetWindowPortBounds (wp, &r);
- InvalWindowRect (wp, &r);
- }
+ GetWindowPortBounds (wp, &r);
+ InvalWindowRect (wp, &r);
+ }
#else /* not TARGET_API_MAC_CARBON */
- InvalRect (&(wp->portRect));
+ InvalRect (&(wp->portRect));
#endif /* not TARGET_API_MAC_CARBON */
- }
- default:
- break;
- }
+ }
+ default:
+ break;
+ }
#if USE_CARBON_EVENTS
ReleaseEvent (eventRef);
- }
#endif
+ if (inev.kind != NO_EVENT)
+ {
+ kbd_buffer_store_event_hold (&inev, hold_quit);
+ count++;
+ }
+
+ if (do_help
+ && !(hold_quit && hold_quit->kind != NO_EVENT))
+ {
+ Lisp_Object frame;
+
+ if (f)
+ XSETFRAME (frame, f);
+ else
+ frame = Qnil;
+
+ if (do_help > 0)
+ {
+ any_help_event_p = 1;
+ gen_help_event (help_echo_string, frame, help_echo_window,
+ help_echo_object, help_echo_pos);
+ }
+ else
+ {
+ help_echo_string = Qnil;
+ gen_help_event (Qnil, frame, Qnil, Qnil, 0);
+ }
+ count++;
+ }
+
+ }
+
/* If the focus was just given to an autoraising frame,
raise it now. */
/* ??? This ought to be able to handle more than one such frame. */
@@ -8567,58 +8669,6 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
check_alarm (); /* simulate the handling of a SIGALRM */
#endif
- {
- static Point old_mouse_pos = { -1, -1 };
-
- if (app_is_suspended)
- {
- old_mouse_pos.h = -1;
- old_mouse_pos.v = -1;
- }
- else
- {
- Point mouse_pos;
- WindowPtr wp;
- struct frame *f;
- Lisp_Object bar;
- struct scroll_bar *sb;
-
- wp = FrontWindow ();
- if (is_emacs_window (wp))
- {
- f = ((mac_output *) GetWRefCon (wp))->mFP;
-
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (wp));
-#else
- SetPort (wp);
-#endif
-
- GetMouse (&mouse_pos);
-
- if (!EqualPt (mouse_pos, old_mouse_pos))
- {
- if (mouse_tracking_in_progress == mouse_tracking_scroll_bar
- && tracked_scroll_bar)
- x_scroll_bar_note_movement (tracked_scroll_bar,
- mouse_pos.v
- - XINT (tracked_scroll_bar->top),
- TickCount() * (1000 / 60));
- else
- note_mouse_movement (f, &mouse_pos);
-
- old_mouse_pos = mouse_pos;
- }
- }
- }
- }
-
- if (inev.kind != NO_EVENT)
- {
- kbd_buffer_store_event_hold (&inev, hold_quit);
- count++;
- }
-
UNBLOCK_INPUT;
return count;
}
@@ -8647,7 +8697,7 @@ __convert_from_newlines (unsigned char * p, size_t * n)
ROWS Macintosh window, using font with name FONTNAME and size
FONTSIZE. */
void
-NewMacWindow (FRAME_PTR fp)
+make_mac_frame (FRAME_PTR fp)
{
mac_output *mwp;
#if TARGET_API_MAC_CARBON
@@ -8666,33 +8716,52 @@ NewMacWindow (FRAME_PTR fp)
making_terminal_window = 0;
}
else
- if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1)))
- abort ();
+ {
+#if TARGET_API_MAC_CARBON
+ Rect r;
+
+ SetRect (&r, 0, 0, 1, 1);
+ if (CreateNewWindow (kDocumentWindowClass,
+ kWindowStandardDocumentAttributes
+ /* | kWindowToolbarButtonAttribute */,
+ &r, &mwp->mWP) != noErr)
+#else
+ if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1)))
+#endif
+ abort ();
+ }
SetWRefCon (mwp->mWP, (long) mwp);
/* so that update events can find this mac_output struct */
mwp->mFP = fp; /* point back to emacs frame */
-#if TARGET_API_MAC_CARBON
- SetPort (GetWindowPort (mwp->mWP));
-#else
- SetPort (mwp->mWP);
-#endif
-
- mwp->fontset = -1;
+ SetPortWindowPort (mwp->mWP);
SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
- ShowWindow (mwp->mWP);
-
}
void
-make_mac_frame (struct frame *f)
+make_mac_terminal_frame (struct frame *f)
{
- FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR;
+ Lisp_Object frame;
- NewMacWindow(f);
+ XSETFRAME (frame, f);
+
+ f->output_method = output_mac;
+ f->output_data.mac = (struct mac_output *)
+ xmalloc (sizeof (struct mac_output));
+ bzero (f->output_data.mac, sizeof (struct mac_output));
+
+ XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
+
+ FRAME_COLS (f) = 96;
+ FRAME_LINES (f) = 4;
+
+ FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
+ FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right;
+
+ FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR;
f->output_data.mac->cursor_pixel = 0;
f->output_data.mac->border_pixel = 0x00ff00;
@@ -8700,8 +8769,6 @@ make_mac_frame (struct frame *f)
f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
FRAME_FONTSET (f) = -1;
- f->output_data.mac->scroll_bar_foreground_pixel = -1;
- f->output_data.mac->scroll_bar_background_pixel = -1;
f->output_data.mac->explicit_parent = 0;
f->left_pos = 4;
f->top_pos = 4;
@@ -8709,37 +8776,11 @@ make_mac_frame (struct frame *f)
f->internal_border_width = 0;
- f->output_method = output_mac;
-
f->auto_raise = 1;
f->auto_lower = 1;
f->new_text_cols = 0;
f->new_text_lines = 0;
-}
-
-void
-make_mac_terminal_frame (struct frame *f)
-{
- Lisp_Object frame;
-
- XSETFRAME (frame, f);
-
- f->output_method = output_mac;
- f->output_data.mac = (struct mac_output *)
- xmalloc (sizeof (struct mac_output));
- bzero (f->output_data.mac, sizeof (struct mac_output));
- FRAME_FONTSET (f) = -1;
- f->output_data.mac->scroll_bar_foreground_pixel = -1;
- f->output_data.mac->scroll_bar_background_pixel = -1;
-
- XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
-
- FRAME_COLS (f) = 96;
- FRAME_LINES (f) = 4;
-
- FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
- FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right;
make_mac_frame (f);
@@ -8757,6 +8798,8 @@ make_mac_terminal_frame (struct frame *f)
Fmodify_frame_parameters (frame,
Fcons (Fcons (Qbackground_color,
build_string ("white")), Qnil));
+
+ ShowWindow (f->output_data.mac->mWP);
}
@@ -8797,10 +8840,16 @@ mac_initialize_display_info ()
dpyinfo->resx = 75.0;
dpyinfo->resy = 75.0;
dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
+#ifdef MAC_OSX
+ /* HasDepth returns true if it is possible to have a 32 bit display,
+ but this may not be what is actually used. Mac OSX can do better. */
+ dpyinfo->n_planes = CGDisplayBitsPerPixel (CGMainDisplayID ());
+#else
for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
if (HasDepth (main_device_handle, dpyinfo->n_planes,
gdDevType, dpyinfo->color_p))
break;
+#endif
dpyinfo->height = (**main_device_handle).gdRect.bottom;
dpyinfo->width = (**main_device_handle).gdRect.right;
dpyinfo->grabbed = 0;
@@ -8811,6 +8860,8 @@ mac_initialize_display_info ()
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
dpyinfo->mouse_face_window = Qnil;
+ dpyinfo->mouse_face_overlay = Qnil;
+ dpyinfo->mouse_face_hidden = 0;
}
struct mac_display_info *
@@ -8959,22 +9010,23 @@ mac_check_for_quit_char ()
mac_determine_quit_char_modifiers ();
/* Fill the queue with events */
+ BLOCK_INPUT;
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event);
event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp,
NULL);
+ UNBLOCK_INPUT;
if (event)
{
struct input_event e;
- struct mac_output *mwp =
- (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
+
/* Use an input_event to emulate what the interrupt handler does. */
EVENT_INIT (e);
e.kind = ASCII_KEYSTROKE_EVENT;
e.code = quit_char;
- e.arg = NULL;
+ e.arg = Qnil;
e.modifiers = NULL;
e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
- XSETFRAME (e.frame_or_window, mwp->mFP);
+ XSETFRAME (e.frame_or_window, mac_window_to_frame (mac_front_window ()));
/* Remove event from queue to prevent looping. */
RemoveEventFromQueue (GetMainEventQueue (), event);
ReleaseEvent (event);
@@ -9185,10 +9237,10 @@ Otherwise the option key is used. */);
useful for non-standard keyboard layouts. */);
Vmac_reverse_ctrl_meta = Qnil;
- DEFVAR_LISP ("mac-emulate-three-button-mouse",
+ DEFVAR_LISP ("mac-emulate-three-button-mouse",
&Vmac_emulate_three_button_mouse,
doc: /* t means that when the option-key is held down while pressing the
- mouse button, the click will register as mouse-2 and while the
+ mouse button, the click will register as mouse-2 and while the
command-key is held down, the click will register as mouse-3.
'reverse means that the the option-key will register for mouse-3
and the command-key will register for mouse-2. nil means that
diff --git a/src/macterm.h b/src/macterm.h
index 868ce88318c..f9bde772fcd 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -565,8 +565,18 @@ struct scroll_bar {
text from glomming up against the scroll bar */
#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
-
-struct frame * check_x_frame (Lisp_Object);
+struct frame;
+struct face;
+struct image;
+
+Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
+ Lisp_Object, Lisp_Object,
+ Lisp_Object, Lisp_Object));
+struct frame *check_x_frame P_ ((Lisp_Object));
+EXFUN (Fx_display_color_p, 1);
+EXFUN (Fx_display_grayscale_p, 1);
+EXFUN (Fx_display_planes, 1);
+extern void x_free_gcs P_ ((struct frame *));
void activate_scroll_bars (FRAME_PTR);
void deactivate_scroll_bars (FRAME_PTR);
diff --git a/src/makefile.nt b/src/makefile.nt
deleted file mode 100644
index 0cf08f37105..00000000000
--- a/src/makefile.nt
+++ /dev/null
@@ -1,1232 +0,0 @@
-# Makefile for GNU Emacs on the Microsoft W32 API.
-# Copyright (c) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
-# Tim Fleehart (apollo@online.com) 17-Apr-92
-# Geoff Voelker (voelker@cs.washington.edu) 11-20-93
-#
-# This file is part of GNU Emacs.
-#
-# GNU Emacs is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-
-#
-# Sets up the system dependent macros.
-#
-!include ..\nt\makefile.def
-
-SUBSYSTEM=console
-
-#
-# HAVE_CONFIG_H is required by some generic gnu sources stuck into
-# the emacs source tree.
-#
-LOCAL_FLAGS = -Demacs=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I..\nt\inc
-!ifdef NTGUI
-LOCAL_FLAGS = $(LOCAL_FLAGS) -DHAVE_NTGUI=1
-!endif
-!ifdef USE_CRT_DLL
-LOCAL_FLAGS = $(LOCAL_FLAGS) -DUSE_CRT_DLL=1 -MD
-libc = msvcrt.lib
-LINK_FLAGS = -nodefaultlib
-!endif
-
-# From MSVC 5.0 onwards, it seem base relocation information is not included,
-# at least in release builds. We need to ensure the reloc info is included
-# in order to use the MSVC profiler.
-!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
-EXTRA_LINK =
-!ELSE
-EXTRA_LINK = -profile
-!ENDIF
-
-EMACS = $(BLD)\emacs.exe
-TEMACS = $(BLD)\temacs.exe
-TEMACS_TMP = $(BLD)\temacs.bin
-TLIB0 = $(BLD)\temacs0.lib
-TLIB1 = $(BLD)\temacs1.lib
-TLIB2 = $(BLD)\temacs2.lib
-!IFDEF NTGUI
-TLIBW32 = $(BLD)\temacw32.lib
-!ELSE
-TLIBW32 =
-!ENDIF
-TOBJ = $(BLD)\firstfile.obj
-!if $(MSVCNT11)
-TRES = $(BLD)\emacs.res
-!else
-TRES = $(BLD)\emacs.rbj
-!endif
-TLASTLIB = $(BLD)\lastfile.lib
-
-# see comments in allocate_heap in w32heap.c before changing any of the
-# -stack, -heap, or -base settings.
-!if "$(BUILD_TYPE)" == "spd"
-LINK_FLAGS = $(LINK_FLAGS) $(ARCH_LDFLAGS) -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -debug:full -debugtype:both -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) -subsystem:$(SUBSYSTEM) -entry:_start -map:$(BLD)\temacs.map -swaprun:net -swaprun:cd
-!else
-LINK_FLAGS = $(LINK_FLAGS) $(ARCH_LDFLAGS) -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -debug:full -debugtype:both -pdb:none -machine:$(ARCH) -subsystem:$(SUBSYSTEM) -entry:_start -map:$(BLD)\temacs.map -swaprun:net -swaprun:cd $(EXTRA_LINK)
-!endif
-
-#
-# Split up the objects into two sets so that we don't run out of
-# command line space when we link them into a library.
-#
-# Put emacs.obj in a separate lib, since we need to have firstfile.obj
-# as the "main" object file when linking.
-#
-OBJ0 = $(BLD)\emacs.obj
-
-OBJ1 = $(BLD)\abbrev.obj \
- $(BLD)\alloc.obj \
- $(BLD)\alloca.obj \
- $(BLD)\atimer.obj \
- $(BLD)\buffer.obj \
- $(BLD)\bytecode.obj \
- $(BLD)\callint.obj \
- $(BLD)\callproc.obj \
- $(BLD)\casefiddle.obj \
- $(BLD)\cm.obj \
- $(BLD)\cmds.obj \
- $(BLD)\data.obj \
- $(BLD)\dired.obj \
- $(BLD)\dispnew.obj \
- $(BLD)\doc.obj \
- $(BLD)\doprnt.obj \
- $(BLD)\editfns.obj \
- $(BLD)\eval.obj \
- $(BLD)\fileio.obj \
- $(BLD)\filelock.obj \
- $(BLD)\filemode.obj \
- $(BLD)\fns.obj \
- $(BLD)\indent.obj \
- $(BLD)\insdel.obj \
- $(BLD)\keyboard.obj \
- $(BLD)\keymap.obj \
- $(BLD)\lread.obj \
- $(BLD)\macros.obj \
- $(BLD)\marker.obj \
- $(BLD)\md5.obj \
- $(BLD)\minibuf.obj
-
-OBJ2 = $(BLD)\w32.obj \
- $(BLD)\w32heap.obj \
- $(BLD)\w32inevt.obj \
- $(BLD)\w32proc.obj \
- $(BLD)\w32console.obj \
- $(BLD)\print.obj \
- $(BLD)\process.obj \
- $(BLD)\regex.obj \
- $(BLD)\scroll.obj \
- $(BLD)\search.obj \
- $(BLD)\syntax.obj \
- $(BLD)\sysdep.obj \
- $(BLD)\term.obj \
- $(BLD)\termcap.obj \
- $(BLD)\tparam.obj \
- $(BLD)\undo.obj \
- $(BLD)\unexw32.obj \
- $(BLD)\window.obj \
- $(BLD)\xdisp.obj \
- $(BLD)\casetab.obj \
- $(BLD)\floatfns.obj \
- $(BLD)\frame.obj \
- $(BLD)\gmalloc.obj \
- $(BLD)\intervals.obj \
- $(BLD)\composite.obj \
- $(BLD)\ralloc.obj \
- $(BLD)\textprop.obj \
- $(BLD)\vm-limit.obj \
- $(BLD)\region-cache.obj \
- $(BLD)\strftime.obj \
- $(BLD)\charset.obj \
- $(BLD)\coding.obj \
- $(BLD)\category.obj \
- $(BLD)\ccl.obj \
- $(BLD)\fontset.obj
-
-WIN32OBJ = $(BLD)\w32term.obj \
- $(BLD)\w32xfns.obj \
- $(BLD)\w32fns.obj \
- $(BLD)\xfaces.obj \
- $(BLD)\w32select.obj \
- $(BLD)\w32menu.obj \
- $(BLD)\w32reg.obj \
- $(BLD)\w32bdf.obj
-
-LIBS = $(TLIB0) \
- $(TLIB1) \
- $(TLIB2) \
-!IFDEF NTGUI
- $(TLIBW32) \
-!ENDIF
- $(TLASTLIB) \
-!IFDEF NTGUI
- gdi32.lib \
- comdlg32.lib \
-!ENDIF
-# libcmt.lib \
- $(BASE_LIBS) \
- $(ADVAPI32) \
- user32.lib \
- mpr.lib \
- shell32.lib \
- setargv.obj
-
-#
-# Build the executable and dump it.
-#
-all: $(BLD) $(EMACS)
-
-#
-# Headers we would preprocess if we could.
-#
-PREPARED_HEADERS = config.h epaths.h
-config.h: ..\nt\$(CONFIG_H)
- $(CP) $** $@
-epaths.h: ..\nt\paths.h
- $(CP) $** $@
-
-#
-# Make sure we have the DOC file in the right place.
-#
-DOC = $(OBJDIR)\etc\DOC-X
-$(DOC):; cd ..\lib-src
- - $(DEL) DOC-X
- $(MAKE) $(MFLAGS) -f makefile.nt all
- cd ..\src
-
-#
-# The dumped executable
-#
-emacs: $(EMACS)
-$(EMACS): $(DOC) $(TEMACS)
- $(MAKEDIR)\$(BLD)\temacs.exe -batch -l loadup dump
-
-#
-# The undumped executable
-# Note the extra post-link step to insert a static preload heap section.
-# If preload runs out of memory, increase the last argument to addsection
-# (it is the preload heap size in MB).
-#
-temacs: $(BLD) $(TEMACS)
-$(TEMACS): $(PREPARED_HEADERS) $(TLIB0) $(TLIB1) $(TLIB2) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES)
- $(LINK) -out:$(TEMACS_TMP) $(LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
- ..\nt\$(BLD)\addsection $(TEMACS_TMP) $(TEMACS) EMHEAP 16
-
-bootstrap: bootstrap-emacs
-
-#
-# Build a temacs with a sufficiently large PURESIZE to load the
-# Lisp files from loadup.el in source form.
-#
-bootstrap-temacs: bootstrap-clean
- $(MAKE) $(MFLAGS) -f makefile.nt temacs CFLAGS="$(CFLAGS) -DPURESIZE=5000000"
-
-#
-# Dump an Emacs executable named bootstrap-emacs containing the
-# files from loadup.el in source form.
-#
-bootstrap-emacs: bootstrap-temacs
- $(MAKEDIR)\$(BLD)\temacs.exe -batch -l loadup bootstrap
- - mkdir ..\bin
- $(CP) $(EMACS) ..\bin
-
-#
-# Force recompile of files that depend on PURESIZE
-#
-bootstrap-clean:
- - $(DEL) $(BLD)\alloc.obj
- - $(DEL) $(BLD)\data.obj
- - $(DEL) $(BLD)\intervals.obj
- - $(DEL) $(BLD)\keyboard.obj
- - $(DEL) $(BLD)\keymap.obj
-
-#
-# The resource file. NT 3.10 requires the use of cvtres; even though
-# it is not necessary on later versions, it is still ok to use it.
-#
-$(TRES): ..\nt\emacs.rc
- $(RC) -i..\nt -Fo$(BLD)\emacs.res $**
-!if !$(MSVCNT11)
- $(CVTRES) -r -$(ARCH) -o $@ $(BLD)\emacs.res
-!endif
-
-#
-# Build the library. Split up the build into two phases...otherwise we
-# run out of command line space.
-#
-$(TLIB0): $(OBJ0)
- @- $(AR) -out:$@ $**
-$(TLIB1): $(OBJ1)
- @- $(AR) -out:$@ $**
-$(TLIB2): $(OBJ2)
- @- $(AR) -out:$@ $**
-!IFDEF NTGUI
-$(TLIBW32): $(WIN32OBJ)
- @- $(AR) -out:$@ $**
-!ENDIF
-
-#
-# Place lastfile.obj in its own library so that it can be loaded after
-# the source libraries but before any system libraries. Doing so defines
-# the end of Emacs' data section portably across compilers and systems.
-#
-$(TLASTLIB): $(BLD)\lastfile.obj
- @- $(AR) -out:$@ $**
-
-#
-# Assuming INSTALL_DIR is defined, build and install emacs in it.
-#
-install: all
- - mkdir $(INSTALL_DIR)\bin
- $(CP) $(EMACS) $(INSTALL_DIR)\bin
-
-#
-# Maintenance
-#
-clean:; - $(DEL) *~ s\*~
- - $(DEL) *.pdb config.h epaths.h
- - $(DEL) *.orig *.rej *.crlf
- - $(DEL) s\*.orig s\*.rej s\*.crlf
- - $(DEL_TREE) deleted
- - $(DEL_TREE) obj
- - $(DEL_TREE) obj-spd
-
-#
-# These files are the ones that compile conditionally on CANNOT_DUMP...
-# this target is mostly used for debugging.
-#
-cleandump:; cd $(BLD)
- - $(DEL) callproc.obj data.obj dispnew.obj doc.obj editfns.obj emacs.obj lread.obj process.obj sysdep.obj term.obj w32heap.obj unexw32.obj
- cd ..\..
-
-
-### DEPENDENCIES ###
-
-EMACS_ROOT = ..
-SRC = .
-
-$(BLD)\abbrev.obj : \
- $(SRC)\abbrev.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h
-
-$(BLD)\alloc.obj : \
- $(SRC)\alloc.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\puresize.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h \
- $(SRC)\frame.h \
- $(SRC)\blockinput.h \
- $(SRC)\syssignal.h
-
-$(BLD)\alloca.obj : \
- $(SRC)\alloca.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\blockinput.h
-
-$(BLD)\atimer.obj : \
- $(SRC)\atimer.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\atimer.h \
- $(SRC)\syssignal.h \
- $(SRC)\systime.h \
- $(SRC)\blockinput.h
-
-$(BLD)\buffer.obj : \
- $(SRC)\buffer.c \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\indent.h \
- $(SRC)\blockinput.h \
- $(SRC)\region-cache.h
-
-$(BLD)\bytecode.obj : \
- $(SRC)\bytecode.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\syntax.h
-
-$(BLD)\callint.obj : \
- $(SRC)\callint.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h \
- $(SRC)\keyboard.h \
- $(SRC)\window.h
-
-$(BLD)\callproc.obj : \
- $(SRC)\callproc.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\msdos.h \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\process.h \
- $(SRC)\syssignal.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h
-
-$(BLD)\casefiddle.obj : \
- $(SRC)\casefiddle.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h \
- $(SRC)\syntax.h
- $(CC) $(CFLAGS) -Fo$@ casefiddle.c
-
-$(BLD)\casetab.obj : \
- $(SRC)\casetab.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h
-
-$(BLD)\cm.obj : \
- $(SRC)\cm.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\cm.h \
- $(SRC)\termhooks.h
-
-$(BLD)\cmds.obj : \
- $(SRC)\cmds.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\syntax.h
-
-$(BLD)\composite.obj : \
- $(SRC)\composite.c \
- $(SRC)\buffer.h \
- $(SRC)\charset.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\data.obj : \
- $(SRC)\data.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\puresize.h \
- $(SRC)\buffer.h \
- $(SRC)\syssignal.h
-
-$(BLD)\dired.obj : \
- $(SRC)\dired.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\ndir.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h \
- $(SRC)\regex.h
-
-$(BLD)\dispnew.obj : \
- $(SRC)\dispnew.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\termchar.h \
- $(SRC)\termopts.h \
- $(SRC)\termhooks.h \
- $(SRC)\cm.h \
- $(SRC)\buffer.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\commands.h \
- $(SRC)\disptab.h \
- $(SRC)\indent.h \
- $(SRC)\dispextern.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\xterm.h \
- $(SRC)\systime.h
-
-$(BLD)\doc.obj : \
- $(SRC)\doc.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\buffer.h \
- $(SRC)\keyboard.h
-
-$(BLD)\doprnt.obj : \
- $(SRC)\doprnt.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\dosfns.obj : \
- $(SRC)\dosfns.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\termchar.h \
- $(SRC)\termhooks.h \
- $(SRC)\frame.h \
- $(SRC)\dosfns.h \
- $(SRC)\msdos.h
-
-$(BLD)\editfns.obj : \
- $(SRC)\editfns.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\uaf.h \
- $(EMACS_ROOT)\nt\inc\pwd.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h \
- $(SRC)\systime.h
-
-$(BLD)\emacs.obj : \
- $(SRC)\emacs.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h \
- $(SRC)\syssignal.h \
- $(SRC)\process.h
-
-$(BLD)\eval.obj : \
- $(SRC)\eval.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\blockinput.h \
- $(SRC)\commands.h \
- $(SRC)\keyboard.h
-
-$(BLD)\fileio.obj : \
- $(SRC)\fileio.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\uaf.h \
- $(EMACS_ROOT)\nt\inc\pwd.h \
- $(SRC)\msdos.h \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systime.h
-
-$(BLD)\filelock.obj : \
- $(SRC)\filelock.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\uaf.h \
- $(EMACS_ROOT)\nt\inc\pwd.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(EMACS_ROOT)\src\epaths.h \
- $(SRC)\buffer.h \
- $(SRC)\ndir.h
-
-$(BLD)\filemode.obj : \
- $(SRC)\filemode.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h
-
-$(BLD)\firstfile.obj : \
- $(SRC)\firstfile.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\floatfns.obj : \
- $(SRC)\floatfns.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\syssignal.h
-
-$(BLD)\fns.obj : \
- $(SRC)\fns.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\keyboard.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\md5.h
-
-$(BLD)\frame.obj : \
- $(SRC)\frame.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\frame.h \
- $(SRC)\termhooks.h \
- $(SRC)\window.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h \
- $(SRC)\keyboard.h
-
-$(BLD)\getloadavg.obj : \
- $(SRC)\getloadavg.c \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h
-
-$(BLD)\gmalloc.obj : \
- $(SRC)\gmalloc.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(SRC)\getpagesize.h
- $(CC) $(CFLAGS) -D__STDC__ -Fo$@ gmalloc.c
-
-$(BLD)\hftctl.obj : \
- $(SRC)\hftctl.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h
-
-$(BLD)\indent.obj : \
- $(SRC)\indent.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\indent.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\termchar.h \
- $(SRC)\termopts.h \
- $(SRC)\disptab.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\region-cache.h \
- $(SRC)\composite.h
-
-$(BLD)\insdel.obj : \
- $(SRC)\insdel.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h \
- $(SRC)\blockinput.h
-
-$(BLD)\intervals.obj : \
- $(SRC)\intervals.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\keyboard.h \
- $(SRC)\buffer.h \
- $(SRC)\puresize.h
-
-$(BLD)\keyboard.obj : \
- $(SRC)\keyboard.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\termchar.h \
- $(SRC)\termopts.h \
- $(SRC)\termhooks.h \
- $(SRC)\macros.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\disptab.h \
- $(SRC)\keyboard.h \
- $(SRC)\dispextern.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\blockinput.h \
- $(SRC)\msdos.h \
- $(SRC)\syssignal.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\xterm.h \
- $(SRC)\systime.h \
- $(SRC)\atimer.h
-
-$(BLD)\keymap.obj : \
- $(SRC)\keymap.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\keyboard.h \
- $(SRC)\termhooks.h \
- $(SRC)\blockinput.h
-
-$(BLD)\lastfile.obj : \
- $(SRC)\lastfile.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\lread.obj : \
- $(SRC)\lread.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\buffer.h \
- $(EMACS_ROOT)\src\epaths.h \
- $(SRC)\commands.h \
- $(SRC)\keyboard.h \
- $(SRC)\termhooks.h \
- $(SRC)\msdos.h
-
-$(BLD)\macros.obj : \
- $(SRC)\macros.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\macros.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h
-
-$(BLD)\marker.obj : \
- $(SRC)\marker.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h
-
-$(BLD)\md5.obj : \
- $(SRC)\md5.c \
- $(SRC)\md5.h
-
-$(BLD)\minibuf.obj : \
- $(SRC)\minibuf.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\syntax.h
-
-$(BLD)\w32.obj : \
- $(SRC)\w32.c \
- $(SRC)\w32.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(EMACS_ROOT)\nt\inc\pwd.h \
- $(SRC)\w32heap.h
-
-$(BLD)\w32heap.obj : \
- $(SRC)\w32heap.c \
- $(SRC)\w32heap.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h
-
-$(BLD)\w32inevt.obj : \
- $(SRC)\w32inevt.c \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\frame.h \
- $(SRC)\blockinput.h \
- $(SRC)\termhooks.h \
- $(SRC)\w32heap.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h
-
-$(BLD)\w32proc.obj : \
- $(SRC)\w32proc.c \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\w32.h \
- $(SRC)\w32heap.h \
- $(SRC)\systime.h
-
-$(BLD)\w32console.obj : \
- $(SRC)\w32console.c \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\frame.h \
- $(SRC)\disptab.h \
- $(SRC)\termhooks.h \
- $(SRC)\w32inevt.h
-
-$(BLD)\prefix-args.obj : \
- $(SRC)\prefix-args.c
-
-$(BLD)\print.obj : \
- $(SRC)\print.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\process.h \
- $(SRC)\termchar.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h
-
-$(BLD)\process.obj : \
- $(SRC)\process.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h \
- $(SRC)\window.h \
- $(SRC)\buffer.h \
- $(SRC)\process.h \
- $(SRC)\termhooks.h \
- $(SRC)\commands.h \
- $(SRC)\frame.h \
- $(SRC)\syssignal.h \
- $(SRC)\syswait.h \
- $(SRC)\systime.h \
- $(SRC)\termopts.h \
- $(SRC)\composite.h \
- $(SRC)\atimer.h
-
-$(BLD)\ralloc.obj : \
- $(SRC)\ralloc.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(SRC)\getpagesize.h
-
-$(BLD)\regex.obj : \
- $(SRC)\regex.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\s\ms-w32.h \
- $(SRC)\m\intel386.h \
- $(SRC)\config.h \
- $(SRC)\buffer.h \
- $(SRC)\syntax.h \
- $(SRC)\regex.h
-
-$(BLD)\region-cache.obj : \
- $(SRC)\region-cache.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\region-cache.h
-
-$(BLD)\scroll.obj : \
- $(SRC)\scroll.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\termchar.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\frame.h
-
-$(BLD)\search.obj : \
- $(SRC)\search.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\syntax.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h \
- $(SRC)\blockinput.h \
- $(SRC)\regex.h \
- $(SRC)\region-cache.h \
- $(SRC)\composite.h
-
-$(BLD)\strftime.obj : \
- $(SRC)\strftime.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\syntax.obj : \
- $(SRC)\syntax.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\commands.h \
- $(SRC)\buffer.h \
- $(SRC)\syntax.h \
- $(SRC)\composite.h
-
-$(BLD)\sysdep.obj : \
- $(SRC)\sysdep.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\blockinput.h \
- $(SRC)\dosfns.h \
- $(SRC)\msdos.h \
- $(EMACS_ROOT)\nt\inc\sys\param.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h \
- $(SRC)\systty.h \
- $(SRC)\syswait.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\termhooks.h \
- $(SRC)\termchar.h \
- $(SRC)\termopts.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\process.h \
- $(SRC)\ndir.h \
- $(SRC)\syssignal.h \
- $(SRC)\systime.h \
- $(SRC)\uaf.h \
- $(EMACS_ROOT)\src\acldef.h \
- $(EMACS_ROOT)\src\chpdef.h
-
-$(BLD)\term.obj : \
- $(SRC)\term.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\termchar.h \
- $(SRC)\termopts.h \
- $(SRC)\cm.h \
- $(SRC)\frame.h \
- $(SRC)\disptab.h \
- $(SRC)/dispextern.h \
- $(SRC)\termhooks.h \
- $(SRC)\keyboard.h
-
-$(BLD)\termcap.obj : \
- $(SRC)\termcap.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(EMACS_ROOT)\nt\inc\sys\file.h
-
-$(BLD)\terminfo.obj : \
- $(SRC)\terminfo.c
-
-$(BLD)\textprop.obj : \
- $(SRC)\textprop.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h
-
-$(BLD)\tparam.obj : \
- $(SRC)\tparam.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h
-
-$(BLD)\undo.obj : \
- $(SRC)\undo.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\commands.h
-
-$(BLD)\unexw32.obj : \
- $(SRC)\unexw32.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32heap.h
-
-$(BLD)\vm-limit.obj : \
- $(SRC)\vm-limit.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\mem-limits.h
-
-$(BLD)\widget.obj : \
- $(SRC)\widget.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\xterm.h \
- $(SRC)\frame.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\widget.h \
- $(SRC)\widgetprv.h
-
-$(BLD)\window.obj : \
- $(SRC)\window.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\buffer.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\commands.h \
- $(SRC)\indent.h \
- $(SRC)\termchar.h \
- $(SRC)\disptab.h \
- $(SRC)\keyboard.h \
- $(SRC)\composite.h
-
-$(BLD)\xdisp.obj : \
- $(SRC)\xdisp.c \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\termchar.h \
- $(SRC)\buffer.h \
- $(SRC)\indent.h \
- $(SRC)\commands.h \
- $(SRC)\macros.h \
- $(SRC)\disptab.h \
- $(SRC)\termhooks.h \
- $(SRC)\dispextern.h \
- $(SRC)\w32gui.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h
-
-$(BLD)\xfaces.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\xfaces.c \
- $(SRC)\charset.h \
- $(SRC)\fontset.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\buffer.h \
- $(SRC)\dispextern.h \
- $(SRC)\frame.h \
- $(SRC)\blockinput.h \
- $(SRC)\window.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h
-
-$(BLD)\w32fns.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32fns.c \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\buffer.h \
- $(SRC)\charset.h \
- $(SRC)\coding.h \
- $(SRC)\dispextern.h \
- $(SRC)\keyboard.h \
- $(SRC)\blockinput.h \
- $(SRC)\epaths.h \
- $(SRC)\w32heap.h \
- $(SRC)\termhooks.h
-
-$(BLD)\w32menu.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32menu.c \
- $(SRC)\termhooks.h \
- $(SRC)\frame.h \
- $(SRC)\window.h \
- $(SRC)\keyboard.h \
- $(SRC)\blockinput.h \
- $(SRC)\buffer.h \
- $(SRC)\charset.h \
- $(SRC)\coding.h
-
-$(BLD)\w32term.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32term.c \
- $(SRC)\blockinput.h \
- $(SRC)\w32heap.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\systty.h \
- $(SRC)\systime.h \
- $(SRC)\frame.h \
- $(SRC)\dispextern.h \
- $(SRC)\termhooks.h \
- $(SRC)\termopts.h \
- $(SRC)\termchar.h \
- $(SRC)\gnu.h \
- $(SRC)\disptab.h \
- $(SRC)\buffer.h \
- $(SRC)\window.h \
- $(SRC)\keyboard.h \
- $(SRC)\intervals.h \
- $(SRC)\composite.h \
- $(SRC)\atimer.h
-
-$(BLD)\w32select.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32select.c \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\dispextern.h \
- $(SRC)\frame.h \
- $(SRC)\blockinput.h
-
-$(BLD)\w32reg.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32reg.c \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\blockinput.h
-
-$(BLD)\w32xfns.obj: \
- $(EMACS_ROOT)\src\s\ms-w32.h \
- $(EMACS_ROOT)\src\m\intel386.h \
- $(EMACS_ROOT)\src\config.h \
- $(SRC)\w32xfns.c \
-
-$(BLD)\w32bdf.obj: \
- $(EMACS_ROOT)\src/s\ms-w32.h \
- $(EMACS_ROOT)\src/m\intel386.h \
- $(EMACS_ROOT)\src/config.h \
- $(SRC)\w32bdf.c \
- $(SRC)\charset.h \
- $(SRC)\frame.h \
- $(SRC)\dispextern.h \
- $(SRC)\fontset.h \
- $(SRC)\blockinput.h \
- $(SRC)\w32gui.h \
- $(SRC)\w32term.h \
- $(SRC)\w32gui.h \
- $(SRC)\w32bdf.h \
- $(SRC)\w32.h \
- $(SRC)\frame.h \
- $(SRC)\blockinput.h
-
-# arch-tag: ee9a97ba-19b7-4b50-a127-aaf4efe494dc
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 99a04ecc17d..a7efcc4cae5 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -1,5 +1,5 @@
-# Makefile for GNU Emacs on the Microsoft W32 API.
-# Copyright (c) 2000-2001 Free Software Foundation, Inc.
+# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
+# Copyright (c) 2000-2001, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
@@ -115,8 +115,6 @@ OBJ1 = $(BLD)/abbrev.$(O) \
$(BLD)/region-cache.$(O) \
$(BLD)/strftime.$(O) \
$(BLD)/charset.$(O) \
- $(BLD)/character.$(O) \
- $(BLD)/chartab.$(O) \
$(BLD)/coding.$(O) \
$(BLD)/category.$(O) \
$(BLD)/ccl.$(O) \
@@ -124,7 +122,6 @@ OBJ1 = $(BLD)/abbrev.$(O) \
$(BLD)/fringe.$(O) \
$(BLD)/image.$(O)
-
WIN32OBJ = $(BLD)/w32term.$(O) \
$(BLD)/w32xfns.$(O) \
$(BLD)/w32fns.$(O) \
@@ -170,7 +167,7 @@ $(EMACS): $(DOC) $(TEMACS)
temacs: $(BLD) $(TEMACS)
$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES)
$(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
- "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 20
+ "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16
bootstrap: bootstrap-emacs
@@ -265,7 +262,6 @@ $(BLD)/abbrev.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/dispextern.h \
@@ -281,7 +277,6 @@ $(BLD)/alloc.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -364,7 +359,6 @@ $(BLD)/callproc.$(O) : \
$(EMACS_ROOT)/nt/inc/sys/file.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -381,7 +375,6 @@ $(BLD)/casefiddle.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -403,7 +396,6 @@ $(BLD)/category.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/category.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/keymap.h
@@ -413,22 +405,9 @@ $(BLD)/ccl.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h
-$(BLD)/character.$(O) : \
- $(SRC)/character.c \
- $(EMACS_ROOT)/src/s/ms-w32.h \
- $(EMACS_ROOT)/src/m/intel386.h \
- $(EMACS_ROOT)/src/config.h \
- $(SRC)/buffer.h \
- $(SRC)/character.h \
- $(SRC)/charset.h \
- $(SRC)/coding.h \
- $(SRC)/composite.h \
- $(SRC)/disptab.h
-
$(BLD)/charset.$(O) : \
$(SRC)/charset.c \
$(EMACS_ROOT)/src/s/ms-w32.h \
@@ -436,20 +415,11 @@ $(BLD)/charset.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
$(SRC)/disptab.h
-$(BLD)/chartab.$(O) : \
- $(SRC)/chartab.c \
- $(EMACS_ROOT)/src/s/ms-w32.h \
- $(EMACS_ROOT)/src/m/intel386.h \
- $(EMACS_ROOT)/src/config.h \
- $(SRC)/charset.h \
- $(SRC)/character.h
-
$(BLD)/cm.$(O) : \
$(SRC)/cm.c \
$(EMACS_ROOT)/src/s/ms-w32.h \
@@ -464,7 +434,6 @@ $(BLD)/cmds.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/dispextern.h \
@@ -482,7 +451,6 @@ $(BLD)/coding.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
@@ -498,7 +466,6 @@ $(BLD)/composite.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -512,7 +479,6 @@ $(BLD)/data.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/frame.h \
$(SRC)/keyboard.h \
@@ -526,7 +492,6 @@ $(BLD)/dired.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -544,7 +509,6 @@ $(BLD)/dispnew.$(O) : \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/cm.h \
$(SRC)/commands.h \
@@ -573,7 +537,6 @@ $(BLD)/doc.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(EMACS_ROOT)/nt/inc/sys/file.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/keyboard.h \
$(SRC)/keymap.h
@@ -583,7 +546,6 @@ $(BLD)/doprnt.$(O) : \
$(EMACS_ROOT)/src/s/ms-w32.h \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
- $(SRC)/character.h \
$(SRC)/charset.c
$(BLD)/editfns.$(O) : \
@@ -594,7 +556,6 @@ $(BLD)/editfns.$(O) : \
$(EMACS_ROOT)/nt/inc/pwd.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
@@ -655,7 +616,6 @@ $(BLD)/fileio.$(O) : \
$(EMACS_ROOT)/nt/inc/sys/file.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -677,7 +637,6 @@ $(BLD)/filelock.$(O) : \
$(EMACS_ROOT)/src/epaths.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/systime.h
@@ -713,7 +672,6 @@ $(BLD)/fns.$(O) : \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -736,7 +694,6 @@ $(BLD)/fontset.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/dispextern.h \
$(SRC)/fontset.h \
@@ -754,7 +711,6 @@ $(BLD)/frame.$(O) : \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/dispextern.h \
@@ -816,7 +772,6 @@ $(BLD)/indent.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/category.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -840,7 +795,6 @@ $(BLD)/insdel.$(O) : \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -876,7 +830,6 @@ $(BLD)/keyboard.$(O) : \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -908,7 +861,6 @@ $(BLD)/keymap.$(O) : \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -937,7 +889,6 @@ $(BLD)/lread.$(O) : \
$(EMACS_ROOT)/src/epaths.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -969,7 +920,6 @@ $(BLD)/marker.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h
$(BLD)/md5.$(O) : \
@@ -982,7 +932,6 @@ $(BLD)/minibuf.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -1050,7 +999,6 @@ $(BLD)/w32console.$(O) : \
$(SRC)/s/ms-w32.h \
$(SRC)/m/intel386.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/config.h \
@@ -1068,7 +1016,6 @@ $(BLD)/print.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -1092,7 +1039,6 @@ $(BLD)/process.$(O) : \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -1132,7 +1078,6 @@ $(BLD)/regex.$(O) : \
$(SRC)/m/intel386.h \
$(SRC)/buffer.h \
$(SRC)/category.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/config.h \
$(SRC)/regex.h \
@@ -1168,7 +1113,6 @@ $(BLD)/search.$(O) : \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/category.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -1201,7 +1145,6 @@ $(BLD)/syntax.$(O) : \
$(EMACS_ROOT)/src/config.h \
$(SRC)/buffer.h \
$(SRC)/category.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
@@ -1246,7 +1189,6 @@ $(BLD)/term.$(O) : \
$(EMACS_ROOT)/src/m/intel386.h \
$(EMACS_ROOT)/src/config.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/cm.h \
$(SRC)/coding.h \
@@ -1343,7 +1285,6 @@ $(BLD)/xdisp.$(O) : \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/commands.h \
@@ -1375,7 +1316,6 @@ $(BLD)/xfaces.$(O): \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/composite.h \
$(SRC)/dispextern.h \
@@ -1398,7 +1338,6 @@ $(BLD)/w32fns.$(O): \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
@@ -1424,7 +1363,6 @@ $(BLD)/w32menu.$(O): \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/dispextern.h \
@@ -1447,7 +1385,6 @@ $(BLD)/w32term.$(O): \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
@@ -1479,7 +1416,6 @@ $(BLD)/w32select.$(O): \
$(SRC)/blockinput.h \
$(SRC)/buffer.h \
$(SRC)/ccl.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/coding.h \
$(SRC)/composite.h \
@@ -1510,7 +1446,6 @@ $(BLD)/w32xfns.$(O): \
$(EMACS_ROOT)/src/config.h \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/fontset.h \
$(SRC)/frame.h \
@@ -1527,7 +1462,6 @@ $(BLD)/w32bdf.$(O): \
$(EMACS_ROOT)/src/config.h \
$(SRC)/atimer.h \
$(SRC)/blockinput.h \
- $(SRC)/character.h \
$(SRC)/charset.h \
$(SRC)/dispextern.h \
$(SRC)/fontset.h \
@@ -1537,5 +1471,3 @@ $(BLD)/w32bdf.$(O): \
$(SRC)/w32bdf.h \
$(SRC)/w32gui.h \
$(SRC)/w32term.h
-
-# arch-tag: 9fd7aba8-f826-4111-b3c0-497a8e7db9a0
diff --git a/src/mem-limits.h b/src/mem-limits.h
index 578cf59f12e..57a79863a1b 100644
--- a/src/mem-limits.h
+++ b/src/mem-limits.h
@@ -1,5 +1,5 @@
/* Includes for memory limit warnings.
- Copyright (C) 1990, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1990, 93, 94, 95, 1996, 2004 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -81,7 +81,9 @@ typedef unsigned long SIZE;
#define NULL ((POINTER) 0)
extern POINTER start_of_data ();
-#ifdef DATA_SEG_BITS
+#if defined USE_LSB_TAG
+#define EXCEEDS_LISP_PTR(ptr) 0
+#elif defined DATA_SEG_BITS
#define EXCEEDS_LISP_PTR(ptr) \
(((EMACS_UINT) (ptr) & ~DATA_SEG_BITS) >> VALBITS)
#else
diff --git a/src/minibuf.c b/src/minibuf.c
index 2feac10f2b7..a313016154e 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1,5 +1,5 @@
/* Minibuffer input and completion.
- Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03
+ Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -209,6 +209,7 @@ without invoking the usual minibuffer commands. */)
/* Actual minibuffer invocation. */
static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object));
+static Lisp_Object run_exit_minibuf_hook P_ ((Lisp_Object));
static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
int, Lisp_Object,
@@ -563,6 +564,12 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
record_unwind_protect (read_minibuf_unwind, Qnil);
minibuf_level++;
+ /* We are exiting the minibuffer one way or the other, so run the hook.
+ It should be run before unwinding the minibuf settings. Do it
+ separately from read_minibuf_unwind because we need to make sure that
+ read_minibuf_unwind is fully executed even if exit-minibuffer-hook
+ signals an error. --Stef */
+ record_unwind_protect (run_exit_minibuf_hook, Qnil);
/* Now that we can restore all those variables, start changing them. */
@@ -822,6 +829,17 @@ get_minibuffer (depth)
return buf;
}
+static Lisp_Object
+run_exit_minibuf_hook (data)
+ Lisp_Object data;
+{
+ if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound)
+ && !NILP (Vrun_hooks))
+ safe_run_hooks (Qminibuffer_exit_hook);
+
+ return Qnil;
+}
+
/* This function is called on exiting minibuffer, whether normally or
not, and it restores the current window, buffer, etc. */
@@ -832,12 +850,6 @@ read_minibuf_unwind (data)
Lisp_Object old_deactivate_mark;
Lisp_Object window;
- /* We are exiting the minibuffer one way or the other,
- so run the hook. */
- if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound)
- && !NILP (Vrun_hooks))
- safe_run_hooks (Qminibuffer_exit_hook);
-
/* If this was a recursive minibuffer,
tie the minibuffer window back to the outer level minibuffer buffer. */
minibuf_level--;
@@ -1195,6 +1207,7 @@ is used to further constrain the set of candidates. */)
|| NILP (XCAR (alist))));
int index = 0, obsize = 0;
int matchcount = 0;
+ int bindcount = -1;
Lisp_Object bucket, zero, end, tem;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -1274,16 +1287,18 @@ is used to further constrain the set of candidates. */)
/* Ignore this element if it fails to match all the regexps. */
{
- int count = SPECPDL_INDEX ();
- specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
+ if (bindcount < 0) {
+ bindcount = SPECPDL_INDEX ();
+ specbind (Qcase_fold_search,
+ completion_ignore_case ? Qt : Qnil);
+ }
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
- unbind_to (count, Qnil);
if (CONSP (regexps))
continue;
}
@@ -1297,6 +1312,10 @@ is used to further constrain the set of candidates. */)
tem = Fcommandp (elt, Qnil);
else
{
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
GCPRO4 (tail, string, eltstring, bestmatch);
tem = type == 3
? call2 (predicate, elt,
@@ -1378,6 +1397,11 @@ is used to further constrain the set of candidates. */)
}
}
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
+
if (NILP (bestmatch))
return Qnil; /* No completions found */
/* If we are ignoring case, and there is no exact match,
@@ -1440,6 +1464,7 @@ are ignored unless STRING itself starts with a space. */)
&& (!SYMBOLP (XCAR (alist))
|| NILP (XCAR (alist))));
int index = 0, obsize = 0;
+ int bindcount = -1;
Lisp_Object bucket, tem;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -1525,16 +1550,18 @@ are ignored unless STRING itself starts with a space. */)
/* Ignore this element if it fails to match all the regexps. */
{
- int count = SPECPDL_INDEX ();
- specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
+ if (bindcount < 0) {
+ bindcount = SPECPDL_INDEX ();
+ specbind (Qcase_fold_search,
+ completion_ignore_case ? Qt : Qnil);
+ }
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
- unbind_to (count, Qnil);
if (CONSP (regexps))
continue;
}
@@ -1548,6 +1575,10 @@ are ignored unless STRING itself starts with a space. */)
tem = Fcommandp (elt, Qnil);
else
{
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
GCPRO4 (tail, eltstring, allmatches, string);
tem = type == 3
? call2 (predicate, elt,
@@ -1562,6 +1593,11 @@ are ignored unless STRING itself starts with a space. */)
}
}
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
+
return Fnreverse (allmatches);
}
@@ -1602,7 +1638,7 @@ HIST, if non-nil, specifies a history list and optionally the initial
is the initial position (the position in the list used by the
minibuffer history commands). For consistency, you should also
specify that element of the history as the value of
- INITIAL-CONTENTS. (This is the only case in which you should use
+ INITIAL-INPUT. (This is the only case in which you should use
INITIAL-INPUT instead of DEF.) Positions are counted starting from
1 at the beginning of the list. The variable `history-length'
controls the maximum length of a history list.
@@ -1772,19 +1808,20 @@ the values STRING, PREDICATE and `lambda'. */)
return call3 (alist, string, predicate, Qlambda);
/* Reject this element if it fails to match all the regexps. */
- {
- int count = SPECPDL_INDEX ();
- specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
- for (regexps = Vcompletion_regexp_list; CONSP (regexps);
- regexps = XCDR (regexps))
- {
- if (NILP (Fstring_match (XCAR (regexps),
- SYMBOLP (tem) ? string : tem,
- Qnil)))
- return unbind_to (count, Qnil);
- }
- unbind_to (count, Qnil);
- }
+ if (CONSP (Vcompletion_regexp_list))
+ {
+ int count = SPECPDL_INDEX ();
+ specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
+ for (regexps = Vcompletion_regexp_list; CONSP (regexps);
+ regexps = XCDR (regexps))
+ {
+ if (NILP (Fstring_match (XCAR (regexps),
+ SYMBOLP (tem) ? string : tem,
+ Qnil)))
+ return unbind_to (count, Qnil);
+ }
+ unbind_to (count, Qnil);
+ }
/* Finally, check the predicate. */
if (!NILP (predicate))
diff --git a/src/msdos.c b/src/msdos.c
index c4e9197ab49..d0de02aba3f 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h> /* for chdir, dup, dup2, etc. */
#include <dir.h> /* for getdisk */
#if __DJGPP__ >= 2
+#pragma pack(0) /* dir.h does a pack(4), which isn't GCC's default */
#include <fcntl.h>
#include <io.h> /* for setmode */
#include <dpmi.h> /* for __dpmi_xxx stuff */
@@ -950,8 +951,8 @@ static void
IT_write_glyphs (struct glyph *str, int str_len)
{
unsigned char *screen_buf, *screen_bp, *screen_buf_end, *bp;
- int unsupported_face = FAST_GLYPH_FACE (Vdos_unsupported_char_glyph);
- unsigned unsupported_char= FAST_GLYPH_CHAR (Vdos_unsupported_char_glyph);
+ int unsupported_face = 0;
+ unsigned unsupported_char = '\177';
int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
register int sl = str_len;
register int tlen = GLYPH_TABLE_LENGTH;
@@ -977,6 +978,13 @@ IT_write_glyphs (struct glyph *str, int str_len)
if (str_len <= 0) return;
+ /* Set up the unsupported character glyph */
+ if (!NILP (Vdos_unsupported_char_glyph))
+ {
+ unsupported_char = FAST_GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph));
+ unsupported_face = FAST_GLYPH_FACE (XINT (Vdos_unsupported_char_glyph));
+ }
+
screen_buf = screen_bp = alloca (str_len * 2);
screen_buf_end = screen_buf + str_len * 2;
sf = SELECTED_FRAME();
@@ -1041,7 +1049,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
if (! CHAR_VALID_P (ch, 0))
{
g = !NILP (Vdos_unsupported_char_glyph)
- ? Vdos_unsupported_char_glyph
+ ? XINT (Vdos_unsupported_char_glyph)
: MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g));
ch = FAST_GLYPH_CHAR (g);
}
@@ -1571,7 +1579,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
{
extern Lisp_Object Qmouse_face;
Lisp_Object mouse_face, overlay, position, *overlay_vec;
- int len, noverlays, obegv, ozv;;
+ int noverlays, obegv, ozv;;
struct buffer *obuf;
/* If we get an out-of-range value, return now; avoid an error. */
@@ -1590,20 +1598,8 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
/* Is this char mouse-active or does it have help-echo? */
XSETINT (position, pos);
- /* Put all the overlays we want in a vector in overlay_vec.
- Store the length in len. If there are more than 10, make
- enough space for all, and try again. */
- len = 10;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
- if (noverlays > len)
- {
- len = noverlays;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos,
- 0, &overlay_vec, &len, NULL, NULL, 0);
- }
-
+ /* Put all the overlays we want in a vector in overlay_vec. */
+ GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
/* Sort overlays into increasing priority order. */
noverlays = sort_overlays (overlay_vec, noverlays, w);
@@ -4408,9 +4404,28 @@ init_environment (argc, argv, skip_args)
for (i = 0; i < imax ; i++)
{
const char *tmp = tempdirs[i];
+ char buf[FILENAME_MAX];
if (*tmp == '$')
- tmp = getenv (tmp + 1);
+ {
+ int tmp_len;
+
+ tmp = getenv (tmp + 1);
+ if (!tmp)
+ continue;
+
+ /* Some lusers set TMPDIR=e:, probably because some losing
+ programs cannot handle multiple slashes if they use e:/.
+ e: fails in `access' below, so we interpret e: as e:/. */
+ tmp_len = strlen(tmp);
+ if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\')
+ {
+ strcpy(buf, tmp);
+ buf[tmp_len++] = '/', buf[tmp_len] = 0;
+ tmp = buf;
+ }
+ }
+
/* Note that `access' can lie to us if the directory resides on a
read-only filesystem, like CD-ROM or a write-protected floppy.
The only way to be really sure is to actually create a file and
@@ -5272,7 +5287,7 @@ syms_of_msdos ()
DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph,
doc: /* *Glyph to display instead of chars not supported by current codepage.
This variable is used only by MSDOS terminals. */);
- Vdos_unsupported_char_glyph = '\177';
+ Vdos_unsupported_char_glyph = make_number ('\177');
#endif
#ifndef subprocesses
diff --git a/src/print.c b/src/print.c
index 8d0a5e2bb3b..4b94d77e876 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,5 +1,5 @@
/* Lisp object printing and output streams.
- Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 01, 2003
+ Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 01, 03, 2004
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -601,6 +601,8 @@ temp_output_buffer_setup (bufname)
eassert (current_buffer->overlays_after == NULL);
current_buffer->enable_multibyte_characters
= buffer_defaults.enable_multibyte_characters;
+ specbind (Qinhibit_read_only, Qt);
+ specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
XSETBUFFER (buf, current_buffer);
@@ -789,7 +791,7 @@ A printed representation of an object is text which describes that object. */)
if (SBYTES (object) == SCHARS (object))
STRING_SET_UNIBYTE (object);
- /* Note that this won't make prepare_to_modify_buffer call
+ /* Note that this won't make prepare_to_modify_buffer call
ask-user-about-supersession-threat because this buffer
does not visit a file. */
Ferase_buffer ();
@@ -927,7 +929,7 @@ DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugg
doc: /* Redirect debugging output (stderr stream) to file FILE.
If FILE is nil, reset target to the initial stderr stream.
Optional arg APPEND non-nil (interactively, with prefix arg) means
-append to existing target file. */)
+append to existing target file. */)
(file, append)
Lisp_Object file, append;
{
@@ -1218,7 +1220,6 @@ print (obj, printcharfun, escapeflag)
register Lisp_Object printcharfun;
int escapeflag;
{
- print_depth = 0;
old_backquote_output = 0;
/* Reset print_number_index and Vprint_number_table only when
@@ -1238,6 +1239,7 @@ print (obj, printcharfun, escapeflag)
start = index = print_number_index;
/* Construct Vprint_number_table.
This increments print_number_index for the objects added. */
+ print_depth = 0;
print_preprocess (obj);
/* Remove unnecessary objects, which appear only once in OBJ;
@@ -1262,6 +1264,7 @@ print (obj, printcharfun, escapeflag)
print_number_index = index;
}
+ print_depth = 0;
print_object (obj, printcharfun, escapeflag);
}
@@ -1278,6 +1281,26 @@ print_preprocess (obj)
{
int i;
EMACS_INT size;
+ int loop_count = 0;
+ Lisp_Object halftail;
+
+ /* Avoid infinite recursion for circular nested structure
+ in the case where Vprint_circle is nil. */
+ if (NILP (Vprint_circle))
+ {
+ for (i = 0; i < print_depth; i++)
+ if (EQ (obj, being_printed[i]))
+ return;
+ being_printed[print_depth] = obj;
+ }
+
+ /* Give up if we go so deep that print_object will get an error. */
+ /* See similar code in print_object. */
+ if (print_depth >= PRINT_CIRCLE)
+ return;
+
+ print_depth++;
+ halftail = obj;
loop:
if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
@@ -1338,8 +1361,15 @@ print_preprocess (obj)
break;
case Lisp_Cons:
+ /* Use HALFTAIL and LOOP_COUNT to detect circular lists,
+ just as in print_object. */
+ if (loop_count && EQ (obj, halftail))
+ break;
print_preprocess (XCAR (obj));
obj = XCDR (obj);
+ loop_count++;
+ if (!(loop_count & 1))
+ halftail = XCDR (halftail);
goto loop;
case Lisp_Vectorlike:
@@ -1354,6 +1384,7 @@ print_preprocess (obj)
break;
}
}
+ print_depth--;
}
static void
@@ -1457,7 +1488,7 @@ print_object (obj, printcharfun, escapeflag)
register Lisp_Object printcharfun;
int escapeflag;
{
- char buf[30];
+ char buf[40];
QUIT;
@@ -1511,6 +1542,7 @@ print_object (obj, printcharfun, escapeflag)
print_depth++;
+ /* See similar code in print_preprocess. */
if (print_depth > PRINT_CIRCLE)
error ("Apparently circular structure being printed");
#ifdef MAX_PRINT_CHARS
@@ -1876,18 +1908,14 @@ print_object (obj, printcharfun, escapeflag)
register unsigned char c;
struct gcpro gcpro1;
int size_in_chars
- = (XBOOL_VECTOR (obj)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
+ = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
GCPRO1 (obj);
PRINTCHAR ('#');
PRINTCHAR ('&');
- if (sizeof (int) == sizeof (EMACS_INT))
- sprintf (buf, "%d", XBOOL_VECTOR (obj)->size);
- else if (sizeof (long) == sizeof (EMACS_INT))
- sprintf (buf, "%ld", XBOOL_VECTOR (obj)->size);
- else
- abort ();
+ sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size);
strout (buf, -1, -1, printcharfun, 0);
PRINTCHAR ('\"');
@@ -1917,6 +1945,14 @@ print_object (obj, printcharfun, escapeflag)
PRINTCHAR ('\\');
PRINTCHAR ('f');
}
+ else if (c > '\177')
+ {
+ /* Use octal escapes to avoid encoding issues. */
+ PRINTCHAR ('\\');
+ PRINTCHAR ('0' + ((c >> 6) & 3));
+ PRINTCHAR ('0' + ((c >> 3) & 7));
+ PRINTCHAR ('0' + (c & 7));
+ }
else
{
if (c == '\"' || c == '\\')
@@ -1937,7 +1973,7 @@ print_object (obj, printcharfun, escapeflag)
else if (WINDOWP (obj))
{
strout ("#<window ", -1, -1, printcharfun, 0);
- sprintf (buf, "%d", XFASTINT (XWINDOW (obj)->sequence_number));
+ sprintf (buf, "%ld", (long) XFASTINT (XWINDOW (obj)->sequence_number));
strout (buf, -1, -1, printcharfun, 0);
if (!NILP (XWINDOW (obj)->buffer))
{
@@ -1958,8 +1994,8 @@ print_object (obj, printcharfun, escapeflag)
PRINTCHAR (' ');
strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
PRINTCHAR (' ');
- sprintf (buf, "%d/%d", XFASTINT (h->count),
- XVECTOR (h->next)->size);
+ sprintf (buf, "%ld/%ld", (long) XFASTINT (h->count),
+ (long) XVECTOR (h->next)->size);
strout (buf, -1, -1, printcharfun, 0);
}
sprintf (buf, " 0x%lx", (unsigned long) h);
@@ -2082,7 +2118,7 @@ print_object (obj, printcharfun, escapeflag)
break;
case Lisp_Misc_Intfwd:
- sprintf (buf, "#<intfwd to %d>", *XINTFWD (obj)->intvar);
+ sprintf (buf, "#<intfwd to %ld>", (long) *XINTFWD (obj)->intvar);
strout (buf, -1, -1, printcharfun, 0);
break;
diff --git a/src/process.c b/src/process.c
index 4999aebf723..b810b027737 100644
--- a/src/process.c
+++ b/src/process.c
@@ -445,10 +445,11 @@ decode_status (l, symbol, code, coredump)
/* Return a string describing a process status list. */
-Lisp_Object
-status_message (status)
- Lisp_Object status;
+static Lisp_Object
+status_message (p)
+ struct Lisp_Process *p;
{
+ Lisp_Object status = p->status;
Lisp_Object symbol;
int code, coredump;
Lisp_Object string, string2;
@@ -469,6 +470,8 @@ status_message (status)
}
else if (EQ (symbol, Qexit))
{
+ if (NETCONN1_P (p))
+ return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n");
if (code == 0)
return build_string ("finished\n");
string = Fnumber_to_string (make_number (code));
@@ -532,7 +535,7 @@ allocate_pty ()
three failures in a row before deciding that we've reached the
end of the ptys. */
int failed_count = 0;
-
+
if (stat (pty_name, &stb) < 0)
{
failed_count++;
@@ -765,6 +768,7 @@ nil, indicating the current buffer's process. */)
{
XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
XSETINT (XPROCESS (process)->tick, ++process_tick);
+ status_notify ();
}
else if (XINT (XPROCESS (process)->infd) >= 0)
{
@@ -843,7 +847,7 @@ If PROCESS has not yet exited or died, return 0. */)
DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
doc: /* Return the process id of PROCESS.
-This is the pid of the Unix process which PROCESS uses or talks to.
+This is the pid of the external process which PROCESS uses or talks to.
For a network connection, this value is nil. */)
(process)
register Lisp_Object process;
@@ -1082,7 +1086,7 @@ DEFUN ("set-process-query-on-exit-flag",
Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag,
2, 2, 0,
doc: /* Specify if query is needed for PROCESS when Emacs is exited.
-If the second argument FLAG is non-nil, emacs will query the user before
+If the second argument FLAG is non-nil, Emacs will query the user before
exiting if PROCESS is running. */)
(process, flag)
register Lisp_Object process, flag;
@@ -1095,7 +1099,7 @@ exiting if PROCESS is running. */)
DEFUN ("process-query-on-exit-flag",
Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag,
1, 1, 0,
- doc: /* Return the current value of query on exit flag for PROCESS. */)
+ doc: /* Return the current value of query-on-exit flag for PROCESS. */)
(process)
register Lisp_Object process;
{
@@ -1458,12 +1462,12 @@ static Lisp_Object start_process_unwind ();
DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0,
doc: /* Start a program in a subprocess. Return the process object for it.
NAME is name for process. It is modified if necessary to make it unique.
-BUFFER is the buffer or (buffer-name) to associate with the process.
+BUFFER is the buffer (or buffer name) to associate with the process.
Process output goes at end of that buffer, unless you specify
an output stream or filter function to handle the output.
BUFFER may be also nil, meaning that this process is not associated
with any buffer.
-Third arg is program file name. It is searched for in PATH.
+PROGRAM is the program file name. It is searched for in PATH.
Remaining arguments are strings to give program as arguments.
usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
@@ -2609,7 +2613,7 @@ successful) or "failed" when the connect completes. Default is to use
a blocking connect (i.e. wait) for stream type connections.
:noquery BOOL -- Query the user unless BOOL is non-nil, and process is
-running when emacs is exited.
+running when Emacs is exited.
:stop BOOL -- Start process in the `stopped' state if BOOL non-nil.
In the stopped state, a server process does not accept new
@@ -2955,7 +2959,7 @@ usage: (make-network-process &rest ARGS) */)
struct hostent *host_info_ptr;
/* gethostbyname may fail with TRY_AGAIN, but we don't honour that,
- as it may `hang' emacs for a very long time. */
+ as it may `hang' Emacs for a very long time. */
immediate_quit = 1;
QUIT;
host_info_ptr = gethostbyname (SDATA (host));
@@ -3616,6 +3620,8 @@ FLAGS is the current flags of the interface. */)
#endif
#endif /* HAVE_SOCKETS */
+/* Turn off input and output for process PROC. */
+
void
deactivate_process (proc)
Lisp_Object proc;
@@ -3635,7 +3641,7 @@ deactivate_process (proc)
p->read_output_skip = Qnil;
}
#endif
-
+
if (inchannel >= 0)
{
/* Beware SIGCHLD hereabouts. */
@@ -3965,7 +3971,7 @@ server_accept_connection (server, channel)
/* This variable is different from waiting_for_input in keyboard.c.
It is used to communicate to a lisp process-filter/sentinel (via the
- function Fwaiting_for_user_input_p below) whether emacs was waiting
+ function Fwaiting_for_user_input_p below) whether Emacs was waiting
for user-input when that process-filter was called.
waiting_for_input cannot be used as that is by definition 0 when
lisp code is being evalled.
@@ -4019,8 +4025,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
int do_display;
{
register int channel, nfds;
- static SELECT_TYPE Available;
- static SELECT_TYPE Connecting;
+ SELECT_TYPE Available;
+ SELECT_TYPE Connecting;
int check_connect, check_delay, no_avail;
int xerrno;
Lisp_Object proc;
@@ -4031,6 +4037,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* Either nil or a cons cell, the car of which is of interest and
may be changed outside of this routine. */
Lisp_Object wait_for_cell = Qnil;
+ int saved_waiting_for_user_input_p = waiting_for_user_input_p;
FD_ZERO (&Available);
FD_ZERO (&Connecting);
@@ -4581,7 +4588,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
}
}
#ifdef NON_BLOCKING_CONNECT
- if (check_connect && FD_ISSET (channel, &Connecting))
+ if (check_connect && FD_ISSET (channel, &Connecting)
+ && FD_ISSET (channel, &connect_wait_mask))
{
struct Lisp_Process *p;
@@ -4644,7 +4652,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
} /* end for each file descriptor */
} /* end while exit conditions not met */
- waiting_for_user_input_p = 0;
+ waiting_for_user_input_p = saved_waiting_for_user_input_p;
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
@@ -4691,7 +4699,7 @@ read_process_output_error_handler (error)
starting with our buffered-ahead character if we have one.
Yield number of decoded characters read.
- This function reads at most 1024 characters.
+ This function reads at most 4096 characters.
If you want to read all available subprocess output,
you must call it repeatedly until it returns zero.
@@ -4711,7 +4719,7 @@ read_process_output (proc, channel)
register int opoint;
struct coding_system *coding = proc_decode_coding_system[channel];
int carryover = XINT (p->decoding_carryover);
- int readmax = 1024;
+ int readmax = 4096;
#ifdef VMS
VMS_PROC_STUFF *vs, *get_vms_process_pointer();
@@ -4744,16 +4752,6 @@ read_process_output (proc, channel)
}
#else /* not VMS */
-#ifdef DATAGRAM_SOCKETS
- /* A datagram is one packet; allow at least 1500+ bytes of data
- corresponding to the typical Ethernet frame size. */
- if (DATAGRAM_CHAN_P (channel))
- {
- /* carryover = 0; */ /* Does carryover make sense for datagrams? */
- readmax += 1024;
- }
-#endif
-
chars = (char *) alloca (carryover + readmax);
if (carryover)
/* See the comment above. */
@@ -5069,7 +5067,7 @@ read_process_output (proc, channel)
DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,
0, 0, 0,
- doc: /* Returns non-nil if emacs is waiting for input from the user.
+ doc: /* Returns non-nil if Emacs is waiting for input from the user.
This is intended for use by asynchronous process output filters and sentinels. */)
()
{
@@ -5446,7 +5444,7 @@ emacs_get_tty_pgrp (p)
{
int gid = -1;
-#ifdef TIOCGPGRP
+#ifdef TIOCGPGRP
if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
{
int fd;
@@ -5643,7 +5641,7 @@ process_send_signal (process, signo, current_group, nomsg)
we should just assume that p->pid is also the process group id. */
gid = emacs_get_tty_pgrp (p);
-
+
if (gid == -1)
/* If we can't get the information, assume
the shell owns the tty. */
@@ -5726,7 +5724,7 @@ process_send_signal (process, signo, current_group, nomsg)
DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0,
doc: /* Interrupt process PROCESS.
PROCESS may be a process, a buffer, or the name of a process or buffer.
-nil or no arg means current buffer's process.
+No arg or nil means current buffer's process.
Second arg CURRENT-GROUP non-nil means send signal to
the current process-group of the process's controlling terminal
rather than to the process's own process group.
@@ -6385,7 +6383,7 @@ status_notify ()
/* Get the text to use for the message. */
if (!NILP (p->raw_status_low))
update_status (p);
- msg = status_message (p->status);
+ msg = status_message (p);
/* If process is terminated, deactivate it or delete it. */
symbol = p->status;
@@ -6471,13 +6469,13 @@ DEFUN ("set-process-coding-system", Fset_process_coding_system,
doc: /* Set coding systems of PROCESS to DECODING and ENCODING.
DECODING will be used to decode subprocess output and ENCODING to
encode subprocess input. */)
- (proc, decoding, encoding)
- register Lisp_Object proc, decoding, encoding;
+ (process, decoding, encoding)
+ register Lisp_Object process, decoding, encoding;
{
register struct Lisp_Process *p;
- CHECK_PROCESS (proc);
- p = XPROCESS (proc);
+ CHECK_PROCESS (process);
+ p = XPROCESS (process);
if (XINT (p->infd) < 0)
error ("Input file descriptor of %s closed", SDATA (p->name));
if (XINT (p->outfd) < 0)
@@ -6487,7 +6485,7 @@ encode subprocess input. */)
p->decode_coding_system = decoding;
p->encode_coding_system = encoding;
- setup_process_coding_systems (proc);
+ setup_process_coding_systems (process);
return Qnil;
}
@@ -6495,12 +6493,12 @@ encode subprocess input. */)
DEFUN ("process-coding-system",
Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0,
doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */)
- (proc)
- register Lisp_Object proc;
+ (process)
+ register Lisp_Object process;
{
- CHECK_PROCESS (proc);
- return Fcons (XPROCESS (proc)->decode_coding_system,
- XPROCESS (proc)->encode_coding_system);
+ CHECK_PROCESS (process);
+ return Fcons (XPROCESS (process)->decode_coding_system,
+ XPROCESS (process)->encode_coding_system);
}
DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte,
@@ -6510,15 +6508,15 @@ If FLAG is non-nil, the filter is given multibyte strings.
If FLAG is nil, the filter is given unibyte strings. In this case,
all character code conversion except for end-of-line conversion is
suppressed. */)
- (proc, flag)
- Lisp_Object proc, flag;
+ (process, flag)
+ Lisp_Object process, flag;
{
register struct Lisp_Process *p;
- CHECK_PROCESS (proc);
- p = XPROCESS (proc);
+ CHECK_PROCESS (process);
+ p = XPROCESS (process);
p->filter_multibyte = flag;
- setup_process_coding_systems (proc);
+ setup_process_coding_systems (process);
return Qnil;
}
@@ -6526,13 +6524,13 @@ suppressed. */)
DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
Sprocess_filter_multibyte_p, 1, 1, 0,
doc: /* Return t if a multibyte string is given to PROCESS's filter.*/)
- (proc)
- Lisp_Object proc;
+ (process)
+ Lisp_Object process;
{
register struct Lisp_Process *p;
- CHECK_PROCESS (proc);
- p = XPROCESS (proc);
+ CHECK_PROCESS (process);
+ p = XPROCESS (process);
return (NILP (p->filter_multibyte) ? Qnil : Qt);
}
@@ -6753,11 +6751,11 @@ The value takes effect when `start-process' is called. */);
#ifdef ADAPTIVE_READ_BUFFERING
DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering,
doc: /* If non-nil, improve receive buffering by delaying after short reads.
-On some systems, when emacs reads the output from a subprocess, the output data
+On some systems, when Emacs reads the output from a subprocess, the output data
is read in very small blocks, potentially resulting in very poor performance.
This behaviour can be remedied to some extent by setting this variable to a
non-nil value, as it will automatically delay reading from such processes, to
-allowing them to produce more output before emacs tries to read it.
+allowing them to produce more output before Emacs tries to read it.
If the value is t, the delay is reset after each write to the process; any other
non-nil value means that the delay is not reset on write.
The variable takes effect when `start-process' is called. */);
diff --git a/src/regex.c b/src/regex.c
index e1479e64c9f..006b79acba8 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2,7 +2,7 @@
0.12. (Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
- Copyright (C) 1993,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,97,98,99,2000,04 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -233,7 +233,7 @@ char *realloc ();
/* Define the syntax stuff for \<, \>, etc. */
/* Sword must be nonzero for the wordchar pattern commands in re_match_2. */
-enum syntaxcode { Swhitespace = 0, Sword = 1 };
+enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
# ifdef SWITCH_ENUM_BUG
# define SWITCH_ENUM_CAST(x) ((int)(x))
@@ -423,7 +423,7 @@ init_syntax_once ()
if (ISALNUM (c))
re_syntax_table[c] = Sword;
- re_syntax_table['_'] = Sword;
+ re_syntax_table['_'] = Ssymbol;
done = 1;
}
@@ -680,6 +680,9 @@ typedef enum
wordbound, /* Succeeds if at a word boundary. */
notwordbound, /* Succeeds if not at a word boundary. */
+ symbeg, /* Succeeds if at symbol beginning. */
+ symend, /* Succeeds if at symbol end. */
+
/* Matches any character whose syntax is specified. Followed by
a byte which contains a syntax code, e.g., Sword. */
syntaxspec,
@@ -1118,6 +1121,15 @@ print_partial_compiled_pattern (start, end)
case wordend:
fprintf (stderr, "/wordend");
+ break;
+
+ case symbeg:
+ fprintf (stderr, "/symbeg");
+ break;
+
+ case symend:
+ fprintf (stderr, "/symend");
+ break;
case syntaxspec:
fprintf (stderr, "/syntaxspec");
@@ -2003,41 +2015,10 @@ struct range_table_work_area
} \
} while (0)
-#if WIDE_CHAR_SUPPORT
-/* The GNU C library provides support for user-defined character classes
- and the functions from ISO C amendement 1. */
-# ifdef CHARCLASS_NAME_MAX
-# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
-# else
-/* This shouldn't happen but some implementation might still have this
- problem. Use a reasonable default value. */
-# define CHAR_CLASS_MAX_LENGTH 256
-# endif
-typedef wctype_t re_wctype_t;
-typedef wchar_t re_wchar_t;
-# define re_wctype wctype
-# define re_iswctype iswctype
-# define re_wctype_to_bit(cc) 0
-#else
-# define CHAR_CLASS_MAX_LENGTH 9 /* Namely, `multibyte'. */
-# define btowc(c) c
-
-/* Character classes. */
-typedef enum { RECC_ERROR = 0,
- RECC_ALNUM, RECC_ALPHA, RECC_WORD,
- RECC_GRAPH, RECC_PRINT,
- RECC_LOWER, RECC_UPPER,
- RECC_PUNCT, RECC_CNTRL,
- RECC_DIGIT, RECC_XDIGIT,
- RECC_BLANK, RECC_SPACE,
- RECC_MULTIBYTE, RECC_NONASCII,
- RECC_ASCII, RECC_UNIBYTE
-} re_wctype_t;
-
-typedef int re_wchar_t;
+#if ! WIDE_CHAR_SUPPORT
/* Map a string to the char class it names (if any). */
-static re_wctype_t
+re_wctype_t
re_wctype (str)
re_char *str;
{
@@ -2063,7 +2044,7 @@ re_wctype (str)
}
/* True iff CH is in the char class CC. */
-static boolean
+boolean
re_iswctype (ch, cc)
int ch;
re_wctype_t cc;
@@ -3464,6 +3445,19 @@ regex_compile (pattern, size, syntax, bufp)
BUF_PUSH (wordend);
break;
+ case '_':
+ if (syntax & RE_NO_GNU_OPS)
+ goto normal_char;
+ laststart = b;
+ PATFETCH (c);
+ if (c == '<')
+ BUF_PUSH (symbeg);
+ else if (c == '>')
+ BUF_PUSH (symend);
+ else
+ FREE_STACK_RETURN (REG_BADPAT);
+ break;
+
case 'b':
if (syntax & RE_NO_GNU_OPS)
goto normal_char;
@@ -3980,6 +3974,8 @@ analyse_first (p, pend, fastmap, multibyte)
case notwordbound:
case wordbeg:
case wordend:
+ case symbeg:
+ case symend:
continue;
@@ -4768,14 +4764,20 @@ mutually_exclusive_p (bufp, p1, p2)
break;
case wordend:
- case notsyntaxspec:
+ return ((re_opcode_t) *p1 == syntaxspec && p1[1] == Sword);
+ case symend:
return ((re_opcode_t) *p1 == syntaxspec
- && p1[1] == (op2 == wordend ? Sword : p2[1]));
+ && (p1[1] == Ssymbol || p1[1] == Sword));
+ case notsyntaxspec:
+ return ((re_opcode_t) *p1 == syntaxspec && p1[1] == p2[1]);
case wordbeg:
- case syntaxspec:
+ return ((re_opcode_t) *p1 == notsyntaxspec && p1[1] == Sword);
+ case symbeg:
return ((re_opcode_t) *p1 == notsyntaxspec
- && p1[1] == (op2 == wordend ? Sword : p2[1]));
+ && (p1[1] == Ssymbol || p1[1] == Sword));
+ case syntaxspec:
+ return ((re_opcode_t) *p1 == notsyntaxspec && p1[1] == p2[1]);
case wordbound:
return (((re_opcode_t) *p1 == notsyntaxspec
@@ -5952,6 +5954,92 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
}
break;
+ case symbeg:
+ DEBUG_PRINT1 ("EXECUTING symbeg.\n");
+
+ /* We FAIL in one of the following cases: */
+
+ /* Case 1: D is at the end of string. */
+ if (AT_STRINGS_END (d))
+ goto fail;
+ else
+ {
+ /* C1 is the character before D, S1 is the syntax of C1, C2
+ is the character at D, and S2 is the syntax of C2. */
+ re_wchar_t c1, c2;
+ int s1, s2;
+#ifdef emacs
+ int offset = PTR_TO_OFFSET (d);
+ int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
+ UPDATE_SYNTAX_TABLE (charpos);
+#endif
+ PREFETCH ();
+ c2 = RE_STRING_CHAR (d, dend - d);
+ s2 = SYNTAX (c2);
+
+ /* Case 2: S2 is neither Sword nor Ssymbol. */
+ if (s2 != Sword && s2 != Ssymbol)
+ goto fail;
+
+ /* Case 3: D is not at the beginning of string ... */
+ if (!AT_STRINGS_BEG (d))
+ {
+ GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
+#ifdef emacs
+ UPDATE_SYNTAX_TABLE_BACKWARD (charpos - 1);
+#endif
+ s1 = SYNTAX (c1);
+
+ /* ... and S1 is Sword or Ssymbol. */
+ if (s1 == Sword || s1 == Ssymbol)
+ goto fail;
+ }
+ }
+ break;
+
+ case symend:
+ DEBUG_PRINT1 ("EXECUTING symend.\n");
+
+ /* We FAIL in one of the following cases: */
+
+ /* Case 1: D is at the beginning of string. */
+ if (AT_STRINGS_BEG (d))
+ goto fail;
+ else
+ {
+ /* C1 is the character before D, S1 is the syntax of C1, C2
+ is the character at D, and S2 is the syntax of C2. */
+ re_wchar_t c1, c2;
+ int s1, s2;
+#ifdef emacs
+ int offset = PTR_TO_OFFSET (d) - 1;
+ int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
+ UPDATE_SYNTAX_TABLE (charpos);
+#endif
+ GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
+ s1 = SYNTAX (c1);
+
+ /* Case 2: S1 is neither Ssymbol nor Sword. */
+ if (s1 != Sword && s1 != Ssymbol)
+ goto fail;
+
+ /* Case 3: D is not at the end of string ... */
+ if (!AT_STRINGS_END (d))
+ {
+ PREFETCH_NOLIMIT ();
+ c2 = RE_STRING_CHAR (d, dend - d);
+#ifdef emacs
+ UPDATE_SYNTAX_TABLE_FORWARD (charpos);
+#endif
+ s2 = SYNTAX (c2);
+
+ /* ... and S2 is Sword or Ssymbol. */
+ if (s2 == Sword || s2 == Ssymbol)
+ goto fail;
+ }
+ }
+ break;
+
case syntaxspec:
case notsyntaxspec:
not = (re_opcode_t) *(p - 1) == notsyntaxspec;
diff --git a/src/regex.h b/src/regex.h
index be7634bb8de..26c589bde92 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -568,6 +568,49 @@ extern void regfree _RE_ARGS ((regex_t *__preg));
}
#endif /* C++ */
+/* For platform which support the ISO C amendement 1 functionality we
+ support user defined character classes. */
+#if WIDE_CHAR_SUPPORT
+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
+# include <wchar.h>
+# include <wctype.h>
+#endif
+
+#if WIDE_CHAR_SUPPORT
+/* The GNU C library provides support for user-defined character classes
+ and the functions from ISO C amendement 1. */
+# ifdef CHARCLASS_NAME_MAX
+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
+# else
+/* This shouldn't happen but some implementation might still have this
+ problem. Use a reasonable default value. */
+# define CHAR_CLASS_MAX_LENGTH 256
+# endif
+typedef wctype_t re_wctype_t;
+typedef wchar_t re_wchar_t;
+# define re_wctype wctype
+# define re_iswctype iswctype
+# define re_wctype_to_bit(cc) 0
+#else
+# define CHAR_CLASS_MAX_LENGTH 9 /* Namely, `multibyte'. */
+# define btowc(c) c
+
+/* Character classes. */
+typedef enum { RECC_ERROR = 0,
+ RECC_ALNUM, RECC_ALPHA, RECC_WORD,
+ RECC_GRAPH, RECC_PRINT,
+ RECC_LOWER, RECC_UPPER,
+ RECC_PUNCT, RECC_CNTRL,
+ RECC_DIGIT, RECC_XDIGIT,
+ RECC_BLANK, RECC_SPACE,
+ RECC_MULTIBYTE, RECC_NONASCII,
+ RECC_ASCII, RECC_UNIBYTE
+} re_wctype_t;
+
+typedef int re_wchar_t;
+
+#endif /* not WIDE_CHAR_SUPPORT */
+
#endif /* regex.h */
/*
diff --git a/src/search.c b/src/search.c
index f9b45c8eca6..eba74f418ce 100644
--- a/src/search.c
+++ b/src/search.c
@@ -924,7 +924,7 @@ trivial_regexp_p (regexp)
{
case '|': case '(': case ')': case '`': case '\'': case 'b':
case 'B': case '<': case '>': case 'w': case 'W': case 's':
- case 'S': case '=': case '{': case '}':
+ case 'S': case '=': case '{': case '}': case '_':
case 'c': case 'C': /* for categoryspec and notcategoryspec */
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
@@ -2576,9 +2576,11 @@ match_limit (num, beginningp)
CHECK_NUMBER (num);
n = XINT (num);
- if (n < 0 || n >= search_regs.num_regs)
- args_out_of_range (num, make_number (search_regs.num_regs));
- if (search_regs.num_regs <= 0
+ if (n < 0)
+ args_out_of_range (num, 0);
+ if (search_regs.num_regs <= 0)
+ error ("No match data, because no search succeeded");
+ if (n >= search_regs.num_regs
|| search_regs.start[n] < 0)
return Qnil;
return (make_number ((beginningp) ? search_regs.start[n]
diff --git a/src/syntax.c b/src/syntax.c
index 22a34c40fb3..57606f314d6 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */
#include "buffer.h"
#include "character.h"
#include "keymap.h"
+#include "regex.h"
/* Make syntax table lookup grant data in gl_state. */
#define SYNTAX_ENTRY_VIA_PROPERTY
@@ -97,12 +98,13 @@ static int find_start_modiff;
static int find_defun_start P_ ((int, int));
static int back_comment P_ ((int, int, int, int, int, int *, int *));
static int char_quoted P_ ((int, int));
-static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object));
+static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int));
static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object));
static Lisp_Object scan_lists P_ ((int, int, int, int));
static void scan_sexps_forward P_ ((struct lisp_parse_state *,
int, int, int, int,
int, Lisp_Object, int));
+static int in_classes P_ ((int, Lisp_Object));
struct gl_state_s gl_state; /* Global state of syntax parser. */
@@ -293,8 +295,11 @@ char_quoted (charpos, bytepos)
while (bytepos >= beg)
{
+ int c;
+
UPDATE_SYNTAX_TABLE_BACKWARD (charpos);
- code = SYNTAX (FETCH_CHAR_AS_MULTIBYTE (bytepos));
+ c = FETCH_CHAR_AS_MULTIBYTE (bytepos);
+ code = SYNTAX (c);
if (! (code == Scharquote || code == Sescape))
break;
@@ -381,12 +386,16 @@ find_defun_start (pos, pos_byte)
gl_state.use_global = 0;
while (PT > BEGV)
{
+ int c;
+
/* Open-paren at start of line means we may have found our
defun-start. */
- if (SYNTAX (FETCH_CHAR_AS_MULTIBYTE (PT_BYTE)) == Sopen)
+ c = FETCH_CHAR_AS_MULTIBYTE (PT_BYTE);
+ if (SYNTAX (c) == Sopen)
{
SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */
- if (SYNTAX (FETCH_CHAR_AS_MULTIBYTE (PT_BYTE)) == Sopen)
+ c = FETCH_CHAR_AS_MULTIBYTE (PT_BYTE);
+ if (SYNTAX (c) == Sopen)
break;
/* Now fallback to the default value. */
gl_state.current_syntax_table = current_buffer->syntax_table;
@@ -955,7 +964,7 @@ text property. */)
DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
"cSet syntax for character: \nsSet syntax for %s to: ",
doc: /* Set syntax for character CHAR according to string NEWENTRY.
-The syntax is changed only for table SYNTAX_TABLE, which defaults to
+The syntax is changed only for table SYNTAX-TABLE, which defaults to
the current buffer's syntax table.
CHAR may be a cons (MIN . MAX), in which case, syntaxes of all characters
in the range MIN and MAX are changed.
@@ -1339,13 +1348,13 @@ except that `]' is never special and `\\' quotes `^', `-' or `\\'
(but not as the end of a range; quoting is never needed there).
Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter.
With arg "^a-zA-Z", skips nonletters stopping before first letter.
-Returns the distance traveled, either zero or positive.
-Note that char classes, e.g. `[:alpha:]', are not currently supported;
-they will be treated as literals. */)
+Char classes, e.g. `[:alpha:]', are supported.
+
+Returns the distance traveled, either zero or positive. */)
(string, lim)
Lisp_Object string, lim;
{
- return skip_chars (1, string, lim);
+ return skip_chars (1, string, lim, 1);
}
DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
@@ -1355,7 +1364,7 @@ Returns the distance traveled, either zero or negative. */)
(string, lim)
Lisp_Object string, lim;
{
- return skip_chars (0, string, lim);
+ return skip_chars (0, string, lim, 1);
}
DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0,
@@ -1383,9 +1392,10 @@ This function returns the distance traveled, either zero or negative. */)
}
static Lisp_Object
-skip_chars (forwardp, string, lim)
+skip_chars (forwardp, string, lim, handle_iso_classes)
int forwardp;
Lisp_Object string, lim;
+ int handle_iso_classes;
{
register unsigned int c;
unsigned char fastmap[0400];
@@ -1403,8 +1413,10 @@ skip_chars (forwardp, string, lim)
int size_byte;
const unsigned char *str;
int len;
+ Lisp_Object iso_classes;
CHECK_STRING (string);
+ iso_classes = Qnil;
if (NILP (lim))
XSETINT (lim, forwardp ? ZV : BEGV);
@@ -1448,6 +1460,42 @@ skip_chars (forwardp, string, lim)
{
c = str[i_byte++];
+ if (handle_iso_classes && c == '['
+ && i_byte < size_byte
+ && str[i_byte] == ':')
+ {
+ const unsigned char *class_beg = str + i_byte + 1;
+ const unsigned char *class_end = class_beg;
+ const unsigned char *class_limit = str + size_byte - 2;
+ /* Leave room for the null. */
+ unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
+ re_wctype_t cc;
+
+ if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH)
+ class_limit = class_beg + CHAR_CLASS_MAX_LENGTH;
+
+ while (class_end < class_limit
+ && *class_end >= 'a' && *class_end <= 'z')
+ class_end++;
+
+ if (class_end == class_beg
+ || *class_end != ':' || class_end[1] != ']')
+ goto not_a_class_name;
+
+ bcopy (class_beg, class_name, class_end - class_beg);
+ class_name[class_end - class_beg] = 0;
+
+ cc = re_wctype (class_name);
+ if (cc == 0)
+ error ("Invalid ISO C character class");
+
+ iso_classes = Fcons (make_number (cc), iso_classes);
+
+ i_byte = class_end + 2 - str;
+ continue;
+ }
+
+ not_a_class_name:
if (c == '\\')
{
if (i_byte == size_byte)
@@ -1534,6 +1582,42 @@ skip_chars (forwardp, string, lim)
c = STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len);
i_byte += len;
+ if (handle_iso_classes && c == '['
+ && i_byte < size_byte
+ && STRING_CHAR (str + i_byte, size_byte - i_byte) == ':')
+ {
+ const unsigned char *class_beg = str + i_byte + 1;
+ const unsigned char *class_end = class_beg;
+ const unsigned char *class_limit = str + size_byte - 2;
+ /* Leave room for the null. */
+ unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
+ re_wctype_t cc;
+
+ if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH)
+ class_limit = class_beg + CHAR_CLASS_MAX_LENGTH;
+
+ while (class_end < class_limit
+ && *class_end >= 'a' && *class_end <= 'z')
+ class_end++;
+
+ if (class_end == class_beg
+ || *class_end != ':' || class_end[1] != ']')
+ goto not_a_class_name_multibyte;
+
+ bcopy (class_beg, class_name, class_end - class_beg);
+ class_name[class_end - class_beg] = 0;
+
+ cc = re_wctype (class_name);
+ if (cc == 0)
+ error ("Invalid ISO C character class");
+
+ iso_classes = Fcons (make_number (cc), iso_classes);
+
+ i_byte = class_end + 2 - str;
+ continue;
+ }
+
+ not_a_class_name_multibyte:
if (c == '\\')
{
if (i_byte == size_byte)
@@ -1643,13 +1727,13 @@ skip_chars (forwardp, string, lim)
if (forwardp)
{
- endp = (XINT (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim));
- stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp;
+ endp = (XINT (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim));
+ stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp;
}
else
{
- endp = CHAR_POS_ADDR (XINT (lim));
- stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp;
+ endp = CHAR_POS_ADDR (XINT (lim));
+ stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp;
}
immediate_quit = 1;
@@ -1667,9 +1751,17 @@ skip_chars (forwardp, string, lim)
p = GAP_END_ADDR;
stop = endp;
}
+ c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
+ if (! NILP (iso_classes) && in_classes (c, iso_classes))
+ {
+ if (negate)
+ break;
+ else
+ goto fwd_ok;
+ }
+
if (! fastmap[*p])
break;
- c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes);
if (! ASCII_CHAR_P (c))
{
/* As we are looking at a multibyte character, we
@@ -1686,6 +1778,7 @@ skip_chars (forwardp, string, lim)
if (!(negate ^ (i < n_char_ranges)))
break;
}
+ fwd_ok:
p += nbytes, pos++, pos_byte += nbytes;
}
else
@@ -1698,8 +1791,18 @@ skip_chars (forwardp, string, lim)
p = GAP_END_ADDR;
stop = endp;
}
+
+ if (!NILP (iso_classes) && in_classes (*p, iso_classes))
+ {
+ if (negate)
+ break;
+ else
+ goto fwd_unibyte_ok;
+ }
+
if (!fastmap[*p])
break;
+ fwd_unibyte_ok:
p++, pos++, pos_byte++;
}
}
@@ -1719,9 +1822,18 @@ skip_chars (forwardp, string, lim)
}
prev_p = p;
while (--p >= stop && ! CHAR_HEAD_P (*p));
+ c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
+
+ if (! NILP (iso_classes) && in_classes (c, iso_classes))
+ {
+ if (negate)
+ break;
+ else
+ goto back_ok;
+ }
+
if (! fastmap[*p])
break;
- c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
if (! ASCII_CHAR_P (c))
{
/* See the comment in the previous similar code. */
@@ -1731,6 +1843,7 @@ skip_chars (forwardp, string, lim)
if (!(negate ^ (i < n_char_ranges)))
break;
}
+ back_ok:
pos--, pos_byte -= prev_p - p;
}
else
@@ -1743,8 +1856,18 @@ skip_chars (forwardp, string, lim)
p = GPT_ADDR;
stop = endp;
}
+
+ if (! NILP (iso_classes) && in_classes (p[-1], iso_classes))
+ {
+ if (negate)
+ break;
+ else
+ goto back_unibyte_ok;
+ }
+
if (!fastmap[p[-1]])
break;
+ back_unibyte_ok:
p--, pos--, pos_byte--;
}
}
@@ -1927,6 +2050,30 @@ skip_syntaxes (forwardp, string, lim)
return make_number (PT - start_point);
}
}
+
+/* Return 1 if character C belongs to one of the ISO classes
+ in the list ISO_CLASSES. Each class is represented by an
+ integer which is its type according to re_wctype. */
+
+static int
+in_classes (c, iso_classes)
+ int c;
+ Lisp_Object iso_classes;
+{
+ int fits_class = 0;
+
+ while (! NILP (iso_classes))
+ {
+ Lisp_Object elt;
+ elt = XCAR (iso_classes);
+ iso_classes = XCDR (iso_classes);
+
+ if (re_iswctype (c, XFASTINT (elt)))
+ fits_class = 1;
+ }
+
+ return fits_class;
+}
/* Jump over a comment, assuming we are at the beginning of one.
FROM is the current position.
@@ -2310,7 +2457,8 @@ scan_lists (from, count, depth, sexpflag)
INC_BOTH (from, from_byte);
UPDATE_SYNTAX_TABLE_FORWARD (from);
if (from < stop && comstart_first
- && SYNTAX_COMSTART_SECOND (FETCH_CHAR_AS_MULTIBYTE (from_byte))
+ && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte),
+ SYNTAX_COMSTART_SECOND (c))
&& parse_sexp_ignore_comments)
{
/* we have encountered a comment start sequence and we
@@ -2636,7 +2784,7 @@ scan_lists (from, count, depth, sexpflag)
Fcons (build_string ("Unbalanced parentheses"),
Fcons (make_number (last_good),
Fcons (make_number (from), Qnil))));
-
+ abort ();
/* NOTREACHED */
}
@@ -2776,8 +2924,8 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
#define INC_FROM \
do { prev_from = from; \
prev_from_byte = from_byte; \
- prev_from_syntax \
- = SYNTAX_WITH_FLAGS (FETCH_CHAR_AS_MULTIBYTE (prev_from_byte)); \
+ temp = FETCH_CHAR_AS_MULTIBYTE (prev_from_byte); \
+ prev_from_syntax = SYNTAX_WITH_FLAGS (temp); \
INC_BOTH (from, from_byte); \
if (from < end) \
UPDATE_SYNTAX_TABLE_FORWARD (from); \
@@ -2852,7 +3000,8 @@ do { prev_from = from; \
curlevel->last = -1;
SETUP_SYNTAX_TABLE (prev_from, 1);
- prev_from_syntax = SYNTAX_WITH_FLAGS (FETCH_CHAR (prev_from_byte));
+ temp = FETCH_CHAR (prev_from_byte);
+ prev_from_syntax = SYNTAX_WITH_FLAGS (temp);
UPDATE_SYNTAX_TABLE_FORWARD (from);
/* Enter the loop at a place appropriate for initial state. */
@@ -2931,7 +3080,8 @@ do { prev_from = from; \
while (from < end)
{
/* Some compilers can't handle this inside the switch. */
- temp = SYNTAX (FETCH_CHAR_AS_MULTIBYTE (from_byte));
+ temp = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+ temp = SYNTAX (temp);
switch (temp)
{
case Scharquote:
diff --git a/src/syntax.h b/src/syntax.h
index 21f24dbd100..ba862655cfe 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -89,24 +89,24 @@ enum syntaxcode
#ifdef __GNUC__
#define SYNTAX(c) \
- ({ Lisp_Object temp; \
- temp = SYNTAX_ENTRY (c); \
- (CONSP (temp) \
- ? (enum syntaxcode) (XINT (XCAR (temp)) & 0xff) \
+ ({ Lisp_Object _syntax_temp; \
+ _syntax_temp = SYNTAX_ENTRY (c); \
+ (CONSP (_syntax_temp) \
+ ? (enum syntaxcode) (XINT (XCAR (_syntax_temp)) & 0xff) \
: Swhitespace); })
#define SYNTAX_WITH_FLAGS(c) \
- ({ Lisp_Object temp; \
- temp = SYNTAX_ENTRY (c); \
- (CONSP (temp) \
- ? XINT (XCAR (temp)) \
+ ({ Lisp_Object _syntax_temp; \
+ _syntax_temp = SYNTAX_ENTRY (c); \
+ (CONSP (_syntax_temp) \
+ ? XINT (XCAR (_syntax_temp)) \
: (int) Swhitespace); })
#define SYNTAX_MATCH(c) \
- ({ Lisp_Object temp; \
- temp = SYNTAX_ENTRY (c); \
- (CONSP (temp) \
- ? XCDR (temp) \
+ ({ Lisp_Object _syntax_temp; \
+ _syntax_temp = SYNTAX_ENTRY (c); \
+ (CONSP (_syntax_temp) \
+ ? XCDR (_syntax_temp) \
: Qnil); })
#else
extern Lisp_Object syntax_temp;
diff --git a/src/syssignal.h b/src/syssignal.h
index 2b536758e27..cef71f7459a 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -18,6 +18,8 @@ along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+extern void init_signals P_ ((void));
+
#ifdef POSIX_SIGNALS
/* Don't #include <signal.h>. That header should always be #included
@@ -31,7 +33,6 @@ Boston, MA 02111-1307, USA. */
#define SIGEMPTYMASK (empty_mask)
#define SIGFULLMASK (full_mask)
extern sigset_t empty_mask, full_mask;
-extern void init_signals P_ ((void));
/* POSIX pretty much destroys any possibility of writing sigmask as a
macro in standard C. We always define our own version because the
diff --git a/src/textprop.c b/src/textprop.c
index 4f13aefb1be..c8ec008dcbd 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -637,30 +637,13 @@ get_char_property_and_overlay (position, prop, object, overlay)
}
if (BUFFERP (object))
{
- int posn = XINT (position);
int noverlays;
- Lisp_Object *overlay_vec, tem;
- int len;
+ Lisp_Object *overlay_vec;
struct buffer *obuf = current_buffer;
set_buffer_temp (XBUFFER (object));
- /* First try with room for 40 overlays. */
- len = 40;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
-
- noverlays = overlays_at (posn, 0, &overlay_vec, &len,
- NULL, NULL, 0);
-
- /* If there are more than 40,
- make enough space for all, and try again. */
- if (noverlays > len)
- {
- len = noverlays;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (posn, 0, &overlay_vec, &len,
- NULL, NULL, 0);
- }
+ GET_OVERLAYS_AT (XINT (position), overlay_vec, noverlays, NULL, 0);
noverlays = sort_overlays (overlay_vec, noverlays, w);
set_buffer_temp (obuf);
@@ -668,7 +651,7 @@ get_char_property_and_overlay (position, prop, object, overlay)
/* Now check the overlays in order of decreasing priority. */
while (--noverlays >= 0)
{
- tem = Foverlay_get (overlay_vec[noverlays], prop);
+ Lisp_Object tem = Foverlay_get (overlay_vec[noverlays], prop);
if (!NILP (tem))
{
if (overlay)
diff --git a/src/undo.c b/src/undo.c
index dd086db6c40..9fdc46a3b13 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -292,14 +292,15 @@ but another undo command will undo to the previous boundary. */)
/* At garbage collection time, make an undo list shorter at the end,
returning the truncated list.
- MINSIZE and MAXSIZE are the limits on size allowed, as described below.
- In practice, these are the values of undo-limit and
- undo-strong-limit. */
+ MINSIZE, MAXSIZE and LIMITSIZE are the limits on size allowed,
+ as described below.
+ In practice, these are the values of undo-limit,
+ undo-strong-limit, and undo-outer-limit. */
Lisp_Object
-truncate_undo_list (list, minsize, maxsize)
+truncate_undo_list (list, minsize, maxsize, limitsize)
Lisp_Object list;
- int minsize, maxsize;
+ int minsize, maxsize, limitsize;
{
Lisp_Object prev, next, last_boundary;
int size_so_far = 0;
@@ -308,7 +309,8 @@ truncate_undo_list (list, minsize, maxsize)
next = list;
last_boundary = Qnil;
- /* Always preserve at least the most recent undo record.
+ /* Always preserve at least the most recent undo record
+ unless it is really horribly big.
If the first element is an undo boundary, skip past it.
Skip, skip, skip the undo, skip, skip, skip the undo,
@@ -323,6 +325,7 @@ truncate_undo_list (list, minsize, maxsize)
prev = next;
next = XCDR (next);
}
+
while (CONSP (next) && ! NILP (XCAR (next)))
{
Lisp_Object elt;
@@ -338,13 +341,20 @@ truncate_undo_list (list, minsize, maxsize)
+ SCHARS (XCAR (elt)));
}
+ /* If we reach LIMITSIZE before the first boundary,
+ we're heading for memory full, so truncate the list to nothing. */
+ if (size_so_far > limitsize)
+ return Qnil;
+
/* Advance to next element. */
prev = next;
next = XCDR (next);
}
+
if (CONSP (next))
last_boundary = prev;
+ /* Keep more if it fits. */
while (CONSP (next))
{
Lisp_Object elt;
diff --git a/src/w32.c b/src/w32.c
index 98d630529e6..12d1f21b091 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -105,7 +105,7 @@ void globals_of_w32 ();
extern Lisp_Object Vw32_downcase_file_names;
extern Lisp_Object Vw32_generate_fake_inodes;
extern Lisp_Object Vw32_get_true_file_attributes;
-extern Lisp_Object Vw32_num_mouse_buttons;
+extern int w32_num_mouse_buttons;
/*
@@ -1094,7 +1094,7 @@ init_environment (char ** argv)
/* Determine if there is a middle mouse button, to allow parse_button
to decide whether right mouse events should be mouse-2 or
mouse-3. */
- XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS));
+ w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
init_user_info ();
}
@@ -1627,7 +1627,7 @@ static WIN32_FIND_DATA dir_find_data;
/* Support shares on a network resource as subdirectories of a read-only
root directory. */
static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE;
-HANDLE open_unc_volume (char *);
+HANDLE open_unc_volume (const char *);
char *read_unc_volume (HANDLE, char *, int);
void close_unc_volume (HANDLE);
@@ -1740,7 +1740,7 @@ readdir (DIR *dirp)
}
HANDLE
-open_unc_volume (char *path)
+open_unc_volume (const char *path)
{
NETRESOURCE nr;
HANDLE henum;
@@ -1797,7 +1797,7 @@ close_unc_volume (HANDLE henum)
}
DWORD
-unc_volume_file_attributes (char *path)
+unc_volume_file_attributes (const char *path)
{
HANDLE henum;
DWORD attrs;
@@ -3486,7 +3486,7 @@ sys_pipe (int * phandles)
}
/* From ntproc.c */
-extern Lisp_Object Vw32_pipe_read_delay;
+extern int w32_pipe_read_delay;
/* Function to do blocking read of one byte, needed to implement
select. It is only allowed on sockets and pipes. */
@@ -3526,7 +3526,7 @@ _sys_read_ahead (int fd)
shell on NT is very slow if we don't do this. */
if (rc > 0)
{
- int wait = XINT (Vw32_pipe_read_delay);
+ int wait = w32_pipe_read_delay;
if (wait > 0)
Sleep (wait);
diff --git a/src/w32console.c b/src/w32console.c
index 50cbfb281d3..cd71f0ba6ad 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -53,20 +53,20 @@ extern int read_input_pending ();
extern struct frame * updating_frame;
extern int meta_key;
-static void move_cursor (int row, int col);
-static void clear_to_end (void);
-static void clear_frame (void);
-static void clear_end_of_line (int);
-static void ins_del_lines (int vpos, int n);
-static void insert_glyphs (struct glyph *start, int len);
-static void write_glyphs (struct glyph *string, int len);
-static void delete_glyphs (int n);
+static void w32con_move_cursor (int row, int col);
+static void w32con_clear_to_end (void);
+static void w32con_clear_frame (void);
+static void w32con_clear_end_of_line (int);
+static void w32con_ins_del_lines (int vpos, int n);
+static void w32con_insert_glyphs (struct glyph *start, int len);
+static void w32con_write_glyphs (struct glyph *string, int len);
+static void w32con_delete_glyphs (int n);
void w32_sys_ring_bell (void);
-static void reset_terminal_modes (void);
-static void set_terminal_modes (void);
-static void set_terminal_window (int size);
-static void update_begin (struct frame * f);
-static void update_end (struct frame * f);
+static void w32con_reset_terminal_modes (void);
+static void w32con_set_terminal_modes (void);
+static void w32con_set_terminal_window (int size);
+static void w32con_update_begin (struct frame * f);
+static void w32con_update_end (struct frame * f);
static WORD w32_face_attributes (struct frame *f, int face_id);
static COORD cursor_coords;
@@ -103,8 +103,8 @@ ctrl_c_handler (unsigned long type)
#define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ())
/* Move the cursor to (row, col). */
-void
-move_cursor (int row, int col)
+static void
+w32con_move_cursor (int row, int col)
{
cursor_coords.X = col;
cursor_coords.Y = row;
@@ -116,18 +116,18 @@ move_cursor (int row, int col)
}
/* Clear from cursor to end of screen. */
-void
-clear_to_end (void)
+static void
+w32con_clear_to_end (void)
{
struct frame * f = PICK_FRAME ();
- clear_end_of_line (FRAME_COLS (f) - 1);
- ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);
+ w32con_clear_end_of_line (FRAME_COLS (f) - 1);
+ w32con_ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);
}
/* Clear the frame. */
-void
-clear_frame (void)
+static void
+w32con_clear_frame (void)
{
struct frame * f = PICK_FRAME ();
COORD dest;
@@ -144,7 +144,7 @@ clear_frame (void)
FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
- move_cursor (0, 0);
+ w32con_move_cursor (0, 0);
}
@@ -152,8 +152,8 @@ static struct glyph glyph_base[256];
static BOOL ceol_initialized = FALSE;
/* Clear from Cursor to end (what's "standout marker"?). */
-void
-clear_end_of_line (int end)
+static void
+w32con_clear_end_of_line (int end)
{
if (!ceol_initialized)
{
@@ -164,12 +164,12 @@ clear_end_of_line (int end)
}
ceol_initialized = TRUE;
}
- write_glyphs (glyph_base, end - cursor_coords.X); /* fencepost ? */
+ w32con_write_glyphs (glyph_base, end - cursor_coords.X); /* fencepost ? */
}
/* Insert n lines at vpos. if n is negative delete -n lines. */
-void
-ins_del_lines (int vpos, int n)
+static void
+w32con_ins_del_lines (int vpos, int n)
{
int i, nb;
SMALL_RECT scroll;
@@ -212,8 +212,8 @@ ins_del_lines (int vpos, int n)
{
for (i = scroll.Bottom; i < dest.Y; i++)
{
- move_cursor (i, 0);
- clear_end_of_line (FRAME_COLS (f));
+ w32con_move_cursor (i, 0);
+ w32con_clear_end_of_line (FRAME_COLS (f));
}
}
}
@@ -225,8 +225,8 @@ ins_del_lines (int vpos, int n)
{
for (i = nb; i < scroll.Top; i++)
{
- move_cursor (i, 0);
- clear_end_of_line (FRAME_COLS (f));
+ w32con_move_cursor (i, 0);
+ w32con_clear_end_of_line (FRAME_COLS (f));
}
}
}
@@ -240,7 +240,7 @@ ins_del_lines (int vpos, int n)
#define LEFT 1
#define RIGHT 0
-void
+static void
scroll_line (int dist, int direction)
{
/* The idea here is to implement a horizontal scroll in one line to
@@ -275,8 +275,8 @@ scroll_line (int dist, int direction)
/* If start is zero insert blanks instead of a string at start ?. */
-void
-insert_glyphs (register struct glyph *start, register int len)
+static void
+w32con_insert_glyphs (register struct glyph *start, register int len)
{
scroll_line (len, RIGHT);
@@ -286,18 +286,18 @@ insert_glyphs (register struct glyph *start, register int len)
/* Print the first len characters of start, cursor_coords.X adjusted
by write_glyphs. */
- write_glyphs (start, len);
+ w32con_write_glyphs (start, len);
}
else
{
- clear_end_of_line (cursor_coords.X + len);
+ w32con_clear_end_of_line (cursor_coords.X + len);
}
}
extern unsigned char *terminal_encode_buffer;
-void
-write_glyphs (register struct glyph *string, register int len)
+static void
+w32con_write_glyphs (register struct glyph *string, register int len)
{
int produced, consumed;
DWORD r;
@@ -350,7 +350,7 @@ write_glyphs (register struct glyph *string, register int len)
}
cursor_coords.X += produced;
- move_cursor (cursor_coords.Y, cursor_coords.X);
+ w32con_move_cursor (cursor_coords.Y, cursor_coords.X);
}
len -= consumed;
n -= consumed;
@@ -393,8 +393,8 @@ write_glyphs (register struct glyph *string, register int len)
}
-void
-delete_glyphs (int n)
+static void
+w32con_delete_glyphs (int n)
{
/* delete chars means scroll chars from cursor_coords.X + n to
cursor_coords.X, anything beyond the edge of the screen should
@@ -452,8 +452,8 @@ SOUND is nil to use the normal beep. */)
return sound;
}
-void
-reset_terminal_modes (void)
+static void
+w32con_reset_terminal_modes (void)
{
#ifdef USE_SEPARATE_SCREEN
SetConsoleActiveScreenBuffer (prev_screen);
@@ -463,8 +463,8 @@ reset_terminal_modes (void)
SetConsoleMode (keyboard_handle, prev_console_mode);
}
-void
-set_terminal_modes (void)
+static void
+w32con_set_terminal_modes (void)
{
CONSOLE_CURSOR_INFO cci;
@@ -486,19 +486,19 @@ set_terminal_modes (void)
clumps rather than one-character-at-a-time...
we'll start with not moving the cursor while an update is in progress. */
-void
-update_begin (struct frame * f)
+static void
+w32con_update_begin (struct frame * f)
{
}
-void
-update_end (struct frame * f)
+static void
+w32con_update_end (struct frame * f)
{
SetConsoleCursorPosition (cur_screen, cursor_coords);
}
-void
-set_terminal_window (int size)
+static void
+w32con_set_terminal_window (int size)
{
}
@@ -576,21 +576,21 @@ initialize_w32_display (void)
{
CONSOLE_SCREEN_BUFFER_INFO info;
- cursor_to_hook = move_cursor;
- raw_cursor_to_hook = move_cursor;
- clear_to_end_hook = clear_to_end;
- clear_frame_hook = clear_frame;
- clear_end_of_line_hook = clear_end_of_line;
- ins_del_lines_hook = ins_del_lines;
- insert_glyphs_hook = insert_glyphs;
- write_glyphs_hook = write_glyphs;
- delete_glyphs_hook = delete_glyphs;
+ cursor_to_hook = w32con_move_cursor;
+ raw_cursor_to_hook = w32con_move_cursor;
+ clear_to_end_hook = w32con_clear_to_end;
+ clear_frame_hook = w32con_clear_frame;
+ clear_end_of_line_hook = w32con_clear_end_of_line;
+ ins_del_lines_hook = w32con_ins_del_lines;
+ insert_glyphs_hook = w32con_insert_glyphs;
+ write_glyphs_hook = w32con_write_glyphs;
+ delete_glyphs_hook = w32con_delete_glyphs;
ring_bell_hook = w32_sys_ring_bell;
- reset_terminal_modes_hook = reset_terminal_modes;
- set_terminal_modes_hook = set_terminal_modes;
- set_terminal_window_hook = set_terminal_window;
- update_begin_hook = update_begin;
- update_end_hook = update_end;
+ reset_terminal_modes_hook = w32con_reset_terminal_modes;
+ set_terminal_modes_hook = w32con_set_terminal_modes;
+ set_terminal_window_hook = w32con_set_terminal_window;
+ update_begin_hook = w32con_update_begin;
+ update_end_hook = w32con_update_end;
read_socket_hook = w32_console_read_socket;
mouse_position_hook = w32_console_mouse_position;
diff --git a/src/w32fns.c b/src/w32fns.c
index ebdf5c3ccca..a5f8c4b61f3 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,5 +1,5 @@
/* Graphical user interface functions for the Microsoft W32 API.
- Copyright (C) 1989, 92, 93, 94, 95, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright (C) 1989, 1992, 93, 94, 95, 96, 97, 98, 99, 2000, 01, 04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -89,7 +89,7 @@ Lisp_Object Vw32_pass_alt_to_system;
Lisp_Object Vw32_alt_is_meta;
/* If non-zero, the windows virtual key code for an alternative quit key. */
-Lisp_Object Vw32_quit_key;
+int w32_quit_key;
/* Non nil if left window key events are passed on to Windows (this only
affects whether "tapping" the key opens the Start menu). */
@@ -133,11 +133,11 @@ Lisp_Object Vw32_enable_palette;
/* Control how close left/right button down events must be to
be converted to a middle button down event. */
-Lisp_Object Vw32_mouse_button_tolerance;
+int w32_mouse_button_tolerance;
/* Minimum interval between mouse movement (and scroll bar drag)
events that are passed on to the event loop. */
-Lisp_Object Vw32_mouse_move_interval;
+int w32_mouse_move_interval;
/* Flag to indicate if XBUTTON events should be passed on to Windows. */
int w32_pass_extra_mouse_buttons_to_system;
@@ -235,6 +235,9 @@ Lisp_Object Qw32_charset_mac;
Lisp_Object Qw32_charset_unicode;
#endif
+/* The ANSI codepage. */
+int w32_ansi_code_page;
+
/* Prefix for system colors. */
#define SYSTEM_COLOR_PREFIX "System"
#define SYSTEM_COLOR_PREFIX_LEN (sizeof (SYSTEM_COLOR_PREFIX) - 1)
@@ -281,7 +284,7 @@ int image_cache_refcount, dpyinfo_refcount;
/* From w32term.c. */
-extern Lisp_Object Vw32_num_mouse_buttons;
+extern int w32_num_mouse_buttons;
extern Lisp_Object Vw32_recognize_altgr;
extern HWND w32_system_caret_hwnd;
@@ -463,7 +466,7 @@ if the entry is new. */)
CHECK_NUMBER (blue);
CHECK_STRING (name);
- XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue)));
+ XSETINT (rgb, RGB(XUINT (red), XUINT (green), XUINT (blue)));
BLOCK_INPUT;
@@ -826,7 +829,7 @@ w32_to_x_color (rgb)
return Qnil;
}
-COLORREF
+static Lisp_Object
w32_color_map_lookup (colorname)
char *colorname;
{
@@ -845,7 +848,7 @@ w32_color_map_lookup (colorname)
if (lstrcmpi (SDATA (tem), colorname) == 0)
{
- ret = XUINT (Fcdr (elt));
+ ret = Fcdr (elt);
break;
}
@@ -908,7 +911,7 @@ add_system_logical_colors_to_map (system_colors)
}
-COLORREF
+static Lisp_Object
x_to_w32_color (colorname)
char * colorname;
{
@@ -968,7 +971,8 @@ x_to_w32_color (colorname)
if (i == 2)
{
UNBLOCK_INPUT;
- return (colorval);
+ XSETINT (ret, colorval);
+ return ret;
}
color = end;
}
@@ -1021,7 +1025,8 @@ x_to_w32_color (colorname)
if (*end != '\0')
break;
UNBLOCK_INPUT;
- return (colorval);
+ XSETINT (ret, colorval);
+ return ret;
}
if (*end != '/')
break;
@@ -1062,7 +1067,8 @@ x_to_w32_color (colorname)
if (*end != '\0')
break;
UNBLOCK_INPUT;
- return (colorval);
+ XSETINT (ret, colorval);
+ return ret;
}
if (*end != '/')
break;
@@ -2416,6 +2422,10 @@ Lisp_Object w32_grabbed_keys;
#define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255)
#define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8)
+#define RAW_HOTKEY_ID(k) ((k) & 0xbfff)
+#define RAW_HOTKEY_VK_CODE(k) ((k) & 255)
+#define RAW_HOTKEY_MODIFIERS(k) ((k) >> 8)
+
/* Register hot-keys for reserved key combinations when Emacs has
keyboard focus, since this is the only way Emacs can receive key
combinations like Alt-Tab which are used by the system. */
@@ -2497,20 +2507,20 @@ w32_msg_pump (deferred_msg * msg_buf)
focus_window = GetFocus ();
if (focus_window != NULL)
RegisterHotKey (focus_window,
- HOTKEY_ID (msg.wParam),
- HOTKEY_MODIFIERS (msg.wParam),
- HOTKEY_VK_CODE (msg.wParam));
+ RAW_HOTKEY_ID (msg.wParam),
+ RAW_HOTKEY_MODIFIERS (msg.wParam),
+ RAW_HOTKEY_VK_CODE (msg.wParam));
/* Reply is not expected. */
break;
case WM_EMACS_UNREGISTER_HOT_KEY:
focus_window = GetFocus ();
if (focus_window != NULL)
- UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam));
+ UnregisterHotKey (focus_window, RAW_HOTKEY_ID (msg.wParam));
/* Mark item as erased. NB: this code must be
thread-safe. The next line is okay because the cons
cell is never made into garbage and is not relocated by
GC. */
- XSETCAR ((Lisp_Object) msg.lParam, Qnil);
+ XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
abort ();
break;
@@ -2518,7 +2528,7 @@ w32_msg_pump (deferred_msg * msg_buf)
{
int vk_code = (int) msg.wParam;
int cur_state = (GetKeyState (vk_code) & 1);
- Lisp_Object new_state = (Lisp_Object) msg.lParam;
+ Lisp_Object new_state = (Lisp_Object) ((EMACS_INT) msg.lParam);
/* NB: This code must be thread-safe. It is safe to
call NILP because symbols are not relocated by GC,
@@ -2708,7 +2718,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers)
c = make_ctrl_char (c) & 0377;
if (c == quit_char
|| (wmsg.dwModifiers == 0 &&
- XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key)))
+ w32_quit_key && wParam == w32_quit_key))
{
Vquit_flag = Qt;
@@ -3118,7 +3128,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
are used together, but only if user has two button mouse. */
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
- if (XINT (Vw32_num_mouse_buttons) > 2)
+ if (w32_num_mouse_buttons > 2)
goto handle_plain_button;
{
@@ -3168,7 +3178,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
/* Hold onto message for now. */
mouse_button_timer =
SetTimer (hwnd, MOUSE_BUTTON_ID,
- XINT (Vw32_mouse_button_tolerance), NULL);
+ w32_mouse_button_tolerance, NULL);
saved_mouse_button_msg.msg.hwnd = hwnd;
saved_mouse_button_msg.msg.message = msg;
saved_mouse_button_msg.msg.wParam = wParam;
@@ -3181,7 +3191,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
case WM_LBUTTONUP:
case WM_RBUTTONUP:
- if (XINT (Vw32_num_mouse_buttons) > 2)
+ if (w32_num_mouse_buttons > 2)
goto handle_plain_button;
{
@@ -3277,7 +3287,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
track_mouse_window = hwnd;
}
case WM_VSCROLL:
- if (XINT (Vw32_mouse_move_interval) <= 0
+ if (w32_mouse_move_interval <= 0
|| (msg == WM_MOUSEMOVE && button_state == 0))
{
wmsg.dwModifiers = w32_get_modifiers ();
@@ -3293,7 +3303,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
if (saved_mouse_move_msg.msg.hwnd == 0)
mouse_move_timer =
SetTimer (hwnd, MOUSE_MOVE_ID,
- XINT (Vw32_mouse_move_interval), NULL);
+ w32_mouse_move_interval, NULL);
/* Hold onto message for now. */
saved_mouse_move_msg.msg.hwnd = hwnd;
@@ -4036,15 +4046,15 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1, 1, 0,
doc: /* Make a new window, which is called a \"frame\" in Emacs terms.
Returns an Emacs frame object.
-ALIST is an alist of frame parameters.
+PARAMETERS is an alist of frame parameters.
If the parameters specify that the frame should not have a minibuffer,
and do not specify a specific minibuffer window to use,
then `default-minibuffer-frame' must be a frame whose minibuffer can
be shared by the new frame.
This function is an internal primitive--use `make-frame' instead. */)
- (parms)
- Lisp_Object parms;
+ (parameters)
+ Lisp_Object parameters;
{
struct frame *f;
Lisp_Object frame, tem;
@@ -4065,7 +4075,7 @@ This function is an internal primitive--use `make-frame' instead. */)
until we know if this frame has a specified name. */
Vx_resource_name = Vinvocation_name;
- display = w32_get_arg (parms, Qdisplay, 0, 0, RES_TYPE_STRING);
+ display = w32_get_arg (parameters, Qdisplay, 0, 0, RES_TYPE_STRING);
if (EQ (display, Qunbound))
display = Qnil;
dpyinfo = check_x_display_info (display);
@@ -4075,7 +4085,7 @@ This function is an internal primitive--use `make-frame' instead. */)
kb = &the_only_kboard;
#endif
- name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
+ name = w32_get_arg (parameters, Qname, "name", "Name", RES_TYPE_STRING);
if (!STRINGP (name)
&& ! EQ (name, Qunbound)
&& ! NILP (name))
@@ -4085,7 +4095,7 @@ This function is an internal primitive--use `make-frame' instead. */)
Vx_resource_name = name;
/* See if parent window is specified. */
- parent = w32_get_arg (parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER);
+ parent = w32_get_arg (parameters, Qparent_id, NULL, NULL, RES_TYPE_NUMBER);
if (EQ (parent, Qunbound))
parent = Qnil;
if (! NILP (parent))
@@ -4095,8 +4105,8 @@ This function is an internal primitive--use `make-frame' instead. */)
/* No need to protect DISPLAY because that's not used after passing
it to make_frame_without_minibuffer. */
frame = Qnil;
- GCPRO4 (parms, parent, name, frame);
- tem = w32_get_arg (parms, Qminibuffer, "minibuffer", "Minibuffer",
+ GCPRO4 (parameters, parent, name, frame);
+ tem = w32_get_arg (parameters, Qminibuffer, "minibuffer", "Minibuffer",
RES_TYPE_SYMBOL);
if (EQ (tem, Qnone) || NILP (tem))
f = make_frame_without_minibuffer (Qnil, kb, display);
@@ -4126,7 +4136,7 @@ This function is an internal primitive--use `make-frame' instead. */)
record_unwind_protect (unwind_create_frame, frame);
f->icon_name
- = w32_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
+ = w32_get_arg (parameters, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
if (! STRINGP (f->icon_name))
f->icon_name = Qnil;
@@ -4168,7 +4178,7 @@ This function is an internal primitive--use `make-frame' instead. */)
{
Lisp_Object font;
- font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
+ font = w32_get_arg (parameters, Qfont, "font", "Font", RES_TYPE_STRING);
BLOCK_INPUT;
/* First, try whatever font the caller has specified. */
@@ -4192,49 +4202,49 @@ This function is an internal primitive--use `make-frame' instead. */)
if (! STRINGP (font))
font = build_string ("Fixedsys");
- x_default_parameter (f, parms, Qfont, font,
+ x_default_parameter (f, parameters, Qfont, font,
"font", "Font", RES_TYPE_STRING);
}
- x_default_parameter (f, parms, Qborder_width, make_number (2),
+ x_default_parameter (f, parameters, Qborder_width, make_number (2),
"borderWidth", "BorderWidth", RES_TYPE_NUMBER);
/* This defaults to 2 in order to match xterm. We recognize either
internalBorderWidth or internalBorder (which is what xterm calls
it). */
- if (NILP (Fassq (Qinternal_border_width, parms)))
+ if (NILP (Fassq (Qinternal_border_width, parameters)))
{
Lisp_Object value;
- value = w32_get_arg (parms, Qinternal_border_width,
- "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
+ value = w32_get_arg (parameters, Qinternal_border_width,
+ "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
if (! EQ (value, Qunbound))
- parms = Fcons (Fcons (Qinternal_border_width, value),
- parms);
+ parameters = Fcons (Fcons (Qinternal_border_width, value),
+ parameters);
}
/* Default internalBorderWidth to 0 on Windows to match other programs. */
- x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
+ x_default_parameter (f, parameters, Qinternal_border_width, make_number (0),
"internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qvertical_scroll_bars, Qright,
+ x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright,
"verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
/* Also do the stuff which must be set before the window exists. */
- x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
+ x_default_parameter (f, parameters, Qforeground_color, build_string ("black"),
"foreground", "Foreground", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
+ x_default_parameter (f, parameters, Qbackground_color, build_string ("white"),
"background", "Background", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
+ x_default_parameter (f, parameters, Qmouse_color, build_string ("black"),
"pointerColor", "Foreground", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
+ x_default_parameter (f, parameters, Qcursor_color, build_string ("black"),
"cursorColor", "Foreground", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qborder_color, build_string ("black"),
+ x_default_parameter (f, parameters, Qborder_color, build_string ("black"),
"borderColor", "BorderColor", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qscreen_gamma, Qnil,
+ x_default_parameter (f, parameters, Qscreen_gamma, Qnil,
"screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
- x_default_parameter (f, parms, Qline_spacing, Qnil,
+ x_default_parameter (f, parameters, Qline_spacing, Qnil,
"lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qleft_fringe, Qnil,
+ x_default_parameter (f, parameters, Qleft_fringe, Qnil,
"leftFringe", "LeftFringe", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qright_fringe, Qnil,
+ x_default_parameter (f, parameters, Qright_fringe, Qnil,
"rightFringe", "RightFringe", RES_TYPE_NUMBER);
@@ -4246,16 +4256,16 @@ This function is an internal primitive--use `make-frame' instead. */)
happen. */
init_frame_faces (f);
- x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
+ x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
"menuBar", "MenuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
+ x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
"toolBar", "ToolBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
+ x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
- x_default_parameter (f, parms, Qtitle, Qnil,
+ x_default_parameter (f, parameters, Qtitle, Qnil,
"title", "Title", RES_TYPE_STRING);
- x_default_parameter (f, parms, Qfullscreen, Qnil,
+ x_default_parameter (f, parameters, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW;
@@ -4268,13 +4278,13 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_data.w32->hourglass_cursor = w32_load_cursor (IDC_WAIT);
f->output_data.w32->horizontal_drag_cursor = w32_load_cursor (IDC_SIZEWE);
- window_prompting = x_figure_window_size (f, parms, 1);
+ window_prompting = x_figure_window_size (f, parameters, 1);
- tem = w32_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
+ tem = w32_get_arg (parameters, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
f->no_split = minibuffer_only || EQ (tem, Qt);
w32_window (f, window_prompting, minibuffer_only);
- x_icon (f, parms);
+ x_icon (f, parameters);
x_make_gc (f);
@@ -4284,16 +4294,16 @@ This function is an internal primitive--use `make-frame' instead. */)
/* We need to do this after creating the window, so that the
icon-creation functions can say whose icon they're describing. */
- x_default_parameter (f, parms, Qicon_type, Qnil,
+ x_default_parameter (f, parameters, Qicon_type, Qnil,
"bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
- x_default_parameter (f, parms, Qauto_raise, Qnil,
+ x_default_parameter (f, parameters, Qauto_raise, Qnil,
"autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
- x_default_parameter (f, parms, Qauto_lower, Qnil,
+ x_default_parameter (f, parameters, Qauto_lower, Qnil,
"autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
- x_default_parameter (f, parms, Qcursor_type, Qbox,
+ x_default_parameter (f, parameters, Qcursor_type, Qbox,
"cursorType", "CursorType", RES_TYPE_SYMBOL);
- x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
+ x_default_parameter (f, parameters, Qscroll_bar_width, Qnil,
"scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
/* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
@@ -4331,7 +4341,7 @@ This function is an internal primitive--use `make-frame' instead. */)
{
Lisp_Object visibility;
- visibility = w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
+ visibility = w32_get_arg (parameters, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
if (EQ (visibility, Qunbound))
visibility = Qt;
@@ -4775,46 +4785,46 @@ x_to_w32_charset (lpcs)
w32_charset = Fcar (Fcdr (this_entry));
/* Translate Lisp symbol to number. */
- if (w32_charset == Qw32_charset_ansi)
+ if (EQ (w32_charset, Qw32_charset_ansi))
return ANSI_CHARSET;
- if (w32_charset == Qw32_charset_symbol)
+ if (EQ (w32_charset, Qw32_charset_symbol))
return SYMBOL_CHARSET;
- if (w32_charset == Qw32_charset_shiftjis)
+ if (EQ (w32_charset, Qw32_charset_shiftjis))
return SHIFTJIS_CHARSET;
- if (w32_charset == Qw32_charset_hangeul)
+ if (EQ (w32_charset, Qw32_charset_hangeul))
return HANGEUL_CHARSET;
- if (w32_charset == Qw32_charset_chinesebig5)
+ if (EQ (w32_charset, Qw32_charset_chinesebig5))
return CHINESEBIG5_CHARSET;
- if (w32_charset == Qw32_charset_gb2312)
+ if (EQ (w32_charset, Qw32_charset_gb2312))
return GB2312_CHARSET;
- if (w32_charset == Qw32_charset_oem)
+ if (EQ (w32_charset, Qw32_charset_oem))
return OEM_CHARSET;
#ifdef JOHAB_CHARSET
- if (w32_charset == Qw32_charset_johab)
+ if (EQ (w32_charset, Qw32_charset_johab))
return JOHAB_CHARSET;
- if (w32_charset == Qw32_charset_easteurope)
+ if (EQ (w32_charset, Qw32_charset_easteurope))
return EASTEUROPE_CHARSET;
- if (w32_charset == Qw32_charset_turkish)
+ if (EQ (w32_charset, Qw32_charset_turkish))
return TURKISH_CHARSET;
- if (w32_charset == Qw32_charset_baltic)
+ if (EQ (w32_charset, Qw32_charset_baltic))
return BALTIC_CHARSET;
- if (w32_charset == Qw32_charset_russian)
+ if (EQ (w32_charset, Qw32_charset_russian))
return RUSSIAN_CHARSET;
- if (w32_charset == Qw32_charset_arabic)
+ if (EQ (w32_charset, Qw32_charset_arabic))
return ARABIC_CHARSET;
- if (w32_charset == Qw32_charset_greek)
+ if (EQ (w32_charset, Qw32_charset_greek))
return GREEK_CHARSET;
- if (w32_charset == Qw32_charset_hebrew)
+ if (EQ (w32_charset, Qw32_charset_hebrew))
return HEBREW_CHARSET;
- if (w32_charset == Qw32_charset_vietnamese)
+ if (EQ (w32_charset, Qw32_charset_vietnamese))
return VIETNAMESE_CHARSET;
- if (w32_charset == Qw32_charset_thai)
+ if (EQ (w32_charset, Qw32_charset_thai))
return THAI_CHARSET;
- if (w32_charset == Qw32_charset_mac)
+ if (EQ (w32_charset, Qw32_charset_mac))
return MAC_CHARSET;
#endif /* JOHAB_CHARSET */
#ifdef UNICODE_CHARSET
- if (w32_charset == Qw32_charset_unicode)
+ if (EQ (w32_charset, Qw32_charset_unicode))
return UNICODE_CHARSET;
#endif
@@ -4956,8 +4966,8 @@ w32_to_x_charset (fncharset, matching)
/* Look for Same charset and a valid codepage (or non-int
which means ignore). */
- if (w32_charset == charset_type
- && (!INTEGERP (codepage) || codepage == CP_DEFAULT
+ if (EQ (w32_charset, charset_type)
+ && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
|| IsValidCodePage (XINT (codepage))))
{
/* If we don't have a match already, then this is the
@@ -5151,8 +5161,8 @@ w32_to_all_x_charsets (fncharset)
/* Look for Same charset and a valid codepage (or non-int
which means ignore). */
- if (w32_charset == charset_type
- && (!INTEGERP (codepage) || codepage == CP_DEFAULT
+ if (EQ (w32_charset, charset_type)
+ && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
|| IsValidCodePage (XINT (codepage))))
{
retval = Fcons (x_charset, retval);
@@ -6205,6 +6215,9 @@ w32_find_ccl_program (fontp)
}
}
+/* directory-files from dired.c. */
+Lisp_Object Fdirectory_files P_((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
+
/* Find BDF files in a specified directory. (use GCPRO when calling,
as this calls lisp to get a directory listing). */
@@ -6218,7 +6231,7 @@ w32_find_bdf_fonts_in_dir (Lisp_Object directory)
return Qnil;
filelist = Fdirectory_files (directory, Qt,
- build_string (".*\\.[bB][dD][fF]"), Qt);
+ build_string (".*\\.[bB][dD][fF]"), Qt);
for ( ; CONSP(filelist); filelist = XCDR (filelist))
{
@@ -6231,10 +6244,10 @@ w32_find_bdf_fonts_in_dir (Lisp_Object directory)
DEFUN ("w32-find-bdf-fonts", Fw32_find_bdf_fonts, Sw32_find_bdf_fonts,
1, 1, 0,
- doc: /* Return a list of BDF fonts in DIR.
-The list is suitable for appending to w32-bdf-filename-alist. Fonts
-which do not contain an xlfd description will not be included in the
-list. DIR may be a list of directories. */)
+ doc: /* Return a list of BDF fonts in DIRECTORY.
+The list is suitable for appending to `w32-bdf-filename-alist'.
+Fonts which do not contain an xlfd description will not be included
+in the list. DIRECTORY may be a list of directories. */)
(directory)
Lisp_Object directory;
{
@@ -6315,7 +6328,7 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
Sx_display_grayscale_p, 0, 1, 0,
- doc: /* Return t if the X display supports shades of gray.
+ doc: /* Return t if DISPLAY supports shades of gray.
Note that color displays do support shades of gray.
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
@@ -6388,9 +6401,9 @@ If omitted or nil, that stands for the selected frame's display. */)
hdc = GetDC (dpyinfo->root_window);
if (dpyinfo->has_palette)
- cap = GetDeviceCaps (hdc,SIZEPALETTE);
+ cap = GetDeviceCaps (hdc, SIZEPALETTE);
else
- cap = GetDeviceCaps (hdc,NUMCOLORS);
+ cap = GetDeviceCaps (hdc, NUMCOLORS);
/* We force 24+ bit depths to 24-bit, both to prevent an overflow
and because probably is more meaningful on Windows anyway */
@@ -7175,6 +7188,8 @@ x_create_tip_frame (dpyinfo, parms, text)
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (buffer));
current_buffer->truncate_lines = Qnil;
+ specbind (Qinhibit_read_only, Qt);
+ specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
Finsert (1, &text);
set_buffer_internal_1 (old_buffer);
@@ -7442,7 +7457,7 @@ used to change the tooltip's appearance.
Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
means use the default timeout of 5 seconds.
-If the list of frame parameters PARAMS contains a `left' parameter,
+If the list of frame parameters PARMS contains a `left' parameter,
the tooltip is displayed at that x-position. Otherwise it is
displayed at the mouse position, with offset DX added (default is 5 if
DX isn't specified). Likewise for the y-position; if a `top' frame
@@ -7923,7 +7938,7 @@ Returns an X font string corresponding to the selection. */)
DEFUN ("w32-send-sys-command", Fw32_send_sys_command,
Sw32_send_sys_command, 1, 2, 0,
doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND.
-Some useful values for command are #xf030 to maximise frame (#xf020
+Some useful values for COMMAND are #xf030 to maximize frame (#xf020
to minimize), #xf120 to restore frame to original size, and #xf100
to activate the menubar for keyboard access. #xf140 activates the
screen saver if defined.
@@ -8003,7 +8018,7 @@ lookup_vk_code (char *key)
/* Convert a one-element vector style key sequence to a hot key
definition. */
-static int
+static Lisp_Object
w32_parse_hot_key (key)
Lisp_Object key;
{
@@ -8035,7 +8050,7 @@ w32_parse_hot_key (key)
if (SYMBOLP (c))
{
c = parse_modifiers (c);
- lisp_modifiers = Fcar (Fcdr (c));
+ lisp_modifiers = XINT (Fcar (Fcdr (c)));
c = Fcar (c);
if (!SYMBOLP (c))
abort ();
@@ -8104,8 +8119,13 @@ The return value is the hotkey-id if registered, otherwise nil. */)
/* Notify input thread about new hot-key definition, so that it
takes effect without needing to switch focus. */
+#ifdef USE_LISP_UNION_TYPE
+ PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
+ (WPARAM) key.i, 0);
+#else
PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
(WPARAM) key, 0);
+#endif
}
return key;
@@ -8113,7 +8133,7 @@ The return value is the hotkey-id if registered, otherwise nil. */)
DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
Sw32_unregister_hot_key, 1, 1, 0,
- doc: /* Unregister HOTKEY as a hot-key combination. */)
+ doc: /* Unregister KEY as a hot-key combination. */)
(key)
Lisp_Object key;
{
@@ -8128,8 +8148,14 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
{
/* Notify input thread about hot-key definition being removed, so
that it takes effect without needing focus switch. */
+#ifdef USE_LISP_UNION_TYPE
+ if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
+ (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
+#else
if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
(WPARAM) XINT (XCAR (item)), (LPARAM) item))
+
+#endif
{
MSG msg;
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -8149,7 +8175,8 @@ DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys,
DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key,
Sw32_reconstruct_hot_key, 1, 1, 0,
- doc: /* Convert hot-key ID to a lisp key combination. */)
+ doc: /* Convert hot-key ID to a lisp key combination.
+usage: (w32-reconstruct-hot-key ID) */)
(hotkeyid)
Lisp_Object hotkeyid;
{
@@ -8202,8 +8229,13 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
if (!dwWindowsThreadId)
return make_number (w32_console_toggle_lock_key (vk_code, new_state));
+#ifdef USE_LISP_UNION_TYPE
+ if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
+ (WPARAM) vk_code, (LPARAM) new_state.i))
+#else
if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
(WPARAM) vk_code, (LPARAM) new_state))
+#endif
{
MSG msg;
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -8383,7 +8415,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
Initialization
***********************************************************************/
-/* Keep this list in the same order as frame_parms in frame.c.
+/* Keep this list in the same order as frame_parms in frame.c.
Use 0 for unsupported frame parameters. */
frame_parm_handler w32_frame_parm_handlers[] =
@@ -8468,7 +8500,7 @@ syms_of_w32fns ()
w32_grabbed_keys = Qnil;
DEFVAR_LISP ("w32-color-map", &Vw32_color_map,
- doc: /* An array of color name mappings for windows. */);
+ doc: /* An array of color name mappings for Windows. */);
Vw32_color_map = Qnil;
DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system,
@@ -8482,9 +8514,9 @@ open the System menu. When nil, Emacs silently swallows alt key events. */);
When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */);
Vw32_alt_is_meta = Qt;
- DEFVAR_INT ("w32-quit-key", &Vw32_quit_key,
- doc: /* If non-zero, the virtual key code for an alternative quit key. */);
- XSETINT (Vw32_quit_key, 0);
+ DEFVAR_INT ("w32-quit-key", &w32_quit_key,
+ doc: /* If non-zero, the virtual key code for an alternative quit key. */);
+ w32_quit_key = 0;
DEFVAR_LISP ("w32-pass-lwindow-to-system",
&Vw32_pass_lwindow_to_system,
@@ -8498,9 +8530,9 @@ When non-nil, the Start menu is opened by tapping the key. */);
When non-nil, the Start menu is opened by tapping the key. */);
Vw32_pass_rwindow_to_system = Qt;
- DEFVAR_INT ("w32-phantom-key-code",
+ DEFVAR_LISP ("w32-phantom-key-code",
&Vw32_phantom_key_code,
- doc: /* Virtual key code used to generate \"phantom\" key presses.
+ doc: /* Virtual key code used to generate \"phantom\" key presses.
Value is a number between 0 and 255.
Phantom key presses are generated in order to stop the system from
@@ -8508,7 +8540,7 @@ acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or
`w32-pass-rwindow-to-system' is nil. */);
/* Although 255 is technically not a valid key code, it works and
means that this hack won't interfere with any real key code. */
- Vw32_phantom_key_code = 255;
+ XSETINT (Vw32_phantom_key_code, 255);
DEFVAR_LISP ("w32-enable-num-lock",
&Vw32_enable_num_lock,
@@ -8563,21 +8595,21 @@ Any other value will cause the key to be ignored. */);
Vw32_enable_palette = Qt;
DEFVAR_INT ("w32-mouse-button-tolerance",
- &Vw32_mouse_button_tolerance,
+ &w32_mouse_button_tolerance,
doc: /* Analogue of double click interval for faking middle mouse events.
The value is the minimum time in milliseconds that must elapse between
left/right button down events before they are considered distinct events.
If both mouse buttons are depressed within this interval, a middle mouse
button down event is generated instead. */);
- XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2);
+ w32_mouse_button_tolerance = GetDoubleClickTime () / 2;
DEFVAR_INT ("w32-mouse-move-interval",
- &Vw32_mouse_move_interval,
+ &w32_mouse_move_interval,
doc: /* Minimum interval between mouse move events.
The value is the minimum time in milliseconds that must elapse between
successive mouse move (or scroll bar drag) events before they are
reported as lisp events. */);
- XSETINT (Vw32_mouse_move_interval, 0);
+ w32_mouse_move_interval = 0;
DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system",
&w32_pass_extra_mouse_buttons_to_system,
@@ -8857,6 +8889,11 @@ void globals_of_w32fns ()
/* ditto for GetClipboardSequenceNumber. */
clipboard_sequence_fn = (ClipboardSequence_Proc)
GetProcAddress (user32_lib, "GetClipboardSequenceNumber");
+
+ DEFVAR_INT ("w32-ansi-code-page",
+ &w32_ansi_code_page,
+ doc: /* The ANSI code page used by the system. */);
+ w32_ansi_code_page = GetACP ();
}
#undef abort
diff --git a/src/w32heap.c b/src/w32heap.c
index b40db430ea9..d947842474f 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -245,6 +245,7 @@ init_heap ()
exit (1);
}
+#if defined (NO_UNION_TYPE) && !defined (USE_LSB_TAG)
/* Ensure that the addresses don't use the upper tag bits since
the Lisp type goes there. */
if (((unsigned long) data_region_base & ~VALMASK) != 0)
@@ -252,7 +253,7 @@ init_heap ()
printf ("Error: The heap was allocated in upper memory.\n");
exit (1);
}
-
+#endif
data_region_end = data_region_base;
real_data_region_end = data_region_end;
}
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 168a0fb87b3..8dd4f406881 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -464,12 +464,12 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
}
if (event->uChar.AsciiChar == 0)
return 0;
- XSETINT (emacs_ev->code, event->uChar.AsciiChar);
+ emacs_ev->code = event->uChar.AsciiChar;
}
else
{
emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT;
- XSETINT (emacs_ev->code, event->wVirtualKeyCode);
+ emacs_ev->code = event->wVirtualKeyCode;
}
XSETFRAME (emacs_ev->frame_or_window, get_frame ());
@@ -524,8 +524,8 @@ w32_console_mouse_position (FRAME_PTR *f,
*part = 0;
SELECTED_FRAME ()->mouse_moved = 0;
- *x = movement_pos.X;
- *y = movement_pos.Y;
+ XSETINT(*x, movement_pos.X);
+ XSETINT(*y, movement_pos.Y);
*time = movement_time;
UNBLOCK_INPUT;
@@ -593,9 +593,9 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
if (but_change & mask)
{
if (i < NUM_TRANSLATED_MOUSE_BUTTONS)
- XSETINT (emacs_ev->code, emacs_button_translation[i]);
+ emacs_ev->code = emacs_button_translation[i];
else
- XSETINT (emacs_ev->code, i);
+ emacs_ev->code = i;
break;
}
diff --git a/src/w32menu.c b/src/w32menu.c
index 5f8f8a4e5e0..cc0932d7bf5 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -2225,9 +2225,12 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
/* Set help string for menu item. Leave it as a Lisp_Object
until it is ready to be displayed, since GC can happen while
menus are active. */
- if (wv->help)
- info.dwItemData = (DWORD) wv->help;
-
+ if (!NILP (wv->help))
+#ifdef USE_LISP_UNION_TYPE
+ info.dwItemData = (DWORD) (wv->help).i;
+#else
+ info.dwItemData = (DWORD) (wv->help);
+#endif
if (wv->button_type == BUTTON_TYPE_RADIO)
{
/* CheckMenuRadioItem allows us to differentiate TOGGLE and
@@ -2307,7 +2310,12 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
info.fMask = MIIM_DATA;
get_menu_item_info (menu, item, FALSE, &info);
+#ifdef USE_LISP_UNION_TYPE
+ help = info.dwItemData ? (Lisp_Object) ((EMACS_INT) info.dwItemData)
+ : Qnil;
+#else
help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
+#endif
}
/* Store the help echo in the keyboard buffer as the X toolkit
diff --git a/src/w32proc.c b/src/w32proc.c
index edd286e50d0..8452337f7e2 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,5 +1,5 @@
/* Process support for GNU Emacs on the Microsoft W32 API.
- Copyright (C) 1992, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1992, 95, 99, 2000, 01, 04 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -82,7 +82,7 @@ Lisp_Object Vw32_start_process_inherit_error_mode;
avoids the inefficiency of frequently reading small amounts of data.
This is primarily necessary for handling DOS processes on Windows 95,
but is useful for W32 processes on both Windows 95 and NT as well. */
-Lisp_Object Vw32_pipe_read_delay;
+int w32_pipe_read_delay;
/* Control conversion of upper case file names to lower case.
nil means no, t means yes. */
@@ -367,7 +367,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
cp->pid = -cp->pid;
/* pid must fit in a Lisp_Int */
- cp->pid = (cp->pid & VALMASK);
+ cp->pid = cp->pid & INTMASK;
*pPid = cp->pid;
@@ -2202,7 +2202,7 @@ When non-nil, they inherit their error mode setting from Emacs, which stops
them blocking when trying to access unmounted drives etc. */);
Vw32_start_process_inherit_error_mode = Qt;
- DEFVAR_INT ("w32-pipe-read-delay", &Vw32_pipe_read_delay,
+ DEFVAR_INT ("w32-pipe-read-delay", &w32_pipe_read_delay,
doc: /* Forced delay before reading subprocess output.
This is done to improve the buffering of subprocess output, by
avoiding the inefficiency of frequently reading small amounts of data.
@@ -2211,7 +2211,7 @@ If positive, the value is the number of milliseconds to sleep before
reading the subprocess output. If negative, the magnitude is the number
of time slices to wait (effectively boosting the priority of the child
process temporarily). A value of zero disables waiting entirely. */);
- Vw32_pipe_read_delay = 50;
+ w32_pipe_read_delay = 50;
DEFVAR_LISP ("w32-downcase-file-names", &Vw32_downcase_file_names,
doc: /* Non-nil means convert all-upper case file names to lower case.
diff --git a/src/w32select.c b/src/w32select.c
index 21f828d1f0c..cc0ca64fab8 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -249,11 +249,18 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
+ CloseClipboard ();
+
+ /* Common sense says to read the sequence number inside the
+ OpenClipboard/ CloseClipboard block to avoid race conditions
+ where another app puts something on the clipboard straight after
+ us. But experience suggests that the sequence number from the
+ SetClipboardData is not allocated until we close the clipboard!
+ Since clipboard operations are normally user-driven, the race
+ condition is probably not going to really happen. */
if (clipboard_sequence_fn)
last_clipboard_sequence_number = clipboard_sequence_fn ();
- CloseClipboard ();
-
if (ok) goto done;
error:
diff --git a/src/w32term.c b/src/w32term.c
index a9afc99b959..95ccafe415b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -204,7 +204,7 @@ int last_scroll_bar_drag_pos;
static RECT last_mouse_glyph;
static Lisp_Object last_mouse_press_frame;
-Lisp_Object Vw32_num_mouse_buttons;
+int w32_num_mouse_buttons;
Lisp_Object Vw32_swap_mouse_buttons;
@@ -1371,7 +1371,8 @@ static void w32_draw_image_foreground_1 P_ ((struct glyph_string *, HBITMAP));
static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
int, int, int));
static void w32_draw_relief_rect P_ ((struct frame *, int, int, int, int,
- int, int, int, int, RECT *));
+ int, int, int, int, int, int,
+ RECT *));
static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
int, int, int, RECT *));
@@ -1952,9 +1953,10 @@ x_setup_relief_colors (s)
static void
w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
- raised_p, left_p, right_p, clip_rect)
+ raised_p, top_p, bot_p, left_p, right_p, clip_rect)
struct frame *f;
- int left_x, top_y, right_x, bottom_y, width, left_p, right_p, raised_p;
+ int left_x, top_y, right_x, bottom_y, width;
+ int top_p, bot_p, left_p, right_p, raised_p;
RECT *clip_rect;
{
int i;
@@ -1969,10 +1971,11 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
w32_set_clip_rectangle (hdc, clip_rect);
/* Top. */
- for (i = 0; i < width; ++i)
- w32_fill_area (f, hdc, gc.foreground,
- left_x + i * left_p, top_y + i,
- right_x - left_x - i * (left_p + right_p ) + 1, 1);
+ if (top_p)
+ for (i = 0; i < width; ++i)
+ w32_fill_area (f, hdc, gc.foreground,
+ left_x + i * left_p, top_y + i,
+ right_x - left_x - i * (left_p + right_p ) + 1, 1);
/* Left. */
if (left_p)
@@ -1987,10 +1990,11 @@ w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
gc.foreground = f->output_data.w32->white_relief.gc->foreground;
/* Bottom. */
- for (i = 0; i < width; ++i)
- w32_fill_area (f, hdc, gc.foreground,
- left_x + i * left_p, bottom_y - i,
- right_x - left_x - i * (left_p + right_p) + 1, 1);
+ if (bot_p)
+ for (i = 0; i < width; ++i)
+ w32_fill_area (f, hdc, gc.foreground,
+ left_x + i * left_p, bottom_y - i,
+ right_x - left_x - i * (left_p + right_p) + 1, 1);
/* Right. */
if (right_p)
@@ -2100,7 +2104,7 @@ x_draw_glyph_string_box (s)
{
x_setup_relief_colors (s);
w32_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
- width, raised_p, left_p, right_p, &clip_rect);
+ width, raised_p, 1, 1, left_p, right_p, &clip_rect);
}
}
@@ -2111,21 +2115,22 @@ static void
x_draw_image_foreground (s)
struct glyph_string *s;
{
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
SaveDC (s->hdc);
@@ -2147,12 +2152,12 @@ x_draw_image_foreground (s)
SetTextColor (s->hdc, RGB (255, 255, 255));
SetBkColor (s->hdc, RGB (0, 0, 0));
- BitBlt (s->hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCINVERT);
- BitBlt (s->hdc, x, y, s->img->width, s->img->height,
- mask_dc, 0, 0, SRCAND);
- BitBlt (s->hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCINVERT);
+ BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
+ BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+ mask_dc, s->slice.x, s->slice.y, SRCAND);
+ BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
SelectObject (mask_dc, mask_orig_obj);
DeleteDC (mask_dc);
@@ -2162,8 +2167,8 @@ x_draw_image_foreground (s)
SetTextColor (s->hdc, s->gc->foreground);
SetBkColor (s->hdc, s->gc->background);
- BitBlt (s->hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCCOPY);
+ BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2176,7 +2181,8 @@ x_draw_image_foreground (s)
int r = s->img->relief;
if (r < 0) r = -r;
w32_draw_rectangle (s->hdc, s->gc, x - r, y - r ,
- s->img->width + r*2 - 1, s->img->height + r*2 - 1);
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
@@ -2187,8 +2193,8 @@ x_draw_image_foreground (s)
DeleteDC (compat_hdc);
}
else
- w32_draw_rectangle (s->hdc, s->gc, x, y, s->img->width -1,
- s->img->height - 1);
+ w32_draw_rectangle (s->hdc, s->gc, x, y,
+ s->slice.width - 1, s->slice.height - 1);
RestoreDC (s->hdc ,-1);
}
@@ -2203,21 +2209,22 @@ x_draw_image_relief (s)
{
int x0, y0, x1, y1, thick, raised_p;
RECT r;
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->hl == DRAW_IMAGE_SUNKEN
|| s->hl == DRAW_IMAGE_RAISED)
@@ -2233,12 +2240,17 @@ x_draw_image_relief (s)
x0 = x - thick;
y0 = y - thick;
- x1 = x + s->img->width + thick - 1;
- y1 = y + s->img->height + thick - 1;
+ x1 = x + s->slice.width + thick - 1;
+ y1 = y + s->slice.height + thick - 1;
x_setup_relief_colors (s);
get_glyph_string_clip_rect (s, &r);
- w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
+ w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
+ s->slice.y == 0,
+ s->slice.y + s->slice.height == s->img->height,
+ s->slice.x == 0,
+ s->slice.x + s->slice.width == s->img->width,
+ &r);
}
@@ -2251,21 +2263,22 @@ w32_draw_image_foreground_1 (s, pixmap)
{
HDC hdc = CreateCompatibleDC (s->hdc);
HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap);
- int x;
- int y = s->ybase - s->y - image_ascent (s->img, s->face);
+ int x = 0;
+ int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = abs (s->face->box_line_width);
- else
- x = 0;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->img->pixmap)
{
@@ -2281,12 +2294,12 @@ w32_draw_image_foreground_1 (s, pixmap)
SetTextColor (hdc, RGB (0, 0, 0));
SetBkColor (hdc, RGB (255, 255, 255));
- BitBlt (hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCINVERT);
- BitBlt (hdc, x, y, s->img->width, s->img->height,
- mask_dc, 0, 0, SRCAND);
- BitBlt (hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCINVERT);
+ BitBlt (hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
+ BitBlt (hdc, x, y, s->slice.width, s->slice.height,
+ mask_dc, s->slice.x, s->slice.y, SRCAND);
+ BitBlt (hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
SelectObject (mask_dc, mask_orig_obj);
DeleteDC (mask_dc);
@@ -2296,8 +2309,8 @@ w32_draw_image_foreground_1 (s, pixmap)
SetTextColor (hdc, s->gc->foreground);
SetBkColor (hdc, s->gc->background);
- BitBlt (hdc, x, y, s->img->width, s->img->height,
- compat_hdc, 0, 0, SRCCOPY);
+ BitBlt (hdc, x, y, s->slice.width, s->slice.height,
+ compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2309,8 +2322,9 @@ w32_draw_image_foreground_1 (s, pixmap)
{
int r = s->img->relief;
if (r < 0) r = -r;
- w32_draw_rectangle (hdc, s->gc, x - r, y - r ,
- s->img->width + r*2 - 1, s->img->height + r*2 - 1);
+ w32_draw_rectangle (hdc, s->gc, x - r, y - r,
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
@@ -2320,8 +2334,8 @@ w32_draw_image_foreground_1 (s, pixmap)
DeleteDC (compat_hdc);
}
else
- w32_draw_rectangle (hdc, s->gc, x, y, s->img->width - 1,
- s->img->height - 1);
+ w32_draw_rectangle (hdc, s->gc, x, y,
+ s->slice.width - 1, s->slice.height - 1);
SelectObject (hdc, orig_hdc_obj);
DeleteDC (hdc);
@@ -2380,19 +2394,22 @@ x_draw_image_glyph_string (s)
taller than image or if image has a clip mask to reduce
flickering. */
s->stippled_p = s->face->stipple != 0;
- if (height > s->img->height
+ if (height > s->slice.height
|| s->img->hmargin
|| s->img->vmargin
|| s->img->mask
|| s->img->pixmap == 0
|| s->width != s->background_width)
{
- if (box_line_hwidth && s->first_glyph->left_box_line_p)
- x = s->x + box_line_hwidth;
- else
- x = s->x;
+ x = s->x;
+ if (s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += box_line_hwidth;
+
+ y = s->y;
+ if (s->slice.y == 0)
+ y += box_line_vwidth;
- y = s->y + box_line_vwidth;
#if 0 /* TODO: figure out if we need to do this on Windows. */
if (s->img->mask)
{
@@ -4311,8 +4328,7 @@ w32_read_socket (sd, expected, hold_quit)
/* So people can tell when we have read the available input. */
input_signal_count++;
- /* TODO: tool-bars, ghostscript integration, mouse
- cursors. */
+ /* TODO: ghostscript integration. */
while (get_next_msg (&msg, FALSE))
{
struct input_event inev;
@@ -4495,10 +4511,16 @@ w32_read_socket (sd, expected, hold_quit)
/* If the contents of the global variable help_echo_string
has changed, generate a HELP_EVENT. */
+#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE.
+ But it was originally changed to this to fix a bug, so I have
+ not removed it completely in case the bug is still there. */
if (help_echo_string != previous_help_echo_string ||
(!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved))
+#else /* This is what xterm.c does. */
+ if (!NILP (help_echo_string)
+ || !NILP (previous_help_echo_string))
do_help = 1;
-
+#endif
break;
case WM_LBUTTONDOWN:
@@ -4919,7 +4941,7 @@ w32_read_socket (sd, expected, hold_quit)
if (do_help > 0)
{
- if (help_echo_string == Qnil)
+ if (NILP (help_echo_string))
{
help_echo_object = help_echo_window = Qnil;
help_echo_pos = -1;
@@ -5068,28 +5090,38 @@ x_draw_hollow_cursor (w, row)
struct frame *f = XFRAME (WINDOW_FRAME (w));
HDC hdc;
RECT rect;
- int wd;
+ int wd, h;
struct glyph *cursor_glyph;
HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
+ /* Get the glyph the cursor is on. If we can't tell because
+ the current matrix is invalid or such, give up. */
+ cursor_glyph = get_phys_cursor_glyph (w);
+ if (cursor_glyph == NULL)
+ return;
+
/* Compute frame-relative coordinates from window-relative
coordinates. */
rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
+ row->ascent - w->phys_cursor_ascent);
- rect.bottom = rect.top + row->height;
- /* Get the glyph the cursor is on. If we can't tell because
- the current matrix is invalid or such, give up. */
- cursor_glyph = get_phys_cursor_glyph (w);
- if (cursor_glyph == NULL)
- return;
+ /* Compute the proper height and ascent of the rectangle, based
+ on the actual glyph. Using the full height of the row looks
+ bad when there are tall images on that row. */
+ h = max (min (FRAME_LINE_HEIGHT (f), row->height),
+ cursor_glyph->ascent + cursor_glyph->descent);
+ if (h < row->height)
+ rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
+ h--;
+
+ rect.bottom = rect.top + h;
/* Compute the width of the rectangle to draw. If on a stretch
glyph, and `x-stretch-block-cursor' is nil, don't draw a
rectangle as wide as the glyph, but use a canonical character
width instead. */
- wd = cursor_glyph->pixel_width;
+ wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
if (cursor_glyph->type == STRETCH_GLYPH
&& !x_stretch_cursor_p)
wd = min (FRAME_COLUMN_WIDTH (f), wd);
@@ -6604,9 +6636,9 @@ syms_of_w32term ()
Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
DEFVAR_INT ("w32-num-mouse-buttons",
- &Vw32_num_mouse_buttons,
+ &w32_num_mouse_buttons,
doc: /* Number of physical mouse buttons. */);
- Vw32_num_mouse_buttons = Qnil;
+ w32_num_mouse_buttons = 2;
DEFVAR_LISP ("w32-swap-mouse-buttons",
&Vw32_swap_mouse_buttons,
diff --git a/src/w32term.h b/src/w32term.h
index cf6956c1efa..524b1097c42 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -252,6 +252,10 @@ extern int unibyte_display_via_language_environment;
struct w32_display_info *x_display_info_for_name ();
+Lisp_Object display_x_get_resource P_ ((struct w32_display_info *,
+ Lisp_Object, Lisp_Object,
+ Lisp_Object, Lisp_Object));
+
extern struct w32_display_info *w32_term_init ();
extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
@@ -721,9 +725,10 @@ struct face;
XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *);
struct frame * check_x_frame (Lisp_Object);
+Lisp_Object vga_stdcolor_name (int);
+
EXFUN (Fx_display_color_p, 1);
EXFUN (Fx_display_grayscale_p, 1);
-int image_ascent P_ ((struct image *, struct face *));
#define FONT_TYPE_FOR_UNIBYTE(font, ch) \
((font)->bdf ? BDF_1D_FONT : ANSI_FONT)
diff --git a/src/window.c b/src/window.c
index 47bbf0806ee..d3203c99e90 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
- Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000, 2001, 2002, 2003
+ Copyright (C) 1985,86,87, 1993,94,95,96,97,98, 2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -322,7 +322,11 @@ DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p,
Return nil if that position is scrolled vertically out of view.
If a character is only partially visible, nil is returned, unless the
optional argument PARTIALLY is non-nil.
-POS defaults to point in WINDOW; WINDOW defaults to the selected window. */)
+POS defaults to point in WINDOW; WINDOW defaults to the selected window.
+
+If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
+return value is a list (X Y PARTIAL) where X and Y are the pixel relative
+coordinate */)
(pos, window, partially)
Lisp_Object pos, window, partially;
{
@@ -330,8 +334,9 @@ POS defaults to point in WINDOW; WINDOW defaults to the selected window. */)
register int posint;
register struct buffer *buf;
struct text_pos top;
- Lisp_Object in_window;
- int fully_p;
+ Lisp_Object in_window = Qnil;
+ int fully_p = 1;
+ int x, y;
w = decode_window (window);
buf = XBUFFER (w->buffer);
@@ -347,38 +352,20 @@ POS defaults to point in WINDOW; WINDOW defaults to the selected window. */)
else
posint = XMARKER (w->pointm)->charpos;
- /* If position is above window start, it's not visible. */
- if (posint < CHARPOS (top))
- in_window = Qnil;
- else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf)
- && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf)
- && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos))
- {
- /* If frame is up-to-date, and POSINT is < window end pos, use
- that info. This doesn't work for POSINT == end pos, because
- the window end pos is actually the position _after_ the last
- char in the window. */
- if (NILP (partially))
- {
- pos_visible_p (w, posint, &fully_p, NILP (partially));
- in_window = fully_p ? Qt : Qnil;
- }
- else
- in_window = Qt;
- }
- else if (posint > BUF_ZV (buf))
- in_window = Qnil;
- else if (CHARPOS (top) < BUF_BEGV (buf) || CHARPOS (top) > BUF_ZV (buf))
- /* If window start is out of range, do something reasonable. */
- in_window = Qnil;
- else
- {
- if (pos_visible_p (w, posint, &fully_p, NILP (partially)))
- in_window = !NILP (partially) || fully_p ? Qt : Qnil;
- else
- in_window = Qnil;
- }
-
+ /* If position is above window start or outside buffer boundaries,
+ or if window start is out of range, position is not visible. */
+ if (posint >= CHARPOS (top)
+ && posint <= BUF_ZV (buf)
+ && CHARPOS (top) >= BUF_BEGV (buf)
+ && CHARPOS (top) <= BUF_ZV (buf)
+ && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially))
+ && (!NILP (partially) || fully_p))
+ in_window = Qt;
+
+ if (!NILP (in_window) && !NILP (partially))
+ in_window = Fcons (make_number (x),
+ Fcons (make_number (y),
+ Fcons (fully_p ? Qt : Qnil, Qnil)));
return in_window;
}
@@ -3036,7 +3023,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p)
DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0,
doc: /* Make WINDOW display BUFFER as its contents.
BUFFER can be a buffer or buffer name.
-Optional third arg KEEP_MARGINS non-nil means that WINDOW's current
+Optional third arg KEEP-MARGINS non-nil means that WINDOW's current
display margins, fringe widths, and scroll bar settings are maintained;
the default is to reset these from BUFFER's local settings or the frame
defaults. */)
@@ -3075,8 +3062,8 @@ defaults. */)
DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer.
-If WINDOW is not already selected, also make WINDOW's buffer current.
-Also make WINDOW the frame's selected window.
+If WINDOW is not already selected, make WINDOW's buffer current
+and make WINDOW the frame's selected window.
Optional second arg NORECORD non-nil means
do not put this buffer at the front of the list of recently selected ones.
@@ -3283,6 +3270,10 @@ If FRAME is nil, search only the selected frame
unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil,
which means search visible and iconified frames.
+If a full-width window on a splittable frame is available to display
+the buffer, it may be split, subject to the value of the variable
+`split-height-threshold'.
+
If `even-window-heights' is non-nil, window heights will be evened out
if displaying the buffer causes two vertically adjacent windows to be
displayed. */)
@@ -3460,7 +3451,7 @@ DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
0, 1, 0,
doc: /* Force redisplay of all windows.
If optional arg OBJECT is a window, force redisplay of that window only.
-If OBJECT is a buffer or buffer name, force redisplay of all windows
+If OBJECT is a buffer or buffer name, force redisplay of all windows
displaying that buffer. */)
(object)
Lisp_Object object;
@@ -3482,7 +3473,7 @@ displaying that buffer. */)
++update_mode_lines;
return Qt;
}
-
+
if (STRINGP (object))
object = Fget_buffer (object);
if (BUFFERP (object) && !NILP (XBUFFER (object)->name))
@@ -3547,7 +3538,7 @@ temp_output_buffer_show (buf)
Lisp_Object prev_window, prev_buffer;
prev_window = selected_window;
XSETBUFFER (prev_buffer, old);
-
+
/* Select the window that was chosen, for running the hook.
Note: Both Fselect_window and select_window_norecord may
set-buffer to the buffer displayed in the window,
@@ -3598,7 +3589,8 @@ DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "",
WINDOW defaults to selected one and SIZE to half its size.
If optional third arg HORFLAG is non-nil, split side by side
and put SIZE columns in the first of the pair. In that case,
-SIZE includes that window's scroll bar, or the divider column to its right. */)
+SIZE includes that window's scroll bar, or the divider column to its right.
+Returns the newly-created window. */)
(window, size, horflag)
Lisp_Object window, size, horflag;
{
@@ -6067,7 +6059,7 @@ If TYPE is t, use the frame's scroll-bar type. */)
vertical_type = Qnil;
if (!(EQ (vertical_type, Qnil)
- || EQ (vertical_type, Qleft)
+ || EQ (vertical_type, Qleft)
|| EQ (vertical_type, Qright)
|| EQ (vertical_type, Qt)))
error ("Invalid type of vertical scroll bar");
@@ -6116,12 +6108,13 @@ value. */)
Smooth scrolling
***********************************************************************/
-DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 1, 0,
+DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
doc: /* Return the amount by which WINDOW is scrolled vertically.
Use the selected window if WINDOW is nil or omitted.
-Value is a multiple of the canonical character height of WINDOW. */)
- (window)
- Lisp_Object window;
+Normally, value is a multiple of the canonical character height of WINDOW;
+optional second arg PIXELS_P means value is measured in pixels. */)
+ (window, pixels_p)
+ Lisp_Object window, pixels_p;
{
Lisp_Object result;
struct frame *f;
@@ -6135,7 +6128,9 @@ Value is a multiple of the canonical character height of WINDOW. */)
f = XFRAME (w->frame);
if (FRAME_WINDOW_P (f))
- result = FRAME_CANON_Y_FROM_PIXEL_Y (f, -w->vscroll);
+ result = (NILP (pixels_p)
+ ? FRAME_CANON_Y_FROM_PIXEL_Y (f, -w->vscroll)
+ : make_number (-w->vscroll));
else
result = make_number (0);
return result;
@@ -6143,12 +6138,13 @@ Value is a multiple of the canonical character height of WINDOW. */)
DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
- 2, 2, 0,
+ 2, 3, 0,
doc: /* Set amount by which WINDOW should be scrolled vertically to VSCROLL.
-WINDOW nil means use the selected window. VSCROLL is a non-negative
-multiple of the canonical character height of WINDOW. */)
- (window, vscroll)
- Lisp_Object window, vscroll;
+WINDOW nil means use the selected window. Normally, VSCROLL is a
+non-negative multiple of the canonical character height of WINDOW;
+optional third arg PIXELS_P non-nil means that VSCROLL is in pixels. */)
+ (window, vscroll, pixels_p)
+ Lisp_Object window, vscroll, pixels_p;
{
struct window *w;
struct frame *f;
@@ -6166,7 +6162,9 @@ multiple of the canonical character height of WINDOW. */)
{
int old_dy = w->vscroll;
- w->vscroll = - FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll);
+ w->vscroll = - (NILP (pixels_p)
+ ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll)
+ : XFLOATINT (vscroll));
w->vscroll = min (w->vscroll, 0);
/* Adjust glyph matrix of the frame if the virtual display
@@ -6178,7 +6176,7 @@ multiple of the canonical character height of WINDOW. */)
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
}
- return Fwindow_vscroll (window);
+ return Fwindow_vscroll (window, pixels_p);
}
@@ -6506,9 +6504,10 @@ using `special-display-function'. See also `special-display-regexps'.
An element of the list can be a list instead of just a string.
There are two ways to use a list as an element:
(BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)
-In the first case, FRAME-PARAMETERS are used to create the frame.
-In the latter case, FUNCTION is called with BUFFER as the first argument,
-followed by OTHER-ARGS--it can display BUFFER in any way it likes.
+In the first case, the FRAME-PARAMETERS are pairs of the form
+\(PARAMETER . VALUE); these parameter values are used to create the frame.
+In the second case, FUNCTION is called with BUFFER as the first argument,
+followed by the OTHER-ARGS--it can display BUFFER in any way it likes.
All this is done by the function found in `special-display-function'.
If the specified frame parameters include (same-buffer . t), the
@@ -6531,9 +6530,10 @@ using `special-display-function'.
An element of the list can be a list instead of just a string.
There are two ways to use a list as an element:
(REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)
-In the first case, FRAME-PARAMETERS are used to create the frame.
-In the latter case, FUNCTION is called with the buffer as first argument,
-followed by OTHER-ARGS--it can display the buffer in any way it likes.
+In the first case, the FRAME-PARAMETERS are pairs of the form
+\(PARAMETER . VALUE); these parameter values are used to create the frame.
+In the second case, FUNCTION is called with BUFFER as the first argument,
+followed by the OTHER-ARGS--it can display the buffer in any way it likes.
All this is done by the function found in `special-display-function'.
If the specified frame parameters include (same-buffer . t), the
@@ -6599,7 +6599,7 @@ See also `same-window-buffer-names'. */);
next_screen_context_lines = 2;
DEFVAR_INT ("split-height-threshold", &split_height_threshold,
- doc: /* *display-buffer would prefer to split the largest window if this large.
+ doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'.
If there is only one window, it is split regardless of this value. */);
split_height_threshold = 500;
diff --git a/src/window.h b/src/window.h
index c665e9921c6..1e53ae659cb 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,5 +1,5 @@
/* Window definitions for GNU Emacs.
- Copyright (C) 1985, 1986, 1993, 1995, 1997, 1998, 1999, 2000, 2001, 2003
+ Copyright (C) 1985,86,93,95,97,98,99, 2000,01,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -320,7 +320,7 @@ struct window
| | +--------------------------- LEFT_MARGIN_COLS
| +------------------------------- LEFT_FRINGE_WIDTH
+---------------------------------- LEFT_SCROLL_BAR_COLS
-
+
*/
@@ -767,8 +767,8 @@ EXFUN (Fdisplay_buffer, 3);
EXFUN (Fset_window_buffer, 3);
EXFUN (Fset_window_hscroll, 2);
EXFUN (Fwindow_hscroll, 1);
-EXFUN (Fset_window_vscroll, 2);
-EXFUN (Fwindow_vscroll, 1);
+EXFUN (Fset_window_vscroll, 3);
+EXFUN (Fwindow_vscroll, 2);
EXFUN (Fset_window_margins, 3);
EXFUN (Fwindow_live_p, 1);
EXFUN (Fset_window_point, 2);
diff --git a/src/xdisp.c b/src/xdisp.c
index 13fdd0d8c72..41e00893c30 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -199,8 +199,6 @@ Boston, MA 02111-1307, USA. */
#endif
#ifdef MAC_OS
#include "macterm.h"
-
-Cursor No_Cursor;
#endif
#ifndef FRAME_X_OUTPUT
@@ -302,8 +300,10 @@ extern Lisp_Object Qface, Qinvisible, Qwidth;
Lisp_Object Vdisplay_pixels_per_inch;
Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height;
Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise;
+Lisp_Object Qslice;
Lisp_Object Qcenter;
Lisp_Object Qmargin, Qpointer;
+Lisp_Object Qline_height, Qtotal;
extern Lisp_Object Qheight;
extern Lisp_Object QCwidth, QCheight, QCascent;
extern Lisp_Object Qscroll_bar;
@@ -671,10 +671,6 @@ EMACS_INT hscroll_margin;
/* How much to scroll horizontally when point is inside the above margin. */
Lisp_Object Vhscroll_step;
-/* A list of symbols, one for each supported image type. */
-
-Lisp_Object Vimage_types;
-
/* The variable `resize-mini-windows'. If nil, don't resize
mini-windows. If t, always resize them to fit the text they
display. If `grow-only', let mini-windows grow only until they
@@ -800,6 +796,9 @@ int help_echo_pos;
Lisp_Object previous_help_echo_string;
+/* Null glyph slice */
+
+static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
/* Function prototypes. */
@@ -852,7 +851,7 @@ static void insert_left_trunc_glyphs P_ ((struct it *));
static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
Lisp_Object));
static void extend_face_to_end_of_line P_ ((struct it *));
-static int append_space P_ ((struct it *, int));
+static int append_space_for_newline P_ ((struct it *, int));
static int make_cursor_line_fully_visible P_ ((struct window *, int));
static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
@@ -1238,9 +1237,9 @@ line_bottom_y (it)
and header-lines heights. */
int
-pos_visible_p (w, charpos, fully, exact_mode_line_heights_p)
+pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p)
struct window *w;
- int charpos, *fully, exact_mode_line_heights_p;
+ int charpos, *fully, *x, *y, exact_mode_line_heights_p;
{
struct it it;
struct text_pos top;
@@ -1288,14 +1287,27 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p)
visible_p = 1;
*fully = bottom_y <= it.last_visible_y;
}
+ if (visible_p && x)
+ {
+ *x = it.current_x;
+ *y = max (top_y + it.max_ascent - it.ascent, window_top_y);
+ }
}
else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y)
{
+ struct it it2;
+
+ it2 = it;
move_it_by_lines (&it, 1, 0);
if (charpos < IT_CHARPOS (it))
{
visible_p = 1;
- *fully = 0;
+ if (x)
+ {
+ move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
+ *x = it2.current_x;
+ *y = it2.current_y + it2.max_ascent - it2.ascent;
+ }
}
}
@@ -1303,6 +1315,7 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p)
set_buffer_internal_1 (old_buffer);
current_header_line_height = current_mode_line_height = -1;
+
return visible_p;
}
@@ -2057,6 +2070,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
{
if (NATNUMP (current_buffer->extra_line_spacing))
it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing);
+ else if (FLOATP (current_buffer->extra_line_spacing))
+ it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing)
+ * FRAME_LINE_HEIGHT (it->f));
else if (it->f->extra_line_spacing > 0)
it->extra_line_spacing = it->f->extra_line_spacing;
}
@@ -2070,9 +2086,11 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
if (FRAME_FACE_CACHE (it->f)->used == 0)
recompute_basic_faces (it->f);
- /* Current value of the `space-width', and 'height' properties. */
+ /* Current value of the `slice', `space-width', and 'height' properties. */
+ it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
it->space_width = Qnil;
it->font_height = Qnil;
+ it->override_ascent = -1;
/* Are control characters displayed as `^C'? */
it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow);
@@ -2713,19 +2731,10 @@ next_overlay_change (pos)
int noverlays;
int endpos;
Lisp_Object *overlays;
- int len;
int i;
/* Get all overlays at the given position. */
- len = 10;
- overlays = (Lisp_Object *) alloca (len * sizeof *overlays);
- noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1);
- if (noverlays > len)
- {
- len = noverlays;
- overlays = (Lisp_Object *) alloca (len * sizeof *overlays);
- noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1);
- }
+ GET_OVERLAYS_AT (pos, overlays, noverlays, &endpos, 1);
/* If any of these overlays ends before endpos,
use its ending point instead. */
@@ -3278,8 +3287,9 @@ handle_display_prop (it)
}
/* Reset those iterator values set from display property values. */
- it->font_height = Qnil;
+ it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
it->space_width = Qnil;
+ it->font_height = Qnil;
it->voffset = 0;
/* We don't support recursive `display' properties, i.e. string
@@ -3298,6 +3308,7 @@ handle_display_prop (it)
&& !EQ (XCAR (prop), Qimage)
&& !EQ (XCAR (prop), Qspace)
&& !EQ (XCAR (prop), Qwhen)
+ && !EQ (XCAR (prop), Qslice)
&& !EQ (XCAR (prop), Qspace_width)
&& !EQ (XCAR (prop), Qheight)
&& !EQ (XCAR (prop), Qraise)
@@ -3494,6 +3505,30 @@ handle_single_display_prop (it, prop, object, position,
it->space_width = value;
}
else if (CONSP (prop)
+ && EQ (XCAR (prop), Qslice))
+ {
+ /* `(slice X Y WIDTH HEIGHT)'. */
+ Lisp_Object tem;
+
+ if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+ return 0;
+
+ if (tem = XCDR (prop), CONSP (tem))
+ {
+ it->slice.x = XCAR (tem);
+ if (tem = XCDR (tem), CONSP (tem))
+ {
+ it->slice.y = XCAR (tem);
+ if (tem = XCDR (tem), CONSP (tem))
+ {
+ it->slice.width = XCAR (tem);
+ if (tem = XCDR (tem), CONSP (tem))
+ it->slice.height = XCAR (tem);
+ }
+ }
+ }
+ }
+ else if (CONSP (prop)
&& EQ (XCAR (prop), Qraise)
&& CONSP (XCDR (prop)))
{
@@ -4427,6 +4462,7 @@ push_it (it)
p->string_nchars = it->string_nchars;
p->area = it->area;
p->multibyte_p = it->multibyte_p;
+ p->slice = it->slice;
p->space_width = it->space_width;
p->font_height = it->font_height;
p->voffset = it->voffset;
@@ -4459,6 +4495,7 @@ pop_it (it)
it->string_nchars = p->string_nchars;
it->area = p->area;
it->multibyte_p = p->multibyte_p;
+ it->slice = p->slice;
it->space_width = p->space_width;
it->font_height = p->font_height;
it->voffset = p->voffset;
@@ -4616,6 +4653,14 @@ back_to_previous_visible_line_start (it)
visible_p = 0;
}
+ if (visible_p)
+ {
+ struct it it2 = *it;
+
+ if (handle_display_prop (&it2) == HANDLED_RETURN)
+ visible_p = 0;
+ }
+
/* Back one more newline if the current one is invisible. */
if (!visible_p)
back_to_previous_line_start (it);
@@ -9539,7 +9584,7 @@ update_overlay_arrows (up_to_date)
if (!SYMBOLP (var))
continue;
- if (up_to_date)
+ if (up_to_date > 0)
{
Lisp_Object val = find_symbol_value (var);
Fput (var, Qlast_arrow_position,
@@ -10862,15 +10907,14 @@ make_cursor_line_fully_visible (w, force_p)
if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
return 1;
- if (force_p)
- return 0;
-
/* If the row the cursor is in is taller than the window's height,
it's not clear what to do, so do nothing. */
window_height = window_box_height (w);
if (row->height >= window_height)
- return 1;
-
+ {
+ if (!force_p || w->vscroll)
+ return 1;
+ }
return 0;
#if 0
@@ -10979,6 +11023,12 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
else
this_scroll_margin = 0;
+ /* Force scroll_conservatively to have a reasonable value so it doesn't
+ cause an overflow while computing how much to scroll. */
+ if (scroll_conservatively)
+ scroll_conservatively = min (scroll_conservatively,
+ MOST_POSITIVE_FIXNUM / FRAME_LINE_HEIGHT (f));
+
/* Compute how much we should try to scroll maximally to bring point
into view. */
if (scroll_step || scroll_conservatively || temp_scroll_step)
@@ -11054,7 +11104,12 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
aggressive = current_buffer->scroll_up_aggressively;
height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
- amount_to_scroll = XFLOATINT (aggressive) * height;
+ {
+ double float_amount = XFLOATINT (aggressive) * height;
+ amount_to_scroll = float_amount;
+ if (amount_to_scroll == 0 && float_amount > 0)
+ amount_to_scroll = 1;
+ }
}
if (amount_to_scroll <= 0)
@@ -11112,7 +11167,12 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
aggressive = current_buffer->scroll_down_aggressively;
height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
- amount_to_scroll = XFLOATINT (aggressive) * height;
+ {
+ double float_amount = XFLOATINT (aggressive) * height;
+ amount_to_scroll = float_amount;
+ if (amount_to_scroll == 0 && float_amount > 0)
+ amount_to_scroll = 1;
+ }
}
if (amount_to_scroll <= 0)
@@ -11307,7 +11367,7 @@ try_cursor_movement (window, startp, scroll_step)
&& (FRAME_WINDOW_P (f)
|| !overlay_arrow_in_current_buffer_p ()))
{
- int this_scroll_margin;
+ int this_scroll_margin, top_scroll_margin;
struct glyph_row *row = NULL;
#if GLYPH_DEBUG
@@ -11320,6 +11380,10 @@ try_cursor_movement (window, startp, scroll_step)
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
this_scroll_margin *= FRAME_LINE_HEIGHT (f);
+ top_scroll_margin = this_scroll_margin;
+ if (WINDOW_WANTS_HEADER_LINE_P (w))
+ top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
+
/* Start with the row the cursor was displayed during the last
not paused redisplay. Give up if that row is not valid. */
if (w->last_cursor.vpos < 0
@@ -11380,7 +11444,7 @@ try_cursor_movement (window, startp, scroll_step)
&& (MATRIX_ROW_START_CHARPOS (row) > PT
|| (MATRIX_ROW_START_CHARPOS (row) == PT
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row)))
- && (row->y > this_scroll_margin
+ && (row->y > top_scroll_margin
|| CHARPOS (startp) == BEGV))
{
xassert (row->enabled_p);
@@ -11408,7 +11472,7 @@ try_cursor_movement (window, startp, scroll_step)
++row;
/* If within the scroll margin, scroll. */
- if (row->y < this_scroll_margin
+ if (row->y < top_scroll_margin
&& CHARPOS (startp) != BEGV)
scroll_p = 1;
}
@@ -12578,9 +12642,8 @@ try_window_reusing_current_matrix (w)
position. */
if (pt_row)
{
- w->cursor.vpos -= MATRIX_ROW_VPOS (first_reusable_row,
- w->current_matrix);
- w->cursor.y -= first_reusable_row->y;
+ w->cursor.vpos -= nrows_scrolled;
+ w->cursor.y -= first_reusable_row->y - start_row->y;
}
/* Scroll the display. */
@@ -12625,6 +12688,29 @@ try_window_reusing_current_matrix (w)
for (row -= nrows_scrolled; row < bottom_row; ++row)
row->enabled_p = 0;
+ /* Point may have moved to a different line, so we cannot assume that
+ the previous cursor position is valid; locate the correct row. */
+ if (pt_row)
+ {
+ for (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+ row < bottom_row && PT >= MATRIX_ROW_END_CHARPOS (row);
+ row++)
+ {
+ w->cursor.vpos++;
+ w->cursor.y = row->y;
+ }
+ if (row < bottom_row)
+ {
+ struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
+ while (glyph->charpos < PT)
+ {
+ w->cursor.hpos++;
+ w->cursor.x += glyph->pixel_width;
+ glyph++;
+ }
+ }
+ }
+
/* Adjust window end. A null value of last_text_row means that
the window end is in reused rows which in turn means that
only its vpos can have changed. */
@@ -13408,9 +13494,9 @@ try_window_id (w)
if ((w->cursor.y < this_scroll_margin
&& CHARPOS (start) > BEGV)
- /* Don't take scroll margin into account at the bottom because
- old redisplay didn't do it either. */
- || w->cursor.y + cursor_height > it.last_visible_y)
+ /* Old redisplay didn't take scroll margin into account at the bottom,
+ but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
+ || w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y)
{
w->cursor.vpos = -1;
clear_glyph_matrix (w->desired_matrix);
@@ -14196,8 +14282,7 @@ compute_line_metrics (it)
/* Append one space to the glyph row of iterator IT if doing a
- window-based redisplay. DEFAULT_FACE_P non-zero means let the
- space have the default face, otherwise let it have the same face as
+ window-based redisplay. The space has the same face as
IT->face_id. Value is non-zero if a space was added.
This function is called to make sure that there is always one glyph
@@ -14209,7 +14294,7 @@ compute_line_metrics (it)
end of the line if the row ends in italic text. */
static int
-append_space (it, default_face_p)
+append_space_for_newline (it, default_face_p)
struct it *it;
int default_face_p;
{
@@ -14223,7 +14308,7 @@ append_space (it, default_face_p)
/* Save some values that must not be changed.
Must save IT->c and IT->len because otherwise
ITERATOR_AT_END_P wouldn't work anymore after
- append_space has been called. */
+ append_space_for_newline has been called. */
enum display_element_type saved_what = it->what;
int saved_c = it->c, saved_len = it->len;
int saved_x = it->current_x;
@@ -14250,6 +14335,8 @@ append_space (it, default_face_p)
PRODUCE_GLYPHS (it);
+ it->override_ascent = -1;
+ it->constrain_row_ascent_descent_p = 0;
it->current_x = saved_x;
it->object = saved_object;
it->position = saved_pos;
@@ -14531,7 +14618,7 @@ display_line (it)
row->exact_window_width_line_p = 1;
else
#endif /* HAVE_WINDOW_SYSTEM */
- if ((append_space (it, 1) && row->used[TEXT_AREA] == 1)
+ if ((append_space_for_newline (it, 1) && row->used[TEXT_AREA] == 1)
|| row->used[TEXT_AREA] == 0)
{
row->glyphs[TEXT_AREA]->charpos = -1;
@@ -14773,7 +14860,7 @@ display_line (it)
/* Add a space at the end of the line that is used to
display the cursor there. */
if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
- append_space (it, 0);
+ append_space_for_newline (it, 0);
#endif /* HAVE_WINDOW_SYSTEM */
/* Extend the face to the end of the line. */
@@ -17400,6 +17487,7 @@ fill_image_glyph_string (s)
xassert (s->first_glyph->type == IMAGE_GLYPH);
s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
xassert (s->img);
+ s->slice = s->first_glyph->slice;
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
s->font = s->face->font;
s->width = s->first_glyph->pixel_width;
@@ -18146,6 +18234,7 @@ append_glyph (it)
glyph->glyph_not_available_p = it->glyph_not_available_p;
glyph->face_id = it->face_id;
glyph->u.ch = it->char_to_display;
+ glyph->slice = null_glyph_slice;
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
@@ -18182,6 +18271,7 @@ append_composite_glyph (it)
glyph->glyph_not_available_p = 0;
glyph->face_id = it->face_id;
glyph->u.cmp_id = it->cmp_id;
+ glyph->slice = null_glyph_slice;
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
@@ -18200,7 +18290,7 @@ take_vertical_position_into_account (it)
if (it->voffset < 0)
/* Increase the ascent so that we can display the text higher
in the line. */
- it->ascent += abs (it->voffset);
+ it->ascent -= it->voffset;
else
/* Increase the descent so that we can display the text lower
in the line. */
@@ -18220,6 +18310,7 @@ produce_image_glyph (it)
struct image *img;
struct face *face;
int face_ascent, glyph_ascent;
+ struct glyph_slice slice;
xassert (it->what == IT_IMAGE);
@@ -18243,19 +18334,68 @@ produce_image_glyph (it)
/* Make sure X resources of the image is loaded. */
prepare_image_for_display (it->f, img);
- it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face);
- it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent;
- it->pixel_width = img->width + 2 * img->hmargin;
+ slice.x = slice.y = 0;
+ slice.width = img->width;
+ slice.height = img->height;
+
+ if (INTEGERP (it->slice.x))
+ slice.x = XINT (it->slice.x);
+ else if (FLOATP (it->slice.x))
+ slice.x = XFLOAT_DATA (it->slice.x) * img->width;
+
+ if (INTEGERP (it->slice.y))
+ slice.y = XINT (it->slice.y);
+ else if (FLOATP (it->slice.y))
+ slice.y = XFLOAT_DATA (it->slice.y) * img->height;
+
+ if (INTEGERP (it->slice.width))
+ slice.width = XINT (it->slice.width);
+ else if (FLOATP (it->slice.width))
+ slice.width = XFLOAT_DATA (it->slice.width) * img->width;
+
+ if (INTEGERP (it->slice.height))
+ slice.height = XINT (it->slice.height);
+ else if (FLOATP (it->slice.height))
+ slice.height = XFLOAT_DATA (it->slice.height) * img->height;
+
+ if (slice.x >= img->width)
+ slice.x = img->width;
+ if (slice.y >= img->height)
+ slice.y = img->height;
+ if (slice.x + slice.width >= img->width)
+ slice.width = img->width - slice.x;
+ if (slice.y + slice.height > img->height)
+ slice.height = img->height - slice.y;
+
+ if (slice.width == 0 || slice.height == 0)
+ return;
+
+ it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face, &slice);
+
+ it->descent = slice.height - glyph_ascent;
+ if (slice.y == 0)
+ it->descent += img->vmargin;
+ if (slice.y + slice.height == img->height)
+ it->descent += img->vmargin;
+ it->phys_descent = it->descent;
+
+ it->pixel_width = slice.width;
+ if (slice.x == 0)
+ it->pixel_width += img->hmargin;
+ if (slice.x + slice.width == img->width)
+ it->pixel_width += img->hmargin;
/* It's quite possible for images to have an ascent greater than
their height, so don't get confused in that case. */
if (it->descent < 0)
it->descent = 0;
+#if 0 /* this breaks image tiling */
/* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
if (face_ascent > it->ascent)
it->ascent = it->phys_ascent = face_ascent;
+#endif
it->nglyphs = 1;
@@ -18263,13 +18403,15 @@ produce_image_glyph (it)
{
if (face->box_line_width > 0)
{
- it->ascent += face->box_line_width;
- it->descent += face->box_line_width;
+ if (slice.y == 0)
+ it->ascent += face->box_line_width;
+ if (slice.y + slice.height == img->height)
+ it->descent += face->box_line_width;
}
- if (it->start_of_box_run_p)
+ if (it->start_of_box_run_p && slice.x == 0)
it->pixel_width += abs (face->box_line_width);
- if (it->end_of_box_run_p)
+ if (it->end_of_box_run_p && slice.x + slice.width == img->width)
it->pixel_width += abs (face->box_line_width);
}
@@ -18298,6 +18440,7 @@ produce_image_glyph (it)
glyph->glyph_not_available_p = 0;
glyph->face_id = it->face_id;
glyph->u.img_id = img->id;
+ glyph->slice = slice;
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
@@ -18340,6 +18483,7 @@ append_stretch_glyph (it, object, width, height, ascent)
glyph->face_id = it->face_id;
glyph->u.stretch.ascent = ascent;
glyph->u.stretch.height = height;
+ glyph->slice = null_glyph_slice;
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
@@ -18505,6 +18649,107 @@ produce_stretch_glyph (it)
take_vertical_position_into_account (it);
}
+/* Calculate line-height and line-spacing properties.
+ An integer value specifies explicit pixel value.
+ A float value specifies relative value to current face height.
+ A cons (float . face-name) specifies relative value to
+ height of specified face font.
+
+ Returns height in pixels, or nil. */
+
+static Lisp_Object
+calc_line_height_property (it, prop, font, boff, total)
+ struct it *it;
+ Lisp_Object prop;
+ XFontStruct *font;
+ int boff, *total;
+{
+ Lisp_Object position, val;
+ Lisp_Object face_name = Qnil;
+ int ascent, descent, height, override;
+
+ if (STRINGP (it->object))
+ position = make_number (IT_STRING_CHARPOS (*it));
+ else
+ position = make_number (IT_CHARPOS (*it));
+
+ val = Fget_char_property (position, prop, it->object);
+
+ if (NILP (val))
+ return val;
+
+ if (total && CONSP (val) && EQ (XCAR (val), Qtotal))
+ {
+ *total = 1;
+ val = XCDR (val);
+ }
+
+ if (INTEGERP (val))
+ return val;
+
+ if (CONSP (val))
+ {
+ face_name = XCDR (val);
+ val = XCAR (val);
+ }
+ else if (SYMBOLP (val))
+ {
+ face_name = val;
+ val = Qnil;
+ }
+
+ override = EQ (prop, Qline_height);
+
+ if (NILP (face_name))
+ {
+ font = FRAME_FONT (it->f);
+ boff = FRAME_BASELINE_OFFSET (it->f);
+ }
+ else if (EQ (face_name, Qt))
+ {
+ override = 0;
+ }
+ else
+ {
+ int face_id;
+ struct face *face;
+ struct font_info *font_info;
+
+ face_id = lookup_named_face (it->f, face_name);
+ if (face_id < 0)
+ return make_number (-1);
+
+ face = FACE_FROM_ID (it->f, face_id);
+ font = face->font;
+ if (font == NULL)
+ return make_number (-1);
+
+ font_info = FONT_INFO_FROM_ID (it->f, face->font_info_id);
+ boff = font_info->baseline_offset;
+ if (font_info->vertical_centering)
+ boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
+ }
+
+ ascent = FONT_BASE (font) + boff;
+ descent = FONT_DESCENT (font) - boff;
+
+ if (override)
+ {
+ it->override_ascent = ascent;
+ it->override_descent = descent;
+ it->override_boff = boff;
+ }
+
+ height = ascent + descent;
+ if (FLOATP (val))
+ height = (int)(XFLOAT_DATA (val) * height);
+ else if (INTEGERP (val))
+ height *= XINT (val);
+
+ return make_number (height);
+}
+
+
/* RIF:
Produce glyphs/get display metrics for the display element IT is
loaded with. See the description of struct display_iterator in
@@ -18514,6 +18759,8 @@ void
x_produce_glyphs (it)
struct it *it;
{
+ int extra_line_spacing = it->extra_line_spacing;
+
it->glyph_not_available_p = 0;
if (it->what == IT_CHARACTER)
@@ -18585,8 +18832,18 @@ x_produce_glyphs (it)
pcm = rif->per_char_metric (font, &char2b,
FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
- it->ascent = FONT_BASE (font) + boff;
- it->descent = FONT_DESCENT (font) - boff;
+
+ if (it->override_ascent >= 0)
+ {
+ it->ascent = it->override_ascent;
+ it->descent = it->override_descent;
+ boff = it->override_boff;
+ }
+ else
+ {
+ it->ascent = FONT_BASE (font) + boff;
+ it->descent = FONT_DESCENT (font) - boff;
+ }
if (pcm)
{
@@ -18597,11 +18854,28 @@ x_produce_glyphs (it)
else
{
it->glyph_not_available_p = 1;
- it->phys_ascent = FONT_BASE (font) + boff;
- it->phys_descent = FONT_DESCENT (font) - boff;
+ it->phys_ascent = it->ascent;
+ it->phys_descent = it->descent;
it->pixel_width = FONT_WIDTH (font);
}
+ if (it->constrain_row_ascent_descent_p)
+ {
+ if (it->descent > it->max_descent)
+ {
+ it->ascent += it->descent - it->max_descent;
+ it->descent = it->max_descent;
+ }
+ if (it->ascent > it->max_ascent)
+ {
+ it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent);
+ it->ascent = it->max_ascent;
+ }
+ it->phys_ascent = min (it->phys_ascent, it->ascent);
+ it->phys_descent = min (it->phys_descent, it->descent);
+ extra_line_spacing = 0;
+ }
+
/* If this is a space inside a region of text with
`space-width' property, change its width. */
stretched_p = it->char_to_display == ' ' && !NILP (it->space_width);
@@ -18634,6 +18908,14 @@ x_produce_glyphs (it)
if (face->overline_p)
it->ascent += 2;
+ if (it->constrain_row_ascent_descent_p)
+ {
+ if (it->ascent > it->max_ascent)
+ it->ascent = it->max_ascent;
+ if (it->descent > it->max_descent)
+ it->descent = it->max_descent;
+ }
+
take_vertical_position_into_account (it);
/* If we have to actually produce glyphs, do it. */
@@ -18660,17 +18942,73 @@ x_produce_glyphs (it)
}
else if (it->char_to_display == '\n')
{
- /* A newline has no width but we need the height of the line. */
+ /* A newline has no width but we need the height of the line.
+ But if previous part of the line set a height, don't
+ increase that height */
+
+ Lisp_Object height;
+
+ it->override_ascent = -1;
it->pixel_width = 0;
it->nglyphs = 0;
- it->ascent = it->phys_ascent = FONT_BASE (font) + boff;
- it->descent = it->phys_descent = FONT_DESCENT (font) - boff;
- if (face->box != FACE_NO_BOX
- && face->box_line_width > 0)
+ height = calc_line_height_property(it, Qline_height, font, boff, 0);
+
+ if (it->override_ascent >= 0)
{
- it->ascent += face->box_line_width;
- it->descent += face->box_line_width;
+ it->ascent = it->override_ascent;
+ it->descent = it->override_descent;
+ boff = it->override_boff;
+ }
+ else
+ {
+ it->ascent = FONT_BASE (font) + boff;
+ it->descent = FONT_DESCENT (font) - boff;
+ }
+
+ if (EQ (height, make_number(0)))
+ {
+ if (it->descent > it->max_descent)
+ {
+ it->ascent += it->descent - it->max_descent;
+ it->descent = it->max_descent;
+ }
+ if (it->ascent > it->max_ascent)
+ {
+ it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent);
+ it->ascent = it->max_ascent;
+ }
+ it->phys_ascent = min (it->phys_ascent, it->ascent);
+ it->phys_descent = min (it->phys_descent, it->descent);
+ it->constrain_row_ascent_descent_p = 1;
+ extra_line_spacing = 0;
+ }
+ else
+ {
+ Lisp_Object spacing;
+ int total = 0;
+
+ it->phys_ascent = it->ascent;
+ it->phys_descent = it->descent;
+
+ if ((it->max_ascent > 0 || it->max_descent > 0)
+ && face->box != FACE_NO_BOX
+ && face->box_line_width > 0)
+ {
+ it->ascent += face->box_line_width;
+ it->descent += face->box_line_width;
+ }
+ if (!NILP (height)
+ && XINT (height) > it->ascent + it->descent)
+ it->ascent = XINT (height) - it->descent;
+
+ spacing = calc_line_height_property(it, Qline_spacing, font, boff, &total);
+ if (INTEGERP (spacing))
+ {
+ extra_line_spacing = XINT (spacing);
+ if (total)
+ extra_line_spacing -= (it->phys_ascent + it->phys_descent);
+ }
}
}
else if (it->char_to_display == '\t')
@@ -19093,7 +19431,8 @@ x_produce_glyphs (it)
if (it->area == TEXT_AREA)
it->current_x += it->pixel_width;
- it->descent += it->extra_line_spacing;
+ if (extra_line_spacing > 0)
+ it->descent += extra_line_spacing;
it->max_ascent = max (it->max_ascent, it->ascent);
it->max_descent = max (it->max_descent, it->descent);
@@ -20390,8 +20729,8 @@ on_hot_spot_p (hot_spot, x, y)
return inside;
}
}
- else
- return 0;
+ /* If we don't understand the format, pretend we're not in the hot-spot. */
+ return 0;
}
Lisp_Object
@@ -20426,7 +20765,6 @@ Returns the alist element for the first matching AREA in MAP. */)
Lisp_Object map;
Lisp_Object x, y;
{
- int ix, iy;
if (NILP (map))
return Qnil;
@@ -20466,11 +20804,7 @@ define_frame_cursor1 (f, cursor, pointer)
cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
}
-#ifndef HAVE_CARBON
if (cursor != No_Cursor)
-#else
- if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
-#endif
rif->define_frame_cursor (f, cursor);
}
@@ -20492,7 +20826,7 @@ note_mode_line_or_margin_highlight (w, x, y, area)
Lisp_Object pointer = Qnil;
int charpos, dx, dy, width, height;
Lisp_Object string, object = Qnil;
- Lisp_Object pos, help, image;
+ Lisp_Object pos, help;
if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
string = mode_line_string (w, area, &x, &y, &charpos,
@@ -20671,7 +21005,7 @@ note_mouse_highlight (f, x, y)
Lisp_Object object;
Lisp_Object mouse_face = Qnil, overlay = Qnil, position;
Lisp_Object *overlay_vec = NULL;
- int len, noverlays;
+ int noverlays;
struct buffer *obuf;
int obegv, ozv, same_region;
@@ -20687,7 +21021,9 @@ note_mouse_highlight (f, x, y)
Lisp_Object image_map, hotspot;
if ((image_map = Fplist_get (XCDR (img->spec), QCmap),
!NILP (image_map))
- && (hotspot = find_hot_spot (image_map, dx, dy),
+ && (hotspot = find_hot_spot (image_map,
+ glyph->slice.x + dx,
+ glyph->slice.y + dy),
CONSP (hotspot))
&& (hotspot = XCDR (hotspot), CONSP (hotspot)))
{
@@ -20756,19 +21092,8 @@ note_mouse_highlight (f, x, y)
if (BUFFERP (object))
{
- /* Put all the overlays we want in a vector in overlay_vec.
- Store the length in len. If there are more than 10, make
- enough space for all, and try again. */
- len = 10;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
- if (noverlays > len)
- {
- len = noverlays;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL,0);
- }
-
+ /* Put all the overlays we want in a vector in overlay_vec. */
+ GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
/* Sort overlays into increasing priority order. */
noverlays = sort_overlays (overlay_vec, noverlays, w);
}
@@ -21724,6 +22049,8 @@ syms_of_xdisp ()
staticpro (&Qspace_width);
Qraise = intern ("raise");
staticpro (&Qraise);
+ Qslice = intern ("slice");
+ staticpro (&Qslice);
Qspace = intern ("space");
staticpro (&Qspace);
Qmargin = intern ("margin");
@@ -21736,6 +22063,10 @@ syms_of_xdisp ()
staticpro (&Qright_margin);
Qcenter = intern ("center");
staticpro (&Qcenter);
+ Qline_height = intern ("line-height");
+ staticpro (&Qline_height);
+ Qtotal = intern ("total");
+ staticpro (&Qtotal);
QCalign_to = intern (":align-to");
staticpro (&QCalign_to);
QCrelative_width = intern (":relative-width");
@@ -22096,11 +22427,6 @@ Note that the lower bound for automatic hscrolling specified by `scroll-left'
and `scroll-right' overrides this variable's effect. */);
Vhscroll_step = make_number (0);
- DEFVAR_LISP ("image-types", &Vimage_types,
- doc: /* List of supported image types.
-Each element of the list is a symbol for a supported image type. */);
- Vimage_types = Qnil;
-
DEFVAR_BOOL ("message-truncate-lines", &message_truncate_lines,
doc: /* If non-nil, messages are truncated instead of resizing the echo area.
Bind this around calls to `message' to let it take effect. */);
diff --git a/src/xfaces.c b/src/xfaces.c
index f44b216877f..d2da290ed56 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -464,6 +464,7 @@ int menu_face_changed_default;
struct font_name;
struct table_entry;
+struct named_merge_point;
static void map_tty_color P_ ((struct frame *, struct face *,
enum lface_attribute_index, int *));
@@ -519,11 +520,10 @@ static int face_numeric_weight P_ ((Lisp_Object));
static int face_numeric_slant P_ ((Lisp_Object));
static int face_numeric_swidth P_ ((Lisp_Object));
static int face_fontset P_ ((Lisp_Object *));
-static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*, Lisp_Object));
-static void merge_face_inheritance P_ ((struct frame *f, Lisp_Object,
- Lisp_Object *, Lisp_Object));
-static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object *,
- Lisp_Object));
+static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*,
+ struct named_merge_point *));
+static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *,
+ int, struct named_merge_point *));
static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object,
Lisp_Object, int, int));
static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int));
@@ -3214,6 +3214,49 @@ check_lface (lface)
#endif /* GLYPH_DEBUG == 0 */
+
+/* Face-merge cycle checking. */
+
+/* A `named merge point' is simply a point during face-merging where we
+ look up a face by name. We keep a stack of which named lookups we're
+ currently processing so that we can easily detect cycles, using a
+ linked- list of struct named_merge_point structures, typically
+ allocated on the stack frame of the named lookup functions which are
+ active (so no consing is required). */
+struct named_merge_point
+{
+ Lisp_Object face_name;
+ struct named_merge_point *prev;
+};
+
+
+/* If a face merging cycle is detected for FACE_NAME, return 0,
+ otherwise add NEW_NAMED_MERGE_POINT, which is initialized using
+ FACE_NAME, as the head of the linked list pointed to by
+ NAMED_MERGE_POINTS, and return 1. */
+
+static INLINE int
+push_named_merge_point (struct named_merge_point *new_named_merge_point,
+ Lisp_Object face_name,
+ struct named_merge_point **named_merge_points)
+{
+ struct named_merge_point *prev;
+
+ for (prev = *named_merge_points; prev; prev = prev->prev)
+ if (EQ (face_name, prev->face_name))
+ return 0;
+
+ new_named_merge_point->face_name = face_name;
+ new_named_merge_point->prev = *named_merge_points;
+
+ *named_merge_points = new_named_merge_point;
+
+ return 1;
+}
+
+
+
+
/* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it
to make it a symvol. If FACE_NAME is an alias for another face,
return that face's name. */
@@ -3480,6 +3523,8 @@ merge_face_heights (from, to, invalid, gcpro)
else if (FLOATP (to))
/* relative X relative => relative */
result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to));
+ else if (UNSPECIFIEDP (to))
+ result = from;
}
else if (FUNCTIONP (from))
/* FROM is a function, which use to adjust TO. */
@@ -3511,14 +3556,15 @@ merge_face_heights (from, to, invalid, gcpro)
completely specified and contain only absolute attributes. Every
specified attribute of FROM overrides the corresponding attribute of
TO; relative attributes in FROM are merged with the absolute value in
- TO and replace it. CYCLE_CHECK is used internally to detect loops in
- face inheritance; it should be Qnil when called from other places. */
+ TO and replace it. NAMED_MERGE_POINTS is used internally to detect
+ loops in face inheritance; it should be 0 when called from other
+ places. */
static INLINE void
-merge_face_vectors (f, from, to, cycle_check)
+merge_face_vectors (f, from, to, named_merge_points)
struct frame *f;
Lisp_Object *from, *to;
- Lisp_Object cycle_check;
+ struct named_merge_point *named_merge_points;
{
int i;
@@ -3529,7 +3575,7 @@ merge_face_vectors (f, from, to, cycle_check)
other code uses `unspecified' as a generic value for face attributes. */
if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])
&& !NILP (from[LFACE_INHERIT_INDEX]))
- merge_face_inheritance (f, from[LFACE_INHERIT_INDEX], to, cycle_check);
+ merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points);
/* If TO specifies a :font attribute, and FROM specifies some
font-related attribute, we need to clear TO's :font attribute
@@ -3548,7 +3594,8 @@ merge_face_vectors (f, from, to, cycle_check)
if (!UNSPECIFIEDP (from[i]))
{
if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i]))
- to[i] = merge_face_heights (from[i], to[i], to[i], cycle_check);
+ to[i] = merge_face_heights (from[i], to[i], to[i],
+ named_merge_points);
else
to[i] = from[i];
}
@@ -3558,87 +3605,45 @@ merge_face_vectors (f, from, to, cycle_check)
to[LFACE_INHERIT_INDEX] = Qnil;
}
+/* Merge the named face FACE_NAME on frame F, into the vector of face
+ attributes TO. NAMED_MERGE_POINTS is used to detect loops in face
+ inheritance. Returns true if FACE_NAME is a valid face name and
+ merging succeeded. */
-/* Checks the `cycle check' variable CHECK to see if it indicates that
- EL is part of a cycle; CHECK must be either Qnil or a value returned
- by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of
- elements after which a cycle might be suspected; after that many
- elements, this macro begins consing in order to keep more precise
- track of elements.
-
- Returns nil if a cycle was detected, otherwise a new value for CHECK
- that includes EL.
-
- CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so
- the caller should make sure that's ok. */
-
-#define CYCLE_CHECK(check, el, suspicious) \
- (NILP (check) \
- ? make_number (0) \
- : (INTEGERP (check) \
- ? (XFASTINT (check) < (suspicious) \
- ? make_number (XFASTINT (check) + 1) \
- : Fcons (el, Qnil)) \
- : (!NILP (Fmemq ((el), (check))) \
- ? Qnil \
- : Fcons ((el), (check)))))
-
-
-/* Merge face attributes from the face on frame F whose name is
- INHERITS, into the vector of face attributes TO; INHERITS may also be
- a list of face names, in which case they are applied in order.
- CYCLE_CHECK is used to detect loops in face inheritance.
- Returns true if any of the inherited attributes are `font-related'. */
-
-static void
-merge_face_inheritance (f, inherit, to, cycle_check)
+static int
+merge_named_face (f, face_name, to, named_merge_points)
struct frame *f;
- Lisp_Object inherit;
+ Lisp_Object face_name;
Lisp_Object *to;
- Lisp_Object cycle_check;
+ struct named_merge_point *named_merge_points;
{
- if (SYMBOLP (inherit) && !EQ (inherit, Qunspecified))
- /* Inherit from the named face INHERIT. */
- {
- Lisp_Object lface;
-
- /* Make sure we're not in an inheritance loop. */
- cycle_check = CYCLE_CHECK (cycle_check, inherit, 15);
- if (NILP (cycle_check))
- /* Cycle detected, ignore any further inheritance. */
- return;
+ struct named_merge_point named_merge_point;
- lface = lface_from_face_name (f, inherit, 0);
- if (!NILP (lface))
- merge_face_vectors (f, XVECTOR (lface)->contents, to, cycle_check);
- }
- else if (CONSP (inherit))
- /* Handle a list of inherited faces by calling ourselves recursively
- on each element. Note that we only do so for symbol elements, so
- it's not possible to infinitely recurse. */
+ if (push_named_merge_point (&named_merge_point,
+ face_name, &named_merge_points))
{
- while (CONSP (inherit))
- {
- if (SYMBOLP (XCAR (inherit)))
- merge_face_inheritance (f, XCAR (inherit), to, cycle_check);
+ Lisp_Object from[LFACE_VECTOR_SIZE];
+ int ok = get_lface_attributes (f, face_name, from, 0);
- /* Check for a circular inheritance list. */
- cycle_check = CYCLE_CHECK (cycle_check, inherit, 15);
- if (NILP (cycle_check))
- /* Cycle detected. */
- break;
+ if (ok)
+ merge_face_vectors (f, from, to, named_merge_points);
- inherit = XCDR (inherit);
- }
+ return ok;
}
+ else
+ return 0;
}
-/* Given a Lisp face attribute vector TO and a Lisp object PROP that
- is a face property, determine the resulting face attributes on
- frame F, and store them in TO. PROP may be a single face
- specification or a list of such specifications. Each face
- specification can be
+/* Merge face attributes from the lisp `face reference' FACE_REF on
+ frame F into the face attribute vector TO. If ERR_MSGS is non-zero,
+ problems with FACE_REF cause an error message to be shown. Return
+ non-zero if no errors occurred (regardless of the value of ERR_MSGS).
+ NAMED_MERGE_POINTS is used to detect loops in face inheritance or
+ list structure; it may be 0 for most callers.
+
+ FACE_REF may be a single face specification or a list of such
+ specifications. Each face specification can be:
1. A symbol or string naming a Lisp face.
@@ -3653,22 +3658,26 @@ merge_face_inheritance (f, inherit, to, cycle_check)
Face specifications earlier in lists take precedence over later
specifications. */
-static void
-merge_face_vector_with_property (f, to, prop)
+static int
+merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
struct frame *f;
+ Lisp_Object face_ref;
Lisp_Object *to;
- Lisp_Object prop;
+ int err_msgs;
+ struct named_merge_point *named_merge_points;
{
- if (CONSP (prop))
+ int ok = 1; /* Succeed without an error? */
+
+ if (CONSP (face_ref))
{
- Lisp_Object first = XCAR (prop);
+ Lisp_Object first = XCAR (face_ref);
if (EQ (first, Qforeground_color)
|| EQ (first, Qbackground_color))
{
/* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR
. COLOR). COLOR must be a string. */
- Lisp_Object color_name = XCDR (prop);
+ Lisp_Object color_name = XCDR (face_ref);
Lisp_Object color = first;
if (STRINGP (color_name))
@@ -3679,23 +3688,28 @@ merge_face_vector_with_property (f, to, prop)
to[LFACE_BACKGROUND_INDEX] = color_name;
}
else
- add_to_log ("Invalid face color", color_name, Qnil);
+ {
+ if (err_msgs)
+ add_to_log ("Invalid face color", color_name, Qnil);
+ ok = 0;
+ }
}
else if (SYMBOLP (first)
&& *SDATA (SYMBOL_NAME (first)) == ':')
{
/* Assume this is the property list form. */
- while (CONSP (prop) && CONSP (XCDR (prop)))
+ while (CONSP (face_ref) && CONSP (XCDR (face_ref)))
{
- Lisp_Object keyword = XCAR (prop);
- Lisp_Object value = XCAR (XCDR (prop));
+ Lisp_Object keyword = XCAR (face_ref);
+ Lisp_Object value = XCAR (XCDR (face_ref));
+ int err = 0;
if (EQ (keyword, QCfamily))
{
if (STRINGP (value))
to[LFACE_FAMILY_INDEX] = value;
else
- add_to_log ("Invalid face font family", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCheight))
{
@@ -3703,10 +3717,10 @@ merge_face_vector_with_property (f, to, prop)
merge_face_heights (value, to[LFACE_HEIGHT_INDEX],
Qnil, Qnil);
- if (NILP (new_height))
- add_to_log ("Invalid face font height", value, Qnil);
- else
+ if (! NILP (new_height))
to[LFACE_HEIGHT_INDEX] = new_height;
+ else
+ err = 1;
}
else if (EQ (keyword, QCweight))
{
@@ -3714,7 +3728,7 @@ merge_face_vector_with_property (f, to, prop)
&& face_numeric_weight (value) >= 0)
to[LFACE_WEIGHT_INDEX] = value;
else
- add_to_log ("Invalid face weight", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCslant))
{
@@ -3722,7 +3736,7 @@ merge_face_vector_with_property (f, to, prop)
&& face_numeric_slant (value) >= 0)
to[LFACE_SLANT_INDEX] = value;
else
- add_to_log ("Invalid face slant", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCunderline))
{
@@ -3731,7 +3745,7 @@ merge_face_vector_with_property (f, to, prop)
|| STRINGP (value))
to[LFACE_UNDERLINE_INDEX] = value;
else
- add_to_log ("Invalid face underline", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCoverline))
{
@@ -3740,7 +3754,7 @@ merge_face_vector_with_property (f, to, prop)
|| STRINGP (value))
to[LFACE_OVERLINE_INDEX] = value;
else
- add_to_log ("Invalid face overline", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCstrike_through))
{
@@ -3749,7 +3763,7 @@ merge_face_vector_with_property (f, to, prop)
|| STRINGP (value))
to[LFACE_STRIKE_THROUGH_INDEX] = value;
else
- add_to_log ("Invalid face strike-through", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCbox))
{
@@ -3761,7 +3775,7 @@ merge_face_vector_with_property (f, to, prop)
|| NILP (value))
to[LFACE_BOX_INDEX] = value;
else
- add_to_log ("Invalid face box", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCinverse_video)
|| EQ (keyword, QCreverse_video))
@@ -3769,21 +3783,21 @@ merge_face_vector_with_property (f, to, prop)
if (EQ (value, Qt) || NILP (value))
to[LFACE_INVERSE_INDEX] = value;
else
- add_to_log ("Invalid face inverse-video", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCforeground))
{
if (STRINGP (value))
to[LFACE_FOREGROUND_INDEX] = value;
else
- add_to_log ("Invalid face foreground", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCbackground))
{
if (STRINGP (value))
to[LFACE_BACKGROUND_INDEX] = value;
else
- add_to_log ("Invalid face background", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCstipple))
{
@@ -3792,7 +3806,7 @@ merge_face_vector_with_property (f, to, prop)
if (!NILP (pixmap_p))
to[LFACE_STIPPLE_INDEX] = value;
else
- add_to_log ("Invalid face stipple", value, Qnil);
+ err = 1;
#endif
}
else if (EQ (keyword, QCwidth))
@@ -3801,52 +3815,51 @@ merge_face_vector_with_property (f, to, prop)
&& face_numeric_swidth (value) >= 0)
to[LFACE_SWIDTH_INDEX] = value;
else
- add_to_log ("Invalid face width", value, Qnil);
+ err = 1;
}
else if (EQ (keyword, QCinherit))
{
- if (SYMBOLP (value))
- to[LFACE_INHERIT_INDEX] = value;
- else
- {
- Lisp_Object tail;
- for (tail = value; CONSP (tail); tail = XCDR (tail))
- if (!SYMBOLP (XCAR (tail)))
- break;
- if (NILP (tail))
- to[LFACE_INHERIT_INDEX] = value;
- else
- add_to_log ("Invalid face inherit", value, Qnil);
- }
+ /* This is not really very useful; it's just like a
+ normal face reference. */
+ if (! merge_face_ref (f, value, to,
+ err_msgs, named_merge_points))
+ err = 1;
}
else
- add_to_log ("Invalid attribute %s in face property",
- keyword, Qnil);
+ err = 1;
- prop = XCDR (XCDR (prop));
+ if (err)
+ {
+ add_to_log ("Invalid face attribute %S %S", keyword, value);
+ ok = 0;
+ }
+
+ face_ref = XCDR (XCDR (face_ref));
}
}
else
{
- /* This is a list of face specs. Specifications at the
- beginning of the list take precedence over later
- specifications, so we have to merge starting with the
- last specification. */
- Lisp_Object next = XCDR (prop);
- if (!NILP (next))
- merge_face_vector_with_property (f, to, next);
- merge_face_vector_with_property (f, to, first);
+ /* This is a list of face refs. Those at the beginning of the
+ list take precedence over what follows, so we have to merge
+ from the end backwards. */
+ Lisp_Object next = XCDR (face_ref);
+
+ if (! NILP (next))
+ ok = merge_face_ref (f, next, to, err_msgs, named_merge_points);
+
+ if (! merge_face_ref (f, first, to, err_msgs, named_merge_points))
+ ok = 0;
}
}
else
{
- /* PROP ought to be a face name. */
- Lisp_Object lface = lface_from_face_name (f, prop, 0);
- if (NILP (lface))
- add_to_log ("Invalid face text property value: %s", prop, Qnil);
- else
- merge_face_vectors (f, XVECTOR (lface)->contents, to, Qnil);
+ /* FACE_REF ought to be a face name. */
+ ok = merge_named_face (f, face_ref, to, named_merge_points);
+ if (!ok && err_msgs)
+ add_to_log ("Invalid face reference: %s", face_ref, Qnil);
}
+
+ return ok;
}
@@ -3962,12 +3975,13 @@ Otherwise check for the existence of a global face. */)
DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face,
Sinternal_copy_lisp_face, 4, 4, 0,
doc: /* Copy face FROM to TO.
-If FRAME it t, copy the global face definition of FROM to the
-global face definition of TO. Otherwise, copy the frame-local
-definition of FROM on FRAME to the frame-local definition of TO
-on NEW-FRAME, or FRAME if NEW-FRAME is nil.
+If FRAME is t, copy the global face definition of FROM.
+Otherwise, copy the frame-local definition of FROM on FRAME.
+If NEW-FRAME is a frame, copy that data into the frame-local
+definition of TO on NEW-FRAME. If NEW-FRAME is nil.
+FRAME controls where the data is copied to.
-Value is TO. */)
+The value is TO. */)
(from, to, frame, new_frame)
Lisp_Object from, to, frame, new_frame;
{
@@ -3975,8 +3989,6 @@ Value is TO. */)
CHECK_SYMBOL (from);
CHECK_SYMBOL (to);
- if (NILP (new_frame))
- new_frame = frame;
if (EQ (frame, Qt))
{
@@ -3988,6 +4000,8 @@ Value is TO. */)
else
{
/* Copy frame-local definition of FROM. */
+ if (NILP (new_frame))
+ new_frame = frame;
CHECK_LIVE_FRAME (frame);
CHECK_LIVE_FRAME (new_frame);
lface = lface_from_face_name (XFRAME (frame), from, 1);
@@ -4797,8 +4811,8 @@ DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute,
doc: /* Return face attribute KEYWORD of face SYMBOL.
If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid
face attribute name, signal an error.
-If the optional argument FRAME is given, report on face FACE in that
-frame. If FRAME is t, report on the defaults for face FACE (for new
+If the optional argument FRAME is given, report on face SYMBOL in that
+frame. If FRAME is t, report on the defaults for face SYMBOL (for new
frames). If FRAME is omitted or nil, use the selected frame. */)
(symbol, keyword, frame)
Lisp_Object symbol, keyword, frame;
@@ -4995,49 +5009,52 @@ return the font name used for CHARACTER. */)
}
-/* Compare face vectors V1 and V2 for equality. Value is non-zero if
+/* Compare face-attribute values v1 and v2 for equality. Value is non-zero if
all attributes are `equal'. Tries to be fast because this function
is called quite often. */
static INLINE int
-lface_equal_p (v1, v2)
- Lisp_Object *v1, *v2;
+face_attr_equal_p (v1, v2)
+ Lisp_Object v1, v2;
{
- int i, equal_p = 1;
+ /* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
+ and the other is specified. */
+ if (XTYPE (v1) != XTYPE (v2))
+ return 0;
- for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i)
- {
- Lisp_Object a = v1[i];
- Lisp_Object b = v2[i];
+ if (EQ (v1, v2))
+ return 1;
- /* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
- and the other is specified. */
- equal_p = XTYPE (a) == XTYPE (b);
- if (!equal_p)
- break;
+ switch (XTYPE (v1))
+ {
+ case Lisp_String:
+ if (SBYTES (v1) != SBYTES (v2))
+ return 0;
- if (!EQ (a, b))
- {
- switch (XTYPE (a))
- {
- case Lisp_String:
- equal_p = ((SBYTES (a)
- == SBYTES (b))
- && bcmp (SDATA (a), SDATA (b),
- SBYTES (a)) == 0);
- break;
+ return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
- case Lisp_Int:
- case Lisp_Symbol:
- equal_p = 0;
- break;
+ case Lisp_Int:
+ case Lisp_Symbol:
+ return 0;
- default:
- equal_p = !NILP (Fequal (a, b));
- break;
- }
- }
+ default:
+ return !NILP (Fequal (v1, v2));
}
+}
+
+
+/* Compare face vectors V1 and V2 for equality. Value is non-zero if
+ all attributes are `equal'. Tries to be fast because this function
+ is called quite often. */
+
+static INLINE int
+lface_equal_p (v1, v2)
+ Lisp_Object *v1, *v2;
+{
+ int i, equal_p = 1;
+
+ for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i)
+ equal_p = face_attr_equal_p (v1[i], v2[i]);
return equal_p;
}
@@ -5333,192 +5350,6 @@ If FRAME is unspecified or nil, the current frame is used. */)
/***********************************************************************
- Face capability testing for ttys
- ***********************************************************************/
-
-
-/* If the distance (as returned by color_distance) between two colors is
- less than this, then they are considered the same, for determining
- whether a color is supported or not. The range of values is 0-65535. */
-
-#define TTY_SAME_COLOR_THRESHOLD 10000
-
-
-DEFUN ("tty-supports-face-attributes-p",
- Ftty_supports_face_attributes_p, Stty_supports_face_attributes_p,
- 1, 2, 0,
- doc: /* Return non-nil if all the face attributes in ATTRIBUTES are supported.
-The optional argument FRAME is the frame on which to test; if it is nil
-or unspecified, then the current frame is used. If FRAME is not a tty
-frame, then nil is returned.
-
-The definition of `supported' is somewhat heuristic, but basically means
-that a face containing all the attributes in ATTRIBUTES, when merged
-with the default face for display, can be represented in a way that's
-
- \(1) different in appearance than the default face, and
- \(2) `close in spirit' to what the attributes specify, if not exact.
-
-Point (2) implies that a `:weight black' attribute will be satisified
-by any terminal that can display bold, and a `:foreground "yellow"' as
-long as the terminal can display a yellowish color, but `:slant italic'
-will _not_ be satisified by the tty display code's automatic
-substitution of a `dim' face for italic. */)
- (attributes, frame)
- Lisp_Object attributes, frame;
-{
- int weight, i;
- struct frame *f;
- Lisp_Object val, fg, bg;
- XColor fg_tty_color, fg_std_color;
- XColor bg_tty_color, bg_std_color;
- Lisp_Object attrs[LFACE_VECTOR_SIZE];
- unsigned test_caps = 0;
-
- if (NILP (frame))
- frame = selected_frame;
- CHECK_LIVE_FRAME (frame);
- f = XFRAME (frame);
-
- for (i = 0; i < LFACE_VECTOR_SIZE; i++)
- attrs[i] = Qunspecified;
- merge_face_vector_with_property (f, attrs, attributes);
-
- /* This function only works on ttys. */
- if (!FRAME_TERMCAP_P (f) && !FRAME_MSDOS_P (f))
- return Qnil;
-
- /* First check some easy-to-check stuff; ttys support none of the
- following attributes, so we can just return nil if any are requested. */
-
- /* stipple */
- val = attrs[LFACE_STIPPLE_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- return Qnil;
-
- /* font height */
- val = attrs[LFACE_HEIGHT_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- return Qnil;
-
- /* font width */
- val = attrs[LFACE_SWIDTH_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val)
- && face_numeric_swidth (val) != XLFD_SWIDTH_MEDIUM)
- return Qnil;
-
- /* overline */
- val = attrs[LFACE_OVERLINE_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- return Qnil;
-
- /* strike-through */
- val = attrs[LFACE_STRIKE_THROUGH_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- return Qnil;
-
- /* boxes */
- val = attrs[LFACE_BOX_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- return Qnil;
-
- /* slant (italics/oblique); We consider any non-default value
- unsupportable on ttys, even though the face code actually `fakes'
- them using a dim attribute if possible. This is because the faked
- result is too different from what the face specifies. */
- val = attrs[LFACE_SLANT_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val)
- && face_numeric_slant (val) != XLFD_SLANT_ROMAN)
- return Qnil;
-
-
- /* Test for terminal `capabilities' (non-color character attributes). */
-
- /* font weight (bold/dim) */
- weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]);
- if (weight >= 0)
- {
- if (weight > XLFD_WEIGHT_MEDIUM)
- test_caps = TTY_CAP_BOLD;
- else if (weight < XLFD_WEIGHT_MEDIUM)
- test_caps = TTY_CAP_DIM;
- }
-
- /* underlining */
- val = attrs[LFACE_UNDERLINE_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- {
- if (STRINGP (val))
- return Qnil; /* ttys don't support colored underlines */
- else
- test_caps |= TTY_CAP_UNDERLINE;
- }
-
- /* inverse video */
- val = attrs[LFACE_INVERSE_INDEX];
- if (!UNSPECIFIEDP (val) && !NILP (val))
- test_caps |= TTY_CAP_INVERSE;
-
-
- /* Color testing. */
-
- /* Default the color indices in FG_TTY_COLOR and BG_TTY_COLOR, since
- we use them when calling `tty_capable_p' below, even if the face
- specifies no colors. */
- fg_tty_color.pixel = FACE_TTY_DEFAULT_FG_COLOR;
- bg_tty_color.pixel = FACE_TTY_DEFAULT_BG_COLOR;
-
- /* Check if foreground color is close enough. */
- fg = attrs[LFACE_FOREGROUND_INDEX];
- if (STRINGP (fg))
- {
- if (! tty_lookup_color (f, fg, &fg_tty_color, &fg_std_color))
- return Qnil;
- else if (color_distance (&fg_tty_color, &fg_std_color)
- > TTY_SAME_COLOR_THRESHOLD)
- return Qnil;
- }
-
- /* Check if background color is close enough. */
- bg = attrs[LFACE_BACKGROUND_INDEX];
- if (STRINGP (bg))
- {
- if (! tty_lookup_color (f, bg, &bg_tty_color, &bg_std_color))
- return Qnil;
- else if (color_distance (&bg_tty_color, &bg_std_color)
- > TTY_SAME_COLOR_THRESHOLD)
- return Qnil;
- }
-
- /* If both foreground and background are requested, see if the
- distance between them is OK. We just check to see if the distance
- between the tty's foreground and background is close enough to the
- distance between the standard foreground and background. */
- if (STRINGP (fg) && STRINGP (bg))
- {
- int delta_delta
- = (color_distance (&fg_std_color, &bg_std_color)
- - color_distance (&fg_tty_color, &bg_tty_color));
- if (delta_delta > TTY_SAME_COLOR_THRESHOLD
- || delta_delta < -TTY_SAME_COLOR_THRESHOLD)
- return Qnil;
- }
-
-
- /* See if the capabilities we selected above are supported, with the
- given colors. */
- if (test_caps != 0 &&
- ! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
- return Qnil;
-
-
- /* Hmmm, everything checks out, this terminal must support this face. */
- return Qt;
-}
-
-
-
-/***********************************************************************
Face Cache
***********************************************************************/
@@ -5570,8 +5401,8 @@ clear_face_gcs (c)
}
-/* Free all realized faces in face cache C, including basic faces. C
- may be null. If faces are freed, make sure the frame's current
+/* Free all realized faces in face cache C, including basic faces.
+ C may be null. If faces are freed, make sure the frame's current
matrix is marked invalid, so that a display caused by an expose
event doesn't try to use faces we destroyed. */
@@ -5911,7 +5742,8 @@ lookup_named_face (f, symbol)
get_lface_attributes (f, symbol, symbol_attrs, 1);
bcopy (default_face->lface, attrs, sizeof attrs);
- merge_face_vectors (f, symbol_attrs, attrs, Qnil);
+ merge_face_vectors (f, symbol_attrs, attrs, 0);
+
return lookup_face (f, attrs);
}
@@ -6049,7 +5881,7 @@ lookup_derived_face (f, symbol, face_id)
get_lface_attributes (f, symbol, symbol_attrs, 1);
bcopy (default_face->lface, attrs, sizeof attrs);
- merge_face_vectors (f, symbol_attrs, attrs, Qnil);
+ merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs);
}
@@ -6062,15 +5894,367 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
Lisp_Object lface;
lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
Qunspecified);
- merge_face_vector_with_property (XFRAME (selected_frame),
- XVECTOR (lface)->contents,
- plist);
+ merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents,
+ 1, 0);
return lface;
}
/***********************************************************************
+ Face capability testing
+ ***********************************************************************/
+
+
+/* If the distance (as returned by color_distance) between two colors is
+ less than this, then they are considered the same, for determining
+ whether a color is supported or not. The range of values is 0-65535. */
+
+#define TTY_SAME_COLOR_THRESHOLD 10000
+
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Return non-zero if all the face attributes in ATTRS are supported
+ on the window-system frame F.
+
+ The definition of `supported' is somewhat heuristic, but basically means
+ that a face containing all the attributes in ATTRS, when merged with the
+ default face for display, can be represented in a way that's
+
+ \(1) different in appearance than the default face, and
+ \(2) `close in spirit' to what the attributes specify, if not exact. */
+
+static int
+x_supports_face_attributes_p (f, attrs, def_face)
+ struct frame *f;
+ Lisp_Object *attrs;
+ struct face *def_face;
+{
+ Lisp_Object *def_attrs = def_face->lface;
+
+ /* Check that other specified attributes are different that the default
+ face. */
+ if ((!UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX])
+ && face_attr_equal_p (attrs[LFACE_UNDERLINE_INDEX],
+ def_attrs[LFACE_UNDERLINE_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
+ && face_attr_equal_p (attrs[LFACE_INVERSE_INDEX],
+ def_attrs[LFACE_INVERSE_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
+ && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX],
+ def_attrs[LFACE_FOREGROUND_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX])
+ && face_attr_equal_p (attrs[LFACE_BACKGROUND_INDEX],
+ def_attrs[LFACE_BACKGROUND_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX])
+ && face_attr_equal_p (attrs[LFACE_STIPPLE_INDEX],
+ def_attrs[LFACE_STIPPLE_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
+ && face_attr_equal_p (attrs[LFACE_OVERLINE_INDEX],
+ def_attrs[LFACE_OVERLINE_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
+ && face_attr_equal_p (attrs[LFACE_STRIKE_THROUGH_INDEX],
+ def_attrs[LFACE_STRIKE_THROUGH_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
+ && face_attr_equal_p (attrs[LFACE_BOX_INDEX],
+ def_attrs[LFACE_BOX_INDEX])))
+ return 0;
+
+ /* Check font-related attributes, as those are the most commonly
+ "unsupported" on a window-system (because of missing fonts). */
+ if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX]))
+ {
+ int face_id;
+ struct face *face;
+ Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
+
+ bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
+
+ merge_face_vectors (f, attrs, merged_attrs, 0);
+
+ face_id = lookup_face (f, merged_attrs);
+ face = FACE_FROM_ID (f, face_id);
+
+ if (! face)
+ signal_error ("cannot make face", 0);
+
+ /* If the font is the same, then not supported. */
+ if (face->font == def_face->font)
+ return 0;
+ }
+
+ /* Everything checks out, this face is supported. */
+ return 1;
+}
+
+#endif /* HAVE_WINDOW_SYSTEM */
+
+/* Return non-zero if all the face attributes in ATTRS are supported
+ on the tty frame F.
+
+ The definition of `supported' is somewhat heuristic, but basically means
+ that a face containing all the attributes in ATTRS, when merged
+ with the default face for display, can be represented in a way that's
+
+ \(1) different in appearance than the default face, and
+ \(2) `close in spirit' to what the attributes specify, if not exact.
+
+ Point (2) implies that a `:weight black' attribute will be satisfied
+ by any terminal that can display bold, and a `:foreground "yellow"' as
+ long as the terminal can display a yellowish color, but `:slant italic'
+ will _not_ be satisfied by the tty display code's automatic
+ substitution of a `dim' face for italic. */
+
+static int
+tty_supports_face_attributes_p (f, attrs, def_face)
+ struct frame *f;
+ Lisp_Object *attrs;
+ struct face *def_face;
+{
+ int weight, i;
+ Lisp_Object val, fg, bg;
+ XColor fg_tty_color, fg_std_color;
+ XColor bg_tty_color, bg_std_color;
+ unsigned test_caps = 0;
+ Lisp_Object *def_attrs = def_face->lface;
+
+
+ /* First check some easy-to-check stuff; ttys support none of the
+ following attributes, so we can just return false if any are requested
+ (even if `nominal' values are specified, we should still return false,
+ as that will be the same value that the default face uses). We
+ consider :slant unsupportable on ttys, even though the face code
+ actually `fakes' them using a dim attribute if possible. This is
+ because the faked result is too different from what the face
+ specifies. */
+ if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
+ || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]))
+ return 0;
+
+
+ /* Test for terminal `capabilities' (non-color character attributes). */
+
+ /* font weight (bold/dim) */
+ weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]);
+ if (weight >= 0)
+ {
+ int def_weight = face_numeric_weight (def_attrs[LFACE_WEIGHT_INDEX]);
+
+ if (weight > XLFD_WEIGHT_MEDIUM)
+ {
+ if (def_weight > XLFD_WEIGHT_MEDIUM)
+ return 0; /* same as default */
+ test_caps = TTY_CAP_BOLD;
+ }
+ else if (weight < XLFD_WEIGHT_MEDIUM)
+ {
+ if (def_weight < XLFD_WEIGHT_MEDIUM)
+ return 0; /* same as default */
+ test_caps = TTY_CAP_DIM;
+ }
+ else if (def_weight == XLFD_WEIGHT_MEDIUM)
+ return 0; /* same as default */
+ }
+
+ /* underlining */
+ val = attrs[LFACE_UNDERLINE_INDEX];
+ if (!UNSPECIFIEDP (val))
+ {
+ if (STRINGP (val))
+ return 0; /* ttys can't use colored underlines */
+ else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX]))
+ return 0; /* same as default */
+ else
+ test_caps |= TTY_CAP_UNDERLINE;
+ }
+
+ /* inverse video */
+ val = attrs[LFACE_INVERSE_INDEX];
+ if (!UNSPECIFIEDP (val))
+ {
+ if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX]))
+ return 0; /* same as default */
+ else
+ test_caps |= TTY_CAP_INVERSE;
+ }
+
+
+ /* Color testing. */
+
+ /* Default the color indices in FG_TTY_COLOR and BG_TTY_COLOR, since
+ we use them when calling `tty_capable_p' below, even if the face
+ specifies no colors. */
+ fg_tty_color.pixel = FACE_TTY_DEFAULT_FG_COLOR;
+ bg_tty_color.pixel = FACE_TTY_DEFAULT_BG_COLOR;
+
+ /* Check if foreground color is close enough. */
+ fg = attrs[LFACE_FOREGROUND_INDEX];
+ if (STRINGP (fg))
+ {
+ Lisp_Object def_fg = def_attrs[LFACE_FOREGROUND_INDEX];
+
+ if (face_attr_equal_p (fg, def_fg))
+ return 0; /* same as default */
+ else if (! tty_lookup_color (f, fg, &fg_tty_color, &fg_std_color))
+ return 0; /* not a valid color */
+ else if (color_distance (&fg_tty_color, &fg_std_color)
+ > TTY_SAME_COLOR_THRESHOLD)
+ return 0; /* displayed color is too different */
+ else
+ /* Make sure the color is really different than the default. */
+ {
+ XColor def_fg_color;
+ if (tty_lookup_color (f, def_fg, &def_fg_color, 0)
+ && (color_distance (&fg_tty_color, &def_fg_color)
+ <= TTY_SAME_COLOR_THRESHOLD))
+ return 0;
+ }
+ }
+
+ /* Check if background color is close enough. */
+ bg = attrs[LFACE_BACKGROUND_INDEX];
+ if (STRINGP (bg))
+ {
+ Lisp_Object def_bg = def_attrs[LFACE_FOREGROUND_INDEX];
+
+ if (face_attr_equal_p (bg, def_bg))
+ return 0; /* same as default */
+ else if (! tty_lookup_color (f, bg, &bg_tty_color, &bg_std_color))
+ return 0; /* not a valid color */
+ else if (color_distance (&bg_tty_color, &bg_std_color)
+ > TTY_SAME_COLOR_THRESHOLD)
+ return 0; /* displayed color is too different */
+ else
+ /* Make sure the color is really different than the default. */
+ {
+ XColor def_bg_color;
+ if (tty_lookup_color (f, def_bg, &def_bg_color, 0)
+ && (color_distance (&bg_tty_color, &def_bg_color)
+ <= TTY_SAME_COLOR_THRESHOLD))
+ return 0;
+ }
+ }
+
+ /* If both foreground and background are requested, see if the
+ distance between them is OK. We just check to see if the distance
+ between the tty's foreground and background is close enough to the
+ distance between the standard foreground and background. */
+ if (STRINGP (fg) && STRINGP (bg))
+ {
+ int delta_delta
+ = (color_distance (&fg_std_color, &bg_std_color)
+ - color_distance (&fg_tty_color, &bg_tty_color));
+ if (delta_delta > TTY_SAME_COLOR_THRESHOLD
+ || delta_delta < -TTY_SAME_COLOR_THRESHOLD)
+ return 0;
+ }
+
+
+ /* See if the capabilities we selected above are supported, with the
+ given colors. */
+ if (test_caps != 0 &&
+ ! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
+ return 0;
+
+
+ /* Hmmm, everything checks out, this terminal must support this face. */
+ return 1;
+}
+
+
+DEFUN ("display-supports-face-attributes-p",
+ Fdisplay_supports_face_attributes_p, Sdisplay_supports_face_attributes_p,
+ 1, 2, 0,
+ doc: /* Return non-nil if all the face attributes in ATTRIBUTES are supported.
+The optional argument DISPLAY can be a display name, a frame, or
+nil (meaning the selected frame's display)
+
+The definition of `supported' is somewhat heuristic, but basically means
+that a face containing all the attributes in ATTRIBUTES, when merged
+with the default face for display, can be represented in a way that's
+
+ \(1) different in appearance than the default face, and
+ \(2) `close in spirit' to what the attributes specify, if not exact.
+
+Point (2) implies that a `:weight black' attribute will be satisfied by
+any display that can display bold, and a `:foreground \"yellow\"' as long
+as it can display a yellowish color, but `:slant italic' will _not_ be
+satisfied by the tty display code's automatic substitution of a `dim'
+face for italic. */)
+ (attributes, display)
+ Lisp_Object attributes, display;
+{
+ int supports, i;
+ Lisp_Object frame;
+ struct frame *f;
+ struct face *def_face;
+ Lisp_Object attrs[LFACE_VECTOR_SIZE];
+
+ if (noninteractive || !initialized)
+ /* We may not be able to access low-level face information in batch
+ mode, or before being dumped, and this function is not going to
+ be very useful in those cases anyway, so just give up. */
+ return Qnil;
+
+ if (NILP (display))
+ frame = selected_frame;
+ else if (FRAMEP (display))
+ frame = display;
+ else
+ {
+ /* Find any frame on DISPLAY. */
+ Lisp_Object fl_tail;
+
+ frame = Qnil;
+ for (fl_tail = Vframe_list; CONSP (fl_tail); fl_tail = XCDR (fl_tail))
+ {
+ frame = XCAR (fl_tail);
+ if (!NILP (Fequal (Fcdr (Fassq (Qdisplay,
+ XFRAME (frame)->param_alist)),
+ display)))
+ break;
+ }
+ }
+
+ CHECK_LIVE_FRAME (frame);
+ f = XFRAME (frame);
+
+ for (i = 0; i < LFACE_VECTOR_SIZE; i++)
+ attrs[i] = Qunspecified;
+ merge_face_ref (f, attributes, attrs, 1, 0);
+
+ def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ if (def_face == NULL)
+ {
+ if (! realize_basic_faces (f))
+ signal_error ("Cannot realize default face", 0);
+ def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ }
+
+ /* Dispatch to the appropriate handler. */
+ if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
+ supports = tty_supports_face_attributes_p (f, attrs, def_face);
+#ifdef HAVE_WINDOW_SYSTEM
+ else
+ supports = x_supports_face_attributes_p (f, attrs, def_face);
+#endif
+
+ return supports ? Qt : Qnil;
+}
+
+
+/***********************************************************************
Font selection
***********************************************************************/
@@ -6968,7 +7152,7 @@ realize_named_face (f, symbol, id)
/* Merge SYMBOL's face with the default face. */
get_lface_attributes (f, symbol, symbol_attrs, 1);
- merge_face_vectors (f, symbol_attrs, attrs, Qnil);
+ merge_face_vectors (f, symbol_attrs, attrs, 0);
/* Realize the face. */
new_face = realize_face (c, attrs, id);
@@ -7441,15 +7625,10 @@ compute_char_face (f, ch, prop)
else
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
- struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- bcopy (face->lface, attrs, sizeof attrs);
- merge_face_vector_with_property (f, attrs, prop);
+ struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ bcopy (default_face->lface, attrs, sizeof attrs);
+ merge_face_ref (f, prop, attrs, 1, 0);
face_id = lookup_face (f, attrs);
- if (! ASCII_CHAR_P (ch))
- {
- face = FACE_FROM_ID (f, face_id);
- face_id = FACE_FOR_CHAR (f, face, ch, -1, Qnil);
- }
}
return face_id;
@@ -7513,24 +7692,8 @@ face_at_buffer_position (w, pos, region_beg, region_end,
/* Look at properties from overlays. */
{
int next_overlay;
- int len;
-
- /* First try with room for 40 overlays. */
- len = 40;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len,
- &next_overlay, NULL, 0);
-
- /* If there are more than 40, make enough space for all, and try
- again. */
- if (noverlays > len)
- {
- len = noverlays;
- overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
- noverlays = overlays_at (pos, 0, &overlay_vec, &len,
- &next_overlay, NULL, 0);
- }
+ GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0);
if (next_overlay < endpos)
endpos = next_overlay;
}
@@ -7550,7 +7713,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
/* Merge in attributes specified via text properties. */
if (!NILP (prop))
- merge_face_vector_with_property (f, attrs, prop);
+ merge_face_ref (f, prop, attrs, 1, 0);
/* Now merge the overlay data. */
noverlays = sort_overlays (overlay_vec, noverlays, w);
@@ -7561,7 +7724,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
prop = Foverlay_get (overlay_vec[i], propname);
if (!NILP (prop))
- merge_face_vector_with_property (f, attrs, prop);
+ merge_face_ref (f, prop, attrs, 1, 0);
oend = OVERLAY_END (overlay_vec[i]);
oendpos = OVERLAY_POSITION (oend);
@@ -7572,8 +7735,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
/* If in the region, merge in the region face. */
if (pos >= region_beg && pos < region_end)
{
- Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
- merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
+ merge_named_face (f, Qregion, attrs, 0);
if (region_end < endpos)
endpos = region_end;
@@ -7669,16 +7831,13 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
/* Merge in attributes specified via text properties. */
if (!NILP (prop))
- merge_face_vector_with_property (f, attrs, prop);
+ merge_face_ref (f, prop, attrs, 1, 0);
/* If in the region, merge in the region face. */
if (bufpos
&& bufpos >= region_beg
&& bufpos < region_end)
- {
- Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
- merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil);
- }
+ merge_named_face (f, Qregion, attrs, 0);
/* Look up a realized face with the given face attributes,
or realize a new one for ASCII characters. */
@@ -7946,7 +8105,7 @@ syms_of_xfaces ()
defsubr (&Sinternal_merge_in_global_face);
defsubr (&Sface_font);
defsubr (&Sframe_face_alist);
- defsubr (&Stty_supports_face_attributes_p);
+ defsubr (&Sdisplay_supports_face_attributes_p);
defsubr (&Scolor_distance);
defsubr (&Sinternal_set_font_selection_order);
defsubr (&Sinternal_set_alternative_font_family_alist);
diff --git a/src/xfns.c b/src/xfns.c
index 12df902ae49..cdbce00fe4c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4425,6 +4425,8 @@ x_create_tip_frame (dpyinfo, parms, text)
old_buffer = current_buffer;
set_buffer_internal_1 (XBUFFER (buffer));
current_buffer->truncate_lines = Qnil;
+ specbind (Qinhibit_read_only, Qt);
+ specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
Finsert (1, &text);
set_buffer_internal_1 (old_buffer);
@@ -5477,6 +5479,11 @@ Chinese, Japanese, and Korean. */);
#endif /* USE_X_TOOLKIT */
#ifdef USE_GTK
+ /* Provide x-toolkit also for GTK. Internally GTK does not use Xt so it
+ is not an X toolkit in that sense (USE_X_TOOLKIT is not defined).
+ But for a user it is a toolkit for X, and indeed, configure
+ accepts --with-x-toolkit=gtk. */
+ Fprovide (intern ("x-toolkit"), Qnil);
Fprovide (intern ("gtk"), Qnil);
DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
diff --git a/src/xselect.c b/src/xselect.c
index b4d61f7c9a9..7be238651a0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1,5 +1,5 @@
/* X Selection processing for Emacs.
- Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004
Free Software Foundation.
This file is part of GNU Emacs.
@@ -2576,7 +2576,7 @@ are ignored. */)
if (event.xclient.format != 8 && event.xclient.format != 16
&& event.xclient.format != 32)
error ("FORMAT must be one of 8, 16 or 32");
-
+
if (FRAMEP (dest) || NILP (dest))
{
struct frame *fdest = check_x_frame (dest);
diff --git a/src/xsmfns.c b/src/xsmfns.c
index e486e5c6e32..9a6a7ccefb8 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -1,6 +1,6 @@
/* Session management module for systems which understand the X Session
management protocol.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/src/xterm.c b/src/xterm.c
index ae4d4063be9..3e606e2560a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,5 +1,5 @@
/* X Communication module for terminals which understand the X protocol.
- Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000, 01, 02, 2003
+ Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -983,7 +983,8 @@ static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
int, int, int));
static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
- int, int, int, int, XRectangle *));
+ int, int, int, int, int, int,
+ XRectangle *));
static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
int, int, int, XRectangle *));
@@ -2025,9 +2026,10 @@ x_setup_relief_colors (s)
static void
x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
- raised_p, left_p, right_p, clip_rect)
+ raised_p, top_p, bot_p, left_p, right_p, clip_rect)
struct frame *f;
- int left_x, top_y, right_x, bottom_y, width, left_p, right_p, raised_p;
+ int left_x, top_y, right_x, bottom_y, width;
+ int top_p, bot_p, left_p, right_p, raised_p;
XRectangle *clip_rect;
{
Display *dpy = FRAME_X_DISPLAY (f);
@@ -2042,10 +2044,11 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
/* Top. */
- for (i = 0; i < width; ++i)
- XDrawLine (dpy, window, gc,
- left_x + i * left_p, top_y + i,
- right_x + 1 - i * right_p, top_y + i);
+ if (top_p)
+ for (i = 0; i < width; ++i)
+ XDrawLine (dpy, window, gc,
+ left_x + i * left_p, top_y + i,
+ right_x + 1 - i * right_p, top_y + i);
/* Left. */
if (left_p)
@@ -2061,10 +2064,11 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
/* Bottom. */
- for (i = 0; i < width; ++i)
- XDrawLine (dpy, window, gc,
- left_x + i * left_p, bottom_y - i,
- right_x + 1 - i * right_p, bottom_y - i);
+ if (bot_p)
+ for (i = 0; i < width; ++i)
+ XDrawLine (dpy, window, gc,
+ left_x + i * left_p, bottom_y - i,
+ right_x + 1 - i * right_p, bottom_y - i);
/* Right. */
if (right_p)
@@ -2172,7 +2176,7 @@ x_draw_glyph_string_box (s)
{
x_setup_relief_colors (s);
x_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
- width, raised_p, left_p, right_p, &clip_rect);
+ width, raised_p, 1, 1, left_p, right_p, &clip_rect);
}
}
@@ -2183,21 +2187,22 @@ static void
x_draw_image_foreground (s)
struct glyph_string *s;
{
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->img->pixmap)
{
@@ -2222,11 +2227,12 @@ x_draw_image_foreground (s)
get_glyph_string_clip_rect (s, &clip_rect);
image_rect.x = x;
image_rect.y = y;
- image_rect.width = s->img->width;
- image_rect.height = s->img->height;
+ image_rect.width = s->slice.width;
+ image_rect.height = s->slice.height;
if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
XCopyArea (s->display, s->img->pixmap, s->window, s->gc,
- r.x - x, r.y - y, r.width, r.height, r.x, r.y);
+ s->slice.x + r.x - x, s->slice.y + r.y - y,
+ r.width, r.height, r.x, r.y);
}
else
{
@@ -2235,11 +2241,12 @@ x_draw_image_foreground (s)
get_glyph_string_clip_rect (s, &clip_rect);
image_rect.x = x;
image_rect.y = y;
- image_rect.width = s->img->width;
- image_rect.height = s->img->height;
+ image_rect.width = s->slice.width;
+ image_rect.height = s->slice.height;
if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
XCopyArea (s->display, s->img->pixmap, s->window, s->gc,
- r.x - x, r.y - y, r.width, r.height, r.x, r.y);
+ s->slice.x + r.x - x, s->slice.y + r.y - y,
+ r.width, r.height, r.x, r.y);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2251,15 +2258,17 @@ x_draw_image_foreground (s)
{
int r = s->img->relief;
if (r < 0) r = -r;
- XDrawRectangle (s->display, s->window, s->gc, x - r, y - r,
- s->img->width + r*2 - 1, s->img->height + r*2 - 1);
+ XDrawRectangle (s->display, s->window, s->gc,
+ x - r, y - r,
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
}
else
/* Draw a rectangle if image could not be loaded. */
XDrawRectangle (s->display, s->window, s->gc, x, y,
- s->img->width - 1, s->img->height - 1);
+ s->slice.width - 1, s->slice.height - 1);
}
@@ -2271,21 +2280,22 @@ x_draw_image_relief (s)
{
int x0, y0, x1, y1, thick, raised_p;
XRectangle r;
- int x;
- int y = s->ybase - image_ascent (s->img, s->face);
+ int x = s->x;
+ int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = s->x + abs (s->face->box_line_width);
- else
- x = s->x;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->hl == DRAW_IMAGE_SUNKEN
|| s->hl == DRAW_IMAGE_RAISED)
@@ -2301,12 +2311,17 @@ x_draw_image_relief (s)
x0 = x - thick;
y0 = y - thick;
- x1 = x + s->img->width + thick - 1;
- y1 = y + s->img->height + thick - 1;
+ x1 = x + s->slice.width + thick - 1;
+ y1 = y + s->slice.height + thick - 1;
x_setup_relief_colors (s);
get_glyph_string_clip_rect (s, &r);
- x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
+ x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
+ s->slice.y == 0,
+ s->slice.y + s->slice.height == s->img->height,
+ s->slice.x == 0,
+ s->slice.x + s->slice.width == s->img->width,
+ &r);
}
@@ -2317,21 +2332,22 @@ x_draw_image_foreground_1 (s, pixmap)
struct glyph_string *s;
Pixmap pixmap;
{
- int x;
- int y = s->ybase - s->y - image_ascent (s->img, s->face);
+ int x = 0;
+ int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
- && s->first_glyph->left_box_line_p)
- x = abs (s->face->box_line_width);
- else
- x = 0;
+ && s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += abs (s->face->box_line_width);
/* If there is a margin around the image, adjust x- and y-position
by that margin. */
- x += s->img->hmargin;
- y += s->img->vmargin;
+ if (s->slice.x == 0)
+ x += s->img->hmargin;
+ if (s->slice.y == 0)
+ y += s->img->vmargin;
if (s->img->pixmap)
{
@@ -2347,19 +2363,21 @@ x_draw_image_foreground_1 (s, pixmap)
XGCValues xgcv;
xgcv.clip_mask = s->img->mask;
- xgcv.clip_x_origin = x;
- xgcv.clip_y_origin = y;
+ xgcv.clip_x_origin = x - s->slice.x;
+ xgcv.clip_y_origin = y - s->slice.y;
xgcv.function = GXcopy;
XChangeGC (s->display, s->gc, mask, &xgcv);
XCopyArea (s->display, s->img->pixmap, pixmap, s->gc,
- 0, 0, s->img->width, s->img->height, x, y);
+ s->slice.x, s->slice.y,
+ s->slice.width, s->slice.height, x, y);
XSetClipMask (s->display, s->gc, None);
}
else
{
XCopyArea (s->display, s->img->pixmap, pixmap, s->gc,
- 0, 0, s->img->width, s->img->height, x, y);
+ s->slice.x, s->slice.y,
+ s->slice.width, s->slice.height, x, y);
/* When the image has a mask, we can expect that at
least part of a mouse highlight or a block cursor will
@@ -2372,14 +2390,15 @@ x_draw_image_foreground_1 (s, pixmap)
int r = s->img->relief;
if (r < 0) r = -r;
XDrawRectangle (s->display, s->window, s->gc, x - r, y - r,
- s->img->width + r*2 - 1, s->img->height + r*2 - 1);
+ s->slice.width + r*2 - 1,
+ s->slice.height + r*2 - 1);
}
}
}
else
/* Draw a rectangle if image could not be loaded. */
XDrawRectangle (s->display, pixmap, s->gc, x, y,
- s->img->width - 1, s->img->height - 1);
+ s->slice.width - 1, s->slice.height - 1);
}
@@ -2421,33 +2440,28 @@ static void
x_draw_image_glyph_string (s)
struct glyph_string *s;
{
- int x, y;
int box_line_hwidth = abs (s->face->box_line_width);
int box_line_vwidth = max (s->face->box_line_width, 0);
int height;
Pixmap pixmap = None;
- height = s->height - 2 * box_line_vwidth;
-
+ height = s->height;
+ if (s->slice.y == 0)
+ height -= box_line_vwidth;
+ if (s->slice.y + s->slice.height >= s->img->height)
+ height -= box_line_vwidth;
/* Fill background with face under the image. Do it only if row is
taller than image or if image has a clip mask to reduce
flickering. */
s->stippled_p = s->face->stipple != 0;
- if (height > s->img->height
+ if (height > s->slice.height
|| s->img->hmargin
|| s->img->vmargin
|| s->img->mask
|| s->img->pixmap == 0
|| s->width != s->background_width)
{
- if (box_line_hwidth && s->first_glyph->left_box_line_p)
- x = s->x + box_line_hwidth;
- else
- x = s->x;
-
- y = s->y + box_line_vwidth;
-
if (s->img->mask)
{
/* Create a pixmap as large as the glyph string. Fill it
@@ -2486,7 +2500,19 @@ x_draw_image_glyph_string (s)
}
}
else
- x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
+ {
+ int x = s->x;
+ int y = s->y;
+
+ if (s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ x += box_line_hwidth;
+
+ if (s->slice.y == 0)
+ y += box_line_vwidth;
+
+ x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
+ }
s->background_filled_p = 1;
}
@@ -7239,7 +7265,8 @@ x_draw_hollow_cursor (w, row)
/* Compute the proper height and ascent of the rectangle, based
on the actual glyph. Using the full height of the row looks
bad when there are tall images on that row. */
- h = max (FRAME_LINE_HEIGHT (f), cursor_glyph->ascent + cursor_glyph->descent);
+ h = max (min (FRAME_LINE_HEIGHT (f), row->height),
+ cursor_glyph->ascent + cursor_glyph->descent);
if (h < row->height)
y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
h--;
diff --git a/src/xterm.h b/src/xterm.h
index fe0449a3bc5..d87135e8bf6 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1,5 +1,5 @@
/* Definitions and headers for communication with X protocol.
- Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000, 2001, 2001
+ Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -167,7 +167,7 @@ struct x_display_info
/* The colormap being used. */
Colormap cmap;
- /* Number of panes on this screen. */
+ /* Number of planes on this screen. */
int n_planes;
/* Dimensions of this screen. */
@@ -941,7 +941,6 @@ Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
struct frame *check_x_frame P_ ((Lisp_Object));
EXFUN (Fx_display_color_p, 1);
EXFUN (Fx_display_grayscale_p, 1);
-int image_ascent P_ ((struct image *, struct face *));
extern void x_free_gcs P_ ((struct frame *));
/* From xrdb.c. */