Got popper working
This commit is contained in:
parent
6e0df30192
commit
d10dae9bfb
@ -73,6 +73,8 @@ Prioritize old byte-compiled source files over newer sources. It saves us a litt
|
|||||||
(org-babel-tangle))
|
(org-babel-tangle))
|
||||||
nil t)))
|
nil t)))
|
||||||
|
|
||||||
|
(setq server-name (format "Emacs-%d" (emacs-pid)))
|
||||||
|
(add-hook 'after-init-hook #'server-start)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** UTF-8 Support
|
*** UTF-8 Support
|
||||||
#+begin_src emacs-lisp :tangle ./early-init.el
|
#+begin_src emacs-lisp :tangle ./early-init.el
|
||||||
@ -229,9 +231,9 @@ Save the chosen theme after picking a new one
|
|||||||
(let ((inhibit-message t)
|
(let ((inhibit-message t)
|
||||||
(message-log-max nil))
|
(message-log-max nil))
|
||||||
(customize-save-variable 'custom-enabled-themes custom-enabled-themes)))
|
(customize-save-variable 'custom-enabled-themes custom-enabled-themes)))
|
||||||
;; (add-hook 'kill-emacs-hook #'joe/save-current-theme)
|
|
||||||
(advice-add 'consult-theme :after #'joe/save-current-theme)
|
(advice-add 'consult-theme :after #'joe/save-current-theme)
|
||||||
(advice-remove 'load-theme 'joe/save-current-theme)
|
|
||||||
|
;; (advice-remove 'load-theme 'joe/save-current-theme)
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Other
|
*** Other
|
||||||
@ -592,7 +594,7 @@ weren't working, until I randomly saw this in someone's init.el
|
|||||||
;; (define-key evil-consult-map "c" 'evil-window-delete)
|
;; (define-key evil-consult-map "c" 'evil-window-delete)
|
||||||
|
|
||||||
(defvar global-evil-leader-map (make-sparse-keymap))
|
(defvar global-evil-leader-map (make-sparse-keymap))
|
||||||
(evil-define-key 'normal 'global-evil-leader-map (kbd "SPC") 'evil-send-leader)
|
;; (evil-define-key 'normal 'global-evil-leader-map (kbd "SPC") 'evil-send-leader)
|
||||||
|
|
||||||
(define-minor-mode global-evil-leader-mode
|
(define-minor-mode global-evil-leader-mode
|
||||||
"Minor mode to make evil leader global"
|
"Minor mode to make evil leader global"
|
||||||
@ -677,10 +679,9 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
|
|||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook 'after-init-hook (lambda () (winner-mode t)))
|
(add-hook 'after-init-hook (lambda () (winner-mode t)))
|
||||||
|
|
||||||
(straight-use-package 'rotate)
|
|
||||||
(setq joe/popper-side-toggle 'right)
|
(setq joe/popper-side-toggle 'right)
|
||||||
(defun joe/window-split-vertical () (interactive) (set 'joe/popper-side-toggle 'right) (rotate:main-horizontal))
|
(defun joe/window-split-vertical () (interactive) (set 'joe/popper-side-toggle 'right))
|
||||||
(defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below) (rotate:main-vertical))
|
(defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below))
|
||||||
|
|
||||||
(define-key ctl-x-4-map (kbd "|") #'joe/window-split-vertical)
|
(define-key ctl-x-4-map (kbd "|") #'joe/window-split-vertical)
|
||||||
(define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal)
|
(define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal)
|
||||||
@ -730,13 +731,26 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
|
|||||||
;; TODO Consider adding checks for vertical splits and only popup on right if so
|
;; TODO Consider adding checks for vertical splits and only popup on right if so
|
||||||
(defun joe/popper-display-func (buffer &optional _alist)
|
(defun joe/popper-display-func (buffer &optional _alist)
|
||||||
(cond
|
(cond
|
||||||
((cl-find-if
|
((when-let ((popup-buffer
|
||||||
(lambda (window)
|
(cl-find-if
|
||||||
(with-current-buffer (window-buffer window) popper-popup-status))
|
#'popper-popup-p
|
||||||
(window-list))
|
(mapcar #'window-buffer (window-list)))))
|
||||||
(display-buffer-reuse-window
|
(window--display-buffer
|
||||||
buffer
|
buffer (get-buffer-window popup-buffer) 'reuse
|
||||||
`((body-function . ,#'select-window))))
|
`((body-function . ,#'select-window)))))
|
||||||
|
|
||||||
|
((and (eq joe/popper-side-toggle 'right)
|
||||||
|
(window-in-direction 'left))
|
||||||
|
(message "Here")
|
||||||
|
(window--display-buffer
|
||||||
|
buffer (get-buffer-window (current-buffer)) 'reuse))
|
||||||
|
|
||||||
|
((when-let ((right-window (window-in-direction 'right))
|
||||||
|
((eq joe/popper-side-toggle 'right)))
|
||||||
|
(window--display-buffer
|
||||||
|
buffer right-window 'reuse
|
||||||
|
`((body-function . ,#'select-window)))))
|
||||||
|
|
||||||
((and (not (window-in-direction 'right))
|
((and (not (window-in-direction 'right))
|
||||||
(not (window-in-direction 'left)))
|
(not (window-in-direction 'left)))
|
||||||
(display-buffer-in-direction
|
(display-buffer-in-direction
|
||||||
@ -898,6 +912,8 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
|
|||||||
|
|
||||||
(add-hook 'project-find-functions #'joe/project-root-override)
|
(add-hook 'project-find-functions #'joe/project-root-override)
|
||||||
|
|
||||||
|
(global-set-key (kbd "<f2>") #'set-frame-name)
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** VEMCO
|
** VEMCO
|
||||||
|
|
||||||
@ -1238,7 +1254,7 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
|
|||||||
(straight-use-package 'undo-fu)
|
(straight-use-package 'undo-fu)
|
||||||
(straight-use-package 'undo-fu-session)
|
(straight-use-package 'undo-fu-session)
|
||||||
(straight-use-package 'vundo)
|
(straight-use-package 'vundo)
|
||||||
(global-undo-fu-session-mode)
|
(undo-fu-session-global-mode +1)
|
||||||
|
|
||||||
(setq undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
|
(setq undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
|
||||||
|
|
||||||
@ -1453,7 +1469,30 @@ println!("Hello world");
|
|||||||
*** Compilation
|
*** Compilation
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq compilation-auto-jump-to-first-error t)
|
(setq compilation-auto-jump-to-first-error t)
|
||||||
(define-key global-map (kbd "<f9>") #'recompile)
|
|
||||||
|
(defun joe/save-then-recompile ()
|
||||||
|
"Save the buffer before recompiling"
|
||||||
|
(interactive)
|
||||||
|
(when (buffer-file-name)
|
||||||
|
(save-buffer))
|
||||||
|
(recompile))
|
||||||
|
|
||||||
|
(defun joe/save-if-file-ignore-args (&rest _)
|
||||||
|
"Save the buffer before recompiling"
|
||||||
|
(interactive)
|
||||||
|
(joe/save-if-file))
|
||||||
|
|
||||||
|
(defun joe/save-if-file ()
|
||||||
|
"Save buffer only if it has a backing file"
|
||||||
|
(interactive)
|
||||||
|
(when (buffer-file-name)
|
||||||
|
(save-buffer)))
|
||||||
|
|
||||||
|
(define-key global-map (kbd "M-s") #'save-buffer)
|
||||||
|
(add-hook 'evil-insert-state-exit-hook #'joe/save-if-file)
|
||||||
|
(add-hook 'after-change-functions #'joe/save-if-file-ignore-args)
|
||||||
|
;; (define-key global-map (kbd "C-x C-s) #'save-buffer)
|
||||||
|
(define-key global-map (kbd "<f9>") #'joe/save-then-recompile)
|
||||||
(define-key global-map (kbd "<f10>") #'compile)
|
(define-key global-map (kbd "<f10>") #'compile)
|
||||||
#+end_src
|
#+end_src
|
||||||
** Debugging
|
** Debugging
|
||||||
@ -1494,37 +1533,6 @@ println!("Hello world");
|
|||||||
(define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input)
|
(define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input)
|
||||||
(define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input)
|
(define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input)
|
||||||
#+end_src>
|
#+end_src>
|
||||||
*** C
|
|
||||||
|
|
||||||
Design some basic functions for compiling. There's also a hook to close the popper window if there
|
|
||||||
are no warnings or errors. It will check if we are still in the compilation buffer as well as
|
|
||||||
whether the point hasn't been moved. This way, if I switched to another popper buffer, like vterm,
|
|
||||||
it doesn't close it.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(straight-use-package 'disaster)
|
|
||||||
(defun joe/c-mode-hook ()
|
|
||||||
(local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run")))
|
|
||||||
(local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make")))
|
|
||||||
(electric-pair-local-mode t)
|
|
||||||
(c-toggle-comment-style -1))
|
|
||||||
(add-hook 'c-mode-hook #'joe/c-mode-hook)
|
|
||||||
|
|
||||||
(defun joe/close-compilation-if-no-warn-err (buffer string)
|
|
||||||
"Bury a compilation buffer if succeeded without warnings "
|
|
||||||
(if (and
|
|
||||||
(string-match "compilation" (buffer-name buffer))
|
|
||||||
(string-match "finished" string)
|
|
||||||
(not
|
|
||||||
(with-current-buffer (current-buffer)
|
|
||||||
(search-forward "warning" nil t))))
|
|
||||||
(run-with-timer 1.5 nil
|
|
||||||
(lambda ()
|
|
||||||
(and (eq (point) 1)
|
|
||||||
(string-match "compilation" (buffer-name (current-buffer)))
|
|
||||||
(popper-close-latest))))))
|
|
||||||
(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err)
|
|
||||||
#+end_src
|
|
||||||
*** Rust
|
*** Rust
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(straight-use-package 'rustic)
|
(straight-use-package 'rustic)
|
||||||
@ -1562,6 +1570,37 @@ it doesn't close it.
|
|||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(global-set-key (kbd "C-x C-r") 'eval-region)
|
(global-set-key (kbd "C-x C-r") 'eval-region)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
*** C
|
||||||
|
|
||||||
|
Design some basic functions for compiling. There's also a hook to close the popper window if there
|
||||||
|
are no warnings or errors. It will check if we are still in the compilation buffer as well as
|
||||||
|
whether the point hasn't been moved. This way, if I switched to another popper buffer, like vterm,
|
||||||
|
it doesn't close it.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(straight-use-package 'disaster)
|
||||||
|
(defun joe/c-mode-hook ()
|
||||||
|
(local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run")))
|
||||||
|
(local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make")))
|
||||||
|
(electric-pair-local-mode t)
|
||||||
|
(c-toggle-comment-style -1))
|
||||||
|
(add-hook 'c-mode-hook #'joe/c-mode-hook)
|
||||||
|
|
||||||
|
(defun joe/close-compilation-if-no-warn-err (buffer string)
|
||||||
|
"Bury a compilation buffer if succeeded without warnings "
|
||||||
|
(if (and
|
||||||
|
(string-match "compilation" (buffer-name buffer))
|
||||||
|
(string-match "finished" string)
|
||||||
|
(not
|
||||||
|
(with-current-buffer (current-buffer)
|
||||||
|
(search-forward "warning" nil t))))
|
||||||
|
(run-with-timer 1.5 nil
|
||||||
|
(lambda ()
|
||||||
|
(and (eq (point) 1)
|
||||||
|
(string-match "compilation" (buffer-name (current-buffer)))
|
||||||
|
(popper-close-latest))))))
|
||||||
|
(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err)
|
||||||
|
#+end_src
|
||||||
*** Haskell
|
*** Haskell
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(straight-use-package 'haskell-mode)
|
(straight-use-package 'haskell-mode)
|
||||||
@ -1569,6 +1608,12 @@ it doesn't close it.
|
|||||||
(evil-define-key 'insert haskell-interactive-mode-map (kbd "C-n") #'haskell-interactive-mode-history-next)
|
(evil-define-key 'insert haskell-interactive-mode-map (kbd "C-n") #'haskell-interactive-mode-history-next)
|
||||||
(evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous)
|
(evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous)
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
*** Clojure
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(straight-use-package 'clojure-mode)
|
||||||
|
(straight-use-package 'cider)
|
||||||
|
(setq cider-show-error-buffer 'only-in-repl)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** OCaml
|
*** OCaml
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
@ -1615,12 +1660,6 @@ and there's no need for a middle-man when it's already been implemented.
|
|||||||
;; Use opam switch to lookup ocamlmerlin binary
|
;; Use opam switch to lookup ocamlmerlin binary
|
||||||
(setq merlin-command 'opam)))
|
(setq merlin-command 'opam)))
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Clojure
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(straight-use-package 'clojure-mode)
|
|
||||||
(straight-use-package 'cider)
|
|
||||||
(setq cider-show-error-buffer 'only-in-repl)
|
|
||||||
#+end_src
|
|
||||||
*** FSharp
|
*** FSharp
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(straight-use-package 'fsharp-mode)
|
(straight-use-package 'fsharp-mode)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
function e --wraps=nvim --description 'alias e nvim'
|
function e --wraps=emacsclient -n $argv
|
||||||
emacsclient -n $argv;
|
emacsclient -n $argv;
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user