Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini-frame & evil eat a single preceding whitespace character in an Org Capture template when using prompts %^{Like_This}, breaking capture templates #85

Open
n-hebert opened this issue Mar 14, 2024 · 11 comments

Comments

@n-hebert
Copy link

n-hebert commented Mar 14, 2024

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

  1. Install evil, mini-frame and the capture template using the .emacs below
  2. 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.

@muffinmad
Copy link
Owner

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
Screenshot 2024-03-17 at 10 01 49
After confirming the title I can enter text in quote block
Screenshot 2024-03-17 at 10 02 07
And after C-c C-c the ~/org/test.org looks like this
Screenshot 2024-03-17 at 10 04 36

I don't see what the problem is.

@n-hebert
Copy link
Author

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

@n-hebert
Copy link
Author

n-hebert commented Mar 18, 2024

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?

@n-hebert n-hebert changed the title Mini-frame somehow eats a single preceding whitespace character when prompted for input %^{Like_This} Mini-frame & evil eat a single preceding whitespace character in an Org Capture template when using prompts %^{Like_This}, breaking capture templates Mar 18, 2024
@muffinmad
Copy link
Owner

muffinmad commented Mar 21, 2024

Hmm. Even with the evil mode enabled I can use capture template with prompt without errors.

@n-hebert
Copy link
Author

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.

@n-hebert
Copy link
Author

It's only happening on emacs 29 or later -- version check? My version 27 seems ok.

@muffinmad
Copy link
Owner

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

@n-hebert
Copy link
Author

n-hebert commented Mar 25, 2024

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.

@muffinmad
Copy link
Owner

Can reproduce in Emacs 29.2 GTK version. As a workaround, enter space before the variable value :)

@n-hebert
Copy link
Author

heh, excellent. yeah I have spaces through-out my variables but then I add new ones and forget 😆

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.

@muffinmad
Copy link
Owner

Any idea where the fix lies?

Unfortunately, but I have no idea at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants