smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

can't insert single quote (`'`) in expression minibuffer in strict mode

Open Rogach opened this issue 4 years ago • 5 comments

Expected behavior

In strict mode M-: ' should result in single quote being typed in the expression minibuffer.

Actual behavior

Quote is doubled instead. And since this is strict mode, I can't delete the extra quote. Temporary workaround: use (quote).

Steps to reproduce the problem

Config that reproduces the problem:

(require 'smartparens-config)
(add-hook 'eval-expression-minibuffer-setup-hook #'smartparens-strict-mode)

Then type M-: (eval-expression) and then type single quote character (').

Environment & version information

  • smartparens version: 20200324.2147
  • Active major-mode: lisp-interaction-mode
  • Smartparens strict mode: t
  • Emacs version (M-x emacs-version): GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.17.3) of 2020-05-27
  • Starterkit/Distribution: Vanilla
  • OS: gnu/linux

Rogach avatar Jun 04 '20 11:06 Rogach

(defun aorst/minibuffer-enable-sp ()
  "Enable `smartparens-strict-mode' in the minibuffer, during `eval-expression'."
  (when (eq this-command 'eval-expression)
    (setq-local comment-start ";")
    (sp-local-pair 'minibuffer-pairs "'" nil :actions nil)
    (sp-local-pair 'minibuffer-pairs "`" nil :actions nil)
    (sp-update-local-pairs 'minibuffer-pairs)
    (smartparens-strict-mode 1)))

I hook this funtion to minibuffer-setup hook and it seems to work

andreyorst avatar Dec 04 '20 19:12 andreyorst

@andreyorst Thank you, that works!

I found that it is possible to get rid of "(when (eq this-command ..." by hooking eval-expression-minibuffer-setup-hook instead of minibuffer-setup-hook.

Rogach avatar Dec 05 '20 07:12 Rogach

oh, great! Did not knew of that hook, thanks for the tip!

andreyorst avatar Dec 05 '20 12:12 andreyorst

Perhaps this should be documented, and tiket can be resolved?

andreyorst avatar Dec 08 '20 20:12 andreyorst

Up to the project owner, I guess. I saw that he marked the issue as a bug, so maybe he plans to do something else (one could argue that smartparens-strict-mode should allow quotes in minbuffer as well as in usual .el buffers - because in both cases we have elisp as a dialect).

Rogach avatar Dec 08 '20 20:12 Rogach