Before this commit,
(yas--all-parents 'lisp-mode) would return:
`(lisp-mode lisp-data-mode prog-mode fundamental-mode fundamental-mode)`
which would cause duplicated entries when prompting,
if the snippet were for fundamental-mode.
* yasnippet.el (yas--flush-all-parents): New function.
(yas-reload-all): Use it.
* yasnippet.el (issue-492-and-494): Don't flush the all=parents cache any
more since `yas-reload-all` does it for us.
yas-reload-all does not undo the memoization done in yas--all-parents, which
causes the issue-492-and-494 test to fail when run after any tests that
expands yas-with-some-interesting-snippet-dirs.
With the memoization enabled, c++-mode is considered a parent of c-mode,
causing the issue-492-and-494 test to fail. With the memoization reset,
this does not occur.
(yas-define-snippets): Warn about identity conflicts.
(yas--one-simple-fom): New fun, extracted from `yas--simple-fom-create`.
(yas--simple-fom-create): Use it.
(yas--field-parse-create): Use it for ${N}.
(yas-not-string-or-comment-condition): Make it a function.
(yas--funcall-condition): Rename from `yas--funcall-condition`, change
its calling convention.
(yas--template-can-expand-p, yas--describe-pretty-table):
Adjust accordingly.
(yas--require-template-specific-condition-p): Add support for functions
in `yas-buffer-local-condition`.
* doc/snippet-expansion.org (The condition system <<condition-system>>):
Adjust example to avoid quoted code.
* yasnippet-tests.el (issue-492-and-494): Make the test a bit less picky.
(test-yas-tab-binding, test-yas-in-org): Test TAB rather than `tab`
because at the level at which we do the test, `tab` is not remapped to TAB.
* yasnippet-tests.el (yas-call-with-saving-variables): Don't `set` when
there's nothing to change.
(yas-with-overriden-buffer-list): Fix `buffer-list` override.
(loading-with-cyclic-parenthood, extra-modes-parenthood): Tweak tests
to be a bit less sensitive to details of ordering and number of
repetitions in `yas--modes-to-activate`.
* yasnippet.el (yas--all-parents): Make sure `mode` is always first in
the output, as is the case for `derived-mode-all-parents`.
(yas--modes-to-activate): Put extra modes first and not reversed, as
required by test `extra-modes-parenthood`.
This allows YASnippet to obey `derived-mode-add-parents`, which should
become the standard way to indicate "loose" relationships (such as
the fact that `js3-mode` is related to `js-mode` or for TS modes).
* yasnippet.el (yas--merge-ordered-lists, yas--all-parents): New functions.
(yas--modes-to-activate): Use them.
Since we already require Emacs≥24.4, there's not point keeping that
compatibility code.
(yas--modes-to-activate): Remove redundant `fboundp` test.
(yas-activate-extra-mode): Don't bother converting hashtable to alist
to pass to `completing-read`.
(yas-dont-activate-functions): Get rid of Emacs≤23 code.
(snippet-mode): `prog-mode` is always available.
(yas-x-prompt): `posn-at-point` is always available.
(yas--merge-and-drop-dups): `delete-consecutive-dups` is always available.
(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.