Jan Djärv [Tue, 28 Aug 2012 16:05:17 +0000 (18:05 +0200)]
Improve NS dialogs. Add close button, remove ugly casts.
* nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
button_values to NULL. Call setStykeMask so dialogs get a close button.
(windowShouldClose:): Set window_closed.
(dealloc): New member, free button_values.
(process_dialog:): Make member function. Remove window argument,
replace window with self. Count buttons and allocate and store values
in button_values.
(addButton:value:row:): value is int with the name tag. Call setTag
with tag. Remove return self, declare return value as void.
(addString:row:): Remove return self, declare return value as void.
(addSplit): Remove return self, declare return value as void.
(clicked:): Remove return self, declare return value as void.
Set dialog_return to button_values[seltag]. Code formatting change.
(initFromContents:isQuestion:): Adjust call to process_dialog.
Code formatting change.
(timeout_handler:): Set timer_fired to YES.
(runDialogAt:): Set timer_fired to NO.
Handle click on close button as quit.
* nsterm.h (EmacsDialogPanel): Make timer_fired BOOL.
Add window_closed and button_values. Add void as return value for
add(Button|String|Split). addButton takes int instead of Lisp_Object.
Add process_dialog as new member.
Dmitry Antipov [Tue, 28 Aug 2012 10:59:17 +0000 (14:59 +0400)]
Do not allow to set major mode for a dead buffer.
* buffer.c (Fset_buffer_major_mode): Signal an error
if the buffer is dead.
(Fother_buffer, other_buffer_safely): Remove redundant
nested declaration.
Paul Eggert [Tue, 28 Aug 2012 00:33:56 +0000 (17:33 -0700)]
* dispnew.c: Use bool for boolean.
(frame_garbaged, display_completed, delayed_size_change)
(fonts_changed_p, add_window_display_history)
(add_frame_display_history, verify_row_hash)
(adjust_glyph_matrix, clear_window_matrices, glyph_row_slice_p)
(row_equal_p, realloc_glyph_pool)
(allocate_matrices_for_frame_redisplay)
(showing_window_margins_p)
(adjust_frame_glyphs_for_frame_redisplay)
(build_frame_matrix_from_leaf_window, make_current)
(mirrored_line_dance, mirror_line_dance, update_frame)
(update_window_tree, update_single_window)
(check_current_matrix_flags, update_window, update_text_area)
(update_window_line, set_window_update_flags, scrolling_window)
(update_frame_1, scrolling, buffer_posn_from_coords)
(do_pending_window_change, change_frame_size)
(change_frame_size_1, sit_for):
Use bool for boolean.
(clear_glyph_matrix_rows): Rename from enable_glyph_matrix_rows,
and remove last int (actually boolean) argument, which was always 0.
All callers changed.
* dispextern.h, frame.h, lisp.h: Reflect above API changes.
* dispextern.h (struct composition_it): Use bool for boolean.
(struct glyph_matrix): Don't assume buffer sizes can fit in 'int'.
(struct bidi_it): Use unsigned:1, not int, for boolean prev_was_pdf.
* dired.c (file_name_completion):
Use bool for boolean. (This was missed in an earlier change.)
Jan Djärv [Mon, 27 Aug 2012 18:53:10 +0000 (20:53 +0200)]
* nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
dialog_return.
(windowShouldClose:): Use stop instead of stopModalWithCode.
(clicked:): Ditto, and also set dialog_return.
(timeout_handler:): Use stop instead of abortModal. Send a dummy
event.
(runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when
modal loop returns.
* nsterm.h (NSPanel): New class variable dialog_return.
Martin Rudalics [Mon, 27 Aug 2012 08:31:19 +0000 (10:31 +0200)]
Address two problems in Fset_window_configuration (Bug#8789) and (Bug#12208).
* window.c (Fset_window_configuration): Record any window's old
buffer if it's replaced (see Bug#8789). If the new current
buffer doesn't appear in the selected window, go to its old
point (Bug#12208).
Dmitry Antipov [Mon, 27 Aug 2012 04:15:33 +0000 (08:15 +0400)]
Special MEM_TYPE_SPARE to denote reserved memory.
* alloc.c (enum mem_type): New memory type.
(refill_memory_reserve): Use new type for spare memory.
This prevents live_cons_p and live_string_p from incorrect
detection of uninitialized objects from spare memory as live.
Chong Yidong [Sun, 26 Aug 2012 13:42:18 +0000 (21:42 +0800)]
Make special-display-* and display-buffer-reuse-frames obsolete.
* lisp/window.el (special-display-regexps, special-display-frame-alist)
(special-display-buffer-names, special-display-function)
(display-buffer-reuse-frames): Mark as obsolete.
* lisp/progmodes/compile.el: Don't use display-buffer-reuse-frames.
Chong Yidong [Sun, 26 Aug 2012 09:16:48 +0000 (17:16 +0800)]
Clean up gdb-mi's usage of display-buffer.
* progmodes/gdb-mi.el (gdb-display-buffer-other-frame-action): New
variable, replacing gdb-frame-parameters.
(gdb-frame-io-buffer, gdb-frame-breakpoints-buffer)
(gdb-frame-threads-buffer, gdb-frame-memory-buffer)
(gdb-frame-disassembly-buffer, gdb-frame-stack-buffer)
(gdb-frame-locals-buffer, gdb-frame-registers-buffer): Use it.
(def-gdb-frame-for-buffer): Macro deleted. It is easier to define
the functions directly with gdb-display-buffer-other-frame-action.
(gdb-display-breakpoints-buffer, gdb-display-threads-buffer)
(gdb-display-memory-buffer, gdb-display-disassembly-buffer)
(gdb-display-stack-buffer, gdb-display-locals-buffer)
(gdb-display-registers-buffer): Define directly.
(def-gdb-display-buffer): Macro deleted.
(gdb-display-buffer): Remove second and third args, callers don't
use them. Defer to the default display-buffer behavior, apart
from making windows dedicated.
(gdb-setup-windows): Don't call display-buffer unnecessarily.
* window.el (display-buffer-pop-up-frame): Handle a
pop-up-frame-parameters alist entry.
(display-buffer): Document it.
* progmodes/gud.el (gud-display-line): Just use display-buffer.
Paul Eggert [Sun, 26 Aug 2012 05:21:04 +0000 (22:21 -0700)]
* lisp.h (ASET): Remove attempt to detect side effects.
It was meant to be temporary and it often doesn't work,
because when IDX has side effects the behavior of IDX==IDX
is undefined. See Stefan Monnier in
<http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00762.html>.
Chong Yidong [Sun, 26 Aug 2012 03:57:55 +0000 (11:57 +0800)]
Make ordinary isearch obey search-whitespace-regexp too.
* lisp/isearch.el (search-whitespace-regexp): Make string and nil
values apply to both ordinary and regexp search. Allow a cons
cell value to distinguish between the two.
(isearch-whitespace-regexp, isearch-search-forward)
(isearch-search-backward): New functions.
(isearch-occur, isearch-search-fun-default, isearch-search)
(isearch-lazy-highlight-new-loop): Use them.
(isearch-forward, isearch-forward-regexp): Doc fix.
Paul Eggert [Sat, 25 Aug 2012 20:31:04 +0000 (13:31 -0700)]
* xgselect.c (xg_select): Use auto storage for the GPollFD buffer
as that's faster and simpler than static storage. Don't bother
with the g_main_context_query overhead if g_main_context_pending
says no events are pending.
(gfds, gfds_size): Remove these static vars.
(xgselect_initialize): Remove; no longer needed.
All uses and decls removed.
Martin Rudalics [Sat, 25 Aug 2012 14:52:02 +0000 (16:52 +0200)]
Handle evening window heights more correctly (Bug#11880) and (Bug#12091).
* window.el (window--even-window-heights): Even heights when
WINDOW and the selected window form a vertical combination.
(display-buffer-use-some-window): Provide that window used gets
sized back by quit-window. (Bug#11880) and (Bug#12091)
Paul Eggert [Sat, 25 Aug 2012 04:04:08 +0000 (21:04 -0700)]
On assertion failure, print backtrace if available.
Merge from gnulib, incorporating:
2012-08-24 execinfo: port to FreeBSD
2012-08-22 execinfo: new module
* admin/merge-gnulib (GNULIB_MODULES): Add execinfo.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files.
* src/alloc.c [ENABLE_CHECKING]: Include <execinfo.h>.
(die) [ENABLE_CHECKING]: Print a backtrace if available.
* src/Makefile.in (LIB_EXECINFO): New macro.
(LIBES): Use it.
Paul Eggert [Thu, 23 Aug 2012 20:31:52 +0000 (13:31 -0700)]
* bidi.c: Use bool for boolean.
This is a bit more readable, and makes the text segment of bidi.o
0.4% smaller on my platform (GCC 4.7.1 x86-64, Fedora 15).
Presumably it's faster too.
(bidi_initialized, bidi_ignore_explicit_marks_for_paragraph_level):
Now bool.
(bidi_cache_find_level_change, bidi_cache_iterator_state)
(bidi_unshelve_cache, bidi_init_it, bidi_count_bytes)
(bidi_char_at_pos, bidi_fetch_char, bidi_paragraph_init)
(bidi_explicit_dir_char, bidi_level_of_next_char)
(bidi_find_other_level_edge, bidi_move_to_visually_next):
Use bool for booleans, instead of int.
* dispextern.h (bidi_init_it, bidi_paragraph_init)
(bidi_unshelve_cache): Adjust decls to match code.
Dan Nicolaescu [Wed, 22 Aug 2012 16:05:04 +0000 (12:05 -0400)]
* frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to
compile time tests instead of run time tests on systems that do
not use them.
(FRAME_MAC_P): Remove leftover from deleted code.
* frame.c (syms_of_frame): Remove leftover from deleted code.
Martin Rudalics [Wed, 22 Aug 2012 09:22:08 +0000 (11:22 +0200)]
Rewrite handling of side and atomic windows.
* window.el (display-buffer-in-atom-window, window--major-non-side-window)
(window--major-side-window, display-buffer-in-major-side-window)
(delete-side-window, display-buffer-in-side-window): New
functions.
(window--side-check, window-deletable-p, delete-window)
(delete-other-windows, split-window): Handle side windows and
atomic windows appropriately.
(window--display-buffer): Call display-buffer-record-window also
when the window buffer did not change.
Martin Rudalics [Wed, 22 Aug 2012 08:30:54 +0000 (10:30 +0200)]
Let walk-window-tree and window-with-parameter operate on minibuffer windows too.
* window.el (walk-window-tree, window-with-parameter): New
optional argument MINIBUF to control whether these functions
should run on the minibuffer window.
(window-at-side-list): Don't operate on minibuffer window.
(window-in-direction): Simplify and rewrite doc-string.
Paul Eggert [Wed, 22 Aug 2012 07:20:42 +0000 (00:20 -0700)]
* fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
Otherwise, the compiler complains about (A?B:C) where B is void
and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12.
(fontset_add): Return void, for FONTSET_ADD.
Paul Eggert [Tue, 21 Aug 2012 23:09:01 +0000 (16:09 -0700)]
Make recently-introduced setters macros.
* fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii)
(set_fontset_base, set_fontset_frame, set_fontset_nofont_face)
(set_fontset_default, set_fontset_fallback): Rename from their
upper-case counterparts, and make them functions rather than macros.
This is more consistent with the other recently-introduced setters.
These don't need to be inline, since they're local.
Paul Eggert [Tue, 21 Aug 2012 17:18:21 +0000 (10:18 -0700)]
* lisp.h (vcopy): Use memcpy rather than our own loop.
This fixes a performance regression introduced by the recent
addition of vcopy. This means 'vcopy' will need to be modified
for a copying collector, but that's OK. Also, tighten the
checking in the assertion.
Eli Zaretskii [Tue, 21 Aug 2012 17:14:08 +0000 (20:14 +0300)]
Fix bug #11860 with displaying composite RTL characters on MS-Windows.
src/w32uniscribe.c (uniscribe_shape): Fix producing gstring
components for RTL text. Adjust X-OFFSET of each non-base glyph
for the width of the base character, according to what
x_draw_composite_glyph_string_foreground expects. Generate
WADJUST value according to composition_gstring_width's
expectations, to produce correct width of the composed character.
Reverse the sign of the DU offset produced by ScriptPlace.
Dmitry Antipov [Tue, 21 Aug 2012 10:21:04 +0000 (14:21 +0400)]
Avoid direct writes to contents member of struct Lisp_Vector.
* lisp.h (vcopy): New function to copy data into vector.
* dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET.
* fns.c (Ffillarray): Use ASET.
* keyboard.c (timer_check_2): Use AREF and ASET.
(append_tool_bar_item, Frecent_keys): Use vcopy.
* lread.c (read_vector): Use ASET.
* msdos.c (Frecent_doskeys): Use vcopy.
* xface.c (Finternal_copy_lisp_face): Use vcopy.
(Finternal_merge_in_global_face): Use ASET and vcopy.
* xfont.c (xfont_list_pattern): Likewise.
Martin Rudalics [Tue, 21 Aug 2012 09:27:07 +0000 (11:27 +0200)]
For selected window have (set-)window-point always operate on buffer's point.
* window.c (Fwindow_point): For the selected window always return
the position of its buffer's point.
(Fset_window_point): For the selected window always go in its
buffer to the specified position.
* window.el (window-point-1, set-window-point-1): Remove.
(window-in-direction, record-window-buffer)
(set-window-buffer-start-and-point, split-window-below)
(window--state-get-1, display-buffer-record-window): Replace
calls to window-point-1 and set-window-point-1 by calls to
window-point and set-window-point respectively.