joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.81k stars 311 forks source link

yassnippet is not expanded inside inline math-mode of cdlatex #1074

Open roiholtzman opened 4 years ago

roiholtzman commented 4 years ago

I am not sure if this problem is related to CDLaTeX or to yassnippet, so I am sorry if this is the wrong place to post it.

This is the scenario:

  1. I am in an org file.
  2. I insert an inline math-mode. I type $ and get my cursor between two $: $|$.
  3. I type the key of the snippet snip and then M-/ to expand it.
  4. I get an error no expansion found.

If the math mode mode is not empty, i.e. there is some char there (even whitespace), then the snippet is expanded successfully.

What is the problem?

joaotavora commented 3 years ago

You recipe is almost good, but not good enough. Please read:

https://github.com/joaotavora/yasnippet#important-note-regarding-bug-reporting

Yasnippet maintainership is stretched very thin, so I need simple to follow bug resports. I don't know what an inline math-mode is. I need monkey-level instructions.

roiholtzman commented 3 years ago

Thanks for the reply! I am still not sure exactly how to report the bug properly. I see this clod block

$ emacs --version
Emacs 24.3
$ cd /tmp/
$ git clone https://github.com/joaotavora/yasnippet.git yasnippet-bug
$ cd yasnippet-bug
$ git log -1 --oneline
6053db0 Closes #527: Unbreak case where yas-fallback-behaviour is a list
$ HOME=$PWD emacs -L . # This "sandboxes" your emacs, melpa configuration, etc

(require 'yasnippet)
(yas-global-mode 1)

When I open a foo-mode file I don't see foo-mode under the "YASnippet" menu!
OR
When loading yasnippet I see "Error: failed to frobnicate"!

I understand from the $ signs that this is terminal, but what happens after that? where does the (require 'yasnippet) go?

Let me try to explain better the bug. When using CDLatex, one can write math equation in the text. To insert an inline math equation you should type $$. For example $f(x)=x^2$. This is what I referred as math-mode -- being inside such environment $...$. Does this make it clearer?

joaotavora commented 3 years ago

where does the (require 'yasnippet) go?

You type it in the very first buffer that Emacs shows you. Then you also type the other line.

But it's been some years since I wronte taht. I can make it even simpler, the last line becomes.

HOME=$PWD emacs -L . -l yasnippet -f yas-global-mode

Then explain exactly what you do, like if I whoever was reading you was a blind tibetan copist scribe monk, who has no idea what CDLatex is , he just knows the keyboard. If you need to supply a special file to reproduce this, attach this to the issue.

Does this make it clearer?

slightly, but if you make a good reproduction recipe will sit here for future maintainers to see and pick up. Informally explained bugs have a lower change of success.

Thanks.

roiholtzman commented 3 years ago

where does the (require 'yasnippet) go?

You type it in the very first buffer that Emacs shows you. Then you also type the other line.

But it's been some years since I wronte taht. I can make it even simpler, the last line becomes.

HOME=$PWD emacs -L . -l yasnippet -f yas-global-mode

Then explain exactly what you do, like if I whoever was reading you was a blind tibetan copist scribe monk, who has no idea what CDLatex is , he just knows the keyboard. If you need to supply a special file to reproduce this, attach this to the issue.

Does this make it clearer?

slightly, but if you make a good reproduction recipe will sit here for future maintainers to see and pick up. Informally explained bugs have a lower change of success.

Thanks.

I am trying to follow the instructions, but I still do not understand exactly what should I do. When I run

HOME=$PWD emacs -L . -l yasnippet -f yas-global-mode

I get an emacs window, but I do not know how to open an org file there and enable cdlatex mode to reproduce the bug. Could you explain how should I do that?