Gregory Heytings [Fri, 12 May 2023 21:56:28 +0000 (21:56 +0000)]
Fix the return type of 'labeled_restrictions_get_bound'
* src/editfns.c:
(labeled_restrictions_get_bound): Return a Lisp_Object instead of
a pointer to a struct Lisp_Marker.
(unwind_reset_outermost_restriction, reset_outermost_restrictions)
(Fwiden, Fnarrow_to_region): Adapt to the new return type.
* src/xdisp.c (get_nearby_bol_pos): Initialize 'bol' to BEGV - 1
instead of 0 (which fixes cursor motion commands in the presence
of a narrowing), adapt the return condition accordingly, and do
not restart the loop when BEGV has been reached.
(get_small_narrowing_begv): Use correct type.
* src/xdisp.c (get_narrowed_width): Use WINDOW_RIGHT_FRINGE_WIDTH,
which works both for character-only terminals and for GUI frames
without fringes.
(get_nearby_bol_pos): Instead of searching for BOL in
[pos-500000..pos], gradually extend the region, starting with
[pos-500..pos]. This is much faster in buffers with some long
lines in the middle of lots of short lines.
Gregory Heytings [Tue, 28 Mar 2023 23:06:56 +0000 (23:06 +0000)]
Improve accuracy of cursor motion commands in long lines
* src/xdisp.c (get_nearby_bol_pos): New function.
(get_small_narrowing_begv): Use it. This makes cursor motion
commands much more accurate in the first 500K characters of each
long line.
Gregory Heytings [Tue, 28 Mar 2023 23:06:54 +0000 (23:06 +0000)]
Code cleanup for long line optimizations
This commit does not change any code, it merely renames functions
and clarifies the documentation, to make the code hopefully easier
to grasp.
* src/dispextern.h (struct it): Rename the 'narrowed_begv',
'narrowed_zv', 'locked_narrowing_begv', 'locked_narrowing_zv' to
'medium_narrowing_begv', 'medium_narrowing_zv',
'large_narrowing_begv', 'large_narrowing_zv'. Clarify the
comments.
Update the prototypes of the functions renamed in xdisp.c.
* src/lisp.h: Update the prototypes of the functions renamed in
editfns.c. Remove the prototype of
'safe_run_hooks_maybe_narrowed', which is used only in keyboard.c.
* src/xdisp.c
(get_small_narrowing_begv): Renamed from
'get_closer_narrowed_begv'.
(get_medium_narrowing_begv): Renamed from 'get_narrowed_begv'.
(get_medium_narrowing_zv): Renamed from 'get_narrowed_zv'.
(get_large_narrowing_begv): Renamed from 'get_locked_narrowing_begv'.
(get_large_narrowing_zv): Renamed from 'get_locked_narrowing_zv'.
(SET_WITH_NARROWED_BEGV): Use the new field names.
(handle_fontified_prop): Use the new function and new field names.
(back_to_previous_line_start): Use the new field name.
(back_to_previous_visible_line_start): Use the new field name.
(reseat): Use the new function and new field names.
(get_visually_first_element): Use the new field name.
(move_it_vertically_backward): Use the new function name.
(redisplay_internal): Use the new function name.
Also add a large comment to explain how Emacs deals with long lines.
* src/keyboard.c:
(safe_run_hooks_maybe_narrowed): Use the new function names from
xdisp.c and editfns.c. Make the function static, and add a
prototype.
* src/editfns.c:
(labeled_restrictions): Renamed from 'narrowing_locks'.
(labeled_restrictions_add): Renamed from 'narrowing_locks_add'.
(labeled_restrictions_remove): Renamed from
'narrowing_locks_remove'.
(labeled_restrictions_get_bound): Renamed from
'narrowing_lock_get_bound'.
(labeled_restrictions_peek_label): Renamed from
'narrowing_lock_peek_tag'.
(labeled_restrictions_push): Renamed from 'narrowing_lock_push'.
(labeled_restrictions_pop): Renamed from 'narrowing_lock_pop'.
(unwind_reset_outermost_restriction): Renamed from
'unwind_reset_outermost_narrowing'.
(reset_outermost_restrictions): Renamed from
'reset_outermost_narrowings'.
(labeled_restrictions_save): Renamed from 'narrowing_locks_save'.
(labeled_restrictions_restore): Renamed from
'narrowing_locks_restore'.
(unwind_labeled_narrow_to_region): Renamed from
'unwind_narrow_to_region_locked'.
(labeled_narrow_to_region): Renamed from
'narrow_to_region_locked'.
(Finternal__label_restriction): Renamed from
'Finternal__lock_narrowing'.
(Finternal__unlabel_restriction): Renamed from
'Finternal__unlock_narrowing'.
(Fwiden): Use the new function names.
(Fnarrow_to_region): Use the new function names.
(save_restriction_save): Use the new function names.
(syms_of_editfns): Use the new function names.
<outermost-restriction>: Renamed from 'outermost-narrowing'.
* lisp/subr.el (internal--with-restriction): Use the new internal
function name.
(internal--without-restriction): Use the new internal function
name.
* src/composite.c (composition_compute_stop_pos):
(find_automatic_composition): Use the new function name.
* doc/lispref/positions.texi (Narrowing): Add index entry.
Eli Zaretskii [Tue, 28 Mar 2023 18:08:12 +0000 (21:08 +0300)]
Improve documentation of 'read-choice' and related symbols
* doc/lispref/commands.texi (Reading One Event):
* lisp/subr.el (read-char-choice-use-read-key, read-char-choice)
(read-char-choice-with-read-key, y-or-n-p-use-read-key): Improve
documentation of these functions and variables.
Eli Zaretskii [Tue, 28 Mar 2023 11:08:29 +0000 (14:08 +0300)]
; Fix incompatibility in 'display-buffer-assq-regexp'
* lisp/window.el (display-buffer-assq-regexp): Make it accept a
buffer's name again, as it did in Emacs 28. This makes computing
the buffer's name inside the function unnecessary.
(display-buffer): Always pass the buffer's name to
'display-buffer-assq-regexp'. (Bug#62417)
This change makes it work again, restoring compatibility.
* lisp/subr.el (buffer-match-p): Fix and adjust docstring.
* lisp/window.el (display-buffer-alist): Adjust docstring.
(display-buffer-assq-regexp): Make good on promise of display-buffer-alist.
Dmitry Gutov [Mon, 27 Mar 2023 00:49:13 +0000 (03:49 +0300)]
ruby-ts-mode: Fix/simplify Imenu index generation
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--full-name): Drop '#'
from the end of resulting string when the node is not a method.
Support 'singleton_method' nodes.
(ruby-ts--imenu-helper): Simplify, to create a "flat" list of
entries, rather than a nested one. The previous implementation
had problems (like producing a nested structure of full-qualified
names, thus creating a lot of textual repetition), seems easier to
just follow ruby-mode's example here, at least for Emacs 29's
release.
* test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index):
New test.
Ken Brown [Sat, 25 Mar 2023 20:37:51 +0000 (16:37 -0400)]
Skip failing tests on Cygwin with native compilation (bug#62450)
* test/Makefile.in (TEST_NATIVE_COMP): New variable, used to
determine whether to run tests tagged with :nativecomp. Set it to
"no" on Cygwin and to $(HAVE_NATIVE_COMP) otherwise.
* test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): Skip
on Cygwin with native-compilation.
Eli Zaretskii [Sun, 26 Mar 2023 11:56:57 +0000 (14:56 +0300)]
; Fix last change
* lisp/net/eww.el (eww-download-directory): Rename from
'eww-default-download-directory'. All users changed. Change
:type to be a directory. Doc fix. (Bug#62435)
Phil Sainty [Sun, 14 Aug 2022 10:34:41 +0000 (22:34 +1200)]
* src/buffer.c (mode-line-format): Remove docs for obsolete %t construct
This documentation had been previously removed in 1999 in [1]
but was subsequently restored again in a different form in 2006
in [2] as the construct was still supported on some systems.
However it looks like it hasn't done what that documentation
indicated since [3] in 2011, and the final remnant of this
functionality was removed in [4] in 2013; so it seems clear that
it's no longer supported and shouldn't be documented now.
kobarity [Sat, 25 Mar 2023 13:59:05 +0000 (22:59 +0900)]
Improve indenting "case" in Python
* lisp/progmodes/python.el (python-info-dedenter-statement-p): Do not
consider the first "case" in the block as dedenter.
* test/lisp/progmodes/python-tests.el
(python-info-dedenter-opening-block-positions-7)
(python-info-dedenter-statement-p-6): New tests. (Bug#62092)
Ken Brown [Fri, 24 Mar 2023 15:35:40 +0000 (11:35 -0400)]
Fix failure of fns-tests-collate-strings on Cygwin
* test/src/fns-tests.el (fns-tests-collate-strings): Use
en_XY.UTF-8 instead of en_DE.UTF-8 as an example of an invalid
locale; en_DE.UTF-8 is actually a valid locale on Cygwin.
Note: The test will still fail on Cygwin releases < 3.5
because of a Cygwin bug. (Bug#62420)
This avoids ballooning the size of variables that contain
large text properties, such as the 'yank-handler' installed
by 'evil-yank-rectangle', which contains a list of lines in
the string.
* lisp/savehist.el (savehist-save): Enable 'print-circle'.
(Bug#62364)
Eli Zaretskii [Fri, 24 Mar 2023 11:10:30 +0000 (14:10 +0300)]
Fix system time sampling on MS-Windows
* src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally
call tzset to make sure we pick up all the changes of time zone,
working around the MS CRT caching.
Yuan Fu [Fri, 24 Mar 2023 07:17:10 +0000 (00:17 -0700)]
Fix treesit_ensure_parsed (bug#62333)
* src/treesit.c (treesit_ensure_parsed): Check for need_reparse after
treesit_sync_visible_region runs, because as the comment says,
treesit_sync_visible_region might modify need_reparse.
Eli Zaretskii [Thu, 23 Mar 2023 09:30:19 +0000 (11:30 +0200)]
; Improve documentation of :predicate in globalized minor modes
* doc/lispref/modes.texi (Defining Minor Modes):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Improve documentation of the :predicate keyword in defining
globalized minor modes.
Eli Zaretskii [Thu, 23 Mar 2023 08:31:56 +0000 (10:31 +0200)]
Allow showing prefix commands in Help buffers
* lisp/help.el (describe-bindings-show-prefix-commands): New user
option.
(describe-map): Use it to decide whether to output prefix
commands. Patch by Bob Rogers <rogers@rgrjr.com>. (Bug#62279)
Daniel Martín [Sat, 18 Mar 2023 00:47:32 +0000 (01:47 +0100)]
Fix toolbar item validation in the NS port
* src/nsterm.m ([EmacsView validateToolbarItem:]): Implement this
NSToolbarItemValidation method, which is called by AppKit when it
needs to validate an image item in a toolbar. This solves, in
particular, the problem with having the "Save" icon on the tool
bar enabled at Emacs startup. (Bug#62234)
It's important for a hook in after-change-functions not to change match-data.
Otherwise it breaks functions that make changes in the buffer, such as
for example, successive calls to delete-region in smerge-keep-n, etc.
João Távora [Tue, 21 Mar 2023 09:56:30 +0000 (09:56 +0000)]
Eglot: report window/workDoneProgress capability to language server
In bug#59149, LSP progress reporting was implemented, but Eglot's
'capabilities' statement to the server wasn't changed to include
window/workDoneProgress.
Andrea Corallo [Mon, 20 Mar 2023 16:24:48 +0000 (17:24 +0100)]
Comp fix calls to redefined primtives with op-bytecode (bug#61917)
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation
of calls to redefined primtives with dedicated op-bytecode.
* test/src/comp-tests.el (61917-1): New test.
João Távora [Sun, 19 Mar 2023 00:47:55 +0000 (00:47 +0000)]
Improve ergonomics of Eglot's inlay hints
Instead of deleting inlay hints instantly as soon as the affected
changes, make hint overlays span one character (instead of being
length 0). Give the overlays an "evaporate" property.
Given an inlay hints at position POS, its attached to [POS, POS+1] if
it's kind=1 (usually type hints) and [POS-1, POS] otherwise. For
kind=1 hints, the 'cursor position of the first such overlay is also
tweaked, so that's it's less akward to edit around it.
João Távora [Fri, 17 Mar 2023 22:37:27 +0000 (22:37 +0000)]
Don't take over mouse-1 binding on Eglot diagnostics (bug#62157)
It's better to give the user a variable to allow the overlay keymap to
be customized.
* lisp/progmodes/eglot.el (eglot--mouse-call): Accept second arg.
(eglot--mode-line-props): Adapt call to eglot--mouse-call
(eglot-diagnostics-map): New variable.
(eglot-code-actions-at-mouse): New command.
Gregory Heytings [Sat, 18 Mar 2023 10:49:29 +0000 (10:49 +0000)]
Avoid slowdowns in xmltok-scan-attributes
* lisp/nxml/xmltok.el (xmltok-scan-attributes): Limit the search
to 10000 characters, to avoid slowdowns due to the quadratic
complexity of the regexp. Suggested by Stefan Monnier.
Alan Mackenzie [Sat, 18 Mar 2023 10:12:24 +0000 (10:12 +0000)]
CC Mode: Eliminate duplicate function c-list-of-strings
Replace it with the existing c-string-list-p. Also put an autoload cookie in
front of c-string-list-p so that it will not be signalled as undefined by
loaddefs.el.
lisp/progmodes/cc-vars.el (c-string-list-p): Make this autoload.
(c-list-of-strings): Remove.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): In the autoload
cookies, replace c-list-of-strings with c-string-list-p.
Alan Mackenzie [Mon, 13 Mar 2023 16:42:02 +0000 (16:42 +0000)]
CC Mode: Allow lists of strings as safe values for *-font-lock-extra-types
* lisp/progmodes/cc-vars.el (c-list-of-strings): New function.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): Add a :safe entry
into each of thes defcustoms for c-list-of-string.
(Top level): Add an autoload entry for each of the above.
Manuel Giraud [Fri, 10 Mar 2023 20:54:00 +0000 (21:54 +0100)]
Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)
* lisp/find-dired.el (find-ls-option-default-ls): Adapt to
a value that works with the default "find" on *BSD and
Darwin/MacOS. Tested on OpenBSD and MacOS. Do not merge
to master.