João Távora [Thu, 20 Oct 2022 10:42:25 +0000 (11:42 +0100)]
Revert "eglot.texi: Make example more realistic"
This quest for realism ignores the fact that a previous example for a
hypothetical language Foo and a language server "fools" already
exists. It also undermines the intended generality of the
instructions.
João Távora [Thu, 20 Oct 2022 10:20:30 +0000 (11:20 +0100)]
Fix Eglot manual's description of eglot-workspace-configuration
* doc/misc/eglot.texi (Customizing Eglot)
(eglot-workspace-configuration): Explain that plist may be
arbitrarily complex and correctly identify nil as the Elisp
equivalent to JSON null.
Mauro Aranda [Thu, 20 Oct 2022 10:34:38 +0000 (07:34 -0300)]
Improve HERE document detection in perl-mode
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Detect indented HERE documents when using a bare identifier.
(perl--syntax-exp-intro-keywords): Recognize HERE documents that come
after die, warn and eval.
(perl--syntax-exp-intro-regexp): Identify HERE documents when printing
to a filehandle with printf? and when they appear after a fat comma.
* test/lisp/progmodes/cperl-mode-resources/here-docs.pl: Add more tests.
Alan Mackenzie [Wed, 19 Oct 2022 14:52:14 +0000 (14:52 +0000)]
CC Mode: Cease adding types to found-types too eagerly
This fixes bug #58537 and bug #58539.
* lisp/progmodes/cc-engine.el (c-forward-type): Remove trailing whitespace
from an identifier before passing it to c-add-type.
(c-forward-decl-or-cast-1): CASE 3: Do not recognize two consecutive
identifiers as type + variable/function unless certain conditions are met.
CASE 10: Do not recognize the "type" as a found type unless certain condtions
are met. (Near end): Do not recognize the identifier in a cast as a type
unless certain conditions are met.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Recognize being
in declaration parens when there is a syntactially wrong "foo ((bar))"
preceding the match position.
* lisp/progmodes/cc-mode.el (c-update-new-id): Set c-new-id-is-type
unconditionally to nil to prevent a second identifier being wrongly marked as
a type.
Po Lu [Wed, 19 Oct 2022 13:31:54 +0000 (21:31 +0800)]
Fix various builds
* src/xterm.c (x_handle_selection_monitor_event): Adjust for
build without XInput2.
(x_maybe_clear_preedit, xim_destroy_callback): Make conditional
on Release 6 XIM.
(x_get_keyboard_modifiers): Adjust for build without XCB.
Juri Linkov [Tue, 18 Oct 2022 18:13:29 +0000 (21:13 +0300)]
* lisp/outline.el (outline-minor-mode-insert-buttons): New defvar-local.
(outline--make-button-overlay, outline--insert-open-button)
(outline--insert-close-button): Insert button when
outline-minor-mode-insert-buttons is non-nil, otherwise
put an overlay with before-string. (bug#57813)
* lisp/help.el (describe-bindings): Set buffer-local
outline-minor-mode-insert-buttons to t.
* lisp/textmodes/emacs-news-mode.el (emacs-news--mode-common):
Set buffer-local outline-minor-mode-use-margins to t. Don't set
outline-regexp for leading spaces because now spaces are not added
in the NEWS buffer.
Juri Linkov [Tue, 18 Oct 2022 18:05:15 +0000 (21:05 +0300)]
* lisp/outline.el: Use one character wide strings for margins (bug#57813)
(outline-open-in-margins, outline-close-in-margins)
(outline-close-rtl-in-margins): Add 1-char emoji, symbol, text
for margins that are 1-column wide.
(outline-minor-mode): Force display of margins only for the selected buffer.
João Távora [Tue, 18 Oct 2022 13:46:27 +0000 (14:46 +0100)]
More minor fixes to doc/misc/eglot.texi
Most, if not all of these, were previously discussed with Eli.
* doc/misc/eglot.texi (Setting Up LSP Server): Fix repetition of
"This variable".
(Setting Up LSP Server): Explain that single a running instance
supports multiple major modes.
(Starting Eglot, Eglot and Buffers): Correctly describe mode-line indication.
(Eglot Features): Suggest that company-mode is just one of the
possible packages. Explain that Eglot arranges for the completion
package to "instantiate" snippets. Could have used "expand".
Mention benefits of having the popular markdown-mode available.
(Eglot Commands): Explain how eglot-reconnect and
eglot-clear-status are useful.
(Eglot Variables): Clarify when eglot-autoreconnect is useful.
Clarify how eglot-sync-connect and eglot-connect-timeout relate to
each other. Clarify semantics of
eglot-confirm-server-initiated-edits.
Jim Porter [Thu, 15 Sep 2022 19:24:37 +0000 (12:24 -0700)]
Improve handling of $PATH in Eshell for remote directories
* lisp/eshell/esh-util.el (eshell-path-env, eshell-parse-colon-path):
Make obsolete.
(eshell-path-env-list): New variable.
(eshell-connection-default-profile): New connection-local profile.
(eshell-get-path): Reimplement using 'eshell-path-env-list'; add
LITERAL-P argument.
(eshell-set-path): New function.
* lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add entry for
$PATH.
(eshell-var-initialize): Add 'eshell-path-env-list' to
'eshell-subcommand-bindings'.
* lisp/eshell/esh-ext.el (eshell-search-path): Use 'file-name-concat'
instead of 'concat'.
(eshell/addpath): Use 'eshell-get-path' and 'eshell-set-path'.
* lisp/net/tramp-integration.el: Only apply Eshell hooks when
'eshell-path-env-list' is unbound.
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/path-var/local-directory)
(esh-var-test/path-var/remote-directory, esh-var-test/path-var/set)
(esh-var-test/path-var/set-locally)
(esh-var-test/path-var-preserve-across-hosts): New tests.
* test/lisp/eshell/esh-ext-tests.el: New file.
* test/lisp/eshell/eshell-tests-helpers.el
(with-temp-eshell): Set 'eshell-last-dir-ring-file-name' to nil.
(eshell-tests-remote-accessible-p, eshell-last-input)
(eshell-last-output): New functions.
(eshell-match-output, eshell-match-output--explainer): Use
'eshell-last-input' and 'eshell-last-output'.
Jim Porter [Mon, 26 Sep 2022 04:47:26 +0000 (21:47 -0700)]
Allow setting the values of variable aliases in Eshell
This makes commands like "COLUMNS=40 some-command" work as expected.
* lisp/eshell/esh-cmd.el (eshell-subcommand-bindings): Remove
'process-environment' from here...
* lisp/eshell/esh-var.el (eshell-var-initialize): ... and add to here,
along with 'eshell-variable-aliases-list'.
(eshell-inside-emacs): Convert to a 'defvar-local' to make it settable
in a particular Eshell buffer.
(eshell-variable-aliases-list): Make $?, $$, and $* read-only and
update docstring.
(eshell-set-variable): New function...
(eshell-handle-local-variables, eshell/export, eshell/unset): ... use
it.
(eshell/set, pcomplete/eshell-mode/set): New functions.
(eshell-get-variable): Get the variable alias's getter function when
appropriate and use a safer method for checking function arity.
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)