From 84725344c9635e7d56c1861178e1d6821d71d5c8 Mon Sep 17 00:00:00 2001 From: Jesper Saastamoinen Date: Fri, 2 Jan 2026 19:33:25 +0100 Subject: [PATCH] Updated dotfiles --- .emacs.el | 69 ++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/.emacs.el b/.emacs.el index bae2926..194dac3 100644 --- a/.emacs.el +++ b/.emacs.el @@ -11,6 +11,39 @@ (require 'eglot) (add-hook 'c-mode-hook 'eglot-ensure) +(global-set-key (kbd "C-c d") 'open-test-file) +(global-set-key (kbd "C-c f") 'eglot-code-actions) +(global-set-key (kbd "C-c c") 'compile) +(global-set-key (kbd "C-c e") 'open-init-file) + + +;; Quick shortcuts for testing +(defun open-init-file () + (interactive) + (find-file "~/.emacs.el")) + +(defun open-test-file () + (interactive) + (find-file "~/programming/c-testing/emacstest.c")) + + +;; ELDOC +;; Ensure eldoc displays in a side window +(setq eldoc-in-side-window-mode t) + +;; Set up the display buffer alist to open new buffers in a vertical split +(add-to-list 'display-buffer-alist + '(.* "\\*eldoc\\*" (side . right) (slot . 0) (window-height . 0.1) (reusable-frames . nil))) + +(add-hook 'c-mode-hook 'eldoc-mode) +(add-hook 'python-mode-hook 'eldoc-mode) + +;; Function to ensure new windows are split vertically if possible, otherwise horizontally +(setq split-height-threshold 0) +(setq split-width-threshold (1- (window-width))) +;; + + (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -18,45 +51,9 @@ ;; If there is more than one, they won't work right. ) -(defun open-init-file () - "Open the user's init file." - (interactive) - (find-file "~/.emacs.el")) - -(global-set-key (kbd "C-c e") 'open-init-file) - - -(defun open-test-file () - "Open the user's init file." - (interactive) - (find-file "~/programming/c-testing/emacstest.c")) - -(global-set-key (kbd "C-c d") 'open-test-file) - - - (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(package-selected-packages '(dracula-theme eglot eglot-inactive-regions))) - -(global-set-key (kbd "C-c f") 'eglot-code-actions) - -(global-set-key (kbd "C-c c") 'compile) - -;; Ensure eldoc displays in a side window -(setq eldoc-in-side-window-mode t) - -;; Set up the display buffer alist to open new buffers in a vertical split -(add-to-list 'display-buffer-alist - '(.* "\\*eldoc\\*" (side . right) (slot . 0) (window-width . 0.3) (reusable-frames . nil))) - -;; Ensure eldoc is triggered correctly -(add-hook 'c-mode-hook 'eldoc-mode) -(add-hook 'python-mode-hook 'eldoc-mode) - -;; Function to ensure new windows are split vertically if possible, otherwise horizontally -(setq split-height-threshold 0) -(setq split-width-threshold (1- (window-width)))