buncha stuff

This commit is contained in:
opfez 2022-07-18 12:11:22 +02:00
parent 8a2aa2d75f
commit d76764d98d
5 changed files with 171 additions and 92 deletions

View File

@ -1,3 +1,5 @@
;; -*- lexical-binding: t -*-
;;; Compilation ;;; Compilation
(setq compile-command "make ") (setq compile-command "make ")
;; C-m functions as \r, so pressing C-x C-m C-m will call compile and skip the prompt. ;; C-m functions as \r, so pressing C-x C-m C-m will call compile and skip the prompt.
@ -230,9 +232,35 @@
(message (message
(substring (substring
(shell-command-to-string (shell-command-to-string
(concat "detex " (buffer-file-name) " | wc -w")) (concat "texcount " (buffer-file-name) " | grep \"^Words in text:\""))
0 -1))) 0 -1)))
(defun fez/log ()
"Add entry to daily log."
(interactive)
(let ((temp-buffer (generate-new-buffer (generate-new-buffer-name "temp-log"))))
(switch-to-buffer temp-buffer)
(text-mode)
(writeroom-mode)
(local-set-key (kbd "C-c C-c")
(lambda () (interactive)
(find-file "~/doc/log.txt")
(goto-char (point-max))
(insert "\n")
(fez/time-stamp)
(goto-char (point-max))
(insert-buffer-substring temp-buffer)
(insert "\nHumør:")
(save-buffer)
(bookmark-set "log.txt")
(insert " ")
(kill-buffer temp-buffer)))))
(defun fez/eshell-new ()
"Open a new instance of eshell."
(interactive)
(eshell 'N))
;; Eshell convinience commands. ;; Eshell convinience commands.
(defalias 'open 'find-file-other-window) (defalias 'open 'find-file-other-window)
(defalias 'clean 'eshell/clear-scrollback) (defalias 'clean 'eshell/clear-scrollback)
@ -248,8 +276,13 @@
;; Better buffer management (smol). ;; Better buffer management (smol).
(global-set-key (kbd "C-x C-b") 'bs-show) (global-set-key (kbd "C-x C-b") 'bs-show)
;; Inspiration from Nyxt, kill the current buffer. ;; Kill the current buffer and close the window it occupied.
(global-set-key (kbd "C-x C-k") 'kill-this-buffer) (global-set-key (kbd "C-x C-k")
(lambda ()
(interactive)
(kill-this-buffer)
(when (> (length (window-list)) 1)
(delete-window))))
(global-set-key (kbd "C-c t") 'fez/time-stamp) (global-set-key (kbd "C-c t") 'fez/time-stamp)
@ -258,6 +291,8 @@
(global-set-key (kbd "C-S-o") 'open-line) (global-set-key (kbd "C-S-o") 'open-line)
(global-set-key (kbd "C-o") 'fez/insert-line) (global-set-key (kbd "C-o") 'fez/insert-line)
(global-set-key (kbd "C-c C-s") 'fez/eshell-new)
;; zap-up-to-char > zap-to-char ;; zap-up-to-char > zap-to-char
(global-set-key (kbd "M-z") 'zap-up-to-char) (global-set-key (kbd "M-z") 'zap-up-to-char)

View File

@ -17,7 +17,7 @@
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Manually installed modes. ;; Manually installed modes.
(add-to-list 'load-path "~/.emacs.d/elisp/") (add-to-list 'load-path "~/.emacs.d/elisp/mu4e/")
;; Package ;; Package
(require 'package) (require 'package)

10
init.el
View File

@ -1,3 +1,5 @@
;; -*- lexical-binding: t -*-
;; Load essentials. ;; Load essentials.
(load "~/.emacs.d/essential.el") (load "~/.emacs.d/essential.el")
@ -13,8 +15,8 @@
;; Start an emacs server from this session, if it isn't already running. ;; Start an emacs server from this session, if it isn't already running.
;; This is useful for stuff like Nyxt where we can launch and emacsclient to ;; This is useful for stuff like Nyxt where we can launch and emacsclient to
;; evaluate forms. ;; evaluate forms.
(when (not (server-running-p)) ;; (when (not (server-running-p))
(server-start)) ;; (server-start))
;; Tab width. ;; Tab width.
(setq-default tab-width 4) (setq-default tab-width 4)
@ -23,8 +25,8 @@
;;; Appearance ;;; Appearance
;; The font is set in fontconfig. Usually it's UW Ttyp0 or Gohufont ;; The font is set in fontconfig. Usually it's UW Ttyp0 or Gohufont
(set-frame-font "monospace 12") (set-frame-font "monospace 11")
(setq default-frame-alist '((font . "monospace 12"))) (setq default-frame-alist '((font . "monospace 11")))
;; Highlight matching parentheses. ;; Highlight matching parentheses.
(show-paren-mode t) (show-paren-mode t)

View File

@ -73,24 +73,39 @@
(use-package racket-mode (use-package racket-mode
:ensure t) :ensure t)
;; Amazing s-expression editing mode. (use-package lua-mode
(use-package lispy
:ensure t :ensure t
:config :config
(add-hook 'scheme-mode-hook 'lispy-mode) (setq-default lua-indent-level 4))
(add-hook 'lisp-mode-hook 'lispy-mode)
(add-hook 'emacs-lisp-mode-hook 'lispy-mode) ;; Amazing s-expression editing mode.
(add-hook 'racket-mode 'lispy-mode)) ;; (use-package lispy
;; :ensure t
;; :config
;; (add-hook 'scheme-mode-hook 'lispy-mode)
;; (add-hook 'lisp-mode-hook 'lispy-mode)
;; (add-hook 'emacs-lisp-mode-hook 'lispy-mode)
;; (add-hook 'racket-mode 'lispy-mode))
(use-package paredit
:ensure t
:config
(add-hook 'scheme-mode-hook 'paredit-mode)
(add-hook 'lisp-mode-hook 'paredit-mode)
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'racket-mode 'paredit-mode)
(add-hook 'fennel-mode 'paredit-mode)
)
;;; Utility packages ;;; Utility packages
;; undo-tree is mainly used for its redo functionality. ;; undo-tree is mainly used for its redo functionality.
(use-package undo-tree ;; (use-package undo-tree
:ensure t ;; :ensure t
:bind ;; :bind
("C-_" . 'undo-tree-undo) ;; ("C-_" . 'undo-tree-undo)
("M-_" . 'undo-tree-redo) ;; ("M-_" . 'undo-tree-redo)
:config ;; :config
(global-undo-tree-mode)) ;; (global-undo-tree-mode))
;; Nice startup screen. ;; Nice startup screen.
(use-package dashboard (use-package dashboard
@ -162,7 +177,7 @@
:bind :bind
("C-c o c" . org-capture) ("C-c o c" . org-capture)
:config :config
;;; org-capture ;;; org-capture
;; Default location for org-capture is ~/org/notes.org ;; Default location for org-capture is ~/org/notes.org
(setq org-default-notes-file (concat org-directory "/notes.org")) (setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-capture-templates (setq org-capture-templates
@ -207,76 +222,92 @@
(setq god-exempt-predicates nil) (setq god-exempt-predicates nil)
(setq god-mode-enable-function-key-translation nil)) (setq god-mode-enable-function-key-translation nil))
(use-package exwm (use-package tex
:ensure auctex
:init :init
(defun fez/exwm-init-hook () (setq compilation-ask-about-save nil)
(exwm-workspace-switch-create 1)) (setq TeX-save-query nil)
(setq TeX-command-force "LaTeX")
(setq LaTeX-command-style '(("" " %(PDF)%(latex) %(file-line-error) -shell-escape %(extraopts) %(output-dir) %S%(PDFout)")))
(setq TeX-view-program-selection
'((output-pdf "Zathura")))
(setq tex-fontify-script nil)
(setq font-latex-fontify-script nil)
(fset 'tex-font-lock-suscript 'ignore))
(require 'exwm-randr) ;; mu4e doesn't have a (m)elpa package, apparently, so it is set up manually here
(setq exwm-randr-workspace-output-plist '(0 "HDMI-0")) (require 'mu4e)
(add-hook 'exwm-randr-screen-change-hook
(lambda () ;; (use-package exwm
(start-process-shell-command ;; :init
"xrandr" nil "xrandr --output HDMI-0 --left-of DVI-D-0 --auto"))) ;; (defun fez/exwm-init-hook ()
(exwm-randr-enable) ;; (exwm-workspace-switch-create 1))
;; (require 'exwm-randr)
;; (setq exwm-randr-workspace-output-plist '(0 "HDMI-0"))
;; (add-hook 'exwm-randr-screen-change-hook
;; (lambda ()
;; (start-process-shell-command
;; "xrandr" nil "xrandr --output HDMI-0 --left-of DVI-D-0 --auto")))
;; (exwm-randr-enable)
(defun exwm-config () ;; (defun exwm-config ()
"EXWM configuration." ;; "EXWM configuration."
;; Set the initial workspace number. ;; ;; Set the initial workspace number.
(unless (get 'exwm-workspace-number 'saved-value) ;; (unless (get 'exwm-workspace-number 'saved-value)
(setq exwm-workspace-number 4)) ;; (setq exwm-workspace-number 4))
;; Make class name the buffer name ;; ;; Make class name the buffer name
(add-hook 'exwm-update-class-hook ;; (add-hook 'exwm-update-class-hook
(lambda () ;; (lambda ()
(exwm-workspace-rename-buffer exwm-class-name))) ;; (exwm-workspace-rename-buffer exwm-class-name)))
;; Global keybindings. ;; ;; Global keybindings.
(unless (get 'exwm-input-global-keys 'saved-value) ;; (unless (get 'exwm-input-global-keys 'saved-value)
(setq exwm-input-global-keys ;; (setq exwm-input-global-keys
`( ;; `(
;; 's-r': Reset (to line-mode, fullscreen). ;; ;; 's-r': Reset (to line-mode, fullscreen).
([?\s-r] . exwm-reset) ;; ([?\s-r] . exwm-reset)
;; 's-w': Switch workspace. ;; ;; 's-w': Switch workspace.
([?\s-w] . exwm-workspace-switch) ;; ([?\s-w] . exwm-workspace-switch)
;; 's-&': Launch application. ;; ;; 's-&': Launch application.
([?\s-&] . (lambda (command) ;; ([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ "))) ;; (interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command))) ;; (start-process-shell-command command nil command)))
;; 's-N': Switch to certain workspace. ;; ;; 's-N': Switch to certain workspace.
(\,@(mapcar (lambda (i) ;; (\,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) . ;; `(,(kbd (format "s-%d" i)) .
(lambda () ;; (lambda ()
(interactive) ;; (interactive)
(exwm-workspace-switch-create ,i)))) ;; (exwm-workspace-switch-create ,i))))
(number-sequence 0 9))) ;; (number-sequence 0 9)))
;; 's-a': Toggle X mouse ;; ;; 's-a': Toggle X mouse
([?\s-a] . fez/toggle-x-mouse) ;; ([?\s-a] . fez/toggle-x-mouse)
;; 's-<space>': Toggle keyboard layouts ;; ;; 's-<space>': Toggle keyboard layouts
([?\s-\ ] . fez/swap-keyboard) ;; ([?\s-\ ] . fez/swap-keyboard)
;; 's-l': Toggle line-mode and char-mode for the current window. ;; ;; 's-l': Toggle line-mode and char-mode for the current window.
([?\s-l] . exwm-input-toggle-keyboard) ;; ([?\s-l] . exwm-input-toggle-keyboard)
;; windmove movement commands ;; ;; windmove movement commands
([?\s-u] . windmove-left) ;; ([?\s-u] . windmove-left)
([?\s-i] . windmove-down) ;; ([?\s-i] . windmove-down)
([?\s-o] . windmove-up) ;; ([?\s-o] . windmove-up)
([?\s-p] . windmove-right))) ;; ([?\s-p] . windmove-right)))
;; Line-editing shortcuts ;; ;; Line-editing shortcuts
(unless (get 'exwm-input-simulation-keys 'saved-value) ;; (unless (get 'exwm-input-simulation-keys 'saved-value)
(setq exwm-input-simulation-keys ;; (setq exwm-input-simulation-keys
'(([?\C-b] . [left]) ;; '(([?\C-b] . [left])
([?\C-f] . [right]) ;; ([?\C-f] . [right])
([?\C-p] . [up]) ;; ([?\C-p] . [up])
([?\C-n] . [down]) ;; ([?\C-n] . [down])
([?\C-a] . [home]) ;; ([?\C-a] . [home])
([?\C-e] . [end]) ;; ([?\C-e] . [end])
([?\M-v] . [prior]) ;; ([?\M-v] . [prior])
([?\C-v] . [next]) ;; ([?\C-v] . [next])
([?\C-d] . [delete]) ;; ([?\C-d] . [delete])
([?\C-k] . [S-end delete])))) ;; ([?\C-k] . [S-end delete]))))
;; Enable windmove keybinds ;; ;; Enable windmove keybinds
(winner-mode t) ;; (winner-mode t)
;; Enable EXWM ;; ;; Enable EXWM
(exwm-enable)))) ;; (exwm-enable))))
(use-package elfeed (use-package elfeed
:ensure t :ensure t
@ -286,7 +317,7 @@
("https://m455.casa/feed.rss" friend) ("https://m455.casa/feed.rss" friend)
("https://itwont.work/atom.xml" friend) ("https://itwont.work/atom.xml" friend)
("http://tilde.town/~archenoth/.weed" friend) ("http://tilde.town/~archenoth/.weed" friend)
("https://tilde.town/~opfez/rss.xml" friend) ("https://tilde.town/~opfez/blog_rss.xml" friend)
("https://dataswamp.org/~solene/rss.xml" blog) ("https://dataswamp.org/~solene/rss.xml" blog)
("http://verisimilitudes.net/rss.xml" blog) ("http://verisimilitudes.net/rss.xml" blog)
("https://stevelosh.com/rss.xml" blog) ("https://stevelosh.com/rss.xml" blog)
@ -305,15 +336,18 @@
("https://git.qorg11.net/kill9.git/rss" blog) ("https://git.qorg11.net/kill9.git/rss" blog)
("https://regularflolloping.com/rss.xml" blog) ("https://regularflolloping.com/rss.xml" blog)
("https://sigkill.dk/atom.xml" blog) ("https://sigkill.dk/atom.xml" blog)
("https://doisinkidney.com/rss.xml" blog)
("http://leahneukirchen.org/trivium/index.atom" blog)
("https://cosmic.voyage/rss.xml" other) ("https://cosmic.voyage/rss.xml" other)
("https://xkcd.com/rss.xml" other) ("https://xkcd.com/rss.xml" other)
("https://nixers.net/syndication.php?limit=15" other) ("https://nixers.net/syndication.php?limit=15" other)
("http://lambda-the-ultimate.org/node/feed" other) ("http://lambda-the-ultimate.org/node/feed" other)
("https://esoteric.codes/rss" other)
("https://solar.lowtechmagazine.com/feeds/all-en.atom.xml" news) ("https://solar.lowtechmagazine.com/feeds/all-en.atom.xml" news)
("http://n-gate.com/index.rss" news) ("http://n-gate.com/index.rss" news)
("https://suckless.org/atom.xml" news) ("https://suckless.org/atom.xml" news)
("https://www.aftenposten.no/rss/" news) ;("https://www.aftenposten.no/rss/" news)
("https://www.nrk.no/toppsaker.rss" news) ;("https://www.nrk.no/toppsaker.rss" news)
("https://www.youtube.com/feeds/videos.xml?channel_id=UC_QIfHvN9auy2CoOdSfMWDw" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UC_QIfHvN9auy2CoOdSfMWDw" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCD6VugMZKRhSyzWEWA9W2fg" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UCD6VugMZKRhSyzWEWA9W2fg" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UClOGLGPOqlAiLmOvXW5lKbw" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UClOGLGPOqlAiLmOvXW5lKbw" youtube)
@ -341,6 +375,11 @@
("https://www.youtube.com/feeds/videos.xml?channel_id=UCD6VugMZKRhSyzWEWA9W2fg" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UCD6VugMZKRhSyzWEWA9W2fg" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCL7DDQWP6x7wy0O6L5ZIgxg" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UCL7DDQWP6x7wy0O6L5ZIgxg" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCqp1yi_juq5JJuzKY71Hoag" youtube) ("https://www.youtube.com/feeds/videos.xml?channel_id=UCqp1yi_juq5JJuzKY71Hoag" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UC1kBxkk2bcG78YBX7LMl9pQ" youtube)))) ("https://www.youtube.com/feeds/videos.xml?channel_id=UC1kBxkk2bcG78YBX7LMl9pQ" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UChl_NKOs1qqh_x7yJfaDpDw" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCTvH45HvnOzqXvfNJqdc3xg" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCd-qVRcjoK9zjtDs_LRxSmw" youtube)
("https://www.youtube.com/feeds/videos.xml?channel_id=UCsUablJrqdwCh83e55tBWPQ" youtube))))
(provide 'packages) (provide 'packages)

View File

@ -94,6 +94,9 @@
;; Show buffer area ;; Show buffer area
(setq-default indicate-buffer-boundaries 'left) (setq-default indicate-buffer-boundaries 'left)
;; Disable cursor blink
(blink-cursor-mode 0)
;; Auto-indent pasted code. ;; Auto-indent pasted code.
(dolist (command '(yank yank-pop)) (dolist (command '(yank yank-pop))
(eval (eval