Po Lu [Sun, 26 Jun 2022 05:34:43 +0000 (13:34 +0800)]
Stop catching errors for some requests
* src/xterm.c (x_dnd_compute_toplevels)
(frame_set_mouse_pixel_position, x_focus_frame): Use
`x_ignore_errors_for_next_request'. This results in a healthy
~30% speedup for the involved requests.
Po Lu [Sun, 26 Jun 2022 02:20:35 +0000 (10:20 +0800)]
Handle errors while sending client events asynchronously
* src/xterm.c (xm_send_drop_message)
(xm_send_top_level_enter_message, xm_send_drag_motion_message)
(xm_send_top_level_leave_message, x_dnd_send_enter)
(x_dnd_send_position, x_dnd_send_leave, x_dnd_send_drop): Avoid
sync to check for errors while sending client events.
(x_dnd_begin_drag_and_drop, handle_one_xevent, XTread_socket):
Clean up failable requests.
(x_request_can_fail): New functions.
(x_clean_failable_requests, x_ignore_errors_for_next_request)
(x_uncatch_errors): Clean up failable requests.
(x_error_handler): If a request is allowed to fail, just return.
(x_term_init): Set up new pointer.
* src/xterm.h (N_FAILABLE_REQUESTS): New macro.
(struct x_display_info): New field `failable_requests' and
associated next pointer.
Paul Eggert [Sat, 25 Jun 2022 19:51:28 +0000 (14:51 -0500)]
Port distribution tarball to Solaris 10
* make-dist (taropt): Use 'tar -H ustar' to generate a portable
tar file format instead of a GNU-specific format. Needed now that
Emacs tarballs contain file names longer than 100 bytes, e.g.:
emacs-28.1/test/lisp/gnus/mml-sec-resources/private-keys-v1.d/C072AF82DCCCB9A7F1B85FFA10B802DC4ED16703.key
emacs-28.1/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el
Without this patch, extracting a tarball on Solaris 10 fails with
many diagnostics like “tar: ././@LongLink: typeflag 'L' not
recognized, converting to regular file”.
Paul Eggert [Sat, 25 Jun 2022 18:00:28 +0000 (13:00 -0500)]
Pacify Oracle Studio re xterm.c
* src/xterm.c (xErrorHandler, xIOErrorHandler):
New typedefs.
(xm_get_drag_window_1, x_connection_closed): Use them instead of
void *, since the C standard frowns on converting function
pointers to and from void *. This pacifies Oracle Studio
diagnostics like “warning: assignment type mismatch: pointer to
void "=" pointer to function(pointer to struct _XDisplay {})\
returning int”.
(x_detect_pending_selection_requests, x_had_errors_p): Do not rely
on implicit conversion of a pointer to a bool return value; use !!
instead. This pacifies Oracle Studio’s “warning: improper
pointer/integer combination: op "="”.
(xim_open_dpy) [HAVE_X11R6 && !HAVE_X11R6_XIM]: Do not use
xim_destroy_callback; configure.ac says “inoue@ainet.or.jp says
Solaris has a bug related to X11R6-style ## XIM support” and
Oracle Studio complains “warning: assignment type mismatch:
pointer to function(pointer to struct _XIC {}, pointer to char,
pointer\ to char) returning void "=" pointer to function(pointer
to struct _XIM {}, pointer to char, pointer to char) returning
void”.
Paul Eggert [Sat, 25 Jun 2022 16:44:33 +0000 (11:44 -0500)]
Pacify Oracle Studio re print_vectorlike
* src/print.c (print_vectorlike): Use explicit cast of function
pointer to void *, to pacify Oracle Studio 12.6’s “warning:
assignment type mismatch: pointer to void "=" pointer to
function(pointer to void) returning void”. Admittedly this is
not strictly conforming C code even with the cast.
Po Lu [Sat, 25 Jun 2022 12:07:35 +0000 (20:07 +0800)]
Update input_pending after deferring selection requests
* src/xterm.c (x_defer_selection_requests): If kbd_fetch_ptr
moved, update input_pending. Bug found calling
`input-pending-p' inside the DND movement function.
Stefan Kangas [Sat, 25 Jun 2022 10:55:15 +0000 (12:55 +0200)]
New command recentf-open
* lisp/recentf.el (recentf-open): New command. (Bug#56148)
(recentf): New alias.
(recentf, recentf-mode): Update documentation to focus more on the
list of recently opened files and ways of accessing it, instead of
focusing on the menu bar only.
(recentf-list, recentf-enabled-p): Minor doc fixes.
Stefan Kangas [Sat, 25 Jun 2022 10:25:58 +0000 (12:25 +0200)]
Don't error out on invalid literal key substitutions
It would be backwards-incompatible to error out on invalid literal key
substitutions. Consider this docstring fragment, where "\\`" should
have been escaped but wasn't:
If we error out, we can't display this docstring at all. However, it
is clearly better to display something in such cases, even if
suboptimal, than refusing to display anything at all.
* lisp/help.el (substitute-command-keys): Don't error out on invalid
literal key substitutions: just ignore them instead.
* test/lisp/help-tests.el
(help-tests-substitute-command-keys/literal-key-sequence-errors):
Delete test.
(help-tests-substitute-command-keys/literal-key-sequence-ignore-invalid):
New test.
* lisp/term/haiku-win.el (require):
* lisp/progmodes/elisp-mode.el (require):
* lisp/isearch.el (require): Require subr-x at compile time, since
these use defsubsts/macros from there.
* lisp/emacs-lisp/subr-x.el (string-empty-p): Move from here...
* lisp/simple.el (string-empty-p): ... to here. This is to help
with a build problem where files.el is using the defsubst, but
requiring subr-x.el at compile time leads to load errors.
Po Lu [Sat, 25 Jun 2022 07:34:43 +0000 (07:34 +0000)]
Implement image transform smoothing on Haiku
* src/dispextern.h (struct image): New field
`use_bilinear_filtering'.
* src/haiku_draw_support.cc (BView_DrawBitmap): Accept it.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_draw_image_glyph_string):
* src/image.c (image_set_transform): Set it.
Po Lu [Sat, 25 Jun 2022 06:20:57 +0000 (06:20 +0000)]
Implement "flip" image transforms on Haiku
* src/dispextern.h (struct image): New field `transform',
`original_width' and `original_height'.
* src/haiku_draw_support.cc (BView_DrawMask): Rename to
`be_draw_image_mask' and fix coding style.
(rotate_bitmap_270, BBitmap_transform_bitmap, rotate_bitmap_90):
Delete functions.
(be_apply_affine_transform): New function.
(be_apply_inverse_transform): New function.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_translate_transform): New function.
(haiku_draw_image_glyph_string): Use affine transforms to
implement images.
* src/image.c (image_set_transform): Implement using affine
transforms on Haiku too.
* lisp/simple.el (execute-extended-command-cycle): New command.
(read-extended-command): Use it to allow toggling (bug#47215).
(read-extended-command-1): Renamed from `read-extended-command'.
(execute-extended-command-for-buffer): Factored out most of the
code...
(command-completion--command-for-this-buffer-function): ... to
here.
(extended-command-versions): New variable.
This code is based on a patch by Felician Nemeth
<felician.nemeth@gmail.com>.
Timo Taipalus [Fri, 24 Jun 2022 12:44:02 +0000 (14:44 +0200)]
Add support for image flipping
* lisp/image.el (image-map): Keybindings for flipping functions.
(image-flip-horizontally): New function that toggles image flipping
property.
(image-flip-vertically): New function that toggles image flipping
property and rotates image 180 degrees.
* src/image.c (syms_of_image): Add property.
(image_set_transform): Modify image rotation code to also horizontally
flip the image when the property is set.
* etc/NEWS: Add description.
* doc/lispref/display.texi (Image Descriptors): Document :flip
(bug#47095).
This is a cosmetic change only; there is no change in behaviour.
* lisp/emacs-lisp/bytecomp.el:
* src/bytecode.c (BYTE_CODES, exec_byte_code):
Update and/or remove incorrect, outdated or useless comments.
Clarify. Reorder where appropriate. Rename Bsave_current_buffer to
Bsave_current_buffer_OBSOLETE and Bsave_current_buffer_1 to
Bsave_current_buffer, reflecting the state since 1996.
* lisp/loadup.el ("emacs-lisp/seq"): Preload seq since it's now
almost impossible to do anything in Emacs that doesn't result in
seq being loaded -- for instance, visiting a .txt file or an .el
file, so this will speed up Emacs usage for basically everybody.
Allow read-multiple-choice to do long-form answers
* doc/lispref/commands.texi (Reading One Event): Document it.
* lisp/emacs-lisp/rmc.el (read-multiple-choice): Allow using
long-form answers instead of single character ones.
(read-multiple-choice--long-answers): New function.
(read-multiple-choice--short-answers): Refactored out from the
main function.
* lisp/sqlite-mode.el (require):
* lisp/net/eudc.el (require):
* lisp/arc-mode.el (require): Require subr-x, since these files
are using macros from there.
* lisp/emacs-lisp/subr-x.el (with-memoization): Move from here...
* lisp/subr.el (with-memoization): ... to here, as it's used from
the preloaded cl-generic.el file.
* lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Don't use
the autoloaded `byte-compile' function during bootstrap.
(cl--generic-get-dispatcher): Don't require subr-x, either.
cl-generic has been preloaded since 2015, and most usages of it (in
preloaded files) work fine. In particular, using `cl-defgeneric' is
unproblematic. However, `cl-defmethod' would end up pulling in the
byte compiler (at load time), which would make it impossible to use
`cl-defmethod' in pre-loaded files, and this change fixes that (but
possibly not in the most self-evidently correct way).
Make warning about require/autoload while bootstrapping not error out
* src/fns.c (Frequire):
* src/eval.c (Fautoload_do_load): Avoid further errors while
outputting the error about not being able to autoload/require
while bootstrapping.
Eli Zaretskii [Fri, 24 Jun 2022 07:44:44 +0000 (10:44 +0300)]
Merge branch 'abort-redisplay'
This allows abandoning the redisplay of a window
that takes too long to complete. Bug#45898
* src/xdisp.c (update_redisplay_ticks): New function.
(init_iterator, set_iterator_to_next): Call
'update_redisplay_ticks'.
(syms_of_xdisp) <max_redisplay_ticks>: New variable.
<list_of_error>: Remove 'void-variable': it is no longer needed,
since 'calc_pixel_width_or_height' can no longer signal a
void-variable error, and it gets in the way of aborting
redisplay via 'redisplay_window_error'.
* src/keyboard.c (command_loop_1): Reinitialize the tick count
before executing each command in the loop.
* src/syntax.c (scan_sexps_forward): Call 'update_redisplay_ticks'
after finishing the loop.
* src/dispnew.c (make_current): Make sure enabled rows of the
current matrix have a valid hash, even if redisplay of a window
was aborted due to slowness. This avoids assertion violations in
'scrolling_window' due to the wrong hash value.
* src/xdisp.c (display_working_on_window_p): New global variable.
(unwind_display_working_on_window): New function.
* src/keyboard.c (command_loop_1): Reset
'display_working_on_window_p' before and after executing commands.
* src/window.c (Frecenter, window_scroll, displayed_window_lines):
* src/indent.c (Fvertical_motion): Set
'display_working_on_window_p' before calling 'start_display'.
* src/syntax.c (scan_sexps_forward): Call 'update_redisplay_ticks'
after finishing the loop.
* src/regex-emacs.c (re_match_2_internal):
* src/bidi.c (bidi_find_bracket_pairs, bidi_fetch_char)
(bidi_paragraph_init, bidi_find_other_level_edge): Update the
redisplay tick count as appropriate, when moving the iterator by
one character position actually requires to examine many more
positions.
* src/xdisp.c (redisplay_window_error): Show messages about
aborted redisplay of a window as delayed-warnings.
* doc/emacs/trouble.texi (DEL Does Not Delete): Move to the end of
the chapter. This issue is no longer frequent or important as it
was back in Emacs 20 days.
(Long Lines): Document 'max-redisplay-ticks'.
* doc/emacs/emacs.texi (Top): Update the detailed menu.
Po Lu [Fri, 24 Jun 2022 01:49:14 +0000 (09:49 +0800)]
Simplify XI event state conversion
* src/xterm.c (xi_convert_button_state, xi_convert_event_state):
New functions.
(handle_one_xevent): Reduce duplicate code for converting XI
state and button state into X state.
Po Lu [Thu, 23 Jun 2022 03:31:10 +0000 (11:31 +0800)]
Don't send XdndPosition before XdndStatus arrives
* src/xterm.c (x_dnd_send_position): Set pending DND message if
target is right.
(x_dnd_send_leave): Clear pending status target.
(x_dnd_begin_drag_and_drop): Clear new flags.
(handle_one_xevent): Respect those flags.
Richard Hansen [Thu, 16 Jun 2022 19:21:57 +0000 (15:21 -0400)]
bindat (strz): Null terminate fixed-length strings if there is room
* lisp/emacs-lisp/bindat.el (bindat--pack-strz): For fixed-length strz
fields, explicitly write a null terminator after the packed string if
there is room (bug#56048).
* doc/lispref/processes.texi (Bindat Types): Update documentation.
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc):
Update tests.
Richard Hansen [Mon, 30 May 2022 01:23:57 +0000 (21:23 -0400)]
; bindat (strz): Move all pack logic to pack function (bug#56048)
Motivation/rationale:
* Improve code readability. Now `bindat--pack-strz` is used for all
`strz` packing, not just variable-length `strz` packing.
* Make it easier to change the behavior of fixed-length `strz`
packing without also affecting the behavior of `str` packing. (A
future commit will modify `strz` to write a null terminator if
there is room.)
Po Lu [Wed, 22 Jun 2022 01:49:16 +0000 (09:49 +0800)]
Fix setting user time for mouse movement events
* src/xterm.c (x_note_mouse_movement, XTmouse_position)
(x_scroll_bar_note_movement, handle_one_xevent): Record whether
or not mouse movement was send_event before using the mouse
movement time.
* src/xterm.h (struct x_display_info): New field
`last_mouse_movement_time_send_event'.
Timothee Denizou [Tue, 21 Jun 2022 19:50:15 +0000 (21:50 +0200)]
Allow different randomization of shapes in Tetris
* lisp/play/tetris.el (tetris-allow-repetitions): New user option.
(tetris--shuffle, tetris--seven-bag): New functions.
(tetris-new-shape): Use the option.
* Added 7 bag randomizer for tetris
A piece is selected from the bag and removed each time we want a piece
When the bag is empty, refill the bag with the seven piece and shuffle it
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload):
Add `iter-defun' and `cl-iter-defun' to the list of "complex cases"
that are macro-expanded and recursed on.
Philipp Stephani [Tue, 21 Jun 2022 17:10:14 +0000 (19:10 +0200)]
Document and test 'no-byte-compile' behavior.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Document behavior
if 'no-byte-compile' is set.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-compile-file/no-byte-compile): New unit test.
* test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el: New test
file.