Commit graph

41017 commits

Author SHA1 Message Date
Paul Eggert
53914a1055 Use ‘const’ to clarify GC marking
Add ‘const’ to make the GC marking code a bit clearer.
This can also help the compiler in some cases, I think because
GCC can now determine more often that the value of a static C
variable can be cached when its address is now converted to
‘Lisp Object const *’ before escaping.
* src/alloc.c (staticvec, mark_maybe_objects, mark_memory)
(mark_stack, staticpro, mark_object_root_visitor)
(garbage_collect_1):
* src/pdumper.c (dump_ptr_referrer, dump_emacs_reloc_to_lv)
(dump_emacs_reloc_to_emacs_ptr_raw, dump_root_visitor):
* src/lisp.h (vcopy, struct gc_root_visitor):
* src/sysdep.c (stack_overflow):
* src/thread.c (mark_one_thread):
* src/thread.h (struct thread_state):
Use pointer-to-const instead of plain pointer in some
GC-related places where either will do.
2019-03-19 12:37:36 -07:00
Stefan Monnier
7f6c6253c9 * src/fileio.c: Don't convert \r to \n just because of C-x $
(choose_write_coding_system): Setup the \r to \n conversion only if
selective-display is t.
2019-03-18 14:57:10 -04:00
Eli Zaretskii
03a9a75c5b Fix 'define-charset' after dumping with pdumper
* src/charset.h:
* src/charset.c (charset_table_used): Now static.
(charset_table_size): Now extern.
* src/pdumper.c (dump_charset_table): Dump the entire
charset_table, not just its used slots.  (Bug#34826)
2019-03-17 17:49:37 +02:00
Alexander Gramiak
cc06d76865 Define macros to abstract support for external menu/tool-bars
* src/lisp.h (HAVE_EXT_MENU_BAR)
(HAVE_EXT_TOOL_BAR): Define.

*src/dispnew.c:
*src/frame.c:
*src/frame.h:
*src/keyboard.c:
*src/menu.c:
*src/menu.h:
*src/window.c:
*src/window.h:
*src/xdisp.c:
*src/xfns: Use the new macros.
2019-03-16 13:15:07 -06:00
Eli Zaretskii
34dd4e0a83 Improve locale and language environment setting at startup
* lisp/international/mule-cmds.el (locale-language-names): Add
more locales and their language environments.
(set-locale-environment): Use w32-multibyte-code-page, if
non-zero, as locale-coding-system.  (Bug#34684)

* src/w32fns.c (globals_of_w32fns) <w32-multibyte-code-page>:
New variable.

* etc/NEWS: Mention w32-multibyte-code-page.
2019-03-16 13:59:03 +02:00
Paul Eggert
0eeb8c5920 Use bool for menu_items_inuse
* src/menu.c (menu_items_inuse): Now bool, instead of a
Lisp_Object that is always Qt or Qnil.  All uses changed.
2019-03-15 18:25:24 -07:00
Paul Eggert
1d65985a2b Reindent pdumper per usual Emacs style
* src/pdumper.c, src/pdumper.h: Reindent.
2019-03-11 11:08:14 -07:00
Eli Zaretskii
7fddde1f06 Fix show-trailing-whitespace in R2L text
* src/xdisp.c (highlight_trailing_whitespace): Allow for
stretch glyphs at the left edge of R2L lines, when skipping
glyphs inserted by the display engine.  This unbreaks
show-trailing-whitespace in R2L lines.
2019-03-11 17:32:38 +02:00
Paul Eggert
93c0527a6a Fix a small pdumper memory leak
* src/pdumper.c (dump_mmap_reset): Free the private area here ...
(dump_mm_heap_cb_release): ... instead of here.
(dump_mmap_release_heap): Simplify by avoiding a local.
(dump_mmap_contiguous): Reindent GNU style.
2019-03-11 08:21:41 -07:00
Martin Rudalics
95373b69b3 Rewrite minibuffer window resizing code
* src/frame.c (resize_mini_frames): New variable.
* src/window.c (resize_mini_window_apply): New function.
(grow_mini_window, shrink_mini_window): Remove PIXELWISE
argument.  Call resize_mini_window_apply to apply changes.
(Fresize_mini_window_internal): Call resize_mini_window_apply
to apply changes.
(Qwindow__resize_mini_frame): New symbol.
* src/window.h (grow_mini_window, shrink_mini_window): Adjust
external declarations.
* src/xdisp.c (resize_mini_window): For minibuffer-only frames
call 'window--resize-mini-frame' if resize_mini_frames is
non-nil.  Offload parts of logic to grow_mini_window and
shrink_mini_window which are now called without the PIXELWISE
argument.
(Vresize_mini_windows): Mention 'resize-mini-frames' in
doc-string.
* lisp/cus-start.el (resize-mini-frames): Add customization
support.
* lisp/window.el (window--resize-mini-window): Simplify code.
(window--resize-mini-frame): New function.
* doc/lispref/minibuf.texi (Minibuffer Windows): Describe new
option 'resize-mini-frames'.
* etc/NEWS: Mention new option 'resize-mini-frames'.
2019-03-11 09:57:23 +01:00
Paul Eggert
27466c62fd * src/editfns.c: Fix docstring typo. 2019-03-10 23:46:46 -07:00
Paul Eggert
9b4d34fa78 Improve binary-as-unsigned treatment (Bug#34792)
* etc/NEWS:
* src/editfns.c (Fformat, binary_as_unsigned):
Update now that we always have bignums.
(syms_of_editfns) [!defined lisp_h_FIXNUMP]: Remove now-obsolete
code, since lisp_h_FIXNUMP is always defined now.
* test/src/editfns-tests.el (read-large-integer): Simplify,
now that we can assume binary-as-unsigned defaults to nil.
2019-03-10 23:41:21 -07:00
Ken Brown
d6826546c4 Use a runtime test for timerfd on Cygwin (Bug#34618)
* src/atimer.c [HAVE_TIMERFD] (have_buggy_timerfd): New
function.
(init_atimer) Use it.
2019-03-10 10:43:00 -04:00
Eli Zaretskii
5625eb7c24 ; * src/editfns.c (Fformat): Fix last change. (Bug#34792) 2019-03-09 20:58:56 +02:00
Ivan Andrus
a4fa053f0e Mention binary-as-unsigned' in format' docstring (Bug#34792)
* src/src/editfns.c (format): Update docstring to mention binary-as-unsigned
(Bug#34792)
2019-03-09 11:35:05 -07:00
Glenn Morris
3b63afd73b Merge from origin/emacs-26
0589de5 (origin/emacs-26) Fix markup of fake keys in the ELisp manual
82d4b98 Avoid errors in Auto Revert mode
a3b1935 Mention empty strings in file name expansion, emacs lisp refe...
a38da0d cc-mode.texi: Work around makeinfo alignment bug.  Fix proble...
464ee80 Warn against recursive invocations of 'buffer-list-update-hoo...
60b5c10 Provide more details in doc-string of 'delete-windows-on' (Bu...
f0be0f1 Improve documentation of 'delete-windows-on'
f1bddc7 * lisp/frame.el (make-frame-command): Doc fix.  (Bug#34715)
2848623 Avoid undefined behavior in gdb-mi.el
dbf1837 * lisp/window.el (fit-frame-to-buffer): Make doc-string more ...
099ef44 Minor spelling and grammar fixes (bug#34756)
52fd400 Minor improvement of documentation of '(when CONDITION . SPEC)'
f872b65 Improve documentation of 'auto-coding-functions'
04cad5e Fix visiting XML files with non-Unix EOL format
a89fabe Update example major mode code in Elisp manual

# Conflicts:
#	lisp/autorevert.el
#	lisp/window.el
2019-03-09 10:07:46 -08:00
Eli Zaretskii
9fe7f23359 Consult 'face-remapping-alist' for 'internal-border' face
* src/xterm.c (x_clear_under_internal_border)
(x_after_update_window_line):
* src/w32fns.c (x_clear_under_internal_border):
* src/w32term.c (x_after_update_window_line): Consult
'face-remapping-alist' when using the 'internal-border' face.
2019-03-09 19:45:13 +02:00
Martin Rudalics
4e082ce394 Further redesign of window change functions
* doc/lispref/windows.texi (Window Hooks): Revise description
of window change functions.  Add documentation for
'window-state-change-hook' and window state change flag.
* etc/NEWS: Update entry for window change functions.
* src/frame.c (Fframe_window_state_change)
(Fset_frame_window_state_change): New functions.
* src/frame.h (struct frame): New boolean window_state_change.
(FRAME_WINDOW_STATE_CHANGE): New macro.
* src/window.c (window_change_record_frames): New static
boolean.
(window_change_record_frame): Remove function - code moved to
window_change_record.
(window_change_record): Record frame changes here taking
window_change_record_frames into account.
(run_window_change_functions_1): Set window_change_record_frames
whenever we run one of our hooks.
(run_window_change_functions): Run hooks also when
FRAME_WINDOW_STATE_CHANGE has been set.  Run
Vwindow_state_change_hook.  Leave decision whether to record
changes for all frames to window_change_record.
(Vwindow_state_change_functions): Update doc-string.
(Vwindow_state_change_hook): New normal hook.
2019-03-09 11:13:18 +01:00
Alan Third
d2270d8fc9 Don't redraw the glyph on top of bar cursors
* src/nsterm.m (ns_draw_window_cursor): Limit when we redraw the
glyph.
2019-03-09 09:17:08 +00:00
Martin Rudalics
464ee80eac Warn against recursive invocations of 'buffer-list-update-hook' (Bug#34765)
* src/buffer.c (Vbuffer_list_update_hook):
* doc/lispref/buffers.texi (Buffer List): Warn against
recursive invocations of 'buffer-list-update-hook' (Bug#34765).
2019-03-08 19:10:27 +01:00
Eli Zaretskii
953cbce77b Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2019-03-07 16:19:00 +02:00
Eli Zaretskii
a0b2a5ad9e Fix OBJECT binding in conditional display specs
* src/xdisp.c (compute_display_string_pos): Pass OBJECT1, not
OBJECT to handle_display_spec, as the latter doesn't expect a
window object.  (Bug#34771)
2019-03-06 21:06:00 +02:00
Paul Eggert
870a333281 Fix typo in fix for Bug#33498
* src/frame.c (delete_frame): Fix typo in previous patch,
which caused GCC to complain about the use of an uninitialized
variable.
2019-03-06 11:05:19 -08:00
Martin Rudalics
612a65d90c In unwind_with_echo_area_buffer use set_marker_restricted_both
* src/xdisp.c (unwind_with_echo_area_buffer): Use
set_marker_restricted_both instead of set_marker_both to avoid
spurious assertion failures.
2019-03-06 10:20:48 +01:00
Martin Rudalics
a425b4230d Fix initialization of Vwindow_state_change_functions
* src/window.c (Vwindow_state_change_functions): Initialize the
right variable.
2019-03-06 09:18:27 +01:00
Eli Zaretskii
1c349c6230 Remove unreliable assertion in buf_bytepos_to_charpos
* src/marker.c (buf_bytepos_to_charpos): Remove the assertion
regarding bytepos always at the head byte of a multibyte
sequence.  For the reasons, see
http://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00100.html
http://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00102.html
2019-03-05 18:25:23 +02:00
Martin Rudalics
a552cc21dc Fix handling of minibuffer-only child frames (Bug#33498)
* doc/lispref/frames.texi (Buffer Parameters): Describe how to
make a minibuffer-only child frame.
(Child Frames): Describe how minbuffer child frames are
deleted.
* src/frame.c (delete_frame): Handle deletion of minibuffer
child frames (Bug#33498).  In the course, fix reassigning of
'default-minibuffer-frame' with minibuffer-only frames.
* lisp/frame.el (frame-notice-user-settings): Handle creation of
initial minibuffer-only child frame.
(make-frame): Handle creation of frame with a minibuffer-only
child frame.
2019-03-05 10:46:19 +01:00
Eli Zaretskii
f06405cbf8 Avoid assertion violations in buf_bytepos_to_charpos
* src/marker.c (buf_bytepos_to_charpos): Disable the assertion
regarding bytepos always at the head byte of a multibyte
sequence.
2019-03-04 19:22:23 +02:00
Martin Rudalics
ad25316bde Prevent introducing invalid scroll bar width/height values (Bug#34569)
* src/frame.c (store_frame_param): Don't store invalid values
for scroll_bar_width/height.
(x_report_frame_params): Don't report invalid values for
scroll_bar_width/height.
(x_set_scroll_bar_width, x_set_scroll_bar_height): Don't set
invalid values for scroll_bar_width/height.
2019-03-04 10:28:56 +01:00
Martin Rudalics
a810a75aa2 Fix minibuffer resizing with temporarily selected frames (Bug#34317)
* src/keyboard.c (command_loop_1): Resize echo area exactly
only if the echo area window is the minibuffer window of the
selected frame (Bug#34317).
* src/xdisp.c (x_consider_frame_title): Inhibit redisplay also
when restoring the selected window/frame to avoid that
resize_mini_window sizes back the minibuffer window of a
temporarily selected frame (Bug#34317).
2019-03-04 10:11:53 +01:00
Paul Eggert
716ff449ef * src/alloc.c (gcstat): Now static. 2019-03-04 00:12:27 -08:00
Paul Eggert
9687176622 * src/gfilenotify.c: Fix indenting. 2019-03-04 00:05:04 -08:00
Paul Eggert
2f86095c36 * src/font.h: Fix commentary. 2019-03-04 00:05:04 -08:00
Paul Eggert
5c2563a547 Simplify list creation in C code
The main new thing here is that C code can now say
‘list (a, b, c, d, e, f)’ instead of
‘listn (CONSTYPE_HEAP, 6, a, b, c, d, e, f)’,
thus relieving callers of the responsibility of counting
arguments (plus, the code feels more like Lisp).  The old
list1 ... list5 functions remain, as they’re probably a bit
faster for small lists.
* src/alloc.c (cons_listn, pure_listn): New functions.
(listn): Omit enum argument.
All callers changed to use either new ‘list’ or ‘pure_list’ macros.
* src/charset.c (Fdefine_charset_internal):
* src/coding.c (detect_coding_system)
(Fset_terminal_coding_system_internal):
* src/frame.c (frame_size_history_add, adjust_frame_size):
* src/gtkutil.c (xg_frame_set_char_size):
* src/keyboard.c (command_loop_1):
* src/nsfns.m (frame_geometry):
* src/widget.c (set_frame_size):
* src/xfaces.c (Fcolor_distance):
* src/xfns.c (frame_geometry):
* src/xterm.c (x_set_window_size_1):
* src/xwidget.c (Fxwidget_size_request):
Prefer list1i, list2i, etc. to open-coding them.
* src/charset.c (Fset_charset_priority):
* src/nsterm.m (append2):
* src/window.c (window_list):
* src/xfaces.c (Fx_list_fonts):
Use nconc2 instead of open-coding it.
* src/eval.c (eval_sub, backtrace_frame_apply):
* src/kqueue.c (kqueue_generate_event):
* src/nsterm.m (performDragOperation:):
* src/pdumper.c (Fpdumper_stats):
* src/w32.c (init_environment):
Prefer list1, list2, etc. to open-coding them.
* src/font.c (font_list_entities):
Parenthesize to avoid expanding new ‘list’ macro.
* src/gtkutil.c (GETSETUP): Rename from MAKE_FLOAT_PAGE_SETUP
to get lines to fit.  Move outside the ‘list’ call, since it’s
now a macro.
* src/keymap.c (Fmake_keymap): Simplify.
* src/lisp.h (list, pure_list): New macros.
(list1i): New function.
2019-03-04 00:05:04 -08:00
Eli Zaretskii
db3b3b3506 Fix starting temacs interactively
* src/dispnew.c (init_display_interactive): Don't call
init_faces_initial if we aren't initialized, since
tty-set-up-initial-frame-faces is not available then.  This
restores the ability to start "temacs -nw" and also avoids
bad crashes in "emacs -nw" if the pdumper file is not found.
(Bug#34707)
2019-03-03 19:02:34 +02:00
Paul Eggert
8a64107f7d Fix typo in previous change
* src/alloc.c (memory_full_cons_threshold):
Move to after definition of struct cons_block.
Problem reported by Basil L. Contovounesios in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00067.html
2019-03-02 23:02:22 -08:00
Paul Eggert
284f635da8 memory_full_cons_threshold is a constant
* src/alloc.c (memory_full_cons_threshold): Now const.
(memory_full): Omit no-longer-needed initialization.
2019-03-02 13:14:26 -08:00
Paul Eggert
5f99d515c9 Avoid staticvec duplicates
* src/alloc.c (staticpro) [ENABLE_CHECKING]: Check for duplicates.
* src/keyboard.c (syms_of_keyboard): Define
while-no-input-ignore-events and inhibit--record-char here ...
(syms_of_keyboard_for_pdumper): ... instead of here.
This avoids duplicates in staticvec.
2019-03-02 11:06:40 -08:00
Alan Mackenzie
954c9c5bc3 Check by eassert that a bytepos argument isn't in the middle of a character
* src/marker.c (buf_bytepos_to_charpos): Add an eassert to check that the
parameter bytepos is at the beginning of a character or EOB.
2019-03-02 18:23:34 +00:00
Phillip Lord
7523a9e8b2 Revert "Add hook for all events"
This reverts commit 7b31de4d10.
2019-03-02 16:52:53 +00:00
Eli Zaretskii
dbffbe0881 Fix 'end-of-visual-line' with overlay strings with newlines
* src/indent.c (Fvertical_motion): Get out of overlay strings
with embedded newlines even if moving within the same screen
line.  See https://github.com/emacs-lsp/lsp-mode/issues/677
for more details.
Fix test for IT_CHARPOS being at the beginning of the
accessible portion of the buffer.
2019-03-02 12:17:47 +02:00
Stefan Monnier
2028756fa3 * src/syntax.c (update_syntax_table): Prefer 'else' to 'goto' 2019-03-01 16:04:11 -05:00
Alan Mackenzie
31182c1d17 Maintain interval ->position fields correctly in update_interval
Also fix some anomalies in the handling of byte positions in regexp-emacs.c
This fixes bug #34525.

* src/intervals.c (SET_PARENT_POSITION): New macro.
(update_interval): When moving to an interval's parent, set that parent's
->position field, to maintain the consistency of the tree.

* src/intervals.h (struct interval): Amend the comment describing when
->position is valid.

* src/pdumper.c: Update the hash associated with struct interval.

* src/regex-emacs.c: (re_match_2_internal): Only invoke POINTER_TO_OFFSET on a
known character boundary.  Only perform arithmetic on character positions, not
on byte positions.  Correct the argument to an invocation of
UPDATE_SYNTAX_TABLE_FORWARD by adding 1 to it (in case wordend:).

* src/syntax.c: (update_syntax_table): Remove the now redundant code that set
the ->position field of all parents of the interval found by update_interval.
2019-03-01 17:37:56 +00:00
Glenn Morris
3c1407cedf Merge from origin/emacs-26
dee3cdc Minor improvement for docs of completion
c86d419 ; * src/image.c (imagemagick_load, svg_load): Fix typos in co...
6d46fa9 Disable the timerfd interface on Cygwin
3707ea4 Fix a typo in the doc string of 'regex-opt'
d9905d5 Document bash 5.0.0 misbehavior in tramp.texi (Bug#34192)

# Conflicts:
#	doc/misc/tramp.texi
2019-03-01 09:40:22 -08:00
Paul Eggert
7e29eae023 Suppress GC stats when obviously not needed
This should help future improvements where these stats can be
bignums that do not fit into intmax_t.
* src/alloc.c (struct gcstat, gcstat): New type and static var,
to package up GC statistics into one C object.  It replaces ...
(total_free_intervals, total_intervals, total_strings)
(total_free_strings, total_string_bytes, total_vectors)
(total_vector_slots, total_free_vector_slots): ... these
removed static vars.  All uses changed.
(garbage_collect_1): Accept a struct gcstat *, not a void *
which was not used anymore anyway.  Return a bool indicating
success, instead of a Lisp object.  All callers changed.
(garbage_collect): New function.  All C callers of
Fgarbage_collect changed to use it, since none of them use the
return value.  Now, only Lisp code uses Fgarbage_collect.
(Fgarbage_collect): No longer noinline.  Cons up the return
value here, not in garbage_collect_1.
2019-03-01 09:09:47 -08:00
Eli Zaretskii
ed087faa9b Don't signal Quit from 'while-no-input' on TTY frames
* src/keyboard.c (read_char): Don't inject quit-char after
longjmp if while-no-input is in effect.  (Bug#34535)
2019-03-01 12:19:03 +02:00
Alan Mackenzie
cb95d771a2 * src/pdumper.c: Clarify the message about updating hash values 2019-03-01 09:25:43 +00:00
Eli Zaretskii
f62f7db2c8 ; * src/xfaces.c (syms_of_xfaces): Fix last change. 2019-03-01 10:42:59 +02:00
Federico Tedin
63d0dc7937 Allow control on the threshold for using 'distant-foreground'
* src/xfaces.c (NEAR_SAME_COLOR_THRESHOLD): Macro deleted.
(load_face_colors): Compare against
face_near_same_color_threshold instead of
NEAR_SAME_COLOR_THRESHOLD.
(syms_of_xfaces) <face-near-same-color-threshold>: New
variable.  (Bug#34001)

* etc/NEWS: Announce the change.
2019-03-01 10:36:59 +02:00
Eli Zaretskii
5d60229bf1 Avoid rare crashes in xbacktrace
* src/eval.c (backtrace_thread_p, backtrace_top): Don't
segfault in "xbacktrace" if called before the specpdl
machinery is initialized in pdumped Emacs.
2019-02-28 21:16:10 +02:00