(Emacs/*)~stop using create-toggle-function
This commit is contained in:
@@ -96,7 +96,7 @@ to the kill ring and bind it to "Y".
|
|||||||
:keymaps 'calendar-mode-map
|
:keymaps 'calendar-mode-map
|
||||||
"Y" #'+calendar/copy-date)
|
"Y" #'+calendar/copy-date)
|
||||||
(app-leader
|
(app-leader
|
||||||
"d" #'+calendar/toggle-calendar)
|
"d" #'calendar)
|
||||||
:config
|
:config
|
||||||
(defun +calendar/copy-date ()
|
(defun +calendar/copy-date ()
|
||||||
"Copy date under cursor into kill ring."
|
"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)))
|
(let ((date (calendar-cursor-to-date)))
|
||||||
(when date
|
(when date
|
||||||
(setq date (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 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))))))
|
(kill-new (format-time-string "%Y-%m-%d" date)))))))
|
||||||
(+oreo/create-toggle-function
|
|
||||||
+calendar/toggle-calendar
|
|
||||||
"*Calendar*"
|
|
||||||
calendar
|
|
||||||
nil))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Mail
|
* Mail
|
||||||
Mail is a funny thing; most people use it just for business or
|
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
|
:commands +shell/toggle-eshell
|
||||||
:general
|
:general
|
||||||
(shell-leader
|
(shell-leader
|
||||||
"t" #'+shell/toggle-eshell)
|
"t" #'eshell)
|
||||||
:init
|
:init
|
||||||
(add-hook
|
(add-hook
|
||||||
'eshell-mode-hook
|
'eshell-mode-hook
|
||||||
@@ -432,13 +427,7 @@ function to pull up the eshell quickly.
|
|||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
"c" (proc (interactive) (eshell/clear)
|
"c" (proc (interactive) (eshell/clear)
|
||||||
(recenter))
|
(recenter))
|
||||||
"k" #'eshell-kill-process)))
|
"k" #'eshell-kill-process))))
|
||||||
:config
|
|
||||||
(+oreo/create-toggle-function
|
|
||||||
+shell/toggle-eshell
|
|
||||||
"*eshell*"
|
|
||||||
eshell
|
|
||||||
t))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** Eshell pretty symbols and display
|
** Eshell pretty symbols and display
|
||||||
Pretty symbols and a display record.
|
Pretty symbols and a display record.
|
||||||
|
|||||||
@@ -59,9 +59,15 @@ temporary customisation) in the etc folder.
|
|||||||
Functions that don't require a packages to work other than Emacs,
|
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
|
which means I can define them early. These are used much later in the
|
||||||
config.
|
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
|
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.
|
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
|
#+begin_src emacs-lisp
|
||||||
(with-eval-after-load "window"
|
(with-eval-after-load "window"
|
||||||
(defmacro +oreo/create-toggle-function (func-name buf-name
|
(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)
|
((eq +oreo/theme 'light)
|
||||||
(load-theme 'personal-primary t)
|
(load-theme 'personal-primary t)
|
||||||
(setq +oreo/theme 'dark)))))
|
(setq +oreo/theme 'dark)))))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** Font size
|
** Font size
|
||||||
Set font size to 140 if on my desktop (oldboy) or 175 if on my laptop
|
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.
|
thing faster and within Emacs lisp. ~rgrep~ is useful though.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package grep
|
(use-package grep
|
||||||
|
:after evil
|
||||||
:straight nil
|
:straight nil
|
||||||
:display
|
:display
|
||||||
("^\\*grep.*"
|
("^\\*grep.*"
|
||||||
|
|||||||
@@ -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
|
Thankfully you can change this via the ~display-buffer-alist~ which
|
||||||
matches buffer names with how the window for the buffer should be
|
matches buffer names with how the window for the buffer should be
|
||||||
displayed. I add a use-package keyword to make ~display-buffer-alist~
|
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.
|
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
|
#+begin_src emacs-lisp
|
||||||
(use-package window
|
(use-package window
|
||||||
:straight nil
|
:straight nil
|
||||||
@@ -593,6 +597,7 @@ I have no idea whether it's optimal AT ALL, but it works for me.
|
|||||||
"k" #'previous-buffer
|
"k" #'previous-buffer
|
||||||
"D" '(+oreo/clean-buffer-list :which-key "Kill most buffers"))
|
"D" '(+oreo/clean-buffer-list :which-key "Kill most buffers"))
|
||||||
:init
|
:init
|
||||||
|
(setq switch-to-buffer-obey-display-actions t)
|
||||||
(with-eval-after-load "use-package-core"
|
(with-eval-after-load "use-package-core"
|
||||||
(add-to-list 'use-package-keywords ':display)
|
(add-to-list 'use-package-keywords ':display)
|
||||||
(defun use-package-normalize/:display (_name-symbol _keyword args)
|
(defun use-package-normalize/:display (_name-symbol _keyword args)
|
||||||
|
|||||||
@@ -531,17 +531,11 @@ Setup for python shell, including a toggle option
|
|||||||
:commands +python/toggle-repl
|
:commands +python/toggle-repl
|
||||||
:general
|
:general
|
||||||
(shell-leader
|
(shell-leader
|
||||||
"p" #'+shell/python-toggle-repl)
|
"p" #'run-python)
|
||||||
:display
|
:display
|
||||||
("\\*Python\\*"
|
("\\*Python\\*"
|
||||||
(display-buffer-at-bottom)
|
(display-buffer-at-bottom)
|
||||||
(window-height . 0.25))
|
(window-height . 0.25)))
|
||||||
:config
|
|
||||||
(+oreo/create-toggle-function
|
|
||||||
+shell/python-toggle-repl
|
|
||||||
"*Python*"
|
|
||||||
run-python
|
|
||||||
nil))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* YAML
|
* YAML
|
||||||
YAML is a data language which is useful for config files.
|
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))
|
(setq-default org-babel-lisp-eval-fn #'sly-eval))
|
||||||
(with-eval-after-load "company"
|
(with-eval-after-load "company"
|
||||||
(add-hook 'sly-mrepl-hook #'company-mode))
|
(add-hook 'sly-mrepl-hook #'company-mode))
|
||||||
(+oreo/create-toggle-function
|
|
||||||
+shell/toggle-sly
|
|
||||||
"*sly-mrepl for sbcl*"
|
|
||||||
sly-mrepl
|
|
||||||
nil)
|
|
||||||
:general
|
:general
|
||||||
(shell-leader
|
(shell-leader
|
||||||
"s" #'+shell/toggle-sly)
|
"s" #'sly-mrepl)
|
||||||
(nmap
|
(nmap
|
||||||
:keymaps '(lisp-mode-map sly-mrepl-mode-map)
|
:keymaps '(lisp-mode-map sly-mrepl-mode-map)
|
||||||
"gr" #'sly-eval-buffer
|
"gr" #'sly-eval-buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user