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
(setq compile-command "make ")
;; 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
(substring
(shell-command-to-string
(concat "detex " (buffer-file-name) " | wc -w"))
(concat "texcount " (buffer-file-name) " | grep \"^Words in text:\""))
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.
(defalias 'open 'find-file-other-window)
(defalias 'clean 'eshell/clear-scrollback)
@ -248,8 +276,13 @@
;; Better buffer management (smol).
(global-set-key (kbd "C-x C-b") 'bs-show)
;; Inspiration from Nyxt, kill the current buffer.
(global-set-key (kbd "C-x C-k") 'kill-this-buffer)
;; Kill the current buffer and close the window it occupied.
(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)
@ -258,6 +291,8 @@
(global-set-key (kbd "C-S-o") 'open-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
(global-set-key (kbd "M-z") 'zap-up-to-char)

View File

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

10
init.el
View File

@ -1,3 +1,5 @@
;; -*- lexical-binding: t -*-
;; Load essentials.
(load "~/.emacs.d/essential.el")
@ -13,8 +15,8 @@
;; 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
;; evaluate forms.
(when (not (server-running-p))
(server-start))
;; (when (not (server-running-p))
;; (server-start))
;; Tab width.
(setq-default tab-width 4)
@ -23,8 +25,8 @@
;;; Appearance
;; The font is set in fontconfig. Usually it's UW Ttyp0 or Gohufont
(set-frame-font "monospace 12")
(setq default-frame-alist '((font . "monospace 12")))
(set-frame-font "monospace 11")
(setq default-frame-alist '((font . "monospace 11")))
;; Highlight matching parentheses.
(show-paren-mode t)

View File

@ -73,24 +73,39 @@
(use-package racket-mode
:ensure t)
;; Amazing s-expression editing mode.
(use-package lispy
(use-package lua-mode
: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))
(setq-default lua-indent-level 4))
;; Amazing s-expression editing 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
;; undo-tree is mainly used for its redo functionality.
(use-package undo-tree
:ensure t
:bind
("C-_" . 'undo-tree-undo)
("M-_" . 'undo-tree-redo)
:config
(global-undo-tree-mode))
;; (use-package undo-tree
;; :ensure t
;; :bind
;; ("C-_" . 'undo-tree-undo)
;; ("M-_" . 'undo-tree-redo)
;; :config
;; (global-undo-tree-mode))
;; Nice startup screen.
(use-package dashboard
@ -162,7 +177,7 @@
:bind
("C-c o c" . org-capture)
:config
;;; org-capture
;;; org-capture
;; Default location for org-capture is ~/org/notes.org
(setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-capture-templates
@ -207,76 +222,92 @@
(setq god-exempt-predicates nil)
(setq god-mode-enable-function-key-translation nil))
(use-package exwm
(use-package tex
:ensure auctex
:init
(defun fez/exwm-init-hook ()
(exwm-workspace-switch-create 1))
(setq compilation-ask-about-save nil)
(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)
(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)
;; mu4e doesn't have a (m)elpa package, apparently, so it is set up manually here
(require 'mu4e)
;; (use-package exwm
;; :init
;; (defun fez/exwm-init-hook ()
;; (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 ()
"EXWM configuration."
;; Set the initial workspace number.
(unless (get 'exwm-workspace-number 'saved-value)
(setq exwm-workspace-number 4))
;; Make class name the buffer name
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; Global keybindings.
(unless (get 'exwm-input-global-keys 'saved-value)
(setq exwm-input-global-keys
`(
;; 's-r': Reset (to line-mode, fullscreen).
([?\s-r] . exwm-reset)
;; 's-w': Switch workspace.
([?\s-w] . exwm-workspace-switch)
;; 's-&': Launch application.
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; 's-N': Switch to certain workspace.
(\,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9)))
;; 's-a': Toggle X mouse
([?\s-a] . fez/toggle-x-mouse)
;; 's-<space>': Toggle keyboard layouts
([?\s-\ ] . fez/swap-keyboard)
;; 's-l': Toggle line-mode and char-mode for the current window.
([?\s-l] . exwm-input-toggle-keyboard)
;; windmove movement commands
([?\s-u] . windmove-left)
([?\s-i] . windmove-down)
([?\s-o] . windmove-up)
([?\s-p] . windmove-right)))
;; Line-editing shortcuts
(unless (get 'exwm-input-simulation-keys 'saved-value)
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-d] . [delete])
([?\C-k] . [S-end delete]))))
;; Enable windmove keybinds
(winner-mode t)
;; Enable EXWM
(exwm-enable))))
;; (defun exwm-config ()
;; "EXWM configuration."
;; ;; Set the initial workspace number.
;; (unless (get 'exwm-workspace-number 'saved-value)
;; (setq exwm-workspace-number 4))
;; ;; Make class name the buffer name
;; (add-hook 'exwm-update-class-hook
;; (lambda ()
;; (exwm-workspace-rename-buffer exwm-class-name)))
;; ;; Global keybindings.
;; (unless (get 'exwm-input-global-keys 'saved-value)
;; (setq exwm-input-global-keys
;; `(
;; ;; 's-r': Reset (to line-mode, fullscreen).
;; ([?\s-r] . exwm-reset)
;; ;; 's-w': Switch workspace.
;; ([?\s-w] . exwm-workspace-switch)
;; ;; 's-&': Launch application.
;; ([?\s-&] . (lambda (command)
;; (interactive (list (read-shell-command "$ ")))
;; (start-process-shell-command command nil command)))
;; ;; 's-N': Switch to certain workspace.
;; (\,@(mapcar (lambda (i)
;; `(,(kbd (format "s-%d" i)) .
;; (lambda ()
;; (interactive)
;; (exwm-workspace-switch-create ,i))))
;; (number-sequence 0 9)))
;; ;; 's-a': Toggle X mouse
;; ([?\s-a] . fez/toggle-x-mouse)
;; ;; 's-<space>': Toggle keyboard layouts
;; ([?\s-\ ] . fez/swap-keyboard)
;; ;; 's-l': Toggle line-mode and char-mode for the current window.
;; ([?\s-l] . exwm-input-toggle-keyboard)
;; ;; windmove movement commands
;; ([?\s-u] . windmove-left)
;; ([?\s-i] . windmove-down)
;; ([?\s-o] . windmove-up)
;; ([?\s-p] . windmove-right)))
;; ;; Line-editing shortcuts
;; (unless (get 'exwm-input-simulation-keys 'saved-value)
;; (setq exwm-input-simulation-keys
;; '(([?\C-b] . [left])
;; ([?\C-f] . [right])
;; ([?\C-p] . [up])
;; ([?\C-n] . [down])
;; ([?\C-a] . [home])
;; ([?\C-e] . [end])
;; ([?\M-v] . [prior])
;; ([?\C-v] . [next])
;; ([?\C-d] . [delete])
;; ([?\C-k] . [S-end delete]))))
;; ;; Enable windmove keybinds
;; (winner-mode t)
;; ;; Enable EXWM
;; (exwm-enable))))
(use-package elfeed
:ensure t
@ -286,7 +317,7 @@
("https://m455.casa/feed.rss" friend)
("https://itwont.work/atom.xml" 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)
("http://verisimilitudes.net/rss.xml" blog)
("https://stevelosh.com/rss.xml" blog)
@ -305,15 +336,18 @@
("https://git.qorg11.net/kill9.git/rss" blog)
("https://regularflolloping.com/rss.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://xkcd.com/rss.xml" other)
("https://nixers.net/syndication.php?limit=15" other)
("http://lambda-the-ultimate.org/node/feed" other)
("https://esoteric.codes/rss" other)
("https://solar.lowtechmagazine.com/feeds/all-en.atom.xml" news)
("http://n-gate.com/index.rss" news)
("https://suckless.org/atom.xml" news)
("https://www.aftenposten.no/rss/" news)
("https://www.nrk.no/toppsaker.rss" news)
;("https://www.aftenposten.no/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=UCD6VugMZKRhSyzWEWA9W2fg" 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=UCL7DDQWP6x7wy0O6L5ZIgxg" 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)

View File

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