commit a9ee02d4a701f9b9a37272a9c4763920312bd2c3
parent 096973bc12a3943b6372381252252645d79f8339
Author: Ethan Long <ethandavidlong@gmail.com>
Date: Fri, 16 Aug 2024 17:53:32 +1000
IDK what I've changed since the last commit
Diffstat:
| M | config.org | | | 41 | ++++++++++++++++++++++++++++++----------- |
| M | init.el | | | 37 | ++++++++++++++++++++++++++++++++----- |
2 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/config.org b/config.org
@@ -77,7 +77,8 @@ We also set the ligatures for code
#+end_src
#+begin_src emacs-lisp
(defun ethandl/format-buffer ()
- (when eglot--managed-mode
+ (when (and eglot--managed-mode
+ (eglot-server-capable :documentFormattingProvider))
(eglot-format-buffer)))
#+end_src
#+begin_src emacs-lisp
@@ -104,7 +105,12 @@ We also set the ligatures for code
(defun ethandl/install-treesit-grammars (lang-alist)
(require 'cl-lib)
(when (treesit-available-p)
- (mapc #'treesit-install-language-grammar (cl-remove-if #'treesit-language-available-p (mapcar #'car lang-alist)))))
+ (mapc #'treesit-install-language-grammar
+ (cl-remove-if #'treesit-language-available-p (mapcar #'car lang-alist)))))
+#+end_src
+#+begin_src emacs-lisp
+ (defun ethandl/define-indents ()
+ (setq-local evil-shift-width tab-width))
#+end_src
** Org Mode Configuration
The following function is the base config for org-mode, it sets org to indent on section depth, sets the font to be variable pitch, turns on visual lines for wrapped lines.
@@ -177,6 +183,11 @@ Some configuration for the LaTeX that appears in Org mode. We want to make sure
(when (>= (string-to-number (org-version)) 9.7)
(org-latex-preview-auto-mode t)))
#+end_src
+** Hooks
+#+begin_src emacs-lisp
+ (defun ethandl/before-save-hook ()
+ (ethandl/format-buffer))
+#+end_src
* General Emacs/Editor settings
We can use ~use-package~ to configure emacs at startup. On MacOS we leave things mostly default because emacs-mac doesn't look fugly, but on Linux we might as well get rid of all the clutter. Also we use spaces not tabs, begone tabs.
#+begin_src emacs-lisp
@@ -186,14 +197,14 @@ We can use ~use-package~ to configure emacs at startup. On MacOS we leave things
:hook
(prog-mode . display-line-numbers-mode)
(display-line-numbers-mode . ethandl/line-nums-cfg)
- (before-save . ethandl/format-buffer)
- (after-save . ethandl/line-nums-cfg)
+ (before-save . ethandl/before-save-hook)
+ (find-file . ethandl/define-indents)
:init
(ethandl/set-fonts code-font) ;; Set fonts
;; Get rid of default crud
(setq inhibit-startup-screen t)
- (menu-bar-mode 0)
- (tool-bar-mode 0)
+ (menu-bar-mode 1)
+ (tool-bar-mode 1)
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode 0))
(setq frame-resize-pixelwise t)
@@ -203,6 +214,7 @@ We can use ~use-package~ to configure emacs at startup. On MacOS we leave things
;; Indentation
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
+ (setq-default evil-shift-width tab-width)
(setq ring-bell-function 'ignore) ;; Get rid of the bell
;; Fuck Control+Scroll to zoom, that's terrible and seems to be bound by something in emacs-plus?
(global-unset-key (kbd "<C-wheel-up>"))
@@ -348,6 +360,15 @@ This solution will increase startup time, but will fix any path issues for most
:config
(exec-path-from-shell-initialize)))
#+end_src
+** PDF-tools
+#+begin_src emacs-lisp
+ (use-package pdf-tools
+ :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
+ :hook (pdf-view-mode . auto-revert-mode)
+ :config
+ (setq-default pdf-view-display-size 'fit-page)
+ (setq pdf-annot-activate-created-annotations t))
+#+end_src
* Org Mode
My org mode is based on [[https://orgmode.org/guide/Hyperlinks.html][a post by Diego Zamboni]]. The general idea is that we want headings to be bigger and more noticable than text, all regular text should be non-monospace, and all code should be in the regular monospace font.
HACK fix for the catppuccin theme: (https://github.com/catppuccin/emacs/issues/61)
@@ -429,7 +450,7 @@ Since Emacs 29, we don't need to install tree sitter separately anymore, it come
(setq treesit-enabled (not (eq system-type 'windows-nt)))
(when treesit-enabled
- (elpaca nil (ethandl/install-treesit-grammars treesit-language-source-alist)))
+ (ethandl/install-treesit-grammars treesit-language-source-alist))
#+end_src
** Eldoc Setup
I like to have eldoc appear as a box below where I'm typing, rather than having it appear in the minibuffer. This is done with =eldoc-box=:
@@ -479,9 +500,7 @@ Rust mode alongside LSP again. The rust LSP is very good as far as LSPs go, very
:config
(add-to-list 'eglot-server-programs
`(rust-mode . ("rust-analyzer" :initializationOptions
- (:procmacro (:enable t))
- :cargo (:buildScripts (:enable t)
- :features "all"))))
+ (:procmacro (:enable t)))))
(push '("\\.rs\\'" . rust-ts-mode) auto-mode-alist))
#+end_src
** Go
@@ -558,7 +577,7 @@ A.K.A. the most overused and overhyped language. This language is incredibly slo
`(python-mode . ("pyright-langserver" "--stdio")))
(add-to-list 'eglot-server-programs
`(python-ts-mode . ("pyright-langserver" "--stdio")))
- (push ".dir-locals.el" project-vc-extra-root-markers)
+ ;(push ".dir-locals.el" project-vc-extra-root-markers)
(when treesit-enabled
(push '(python-mode . python-ts-mode) major-mode-remap-alist)))
#+end_src
diff --git a/init.el b/init.el
@@ -1,9 +1,9 @@
-(defvar elpaca-installer-version 0.6)
+(defvar elpaca-installer-version 0.7)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
- :ref nil
+ :ref nil :depth 1
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
@@ -16,8 +16,10 @@
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
- ((zerop (call-process "git" nil buffer t "clone"
- (plist-get order :repo) repo)))
+ ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
+ ,@(when-let ((depth (plist-get order :depth)))
+ (list (format "--depth=%d" depth) "--no-single-branch"))
+ ,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
@@ -47,8 +49,33 @@
;; If we want to use the git version of org mode, we need to download it now
;; There are many reasons you might want to do this, but the git version is quite unstable as well
;;(elpaca (org :host "git.tecosaur.net" :repo "tec/org-mode"))
+;;(use-package org
+ ;;:ensure (:host "git.tecosaur.net" :repo "tec/org-mode"))
(use-package org
- :ensure (:host "git.tecosaur.net" :repo "tec/org-mode"))
+ :defer
+ :ensure `(org
+ :remotes ("tecosaur"
+ :repo "https://git.tecosaur.net/tec/org-mode.git"
+ :branch "dev")
+ :files (:defaults "etc")
+ :build t
+ :pre-build
+ (with-temp-file "org-version.el"
+ (require 'lisp-mnt)
+ (let ((version
+ (with-temp-buffer
+ (insert-file-contents "lisp/org.el")
+ (lm-header "version")))
+ (git-version
+ (string-trim
+ (with-temp-buffer
+ (call-process "git" nil t nil "rev-parse" "--short" "HEAD")
+ (buffer-string)))))
+ (insert
+ (format "(defun org-release () \"The release version of Org.\" %S)\n" version)
+ (format "(defun org-git-version () \"The truncate git commit hash of Org mode.\" %S)\n" git-version)
+ "(provide 'org-version)\n")))
+ :pin nil))
;; We then need to wait for the download of org to complete before we can use org.
(elpaca-wait)
(setq ethandl/config-fname (expand-file-name "config.org" user-emacs-directory))