Jim Porter [Mon, 28 Nov 2022 06:21:10 +0000 (22:21 -0800)]
Make 'server-stop-automatically' into a defcustom
This changes the meaning of the (formerly internal) variable
'server-stop-automatically': it now always holds the requested
configuration, even when Emacs was not started as a daemon
(bug#59668).
* lisp/server.el (server-stop-automatically): Convert the variable to
a defcustom, and make the function simply set the defcustom.
(server-stop-automatically--timer): New variable.
(server-apply-stop-automatically): New function...
(server-stop, server-start): ... call it.
(server-save-buffers-kill-terminal): Adjust the conditions for
stopping automatically to account for the change of meaning for
'server-stop-automatically'.
(server-stop-automatically--handle-delete-frame): Remove unnecessary
test of the 'server-stop-automatically' option; this hook is only set
when it should do its job.
(server-stop-automatically--maybe-kill-emacs): Update docstring.
Sean Whitton [Wed, 7 Dec 2022 20:12:13 +0000 (13:12 -0700)]
Font lock Commit: and CommitDate: lines in Git logs
* lisp/vc/vc-git.el (vc-git-log-view-mode): Additionally recognize and
font lock Commit: and CommitDate: lines. This is relevant when, for
example, the user has added "--format=fuller" to vc-git-log-switches.
Po Lu [Wed, 7 Dec 2022 11:19:34 +0000 (19:19 +0800)]
Fix some more problems with running Emacs as untrusted
* etc/PROBLEMS (X security problems): Describe new variable.
* src/xfns.c (append_wm_protocols): Don't support ping when it
does not work.
* src/xterm.c (x_wm_supports_1): Don't support anything when
untrusted.
(x_term_init): Implement Vx_detect_server_trust.
(syms_of_xterm): New variable `x-detect-server-trust'.
* src/xterm.h (struct x_display_info): New field `untrusted'.
Stefan Kangas [Wed, 7 Dec 2022 05:30:51 +0000 (06:30 +0100)]
Merge from origin/emacs-29
9ae1c2762d7 EUDC: Outline deprecation plans in NEWS 6acf95cbea6 Fix admin/notes/tree-sitter/build-module/build.sh (bug#59... cc63c086971 * doc/misc/eww.texi (Overview): Improve introduction. b8790e320e1 Consistent fontification of using-directives in csharp-ts... 5257b9cda43 ; Rename c-ts-fontify-error to c-ts-mode--fontify-error c6b454df339 ; Improve docstring of c-ts-mode--fontify-variable 6187d001f28 Fontify some keywords in type face in c-ts-mode b3847c02083 ; Minor cleanup in treesit.c 40af27859e0 ; * lib-src/etags.c (escape_shell_arg_string): Minor doc ... 43b7e7efbf4 Fix etags builds on non-Windows non-MS-DOS machines 7e6d1d1c471 ; Fix last change in etags.c. 01a4035c869 Fix etags local command injection vulnerability ed4734405df Avoid crashes in a build --without-modules 70a2eb4a0b3 Fix 'add-display-text-property' when OBJECT is non-nil d58d1dd48ac Do not run slow tests on EMBA 9b9b39a2d89 Lisp reader undefined behaviour excision
* lisp/bs.el: Improve compatibility with previous version
* lisp/bs.el (bs-default-action-list):
Remove display-buffer-reuse-window.
Ask for a minimum height window, not maximum.
(bs-show-in-buffer): Create window here, and afterwards make
sure it's the only window showing the *bs-selection* buffer.
(bs--show-with-configuration): Move window creation to
bs-show-in-buffer.
(we removed those files in an earlier commit, because they are not
used anymore.)
Now it also more parameterized and builds typescript and tsx
separately.
* admin/notes/tree-sitter/build-module/build.sh (topdir)
(repo, sourcedir, grammardir): New variables.
(Build): Make it parametric.
(Copy out): Use absolute path.
Jim Porter [Fri, 2 Dec 2022 20:15:46 +0000 (12:15 -0800)]
; Remove dead code from 'server-stop-automatically--handle-delete-frame'
* lisp/server.el (server-stop-automatically--handle-delete-frame):
Since 'this-command' is never 'save-buffers-kill-terminal' in this
function, we can remove the second 'if' block and it's then-form,
leaving only the else-form. Additionally, remove the 'delete-frame'
call; it's not necessary, since we just killed Emacs on the prior
line.
Yuan Fu [Tue, 6 Dec 2022 08:15:30 +0000 (00:15 -0800)]
Fontify some keywords in type face in c-ts-mode
* lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Remove some keywords.
(c-ts-mode--type-keywords): New variables.
(c-ts-mode--font-lock-settings): New rule.
* lisp/bs.el: Adapt to modern display-buffer-alist window setup
* lisp/bs.el (bs--window-config-coming-from): Delete.
(bs-default-action-list): New user customizable option.
(bs--restore-window-config): Delete.
(bs-kill, bs-select, bs-select-other-window)
(bs-select-other-frame): Use `quit-window' instead.
(bs--show-with-configuration): Use `pop-to-buffer' to display
the "*buffer-selection*" buffer.
* src/lread.c (read_bool_vector, skip_lazy_string):
Replace `|` with `||` to explicitly introduce sequence points since
the variables, `length` and `nskip`, are mutated more than once.
The `|` was just a weak attempt at micro-optimisation in any case;
sorry about that.
Stefan Kangas [Tue, 6 Dec 2022 05:30:29 +0000 (06:30 +0100)]
Merge from origin/emacs-29
717f8477284 ; Fix typo in js--treesit-imenu c26fe45cb80 Fix treesit-query-capture 318bf42b410 Improve fontification of typescript-ts-mode (bug#59831) 64271bbb7d9 Add back pair feature in json-ts-mode fontification (bug#... 16b94888429 Fix mouse clicks on a non-selected frame ca0da3b83df ; Clarify description of display on the margins
Yuan Fu [Tue, 6 Dec 2022 02:37:47 +0000 (18:37 -0800)]
Fix treesit-query-capture
Before this change Ftreesit_query_capture doesn't convert character
position to byte position for BEG and END parameters. I observed
fontification issue in css files but couldn't figure out why, now I
know :-)
I decide to keep treesit--font-lock-query-expand-range, since it might
provide a escape hatch for problems we discover in the future, and it
should be very cheap so no downside of keeping it.
* lisp/textmodes/css-mode.el (css-ts-mode): Stop setting
treesit--font-lock-query-expand-range.
* lisp/treesit.el (treesit--font-lock-query-expand-range): Update
docstring.
* src/treesit.c (Ftreesit_query_capture): Convert BEG and END to byte
position. Also added parentheses wround "beg_byte - visible_beg" in
the call to ts_query_cursor_set_byte_range (i.e., style change).
Improve fontification of typescript-ts-mode (bug#59831)
- Highlight property and field definitions in class declaration.
- Highlight property-keys in object initializaters.
- Highlight variable-names in function/method return-statements.
Add back pair feature in json-ts-mode fontification (bug#59833)
* lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings):
Add back in removed pair feature. Also alphabetize features.
(json-ts-mode): Use the new feature.
Eli Zaretskii [Mon, 5 Dec 2022 19:45:01 +0000 (21:45 +0200)]
; Clarify description of display on the margins
* doc/lispref/display.texi (Display Margins): More accurate
explanation of how to show text in the display margin without
concealing buffer text. (Bug#59841)
Po Lu [Mon, 5 Dec 2022 12:41:37 +0000 (20:41 +0800)]
Fix build with old XCB
* src/xfns.c (x_get_net_workarea):
* src/xterm.c (x_dnd_compute_toplevels, x_dnd_get_proxy_proto)
(x_dnd_get_wm_state_and_proto, handle_one_xevent): Do not
include xcb_aux.h. Use XA_ constants instead of XCB_ATOM_ ones.
Stefan Kangas [Mon, 5 Dec 2022 05:30:21 +0000 (06:30 +0100)]
Merge from origin/emacs-29
ec00d292ec0 Improve treesit-fontify-with-override 4bcdb1cc65b Make killing a non-last client work the same no matter th... a27f61f6f48 Use the function 'window-system' on the tab-bar/tab-line ... 432b9655ae0 Restore font-lock-type-face for lisp mode &symbols
Sean Whitton [Sun, 4 Dec 2022 22:56:35 +0000 (15:56 -0700)]
Improve passing user switches to Git log commands (bug#59414)
* lisp/vc/vc-git.el (vc-git-log-switches): Revise docstring.
(vc-git-shortlog-switches): New defcustom.
(vc-git-print-log): Use vc-git-log-switches or
vc-git-shortlog-switches depending on whether printing a shortlog.
(vc-git-log-outgoing, vc-git-log-incoming): Use
vc-git-shortlog-switches.
(vc-git-log-search, vc-git-expanded-log-entry): Use
vc-git-log-switches.
* etc/NEWS: Document the new defcustom.
Yuan Fu [Sun, 4 Dec 2022 08:22:28 +0000 (00:22 -0800)]
Improve treesit-fontify-with-override
This also fixes fontification problem with c-ts-mode--fontify-defun.
Now treesit-fontify-with-override clips the fontification region for
the user, so no need for (max start node-start) shenanigans anymore.
More importantly it doesn't fontify unless the region between
node-start and node-end intersects with the region between start and
end, which fixes the problem with c-ts-mode--fontify-defun.
* lisp/treesit.el (treesit-fontify-with-override): Add optional
parameter BOUND-START and BOUND-END. Wrap the function body in a
when-form.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator)
(c-ts-mode--fontify-variable)
(c-ts-mode--fontify-defun)
(c-ts-fontify-error)
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string): Use the
new signature.
Jim Porter [Fri, 2 Dec 2022 20:14:50 +0000 (12:14 -0800)]
Make killing a non-last client work the same no matter the auto-stop setting
Previously, if 'server-stop-automatically' was configured for
'kill-terminal' or 'delete-frame', killing a client via
'save-buffers-kill-terminal' wouldn't prompt about the saving files in
the client's buffer list (as it does when not using those settings).
This change ensures that those settings only apply when killing the
last client, as described in the manual (bug#51993).
* lisp/server.el (server-save-buffers-kill-terminal): Handle
'server-stop-automatically' behavior in this function, rather than
calling 'server-stop-automatically--handle-delete-frame'.
Juri Linkov [Sun, 4 Dec 2022 19:30:34 +0000 (21:30 +0200)]
Use the function 'window-system' on the tab-bar/tab-line (bug#59620)
* lisp/tab-bar.el (tab-bar-separator)
(tab-bar-format-align-right, tab-bar-auto-width):
* lisp/tab-line.el (tab-line-format-template): Replace the variable
'window-system' with the function call '(window-system)'.
Tom Gillespie [Sun, 4 Dec 2022 06:41:15 +0000 (22:41 -0800)]
Restore font-lock-type-face for lisp mode &symbols
* lisp/emacs-lisp/lisp-mode.el (lisp-cl-font-lock-keywords-2)
(lisp-el-font-lock-keywords-2): Restore use of type face instead of
builtin face for &symbol keywords. This fixes what appears to be
a copy paste error that changed the face for common lisp and emacs
lisp &symbol style keywords that was introduced in commit a498e5f83 by restoring the type face to font-lock-type-face as
consistent with the comments.
Kai Ma [Sat, 3 Dec 2022 10:17:26 +0000 (18:17 +0800)]
Prevent a segfault when deleting a fullscreen frame on NextStep.
* nsterm.m ([EmacsView resetCursorRects:]): Be defensive when
accessing FRAME_OUTPUT_DATA. [resetCursorRects:] can be called
from the event loop after the frame is deleted. When this
happens, emacsframe is NULL. This means there is an underlying
leak of the EmacsView object! (Bug#59794)
Do not merge to master.
Po Lu [Sun, 4 Dec 2022 12:01:31 +0000 (20:01 +0800)]
Make Emacs build with Xfixes support on old versions of the library
* src/xterm.c (xfixes_toggle_visible_pointer):
(x_toggle_visible_pointer):
(XTtoggle_invisible_pointer, x_term_init): Disable code
requiring fixes 4.0 or later when the fixes library is older.
* src/xterm.h: Define missing types needed by other extensions
when the fixes library is too old.
* configure.ac: Allow building with any version of the Xfixes
extension library.
Speed up Unicode normalisation tests by a factor of 5
After this change, ucs-normalize-tests are still very slow but
somewhat less disastrously so (from 100 to 20 min on this machine).
* test/lisp/international/ucs-normalize-tests.el
(ucs-normalize-tests--normalization-equal-p)
(ucs-normalize-tests--normalization-chareq-p)
(ucs-normalize-tests--rule1-holds-p)
(ucs-normalize-tests--rule2-holds-p)
(ucs-normalize-tests--part1-rule2):
Run only over the Unicode code space.
Hoist `with-current-buffer` to reduce overhead.
Fix and expand tests broken by commit 2772ebe366 of 2022-11-28
* test/lisp/emacs-lisp/comp-tests.el
(with-test-native-compile-prune-cache)
(test-native-compile-prune-cache)
(test-native-compile-prune-cache/delete-only-eln)
(test-native-compile-prune-cache/dont-delete-in-parent-of-cache):
Check that the last directory in `native-comp-eln-load-path' is
not affected by `native-compile-prune-cache'.
Eli Zaretskii [Sat, 3 Dec 2022 10:21:00 +0000 (12:21 +0200)]
Fix handling of relative directories in "--init-directory=DIR"
* lisp/startup.el (command-line): Interpret non-absolute file
names in '--init-directory' relative to the directory from
which Emacs is started. (Bug#59795)
Eli Zaretskii [Sat, 3 Dec 2022 09:32:00 +0000 (11:32 +0200)]
Fix gud-minor-mode-menu
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(easy-mmode-define-keymap): Don't declare obsolete, since we are
still using it in gud.el. (Bug#59769) (Bug#59605)
Do not merge to master.
Eli Zaretskii [Sat, 3 Dec 2022 09:16:41 +0000 (11:16 +0200)]
Revert "Make easy-mmode-defmap obsolete and adjust only caller"
This reverts commit 8bb5c1bfec0929f2ba419e1c503f5acc01c336c2.
That commit lost too many useful features in the GUD menus
and caused several bugs, the last of them bug#59769.
* test/lisp/server-tests.el (server-tests/can-create-frames-p):
Don't attempt to create frames if TERM=dumb, which what we have
if run from M-x compile (for instance).
(server-tests/server-force-stop/keeps-frames): Delete created frame so
that it doesn't cause trouble for other tests.
Yikai Zhao [Tue, 29 Nov 2022 14:30:14 +0000 (22:30 +0800)]
Speed up auto-completion in 'sh-script-mode'
* lisp/progmodes/sh-script.el (sh--cmd-completion-table-gen): New
function, replacement for 'sh--cmd-completion-table'.
(sh--cmd-completion-table): Function removed.
(sh-completion-at-point-function): Use
'sh--cmd-completion-table-gen'. (Bug#59678)
* lisp/emacs-lisp/multisession.el (multisession-edit-value):
Do not use `bound-and-true-p' on a non-symbol. This reverts
commit bd586121ac21e046f60f75eeb0200866c38d6f9f.
Po Lu [Fri, 2 Dec 2022 13:00:30 +0000 (21:00 +0800)]
More behind the scenes transparent speedups around xselect.c
* src/xdisp.c (display_menu_bar): Fix compiler warning about
NULL pointer dereference.
* src/xfns.c (Fx_begin_drag): Use x_intern_atoms.
(Fx_change_window_property): Pass dpyinfo to
x_fill_property_data.
* src/xselect.c (lisp_data_to_selection_data): Use
x_intern_atoms instead of syncing for each atom.
(x_fill_property_data, x_send_client_event): Use
x_intern_cached_atom.
* src/xterm.c (x_intern_atoms): New function.
* src/xterm.h: Update prototypes.
Stefan Kangas [Fri, 2 Dec 2022 11:36:35 +0000 (12:36 +0100)]
Merge from origin/emacs-29
39e0c60176 * lisp/tab-bar.el (tab-bar-format-align-right): Fix alignm... bf66b90b9a Fix the width of margins for icons in outline-minor-mode (... 2e4960d63d ; Change c-ts-mode--base-mode to c-ts-base-mode 1aa1f8432b Add new TypeScript mode tsx-ts-mode ad0563855f Add case and match to python--treesit-keywords (bug#59720) 16e68e64f9 ; * lisp/progmodes/c-ts-mode.el: Change rx to regexp-opt. 3bccef6f52 project-files (VC-aware): Make sure the VC backend is loaded 03a40b974c term--update-term-menu: Add the menu to term-terminal-menu 368c7c7d8e Improve detection of very long lines 9c58ea37af ; Fix last change in proced.el 0c1495574a Add colors to Proced (bug#59407) 91dba5b066 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/e... 70ecdebc92 ; Fix typos (don't abbreviate "with" or "without") d94c5870c0 ; * lisp/tab-bar.el (tab-bar-change-tab-group): Doc fix.
Juri Linkov [Fri, 2 Dec 2022 07:59:53 +0000 (09:59 +0200)]
* lisp/tab-bar.el (tab-bar-format-align-right): Fix alignment on TTY frames.
Calculate the alignment from the left edge instead of the right edge
since the `right' spec doesn't work on TTY frames when windows are split
horizontally (bug#59620).
* lisp/emacs-lisp/icons.el (icons--create): Handle :width as well.
* lisp/outline.el (outline--margin-width, outline-margin-width):
New variables.
(outline-open-in-margins, outline-close-in-margins)
(outline-close-rtl-in-margins): Don't inherit from parents.
Use `:width font' instead of `:height 10'.
(outline-minor-mode): Calculate the number of columns for margins
to fit the icons.
There are in fact two languages supporting TypeScript for tree-sitter.
Because TSX causes some ambiguities with types there are two grammars,
one called typescript and one called tsx. To account for this and to
be as correct as possible we enable using both.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Change to a function to accomodate
the two languages.
(typescript-ts-mode--font-lock-settings): Change to a function to
accomodate the two languages.
(typescript-ts-base-mode): Parent mode for typescript-ts-mode
and tsx-ts-mode.
(typescript-ts-mode): Derive from typescript-ts-base-mode and
extend with language specific settings
(tsx-ts-mode): New major mode that derives from
typescript-ts-base-mode and extend it with language specific
settings
Add autoload cookies for the respective file type extensions: .ts and
.tsx.