1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-29 08:31:35 -08:00
Commit graph

47092 commits

Author SHA1 Message Date
Po Lu
1973d4ac1b Avoid lowering child frames below scroll bars on X
* src/xterm.c (x_lower_frame_1): New function.
(x_lower_frame): Avoid calling XLowerFrame when there is a
parent with scroll bars.
2022-08-16 09:30:08 +08:00
Eli Zaretskii
82635f40ed Produce TAGS in 'lib' as well and include them in src/TAGS
* src/Makefile.in (TAGS): Include ../lib/TAGS.
($(lib)/TAGS): New target.
(tags): Depend on $(lib)/TAGS.
2022-08-15 22:12:58 +03:00
Lars Ingebrigtsen
5025b2566e Fix fix_command for non-symbol functions
* src/callint.c (fix_command): Don't bug out on commands that
aren't symbols (like lambdas, for instance).
2022-08-15 16:18:45 +02:00
Alan Mackenzie
629f980fad Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments
This fixes bug #57179.

* src/keyboard.c (safe_run_hooks_1, safe_run_hook_funcall): Enhance these
functions so that nargs == 3 or 4 is handled as well as nargs == 2.  This
allows them to be used to call hooks with 1 or 2 arguments.
2022-08-15 12:18:01 +00:00
Matt Armstrong
79c0e78460 Pacify warnings from gcc 12 in encode_coding_object
* src/coding.c (encode_coding_object): Mark saved_pt_byte with UNINIT
to silence a false alarm from -Wmaybe-uninitialized.  This was already
done in decode_coding_object.  The fix is correct because saved_pt is
used as a sentinel before saved_pt_byte is used (bug#57219).
2022-08-15 08:56:57 +02:00
Po Lu
4bee89b73f Fix uninitialized variable false-positives
* src/xterm.c (xm_setup_dnd_targets):
(x_dnd_free_toplevels): Mark dpy and recs UNINIT, since GCC
thinks they can be used uninitialized.  (bug#57208)
2022-08-15 08:55:26 +08:00
Paul Eggert
a64fe6f319 Improve timefns speed on integers
* src/timefns.c (decode_lisp_time) [FASTER_TIMEFNS]:
Speed up when SPECIFIED_TIME is an integer.
(time_cmp) [FASTER_TIMEFNS]: Speed up when comparing integers.
2022-08-14 13:49:33 -07:00
Paul Eggert
15aba5e644 Decode time conses before floats
* src/timefns.c (decode_lisp_time): Test for conses before floats,
as conses are more common.
2022-08-14 13:49:33 -07:00
Paul Eggert
23561f9665 Work around Bug#57211
* src/buffer.c (Fgenerate_new_buffer_name): Allocate a bigger buffer.
2022-08-14 13:49:33 -07:00
Paul Eggert
9664b8c8e1 Fix selection preservation bug when USE_XCB
* src/xterm.c (x_preserve_selections) [USE_XCB]: Fix bug: use of
wrong ‘tem’ value.  Found by GCC -Wanalyzer-use-of-uninitialized-value.
Move decl of local to make the (former) bug more obvious.
2022-08-14 11:14:17 -07:00
Stefan Monnier
397fdc22eb * lisp/calendar/time-date.el (seconds-to-time): Use the original arg list 2022-08-14 10:41:40 -04:00
Stefan Kangas
096c081e51 * src/Makefile.in (elnlisp): Delete autoload.eln from list. 2022-08-14 16:06:06 +02:00
Eli Zaretskii
a71c05b44d Further speedups of redisplay of long and truncated lines
* src/xdisp.c (mode_line_update_needed, redisplay_window)
(decode_mode_spec): Don't avoid calling current_column, as it is
now fast enough.
(redisplay_window) <optional_new_start>: Don't call 'move_it_to'
if its result will not be used.
(Flong_line_optimizations_p): New primitive.
* src/indent.c (Fcurrent_column): Doc fix.
(current_column, scan_for_column): When in a buffer with long
and/or truncated lines, quickly return an approximate value.
* src/window.c (Frecenter): Use the old text-mode code when the
buffer has very long lines.

* lisp/simple.el (line-move): Avoid costly calls to
'line-move-partial' and 'line-move-visual' when lines are
truncated and/or very long.
(move-beginning-of-line): Call 'line-beginning-position' instead
of the slower 'skip-chars-backward'.

* etc/NEWS: Announce 'long-line-optimizations-p'.
2022-08-14 15:49:37 +03:00
Eli Zaretskii
0df8f481dd ; * src/xdisp.c (display_line): Fix a typo. 2022-08-14 09:34:37 +03:00
Po Lu
47e23ad7a8 More fixes to MPX drag-and-drop interaction
* src/xterm.c (x_dnd_begin_drag_and_drop): Also initialize the
keyboard device used for drag-and-drop.
(handle_one_xevent): Verify deviceid in more places; also test
keyboard device before swallowing F1.
2022-08-14 09:39:08 +08:00
Basil L. Contovounesios
864847bf3c Document time-convert FORM argument as mandatory
This is a followup to commit b70369c557 of 2022-08-05
"time-convert): Deprecate calls without an explicit FORM arg".

* doc/lispref/os.texi (Time Conversion):
* src/timefns.c (Ftime_convert): Describe FORM argument as required
as per the advertised calling convention.
2022-08-13 21:59:39 +03:00
Stefan Kangas
0a93759385 Improve time-convert docstring formatting for readability
* src/timefns.c (Ftime_convert): Doc fix; improve formatting for
readability.
2022-08-13 20:30:12 +02:00
Eli Zaretskii
a1cf3b96f8 ; Fix documentation of 'deactivate-mark'
* src/keyboard.c (syms_of_keyboard):
* etc/NEWS: Fix the documentation of 'deactivate-mark' and its new
value 'dont-save'.  (Bug#57147)
2022-08-13 18:52:46 +03:00
Eli Zaretskii
94c10c426e Speed up display of long lines under 'truncate-lines'
* src/xdisp.c (partial_line_height): Return zero for long and
truncated lines.
(fast_move_it_horizontally): New function.
(hscroll_window_tree, display_line): Use
'fast_move_it_horizontally' in preference to
'move_it_in_display_line_to', when dealing with long and truncated
lines.
(redisplay_internal): Optimize "optimization 3" for long and
truncated lines.
* src/buffer.c (syms_of_buffer) <large-hscroll-threshold>: New
variable.

* etc/NEWS: Announce 'large-hscroll-threshold'.
2022-08-13 16:59:22 +03:00
Po Lu
0ab572d5c9 Add new value dont-save' to deactivate-mark'
* etc/NEWS: Announce new value of `deactivate-mark'.

* lisp/simple.el (deactivate-mark): Handle new value.
(bug#57147)

* src/keyboard.c (syms_of_keyboard): Update doc string of
`deactivate-mark'.
2022-08-13 21:14:07 +08:00
Po Lu
4e23ecb882 ; * src/xfns.c (Fx_set_mouse_absolute_pixel_position): Fix typo. 2022-08-13 10:36:54 +08:00
Po Lu
e311d05ab1 Improve MPX interaction with drag-and-drop
* src/xfns.c (Fx_set_mouse_absolute_pixel_position): Use
internal client pointer record.
* src/xterm.c (x_dnd_cancel_dnd_early): New function.  Only used
on XI2 builds so far.
(x_dnd_begin_drag_and_drop): Set the pointer device used for DND
events.
(xi_disable_devices): Cancel the drag-and-drop operation if that
device is disabled.
(x_send_scroll_bar_event): Update outdated comment.
(handle_one_xevent): Only accept DND events from that device.
(frame_set_mouse_pixel_position): Use internal client pointer
record.
2022-08-13 10:35:08 +08:00
Stefan Kangas
687fcc2c40 Merge from origin/emacs-28
9419bc904d ; * lisp/printing.el: Delete outdated download instructions.
31af0f4eb7 Don't list Emacs as requirement for built-in package
ae348b719e Fix wrong metrics for bitmap-only fonts with HarfBuzz 5
2022-08-12 06:30:31 +02:00
Po Lu
05c4e7bfbd Prevent SelectionNotify etc from reaching GTK 3
* src/xterm.c (handle_one_xevent): Prevent selection events from
reaching GTK if they are destined for an Emacs window.
2022-08-12 09:25:12 +08:00
Alan Mackenzie
48215c41d1 New debugging facility: backtraces from errors in Lisp called from redisplay
Setting backtrace-on-redisplay-error to non-nil enables the generation of a
Lisp backtrace in buffer *Redisplay-trace* following an error in Lisp called
from redisplay.

* doc/lispref/debugging.texi (Debugging Redisplay): New subsection.
(Error Debugging): Reference to the new subsection.

* etc/NEWS: New entry for the new facility.

* src/eval.c (redisplay_deep_handler): New variable.
(init_eval): Initialize redisplay_deep_handler.
(call_debugger): Don't throw to top-level after calling debug-early
(internal_condition_case_n): "Bind" redisplay_deep_handler to the current
handler.
(backtrace_yet): New boolean variable.
(signal_or_quit): New code section to handle Lisp errors occurring in
redisplay.
(syms_of_eval): New DEFVAR_BOOL backtrace-on-redisplay-error.

* src/keyboard.c (command_loop_1): Set backtrace_yet to false each time around
the loop.
(safe_run_hooks_error): Allow args to be up to four Lisp_Objects long.
(safe_run_hooks_2): New function.

* src/lisp.h (top level): declare as externs backtrace_yet and
safe_run_hooks_2.

* src/xdisp.c (run_window_scroll_functions): Replace a call to
run_hook_with_args_2 with one to safe_run_hooks_2.
2022-08-11 19:31:09 +00:00
YAMAMOTO Mitsuharu
ae348b719e Fix wrong metrics for bitmap-only fonts with HarfBuzz 5
* src/ftcrfont.c (ftcrhbfont_begin_hb_font): Always use the standard
position unit value on HarfBuzz 5 and later regardless of whether the
font is bitmap-only or not.  (Bug#57066)
2022-08-11 18:16:24 +09:00
Po Lu
edffda8609 Adjust client pointer upon help event
* src/xterm.c (handle_one_xevent): Keep track of the device that
set do_help and make it the client pointer so that tooltips show
up under the right pointer.
2022-08-11 09:56:15 +08:00
Po Lu
8c0c9398f3 Fix some undesirable frame focus changes
* src/xterm.c (handle_one_xevent): Only detach upon actual
device tree change.
2022-08-10 19:31:21 +08:00
Po Lu
5e07d1d0fc Improve MPX interaction with xwidgets and drag-and-drop
* src/xterm.c (handle_one_xevent): Handle focus interaction in
more places.
2022-08-10 10:33:43 +08:00
Eli Zaretskii
38f9d9bf06 ; * src/keyboard.c (timer_check_2): Restore run-time conditions. 2022-08-09 21:26:21 +03:00
Po Lu
2ebfd7188f ; * src/xterm.c (xi_populate_device_from_info): Minor ifdef cleanup. 2022-08-09 19:56:09 +08:00
Po Lu
97a54d1327 ; * src/xterm.c (xi_disable_devices): Fix portability typo. 2022-08-09 16:30:45 +08:00
Po Lu
1dc3ecc6c3 Factor out some duplicate code from handle_one_xevent
* src/xterm.c (xi_disable_devices): New function.
(handle_one_xevent): Use that to disable an array of device IDs
instead of copypasting the same block of code over and over
again.
2022-08-09 15:44:03 +08:00
Po Lu
f39d25d5fe Fix handling of XI_DeviceChanged events
* src/xterm.c (xi_get_scroll_valuator): New function.
(xi_handle_device_changed): New function.
(handle_one_xevent): Factor out most of the device changed code
to that function, and make it specifically query for the device
information.  (bug#57020)
2022-08-09 11:08:15 +08:00
Lars Ingebrigtsen
c0c5f43f49 Clean up fix_command code slightly
* src/callint.c (fix_command): Remove superfluous check.
2022-08-08 17:47:07 +02:00
Lars Ingebrigtsen
27e1568967 select-active-regions doc string improvement
* src/keyboard.c (syms_of_keyboard): Mention
post-select-region-hook.
2022-08-08 17:47:07 +02:00
Mattias Engdegård
9aae83fe30 * src/print.c (struct print_buffer): Revert gratuitous format change. 2022-08-08 16:26:29 +02:00
Lars Ingebrigtsen
7f8a3d4e91 Clean up fix_command slightly
* src/callint.c (fix_command): Remove now-unused parameter.
(Fcall_interactively): Ditto.
2022-08-08 16:01:24 +02:00
Lars Ingebrigtsen
ffc81ebc4b Allow specifying how args are to be stored in `command-history'
* doc/lispref/functions.texi (Declare Form): Document
`interactive-args'
* lisp/replace.el (replace-string): Store the correct interactive
arguments (bug#45607).

* lisp/emacs-lisp/byte-run.el (byte-run--set-interactive-args):
New function.
(defun-declarations-alist): Use it.

* src/callint.c (fix_command): Remove the old hack (which now
longer works since interactive specs are byte-compiled) and
instead rely on `interactive-args'.
2022-08-08 15:53:41 +02:00
Po Lu
498c5d26bb ; Fix coding style in recently installed changes to print.c
* src/print.c (struct print_buffer, struct print_context): Fix
brace position and make comments more like what is in
lisp.h/xterm.c/etc.
2022-08-08 20:56:50 +08:00
Stefan Kangas
3d7d8ddc5a ; Fix typos 2022-08-08 14:23:29 +02:00
Mattias Engdegård
8c8ae51640 Group print buffer state in a struct
* src/print.c (print_buffer, print_buffer_size, print_buffer_pos)
(print_buffer_pos_byte): Replace with...
(struct print_buffer, print_buffer): ...this.
* src/print.c: (print_free_buffer, print_unwind)
(print_prepare, print_finish, printchar, strout): Adapt users.
2022-08-08 13:26:13 +02:00
Mattias Engdegård
14f0ebc9ac Turn large macros in print.c to functions
This is easier to read and maintain, and makes the state explicit.
It is a pure refactoring; the compiled code should be equivalent.

* src/print.c (PRINTPREPARE, PRINTFINISH): Replace with...
(struct print_context, print_prepare, print_finish): ...these new
functions and explicit state in a struct.
(Fwrite_char, write_string, Fterpri, Fprin1, Fprin1_to_string)
(Fprinc, Fprint): Adapt callers.
2022-08-08 13:12:47 +02:00
Po Lu
9b661ff1a8 Fix warnings outside XI2 builds
* src/xterm.c (x_query_pointer): Juggle some definitions around.
2022-08-08 11:59:08 +08:00
Po Lu
16b8948d79 Improve handling of pointer focus under the input extension
* src/xfns.c (x_relative_mouse_position)
(Fx_mouse_absolute_pixel_position, compute_tip_xy): Use
x_query_pointer instead of XQueryPointer.
* src/xterm.c (xi_populate_device_from_info): Set new attachment
field.
(xi_handle_focus_change): Set client pointer.
(xi_focus_handle_for_device, xi_handle_interaction): Use
attached keyboard device to handle focus.
(x_query_pointer): New function.
(XTmouse_position, x_scroll_bar_report_motion)
(x_horizontal_scroll_bar_report_motion, handle_one_xevent): Use
x_query_pointer instead of XQueryPointer.
(x_term_init): Initialize client pointer device.
* src/xterm.h (struct xi_device_t): New field `attachment'.
(struct x_display_info): New field `client_pointer_device'.
2022-08-08 11:44:53 +08:00
Lars Ingebrigtsen
af90a31629 Pacify a gcc warning in xi_handle_focus_change
* src/xterm.c (xi_handle_focus_change): Pacify a wrong warning on
gcc (Debian 10.2.1-6).

xterm.c: In function ‘xi_handle_focus_change’:
xterm.c:12564:25: warning: ‘source’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
12564 |       ie.device = source->name;
      |                   ~~~~~~^~~~~~
2022-08-07 17:22:54 +02:00
Eli Zaretskii
7592953553 Fix 'vertical-motion' in bidi-reordered text
* src/xdisp.c (move_it_vertically_backward): Fix the case of long
bidi-reordered lines when starting from its last (top-most) screen
line.
(move_it_by_lines): Fix logic of detection when going by lines
overshoots.
2022-08-07 17:03:52 +03:00
Mattias Engdegård
08a74ab05a Cease emitting negative file offsets for user variables
'User variables' were made obsolete in Emacs 24 along with
user-variable-p; the sign of the position in (#$ . POS) hasn't
mattered since.

* lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform):
Don't emit negative position when doc string starts with `*`.
* src/lread.c (get_lazy_string): Explain.
2022-08-07 10:52:16 +02:00
Mattias Engdegård
7778f83b3e Use struct for saved strings in the reader
* src/lread.c (saved_doc_string, saved_doc_string_size)
(saved_doc_string_length, saved_doc_string_position)
(prev_saved_doc_string, prev_saved_doc_string_size)
(prev_saved_doc_string_length, prev_saved_doc_string_position):
Replace with...
(struct saved_string, saved_strings): ...this.
* src/lread.c (Fload, skip_lazy_string, get_lazy_string):
Adapt code.
2022-08-07 10:25:03 +02:00
Mattias Engdegård
c46863d9bb Make force-load-doc-strings work again
When load-force-doc-strings is true, read (#$ . POS) as the (unibyte)
string referred to.  This feature was lost by mistake in the recent
nonrecursive reader rewrite.

Noticed by Stefan Monnier.

* src/lread.c (get_lazy_string): New function (code mostly recycled
from an old version).
(read0): Detect (#$ . FIXNUM) and retrieve the string if appropriate.
* test/src/lread-resources/lazydoc.el:
* test/src/lread-tests.el (lread-force-load-doc-strings):
New test.
2022-08-07 10:25:03 +02:00