Commit graph

6053 commits

Author SHA1 Message Date
Roi Martin
0ac21120cf Update `fill-region-as-paragraph-semlf' to follow fill.el protocols
Update the `fill-region-as-paragraph-semlf' function to follow the
`fill-region-as-paragraph-function' protocol.  This allows us to
reimplement the `fill-paragraph-semlf' function using `fill-paragraph'
and `fill-region-as-paragraph-function'.
* lisp/textmodes/fill.el (fill-region-as-paragraph-semlf): Make this
function compatible with `fill-region-as-paragraph-function'.  Avoid
narrowing.
(fill-paragraph-semlf): Reimplement using `fill-paragraph' and
`fill-region-as-paragraph-function'.
* test/lisp/textmodes/fill-tests.el (fill-test-semlf-fill-region): Add
test.
(fill-test-fill-paragraph-semlf-fill-paragraph-function): Remove test.
(fill-test-fill-paragraph-semlf, fill-test-semlf)
(fill-test-fill-paragraph-semlf-justify, fill-test-semlf-justify)
(fill-test-fill-paragraph-semlf-sentence-end-double-space)
(fill-test-semlf-sentence-end-double-space)
(fill-test-fill-paragraph-semlf-fill-column, fill-test-semlf-fill-column)
(fill-test-fill-paragraph-semlf-punctuation-marks)
(fill-test-semlf-punctuation-marks, fill-test-fill-paragraph-semlf-twice)
(fill-test-semlf-twice, fill-test-fill-paragraph-semlf-fill-prefix)
(fill-test-semlf-fill-prefix)
(fill-test-fill-paragraph-semlf-indented-block)
(fill-test-semlf-indented-block, fill-test-fill-paragraph-semlf-revert)
(fill-test-semlf-revert, fill-test-fill-paragraph-semlf-emacs-lisp-mode)
(fill-test-semlf-emacs-lisp-mode, fill-test-fill-paragraph-semlf-c-mode)
(fill-test-semlf-c-mode, fill-test-fill-paragraph-semlf-org-mode)
(fill-test-semlf-org-mode, fill-test-fill-paragraph-semlf-markdown-mode)
(fill-test-semlf-markdown-mode): User shorter function names consistent
with erts file names.
* test/lisp/textmodes/fill-resources/semlf-fill-region.erts: Add test
data.
* test/lisp/textmodes/fill-resources/semlf-fill-paragraph-function.erts:
Delete file.
* test/lisp/textmodes/fill-resources/semlf-emacs-lisp-mode.erts: Remove
newlines around indented block.
* doc/lispref/text.texi (Filling): Highlight that
`fill-region-as-paragraph-function' changes the behavior of
`fill-paragraph'.
2025-06-30 17:33:43 -04:00
Roi Martin
99ec286d78 Add variable `fill-region-as-paragraph-function'
Add the variable `fill-region-as-paragraph-function' to provide
a way to override how functions like `fill-region' fill text.
* doc/lispref/text.texi (Filling): Document
`fill-region-as-paragraph-function' variable.
* doc/emacs/text.texi (Fill Commands): Reference
`fill-region-as-paragraph-function' variable.
* lisp/textmodes/fill.el (fill-region-as-paragraph-function):
Add variable.
(fill-region-as-paragraph): Convert into
`fill-region-as-paragraph-function' wrapper.
(fill-region-as-paragraph-default): Rename old
`fill-region-as-paragraph' function.
(fill-region-as-paragraph-semlf): Update calls to
`fill-region-as-paragraph-default'.
(fill-region): Add reference to `fill-region-as-paragraph-function'
in doc string.
* test/lisp/textmodes/fill-tests.el (fill-test-fill-region): Add
test case for the `fill-region' function.
* test/lisp/textmodes/fill-resources/fill-region.erts: Add test
data.  (Bug#78816)
2025-06-29 07:33:24 +03:00
Sean Whitton
192066d3b9 Load site-start.el before early-init.el
* lisp/startup.el (command-line): Load site-start.el before
early-init.el.
(site-run-file):
* doc/lispref/os.texi (Startup Summary, Init File):
* etc/NEWS: Document the change.
2025-06-24 17:33:39 +01:00
Stefan Monnier
08fba517f6 (smerge-refine-shadow-cursor): New variable and face (bug#78806)
* lisp/vc/smerge-mode.el (smerge-refine-shadow-cursor): New variable
and face.
(smerge-refine-regions): Add `cursor-sensor-functions` property
to the covering overlays.
(smerge--refine-at-right-margin-p, smerge--refine-shadow-cursor):
New functions.
(smerge--refine-other-pos): New function, extracted from
`smerge-refine-exchange-point`.
(smerge-refine-exchange-point): Use it.
(smerge--refine-highlight-change): Add thin
highlighted space for insertion/deletion positions.

* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect):
Run functions for `moved` events.  Demote errors.
(cursor-sensor-mode): Adjust docstring accordingly.

* doc/lispref/text.texi (Special Properties) <cursor-sensor-functions>:
Mention the new `moved` direction.
2025-06-23 00:00:38 -04:00
Mattias Engdegård
eca2cc00b6 * doc/lispref/functions.texi (Closures): Rewrite outdated text. 2025-06-17 17:51:49 +02:00
Eli Zaretskii
336253ddd3 Merge from origin/emacs-30
df3fb94f09 Insert missing step to make use of directory tracking OSC...
1bed294958 * lisp/keymap.el (keymap-set): Refer to 'key-description'...
941158fc13 Support new tree-sitter grammar filename format (bug#78754)
888f846d37 Fix crash when evaluating "(signal nil 5)" (bug#78738)
51b9e92ab8 Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
c0a913ea4f ; * doc/lispref/modes.texi (Font Lock Basics): Remove old...
37de076017 Adapt emba integration (don't merge)
2025-06-14 11:23:54 -04:00
Jim Porter
90c0c9a01e Clean up text properties in 'visual-wrap-prefix-mode'
Before refontifying a region, remove any text properties we care about
so that we don't end up with stray properties.  Additionally, make sure
to remove all the properties when deactivating the mode.

* lisp/emacs-lisp/subr-x.el (add-remove--display-text-property): New
function, extracted from...
(add-display-text-property): ... here.
(remove-display-text-property): New function.

* lisp/visual-wrap.el (visual-wrap--remove-properties): New function...
(visual-wrap-prefix-function, visual-wrap-prefix-mode): ... call it.

* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-remove-display-text-property): New test.

* test/lisp/visual-wrap-tests.el
(visual-wrap-tests/wrap-prefix-stickiness, visual-wrap-tests/cleanup):
New tests.

* doc/lispref/display.texi (Display Property): Document
'remove-display-text-property'.

* etc/NEWS: Announce 'remove-display-text-property' (bug#76018).
2025-06-10 22:09:26 -07:00
Jim Porter
24e6cd4233 Improve documentation for display property functions
Specifically, use the term "display specification" more consistently to
distinguish from "display property", which is the full value of the
'display' text property.

* src/xdisp.c (find_display_property): Rename PROP to SPEC.
(Fget_display_property): Rename PROP to SPEC and improve docstring.

* lisp/emacs-lisp/subr-x.el (add-display-text-property): Rename PROP to
SPEC and improve docstring.

* doc/lispref/display.texi (Display Property): Reword documentation to
more-consistently refer to display specifications.
2025-06-10 22:09:26 -07:00
Yuan Fu
0a629abfbb
Add new tactic to treesit-navigate-thing (bug#78703)
* doc/emacs/programs.texi (Moving by Defuns):
* doc/lispref/parsing.texi (User-defined Things): Describe the
new tactic.
* lisp/treesit.el (treesit-navigate-thing): Add new tactic.
2025-06-09 21:43:27 -07:00
Eshel Yaron
86eb733aef
; Fix last change.
Thanks to Daniel Mendler <mail@daniel-mendler.de> for
pointing out my mistake in commit 4be63c85d2.
2025-06-08 21:58:18 +02:00
Eshel Yaron
4be63c85d2
; Document 'completion-table-with-metadata' in the ELisp manual
* doc/lispref/minibuf.texi (Programmed Completion): Document
'completion-table-with-metadata'.
2025-06-08 21:07:20 +02:00
Eli Zaretskii
c0a913ea4f ; * doc/lispref/modes.texi (Font Lock Basics): Remove old info (bug#78720). 2025-06-08 18:43:20 +03:00
shipmints
13fa74b73c Add optional inherit argument to 'face-all-attributes' (bug#77945)
* lisp/faces.el (face-all-attributes): Add 'inherit' argument
and pass to 'face-attribute'.
2025-06-07 12:39:49 +03:00
Eli Zaretskii
5bf6585de2 ; Improve documentation of treesit nodes
* doc/lispref/parsing.texi (Retrieving Nodes): Fix and describe the
printed representation of treesit nodes.
2025-06-05 14:25:06 +03:00
Eli Zaretskii
bcf005fa77 Improve documentation of treesit "thing"
* src/treesit.c (syms_of_treesit):
* lisp/treesit.el (treesit-cycle-sexp-type):
(treesit-thing-at, treesit-thing-at-point): Doc fixes.

* doc/lispref/parsing.texi (User-defined Things): Improve
documentation of treesit "thing" and related functions; add
cross-references and indexing.
2025-06-05 10:30:44 +03:00
Eli Zaretskii
b247b1e0b1 Merge from origin/emacs-30
9dc6c21b41 ; * lisp/subr.el (setq-local): Doc fix (bug#78644).
1bb88a86cb Revert "; * lisp/subr.el (setq-local): Doc fix (bug#78644)."
cb9556d669 ; * lisp/subr.el (setq-local): Doc fix (bug#78644).
8881dca81c ; * doc/lispref/searching.texi (Char Classes): Add speedu...
4507b6a9c7 Fix bug in 'todo-jump-to-category' (bug#78608)
2025-05-31 08:29:51 -04:00
Eli Zaretskii
8881dca81c ; * doc/lispref/searching.texi (Char Classes): Add speedup advice. 2025-05-29 19:02:13 +03:00
Martin Rudalics
433a031d24 Have 'delete-frame' delete initial daemon frame only if FORCE is non-nil
* src/frame.c (delete_frame): Delete initial daemon frame only
if FORCE is non-nil (Bug#78583).
(Fdelete_frame): Rewrite doc-string to mention that it can
delete an initial daemon frame if and only if FORCE is non-nil.
* etc/NEWS:
* doc/lispref/frames.texi (Deleting Frames): Mention that
'delete-frame' can delete an initial daemon frame if and only if
FORCE is non-nil.
2025-05-29 11:33:28 +02:00
Eli Zaretskii
da174e4a15 ; Fix documentation of a recent commit
* etc/NEWS:
* doc/lispref/loading.texi (How Programs Do Loading): Document the
new variable and function.

* src/lread.c (load-path-filter-function):
* lisp/startup.el (load-path-filter-cache-directory-files)
(load-path-filter--cache): Doc fixes.
2025-05-24 10:23:11 +03:00
Mattias Engdegård
2606e3dd99 * doc/lispref/searching.texi (Rx Notation): Fix example (bug#76731)
The example purporting to match C comments was wrong.
Reported by Yue Yi, whose proposed remedy is used here.
2025-05-17 14:20:51 +02:00
Eli Zaretskii
bd57055a58 Merge from origin/emacs-30
299d3a4401 Fix saving abbrevs by 'abbrev-edit-save-buffer'
399d05332e ; Remove confusing text from ELisp manual
feecb1fbc6 ; * doc/emacs/cmdargs.texi (General Variables): More accu...
18e1aabbea ; Improve documentation of the -L command-line option
c80fbe3f23 typescript-ts-mode: align ternary-chain branches (bug#78187)
16bfbc6fe3 ; Tramp test fixes
f0ac271da3 ; Time Stamps doc: Clearer customize recipe
49c06df224 ; * doc/lispref/variables.texi (Default Value): Update.
cbea5997c0 ; * lisp/mh-e/mh-e.el: Commentary: link to The MH-E Manual
0bf956235e Improve Tramp test
eaf01d034c * lisp/autorevert.el (auto-revert-remote-files): Adapt do...
e32bb816ad ; Improve documentation of ls-lisp.el
2d5f243470 ; * lisp/emacs-lisp/comp.el (native-compile-prune-cache):...
bb73533165 Improve Electric Pair mode documentation (bug#78021)
2025-05-17 06:52:01 -04:00
Eli Zaretskii
399d05332e ; Remove confusing text from ELisp manual
* doc/lispref/variables.texi (Defining Variables): Remove outdated
confusing warning.  For the details, see
https://lists.gnu.org/archive/html/emacs-devel/2025-05/msg00332.html.
2025-05-17 12:35:29 +03:00
Eli Zaretskii
db198e0e59 ; Fix wording of recently-added documentation
* src/eval.c (Fset_buffer_local_toplevel_value)
(Fbuffer_local_toplevel_value):
* doc/lispref/variables.texi (Default Value): Fix wording of
documentation.
2025-05-15 16:29:27 +03:00
Sean Whitton
45627ca7cc New top-level buffer-local value functions
* src/eval.c (local_toplevel_binding)
(Fbuffer_local_toplevel_value, Fset_buffer_local_toplevel_value)
(syms_of_eval): New functions.
* doc/lispref/variables.texi (Default Value):
* lisp/subr.el (setq-local):
* etc/NEWS: Document them.
* test/lisp/emacs-lisp/lisp-tests.el
(core-elisp-tests-4-toplevel-values): New test.
* lisp/progmodes/xref.el (xref--show-xref-buffer)
(xref-show-definitions-buffer-at-bottom):
* lisp/vc/vc-dispatcher.el (vc-setup-buffer):
Use set-buffer-local-toplevel-value.
2025-05-15 13:40:04 +01:00
Sean Whitton
49c06df224 ; * doc/lispref/variables.texi (Default Value): Update.
Frame-local variables have been removed.
2025-05-13 12:07:42 +01:00
Eli Zaretskii
1410bfb7ca Merge from origin/emacs-30
0d493864ce Fix indentation of XML comments
1a2c29b531 Improve Tramp's make-process handling for Solaris
a7dffc2ea3 Document 'time-stamp-time-zone' in Emacs Manual
0b4eb525b6 Make treesit--simple-indent-eval more permissive (bug#78065)
ed7b55f6bf Adapt Tramp tests
b172a1478c ; * doc/lispref/tips.texi (Library Headers): Fix wording ...
81629b2b2b ; * lisp/gnus/mail-source.el (mail-sources): Fix a typo (...
2025-05-10 07:40:30 -04:00
Martin Rudalics
0041873502 Fix infinite looping in 'next-frame' and associates (Bug#77985)
* src/frame.c (next_frame): Rewrite to avoid infinite looping if
FRAME itself does not qualify as candidate frame (Bug#77985).
(Fnext_frame, Fprevious_frame): Adjust do-strings.
* lisp/frame.el (other-frame): Adjust doc-string.
(frame-list-1): New function.
(make-frame-names-alist): Rewrite using 'frame-list-1' instead
of 'next-frame' (Bug#77985).
(delete-other-frames): Rewrite using 'frame-list' instead of
'next-frame'.
* doc/lispref/frames.texi (Finding All Frames): Minor
clarifications for 'frame-list' and 'next-frame'.
2025-05-09 09:36:00 +02:00
Eli Zaretskii
b172a1478c ; * doc/lispref/tips.texi (Library Headers): Fix wording (bug#78253). 2025-05-05 14:51:56 +03:00
Yuan Fu
1897da0b59
Add line-column tracking for tree-sitter
Add line-column tracking for tree-sitter parsers.  Copied from
comments in treesit.c:

   Technically we had to send tree-sitter the line and column
   position of each edit.  But in practice we just send it dummy
   values, because tree-sitter doesn't use it for parsing and
   mostly just carries the line and column positions around and
   return it when e.g. reporting node positions[1].  This has
   been working fine until we encountered grammars that actually
   utilizes the line and column information for
   parsing (Haskell)[2].

   [1] https://github.com/tree-sitter/tree-sitter/issues/445
   [2] https://github.com/tree-sitter/tree-sitter/issues/4001

   So now we have to keep track of line and column positions and
   pass valid values to tree-sitter.  (It adds quite some
   complexity, but only linearly; one can ignore all the linecol
   stuff when trying to understand treesit code and then come
   back to it later.)  Eli convinced me to disable tracking by
   default, and only enable it for languages that needs it.  So
   the buffer starts out not tracking linecol.  And when a
   parser is created, if the language is in
   treesit-languages-require-line-column-tracking, we enable
   tracking in the buffer, and enable tracking for the parser.
   To simplify things, once a buffer starts tracking linecol, it
   never disables tracking, even if parsers that need tracking
   are all deleted; and for parsers, tracking is determined at
   creation time, if it starts out tracking/non-tracking, it
   stays that way, regardless of later changes to
   treesit-languages-require-line-column-tracking.

   To make calculating line/column positons fast, we store
   linecol caches for begv, point, and zv in the
   buffer (buf->ts_linecol_cache_xxx); and in the parser object,
   we store linecol cache for visible beg/end of that parser.

   In buffer editing functions, we need the linecol for
   start/old_end/new_end, those can be calculated by scanning
   newlines (treesit_linecol_of_pos) from the buffer point
   cache, which should be always near the point.  And we usually
   set the calculated linecol of new_end back to the buffer
   point cache.

   We also need to calculate linecol for the visible_beg/end for
   each parser, and linecol for the buffer's begv/zv, these
   positions are usually far from point, so we have caches for
   all of them (in either the parser object or the buffer).
   These positions are far from point, so it's inefficient to
   scan newlines from point to there to get up-to-date linecol
   for them; but in the same time, because they're far and
   outside the changed region, we can calculate their change in
   line and column number by simply counting how much newlines
   are added/removed in the changed
   region (compute_new_linecol_by_change).

* doc/lispref/parsing.texi (Using Parser): Mention line-column
tracking in manual.
* etc/NEWS: Add news.
* lisp/treesit.el:
(treesit-languages-need-line-column-tracking): New variable.
* src/buffer.c: Include treesit.h (for TREESIT_EMPTY_LINECOL).
(Fget_buffer_create):
(Fmake_indirect_buffer): Initialize new buffer fields.
(Fbuffer_swap_text): Add new buffer fields.
* src/buffer.h (ts_linecol): New struct.
(buffer): New buffer fields.
(BUF_TS_LINECOL_BEGV):
(BUF_TS_LINECOL_POINT):
(BUF_TS_LINECOL_ZV):
(SET_BUF_TS_LINECOL_BEGV):
(SET_BUF_TS_LINECOL_POINT):
(SET_BUF_TS_LINECOL_ZV): New inline functions.
* src/casefiddle.c (casify_region): Record linecol info.
* src/editfns.c (Fsubst_char_in_region):
(Ftranslate_region_internal):
(Ftranspose_regions): Record linecol info.
* src/insdel.c (insert_1_both):
(insert_from_string_1):
(insert_from_gap_1):
(insert_from_buffer):
(replace_range):
(del_range_2): Record linecol info.
* src/treesit.c (TREESIT_BOB_LINECOL):
(TREESIT_EMPTY_LINECOL):
(TREESIT_TS_POINT_1_0): New constants.
(treesit_debug_print_linecol):
(treesit_buf_tracks_linecol_p):
(restore_restriction_and_selective_display):
(treesit_count_lines):
(treesit_debug_validate_linecol):
(treesit_linecol_of_pos):
(treesit_make_ts_point):
(Ftreesit_tracking_line_column_p):
(Ftreesit_parser_tracking_line_column_p): New functions.
(treesit_tree_edit_1): Accept real TSPoint and pass to
tree-sitter.
(compute_new_linecol_by_change): New function.
(treesit_record_change_1): Rename from treesit_record_change,
handle linecol if tracking is enabled.
(treesit_linecol_maybe): New function.
(treesit_record_change): New wrapper around
treesit_record_change_1 that handles some boilerplate and sets
buffer state.
(treesit_sync_visible_region): Handle linecol if tracking is
enabled.
(make_treesit_parser): Setup parser's linecol cache if tracking
is enabled.
(Ftreesit_parser_create): Enable tracking if the parser's
language requires it.
(Ftreesit__linecol_at):
(Ftreesit__linecol_cache_set):
(Ftreesit__linecol_cache): New functions for debugging and
testing.
(syms_of_treesit): New variable
Vtreesit_languages_require_line_column_tracking.
* src/treesit.h (Lisp_TS_Parser): New fields.
(TREESIT_BOB_LINECOL):
(TREESIT_EMPTY_LINECOL): New constants.
* test/src/treesit-tests.el (treesit-linecol-basic):
(treesit-linecol-search-back-across-newline):
(treesit-linecol-col-same-line):
(treesit-linecol-enable-disable): New tests.
* src/lisp.h: Declare display_count_lines.
* src/xdisp.c (display_count_lines): Remove static keyword.
2025-05-03 22:14:03 -07:00
Sean Whitton
d32ab06145 Move documentation of this-command buffer display condition entry
* doc/lispref/buffers.texi (Buffer List): Document this-command
buffer display condition entry.
* doc/lispref/windows.texi (Choosing Window): Give an example of
using this-command buffer display condition entry in
display-buffer-alist.
(Buffer Display Action Alists):
* lisp/window.el (display-buffer): Delete documentation of
this-command buffer display condition entry from these locations
because it is not a buffer display action alist entry.
* lisp/subr.el (buffer-match-p): Update cross reference.
2025-05-02 12:49:35 +08:00
Eli Zaretskii
75870a7ad1 ; Fix wording of recently added documentation
* lisp/window.el (display-buffer):
* doc/lispref/windows.texi (Buffer Display Action Alists): Fix wording.
2025-05-01 17:42:12 +03:00
Sean Whitton
343f0c44f3 New this-command buffer display action alist entry
* lisp/subr.el (buffer-match-p): New this-command cons cell
condition to implement new this-command buffer display action
alist entry (bug#78082).
* lisp/window.el (display-buffer):
* doc/lispref/windows.texi (Buffer Display Action Alists):
* etc/NEWS: Document the new buffer display action alist entry.
2025-05-01 20:56:36 +08:00
Eli Zaretskii
6bb3c6f9e1 Merge from origin/emacs-30
cc5b1a01a2 ; * doc/misc/efaq-w32.texi (Location of init file): Fix a...
6c2aaedfce Fix compilation errors in emacsclient.c with MinGW GCC 15
d56e5ba97e ; * etc/DEBUG: Add link to GCC bug #78685.
80cbd1e31c ; Fix key notation in Introduction to Emacs Lisp
1224e5fd96 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
79e7eeb329 ; Improve documentation of 'format-time-string'
2838b64fc8 ; * lisp/textmodes/text-mode.el (text-mode-variant): Fix ...
9adb05422e ; Improve obsolescence of 'text-mode-variant'
4858d81848 ; * lisp/files.el (revert-buffer-restore-functions): Doc ...
2a8e223b8d ; Mention early-init file in Emacs FAQ for Windows
14c707b42d ; Isearch: Fix key bindings in docstrings
2025-04-30 07:14:23 -04:00
Eli Zaretskii
79e7eeb329 ; Improve documentation of 'format-time-string'
* doc/lispref/os.texi (Time Parsing): Fix documentation of week
numbers for %U, %V and %W.  (Bug#78096)
2025-04-29 11:19:19 +03:00
Eli Zaretskii
9adb05422e ; Improve obsolescence of 'text-mode-variant'
* lisp/textmodes/text-mode.el (text-mode-variant): Improve
obsolescence announcement text.

* doc/lispref/modes.texi (Example Major Modes): Update example.
(Bug#78125).
2025-04-29 10:09:54 +03:00
Eli Zaretskii
37b2c2fcdd ; Improve the documentation of a recent commit
* etc/NEWS:
* doc/lispref/frames.texi (Deleting Frames): Improve documentation
of 'frame-deletable-p'.
2025-04-19 09:11:57 +03:00
Yuan Fu
e7ca83a2f4
Merge from savannah/emacs-30
01d4eb3dd4 ; Improve doc string of 'insert-char'
93ad8407ed * admin/notes/emba: Fix docker build instruction.
b901290ae7 * doc/lispref/text.texi (Margins): Grammar fix.
16855c89dd Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
8792d3431b Backport: Fix tree-sitter tests on Emba

# Conflicts:
#	test/infra/Dockerfile.emba
2025-04-18 16:30:39 -07:00
Sean Whitton
b901290ae7 * doc/lispref/text.texi (Margins): Grammar fix.
Author:
2025-04-18 14:31:50 +08:00
Eli Zaretskii
4918de1699 Support file:// URIs and readonly DB in 'sqlite-open'
* src/sqlite.c (Fsqlite_open): Two new optional arguments,
READONLY and DISABLE-URI.  Doc fix.

* etc/NEWS:
* doc/lispref/text.texi (Database): Document the new optional
arguments to 'sqlite-open'.  (Bug#65274)
2025-04-14 12:42:28 +03:00
Pengji Zhang
6f494d74f6 New user option to hide minor mode lighters (bug#77361)
* lisp/bindings.el (mode-line-collapse-minor-modes): New user
option.
(mode-line-minor-modes): New variable to hold mode line
constructs for minor modes.
(mode-line--make-lighter-menu): New helper function to generate
the menu for hidden minor modes.
(mode-line--minor-modes): New helper function to computer mode
line constructs for minor mode lighters.
(mode-line-modes): Use the new variable 'mode-line-minor-modes',
and adjust the order of elements so the indicator for hidden
minor modes is shown towards the end.

* doc/lispref/modes.texi (Mode Line Basics): Move the paragraph
for 'mode-line-compact' from here...
* doc/emacs/display.texi (Optional Mode Line): ...to here, and
document the new user option.
* etc/NEWS: Annouce the new user option.
2025-04-13 11:43:33 +03:00
Eli Zaretskii
b0d6fe1449 Disable clearing echo-area when 'inhibit-message' is non-nil
* src/xdisp.c (clear_message): Don't clear echo-area if
'inhibit-message' is non-nil.

* etc/NEWS:
* doc/lispref/display.texi (Displaying Messages): Document the
above change.  (Bug#77257)
2025-04-13 10:44:55 +03:00
Eli Zaretskii
2b3763e955 Merge from origin/emacs-30
d3c39fb522 Fix display of keys in 'help-form' buffers (bug#77118)
6509cc20a9 Improve documentation of 'user-emacs-directory'
3f06059730 Update remarks on name prefixes in coding conventions
e966ff9759 ; * doc/emacs/files.texi (Image Mode): Fix a typo (bug#77...
378bea99b1 ; Fix doc strings of a few Dired commands
30fb2ac07a ; * CONTRIBUTE: Clarify single-line commit should end wit...
417d14a95e ; * admin/MAINTAINERS: Complete the handover of VC
bb756b195a ; Fix typo in Tramp
2025-04-12 08:57:38 -04:00
Sean Whitton
3f06059730 Update remarks on name prefixes in coding conventions
* doc/lispref/tips.texi (Coding Conventions): Say that it's okay
to put the name prefix later for defining constructs, rather
than explicitly instructing the reader to do so.  Condense the
recommendation to err on the side of prepending the name prefix.
2025-04-12 11:05:45 +08:00
Sean Whitton
09887a2d41 Rename some of the new window layout commands
* lisp/window-x.el (rotate-window-layout-counterclockwise):
Rename to window-layout-rotate-anticlockwise.
(rotate-window-layout-clockwise):
Rename to window-layout-rotate-clockwise.
(flip-window-layout-horizontally):
Rename to window-layout-flip-leftright.
(flip-window-layout-vertically):
Rename to window-layout-flip-topdown.
(transpose-window-layout): Rename to window-layout-transpose.

* doc/lispref/windows.texi (Changing Window Layouts):
* etc/NEWS:
* lisp/ldefs-boot.el (rotate-window-layout-counterclockwise)
(rotate-window-layout-clockwise, flip-window-layout-horizontally)
(flip-window-layout-vertically, transpose-window-layout):
Update for the renames.
2025-04-09 13:34:55 +08:00
Juri Linkov
5e0daa1ef7 New function treesit-parsers-at for treesit-language-at (bug#77256).
* doc/lispref/parsing.texi (Multiple Languages): The variable
'treesit-language-at-point-function' is now optional for
multi-language major modes.  Add description of 'treesit-parsers-at'.

* lisp/treesit.el (treesit-language-at-point-function):
Change the the docstring to remove the dissuasion against
deriving the language from parser ranges.
(treesit-language-at): Use the first parser from
'treesit-parsers-at' as the default return value when
'treesit-language-at-point-function' is nil.  Adapt the docstring.
(treesit-node-at): Use 'treesit-parsers-at'.
(treesit-parsers-at): New function.
(treesit-local-parsers-at): Use 'treesit-parsers-at'
with the most part of the body moved to it.
(treesit-local-parsers-on): Replace the overlay property
'treesit-parser' with 'treesit-parser-local-p' in the docstring.
(treesit-up-list, treesit-simple-imenu, treesit-outline-level):
Use 'treesit-parsers-at'.

* lisp/progmodes/c-ts-mode.el (c-ts-mode): Don't set
'treesit-language-at-point-function'.

* lisp/progmodes/elixir-ts-mode.el (elixir-ts--treesit-language-at-point):
Remove.
(elixir-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/progmodes/js.el (js--treesit-language-at-point): Remove.
(js-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/progmodes/php-ts-mode.el (php-ts-mode--html-language-at-point)
(php-ts-mode--language-at-point): Remove.
(php-ts-mode): Don't set 'treesit-language-at-point-function'.

* lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--language-at-point):
Remove.
(mhtml-ts-mode): Don't set 'treesit-language-at-point-function'.
Use 'treesit-language-at' for mode-line lighter.
2025-04-08 20:40:10 +03:00
Eli Zaretskii
d42ee9f33a Merge from origin/emacs-30
38fec86281 ; Improve the documentation of 'slice' display spec (bug#...
3f05b455f7 ; * src/editfns.c (Fmessage): Mention 'inhibit-message' (...
2025-04-05 07:07:28 -04:00
Paul Nelson
2d0b5f34a0 Restrict symbol prettification to displayable glyphs
* lisp/international/mule.el (char-displayable-on-frame-p): New
function used to determine whether a character can be
meaningfully displayed on a given frame.
* doc/lispref/display.texi (Fontsets): Document it.
* lisp/progmodes/prog-mode.el
(prettify-symbols--composition-displayable-p): New function used
to restrict to displayable prettification symbols.  This
prevents issues with missing characters appearing as boxes.
(prettify-symbols--make-keywords): Use it.  (Bug#77381)
2025-04-05 12:24:50 +03:00
Eli Zaretskii
38fec86281 ; Improve the documentation of 'slice' display spec (bug#77384). 2025-03-30 19:27:22 +03:00
Stefan Monnier
7c82cc8b97 (replace-region-contents): Improve and promote (bug#76313)
Swap the role of `replace-region-contents` and `replace-buffer-contents`,
so `replace-region-contents` is the main function, implemented in C,
and `replace-buffer-contents` is a mere wrapper (marked as obsolete).
Also remove the need to rely on narrowing and on describing the
new text as a function.
Finally, allow MAX-SECS==0 to require a cheap replacement, and
add an INHERIT argument.

* src/editfns.c: Include `coding.h`.
(Freplace_region_contents): Rename from `Freplace_buffer_contents`.
Change calling convention to that of `replace-region-contents`.
Add more options for the SOURCE argument.  Add INHERIT argument.
Skip the costly algorithm if MAX-SECS is 0.
* src/insdel.c (replace_range): Allow NEW to be a buffer.

* lisp/subr.el (replace-buffer-contents): New implementation.
* lisp/emacs-lisp/subr-x.el (replace-region-contents): Delete.

* doc/lispref/text.texi (Replacing): Document new API for
`replace-region-contents`.  Remove documentation of
`replace-buffer-contents`.

* test/src/editfns-tests.el (replace-buffer-contents-1)
(replace-buffer-contents-2, replace-buffer-contents-bug31837):
Use `replace-region-contents`.
(editfns--replace-region): Delete.
(editfns-tests--replace-region): Use `replace-region-contents`.
Adds tests for new types of SOURCE args.
2025-03-29 17:49:05 -04:00
Stefan Kangas
dd0dd87e3a New function 'hash-table-contains-p'
This function tests whether a given key is present in a hash table.
Emacs Lisp has long lacked a standard way to do this, leading users to
write one of:

    (not (eq (gethash key table 'missing) 'missing))
or
    (gethash key table)

This idiom is error-prone (when 'missing' or 'nil' are valid values),
and it obscures intent.  The new function avoids such pitfalls,
improves readability, and makes the intent explicit:

    (hash-table-contains-p key table)

The name 'hash-table-contains-p' exists in other Lisp dialects (e.g.,
SRFI-125), and follows the precedent of 'seq-contains-p'.  Other
alternatives considered include `hash-table-has-key-p` and
`hash-table-key-exists-p`, but none were clearly better.

This was previously discussed in 2018, and all comments were positive,
but the proposed patch (implementing it in C) was never pushed:
https://lists.gnu.org/r/emacs-devel/2018-02/msg00424.html

* lisp/subr.el (hash-table-contains-p): New function.
* lisp/emacs-lisp/shortdoc.el (hash-table):
* doc/lispref/hash.texi (Other Hash): Document the new function.
* test/lisp/subr-tests.el (hash-table-contains-p): New test.
2025-03-29 14:59:36 +01:00