feat(format): add +format/org-block-in-region

Also updates `+org/reformat-at-point` to call
`+format/org-block-in-region` if selection is active.

Fix: #7936
This commit is contained in:
Henrik Lissner 2024-07-14 01:48:11 -04:00
parent 378d0b8db6
commit 7543b04e15
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
4 changed files with 91 additions and 27 deletions

View file

@ -135,6 +135,19 @@ Uses `evil-visual-end' if available."
(marker-position evil-visual-end))
(region-end)))
;;;###autoload
(defun doom-region (&optional as-list)
"Return the bounds of the current seelction.
If AS-LIST is non-nil, returns (BEG END). Otherwise returns a cons cell (BEG .
END)."
(let* ((active (doom-region-active-p))
(beg (if active (doom-region-beginning)))
(end (if active (doom-region-end))))
(if as-list
(list beg end)
(cons beg end))))
;;;###autoload
(defun doom-thing-at-point-or-region (&optional thing prompt)
"Grab the current selection, THING at point, or xref identifier at point.