feat: Library additions

This commit is contained in:
Madeleine Sydney
2025-02-02 14:51:04 -07:00
parent 0de6153e47
commit c3b93ad52b
2 changed files with 48 additions and 0 deletions

View File

@@ -44,6 +44,10 @@
;; (<= 2 (length hform))
;; (nth 1 hform)))
(defmacro comment (&rest _)
"Completely every argument, and expand to nil."
nil)
(defmacro with-transient-after (hook-or-function &rest forms)
(let ((hook-name (gensym "transient-hook"))
(hook-or-function* (gensym "hook-or-function")))

View File

@@ -68,4 +68,48 @@ in some cases."
(prompt
(read-string (if (stringp prompt) prompt "")))))
;;;###autoload
(defun syd-insert-newline-above ()
"Insert a blank line below the current line."
(interactive)
(save-excursion (evil-insert-newline-above)))
;;;###autoload
(defun syd-insert-newline-below ()
"Insert a blank line below the current line."
(interactive)
(save-excursion (evil-insert-newline-below)))
;;;###autoload
(defun syd-render-ansi-escape-codes (beg end)
(interactive "r")
(require 'ansi-color)
(if (region-active-p)
(ansi-color-apply-on-region beg end)
(ansi-color-apply-on-region (point-min) (point-max))))
(defun syd-evil-paste (before-p arg &optional register yank-handler)
"Like `evil-paste-after', but a 'C-u' prefix argument will instead act like
':put' (i.e. the register will be pasted onto a new line)."
(if (consp arg)
(evil-ex-put (syd-region-beginning) (syd-region-end)
;; `evil-ex-put' wants a string, but it is immediately
;; converted back to a char. }xP
(and register (string register))
before-p)
(funcall (if before-p #'evil-paste-before #'evil-paste-after)
arg register yank-handler)))
;;;###autoload
(evil-define-command syd-evil-paste-after (arg &optional register yank-handler)
"See `syd-evil-paste'.'"
(interactive "P<x><y>")
(syd-evil-paste nil arg register yank-handler))
;;;###autoload
(evil-define-command syd-evil-paste-before (arg &optional register yank-handler)
"See `syd-evil-paste'.'"
(interactive "P<x><y>")
(syd-evil-paste t arg register yank-handler))
(provide 'syd-text)