smartparens
smartparens copied to clipboard
sp-point-in-empty-sexp returns truthy value when quotes are adjacent
Expected behavior
Calling sp-point-in-empty-sexp in "x"["]y" should return nil
Actual behavior
It returns ("\"" . "\"")
Steps to reproduce the problem
mvyour.emacs.dconfig elsewhere.- Launch with
emacs -Q - Bootstrap melpa as per https://melpa.org/#/getting-started
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
- Install smartparens
(package-refresh-contents)
(package-install 'smartparens)
(smartparens +1)
Create the following contents in the scratch buffer
"x""y"
Place the cursor on the quote mark before the y.
M-x eval-expression (sp-point-in-empty-sexp).
If I put a space between the adjacent "s then the function in questions behaves as desired.
Environment & version information
smartparensversion: 20190622.1750- Active
major-mode:lisp-interaction-mode - Smartparens strict mode: nil
- Emacs version (
M-x emacs-version): GNU Emacs 26.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.8) of 2019-04-30 - Starterkit/Distribution: n/a
- OS: gnu/linux
Yep I can reproduce this. Definitely a bug. How did you find it? Does it trigger some weird behaviour further down the line?
I encountered this in using https://github.com/expez/evil-smartparens, which uses it in a number of places.
I can still reproduce this. For string delimiters we will need to somehow find where the context switches. This might be very tricky for non-syntactic pairs :/