From 64256cf84a67c5109b1e9e8603ebf2cecdb515fa Mon Sep 17 00:00:00 2001 From: Ivan Sokolov Date: Sat, 6 Nov 2021 01:54:01 +0300 Subject: [PATCH 2/2] Add move-past-close * lisp/emacs-lisp/lisp.el: add move-past-close. --- lisp/emacs-lisp/lisp.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index e9932df8d0..606a3be425 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -872,6 +872,12 @@ raise-sexp (defun move-past-close-and-reindent () "Move past next `)', delete indentation before it, then indent after it." (interactive) + (move-past-close) + (newline-and-indent)) + +(defun move-past-close () + "Move past next `)' and delete indentation before it." + (interactive) (up-list 1) (forward-char -1) (while (save-excursion ; this is my contribution @@ -887,10 +893,10 @@ move-past-close-and-reindent state) (beginning-of-line) ;; Get state at start of line. - (setq state (list 0 nil nil - (null (calculate-lisp-indent)) - nil nil nil nil - nil)) + (setq state + (make-ppss + :depth 0 + :string-terminator (null (calculate-lisp-indent)))) ;; Parse state across the line to get state at end. (setq state (parse-partial-sexp (point) end nil nil state)) @@ -898,8 +904,7 @@ move-past-close-and-reindent (and (not (ppss-string-terminator state)) (not (ppss-comment-depth state)))))))) (delete-indentation)) - (forward-char 1) - (newline-and-indent)) + (forward-char 1)) (defun check-parens () ; lame name? "Check for unbalanced parentheses in the current buffer. -- 2.33.1