Comments (13)
A few precisions : the place where the snippet argument becomes nil is during the call to :
(delete-region (or from (yas--field-start field)) (yas--field-end field))
in the function yas--skip-and-clear
.
In order to establish that, one would just need to call yas-active-snippets
just before and after the aforementioned line.
Under emacs 29, this evaluates to non-nil
before, and nil
after, whereas under emacs 28, this evaluated to something non-nil
both before and after.
from yasnippet.
After instrumenting the function yas-active-snippets
to observe the test process, it looks like under Emacs 28, after a series of calls to yas-active-snippets
, the test will end after passing both beg
and end
with nil
. However under Emacs 29, yas--on-protection-overlay-modification
got triggered after that, printing a message of [yas] Committing snippets. Action would destroy a protection overlay.
, and yas-active-snippets
gets invoked again with beg
as 1 and end
as 1, which results in snippet
becomes nil
. Hopefully someone familiar with yasnippet internal will figure out why yas--on-protection-overlay-modification
got triggered here.
As there exists a customization of yas-inhibit-overlay-modification-protection
, setting it to t
helps letting both tests pass.
from yasnippet.
If there are overlay-related behaviors that have changed between 28 and 29, emacs-devel will really want to know the details.
from yasnippet.
This appears to cause only the very last snippet key in .yas-compiled-snippets.el
to work correctly, regardless of how many snippets are defined or in what order.
from yasnippet.
from yasnippet.
Does the problem show up in Emacs-30?
Yes, I'm using
GNU Emacs 30.0.50
Development version 790b5982175b on master branch; build date 2024-01-09.
I could be entirely wrong that the bug I see is related to this issue, though. I thought so because I get a similar error message.
from yasnippet.
from yasnippet.
As a sanity check, I've just run it under emacs -Q
. I did package-install yasnippet
, set my yas-snippet-dirs
, and got the same issue, so it definitely doesn't relate to my other configurations. However, I don't seem to get the Wrong type argument: characterp, nil
error message that I do in my real configuration, which seems super weird. That error message might have been completely been unrelated to this issue.
from yasnippet.
from yasnippet.
Could you clarify what is "the same issue" exactly, or more specifically, what steps you took after setting
yas-snippet-dirs
, what happened and what you expected to happen instead?
Yes, I'm using Emacs 30 for this. Setting yas-snippet-dirs
isn't really important here (it doesn't seem to affect this problem), only calling yas-define-snippets
one way or another is important. I've designed a minimal reproduction case here:
I run simply:
emacs -Q
M-x package-delete
yasnippet
M-x package-install
yasnippet
Then in the scratch buffer, I evaluate:
(yas-minor-mode)
(yas-define-snippets 'emacs-lisp-mode
'(("a" "aaa" "function" nil
nil nil
"" nil
nil)
("b"
"bbb"
"function" nil nil nil
"" nil
nil)))
I then type b
, and press TAB
to expand, which transforms it into bbb
. If I type a
and expand the same way, it does not appear to do anything. I would expect that both a and b expand correctly here.
from yasnippet.
from yasnippet.
Aaaaaaa I feel so silly now! That was the issue in my real Emacs config as well. Thank you for pointing that out!
from yasnippet.
I still don't see why you wrote about your problems in this issue, since they seem wholly unrelated.
In any case, I think this issue is now closed.
from yasnippet.
Related Issues (20)
- please tag new release for Emacs 29 compat (affects MELPA stable and others) HOT 7
- unwanted prompt when pressing TAB HOT 1
- self-defined function `expand-from-key-p`(which check current expanding come from key or binding) not work anymore after update to newest master. HOT 3
- update latex snippets for use with text selection
- Documentation webage 404s HOT 1
- yas--all-parents can fail to find all parents if called before snippet directory is loaded HOT 5
- Some functions don't work in yasnippet HOT 3
- Multi-line embedded lisp-code HOT 7
- Template variables do not work in template lines starting with # HOT 3
- delete-numberless-inner-snippet-issue-562 test failure (non-deterministic) HOT 6
- Error in condition evaluation: Symbol’s function definition is void: js2-node-type HOT 3
- elpy-snippet-init-assignments - "Symbol’s value as variable is void: start-point" HOT 1
- Suggestion: not preceded by space HOT 4
- special character
- elisp evaluation move cursor on new line
- elisp evaluation move cursor on new line in snippet body
- Suggestion for a repeat snippet feature. HOT 8
- Case sensitive major modes? HOT 1
- [FR/Q] How do I comment a line of the snippet from being included in the snippet? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yasnippet.