doom/repos/x-lib/x-lib.el

45 lines
1.2 KiB
EmacsLisp

;;; x-lib.el -*- lexical-binding: t -*-
;;
;;; Code:
;;;###autoload
(defun +x/indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
(interactive)
(if (region-active-p)
(indent-region (region-beginning) (region-end))
(indent-region (point-min) (point-max))))
;;;###autoload
(defun +x/kill-buffer ()
"Kill current buffer without prompting for which buffer."
(interactive)
(kill-buffer))
;;;###autoload
(defun +x/scroll-down-one ()
"Scroll text (but not the point) of selected window downward one line."
(interactive)
(let ((scroll-preserve-screen-position nil))
(scroll-down 1)))
;;;###autoload
(defun +x/scroll-up-one ()
"Scroll text (but not the point) of selected window upward one line."
(interactive)
(let ((scroll-preserve-screen-position nil))
(scroll-up 1)))
;;;###autoload
(defun +x/unfill-paragraph (&optional region)
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive (progn (barf-if-buffer-read-only) '(t)))
(let ((fill-column (point-max))
;; This would override `fill-column' if it's an integer.
(emacs-lisp-docstring-fill-column t))
(fill-paragraph nil region)))
(provide 'x-lib)
;;; x-lib.el ends here