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.
Po Lu [Mon, 2 May 2022 01:32:54 +0000 (09:32 +0800)]
Make the NS font dialog return more correct values
* src/nsfns.m (Fx_select_font): Update doc string.
* src/nsterm.m (ns_font_desc_to_font_spec): New
function.
([EmacsView showFontPanel]): Return selected font as a
font spec instead.
Jim Porter [Mon, 28 Mar 2022 05:28:40 +0000 (22:28 -0700)]
Use a common set of string delimiters for all Eshell predicates/modifiers
* lisp/eshell/em-pred.el (eshell-pred-delimiter-pairs): New variable.
(eshell-get-comparison-modifier-argument)
(eshell-get-numeric-modifier-argument)
(eshell-get-delimited-modifier-argument): New functions...
(eshell-pred-user-or-group, eshell-pred-file-time)
(eshell-pred-file-links, eshell-pred-file-size)
(eshell-pred-substitute, eshell-join-memebers, eshell-split-members):
... and use them here.
(eshell-include-members): Pass 'mod-char' and use
'eshell-get-delimited-modifier-argument'.
(eshell-pred-file-type, eshell-pred-file-mode): Use 'when-let'.
(eshell-modifier-alist): Pass modifier char to
'eshell-include-members'.
* test/lisp/eshell/em-pred-tests.el
(em-pred-test/predicate-delimiters): New test.
(em-pred-test/predicate-uid, em-pred-test/predicate-gid,
em-pred-test/modifier-include, em-pred-test/modifier-exclude): Remove
cases covered by 'em-pred-test/predicate-delimiters'.
(em-pred-test/modifier-substitute): Add test cases for new delimiter
styles.
* doc/misc/eshell.texi (Argument Predication and Modification):
Explain how string parameters are delimited.
(Argument Modifiers): Document some special delimiter behavior with
the 's/PATTERN/REPLACE/' modifier (bug#55204).
* etc/NEWS: Announce this change, and move the
'eshell-eval-using-options' entry to the Eshell section.
Po Lu [Sun, 1 May 2022 13:39:33 +0000 (21:39 +0800)]
Replace NS code that implemented font panels in a different way
* doc/emacs/macos.texi (Mac / GNUstep Events): Document removal
of `ns-change-font' event. The font panels are now implemented
normally, via `x-select-font'.
Don't enter the debugger from *Backtrace* or edebug on eval errors
* doc/lispref/debugging.texi (Error Debugging): Document it.
* doc/lispref/edebug.texi (Edebug Eval): Mention it.
* lisp/emacs-lisp/debug.el (debug-allow-recursive-debug): New user
option (bug#36145).
(debugger-eval-expression): Use it.
Make scroll-other-window respect target window remappings
* lisp/window.el (scroll-other-window, scroll-other-window-down):
Moved from window.c and change implementation so that they respect
command remappings in the target window (bug#20236).
Po Lu [Sun, 1 May 2022 08:53:51 +0000 (08:53 +0000)]
Improve display of Haiku font dialog
* src/haiku_support.cc (EmacsFontSelectionDialog)
(class EmacsFontSelectionDialog, FrameResized): Set minimum size
based on individual view dimensions and add label to size
control.
(BWindow_set_min_size): Delete function.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_update_size_hints): Stop setting min
size, since that doesn't work correctly on Haiku.
Po Lu [Sun, 1 May 2022 05:41:33 +0000 (05:41 +0000)]
Allow specifying font size in the Haiku font selection dialog
* src/haiku_support.cc (struct font_selection_dialog_message):
New fields `size' and `size_specified'.
(class EmacsFontSelectionDialog): New `size_entry' control.
(MessageReceived): Set size from that control if available.
(EmacsFontSelectionDialog): Initialize that control.
(FrameResized): Handle layout for that control.
(be_select_font): New field `size'.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): Populate font spec with
size.
Po Lu [Sun, 1 May 2022 03:20:58 +0000 (03:20 +0000)]
Allow quitting inside font selection dialogs on Haiku
* src/haiku_support.cc (WaitForChoice): Accept new function for
checking quit flag.
(be_select_font): Pass that function.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (haikufont_should_quit_popup): New function.
(Fx_select_font): Give said function to `be_select_font'.
Po Lu [Sun, 1 May 2022 01:37:12 +0000 (09:37 +0800)]
Fix processing events from multiple displays during DND
* src/xterm.c (x_next_event_from_any_display): New function.
Only used on no-toolkit builds.
(x_dnd_begin_drag_and_drop): Compute correct dpyinfo for
handle_one_xevent.
Po Lu [Sun, 1 May 2022 01:15:52 +0000 (09:15 +0800)]
Clean up X Windows tooltip code
* src/xfns.c (x_hide_tip): Remove "bloodcurdling hack".
* src/xterm.c (handle_one_xevent): Add a better version here
instead. The code is unlikely to be hit as well, since tooltip
frames are typically deleted, not just hidden.
Po Lu [Sun, 1 May 2022 00:59:55 +0000 (00:59 +0000)]
Implement font selection dialog on Haiku
* src/haiku_font_support.cc (font_style_to_flags): Handle style
allocation failures.
(be_font_style_to_flags): New function.
* src/haiku_support.cc (struct font_selection_dialog_message):
New struct.
(class EmacsFontSelectionDialog): New class.
(be_select_font): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (Fx_select_font): New function.
(syms_of_haikufont): Define new subr.
* lisp/subr.el (internal--build-binding)
(internal--build-bindings): Moved from subr-x.el and rewritten to
not use the threading macro.
(if-let*, when-let*, and-let*, if-let, when-let): Moved from
subr-x.el. This avoids breaking the build every time somebody
uses these macros in functions that end up being called during
bootstrap.