Compare commits

...

10 Commits

@ -4,6 +4,7 @@
(require 'seq)
(require 'server)
(require 'edebug)
(require 'xdg)
(global-unset-key (kbd "<left>"))
(global-unset-key (kbd "<right>"))
@ -79,6 +80,7 @@
(scroll-bar-mode 0)
(tool-bar-mode 0)
(tooltip-mode 0)
(auto-save-mode 0)
(load-theme 'wombat)
(load-theme 'badger t)

@ -0,0 +1,37 @@
;;; flycheck-nasm-mode.el --- flycheck checker for NASM -*- lexical-binding: t; -*-
;; Copyright (C) 2024 John Turner
;; Author: John Turner jturner.usa@gmail.com
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'flycheck)
(flycheck-def-option-var flycheck-nasm-format "elf64" nasm
"NASM executable format."
:type 'string)
(flycheck-define-checker nasm
"Flycheck checker for NASM."
:command ("nasm" "-o" "/dev/null" (option "-f" flycheck-nasm-format) source)
:error-patterns ((error line-start (file-name) ":" line ":" space "error:" space (message) line-end)
(warning line-start (file-name) ":" line ":" space "warning:" space (message) line-end))
:modes (asm-mode nasm-mode))
(provide 'flycheck-nasm)
;;; flycheck-nasm-mode.el ends here

@ -0,0 +1,76 @@
;;; fmt.el --- -*- lexical-binding: t; -*-
;; Copyright (C) 2023 John Turner
;; Author: John Turner <notroot@gentoo-pc>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(defgroup fmt nil
"Format buffers using external programs such as rustfmt.")
(defcustom fmt-executable nil
"Formatter executable to use for formatting a buffer."
:local t
:type '(string)
:group 'fmt)
(defcustom fmt-args nil
"Args to use when running fmt-executable."
:local t
:type '(repeat string)
:group 'fmt)
(defun fmt--init-output-buffer (name)
(with-current-buffer (get-buffer-create name)
(erase-buffer)
(current-buffer)))
(defun fmt--wait-for-processes (processes)
(cl-loop for process in processes
do (cl-loop while (accept-process-output process))))
(defun fmt-process-current-buffer ()
(let* ((stdout-buffer (fmt--init-output-buffer "*fmt stdout*"))
(stderr-buffer (fmt--init-output-buffer "*fmt stderr*"))
(stderr (make-pipe-process
:name (format "%s stderr" fmt-executable)
:buffer stderr-buffer
:sentinel 'ignore
:noquery t))
(process (make-process
:name fmt-executable
:buffer stdout-buffer
:command (cons fmt-executable fmt-args)
:sentinel 'ignore
:noquery t
:connection-type 'pipe
:stderr stderr)))
(process-send-region process (point-min) (point-max))
(process-send-eof process)
(cons process stderr)))
(defun fmt-current-buffer ()
(interactive)
(pcase-let ((`(,process . ,stderr) (fmt-process-current-buffer)))
(fmt--wait-for-processes (list process stderr))
(if (zerop (process-exit-status process))
(replace-buffer-contents (process-buffer process))
(message "%s failed with exit status %s. See %s for output."
fmt-executable
(process-exit-status process)
(process-buffer stderr)))))
(provide 'fmt)
;;; fmt.el ends here

@ -34,3 +34,8 @@
(use-package best-side-window
:load-path (lambda () (locate-user-emacs-file "lisp/best-side-window")))
(use-package fmt
:load-path (lambda () (locate-user-emacs-file "lisp/fmt")))
(use-package flycheck-nasm
:load-path (lambda () (locate-user-emacs-file "lisp/flycheck-nasm")))

@ -0,0 +1,4 @@
(use-package dired
:custom
(dired-listing-switches "-ahl --group-directories-first")
(dired-kill-when-opening-new-dired-buffer t))

@ -1,3 +1,9 @@
(use-package flycheck
:hook
(flycheck-error-list-mode . visual-line-mode))
(flycheck-error-list-mode . visual-line-mode)
:custom
(flycheck-python-mypy-cache-dir (file-name-concat (getenv "HOME") ".cache" "mypy"))
:config
(when (require 'best-side-window nil t)
(add-to-list 'display-buffer-alist '((major-mode . flycheck-error-list-mode)
best-side-window-display-buffer-in-best-side-window))))

@ -0,0 +1,3 @@
(use-package image-dired
:custom
(image-dired-dir (file-name-concat (xdg-cache-home) "image-dired")))

@ -0,0 +1 @@
(use-package nasm-mode)

@ -0,0 +1,3 @@
(use-package recentf
:custom
(recentf-save-file (file-name-concat (xdg-state-home) "emacs/recentf")))

@ -1,4 +1,4 @@
(use-package savehist
:custom
(savehist-file (file-name-concat user-emacs-directory "savehist"))
(savehist-file (file-name-concat (xdg-state-home) "emacs/savehist"))
(savehist-save-minibuffer-history t))

@ -0,0 +1,4 @@
(use-package saveplace
:custom
(save-place-file (file-name-concat (xdg-state-home) "saveplace/places"))
(save-place-limit nil))

@ -1,9 +1,8 @@
(use-package tramp
:custom
(tramp-password-cache nil)
(tramp-persistency-file-name nil)
(tramp-persistency-file-name (file-name-concat (xdg-state-home) "emacs/tramp/persistency-file"))
:config
(add-to-list 'tramp-connection-properties
(list (regexp-quote (format "/sudo:root@%s:" system-name))
"session-timeout" (* 60 60)))
(add-to-list 'tramp-remote-path "/root/bin"))
"session-timeout" (* 60 60))))

@ -0,0 +1,5 @@
(use-package transient
:custom
(transient-levels-file (file-name-concat (xdg-state-home) "emacs/transient/levels.el"))
(transient-values-file (file-name-concat (xdg-state-home) "emacs/transient/values.el"))
(transient-history-file (file-name-concat (xdg-state-home) "emacs/transient/history.el")))

@ -3,7 +3,8 @@
:config
(let ((setup-treesit-mode (lambda (parser treesit-mode modes &optional interpreters)
(if (not (treesit-language-available-p parser))
(error "treesit language parser not available for %s" (symbol-name language))
(message "treesit language parser not available for %s"
(symbol-name language))
(seq-each (lambda (mode)
(add-to-list 'auto-mode-alist
(cons (rx (literal ".")

Loading…
Cancel
Save