Jim Porter [Wed, 12 Oct 2022 05:11:04 +0000 (22:11 -0700)]
Add helpers to dynamically assign connection-local values
* lisp/files-x.el (connection-local-criteria)
(connection-local-profile-name-for-setq): New variables.
(with-connection-local-variables-1): ... let-bind them here.
(connection-local-update-profile-variables)
(connection-local-profile-name-for-criteria): New functions.
(with-connection-local-application-variables, setq-connection-local):
New macros.
* test/lisp/files-x-tests.el: Require 'tramp-integration'
(files-x-test--variable5, remote-lazy-var): New variables.
(files-x-test-hack-connection-local-variables-apply): Expand checks.
(files-x-test-with-connection-local-variables): Remove
'hack-connection-local-variables-apply' check (it belongs in the above
test), and expand some other checks.
(files-x-test--get-lazy-var, files-x-test--set-lazy-var): New
functions.
(files-x-test-connection-local-update-profile-variables)
(files-x-test-setq-connection-local): New tests.
* doc/lispref/variables.texi (Connection Local Variables): Split into
two subsections and document the new features.
Paul Eggert [Mon, 17 Oct 2022 04:35:47 +0000 (21:35 -0700)]
Improve ‘random’ doc re nonces
* doc/lispref/numbers.texi (Random Numbers): Improve coverage of
random seed, entropy pools, and why one shouldn’t use ‘random’ for
nonces. See Bug#58472.
Po Lu [Tue, 18 Oct 2022 00:52:01 +0000 (08:52 +0800)]
Fix bug#58584
* src/xterm.c (x_handle_selection_monitor_event): Return if
selection event is one Emacs asked for.
(handle_one_xevent): In that case, drop the event and don't let
it reach GTK.
Dmitry Gutov [Mon, 17 Oct 2022 23:33:43 +0000 (02:33 +0300)]
Follow-up fixes for vc-default-checkin-patch
* lisp/vc/vc.el (vc-default-checkin-patch):
Call vc-revert-file on buffer-file-name (vc-backend failed on
relative name sometimes). Delete the tmp dir after copying all
files back, not just the first one. Bug#52349,
https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01446.html.
Alan Mackenzie [Mon, 17 Oct 2022 20:33:26 +0000 (20:33 +0000)]
CC Mode: Don't fontify as types variables with the same names as struct tags
This fixes bug #58534.
* lisp/progmodes/cc-engine.el (c-forward-type): Only regard "struct" keywords
which create self contained types (e.g. C++'s "typename") as creating found
types.
* lisp/progmodes/cc-langs.el (c-self-contained-typename-kwds
(c-self-contained-typename-key): New language consts and variable.
Stefan Kangas [Mon, 17 Oct 2022 18:10:40 +0000 (20:10 +0200)]
Update version information in Gnus manual
* doc/misc/gnus.texi (Gnus Versions): Update with some information
from https://www.gnus.org/history.html
(Ma Gnus): Explain that Gnus is now developed together with
Emacs. (Bug#58161)
* test/lisp/emacs-lisp/comp-tests.el: Mark used native-compile
variables as special to pacify unknown lexvar warnings in the
default build.
(with-test-native-compile-prune-cache): Instrument macro arguments
for debugging and indent conventionally. Reindent all callers.
(test-native-compile-prune-cache/dont-delete-in-parent-of-cache):
Simplify file name expansion.
Po Lu [Mon, 17 Oct 2022 12:56:20 +0000 (20:56 +0800)]
Fix pieces of code being too expensive over slow network connections
* lisp/menu-bar.el (menu-bar-edit-menu): Test buffer-read-only
before gui-backend-selection-exists-p. This places the less
expensive condition before the more expensive one.
* src/xfns.c (compute_tip_xy): Use cached monitor attributes
whenever available.
(Fx_show_tip): Remove code that really did nothing.
(Fx_backspace_delete_keys_p): Do not download the entire keymap
from the server upon creating a frame.
* src/xmenu.c (create_and_show_popup_menu): Use
x_translate_coordinates_to_root.
(x_menu_show): Use x_translate_coordinates_to_root.
* src/xselect.c (Fx_selection_exists_p): If a temporary
selection owner can be found, use it.
* src/xterm.c (x_translate_coordinates_to_root)
(x_handle_selection_monitor_event, x_find_selection_owner): New
functions. These functions try to avoid downloading data from
the X server in places that are called very often (i.e. during
tool bar updates.)
(handle_one_xevent): Handle selection notify events. Also catch
some mistakes found. Fetch all kinds of key names as well.
(x_create_special_window): New function.
(x_term_init, x_delete_display): Ask for all key names. Also,
passively monitor selections that are given to
`x-selection-exists-p' during redisplay, so we do not have to
ask the server about them upon each redisplay.
(syms_of_xterm): New variable `x-fast-selection-list'.
* src/xterm.h (struct x_monitored_selection): New structure.
(X_INVALID_WINDOW): New define.
(struct x_display_info): New fields for selection monitoring.
Also, record the fixes extension base.
* lisp/emacs-lisp/comp.el (native--compile-async): Don't start the
async compilation if we didn't add anything. This avoids spurious
"Compilation finished" messages in the *Async* buffer when it
turned out that all the files we considered nativecomping were
skipped.
Avoid having the async compile log saying it's compiling loaddefs
* lisp/loadup.el (featurep): Define the hash table in nativecomp
builds (but not otherwise). A more natural place to define this
would be in comp.el, but comp.el isn't loaded yet when we load the
.elc file that updates comp--no-native-compile. We could change
the load order and move the definition to comp.el, though.
Dmitry Gutov [Sun, 16 Oct 2022 23:46:02 +0000 (02:46 +0300)]
Add default implementation for 'checkin-patch'
* lisp/vc/vc.el (vc-default-checkin-patch):
Add default implementation for 'checkin-patch' (bug#52349).
The first attempt was here:
https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg01464.html
kobarity [Sun, 16 Oct 2022 09:26:29 +0000 (11:26 +0200)]
Fix invalid search bound error in python-shell-completion-at-point
* lisp/progmodes/python.el (python-shell-completion-at-point): Add
check if point is before line-start.
* test/lisp/progmodes/python-tests.el (python-shell-completion-shell-buffer-1)
(python-shell-completion-shell-buffer-native-1): New tests
(bug#58548).
kobarity [Sun, 16 Oct 2022 09:15:22 +0000 (11:15 +0200)]
Disable completion when PDB is active in Python Shell buffer
* lisp/progmodes/python.el (python-shell-completion-at-point): Disable
completion in Python buffer when PDB is active in Python Shell buffer.
* test/lisp/progmodes/python-tests.el (python-shell-completion-pdb-1):
New test (bug#58562).
Stefan Kangas [Sun, 16 Oct 2022 06:27:16 +0000 (08:27 +0200)]
Merge from origin/emacs-28
067361f3a2 ; Improve documentation of 'C-M-i' fdb6f7cf26 ; Fix documentation of 'comp-enable-subr-trampolines' be30369e01 ; Avoid incorrect indentation in an @example. 4bd3dd505e Document how to control where the *.eln files are written b7d7c2d9e9 Add cross-reference to alternative syntaxes for Unicode
Po Lu [Sun, 16 Oct 2022 06:02:31 +0000 (14:02 +0800)]
Fix multiple sources of flicker under X
Fix three kinds of flicker. The first is if you do:
(while t (sit-for 1) (redraw-display))
and press a key, the frame will turn blank until you C-g. The
second is where handling async input happens in the middle of
drawing and causes a buffer flip to happen. The third is where
unmapping the hourglass window causes exposures.
* src/dispnew.c (redraw_frame): Garbage the frame if it is a
window system frame.
* src/xterm.c (x_update_begin): Clear complete flag.
(x_flip_and_flush, XTframe_up_to_date): Set complete flag.
(x_show_hourglass): Fix hourglass window class.
(flush_dirty_back_buffer_on): Rename to
x_flush_dirty_back_buffer_on.
(x_flush_dirty_back_buffer_on): Check if the frame is complete
before trying to flip.
(handle_one_xevent): Flush frames in a more detailed fashion.
* src/xterm.h (struct x_output): New flag `complete'.
(FRAME_X_COMPLETE_P): New macro.
Handle ;;;###theme-autoload comments in etc/themes
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--emacs-batch):
Extract the autoloads and have them loaded along with loaddefs.el.
* etc/NEWS: Mention the new feature. (Bug#57639)
Stefan Kangas [Sat, 15 Oct 2022 08:52:13 +0000 (10:52 +0200)]
Delete broken link to Network Theory Ltd.
Sadly, their website has been down for several months already.
I was unable to find a new link, but it seems like they haven't
published anything new for over a decade.
* doc/misc/org.org (Summary): Remove broken link to Network Theory Ltd.
Po Lu [Sat, 15 Oct 2022 08:25:22 +0000 (16:25 +0800)]
Remove redundant call to expensive function XOpenDisplay
* src/xterm.c (x_term_init): Speed up opening Emacs over a slow
network connection by an order of magnitude on no toolkit builds
by avoiding a redundant call to XOpenDisplay.
* test/manual/image-circular-tests.el
(image-test-duplicate-keywords): Skip unless images are supported.
(image-test-circular-plist, image-test-:type-property-value): Ditto.
Wrap only failing forms in should[-error] rather than entire test
bodies. Use simpler printed notation in place of function calls.
(image-test-circular-specs): Ditto. Wrap overly wide docstring.
Mark as failing since shortly after its introduction (bug#36403#63).
Eli Zaretskii [Fri, 14 Oct 2022 18:57:18 +0000 (21:57 +0300)]
Document how to control where the *.eln files are written
* doc/lispref/compile.texi (Native Compilation): Document the
trick of pointing $HOME to a non-existent directory.
(Native-Compilation Variables): Document the role of
'native-comp-eln-load-path' in determining where *.eln files are
written.
Alan Mackenzie [Fri, 14 Oct 2022 17:40:26 +0000 (17:40 +0000)]
Correctly fontify C++'s operator"" _tag (...)
Give both the "" and _tag font-lock-function-name-face. Also correct the
fontification of an inherited class name when there is an attribute between
the class name being declared and the colon introducing the inheritance.
* lisp/progmodes/cc-engine.el (c-forward-over-colon-type-list): New function.
(c-forward-keyword-clause): Use the above new function instead of a
looking-at.
(c-forward-name, c-forward-declarator): Accept both the "" and the tag as part
of the name.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Fontify the "" (which
already has font-lock-string-face) and the tag with
font-lock-function-name-face.
* lisp/progmodes/cc-langs.el (c-overloadable-operators): Add "" to this list.
(c-sub-colon-type-list-re): New lang-const and lang-var.
* lisp/files-x.el (modify-dir-local-variable): Add a 'no-byte-compile'
file local variable when generating a .dir-locals.el
file.
* .dir-locals.el: Add 'no-byte-compile'. (Bug#58486)
Po Lu [Fri, 14 Oct 2022 11:04:44 +0000 (19:04 +0800)]
Fix bug#56153
* src/nsterm.m (get_keysym_name)
(ns_draw_glyphless_glyph_string_foreground): Fix new Mac OS
deprecations.
([EmacsApp terminate:]): Use kbd_buffer_store_event instead
of emacs_event. (bug#56153)
([EmacsView windowDidChangeBackingProperties:]): Fix new Mac
OS deprecation.
Po Lu [Fri, 14 Oct 2022 07:52:16 +0000 (15:52 +0800)]
Avoid redundant creation of XRender pictures
* src/xterm.c (x_composite_image): Take arg DESTINATION. Do not
create a picture if it is set.
(x_draw_image_foreground, x_draw_image_foreground_1): Pass
destination where appropriate.
Fix misleading "File exists, but cannot be read" in browse-url-emacs
* src/fileio.c (Finsert_file_contents): Don't signal an error
about not being able to open the file when we're fetching things
via handlers -- in that case, modtime isn't necessarily set, and
if there's a handler, it should take care of this (bug#42431).
Stefan Monnier [Wed, 12 Oct 2022 21:06:33 +0000 (17:06 -0400)]
src/frame.c (do_switch_frame): Fix bug#58343
* src/frame.c (do_switch_frame): Move call to `get-mru-window` outside
of the "critical region" where (selected-window) != (frame-selected-window).
* src/minibuf.c (move_minibuffers_onto_frame): Add arg `frame`.
Use it instead of `selected_frame`. Adjust all callers.
* src/lisp.h (move_minibuffers_onto_frame): Adjust declaration.
Po Lu [Wed, 12 Oct 2022 12:40:03 +0000 (20:40 +0800)]
Improve makefile-imake-mode
* lisp/progmodes/make-mode.el
(makefile-imake-font-lock-keywords): Give Imake priority over
CPP keywords, and don't require comments to start at BOL.
(makefile-imake-mode): Set comment-start to some sensible value.
Po Lu [Wed, 12 Oct 2022 07:07:49 +0000 (15:07 +0800)]
Stop relying on Xt hack to set window manager hints
* src/widget.c (get_wm_shell): Return WMShellWidget.
(update_wm_hints, widget_update_wm_size_hints): Return whether
or not size hints changed.
* src/widget.h: Delete `size_switch'.
* src/widgetprv.h (EmacsFramePart): Likewise.
* src/xterm.c (x_wm_set_size_hint): Set size hints the usual way
if Xt did not set them. (bug#58412)