General refactor + clean up
This commit is contained in:
parent
ac590845f9
commit
6259c64866
2 changed files with 19 additions and 22 deletions
|
@ -371,10 +371,10 @@ the command buffer."
|
||||||
|
|
||||||
|
|
||||||
(after! mu4e
|
(after! mu4e
|
||||||
(advice-add #'mu4e~temp-window :override #'doom*mu4e~temp-window)
|
(defun doom*mu4e-popup-window (buf height)
|
||||||
(defun doom*mu4e~temp-window (buf height)
|
|
||||||
(doom-popup-buffer buf :size 10 :noselect t)
|
(doom-popup-buffer buf :size 10 :noselect t)
|
||||||
buf))
|
buf)
|
||||||
|
(advice-add #'mu4e~temp-window :override #'doom*mu4e-popup-window))
|
||||||
|
|
||||||
|
|
||||||
(after! twittering-mode
|
(after! twittering-mode
|
||||||
|
@ -382,15 +382,15 @@ the command buffer."
|
||||||
|
|
||||||
|
|
||||||
(after! xref
|
(after! xref
|
||||||
(advice-add 'xref-goto-xref :around '+jump*xref-goto-xref)
|
(defun doom*xref-follow-and-close (orig-fn &rest args)
|
||||||
(defun +jump*xref-goto-xref (orig-fn &rest args)
|
|
||||||
"Jump to the xref on the current line, select its window and close the popup
|
"Jump to the xref on the current line, select its window and close the popup
|
||||||
you came from."
|
you came from."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((popup-p (doom-popup-p))
|
(let ((popup-p (doom-popup-p))
|
||||||
(window (selected-window)))
|
(window (selected-window)))
|
||||||
(apply orig-fn args)
|
(apply orig-fn args)
|
||||||
(when popup-p (doom/popup-close window)))))
|
(when popup-p (doom/popup-close window))))
|
||||||
|
(advice-add 'xref-goto-xref :around 'doom*xref-follow-and-close))
|
||||||
|
|
||||||
|
|
||||||
;; Ensure these settings are attached to org-load-hook as late as possible,
|
;; Ensure these settings are attached to org-load-hook as late as possible,
|
||||||
|
@ -413,17 +413,16 @@ you came from."
|
||||||
'("^CAPTURE.*\\.org$" :regexp t :size 20))
|
'("^CAPTURE.*\\.org$" :regexp t :size 20))
|
||||||
|
|
||||||
;; Org tries to do its own popup management, causing buffer/window config
|
;; Org tries to do its own popup management, causing buffer/window config
|
||||||
;; armageddon when paired with shackle. To fix this, we must make a couple modifications:
|
;; armageddon when paired with shackle. To fix this, we must make a couple
|
||||||
|
;; modifications:
|
||||||
|
|
||||||
;; Suppress `delete-other-windows' in org functions:
|
;; Suppress `delete-other-windows' in org functions:
|
||||||
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
|
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
|
||||||
(cl-flet ((silence (&rest args) (ignore)))
|
(cl-flet (((symbol-function 'delete-other-windows)
|
||||||
(advice-add #'delete-other-windows :around #'silence)
|
(symbol-function 'ignore)))
|
||||||
(unwind-protect
|
(apply orig-fn args)))
|
||||||
(apply orig-fn args)
|
|
||||||
(advice-remove #'delete-other-windows #'silence))))
|
|
||||||
(advice-add #'org-capture-place-template :around #'doom*suppress-delete-other-windows)
|
|
||||||
(advice-add #'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
(advice-add #'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
||||||
|
(advice-add #'org-capture-place-template :around #'doom*suppress-delete-other-windows)
|
||||||
(advice-add #'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
(advice-add #'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
||||||
|
|
||||||
;; Tell `org-src-edit' to open another window, which shackle can intercept.
|
;; Tell `org-src-edit' to open another window, which shackle can intercept.
|
||||||
|
@ -443,21 +442,21 @@ you came from."
|
||||||
(advice-add #'org-edit-src-exit :after #'doom*org-src-exit)
|
(advice-add #'org-edit-src-exit :after #'doom*org-src-exit)
|
||||||
|
|
||||||
;; Ensure todo, agenda, and other popups are opened with shackle
|
;; Ensure todo, agenda, and other popups are opened with shackle
|
||||||
(defun doom*org-switch-to-buffer-other-window (&rest args)
|
(defun doom*org-pop-to-buffer (&rest args)
|
||||||
(let ((buf (car args)))
|
(let ((buf (car args)))
|
||||||
(pop-to-buffer
|
(pop-to-buffer
|
||||||
(cond ((stringp buf) (get-buffer-create buf))
|
(cond ((stringp buf) (get-buffer-create buf))
|
||||||
((bufferp buf) buf)
|
((bufferp buf) buf)
|
||||||
(t (error "Invalid buffer %s" buf))))))
|
(t (error "Invalid buffer %s" buf))))))
|
||||||
(advice-add #'org-switch-to-buffer-other-window :override #'doom*org-switch-to-buffer-other-window)
|
(advice-add #'org-switch-to-buffer-other-window :override #'doom*org-pop-to-buffer)
|
||||||
|
|
||||||
;; Hide modeline in org-agenda
|
|
||||||
(add-hook 'org-agenda-finalize-hook #'doom-hide-modeline-mode)
|
|
||||||
|
|
||||||
(after! org-agenda
|
(after! org-agenda
|
||||||
(setq org-agenda-window-setup 'other-window
|
(setq org-agenda-window-setup 'other-window
|
||||||
org-agenda-restore-windows-after-quit nil)
|
org-agenda-restore-windows-after-quit nil)
|
||||||
|
|
||||||
|
;; Hide modeline in org-agenda
|
||||||
|
(add-hook 'org-agenda-finalize-hook #'doom-hide-modeline-mode)
|
||||||
|
|
||||||
(advice-add #'org-agenda :around #'doom*suppress-delete-other-windows)
|
(advice-add #'org-agenda :around #'doom*suppress-delete-other-windows)
|
||||||
|
|
||||||
(after! evil
|
(after! evil
|
||||||
|
|
|
@ -465,16 +465,14 @@ algorithm is just confusing, like in python or ruby."
|
||||||
|
|
||||||
(push neo-buffer-name winner-boring-buffers)
|
(push neo-buffer-name winner-boring-buffers)
|
||||||
|
|
||||||
;; Don't ask for confirmation when creating files
|
|
||||||
(defun +evil*neotree-create-node (orig-fun &rest args)
|
(defun +evil*neotree-create-node (orig-fun &rest args)
|
||||||
"Don't ask for confirmation when creating files"
|
"Don't ask for confirmation when creating files"
|
||||||
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t)))
|
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t)))
|
||||||
(apply orig-fun args)))
|
(apply orig-fun args)))
|
||||||
|
|
||||||
(advice-add #'neotree-create-node :around #'+evil*neotree-create-node)
|
(advice-add #'neotree-create-node :around #'+evil*neotree-create-node)
|
||||||
|
|
||||||
;; Adding keybindings to `neotree-mode-map' wouldn't work for me (they get
|
;; `neotree-mode-map' are overridden when the neotree buffer is created. So we
|
||||||
;; overridden when the neotree buffer is spawned). So we bind them in a hook.
|
;; bind them in a hook.
|
||||||
(add-hook 'neo-after-create-hook #'+evil|neotree-init-keymap)
|
(add-hook 'neo-after-create-hook #'+evil|neotree-init-keymap)
|
||||||
(defun +evil|neotree-init-keymap (&rest _)
|
(defun +evil|neotree-init-keymap (&rest _)
|
||||||
(map! :Lm "\\\\" 'evil-window-prev
|
(map! :Lm "\\\\" 'evil-window-prev
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue