diff options
| -rw-r--r-- | paredit.el | 25 | ||||
| -rw-r--r-- | test.el | 17 | 
2 files changed, 30 insertions, 12 deletions
| @@ -2206,17 +2206,18 @@ If in a string, move the opening double-quote forward by one    (up-list)                             ; Up to the end of the list to    (let ((close (char-before)))          ;   save and delete the closing      (backward-delete-char 1)            ;   delimiter. -    (catch 'return                      ; Go to the end of the desired -      (while t                          ;   S-expression, going up a -        (paredit-handle-sexp-errors     ;   list if it's not in this, -            (progn (paredit-forward-and-indent) -                   (throw 'return nil)) -          (up-list) -          (setq close                   ; adjusting for mixed -                (prog1 (char-before)    ;   delimiters as necessary, -                  (backward-delete-char 1) -                  (insert close)))))) -    (insert close)))                    ; to insert that delimiter. +    (let ((start (point))) +      (catch 'return                    ; Go to the end of the desired +        (while t                        ;   S-expression, going up a +          (paredit-handle-sexp-errors   ;   list if it's not in this, +              (progn (forward-sexp) (throw 'return nil)) +            (up-list) +            (setq close                 ; adjusting for mixed +                  (prog1 (char-before)  ;   delimiters as necessary, +                    (backward-delete-char 1) +                    (insert close)))))) +      (insert close)                    ; to insert that delimiter. +      (indent-region start (point) nil))))  (defun paredit-forward-slurp-into-string ()    (goto-char (1+ (cdr (paredit-string-start+end-points)))) @@ -2245,7 +2246,7 @@ Automatically reindent the newly barfed S-expression with respect to        (cond ((bobp)               (error "Barfing all subexpressions with no open-paren?"))              ((paredit-in-comment-p)     ; Don't put the close-paren in -             (newline-and-indent)))     ;   a comment. +             (newline)))                ;   a comment.        (insert close))      ;; Reindent all of the newly barfed S-expressions.      (paredit-forward-and-indent))) @@ -183,4 +183,21 @@ Four arguments: the paredit command, the text of the buffer      ;; (";;|foo(" ";|foo(" error)      )) +(defun paredit-canary-indent-method (state indent-point normal-indent) +  (check-parens) +  nil) + +(put 'paredit-canary 'scheme-indent-function 'paredit-canary-indent-method) + +;;; Check for regressions the indentation behaviour of forward slurping +;;; and barfing. + +(paredit-test 'paredit-forward-slurp-sexp +  '(("(paredit-canary|)\n(lose)" +     "(paredit-canary|\n (lose))"))) + +(paredit-test 'paredit-forward-barf-sexp +  '(("(paredit-canary|  ;\n (lose))") +    ("(paredit-canary|  ;\n)\n(lose)"))) +  ;++ Killing commands...ugh... | 
