(Installation): Rename the Git install section to make it sound less
like the "normal&recommanded" way to install YAsnippet.
(Install with `package-install`): Mention GNU ELPA and GNU-devel ELPA.
(debug-ignored-errors): Remove left over code that became obsolete with
commit 175e0a3a102c22.
(yas--read-lisp): Fix code generation.
(yas-exception): Use `define-error`.
Prefer #' to quote function names.
(yas-after-exit-snippet-hook, yas-before-expand-snippet-hook)
(yas-after-reload-hook): A hook is not a function, but a symbol
containing functions. Fix doc accordingly.
(yas-define-snippets, yas-longest-key-from-whitespace)
(yas--field-parse-create): Make the doc fit within 80 columns.
(yas-skip-and-clear-or-delete-char): Fix ordering between `declare` and
`interactive`.
Now that we use `add-function`, we may as well avoid using the deprecated
`defadvice`
(cl-flet): Remove confusing `cl-flet` fallback, always provided by `cl-lib`.
(yas--snippet-parse-create, yas--commit-snippet):
Use `advice-add` i.s.o `defadvice`.
Instead of using `setq` and storing the old value in
`yas--original-auto-fill-function`, use `add-function`.
This makes it virtually impossible for a bug like #873/#919 to appear.
Remove the left-over debug code we had added to try and track down
#873/#919.
This requires bumping the dependency on Emacs≥24.4.
(yas--original-auto-fill-function, yas--watch-auto-fill-backtrace):
Delete variables.
(yas--watch-auto-fill): Delete function. Don't add it to variable watchers.
(yas--auto-fill-wrapper): Use `add-function`.
(yas-minor-mode): Use `remove-function`.
(yas--auto-fill): Adjust its calling convention for use with `:around`
in `add-function`. Remove left-over debug code.
(yas--post-command-handler): Remove left-over debug code.
Use utf-8 rather than latin-1.
Prefer #' to quote function names.
(special-mode): Remove backward compatibility code which never worked
since it uses `fundamental` which doesn't exist).
- Emacs 28 has a new mode ‘lisp-data-mode’ for Lisp data.
- A test that was temporarily broken passes again.
- The default for ‘org-adapt-indentation’ has changed.
* yasnippet.el (yas--eval-for-string): Convert error to a string,
rather than returning the error data (which can only lead to confusing
type errors later when code expecting a string gets a list).
* yasnippet-tests.el (yas-no-memory-of-bad-snippet): Adjust test, now
that snippet expansion swallows errors properly.
The pre-change-len argument passed to each element of
after-change-fucntions must reflect the length of the affected region
before the change happened.
In Yasnippet's case, the change enacted in yas--snippet-create is the
replacement of a region (which is almost always of length 0) with a
ready-to-navigate snippet template. The previous implementation
calculated the length of the affected region after that change
happened, which is wrong.
See https://github.com/joaotavora/eglot/issues/462 for a case where
this mattered.
* yasnippet.el (yas--snippet-create): Correct manual call to
after-change-functions.
* yasnippet.el (yas--snippet-create): Bind before-change-functions and
after-change-functions to nil instead of inhibit-modification-hooks to
t while expanding snippet. The latter also needlessly blocks overlay
and text property modification hooks (which we don't call ourselves
afterwards). This way we allow packages like iedit to better
co-operate with yasnippet.
* yasnippet.el (yas--scan-for-field-end): New function.
(yas--field-parse-create): Use it instead of yas--scan-sexps, which
isn't able to distinguish between ${...} (a nested field) and
{...} (plain old braces in the snippet text).
* yasnippet-tests.el (yas-escaping-close-brace): New test.
* yasnippet.el (yas--advance-end-maybe-previous-fields): New function.
(yas--commit-snippet, yas--on-field-overlay-modification)
(yas-expand-snippet): Use it, so that all active fields will be
extended properly, even in case of deeply nested snippet expansion.
* yasnippet-tests.el (nested-snippet-expansion-depth-2): New test.
* yasnippet.el (yas--auto-next): Loop again after moving to the next
field.
* yasnippet-tests.el (auto-next-field): Test for multiple
yas-auto-next uses.
* yasnippet.el (yas--expand-or-visit-from-menu)
(yas--expand-or-prompt-for-template)
(yas-visit-snippet-file, yas-tryout-snippet): Don't pass expand-env
when to yas-expand-snippet when first arg is a yas--template record.
For deletion, we need to check the bounds before the deletion happens,
otherwise the overlay may already be moved to wrong place.
* yasnippet.el (yas--before-change-modified-snippets): New variable.
(yas--merge-and-drop-dups): New function.
(yas--gather-active-snippets): New function.
(yas--on-field-overlay-modification): Use it.
* yasnippet.el
* yasnippet.el (yas--todo-snippet-indent): New variable.
(yas--on-field-overlay-modification): Save snippet to it, and don't
indent after mirror update.
(yas--do-todo-field-updates): New function.
(yas--post-command-handler): Call it.
(yas--snippet-field-mirrors, yas--indent-mirrors-of-snippet): New
functions, split out from...
(yas--snippet-field-mirrors): ...here.
* yasnippet-tests.el (yas-test-delete-and-insert-command)
(indent-mirrors-on-complex-update): New test and helper function.
* yasnippet.el (yas-keymap-disable-hook): New hook.
(yas-filtered-definition): New function.
(yas-keymap): Use it.
* doc/faq.org: Update key redefinition example.
Since we now check conditions in conditional keybindings, it can be
evaluated before 'this-command' has been assigned.
* yasnippet.el (yas-not-string-or-comment-condition): Remove check of
'this-command'.
There was some half-backed code getting confused between "plain"
snapshort info and line+snapshot info leading to some type errors when
expanding snippets in org-mode src blocks. I had wrongly assumed the
failures were only due to org version 9 changes (in fact, the org
changes only affect snippet expansion for text-mode (and probably
other non-fontifying modes too)). Reorganize the snapshotting
functions so that line+snaphot has the line info after the marker,
next to the rest of the snapshot info. This removes the need for list
manipulation and simplifies the code. Furthermore, let the
restoration functions take the info as a list, rather than separate
arguments, this removes the need for several uses of `apply'.
* yasnippet.el (yas--snapshot-location): Renamed from
yas--snapshot-marker-location, don't return marker.
(yas--snapshot-line-location): New function.
(yas--goto-saved-location): Take single list arg. Return point.
(yas--restore-marker-location): Remove, open code callers.
(yas--goto-saved-line-location)
(yas--restore-overlay-line-location): New functions.
(yas--prepare-snippets-for-move, yas--finish-moving-snippets)
(yas--auto-fill, yas--indent-region): Adjust callers of previously
mentioned functions accordingly.
* yasnippet-tests.el (yas-org-native-tab-in-source-block-text):
Renamed from yas-org-native-tab-in-source-block.
(yas-org-native-tab-in-source-block-emacs-lisp): New test.
(do-yas-org-native-tab-in-source-block): Take MODE parameter.
Generally, the user won't be interacting with, or creating snippets in
temporary buffers.
* yasnippet.el (yas-temp-buffer-p): New function.
(yas-dont-activate-functions): Add it to default value.
* yasnippet-tests.el (complicated-yas-key-syntaxes)
(test-yas-activate-extra-modes): Call yas-minor-mode instead of
yas-minor-mode-on, to ensure activation.
* yasnippet.el (yas--snippet-create): Let-bind
inhibit-modification-hooks for snippet insertion, so that we don't
call change functions automatically, we already call them manually
after insertion and parsing.