Adjust indentation for prot-embark

This commit is contained in:
Vedang Manerikar 2024-12-02 09:42:50 +05:30
parent c383baf17d
commit 2f13a813fa

View file

@ -6064,144 +6064,144 @@ NOTE: All these settings are being added after the provide form, which is a big
:END: :END:
#+begin_src emacs-lisp :tangle "custom-lisp/prot-embark.el" :mkdirp yes #+begin_src emacs-lisp :tangle "custom-lisp/prot-embark.el" :mkdirp yes
;;; prot-embark.el --- Custom Embark keymaps -*- lexical-binding: t -*- ;;; prot-embark.el --- Custom Embark keymaps -*- lexical-binding: t -*-
;; Copyright (C) 2023-2024 Protesilaos Stavrou ;; Copyright (C) 2023-2024 Protesilaos Stavrou
;; Author: Protesilaos Stavrou <info@protesilaos.com> ;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://protesilaos.com/emacs/dotemacs ;; URL: https://protesilaos.com/emacs/dotemacs
;; Version: 0.1.0 ;; Version: 0.1.0
;; Package-Requires: ((emacs "30.1") (embark "0.23")) ;; Package-Requires: ((emacs "30.1") (embark "0.23"))
;; This file is NOT part of GNU Emacs. ;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at ;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version. ;; your option) any later version.
;; ;;
;; This program is distributed in the hope that it will be useful, ;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details. ;; GNU General Public License for more details.
;; ;;
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary: ;;; Commentary:
;; ;;
;; Remember that every piece of Elisp that I write is for my own ;; Remember that every piece of Elisp that I write is for my own
;; educational and recreational purposes. I am not a programmer and I ;; educational and recreational purposes. I am not a programmer and I
;; do not recommend that you copy any of this if you are not certain of ;; do not recommend that you copy any of this if you are not certain of
;; what it does. ;; what it does.
;;; Code: ;;; Code:
(require 'embark) (require 'embark)
(defvar-keymap prot-embark-general-map (defvar-keymap prot-embark-general-map
:parent embark-general-map :parent embark-general-map
"i" #'embark-insert "i" #'embark-insert
"w" #'embark-copy-as-kill "w" #'embark-copy-as-kill
"E" #'embark-export "E" #'embark-export
"S" #'embark-collect "S" #'embark-collect
"A" #'embark-act-all "A" #'embark-act-all
"DEL" #'delete-region) "DEL" #'delete-region)
(defvar-keymap prot-embark-url-map (defvar-keymap prot-embark-url-map
:parent embark-general-map :parent embark-general-map
"b" #'browse-url "b" #'browse-url
"d" #'embark-download-url "d" #'embark-download-url
"e" #'eww) "e" #'eww)
(defvar-keymap prot-embark-buffer-map (defvar-keymap prot-embark-buffer-map
:parent embark-general-map :parent embark-general-map
"k" #'prot-simple-kill-buffer "k" #'prot-simple-kill-buffer
"o" #'switch-to-buffer-other-window "o" #'switch-to-buffer-other-window
"e" #'ediff-buffers) "e" #'ediff-buffers)
(add-to-list 'embark-post-action-hooks (list 'prot-simple-kill-buffer 'embark--restart)) (add-to-list 'embark-post-action-hooks (list 'prot-simple-kill-buffer 'embark--restart))
(defvar-keymap prot-embark-file-map (defvar-keymap prot-embark-file-map
:parent embark-general-map :parent embark-general-map
"f" #'find-file "f" #'find-file
"j" #'embark-dired-jump "j" #'embark-dired-jump
"c" #'copy-file "c" #'copy-file
"e" #'ediff-files) "e" #'ediff-files)
(defvar-keymap prot-embark-identifier-map (defvar-keymap prot-embark-identifier-map
:parent embark-general-map :parent embark-general-map
"h" #'display-local-help "h" #'display-local-help
"." #'xref-find-definitions "." #'xref-find-definitions
"o" #'occur) "o" #'occur)
(defvar-keymap prot-embark-command-map (defvar-keymap prot-embark-command-map
:parent embark-general-map :parent embark-general-map
"h" #'describe-command "h" #'describe-command
"." #'embark-find-definition) "." #'embark-find-definition)
(defvar-keymap prot-embark-expression-map (defvar-keymap prot-embark-expression-map
:parent embark-general-map :parent embark-general-map
"e" #'pp-eval-expression "e" #'pp-eval-expression
"m" #'pp-macroexpand-expression) "m" #'pp-macroexpand-expression)
(defvar-keymap prot-embark-function-map (defvar-keymap prot-embark-function-map
:parent embark-general-map :parent embark-general-map
"h" #'describe-function "h" #'describe-function
"." #'embark-find-definition) "." #'embark-find-definition)
(defvar-keymap prot-embark-package-map (defvar-keymap prot-embark-package-map
:parent embark-general-map :parent embark-general-map
"h" #'describe-package "h" #'describe-package
"i" #'package-install "i" #'package-install
"d" #'package-delete "d" #'package-delete
"r" #'package-reinstall "r" #'package-reinstall
"u" #'embark-browse-package-url "u" #'embark-browse-package-url
"w" #'embark-save-package-url) "w" #'embark-save-package-url)
(defvar-keymap prot-embark-symbol-map (defvar-keymap prot-embark-symbol-map
:parent embark-general-map :parent embark-general-map
"h" #'describe-symbol "h" #'describe-symbol
"." #'embark-find-definition) "." #'embark-find-definition)
(defvar-keymap prot-embark-variable-map (defvar-keymap prot-embark-variable-map
:parent embark-general-map :parent embark-general-map
"h" #'describe-variable "h" #'describe-variable
"." #'embark-find-definition) "." #'embark-find-definition)
(defvar-keymap prot-embark-region-map (defvar-keymap prot-embark-region-map
:parent embark-general-map :parent embark-general-map
"a" #'align-regexp "a" #'align-regexp
"D" #'delete-duplicate-lines "D" #'delete-duplicate-lines
"f" #'flush-lines "f" #'flush-lines
"i" #'epa-import-keys-region "i" #'epa-import-keys-region
"d" #'epa-decrypt-armor-in-region "d" #'epa-decrypt-armor-in-region
"r" #'repunctuate-sentences "r" #'repunctuate-sentences
"s" #'sort-lines "s" #'sort-lines
"u" #'untabify) "u" #'untabify)
;; The minimal indicator shows cycling options, but I have no use ;; The minimal indicator shows cycling options, but I have no use
;; for those. I want it to be silent. ;; for those. I want it to be silent.
(defun prot-embark-no-minimal-indicator ()) (defun prot-embark-no-minimal-indicator ())
(advice-add #'embark-minimal-indicator :override #'prot-embark-no-minimal-indicator) (advice-add #'embark-minimal-indicator :override #'prot-embark-no-minimal-indicator)
(defun prot-embark-act-no-quit () (defun prot-embark-act-no-quit ()
"Call `embark-act' but do not quit after the action." "Call `embark-act' but do not quit after the action."
(interactive) (interactive)
(let ((embark-quit-after-action nil)) (let ((embark-quit-after-action nil))
(call-interactively #'embark-act))) (call-interactively #'embark-act)))
(defun prot-embark-act-quit () (defun prot-embark-act-quit ()
"Call `embark-act' and quit after the action." "Call `embark-act' and quit after the action."
(interactive) (interactive)
(let ((embark-quit-after-action t)) (let ((embark-quit-after-action t))
(call-interactively #'embark-act)) (call-interactively #'embark-act))
(when (and (> (minibuffer-depth) 0) (when (and (> (minibuffer-depth) 0)
(derived-mode-p 'completion-list-mode)) (derived-mode-p 'completion-list-mode))
(abort-recursive-edit))) (abort-recursive-edit)))
(provide 'prot-embark) (provide 'prot-embark)
;;; prot-embark.el ends here ;;; prot-embark.el ends here
#+end_src #+end_src
** The =prot-window.el= library ** The =prot-window.el= library