Robert Pluim [Wed, 4 May 2022 15:09:07 +0000 (17:09 +0200)]
Allow the use of poll instead of select
Increase the maximum number of open files allowed to
10 x FD_SETSIZE (which is what poll is limited to on macOS).
* configure.ac (--with-poll): New option, default off, for requesting
'poll' support. Check for "sys/poll.h" header.
(USE_POLL): New variable.
(EMACS_CONFIG_FEATURES): Add USE_POLL.
* etc/NEWS: Document --with-poll.
* src/sysselect.h: New define EMACS_MAX_FD, defaulting to FD_SETSIZE,
for the maximum number of file descriptors Emacs can use.
* src/process.c:
* src/sysdep.c:
* src/nsterm.m (ns_select_1):
(applicationDidFinishLaunching): Use EMACS_MAX_FD instead of
FD_SETSIZE everywhere.
* src/syspoll.h (SYSPOLL_H): New file for definitions related to use
of 'poll'.
* src/sysselect.h [USE_POLL]: Set EMACS_MAX_FD to 10 x FD_SETSIZE.
(emacs_fd_set) [USE_POLL]: New type, used for bitsets of file
descriptors.
(FD_CLR, FD_ISSET, FD_SET, FD_ZERO) [USE_POLL]: Macros for
manipulating bitsets.
[USE_POLL]: Include "syspoll.h".
* src/process.c (fd_sets_to_pollfds) [USE_POLL]: New function.
Converts two 'emacs_fd_set' to an array of 'struct pollfd'
(pollfds_to_fd_sets) [USE_POLL]: New function.
Converts from an array of 'struct pollfd' to two 'emacs_fd_set'.
(timespec_to_timeout) [USE_POLL]: New function, converts a 'struct
timespec' to a timeout in milliseconds.
(emacs_pselect) [USE_POLL]: Replacement for 'pselect' that calls
'poll' and does the appropriate conversions. Does not support
sigmask.
Po Lu [Thu, 5 May 2022 09:46:05 +0000 (09:46 +0000)]
Speed up opening fonts on Haiku
* src/font.h (font_property_index): Note that some font drivers
use the extra data in a font entity to store driver-specific
information.
* src/haiku_font_support.cc (BFont_find): Set font indices.
(be_open_font_at_index): New function.
(BFont_open_pattern): Clean up coding style.
* src/haiku_support.h (enum haiku_font_specification)
(struct haiku_font_pattern): New fields and specifications for
indices.
* src/haikufont.c (haikufont_pattern_to_entity, haikufont_open):
Use indices to open fonts if available in the extra data.
Po Lu [Thu, 5 May 2022 07:55:33 +0000 (15:55 +0800)]
Improve appearance of macOS font panel buttons
* src/nsterm.m (ns_create_font_panel_buttons):
([EmacsView noteUserCancelledSelection]): New functions.
([EmacsView showFontPanel]): Use those buttons instead.
Michael Albinus [Thu, 5 May 2022 07:54:31 +0000 (09:54 +0200)]
Add Tramp test
* test/lisp/net/tramp-tests.el (tar-mode): Require.
(tramp-test10-write-region-other-file-name-handler): New test.
(tramp-test31-interrupt-process, tramp-test31-signal-process):
Tag them :unstable unconditionally.
* test/lisp/net/tramp-resources/foo.tar.gz: New resource file.
Po Lu [Thu, 5 May 2022 04:58:47 +0000 (04:58 +0000)]
Take size into account when previewing fonts on Haiku
* src/haiku_support.cc (MessageReceived): Decode size sent and
handle `UPDATE_PREVIEW_DIALOG' message.
(UpdatePreview): Add current size.
(EmacsFontSelectionDialog): Assign correct modification messages
to the size entry.
Po Lu [Thu, 5 May 2022 03:10:30 +0000 (03:10 +0000)]
Allow displaying font preview on Haiku
* src/haiku_support.cc (class EmacsFontPreviewDialog)
(class DualLayoutView): New classes.
(class EmacsFontSelectionDialog): Add field for preview,
checkbox and layout view.
(MessageReceived): Handle new font preview messages.
(EmacsFontSelectionDialog): New constructor.
(FrameResized): Resize the layout view instead.
Eric Abrahamsen [Wed, 4 May 2022 19:54:37 +0000 (12:54 -0700)]
Remove bogus mode check from gnus topic update functions
* lisp/gnus/gnus-topic.el (gnus-topic-update-topics-containing-group):
(gnus-topic-update-topic): These functions originally checked to see
if we were in group mode, but later that check was changed to
'gnus-topic-mode, which never passes because 'gnus-topic-mode isn't a
major mode. Revert to checking for 'gnus-group-mode, and use
`derived-mode-p' while we're at it.
Juri Linkov [Wed, 4 May 2022 19:32:30 +0000 (22:32 +0300)]
* lisp/tab-bar.el: Use pixel-based alignment (bug#55207)
* lisp/tab-bar.el (tab-bar-format-align-right): Use string-pixel-width
on the string with tab-bar face to get the width in pixels to align.
(tab-bar-format-global): Remove string-trim-right to keep padding-right.
Robert Pluim [Wed, 4 May 2022 12:35:59 +0000 (14:35 +0200)]
* doc/emacs/killing.texi: Fix typos
* doc/emacs/killing.texi (Clipboard): Fix wording in description of
'save-interprogram-paste-before-kill'. Ensure the reference to
"Yanking Media" is not split over two lines.
Eli Zaretskii [Wed, 4 May 2022 09:04:53 +0000 (12:04 +0300)]
Fix restoring desktop from TTY-saved sessions
* lisp/frameset.el (frameset-restore): Don't override/fix position
of the restored frames for which we have geometry information
saved by a past GUI session. (Bug#55070)
Po Lu [Wed, 4 May 2022 08:48:24 +0000 (16:48 +0800)]
Turn on XInput 2 support by default
The support doesn't interfere with compatibility, since Emacs
built with XInput 2 support transparently falls back to Core
Input when a suitable version of the input extension is not
available. It also matured much sooner than expected, so
enabling this by default will lead to new features being
available to more users.
* INSTALL:
* configure.ac:
* etc/NEWS: Enable XInput 2 support by default.
Po Lu [Wed, 4 May 2022 05:46:24 +0000 (05:46 +0000)]
Set initial size in the Haiku font dialog
* src/haiku_support.cc (class EmacsFontSelectionDialog)
(EmacsFontSelectionDialog): New argument `initial_size'.
(be_select_font): Likewise.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): Set font dialog size to the
pixel size of the current font.
Sean Whitton [Wed, 4 May 2022 01:08:14 +0000 (18:08 -0700)]
server-execute: Initialize the *scratch* buffer
* lisp/server.el: Require subr-x when compiling.
(server-execute): Initialize the *scratch* buffer in the same way that
the scratch-buffer command does, for consistency.
Stefan Monnier [Tue, 3 May 2022 19:35:47 +0000 (15:35 -0400)]
with-buffer-unmodified-if-unchanged: Tweak the implementation
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
Skip the hash if the buffer was not modified at all.
Use `restore-buffer-modified-p`.
Also mention that it's imperative that the current buffer is preserved.
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
New macro.
* lisp/textmodes/fill.el (fill-paragraph): Macro code copied from
here. Adjust and use the macro.
* lisp/tool-bar.el (tool-bar-keymap-cache): Make into a non-weak
EQ hash table, which should be faster and not lose the contents
after a GC (bug#43397).
(tool-bar--flush-cache, tool-bar-make-keymap): Use the terminal
only as the key.
(tool-bar-local-item, tool-bar-local-item-from-menu): Flush the
cache after altering the tool bar.
Eli Zaretskii [Tue, 3 May 2022 16:29:03 +0000 (19:29 +0300)]
Allow desktop to restore frames and windows on TTY frames
* lisp/frameset.el (frameset-persistent-filter-alist): Add 'top',
'left', 'bottom', and 'right' to frame parameters that are shelved
and unshelved when switching from GUI to TTY frames and vice
versa.
(frameset--restore-frame): Accept two optional arguments DX and
DY, and offset by them each frame restored from TTY desktop, to
make such restored frames more prominently visible. Force such
frames to be visible on GUI display, since the visibility
parameter is meaningless for TTY frames.
(frameset-restore): Pass DX and DY offsets to
'frameset--restore-frame', when restoring TTY frames on GUI
display.
* lisp/desktop.el (desktop-restore-frameset): Pass the
:force-onscreen argument of 'frameset-restore' as nil when
restoring frames on text-mode display.
(desktop-restore-forces-onscreen): Document that this option has
no real effect on restoring frames on text-mode display.
(desktop-restoring-frameset-p): Allow restoring frames in non-GUI
sessions, but disallow that when the selected frame is the
daemon's initial frame. (Bug#55070)
Jim Porter [Mon, 2 May 2022 23:56:49 +0000 (16:56 -0700)]
Improve the behavior of concatenating parts of Eshell arguments
Previously, concatenating a list to a string would first convert the
list to a string. Now, the string is concatenated with the last
element of the list.
* lisp/eshell/esh-util.el (eshell-to-flat-string): Make obsolete.
* lisp/eshell/esh-arg.el (eshell-concat, eshell-concat-1): New
functions.
(eshell-resolve-current-argument): Use 'eshell-concat'.
* test/lisp/eshell/esh-var-tests.el (esh-var-test/interp-concat-cmd):
Add check for concatenation of multiline output of subcommands.
(esh-var-test/quoted-interp-concat-cmd): New test.
* test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-13): Use
'eshell-concat'.
* doc/misc/eshell.texi (Expansion): Document this behavior.
* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Add MODIFIER-P
argument and adjust how 'eshell-convert' and 'eshell-apply-indices'
are called.
(eshell-get-variable, eshell-apply-indices): Add QUOTED argument.
* doc/misc/eshell.texi (Arguments): Expand this section, and document
the new behavior.
(Dollars Expansion): Provide more detail about '$(lisp)' and
'${command}' forms.
* etc/NEWS (Eshell): Announce this change (bug#55236).
* lisp/keymap.el (key-parse): Move the read-kbd-macro compat code
from here...
* lisp/subr.el (kbd): ... to here. (And fix the logic, too.)
This allows `key-parse' to have a less puzzling result while
maintaining backwards compatibility (bug#38775).
* lisp/progmodes/sql.el (sql-starts-with-prompt-re): Remove.
(sql-ends-with-prompt-re): Remove
(sql-interactive-remove-continuation-prompt): Delete prompts from
anywhere in the process output, not just at the beginning of current
string. Streamline logic, describe it in docstring.
* test/lisp/progmodes/sql-tests.el: Add tests
Glenn Morris [Tue, 3 May 2022 01:26:22 +0000 (18:26 -0700)]
Don't leave temp files behind from undigest-tests
Sadly the "temp" in with-temp-file refers to a buffer, not a file.
* test/lisp/mail/undigest-tests.el (rmail-undigest-test-rfc934-digest)
(rmail-undigest-test-rfc1153-digest-strict)
(rmail-undigest-test-rfc1153-less-strict-digest)
(rmail-undigest-test-rfc1153-sloppy-digest)
(rmail-undigest-test-rfc1521-mime-digest)
(rmail-undigest-test-multipart-mixed-digest):
Delete temporary files at end.
Po Lu [Tue, 3 May 2022 01:22:06 +0000 (09:22 +0800)]
Clean up X11 double buffering code
This fixes several latent bugs where code went down the path
with double buffering enabled when it wasn't, and vice versa.
* src/xfns.c (x_set_inhibit_double_buffering): Improve
commentary and only define when HAVE_XDBE.
(x_mark_frame_dirty): Only set buffer flip flag when HAVE_XDBE.
(initial_set_up_x_back_buffer): Clean up coding style and remove
unnecessary block_input pair.
(Fx_double_buffered_p): Always return nil if !HAVE_XDBE.
(x_frame_parm_handlers): Don't set double buffering handler if
!HAVE_XDBE.
* src/xftfont.c (xftfont_drop_xrender_surfaces, xftfont_driver):
Only define when XDBE is available.
* src/xterm.c (x_drop_xrender_surfaces): Likewise.
(x_clear_window): Don't test double buffering flags when
!HAVE_XDBE.
(show_back_buffer): Only define when HAVE_XDBE.
(x_flip_and_flush): Don't try to flip when !HAVE_XDBE.
(XTframe_up_to_date): Likewise.
(XTbuffer_flipping_unblocked_hook): Only define when Xdbe is
available.
(x_clear_area): Don't test double buffering flags when Xdbe is
not available.
(flush_dirty_back_buffer_on): Don't define if there's no DBE.
(handle_one_xevent, x_create_terminal): Likewise.
* lisp/subr.el (when, unless): Remove the (fn...) bits from the
doc string, because the advertised calling convention is correct
the way it is (bug#27229). This also makes eldoc highlight the
arguments correctly.
Stefan Kangas [Mon, 2 May 2022 10:03:08 +0000 (12:03 +0200)]
Fix handling double-click-time nil or t
* lisp/mouse.el (mouse-double-click-time): New function to always
return a number for `double-click-time'.
* lisp/emulation/viper-mous.el (viper-multiclick-timeout):
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/help.el (help--read-key-sequence):
* lisp/org/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.
* src/keyboard.c (syms_of_keyboard): Mention
'mouse-double-click-time' in doc string of 'double-click-time'.
* test/lisp/mouse-tests.el (mouse-test-mouse-double-click-time):
New test.
Po Lu [Mon, 2 May 2022 08:46:04 +0000 (08:46 +0000)]
Fix handling of some weights in the Haiku font driver
* src/haiku_font_support.cc (font_style_to_flags):
* src/haiku_support.h (enum haiku_font_weight):
* src/haikufont.c (haikufont_weight_to_lisp)
(haikufont_lisp_to_weight): Make `ultralight' and `extralight'
mean the same thing.
Po Lu [Mon, 2 May 2022 05:48:48 +0000 (05:48 +0000)]
Default to currently selected font in Haiku font dialogs
* src/haiku_font_support.cc (be_find_font_indices): New
function.
* src/haiku_support.cc (class EmacsFontSelectionDialog)
(UpdateStylesForIndex, EmacsFontSelectionDialog): Allow
specifying an initial font family and style.
(be_select_font): New parameters `initial_family' and
`initial_style'.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (haikufont_lisp_to_weight)
(haikufont_lisp_to_slant, haikufont_lisp_to_width): Handle
`regular'.
(haikufont_pattern_from_object): New function.
(haikufont_spec_or_entity_to_pattern): Fix coding style.
(Fx_select_font): Compute indices based on currently selected
font.
(syms_of_haikufont): New defsyms.