diff --git a/config.el b/config.el index 45af0d9..1657a0c 100644 --- a/config.el +++ b/config.el @@ -244,6 +244,10 @@ (define-key whole-line-or-region-local-mode-map [remap comment-dwim] nil) (whole-line-or-region-global-mode +1)) +;; Defer loading of local configuration library. +(use-package! x-lib + :defer t) + ;; ----------------------------------------------------------------------------- ;; Global configuration. ;; ----------------------------------------------------------------------------- @@ -285,33 +289,11 @@ ;; ----------------------------------------------------------------------------- (map! - "C-M-\\" (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)))) - + "C-M-\\" #'+x/indent-region-or-buffer "C-x k" #'kill-current-buffer - - "C-<" (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))) - - "C->" (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))) - - "M-Q" (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))) - + "C-<" #'+x/scroll-down-one + "C->" #'+x/scroll-up-one + "M-Q" #'+x/unfill-paragraph ;; Create binding before dired is loaded. "C-x C-j" #'dired-jump ;; More convenient window switching. diff --git a/packages.el b/packages.el index 34bc92f..755c755 100644 --- a/packages.el +++ b/packages.el @@ -14,6 +14,8 @@ (package! duplicate-thing) (package! treemacs-icons-dired) (package! whole-line-or-region) +(package! x-lib + :recipe (:local-repo "repos/x-lib")) ;; To install a package directly from a remote git repo, you must specify a ;; `:recipe'. You'll find documentation on what `:recipe' accepts here: diff --git a/repos/x-lib/x-lib.el b/repos/x-lib/x-lib.el new file mode 100644 index 0000000..03fce17 --- /dev/null +++ b/repos/x-lib/x-lib.el @@ -0,0 +1,38 @@ +;;; 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/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