Closed ardpp closed 8 years ago
Can't reproduce. Can you add more details?
There is at least some inconsistency that I can reproduce with the following steps
emacs -Q
(and stay in the scratch buffer)M-x package-initialize
auto-yasnippet
lispy-mode
Put the following into the scratch buffer |
denotes the cursor
(open-line 1)|
pressing e
(for special-lispy-eval
) opens a new line an the cursor stays in place. The same happens if you do M-x open-line
or mark region and call eval-region
If you do the same with
(aya-open-line)|
After e
a new line is opened an the cursor stays in place as before.
When you do M-x aya-open-line
(or mark the region an evaluate it) then you get
(aya-open-line)
|
Which looks as if open-line
is followed by newline
(With linum-mode
enabled you see that two lines are actually added in the latter case.)
emacs and the packages are all up to date (from git resp. melpa)
Still can't reproduce. It could be an issue of you having different abbrevs and snippets than me. Maybe it's possible to try without those.
Also, try to edebug aya-open-line
and see what code triggers.
I have tried on a different machine with an empty .emacs.d directory except for a very minimalistic init.el that installs and loads auto-yasnippet. Also there I can reproduce the inconsistency. I add a gif that maybe explains better what is going on than I do in words. I hope that the details are visible enough. Basically in the scratch buffer I enable linum-mode
. Write fi
and then keep pressing C-o
for aya-open-line
First C-o
expands the snippet, second opens a new line. Subsequent calls of aya-open-line
open two new lines which open-line
does not
Can you provide this minimalistic init? I see the problem you have, but still can't reproduce.
I created a new directory ~/.testemacs.d/ and the file init.el in that directory with the following contents
(defvar emacs-d "~/.testemacs.d")
(let ((default-directory "/usr/share/emacs/site-lisp/"))
(normal-top-level-add-subdirs-to-load-path))
(setq package-user-dir (expand-file-name "elpa" emacs-d))
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
(package-refresh-contents)
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(use-package yasnippet
:ensure t
:diminish yas-minor-mode)
(use-package auto-yasnippet
:ensure t
:commands aya-create aya-open-line)
(global-set-key "\C-o" 'aya-open-line)
then starting emacs via
emacs -q -l .testemacs.d/init.el
and doing the things described in above posts reproduces the things for me.
I don't know if it matters in this case, but there's a difference between emacs -q
and emacs -Q
. The first one might still load custom code, e.g. /usr/local/share/emacs/site-lisp/
. I recommend to always use emacs -Q
.
There seems to be something like a memory effect. Looking at the code of the function I do not understand why that happens. I can reproduce it on every machine that I have access to (Archlinux and Gentoo with emacs 24.5 and 25.1).
When I put in the directory ~/.testemacs.d/elpa/
only the yasnippet and auto-yasnippet directories and put in the ~/.testemacs.d/init.el
the following code
(load-file "~/.testemacs.d/elpa/yasnippet-20160801.1142/yasnippet.el")
(load-file "~/.testemacs.d/elpa/auto-yasnippet-20160524.618/auto-yasnippet.el")
(global-set-key "\C-o" 'aya-open-line)
Then I can reproduce what is shown in the above gif even with emacs -Q -l .testemacs.d/init.el
Thanks, I was finally able to reproduce. The issue was that I was using the stable version of yasnippet
. I've just fixed that bug that comes due to the interaction with the MELPA version.
Thank you!
Open the scratch buffer and enable
linum-mode
to better see what I mean.Put
in the buffer.
Evaluation of any of those will add one new line as expected. However
M-x aya-open-line
adds two lines. Happens to me even withemacs -Q