From a01cba5589368b6b2c3946d1286e8b295ab3403d Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 18:18:05 +0530 Subject: (Emacs/*)~stop using create-toggle-function --- Emacs/.config/emacs/app.org | 19 ++++--------------- Emacs/.config/emacs/config.org | 10 ++++++++-- Emacs/.config/emacs/core.org | 7 ++++++- Emacs/.config/emacs/lang.org | 17 +++-------------- 4 files changed, 21 insertions(+), 32 deletions(-) (limited to 'Emacs') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index c75e8f1..5b94a9d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -96,7 +96,7 @@ to the kill ring and bind it to "Y". :keymaps 'calendar-mode-map "Y" #'+calendar/copy-date) (app-leader - "d" #'+calendar/toggle-calendar) + "d" #'calendar) :config (defun +calendar/copy-date () "Copy date under cursor into kill ring." @@ -106,12 +106,7 @@ to the kill ring and bind it to "Y". (let ((date (calendar-cursor-to-date))) (when date (setq date (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))) - (kill-new (format-time-string "%Y-%m-%d" date)))))) - (+oreo/create-toggle-function - +calendar/toggle-calendar - "*Calendar*" - calendar - nil)) + (kill-new (format-time-string "%Y-%m-%d" date))))))) #+end_src * Mail Mail is a funny thing; most people use it just for business or @@ -417,7 +412,7 @@ function to pull up the eshell quickly. :commands +shell/toggle-eshell :general (shell-leader - "t" #'+shell/toggle-eshell) + "t" #'eshell) :init (add-hook 'eshell-mode-hook @@ -432,13 +427,7 @@ function to pull up the eshell quickly. :keymaps 'eshell-mode-map "c" (proc (interactive) (eshell/clear) (recenter)) - "k" #'eshell-kill-process))) - :config - (+oreo/create-toggle-function - +shell/toggle-eshell - "*eshell*" - eshell - t)) + "k" #'eshell-kill-process)))) #+end_src ** Eshell pretty symbols and display Pretty symbols and a display record. diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 83655e4..a0c6cc8 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -59,9 +59,15 @@ temporary customisation) in the etc folder. Functions that don't require a packages to work other than Emacs, which means I can define them early. These are used much later in the config. -** Toggle buffer +** WAIT Toggle buffer +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: Like VSCode's toggling feature for just the terminal but now for any buffer of choice, as long as I can generate it via a command. + +2024-04-23: Don't need this anymore due to +~switch-to-buffer-obey-display-actions~. #+begin_src emacs-lisp (with-eval-after-load "window" (defmacro +oreo/create-toggle-function (func-name buf-name @@ -253,7 +259,6 @@ dark easily, so here's a command to switch between them. ((eq +oreo/theme 'light) (load-theme 'personal-primary t) (setq +oreo/theme 'dark))))) - #+end_src ** Font size Set font size to 140 if on my desktop (oldboy) or 175 if on my laptop @@ -663,6 +668,7 @@ I have no use for standard 'grep'; ~counsel-swiper~ does the same thing faster and within Emacs lisp. ~rgrep~ is useful though. #+begin_src emacs-lisp (use-package grep + :after evil :straight nil :display ("^\\*grep.*" diff --git a/Emacs/.config/emacs/core.org b/Emacs/.config/emacs/core.org index 759ee24..60fb64c 100644 --- a/Emacs/.config/emacs/core.org +++ b/Emacs/.config/emacs/core.org @@ -578,9 +578,13 @@ a whim and not particularly caring for the current window setup. Thankfully you can change this via the ~display-buffer-alist~ which matches buffer names with how the window for the buffer should be displayed. I add a use-package keyword to make ~display-buffer-alist~ -records within use-package. +records within a use-package call. I have no idea whether it's optimal AT ALL, but it works for me. + +2024-04-23: Found this option ~switch-to-buffer-obey-display-actions~ +which makes manual buffer switches obey the same constraints via +~display-buffer-alist~ as creating the buffer automatically. #+begin_src emacs-lisp (use-package window :straight nil @@ -593,6 +597,7 @@ I have no idea whether it's optimal AT ALL, but it works for me. "k" #'previous-buffer "D" '(+oreo/clean-buffer-list :which-key "Kill most buffers")) :init + (setq switch-to-buffer-obey-display-actions t) (with-eval-after-load "use-package-core" (add-to-list 'use-package-keywords ':display) (defun use-package-normalize/:display (_name-symbol _keyword args) diff --git a/Emacs/.config/emacs/lang.org b/Emacs/.config/emacs/lang.org index fb1ee36..594c52e 100644 --- a/Emacs/.config/emacs/lang.org +++ b/Emacs/.config/emacs/lang.org @@ -531,17 +531,11 @@ Setup for python shell, including a toggle option :commands +python/toggle-repl :general (shell-leader - "p" #'+shell/python-toggle-repl) + "p" #'run-python) :display ("\\*Python\\*" (display-buffer-at-bottom) - (window-height . 0.25)) - :config - (+oreo/create-toggle-function - +shell/python-toggle-repl - "*Python*" - run-python - nil)) + (window-height . 0.25))) #+end_src * YAML YAML is a data language which is useful for config files. @@ -642,14 +636,9 @@ development on Emacs. (setq-default org-babel-lisp-eval-fn #'sly-eval)) (with-eval-after-load "company" (add-hook 'sly-mrepl-hook #'company-mode)) - (+oreo/create-toggle-function - +shell/toggle-sly - "*sly-mrepl for sbcl*" - sly-mrepl - nil) :general (shell-leader - "s" #'+shell/toggle-sly) + "s" #'sly-mrepl) (nmap :keymaps '(lisp-mode-map sly-mrepl-mode-map) "gr" #'sly-eval-buffer -- cgit v1.2.3-13-gbd6f