62 lines
2.1 KiB
Org Mode
62 lines
2.1 KiB
Org Mode
:PROPERTIES:
|
|
:ID: cce/hydra_dipswitches
|
|
:END:
|
|
#+TITLE: Hydra Dipswitches
|
|
#+PROPERTY: header-args :mkdirp yes :results none
|
|
#+PROPERTY: header-args:emacs-lisp :tangle hydra-dipswitch.el
|
|
#+ARROYO_EMACS_MODULE: hydra-dipswitch
|
|
#+ARCOLOGY_KEY: cce/hydra-dipswitch
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
#+CCE_PREDICATE: t
|
|
#+CCE_PRIORITY: 10
|
|
#+ARROYO_MODULE_WANTS: cce/hydra.org
|
|
|
|
#+begin_src emacs-lisp
|
|
(provide 'cce/hydra-dipswitch)
|
|
#+end_src
|
|
|
|
I have a [[id:cce/hydra][Hydra]] function called =hydra-dipswitch= which exposes some common important [[id:cce/emacs][Emacs]] variables, allowing me to quickly toggle common systems. I would love to expand this some day to include system-level things like Wi-Fi, power management, etc...
|
|
|
|
#+begin_src emacs-lisp
|
|
(defhydra hydra-dipswitch ()
|
|
"Toggles"
|
|
("e" toggle-debug-on-error "Debug on Error")
|
|
("q" toggle-debug-on-quit "Debug on Quit")
|
|
("r" tasshin/read-write-toggle "Read/Write")
|
|
("w" whitespace-mode "Whitespace")
|
|
("l" lsp-ui-mode "LSP UI")
|
|
("f" focus-mode "Focus")
|
|
("t" bh/set-truncate-lines "Truncate")
|
|
("n" cce/toggle-theme "Light/Dark")
|
|
("d" visible-mode "Visible Mode")
|
|
("v" variable-pitch-mode "Variable Pitch"))
|
|
|
|
(with-eval-after-load 'evil-leader
|
|
(evil-leader/set-key "t" 'hydra-dipswitch/body))
|
|
#+end_src
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun tasshin/read-write-toggle ()
|
|
"Toggles read-only in any relevant mode: ag-mode, Dired, or
|
|
just any file at all."
|
|
(interactive)
|
|
(if (equal major-mode 'ag-mode)
|
|
;; wgrep-ag can support ag-mode
|
|
(wgrep-change-to-wgrep-mode)
|
|
;; dired-toggle-read-only has its own conditional:
|
|
;; if the mode is Dired, it will make the directory writable
|
|
;; if it is not, it will just toggle read only, as desired
|
|
(dired-toggle-read-only)))
|
|
#+end_src
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun bh/set-truncate-lines ()
|
|
"Toggle value of truncate-lines and refresh window display."
|
|
(interactive)
|
|
(setq truncate-lines (not truncate-lines))
|
|
;; now refresh window display (an idiom from simple.el):
|
|
(save-excursion
|
|
(set-window-start (selected-window)
|
|
(window-start (selected-window)))))
|
|
#+end_src
|