Skip to content

Commit

Permalink
Improve plist pp function
Browse files Browse the repository at this point in the history
The function now advances through the elements in the list with
`forward-sexp` instead of regex, making it more robust. It also
properly handles lists now.
  • Loading branch information
tralph3 committed May 2, 2024
1 parent 56dc45b commit cc2471d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions conner.el
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,14 @@ been called. You can use `plist-get' to fetch data from it.
(let ((inhibit-message t)
(message-log-max nil))
(lisp-data-mode)
(insert (pp-to-string plist))
(goto-char (point-min))
(prin1 plist (current-buffer))
(goto-char (1+ (point-min)))
(dotimes (i (proper-list-p plist))
(when (and (cl-evenp i) (not (eq i 0)))
(re-search-forward (pp (nth i plist)))
(goto-char (match-beginning 0))
(when (and (cl-evenp i) (< (1+ i) (1- (proper-list-p plist))))
(forward-sexp 2)
(newline-and-indent)))
(goto-char (point-max))
(newline-and-indent)
(buffer-string))))

(defun conner--pp-plist-list (plist-list)
Expand Down

0 comments on commit cc2471d

Please sign in to comment.