Coder Social home page Coder Social logo

Comments (13)

aagon avatar aagon commented on June 12, 2024 2

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.

manphiz avatar manphiz commented on June 12, 2024

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.

dgutov avatar dgutov commented on June 12, 2024

If there are overlay-related behaviors that have changed between 28 and 29, emacs-devel will really want to know the details.

from yasnippet.

Cons-Cat avatar Cons-Cat commented on June 12, 2024

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.

monnier avatar monnier commented on June 12, 2024

from yasnippet.

Cons-Cat avatar Cons-Cat commented on June 12, 2024

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.

monnier avatar monnier commented on June 12, 2024

from yasnippet.

Cons-Cat avatar Cons-Cat commented on June 12, 2024

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.

monnier avatar monnier commented on June 12, 2024

from yasnippet.

Cons-Cat avatar Cons-Cat commented on June 12, 2024

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.

monnier avatar monnier commented on June 12, 2024

from yasnippet.

Cons-Cat avatar Cons-Cat commented on June 12, 2024

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.

monnier avatar monnier commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.