Yuan Fu [Wed, 30 Nov 2022 22:59:06 +0000 (14:59 -0800)]
Fix c-ts-mode defun movement (bug#59628)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--end-of-defun): New function.
(c-ts-mode--base-mode): Use more specific regexp, and set
treesit-defun-prefer-top-level.
(c-ts-mode)
(c++-ts-mode): Set end-of-defun-function.
Juri Linkov [Wed, 30 Nov 2022 19:36:33 +0000 (21:36 +0200)]
* lisp/tab-bar.el: Keep tabs of the same group together (bug#59721)
(tab-bar-tab-post-change-group-functions): Change the default value to
'(tab-bar-move-tab-to-group)'. Improve docstring.
(tab-bar-change-tab-group): Improve docstring.
* lisp/org/org-element.el (org-element--get-node-properties):
Escape literal `+`.
* lisp/org/org-persist.el (org-persist-load:index):
Replace line-start with string-start when the latter is meant.
* test/lisp/progmodes/python-tests.el (python-ffap-module-path-1):
This test fails with a standard macOS Python installation;
see bug#59477 and bug#25753.
Sink python indent offset guessing to avoid test failure
Call python-indent-guess-indent-offset late in the set-up of
python-mode and python-ts-mode to make sure that the required other
settings (of syntax-propetize-function in particular) have been
carried out. This cures a python-test failure (bug#59477).
Fix interactive selection of emacs-lock mode, broken by 2a4b0da28c
* lisp/emacs-lock.el (emacs-lock--set-mode): Check that
arg is 4 and prefix is '(4).
(emacs-lock-mode): Pass also `current-prefix-arg' to
`emacs-lock--set-mode'.
Alan Mackenzie [Tue, 29 Nov 2022 20:19:34 +0000 (20:19 +0000)]
CC Mode: Prevent lone ids being parsed as types unless in decl arglists
This fixes bug #59051.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): In the test for the
last invocation of c-fdoc-shift-type-backward before CASE 1, additionally
test CONTEXT not being an arglist or BACKUP-AT-TYPE being non-nil.
Po Lu [Tue, 29 Nov 2022 06:25:04 +0000 (06:25 +0000)]
Allow be-resources to fail
* lib-src/be_resources.cc (be_perror): Print additional blurb.
(main): Return 0 on failure as well, but print the blurb.
Problem reported by the Haiku packager.
F. Jason Park [Thu, 24 Nov 2022 05:31:19 +0000 (21:31 -0800)]
Simplify erc-sasl's auth-source API
* doc/misc/erc.texi: Revise descriptions in SASL chapter to reflect
simplified auth-source options.
* lisp/erc/erc-sasl.el (erc-sasl-password,
erc-sasl-auth-source-function): Revise doc strings.
(erc-sasl-auth-source-password-as-host): New function to serve as
more useful choice for option `erc-sasl-auth-source-function'.
(erc-sasl--read-password): Promote auth-source to pole position, above
an explicit string and `:password'.
* test/lisp/erc/erc-sasl-tests.el (erc-sasl--read-password--basic):
Massage tests to conform to simplified `erc-sasl-password'
API. (Bug#29108.)
F. Jason Park [Thu, 24 Nov 2022 05:31:19 +0000 (21:31 -0800)]
Add erc-sasl-auth-source-function to cached options
* lisp/erc/erc-sasl.el (erc-sasl--read-password): Consult cached
options instead of `erc-sasl-auth-source-function'.
(erc-sasl--init): Add `erc-sasl-auth-source-function' to
`erc-sasl--options'.
* test/lisp/erc/erc-sasl-tests.el (erc-sasl--read-password--basic,
erc-sasl--read-password--auth-source): Look for original value of
`erc-sasl-auth-source-function' in `erc-sasl--options' under the
`authfn' key.
* lisp/textmodes/css-mode.el (css--treesit-settings): Add new
font-lock features 'query', 'keyword', 'operator' and 'bracket'.
(css-ts-mode): Use new features.
Gregory Heytings [Mon, 28 Nov 2022 12:17:30 +0000 (12:17 +0000)]
Fix display of long completions.
* lisp/minibuffer.el (completion--insert-strings): Do not assume
"at least 2 columns", which is not possible when completion
strings are long, e.g. with completions-detailed set.
Jim Porter [Mon, 28 Nov 2022 01:22:49 +0000 (17:22 -0800)]
; Don't emit a "Server stopped" message when restarting the Emacs server
* lisp/server.el (server-stop): Return non-nil when we actually stop
the server. Don't message about stopping the server here (but do log
it).
(server-start): Emit the appropriate message about stopping or
restarting the server.
Stefan Kangas [Mon, 28 Nov 2022 00:32:01 +0000 (01:32 +0100)]
Catch more cases in info--ensure-not-in-directory-node
* lisp/info.el (info--ensure-not-in-directory-node): Fix the case
where "DIR" is in upper-case, and if 'Info-current-file' is an
absolute file name.
Problem reported by Eli Zaretskii <eliz@gnu.org>.
Gregory Heytings [Sun, 27 Nov 2022 22:53:20 +0000 (22:53 +0000)]
Minor improvements to locked narrowing
* src/xdisp.c (get_locked_narrowing_begv)
(get_locked_narrowing_zv): Safer handling of negative values.
(handle_fontified_prop): Do not use locked narrowing if the region
size is <= 0.
* src/keyboard.c (safe_run_hooks_maybe_narrowed): Do not use
locked narrowing if the region size is <= 0.
Yuan Fu [Sun, 27 Nov 2022 22:15:57 +0000 (14:15 -0800)]
Remove treesit-comment-start/end and use comment-start/end-skip
treesit-comment-start/end is unnecessary because of
comment-start/end-skip, so they should be removed.
Cleanup and set comment-start/end-skip for tree-sitter C-like major
modes.
I replaced the [ \t]* part in comment-start-skip with (syntax
whitespace), which is what comment-end-skip uses. I also added
grouping in comment-start-skip to match that of comment-end-skip.
* lisp/emacs-lisp/package-vc.el: Replace instances of "source package"
in comments and docstrings.
* lisp/emacs-lisp/package.el: Replace instances of "source package" in
comments and docstrings.
* lisp/progmodes/xref.el (xref--add-log-current-defun):
New function.
(xref--xref-buffer-mode): Assign it buffer-locally to
`add-log-current-defun-function'.
lu4nx [Fri, 25 Nov 2022 06:38:29 +0000 (14:38 +0800)]
Fixed ctags local command execute vulnerability
* lib-src/etags.c:
(clean_matched_file_tag): New function
(do_move_file): New function
(readline_internal):
Add `leave_cr` parameter, if true, include the \r character
* test/manual/etags/CTAGS.good_crlf: New file
* test/manual/etags/CTAGS.good_update: New file
* test/manual/etags/crlf: New file
* test/manual/etags/Makefile: Add `ctags -u` test cases
Po Lu [Sun, 27 Nov 2022 11:17:38 +0000 (19:17 +0800)]
Make frame synchronization more robust
* src/xterm.c (x_sync_wait_for_frame_drawn_event)
(x_sync_handle_frame_drawn): Only cancel frame synchronization
if hanging twice or more in a row.
* src/xterm.h (struct x_output, FRAME_X_DRAW_JUST_HUNG): New
flag.
* lisp/progmodes/csharp-mode.el (c-basic-matchers-before): Remove
invalid string check for Emacs 27.
(version=): Remove compatibility hack for string handling in CC Mode
in Emacs 27.1. (Bug#59602)
Stefan Kangas [Sun, 27 Nov 2022 06:29:54 +0000 (07:29 +0100)]
Improve describe-text-properties display
* lisp/descr-text.el (describe-property-list): Don't propertize white
space with the 'help-argument-name' face. This improves display
slightly when that face has an underline.
Gregory Heytings [Sun, 27 Nov 2022 00:24:40 +0000 (00:24 +0000)]
Improve handling of killed buffers in locked narrowings
* src/editfns.c (narrowing_locks_add, narrowing_locks_remove):
New functions, factored out.
(narrowing_lock_push, narrowing_lock_pop)
(narrowing_locks_restore): Use the new functions.
(narrowing_lock_get_bound): Return NULL for killed buffers.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing):
Remove killed buffers from the 'narrowing_locks' alist.
Yuan Fu [Sat, 26 Nov 2022 23:32:57 +0000 (15:32 -0800)]
Make typescript-ts-mode not fallback to js-mode
1. js-mode might not be able to handle typescript file
2. Now that we use separate modes for tree-sitter modes, not falling
back makes tree-sitter modes more consistent
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Remove
the fallback code.
Yuan Fu [Sat, 26 Nov 2022 23:31:48 +0000 (15:31 -0800)]
Make bash-ts-mode fall back to sh-mode if the file isn't in Bash
* lisp/progmodes/sh-script.el (sh--guess-shell): Take out into a new
function.
(sh-base-mode): Use the new function.
(bash-ts-mode): Update docstring.
(sh--redirect-recursing): New variable.
(sh--redirect-bash-ts-mode): New function.
Yuan Fu [Sat, 26 Nov 2022 22:54:55 +0000 (14:54 -0800)]
Add treesit-font-lock-level
This replaces font-lock-maximum-decoration and allows us to disable
the busiest fontification level by default.
* lisp/treesit.el (treesit-font-lock-level): New variable.
(treesit-font-lock-feature-list)
(treesit-font-lock-settings): Change docstring.
(treesit-font-lock-recompute-features): Use the new variable.
Jim Porter [Fri, 25 Nov 2022 19:13:06 +0000 (11:13 -0800)]
Improve robustness of server.el tests
* lisp/emacs-lisp/ert.el (ert--insert-infos): Allow 'message' to be a
function that is called when inserting the info.
(ert-info): Update docstring to describe using a function for
MESSAGE-FORM.
* lisp/server.el (server-start): Log when the server is starting.
* test/lisp/server-tests.el (server-tests/can-create-frames-p): New
constant. Use it to skip tests that need to create frames.
(server-tests/start-emacsclient): Rename to...
(server-tests/start-client): ... this, and set the process's buffer.
(server-tests/with-server): Put the server file in a temporary
directory so we don't conflict with real Emacs servers.
(server-tests/with-client): New macro...
(server-tests/server-start/stop-prompt-with-client)
(server-tests/emacsclient/server-edit)
(server-tests/emacsclient/create-frame)
(server-tests/emacsclient/create-frame): ... use it.
(server-tests/server-start/stop-prompt-with-client): Simplify.
Eric Abrahamsen [Sat, 26 Nov 2022 20:12:50 +0000 (12:12 -0800)]
Remove mentions of create-directory nnmaildir setting
* lisp/gnus/nnmaildir.el (nnmaildir-open-server): The
'create-directory server parameter should have been removed entirely,
and supplanted by 'target-prefix. Remove check for old parameter.
* doc/misc/gnus.texi (Maildir): Delete mention from manual.
Gregory Heytings [Sat, 26 Nov 2022 16:13:04 +0000 (16:13 +0000)]
Further improvements to narrowing locks
* src/editfns.c:
(narrowing_lock_get_bound): Return a pointer to a struct
Lisp_Marker instead of a character position. Suggested by Eli
Zaretskii.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing)
(Fwiden, Fnarrow_to_region): Adapt accordingly.
(narrowing_lock_peek_tag, narrowing_lock_push)
(narrowing_lock_pop, narrowing_locks_save)
(narrowing_locks_restore): Use XCAR/XCDR/XSETCAR instead of
Fcar/Fcdr/Fsetcar.
Gregory Heytings [Sat, 26 Nov 2022 14:09:41 +0000 (14:09 +0000)]
Improve locked narrowing around low-level hooks.
* src/buffer.c (syms_of_buffer): Two new variables,
'long-line-locked-narrowing-region-size' and
'long-line-locked-narrowing-bol-search-limit', to make the locked
narrowing around low-level hooks configurable.
Increase the default value of 'long-line-threshold'. After
carefully considering the (few) bug reports about long line
optimizations, I concluded that the previous default value was too
low.
* src/xdisp.c (get_locked_narrowing_begv)
(get_locked_narrowing_zv): Two new functions.
(handle_fontified_prop, reseat): Use them.
* src/keyboard.c (safe_run_hooks_maybe_narrowed): Use them.
* src/dispextern.h (struct it): Add two new fields to store the
values returned by these functions.
Make them externally visible.
Eli Zaretskii [Sat, 26 Nov 2022 10:59:06 +0000 (12:59 +0200)]
Fix generation of autoloads on MS-Windows
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--file-load-name): Handle the case when FILE and
OUTFILE don't share any common ancestor directory. (Bug#59507)
Po Lu [Sat, 26 Nov 2022 10:57:34 +0000 (18:57 +0800)]
Reduce wasted cycles in x*.c
* src/xfns.c (compute_tip_xy, Fx_show_tip):
* src/xselect.c (x_own_selection, x_get_local_selection)
(x_clear_frame_selections): Call CAR and CDR, not Fcar and Fcdr.