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

Comments seem to mess up sp-slurp-barf-sexp #634

Closed
zck opened this issue Aug 8, 2016 · 1 comment
Closed

Comments seem to mess up sp-slurp-barf-sexp #634

zck opened this issue Aug 8, 2016 · 1 comment
Labels
Milestone

Comments

@zck
Copy link

zck commented Aug 8, 2016

I'm running Emacs built from source at commit , and I got smartparens from elpa; it's in elpa/smartparens-20160706.649. If there's a better way to get the smartparens version, let me know and I'll do that.

I opened emacs -Q, loaded dash (from elpa/dash-201606019.611), and then smartparens. I turned on debug on error, and then put this code into the scratch buffer:

(let ((a-thing 4)
      (this-one-messes 'up)
      (+ 1 2 4)
))

And I put point at the end of the third line (the (+ 1 2 4) line. I then ran sp-forward-barf-sexp, and everything worked fine. That is, I ended up with:

(let ((a-thing 4)
      (this-one-messes 'up))
  (+ 1 2 4)
)

Now, if instead I comment out the entire (this-one-messes 'up) line:

(let ((a-thing 4)
      ;;(this-one-messes 'up)
      (+ 1 2 4)
))

And do the same thing (point at the end of the third line, call sp-forward-barf-sexp), I would expect to get something like this:

(let ((a-thing 4)
      ;; (this-one-messes 'up)
      )
  (+ 1 2 4)
)

But instead I get the following error:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  insert("" nil)
  (if (> --sp-argument-- (- (plist-get struct :end) (length (plist-get struct :cl)))) (progn (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix))))) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix)))) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)))
  (let ((--sp-argument-- (point))) (if (> --sp-argument-- (- (plist-get struct :end) (length (plist-get struct :cl)))) (progn (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix))))) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix)))) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix))))
  (let ((struct (sp-get-enclosing-sexp))) (let ((--sp-argument-- (point))) (if (> --sp-argument-- (- (plist-get struct :end) (length (plist-get struct :cl)))) (progn (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix))))) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix)))) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)))) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward)))
  (let ((enc (sp-get-enclosing-sexp))) (let ((struct enc)) (cond ((and raw (= arg 4)) (let ((struct (sp-get-thing t))) (goto-char (+ (plist-get struct :end) (length ...))))) (t (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (sp-backward-sexp arg) (if (<= (point) (plist-get struct :beg)) (progn (goto-char (+ ... ...)))))) (let ((back (sp-get-thing t))) (if (equal (let ((struct back)) (plist-get struct :beg)) (let ((struct enc)) (plist-get struct :beg))) (goto-char (+ (plist-get struct :beg) (length (plist-get struct :op)))) (goto-char (let ((struct back)) (+ (plist-get struct :end) (length ...)))))) (sp--run-hook-with-args (plist-get struct :op) :pre-handlers (quote barf-forward))) (let ((struct (sp-get-enclosing-sexp))) (let ((--sp-argument-- (point))) (if (> --sp-argument-- (- (plist-get struct :end) (length (plist-get struct :cl)))) (progn (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)) (goto-char (- (plist-get struct :end) (length ...))) (delete-char (+ (length ...) (length ...)))) (goto-char (- (plist-get struct :end) (length (plist-get struct :cl)))) (delete-char (+ (length (plist-get struct :cl)) (length (plist-get struct :suffix)))) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)))) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward))))
  (save-excursion (let ((enc (sp-get-enclosing-sexp))) (let ((struct enc)) (cond ((and raw (= arg 4)) (let ((struct ...)) (goto-char (+ ... ...)))) (t (goto-char (- (plist-get struct :end) (length ...))) (sp-backward-sexp arg) (if (<= (point) (plist-get struct :beg)) (progn (goto-char ...))))) (let ((back (sp-get-thing t))) (if (equal (let (...) (plist-get struct :beg)) (let (...) (plist-get struct :beg))) (goto-char (+ (plist-get struct :beg) (length ...))) (goto-char (let (...) (+ ... ...))))) (sp--run-hook-with-args (plist-get struct :op) :pre-handlers (quote barf-forward))) (let ((struct (sp-get-enclosing-sexp))) (let ((--sp-argument-- (point))) (if (> --sp-argument-- (- (plist-get struct :end) (length ...))) (progn (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)) (goto-char (- ... ...)) (delete-char (+ ... ...))) (goto-char (- (plist-get struct :end) (length ...))) (delete-char (+ (length ...) (length ...))) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)))) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward)))))
  (if (sp-point-in-blank-sexp) (sp-message :blank-sexp) (save-excursion (let ((enc (sp-get-enclosing-sexp))) (let ((struct enc)) (cond ((and raw (= arg 4)) (let (...) (goto-char ...))) (t (goto-char (- ... ...)) (sp-backward-sexp arg) (if (<= ... ...) (progn ...)))) (let ((back (sp-get-thing t))) (if (equal (let ... ...) (let ... ...)) (goto-char (+ ... ...)) (goto-char (let ... ...)))) (sp--run-hook-with-args (plist-get struct :op) :pre-handlers (quote barf-forward))) (let ((struct (sp-get-enclosing-sexp))) (let ((--sp-argument-- (point))) (if (> --sp-argument-- (- ... ...)) (progn (goto-char --sp-argument--) (insert ... ...) (goto-char ...) (delete-char ...)) (goto-char (- ... ...)) (delete-char (+ ... ...)) (goto-char --sp-argument--) (insert (plist-get struct :cl) (plist-get struct :suffix)))) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward))))))
  (if (> arg 0) (if (sp-point-in-blank-sexp) (sp-message :blank-sexp) (save-excursion (let ((enc (sp-get-enclosing-sexp))) (let ((struct enc)) (cond ((and raw ...) (let ... ...)) (t (goto-char ...) (sp-backward-sexp arg) (if ... ...))) (let ((back ...)) (if (equal ... ...) (goto-char ...) (goto-char ...))) (sp--run-hook-with-args (plist-get struct :op) :pre-handlers (quote barf-forward))) (let ((struct (sp-get-enclosing-sexp))) (let ((--sp-argument-- ...)) (if (> --sp-argument-- ...) (progn ... ... ... ...) (goto-char ...) (delete-char ...) (goto-char --sp-argument--) (insert ... ...))) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward)))))) (sp-backward-barf-sexp (sp--negate-argument old-arg)))
  (let* ((raw (sp--raw-argument-p arg)) (old-arg arg) (arg (prefix-numeric-value arg))) (if (> arg 0) (if (sp-point-in-blank-sexp) (sp-message :blank-sexp) (save-excursion (let ((enc (sp-get-enclosing-sexp))) (let ((struct enc)) (cond (... ...) (t ... ... ...)) (let (...) (if ... ... ...)) (sp--run-hook-with-args (plist-get struct :op) :pre-handlers (quote barf-forward))) (let ((struct ...)) (let (...) (if ... ... ... ... ... ...)) (sp--indent-region (plist-get struct :beg) (plist-get struct :end)) (sp--run-hook-with-args (plist-get struct :op) :post-handlers (quote barf-forward)))))) (sp-backward-barf-sexp (sp--negate-argument old-arg))))
  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)
  execute-extended-command(nil "sp-forward-barf-sexp" "sp-forward-b")
  funcall-interactively(execute-extended-command nil "sp-forward-barf-sexp" "sp-forward-b")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

This might be related to #477, but I'm not sure, so I'm filing it as a new bug.

@Fuco1
Copy link
Owner

Fuco1 commented Aug 8, 2016

Sounds like a bug indeed :) Thanks for reporting, I'll look into it.

@Fuco1 Fuco1 added the bug label Aug 8, 2016
@Fuco1 Fuco1 added this to the 1.9 milestone Sep 25, 2016
@Fuco1 Fuco1 closed this as completed in 9ae8d4f Oct 1, 2016
jojojames pushed a commit to jojojames/smartparens that referenced this issue Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants