Skip to content

artsi0m/emacs-organizer

Repository files navigation

emacs-organizer

Some code should be executing before tangling and evaluating this file. So, look at init.el

general emacs

package management

Add 4 main package archives

(require 'package)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/") t)

Set priorites for package-archives

(setq package-archive-priorities
  '(("gnu" . 40)
    ("nongnu" . 30)
    ("melpa" . 20)))

layout

See layout.org file – link

(use-package reverse-im
:ensure t
:custom
(reverse-im-input-methods '("cyrillic-colemak"))
:config
(reverse-im-mode t)
:pin melpa)

window management

If frame is devided by top and bottom, change it to left and right. Transpose operation like with matrices and tables.

(use-package transpose-frame :ensure t)

Enable tab-bar-mode

(tab-bar-mode)

autocomplete

Press C-M-i to activate emacs autocomplete.

Frankly speaking, I copy this snippet from the official vertico docs:

https://github.com/minad/vertico?tab=readme-ov-file#completion-at-point-and-completion-in-region

This configuration give my ability to perform fuzzy search. Like with dmenu, rofi or fzf, but in emacs.

(use-package vertico
  :init (vertico-mode)
   (setq completion-in-region-function
	      (lambda (&rest args)
		(apply (if vertico-mode
			   #'consult-completion-in-region
			 #'completion--in-region)
		       args)))
   :ensure t)

 (use-package consult :ensure t)

 (use-package consult-eglot :ensure t)

Force UTF-8 and LF line endings

This should be executed before loading this file, so this forms also present in init.el.

(defvar *fs-encoding* 'utf-8)
(prefer-coding-system 'utf-8-unix)

tool-bar

Use C-c C-c in LaTeX buffers instead

(tool-bar-mode -1)

menu-bar

Use ESC-tilde instead

(menu-bar-mode -1)

modus-themes

Enable only in graphical mode.

(use-package modus-themes :ensure t)

(when (display-graphic-p)
  (load-theme 'modus-operandi t)
  (enable-theme 'modus-operandi))

config by use cases

I structured my config by use cases I apply emacs in.

file manager

I use build in dired for now.

Copy, move, rename files across panes, like two-panel file manager

(setq dired-dwim-target t)

git client

(use-package magit :ensure t)

(use-package git-modes :ensure t)

organizer & writer’s tool

(use-package howm :config
  (setq howm-view-use-grep t)
  :ensure t)

Function to add prop-line, so I can use howm with any other major mode, with org-mode for examlpe

	(defun howm-insert-prop-line (mode)
     "Activate major mode and modify the file so that this mode is activated
   automatically the next time it is opened"
     (interactive (list (intern-soft
			  (completing-read "Choose major mode: "
					   (mapcar #'cdr auto-mode-alist)))))
     (howm-mode)
     (unless (or (null mode)
		  (eq mode major-mode))
	(funcall mode)
	(howm-mode)
	(add-file-local-variable-prop-line
	 'mode (intern (string-trim-right (symbol-name mode) "-mode\\'")))))

spelling

(use-package ispell
:defer t
:custom
(ispell-local-dictionary-alist
 '(("russian"
    "[АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯабвгдеёжзийклмнопрстуфхцчшщьыъэюяіў’A-Za-z]"
    "[^АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯабвгдеёжзийклмнопрстуфхцчшщьыъэюяіў’A-Za-z]"
    "[-']"  nil ("-d" "be_BY,ru_RU,en_US") nil utf-8)))
(ispell-program-name "hunspell")
(ispell-dictionary "russian")
(ispell-really-aspell nil)
(ispell-really-hunspell t)
(ispell-encoding8-command t)
(ispell-silently-savep t))

org-mode as better notebook

(org-babel-do-load-languages
 'org-babel-load-languages
 '((C . t)
   (shell . t)
   (lisp . t)
   (emacs-lisp . t)
   (python . t)
   (dot . t)
   (plantuml . t)))

diagrams with plantuml

Installed plantuml from openSUSE package manager.

(setq org-plantuml-exec-mode 'plantuml) 

flascards

Even with all of org-drill bugs I like it much more than Anki -[2024-12-12]

(use-package org-drill
:after howm
:pin melpa
:ensure t)
(defun my-org-drill-file-names-in-howm ()
"Return list of absolute filenames of org-drill files in howm"
(delete-dups
 (mapcar #'car (howm-grep "\:drill\:"
			    (howm-files-in-directory howm-directory)))))
(defun my-org-drill-update-scope ()
  (interactive)
  "Update org-drill scope variable populating it with files from howm"
  (setq org-drill-scope (my-org-drill-file-names-in-howm)))

workarounds

(defun org-drill-time-to-inactive-org-timestamp (time)
"Convert TIME into org-mode timestamp."
(format-time-string
 (concat "[" (cdr org-time-stamp-formats) "]")
 time))

todo list and pomodoro

(use-package pomm :ensure t :pin melpa)
(setq org-todo-keywords
    '((sequence "TODO" "|" "DONE" "FAIL" "NGMI" )))

Work arounds

Use C locale for time on windows for org-pomodoro

(when (eq system-type 'windows-nt)
(setq system-time-locale "C"))

xelatex editor

(use-package auctex :ensure t)

I write my coursework in xelatex.

(setq-default TeX-engine 'xetex)

From auctex info:

(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

code editor

python

(use-package pyvenv :ensure t)
(use-package elpy :ensure t)

common lisp

(use-package slime :ensure t)
(setq inferior-lisp-program "sbcl")

EditorConfig

(use-package editorconfig :ensure t)

assembly and compiler exploration

Compiler explorer

(use-package rmsbolt :ensure t)

Assembly

(use-package nasm-mode :ensure t)

data and config files

Systemd units

(use-package systemd :ensure t)

Comma separated values

(use-package csv :ensure t)

YAML

(use-package yaml-mode :ensure t)

chip design

(use-package verilog-mode :ensure t)
(use-package verilog-ext :ensure t)

terminal

(use-package eat
  :config
  (setq eat-kill-buffer-on-exit t)
  (setq eat-enable-mouse t)
  :ensure t)

rss reader

Elfeed in my config is interconneted with howm.

elfeed use-package:

(use-package elfeed
:ensure t
:config
(setq elfeed-db-directory "~/howm/.elfeed")
  (setq elfeed-curl-program-name "curl"))
(use-package elfeed-protocol) 

elfeed-org use-package

(use-package elfeed-org
  :ensure t
  :config
  (elfeed-org)
  :after howm)

functions for interconnecting with howm

(defun my-elfeed-file-names-in-howm ()
  "Return list of absolute filenames of org-elfeed files in howm"
  (delete-dups
   (mapcar #'car (howm-grep "\:elfeed\:"
		      (howm-files-in-directory howm-directory)))))
  

advices for executing functions

(define-advice elfeed (:before (&rest _args))
  (setq rmh-elfeed-org-files (my-elfeed-file-names-in-howm)))


(define-advice elfeed-update (:before (&rest _args))
  (setq rmh-elfeed-org-files (my-elfeed-file-names-in-howm)))

email client

(setq 
   user-full-name "Корякин Артём"
   user-mail-address "[email protected]"
   send-mail-function 'smtpmail-send-it
   smtpmail-smtp-server "smtp.gmail.com"
   smtpmail-stream-type 'starttls ;; was nil (upgrade with STARTTLS if possible)
   smtpmail-smtp-service 587
   smtpmail-servers-requiring-authorization "*"
   gnus-save-score t
   gnus-startup-file "~/howm/.newsrc"
   gnus-backup-startup-file 'never
   gnus-select-method
   '(nnimap "gmail"
	      (nnimap-address "imap.gmail.com")
	      (nnmail-expiry-target "nnimap+gmail:[Gmail]/Корзина")
	      (nnimap-server-port 993)
	      (nnimap-stream ssl)
	      (gnus-search-engine gnus-search-imap)
	      (nnmail-expiry-wait 5)))

epub reader

(use-package nov :ensure t)