emacs-mini-frame
emacs-mini-frame copied to clipboard
Mini-frame & evil eat a single preceding whitespace character in an Org Capture template when using prompts %^{Like_This}, breaking capture templates
Mini-frame is great, I love having the mini-buffer floating and centered. However, it has an odd bug where it consumes whitespace preceding prompts for user input.
Background
- Org provides capture functionality which can use prompts that use the mini-buffer to get input from a user.
- On version 29 or later (unsure about 28, but not 27)
Issue
Mini-frame actually consumes the space there prior to the %^{Title}
. When I have mini-frame-mode
on, and I run a capture, it says to me that the Org entry is invalid and it fails to capture.
Steps to Reproduce
- Install evil, mini-frame and the capture template using the .emacs below
- Run an org-capture and try to complete normally (give input and C-c C-c)
Config
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
(unless (package-installed-p 'evil) (package-install 'evil)) ;; impacted version is evil 1.15.0
(require 'evil)
(evil-mode 1)
(unless (package-installed-p 'mini-frame)
(package-install 'mini-frame))
(mini-frame-mode)
(setq org-capture-templates
'(("p" "With prompt" entry (file+headline "~/org/test.org" "Test")
"* %^{Title}\n#+BEGIN_QUOTE\n%?\n#+END_QUOTE")))
Expected Result
Mini-frame lets me type a title and then captures the snippet
Actual Result
Mini-frame interacts with evil and consumes preceding whitespace and results in a bad capture. This does not occur with only evil or only mini-frame.
I've setup org-capture-templates
like this:
(setq org-capture-templates
'(("p" "With prompt" entry (file+headline "~/org/test.org" "Test")
"* %^{Title}\n#+BEGIN_QUOTE\n%?\n#+END_QUOTE")))
Then M-x org-capture
and p
After confirming the title I can enter text in quote block
And after
C-c C-c
the ~/org/test.org
looks like this
I don't see what the problem is.
Hm! I'll get you a config or provide a video for further analysis; maybe it's like #86 and not a mini-frame problem
Got it! It's an interaction with evil. Toss this into your ~/.emacs and try
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
(unless (package-installed-p 'evil) (package-install 'evil))
(require 'evil)
(evil-mode 1)
(unless (package-installed-p 'mini-frame)
(package-install 'mini-frame))
(mini-frame-mode)
(setq org-capture-templates
'(("p" "With prompt" entry (file+headline "~/org/test.org" "Test")
"* %^{Title}\n#+BEGIN_QUOTE\n%?\n#+END_QUOTE")))
Any ideas?
Hmm. Even with the evil
mode enabled I can use capture template with prompt without errors.
Hm! Is it somehow operating system related? I'm on Pop!_OS 22.04 LTS and Arch Linux.
I'll record a screen cast of it and post back, maybe there's something in the mix that's slipping my eyeline to pin down in text.
:grey_exclamation:
It's only happening on emacs 29 or later -- version check? My version 27 seems ok.
Mine is
GNU Emacs 29.1.50 (build 1, aarch64-apple-darwin22.5.0, NS
appkit-2299.60 Version 13.4.1 (c) (Build 22F770820d)) of 2023-08-23
That's lending credence to the OS constraint.
GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.40, cairo version 1.18.0)
Perhaps try 29.2, as well?
I'm also near the tip of emacs master
(commit: c5de73a95
), if that's easier -- GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2024-03-24
Evil version 1.15.0 everywhere.
Can reproduce in Emacs 29.2 GTK version. As a workaround, enter space before the variable value :)
heh, excellent. yeah I have spaces through-out my variables but then I add new ones and forget :laughing:
Any idea where the fix lies? Mini-frame's codebase or evil or Emacs? It's a real toss-up and I'm not sure where yet.
Any idea where the fix lies?
Unfortunately, but I have no idea at the moment.