Stefan Kangas [Thu, 15 Dec 2022 20:13:14 +0000 (21:13 +0100)]
Merge from origin/emacs-29
a15cd55044c ; Don't quote nil in comments da39200c4be ; Checkdoc fixes in dired-aux.el fd403a5c5a8 Fix ruby-add-log-current-method after nested class defini... 2ca06aed7b3 Add indent rules to js/typescript/tsx-ts-mode (bug#60074) a54d5f500c1 Improve fontification in csharp-ts-mode (bug#59897) 3db2f560bb7 Revert "Add expression for generic_name in csharp-ts-mode" 1985762fbd7 Introduce support for TOML config-format 622838b957e Fix handling of % when searching in .tex or .dtx files 3b226b60248 Treat C++ classes as defuns in C Tree-sitter mode (bug#60... 480f41c7deb Add < and > to the syntax table in c++-ts-mode (bug#60049) fbf0d3b796a Improve fontifications in Typescript mode f93a5180a61 Update the documentation of overlays (bug#59996) d51b66ed540 ; Improve description of scoping and let-bindings 752f9dde631 ; Fix a typo in window.el 102a3e3b445 Don't send erc-sasl-user as USER command argument f0c90888781 Set erc-network to a "given" ID instead of failing 09c0c6b2ba3 Limit casemapping to appropriate ranges in ERC 44b04c0ac1c Actually accept non-symbols as IDs in erc-open 75f26646d4a ; Be nicer when updating browse-url var in erc-compat 0155fc67be3 Respect a nil erc-session-password when reconnecting 9ac80e8a6e4 Add dedicated auth-source section in ERC manual 2d96a18cd09 ; * lisp/emacs-lisp/shortdoc.el: fix mistakes in previous... 1d3cbba7dfa ; * lisp/progmodes/cmake-ts-mode.el (auto-mode-alist): $ ... 0cc199f1a61 Better shortdoc examples 931d97bf563 Shortdoc: read and evaluate strings after :eval be165f75332 Fix Tramp tests in eglot-tests, prefix tests uniquely 8c30cb90ba9 * lisp/vc/vc-git.el (vc-git-checkin): Use make-nearby-tem... 3efe4df1d20 Delete temp files after icalendar tests
Po Lu [Thu, 15 Dec 2022 12:06:37 +0000 (20:06 +0800)]
Handle selection transfer errors earlier
* src/xselect.c (x_decline_selection_request, struct transfer)
(struct x_selection_request, x_cancel_selection_transfer)
(x_start_selection_transfer, x_continue_selection_transfer):
Give the right serial to x_ignore_errors_for_next_request.
(x_handle_selection_error): New function.
(x_reply_selection_request): Give the right serial to
x_ignore_errors_for_next_request.
* src/xterm.c (x_ignore_errors_for_next_request): New arg
`selection_serial'. All callers changed.
(x_error_handler): Call selection error handler.
* src/xterm.h (struct x_failable_request): New field
`selection_serial'.
Dmitry Gutov [Thu, 15 Dec 2022 01:21:14 +0000 (03:21 +0200)]
Fix ruby-add-log-current-method after nested class definition
* lisp/progmodes/ruby-mode.el (ruby--add-log-current-indent):
New function.
(ruby-add-log-current-method): Use it.
Check for "class" and "module" indentation to filter out the
definitions which don't include the given position. Also try to
match "def" only once (for performance), because if the closest
one doesn't include the given position, none will.
* test/lisp/progmodes/ruby-mode-tests.el
(ruby-add-log-current-method-after-inner-class-outside-methods)
(ruby-add-log-current-method-after-inner-class-outside-methods-with-text):
New tests.
Add indent rules to js/typescript/tsx-ts-mode (bug#60074)
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add in binary_expression and
jsx_fragment.
* lisp/progmodes/js.el (js--treesit-indent-rules): Add the same rules.
This commit introduces support for the semi-popular TOML
config-format[1] through a new major-mode: toml-ts-mode.
I've read through the full spec[2], and from what I can see this
major-mode should provide correct syntax-highligting for every sort of
config-declaration which adheres to the specification.
Besides that it also adds support for imenu and basic tree-sitter
based navigation.
Daniel Martín [Tue, 13 Dec 2022 21:28:13 +0000 (22:28 +0100)]
Add < and > to the syntax table in c++-ts-mode (bug#60049)
* lisp/progmodes/c-ts-mode.el (c++-ts-mode--syntax-table): Add a
specific syntax table for C++. Consider "<" and ">" open/close
delimiters (C++ templates).
(c++-ts-mode): Use the new syntax table.
Warn about unmatchable constant args to `eq`, `memq` etc
Add a byte-compiler warning about attempts to compare literal values
with undefined identity relation to other values. For example:
(eq x 2.0)
(memq x '("a" (b) [c]))
Such incomparable values include all literal conses, strings, vectors,
records and (except for eql and memql) floats and bignums.
The warning currently applies to eq, eql, memq, memql, assq, rassq,
remq and delq.
* lisp/emacs-lisp/bytecomp.el (bytecomp--dodgy-eq-arg)
(bytecomp--value-type-description, bytecomp--arg-type-description)
(bytecomp--warn-dodgy-eq-arg, bytecomp--check-eq-args)
(bytecomp--check-memq-args): New.
(eq, eql, memq, memql, assq, rassq, remq, delq):
Set compiler-macro property.
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings):
Amend doc string.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp--with-warning-test): Fix text-quoting-style and expand
re-warning so that it doesn't need to be a literal.
(bytecomp-warn-dodgy-args-eq, bytecomp-warn-dodgy-args-memq):
New tests.
Eli Zaretskii [Wed, 14 Dec 2022 18:13:47 +0000 (20:13 +0200)]
Update the documentation of overlays (bug#59996)
* src/buffer.c (Foverlay_recenter, Foverlay_lists): Update the doc
strings.
* lisp/subr.el (copy-overlay): Update comment.
* doc/lispref/internals.texi (Buffer Internals): Remove buffer
fields relevant to the old implementation; add the new interval
tree field.
* doc/lispref/display.texi (Overlays, Managing Overlays): Update
text to be consistent with the new implementation of overlays.
(Managing Overlays): Remove documentation of 'overlay-recenter'.
* etc/NEWS: Mention incompatible aspects of overlay
reimplementation.
Eli Zaretskii [Wed, 14 Dec 2022 15:46:16 +0000 (17:46 +0200)]
; Improve description of scoping and let-bindings
* doc/lispref/variables.texi (Local Variables, Variable Scoping):
Explain the move to lexical-binding and elaborate on 'let*'.
Suggested by Michael Heerdegen <michael_heerdegen@web.de>.
(Bug#60027)
Eli Zaretskii [Wed, 14 Dec 2022 14:53:29 +0000 (16:53 +0200)]
Make proced-tests work on more systems
* test/lisp/proced-tests.el (proced-format-test)
(proced-update-test, proced-revert-test, proced-color-test):
Remove the 'skip-unless' condition, as it is unnecessary.
(proced-refine-test, proced-refine-with-update-test): Use PID, not
Args, as the column to test, as PID is more portable.
F. Jason Park [Tue, 13 Dec 2022 07:58:03 +0000 (23:58 -0800)]
Don't send erc-sasl-user as USER command argument
* lisp/erc/erc-sasl.el (erc-sasl--send-cap-ls): Add internal switch
for sending an opening "CAP LS". The rationale for not enabling this
by default is twofold: one, it more strongly implies that ERC supports
IRCv3 client capability negotiation, which is somewhat disingenuous;
and, two, We'd still be "faking it" by firing and forgetting, and more
balls in the air makes things less predictable.
(erc--register-connection): Possibly send a "CAP LS" before anything
depending on the value of `erc-sasl--send-cap-ls'. Also, don't
attempt to send `erc-session-username' when it holds an SASL username
because the latter may contain protocol-defying characters.
* test/lisp/erc/resources/base/local-modules/fourth.eld: change user
parameter of "USER" command to reflect nick when `erc-sasl-user' is
set to `:user'. (Bug#59976.)
F. Jason Park [Tue, 13 Dec 2022 07:58:03 +0000 (23:58 -0800)]
Set erc-network to a "given" ID instead of failing
* lisp/erc/erc-networks.el (erc-networks--determine): Return the
so-called "given" ID from a non-nil `:id' keyword arg passed to `erc'
or `erc-tls'.
(erc-networks--allow-unknown-network): Add internal variable to
allow IRC session to continue despite the network being unknown.
(erc-networks--set-name): Tell the user about falling back to a given
ID when the network can't be determined. When that's so, end the
session by destroying the connection unless
`erc-networks--allow-unknown-network' is enabled. (Bug#59976.)
(erc-networks--ensure-announced): Include the fallback announced
server name in the error message.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Add
dummy server process and don't expect an error to be signaled.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-networks-announced-missing): Don't expect an error to
be signaled.
* test/lisp/erc/resources/networks/announced-missing/foonet.eld:
Remove "mode" match pattern.
F. Jason Park [Mon, 12 Dec 2022 03:41:43 +0000 (19:41 -0800)]
Limit casemapping to appropriate ranges in ERC
* lisp/erc/erc-common.el (erc-downcase): Use case table for
`erc-downcase' so that case conversions are limited to the ASCII
interval.
* lisp/erc/erc.el (erc-casemapping--rfc1459-strict,
erc--casemapping-rfc1459): Make these case tables instead of
translation tables. The functions in case-table.el modify the
standard syntax table, but that doesn't seem to make sense here,
right?
* test/lisp/erc/erc-tests.el (erc-downcase): Add cases showing
mappings outside of the ASCII range. (Bug#59976.)
F. Jason Park [Mon, 12 Dec 2022 03:41:43 +0000 (19:41 -0800)]
Actually accept non-symbols as IDs in erc-open
* lisp/erc/erc.el (erc-generate-new-buffer-name): Despite what it says
in the documentation, only symbols were being accepted as valid `:id'
entry-point arguments. This uses the interned `princ' representation
of the argument instead.
* test/lisp/erc/erc-scenarios-base-netid-samenet.el
(erc-scenarios-common--base-network-id-same-network): Randomly specify
a string for the ID param instead of a non-nil symbol when opening a
new connection.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-assert-initial-buf-name): Adjust helper to allow
for non-symbol IDs. (Bug#59976.)
F. Jason Park [Mon, 12 Dec 2022 03:16:07 +0000 (19:16 -0800)]
; Be nicer when updating browse-url var in erc-compat
* lisp/erc/erc-compat.el: Be more cautious about modifying
`browse-url-default-handlers' when loading erc-compat on Emacs 28. A
user may have already added an entry for irc:// URLs before loading
`erc-compat'.
F. Jason Park [Sat, 3 Dec 2022 07:11:24 +0000 (23:11 -0800)]
Respect a nil erc-session-password when reconnecting
* lisp/erc/erc.el (erc-open): Simplify `old-vars' expression.
(erc--compute-server-password): Only compute a server password when
first connecting. For compatibility, this respects third-party code
that expects session passwords in target buffers when initially
non-nil.
* test/lisp/erc/erc-scenarios-services-misc.el
(erc-scenarios-services-auth-source-reconnect): Add new test.
* test/lisp/erc/resources/services/auth-source/recon.eld: Add new test
data file. (Bug#59858.)
F. Jason Park [Thu, 1 Dec 2022 07:10:58 +0000 (23:10 -0800)]
Add dedicated auth-source section in ERC manual
* doc/misc/erc.texi: Move auth-source description from the Password
subheading of the Advanced chapter's Connecting section to the new
Integrations section as a new node, Auth-Source, and give it a bit
more structure. Fix various misuses of xref vs. pxref. Convert URL
subheading to subsection and add anchor. Prefer "backend" as a single
word, based on usage in other manuals. Also replace loud "warning" in
SASL troubleshooting section.
* etc/ERC-NEWS: Re-link auth-source mention.
* lisp/erc/erc-sasl.el (erc-sasl-auth-source-function): Update info
node in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function):
Re-link auth-source info node in doc string.
* lisp/erc/erc.el (erc-password, erc-auth-source-server-function,
erc-auth-source-join-function): Re-link auth-source info node in doc
strings.
Laurence Warne [Sat, 3 Dec 2022 21:41:57 +0000 (21:41 +0000)]
Make proced-update preserve refinements
Make proced-update preserve refinements by creating a new buffer local
variable proced-refinements which stores information about the current
refinements and is used by proced-update to further refine
proced-process-alist in the case it is non-nil. The result is that
refinements are not immediately cleared when a proced buffer is
updated with proced-auto-update-flag non-nil. proced-revert
maintains its current behaviour of clearing any active refinements.
* lisp/proced.el (proced-refinements): New buffer local variable
which tracks the current refinements.
(proced-refine): Set 'proced-refinements' variable and defer setting of
'proced-process-alist' to 'proced-update'.
(proced-update): Take into account 'proced-refinements' when setting
'proced-process-alist'.
(proced-revert): Set 'proced-refinements' to nil prior to calling
'proced-update'.
* lisp/emacs-lisp/shortdoc.el
(symbol, comparison): New.
(string, list, number): Remove or change examples that do not have
well-defined results, such as `eq` on strings or floats.
Edit other examples for better illustrating each respective operation.
* lisp/emacs-lisp/shortdoc.el (shortdoc--display-function):
If the parameter of :eval is a string then read, evaluate and print
the result. This was always the intention and is documented behaviour.
Michael Albinus [Wed, 14 Dec 2022 09:52:04 +0000 (10:52 +0100)]
Fix Tramp tests in eglot-tests, prefix tests uniquely
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Use `make-nearby-temp-file'.
(eglot--call-with-tramp-test): Set `tramp-verbose' and
`default-directory'. The latter is needed for `make-nearby-temp-file'.
(eglot-test-tramp-test, eglot-test-tramp-test-2): Tag them as
:expensive-test.
(all): Prefix all tests with `eglot-test-' uniquely.
Stefan Kangas [Tue, 13 Dec 2022 23:06:29 +0000 (00:06 +0100)]
Merge from origin/emacs-29
cd5856e4038 Fix bug when calling `rgrep` non-interactively ba4bdd6a259 Adapt Tramp specific tests in eglot-tests.el 1d5c35c8e46 * lisp/textmodes/texinfo.el (texinfo-flymake): Improve do... a99d0e7e6c9 Support a function in the BUFFER-LIST arg of list-buffers... def51dd6458 ; Fix typos 4980ed7a6d9 Don't allow lazy highlight from recursive minibuffers 4ef8b9f5441 Improve resetting face attributes when looking for suitab... c4b8bc90a8e ; Fix typos in doc strings c45eb138451 ; * lisp/bs.el (bs-attributes-list): Doc fix d6adaf487d8 Add lexical-binding to example package header 03ad1a92a2d Add improved tree-sitter navigation a5272e2a7cc ; * test/src/treesit-tests.el: Add outline headers. 489bcacc7c3 Add cross-reference to flush-lines 0f9e6532b14 Use font-lock-number-face for numeric values in csharp-mode 4bccb7b211e Make treesit-query-validate create a read-only buffer c0fe6c72cec Improve dockerfile-ts-mode imenu generation (Bug#59979) 631908f7017 Add "->" to python--treesit-operators (bug#59968) 5d4274d9b65 ; * admin/notes/tree-sitter/build-module/build.sh: Add -f... d264b75669d Align C++ access specifiers to their enclosing class/stru... ca67d988d87 Add cmake-ts-mode 8ec923775de Tweak various ts-mode's indent and fontification (bug#59931) 647b6a8099f Add expression for generic_name in csharp-ts-mode (bug#59... 5b178efd85a ; Adjust eglot test to recent autopep8/pycodestyle 58b8ed8b55c ; Avoid compilation warning on MS-Windows 40c23c11e88 * lisp/outline.el: Fix the value 'insert' of outline-mino... 527eb11de20 * lisp/minibuffer.el (completions-group-separator): Rever... 42d740fb2cb ; Skip two eglot tests when typescript is missing 19ef86f775a ; Remove outdated text describing overlays 081bf583007 Skip Eglot rust-analyzer tests if 'cargo' isn't available
Juri Linkov [Tue, 13 Dec 2022 17:47:47 +0000 (19:47 +0200)]
Support a function in the BUFFER-LIST arg of list-buffers-noselect (bug#59935)
* lisp/buff-menu.el (Buffer-menu-buffer-list): New buffer-local variable.
(list-buffers-noselect): Set Buffer-menu-buffer-list to 'buffer-list'
that now keeps the buffer-local value of the provided buffer list
or a function that returns the buffer list.
(list-buffers--refresh): Handle buffer-list and Buffer-menu-buffer-list
as a function and as a list.
* lisp/progmodes/project.el (project-list-buffers): Let-bind
'buffer-list-function' used by both legacy code and the new version
of list-buffers-noselect that supports its arg BUFFER-LIST as a function.
Eli Zaretskii [Tue, 13 Dec 2022 15:35:17 +0000 (17:35 +0200)]
Improve resetting face attributes when looking for suitable fonts
* src/xfaces.c (syms_of_xfaces)<face-font-lax-matched-attributes>:
Change the default value to t. Update doc string.
(realize_gui_face): When 'Vface_font_lax_matched_attributes' is t,
reset the 3 default font attributes efficiently. Call
'font_maybe_unset_attribute' only if the value is neither nil nor
t. (Bug#59347)
Eli Zaretskii [Tue, 13 Dec 2022 14:24:09 +0000 (16:24 +0200)]
; Improve recently installed documentation
* lisp/progmodes/prog-mode.el (prog-fill-reindent-defun): Fix
wording of the doc string.
* doc/emacs/programs.texi (Multi-line Indent): Improve wording of
the description of 'prog-fill-reindent-defun' and related
variables.
Yuan Fu [Tue, 13 Dec 2022 04:25:53 +0000 (20:25 -0800)]
Add improved tree-sitter navigation
This new set of functions (and tests) should eliminate
defun-navigation bugs and limitations we currently have. This commit
doesn't change any existing bahavior: treesit-beginning/end-of-defun
and friends are unchanged. The plan is to later switch gear and
replace the current functions with the new ones introduced in this
change.
This is a relatively big change, but I've setup a comprehensive test,
and it should fix current bugs, so I think it's ok to put it on the
release branch.
The gist of the new navigation is to use treesit--defuns-around to
find the previous sibling defun, next sibling defun, and the parent
defun, then use this information to move to previous/next
beginning/end of defun in treesit--navigate-defun.
I also added comprehensive testing that tests all four possible
operations (prev-beg, next-beg, prev-end, next-end) starting at all
possible positions (between two sibling defuns, inside a sibling
defun, etc).
* lisp/treesit.el (treesit-defun-type-regexp): Expand definition to
allow (REGEXP . FILTER). Old functions don't support this, but it
should be fine since we are soon replacing them.
(treesit-defun-tactic)
(treesit-defun-skipper): New variables.
(treesit-default-defun-skipper)
(treesit--defuns-around)
(treesit--top-level-defun)
(treesit--navigate-defun): New functions.
* test/src/treesit-tests.el (treesit--ert-insert-and-parse-marker)
(treesit--ert-collect-positions)
(treesit--ert-test-defun-navigation): New helper functions.
(treesit--ert-defun-navigation-python-program)
(treesit--ert-defun-navigation-js-program)
(treesit--ert-defun-navigation-bash-program)
(treesit--ert-defun-navigation-nested-master): New variables.
(treesit-defun-navigation-nested-1)
(treesit-defun-navigation-nested-2)
(treesit-defun-navigation-nested-3)
(treesit-defun-navigation-top-level): New tests.
Stefan Kangas [Tue, 13 Dec 2022 00:43:48 +0000 (01:43 +0100)]
Add cross-reference to flush-lines
* lisp/replace.el (flush-lines, kill-matching-lines): Add
cross-references between commands, using the names
'(kill|delete)-matching-lines' for symmetry. (Bug#59934)
Daniel Martín [Sun, 11 Dec 2022 14:57:43 +0000 (15:57 +0100)]
Align C++ access specifiers to their enclosing class/struct/union
(bug#59966)
The default style in c++-mode aligns access specifiers like "private",
"public" or "protected" to their enclosing class, struct, or union.
The "ellemtel" style indents access specifiers, but this C++ style is
not supported by c++-ts-mode yet.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Align access
specifiers to their enclosing class/struct/union.
Randy Taylor [Sun, 11 Dec 2022 02:40:25 +0000 (21:40 -0500)]
Add cmake-ts-mode
* admin/notes/tree-sitter/build-module/batch.sh:
* admin/notes/tree-sitter/build-module/build.sh: Add cmake support.
* etc/NEWS: Mention it.
* lisp/progmodes/cmake-ts-mode.el: New major mode with
tree-sitter support.
* lisp/progmodes/eglot.el (eglot-server-programs): Add it.
Add expression for generic_name in csharp-ts-mode (bug#59897)
Given the below example, we want 'services' to be font-locked in
'font-lock-variable-name-face' in all cases. Previously this only
worked in the first case, and the other was font-locked as
'font-lock-function-name-face'.
Stefan Kangas [Mon, 12 Dec 2022 10:50:38 +0000 (11:50 +0100)]
; Skip two eglot tests when typescript is missing
* test/lisp/progmodes/eglot-tests.el
(javascript-basic, project-wide-diagnostics-typescript): Skip tests
when the npm package "typescript" is not installed.
Po Lu [Mon, 12 Dec 2022 11:21:10 +0000 (19:21 +0800)]
Add variable to make resizing frames sometimes faster
* etc/PROBLEMS: Add documentation about new variable.
* src/xterm.c (x_set_offset, x_set_window_size_1): Respect new
variable.
(syms_of_xterm): Add a new variable to prevent Emacs from
syncing upon resize or movement.
Yuan Fu [Sun, 11 Dec 2022 22:43:58 +0000 (14:43 -0800)]
Add customizale faces for tree-sitter explorer
* lisp/treesit.el (treesit-explorer-anonymous-node)
(treesit-explorer-field-name): New face.
(treesit--explorer-draw-node): Use the new faces.
(treesit-explore-mode): Change playground to explorer.
Introduce a new command that aims to reindent code in a defun, or fill
a paragraph of text. The command uses treesit.el when available,
otherwise falls back to using syntax-ppss and regexps. Treesit.el
needs a new variable that is intended to be set by the major modes so
that this and other future functions can know what kind of node we are
looking at.
* doc/emacs/programs.texi: Mention the new command.
* etc/NEWS: Mention the new command.
* lisp/progmodes/c-ts-mode.el (c++-ts-mode): Add regexp for the new
variable.
* lisp/progmodes/csharp-mode.el (csharp-ts-mode): Add regexp for the
new variable.
* lisp/progmodes/java-ts-mode.el (java-ts-mode): Add regexp for the
new variable.
* lisp/progmodes/js.el (js-ts-mode): Add regexp for the new variable.
* list/progmodes/prog-mode.el (prog-mode-map): Bind the new command by
default.
(prog-fill-reindent-defun): New command.
* lisp/progmodes/sh-script.el (bash-ts-mode): Add regexp for the new
variable.
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Add
regexp for the new variable.
* lisp/treesit.el (treesit-text-type-regexp): New variable.
Juri Linkov [Sun, 11 Dec 2022 17:24:34 +0000 (19:24 +0200)]
Don't use diff-mode buffer as a patch when it's visiting a file (bug#59962)
* lisp/vc/vc.el (vc-deduce-fileset-1): Don't call diff-vc-deduce-fileset
for diff-mode when buffer-file-name is non-nil. This is because in this case
a file with a diff might be committed to VCS. So don't use it as a patch
to commit with 'C-x v v'.
Fix use-package-defaults defcustom type (bug#59941)
* lisp/use-package/use-package-core.el (use-package-defaults):
Enlarge type to allow for keywords such as :ensure and :pin to be
added later, remedying a failure in test-custom-opts.
* src/itree.c (itree_iterator_start): Fix docstring typo.
* test/manual/noverlay/itree-tests.c: Stop defining unused
ITREE_DEBUG. Replace removed names and APIs with current ones,
e.g. interval_tree_init is now called itree_init, and
itree_iterator_finish no longer exists. Ensure preconditions of
itree API are satisfied before use, e.g. by zero-initializing
instances of itree_node before inserting them into a tree.