Commit dicipline fail

This commit is contained in:
Madeleine Sydney
2025-02-11 11:36:20 -07:00
parent fc14c41edd
commit f53f58df5a
11 changed files with 412 additions and 136 deletions

View File

@@ -124,6 +124,21 @@ comment, if there is one. Returns nil or a pair (BEG . END)."
"When `syd-evil-a-defun' is used in combination with one of these operators,
some cleanup will be performed.")
;; FIXME(#12): Comments should only attach to the *immediately* following sexp.
;; Consider the following snippet:
;;
;; ;; Call the continuation if non-nil. Wraps the return value in a singleton
;; ;; list for "affine" use with unquote-splicing.
;; (let ((call-cont (lambda (cont arg)
;; (if cont
;; (list (funcall cont arg))
;; nil)))
;; names)
;; ...)
;;
;; The curreny behaviour of `syd-sexp--backward-attached-comment' considers the
;; comment to be attached to both the (let ...) form, as well as the ((call-cont
;; ...)) form and the (call-cont ...) form. Not good!
(defun syd-sexp--backward-attached-comment ()
"Assuming point is on the opening delimiter of a sexp, move point backward to
the beginning of the \"attached\" comment."
@@ -155,7 +170,7 @@ to clean up whitespace following certain operators."
(list beg-0 :end)))))
;; IDEA: How about the inner-defun text object selects the defun /without/ the
;; comment? Is that more useful, or less? I can't think of the last time I've
;; comment? Is that more useful, or less? I can't think of the last time Ive
;; needed the top-level sexp without the brackets.
;;;###autoload
@@ -189,6 +204,7 @@ delimiters."
(sexp (syd-get-enclosing-sexp)))
(if cleanup-p
(save-excursion
(goto-char (sp-get sexp :beg))
(if (syd-sexp--looking-at-last-p)
(progn (syd-sexp--backward-leading-whitespace sexp)
(list (point) (sp-get sexp :end)))
@@ -208,9 +224,9 @@ sexp-wise analogue to Evil's line-wise `evil-open-below'."
:suppress-operator t
(evil-with-single-undo
;; We want to add an additional blank line when operating at the top level.
;; Instead of parsing upward until we can no longer find an enclosing sexp, we
;; simply check if the opening bracket is on the first column. This is not
;; very correct, but it's way less work (for myself and the CPU). If we
;; Instead of parsing upward until we can no longer find an enclosing sexp,
;; we simply check if the opening bracket is on the first column. This is
;; not very correct, but it's way less work (for myself and the CPU). If we
;; switch to a tree-sitterbased parser, I'd love to switch to the correct
;; algorithm.
(-let* (((beg . end) (sp-get (syd-get-enclosing-sexp) (cons :beg :end)))