Subject: emacs-smartparens: sp-forward-barf-sexp broken

From: Thorsten Wilms <[email-masked]>
Date: Thu, 5 Apr 2018 12:12:08 +0200

With both emacs and smartparens installed via guix, 
sp-backward-slurp-sexp, sp-forward-slurp-sexp work, but 
sp-backwards-barf-sexp and sp-forward-barf-sexp fail with:
   Wrong type argument: integer-or-marker-p, :beg-in

This is with no configuration and using the commands directly via M-x. 
It still happens after (require 'smartparens-config). There doesn't seem 
to be any matching tickets in smartparens's tracker and no matching 
descriptions/solutions elsewhere.

I hesitate to report to the project directly, in case this is somehow 
caused by anything specific to guix.

With | as cursor in: (diz fo (foo bar)| bob)
After toggle-debug-on-error:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p 
:beg-in)
   buffer-substring-no-properties(:beg-in :end-in)
   sp-point-in-blank-sexp()
   sp-forward-barf-sexp(nil)
   funcall-interactively(sp-forward-barf-sexp nil)
   call-interactively(sp-forward-barf-sexp record nil)
   command-execute(sp-forward-barf-sexp record)
   (let ((prefix-arg current-prefix-arg)) (setq real-this-command (setq 
this-command (intern cmd))) (command-execute (intern cmd) (quote record)))
   (closure ((sort) (pred) (cands "toggle-debug-on-error" 
"sp-forward-slurp-sexp" "smartparens-strict-mode" 
"sp-backward-barf-sexp" "eval-region" "eval-last-sexp" "replace-string" 
"indent-region" "load-theme" "goto-line" "flush-lines" "package-install" 
"menu-set-font" "replace-regexp" "load-file" "eval-buffer" 
"package-refresh-contents" "delete-window" "describe-face" "version" 
"whitespace-mode" "uncomment-region" "shell" "apropos" "cua-mode" 
"speedbar" "eval-defun" "write-file" "ivy-recentf" "scheme-mode" 
"list-packages" "sp-cheat-sheet" "close-rectangle" "ivy-switch-buffer" 
"package-list-packages" "switch-to-buffer-other-frame" 
"windmove-default-keybindings" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" 
"eww" "ftp" "gdb" "irc" "jdb" ...) (initial-input) smex-ido-cache 
smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) 
(progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg)) 
(setq real-this-command (setq this-command (intern cmd))) 
(command-execute (intern cmd) (quote record))))("sp-forward-barf-sexp")
   funcall((closure ((sort) (pred) (cands "toggle-debug-on-error" 
"sp-forward-slurp-sexp" "smartparens-strict-mode" 
"sp-backward-barf-sexp" "eval-region" "eval-last-sexp" "replace-string" 
"indent-region" "load-theme" "goto-line" "flush-lines" "package-install" 
"menu-set-font" "replace-regexp" "load-file" "eval-buffer" 
"package-refresh-contents" "delete-window" "describe-face" "version" 
"whitespace-mode" "uncomment-region" "shell" "apropos" "cua-mode" 
"speedbar" "eval-defun" "write-file" "ivy-recentf" "scheme-mode" 
"list-packages" "sp-cheat-sheet" "close-rectangle" "ivy-switch-buffer" 
"package-list-packages" "switch-to-buffer-other-frame" 
"windmove-default-keybindings" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" 
"eww" "ftp" "gdb" "irc" "jdb" ...) (initial-input) smex-ido-cache 
smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) 
(progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg)) 
(setq real-this-command (setq this-command (intern cmd))) 
(command-execute (intern cmd) (quote record)))) "sp-forward-barf-sexp")
   (unwind-protect (funcall action x) (ivy-recursive-restore))
   (save-current-buffer (set-buffer (progn nil (or (progn nil (and 
(vectorp ivy-last) (>= (length ivy-last) 25) (memq (aref ivy-last 0) 
cl-struct-ivy-state-tags) t)) (signal (quote wrong-type-argument) (list 
(quote ivy-state) ivy-last))) (aref ivy-last 13))) (unwind-protect 
(funcall action x) (ivy-recursive-restore)))
   (prog1 (save-current-buffer (set-buffer (progn nil (or (progn nil 
(and (vectorp ivy-last) (>= ... 25) (memq ... cl-struct-ivy-state-tags) 
t)) (signal (quote wrong-type-argument) (list (quote ivy-state) 
ivy-last))) (aref ivy-last 13))) (unwind-protect (funcall action x) 
(ivy-recursive-restore))) (if (or (eq ivy-exit (quote done)) (equal 
(selected-window) (active-minibuffer-window)) (null 
(active-minibuffer-window))) nil (select-window 
(active-minibuffer-window))))
   (if (eq action (quote identity)) (funcall action x) (select-window 
(ivy--get-window ivy-last)) (prog1 (save-current-buffer (set-buffer 
(progn nil (or (progn nil (and ... ... ... t)) (signal (quote 
wrong-type-argument) (list ... ivy-last))) (aref ivy-last 13))) 
(unwind-protect (funcall action x) (ivy-recursive-restore))) (if (or (eq 
ivy-exit (quote done)) (equal (selected-window) 
(active-minibuffer-window)) (null (active-minibuffer-window))) nil 
(select-window (active-minibuffer-window)))))
   (let* ((collection (progn nil (or (progn nil (and (vectorp ivy-last) 
(>= ... 25) (memq ... cl-struct-ivy-state-tags) t)) (signal (quote 
wrong-type-argument) (list (quote ivy-state) ivy-last))) (aref ivy-last 
2))) (x (cond ((and (consp collection) (consp (car collection)) (let 
(idx) (if ... ... ...)))) (ivy--directory (expand-file-name (progn nil 
(or ... ...) (aref ivy-last 23)) ivy--directory)) ((equal (progn nil (or 
... ...) (aref ivy-last 23)) "") ivy-text) (t (progn nil (or (progn nil 
...) (signal ... ...)) (aref ivy-last 23)))))) (if (eq action (quote 
identity)) (funcall action x) (select-window (ivy--get-window ivy-last)) 
(prog1 (save-current-buffer (set-buffer (progn nil (or (progn nil ...) 
(signal ... ...)) (aref ivy-last 13))) (unwind-protect (funcall action 
x) (ivy-recursive-restore))) (if (or (eq ivy-exit (quote done)) (equal 
(selected-window) (active-minibuffer-window)) (null 
(active-minibuffer-window))) nil (select-window 
(active-minibuffer-window))))))
   (progn (let* ((collection (progn nil (or (progn nil (and ... ... ... 
t)) (signal (quote wrong-type-argument) (list ... ivy-last))) (aref 
ivy-last 2))) (x (cond ((and (consp collection) (consp ...) (let ... 
...))) (ivy--directory (expand-file-name (progn nil ... ...) 
ivy--directory)) ((equal (progn nil ... ...) "") ivy-text) (t (progn nil 
(or ... ...) (aref ivy-last 23)))))) (if (eq action (quote identity)) 
(funcall action x) (select-window (ivy--get-window ivy-last)) (prog1 
(save-current-buffer (set-buffer (progn nil (or ... ...) (aref ivy-last 
13))) (unwind-protect (funcall action x) (ivy-recursive-restore))) (if 
(or (eq ivy-exit (quote done)) (equal (selected-window) 
(active-minibuffer-window)) (null (active-minibuffer-window))) nil 
(select-window (active-minibuffer-window)))))))
   (if action (progn (let* ((collection (progn nil (or (progn nil ...) 
(signal ... ...)) (aref ivy-last 2))) (x (cond ((and ... ... ...)) 
(ivy--directory (expand-file-name ... ivy--directory)) ((equal ... "") 
ivy-text) (t (progn nil ... ...))))) (if (eq action (quote identity)) 
(funcall action x) (select-window (ivy--get-window ivy-last)) (prog1 
(save-current-buffer (set-buffer (progn nil ... ...)) (unwind-protect 
(funcall action x) (ivy-recursive-restore))) (if (or (eq ivy-exit ...) 
(equal ... ...) (null ...)) nil (select-window 
(active-minibuffer-window))))))))
   (let ((action (ivy--get-action ivy-last))) (if action (progn (let* 
((collection (progn nil (or ... ...) (aref ivy-last 2))) (x (cond (...) 
(ivy--directory ...) (... ivy-text) (t ...)))) (if (eq action (quote 
identity)) (funcall action x) (select-window (ivy--get-window ivy-last)) 
(prog1 (save-current-buffer (set-buffer ...) (unwind-protect ... ...)) 
(if (or ... ... ...) nil (select-window ...))))))))
   (if ivy-inhibit-action nil (let ((action (ivy--get-action ivy-last))) 
(if action (progn (let* ((collection (progn nil ... ...)) (x (cond ... 
... ... ...))) (if (eq action (quote identity)) (funcall action x) 
(select-window (ivy--get-window ivy-last)) (prog1 (save-current-buffer 
... ...) (if ... nil ...))))))))
   ivy-call()
   (prog1 (unwind-protect (let ((fun (function ivy--minibuffer-setup)) 
setup-hook) (setq setup-hook (function (lambda nil (remove-hook (quote 
minibuffer-setup-hook) setup-hook) (funcall fun)))) (unwind-protect 
(progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist 
...) (minibuffer-completion-table collection) 
(minibuffer-completion-predicate predicate) (resize-mini-windows ...)) 
(if (and ivy-auto-select-single-candidate ... ...) (progn ... ...) 
(read-from-minibuffer prompt ... ... nil hist)) (if (eq ivy-exit ...) 
(progn ...)) (progn nil (or ... ...) (aref ivy-last 23)))) (remove-hook 
(quote minibuffer-setup-hook) setup-hook))) (remove-hook (quote 
post-command-hook) (function ivy--queue-exhibit)) (if (eq 
ivy-display-function (quote ivy-display-function-overlay)) (progn 
(ivy-overlay-cleanup))) (if (setq unwind (progn nil (or (progn nil (and 
... ... ... t)) (signal (quote wrong-type-argument) (list ... 
ivy-last))) (aref ivy-last 16))) (progn (funcall unwind))) (if (eq 
ivy-exit (quote done)) nil (ivy-recursive-restore))) (ivy-call) (if (> 
(length (progn nil (or (progn nil (and ... ... ... t)) (signal (quote 
wrong-type-argument) (list ... ivy-last))) (aref ivy-last 23))) 0) 
(progn (remove-text-properties 0 1 (quote (idx)) (progn nil (or (progn 
nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... 
ivy-last))) (aref ivy-last 23))))))
   (let ((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) 
(transformer-fn (plist-get ivy--display-transformers-list (or caller 
(and (functionp collection) collection)))) (ivy-display-function (if 
(window-minibuffer-p) nil (cdr (assoc caller 
ivy-display-functions-alist))))) (setq ivy-last (progn "Constructor for 
objects of type `ivy-state'." nil (vector (quote cl-struct-ivy-state) 
prompt collection predicate require-match initial-input history 
preselect keymap update-fn sort (selected-frame) (selected-window) 
(current-buffer) nil action unwind re-builder matcher dynamic-collection 
transformer-fn default-directory caller nil def))) (ivy--reset-state 
ivy-last) (prog1 (unwind-protect (let ((fun (function 
ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda 
nil (remove-hook ... setup-hook) (funcall fun)))) (unwind-protect (progn 
(add-hook (quote minibuffer-setup-hook) setup-hook) (let* (... ... ... 
...) (if ... ... ...) (if ... ...) (progn nil ... ...))) (remove-hook 
(quote minibuffer-setup-hook) setup-hook))) (remove-hook (quote 
post-command-hook) (function ivy--queue-exhibit)) (if (eq 
ivy-display-function (quote ivy-display-function-overlay)) (progn 
(ivy-overlay-cleanup))) (if (setq unwind (progn nil (or (progn nil ...) 
(signal ... ...)) (aref ivy-last 16))) (progn (funcall unwind))) (if (eq 
ivy-exit (quote done)) nil (ivy-recursive-restore))) (ivy-call) (if (> 
(length (progn nil (or (progn nil ...) (signal ... ...)) (aref ivy-last 
23))) 0) (progn (remove-text-properties 0 1 (quote (idx)) (progn nil (or 
(progn nil ...) (signal ... ...)) (aref ivy-last 23)))))))
   (progn (let ((extra-actions (delete-dups (append (plist-get 
ivy--actions-list t) (plist-get ivy--actions-list this-command) 
(plist-get ivy--actions-list caller))))) (if extra-actions (progn (setq 
action (cond ((functionp action) (cons 1 ...)) ((null action) (cons 1 
...)) (t (delete-dups ...))))))) (let ((extra-sources (plist-get 
ivy--sources-list caller))) (if extra-sources (progn (setq 
ivy--extra-candidates nil) (let ((--dolist-tail-- extra-sources)) (while 
--dolist-tail-- (let (...) (cond ... ...) (setq --dolist-tail-- ...))))) 
(setq ivy--extra-candidates (quote ((original-source)))))) (let 
((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) 
(transformer-fn (plist-get ivy--display-transformers-list (or caller 
(and (functionp collection) collection)))) (ivy-display-function (if 
(window-minibuffer-p) nil (cdr (assoc caller 
ivy-display-functions-alist))))) (setq ivy-last (progn "Constructor for 
objects of type `ivy-state'." nil (vector (quote cl-struct-ivy-state) 
prompt collection predicate require-match initial-input history 
preselect keymap update-fn sort (selected-frame) (selected-window) 
(current-buffer) nil action unwind re-builder matcher dynamic-collection 
transformer-fn default-directory caller nil def))) (ivy--reset-state 
ivy-last) (prog1 (unwind-protect (let ((fun (function 
ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda 
nil ... ...))) (unwind-protect (progn (add-hook ... setup-hook) (let* 
... ... ... ...)) (remove-hook (quote minibuffer-setup-hook) 
setup-hook))) (remove-hook (quote post-command-hook) (function 
ivy--queue-exhibit)) (if (eq ivy-display-function (quote 
ivy-display-function-overlay)) (progn (ivy-overlay-cleanup))) (if (setq 
unwind (progn nil (or ... ...) (aref ivy-last 16))) (progn (funcall 
unwind))) (if (eq ivy-exit (quote done)) nil (ivy-recursive-restore))) 
(ivy-call) (if (> (length (progn nil (or ... ...) (aref ivy-last 23))) 
0) (progn (remove-text-properties 0 1 (quote (idx)) (progn nil (or ... 
...) (aref ivy-last 23))))))))
   (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond 
((memq (car --cl-keys--) (quote (:predicate :require-match 
:initial-input :history :preselect :def :keymap :update-fn :sort :action 
:unwind :re-builder :matcher :dynamic-collection :caller 
:allow-other-keys))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car 
(cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword 
argument %s not one of (:predicate :require-match :initial-input 
:history :preselect :def :keymap :update-fn :sort :action :unwind 
:re-builder :matcher :dynamic-collection :caller)" (car 
--cl-keys--)))))) (progn (let ((extra-actions (delete-dups (append 
(plist-get ivy--actions-list t) (plist-get ivy--actions-list 
this-command) (plist-get ivy--actions-list caller))))) (if extra-actions 
(progn (setq action (cond (... ...) (... ...) (t ...)))))) (let 
((extra-sources (plist-get ivy--sources-list caller))) (if extra-sources 
(progn (setq ivy--extra-candidates nil) (let ((--dolist-tail-- 
extra-sources)) (while --dolist-tail-- (let ... ... ...)))) (setq 
ivy--extra-candidates (quote ((original-source)))))) (let 
((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) 
(transformer-fn (plist-get ivy--display-transformers-list (or caller 
(and ... collection)))) (ivy-display-function (if (window-minibuffer-p) 
nil (cdr (assoc caller ivy-display-functions-alist))))) (setq ivy-last 
(progn "Constructor for objects of type `ivy-state'." nil (vector (quote 
cl-struct-ivy-state) prompt collection predicate require-match 
initial-input history preselect keymap update-fn sort (selected-frame) 
(selected-window) (current-buffer) nil action unwind re-builder matcher 
dynamic-collection transformer-fn default-directory caller nil def))) 
(ivy--reset-state ivy-last) (prog1 (unwind-protect (let ((fun ...) 
setup-hook) (setq setup-hook (function ...)) (unwind-protect (progn ... 
...) (remove-hook ... setup-hook))) (remove-hook (quote 
post-command-hook) (function ivy--queue-exhibit)) (if (eq 
ivy-display-function (quote ivy-display-function-overlay)) (progn 
(ivy-overlay-cleanup))) (if (setq unwind (progn nil ... ...)) (progn 
(funcall unwind))) (if (eq ivy-exit (quote done)) nil 
(ivy-recursive-restore))) (ivy-call) (if (> (length (progn nil ... ...)) 
0) (progn (remove-text-properties 0 1 (quote ...) (progn nil ... ...))))))))
   (let* ((predicate (car (cdr (plist-member --cl-rest-- (quote 
:predicate))))) (require-match (car (cdr (plist-member --cl-rest-- 
(quote :require-match))))) (initial-input (car (cdr (plist-member 
--cl-rest-- (quote :initial-input))))) (history (car (cdr (plist-member 
--cl-rest-- (quote :history))))) (preselect (car (cdr (plist-member 
--cl-rest-- (quote :preselect))))) (def (car (cdr (plist-member 
--cl-rest-- (quote :def))))) (keymap (car (cdr (plist-member --cl-rest-- 
(quote :keymap))))) (update-fn (car (cdr (plist-member --cl-rest-- 
(quote :update-fn))))) (sort (car (cdr (plist-member --cl-rest-- (quote 
:sort))))) (action (car (cdr (plist-member --cl-rest-- (quote 
:action))))) (unwind (car (cdr (plist-member --cl-rest-- (quote 
:unwind))))) (re-builder (car (cdr (plist-member --cl-rest-- (quote 
:re-builder))))) (matcher (car (cdr (plist-member --cl-rest-- (quote 
:matcher))))) (dynamic-collection (car (cdr (plist-member --cl-rest-- 
(quote :dynamic-collection))))) (caller (car (cdr (plist-member 
--cl-rest-- (quote :caller)))))) (progn (let ((--cl-keys-- --cl-rest--)) 
(while --cl-keys-- (cond ((memq (car --cl-keys--) (quote ...)) (setq 
--cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t 
(error "Keyword argument %s not one of (:predicate :require-match 
:initial-input :history :preselect :def :keymap :update-fn :sort :action 
:unwind :re-builder :matcher :dynamic-collection :caller)" (car 
--cl-keys--)))))) (progn (let ((extra-actions (delete-dups (append ... 
... ...)))) (if extra-actions (progn (setq action (cond ... ... ...))))) 
(let ((extra-sources (plist-get ivy--sources-list caller))) (if 
extra-sources (progn (setq ivy--extra-candidates nil) (let (...) (while 
--dolist-tail-- ...))) (setq ivy--extra-candidates (quote (...))))) (let 
((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) 
(transformer-fn (plist-get ivy--display-transformers-list (or caller 
...))) (ivy-display-function (if (window-minibuffer-p) nil (cdr ...)))) 
(setq ivy-last (progn "Constructor for objects of type `ivy-state'." nil 
(vector (quote cl-struct-ivy-state) prompt collection predicate 
require-match initial-input history preselect keymap update-fn sort 
(selected-frame) (selected-window) (current-buffer) nil action unwind 
re-builder matcher dynamic-collection transformer-fn default-directory 
caller nil def))) (ivy--reset-state ivy-last) (prog1 (unwind-protect 
(let (... setup-hook) (setq setup-hook ...) (unwind-protect ... ...)) 
(remove-hook (quote post-command-hook) (function ivy--queue-exhibit)) 
(if (eq ivy-display-function ...) (progn ...)) (if (setq unwind ...) 
(progn ...)) (if (eq ivy-exit ...) nil (ivy-recursive-restore))) 
(ivy-call) (if (> (length ...) 0) (progn (remove-text-properties 0 1 ... 
...))))))))
   ivy-read("M-x " ("toggle-debug-on-error" "sp-forward-slurp-sexp" 
"smartparens-strict-mode" "sp-backward-barf-sexp" "eval-region" 
"eval-last-sexp" "replace-string" "indent-region" "load-theme" 
"goto-line" "flush-lines" "package-install" "menu-set-font" 
"replace-regexp" "load-file" "eval-buffer" "package-refresh-contents" 
"delete-window" "describe-face" "version" "whitespace-mode" 
"uncomment-region" "shell" "apropos" "cua-mode" "speedbar" "eval-defun" 
"write-file" "ivy-recentf" "scheme-mode" "list-packages" 
"sp-cheat-sheet" "close-rectangle" "ivy-switch-buffer" 
"package-list-packages" "switch-to-buffer-other-frame" 
"windmove-default-keybindings" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" 
"eww" "ftp" "gdb" "irc" "jdb" "man" ...) :predicate nil :require-match t 
:history counsel-M-x-history :action (closure ((sort) (pred) (cands 
"toggle-debug-on-error" "sp-forward-slurp-sexp" 
"smartparens-strict-mode" "sp-backward-barf-sexp" "eval-region" 
"eval-last-sexp" "replace-string" "indent-region" "load-theme" 
"goto-line" "flush-lines" "package-install" "menu-set-font" 
"replace-regexp" "load-file" "eval-buffer" "package-refresh-contents" 
"delete-window" "describe-face" "version" "whitespace-mode" 
"uncomment-region" "shell" "apropos" "cua-mode" "speedbar" "eval-defun" 
"write-file" "ivy-recentf" "scheme-mode" "list-packages" 
"sp-cheat-sheet" "close-rectangle" "ivy-switch-buffer" 
"package-list-packages" "switch-to-buffer-other-frame" 
"windmove-default-keybindings" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" 
"eww" "ftp" "gdb" "irc" "jdb" ...) (initial-input) smex-ido-cache 
smex-initialized-p info-lookup-mode t) (cmd) (if (featurep (quote smex)) 
(progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg)) 
(setq real-this-command (setq this-command (intern cmd))) 
(command-execute (intern cmd) (quote record)))) :sort nil :keymap 
(keymap (67108908 . counsel--info-lookup-symbol) (67108910 . 
counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
   (let* ((cands obarray) (pred (quote commandp)) (sort t)) (if (require 
(quote smex) nil (quote noerror)) (progn (if smex-initialized-p nil 
(smex-initialize)) (if (smex-detect-new-commands) (progn (smex-update))) 
(setq cands smex-ido-cache) (setq pred nil) (setq sort nil))) (setq 
this-command last-command) (setq real-this-command real-last-command) 
(ivy-read (counsel--M-x-prompt) cands :predicate pred :require-match t 
:history (quote counsel-M-x-history) :action (function (lambda (cmd) (if 
(featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let 
((prefix-arg current-prefix-arg)) (setq real-this-command (setq 
this-command (intern cmd))) (command-execute (intern cmd) (quote 
record))))) :sort sort :keymap counsel-describe-map :initial-input 
initial-input :caller (quote counsel-M-x)))
   counsel-M-x()
   funcall-interactively(counsel-M-x)
   call-interactively(counsel-M-x nil nil)
   command-execute(counsel-M-x)