emacs: Toggle olivetti mode when resizing windows, comment out stuff, formatting

This commit is contained in:
Joseph Ferano 2025-06-24 18:48:12 +07:00
parent 49552caea9
commit 81ec6fa96c

View File

@ -260,12 +260,12 @@ Finish up
mu4e-alert
dirvish
restclient
gptel
disaster
magit))
(setopt package-vc-selected-packages
'((dotenv :url "https://github.com/pkulev/dotenv.el")
(gptel :url "https://github.com/karthink/gptel")
(indent-bars :url "https://github.com/jdtsmith/indent-bars")
(doom-themes :url "https://github.com/JosephFerano/doom-themes")
(org-timeblock :url "https://github.com/ichernyshovvv/org-timeblock")
@ -364,12 +364,23 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering
#+begin_src emacs-lisp
(require 'olivetti)
(if (equal "flowjoe-f37" (system-name))
(setq olivetti-minimum-body-width 100)
(setq olivetti-minimum-body-width 120))
;; (if (equal "flowjoe-f37" (system-name))
;; (setq olivetti-minimum-body-width 100)
;; (setq olivetti-minimum-body-width 120))
(setq olivetti-minimum-body-width 120)
(global-set-key (kbd "C-x x o") 'olivetti-mode)
(add-hook 'prog-mode-hook 'olivetti-mode)
;; (add-hook 'prog-mode-hook 'olivetti-mode)
(defun joe/toggle-olivetti-based-on-width ()
(when (derived-mode-p 'prog-mode)
(if (> (window-total-width) 120)
(olivetti-mode 1)
(olivetti-mode -1))))
(add-hook 'window-configuration-change-hook #'joe/toggle-olivetti-based-on-width)
#+end_src
Remove this hook from Olivetti so that lines can truncate [[https://github.com/rnkn/olivetti/issues/76][Github issue]]
@ -534,9 +545,9 @@ Ligatures... are they that useful?
(interactive "r")
(if (use-region-p)
(message "%s"
(concat
(mapcar 'string-to-number
(split-string (buffer-substring-no-properties beg end) " "))))
(concat
(mapcar 'string-to-number
(split-string (buffer-substring-no-properties beg end) " "))))
(message "No region selected")))
(define-key ctl-x-x-map (kbd "a") #'joe/get-ascii-in-region)
@ -1195,7 +1206,7 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
(evil-global-set-key 'normal (kbd "SPC b f") #'joe/beframe-switch-and-unassume)
#+end_src
*** Popper
*** COMMENT Popper
#+begin_src emacs-lisp
(require 'popper)
(setq popper-reference-buffers
@ -1594,7 +1605,7 @@ Stuff to immediately switch to Jetbrains for debugging
#+begin_src emacs-lisp
(global-set-key (kbd "C-M-r") #'joe/open-in-rider)
;; (global-set-key (kbd "C-M-r") #'joe/open-in-rider)
(defun joe/raise-frame-hook ()
(select-frame-set-input-focus (selected-frame)))
(add-hook 'server-switch-hook #'joe/raise-frame-hook)
@ -2521,7 +2532,7 @@ And we do the rest here, including a macro
:server-id 'ols
:multi-root t))) ;; Ensures lsp-mode sends "workspaceFolders" to the server
(add-hook 'odin-mode-hook #'lsp)
;; (add-hook 'odin-mode-hook #'lsp)
(defun joe/odin-mode-hook ()
(electric-pair-local-mode))
@ -2557,9 +2568,9 @@ it doesn't close it.
#+end_src
*** Rust
#+begin_src emacs-lisp
(setq rustic-lsp-setup-p nil)
(require 'rustic)
(require 'ob-rust)
;; (setq rustic-lsp-setup-p nil)
;; (require 'rustic)
;; (require 'ob-rust)
;; Org-Babel
;; Disabling until we figure out how to get it working
;; (elpaca 'parsec) ;; Required by evcxr-mode
@ -2722,11 +2733,11 @@ and there's no need for a middle-man when it's already been implemented.
(evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous)
#+end_src
*** COMMENT Clojure
*** Clojure
#+begin_src emacs-lisp
(require 'clojure-mode)
(require 'cider)
(setq cider-show-error-buffer 'only-in-repl)
;; (setq cider-show-error-buffer 'only-in-repl)
#+end_src
*** COMMENT FSharp
#+begin_src emacs-lisp
@ -3043,7 +3054,7 @@ with the cursor you hit TAB and you complete the following;
(define-key global-map (kbd "C-c t a") #'org-transclusion-add)
(define-key global-map (kbd "C-c t r") #'org-transclusion-remove)
#+end_src
*** org-roam
*** COMMENT org-roam
#+begin_src emacs-lisp
(require 'org-roam)
(setq org-roam-directory "/home/joe/Notes/Roam/")
@ -3085,8 +3096,7 @@ with the cursor you hit TAB and you complete the following;
#+end_src
** Magit
The best git porcelain/client I've ever used. Also kill stray magit buffers left
over as explained [[https://manueluberti.eu/2018/02/17/magit-bury-buffer.html][here]]
The best git porcelain/client I've ever used. Also kill stray magit buffers left over as explained [[https://manueluberti.eu/2018/02/17/magit-bury-buffer.html][here]]
#+begin_src emacs-lisp
(require 'magit)
@ -3098,7 +3108,7 @@ over as explained [[https://manueluberti.eu/2018/02/17/magit-bury-buffer.html][h
(mapc #'kill-buffer buffers)))
(when (boundp 'evil-mode)
(add-hook 'with-editor-mode-hook 'evil-insert-state))
(add-hook 'with-editor-mode-hook 'evil-insert-state))
(setq magit-bury-buffer-function #'joe/magit-kill-buffers)
(setq magit-clone-set-remote.pushDefault t)
@ -3119,7 +3129,7 @@ over as explained [[https://manueluberti.eu/2018/02/17/magit-bury-buffer.html][h
** Restclient
#+begin_src emacs-lisp
(require 'restclient)
;; (require 'restclient)
(add-to-list 'auto-mode-alist '("\\.restclient\\'" . restclient-mode))