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

layout

I use colemak keyboard layout see layout.org file – link

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 '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/") t)
(package-initialize)

Set priorites for package-archives

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

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

(setq tab-bar-mode t)

Disable scroll-bar

(setq scroll-bar-mode nil)

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

Show both icons and caption

(setq tool-bar-style 'both)

use emacs icons instead of gtk ones

(advice-add #'x-gtk-map-stock :override #'ignore)

y-or-n

(defalias 'yes-or-no #'y-or-n-p)

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

(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 ()
 "Activate major mode and modify the file so that this mode is activated
 automatically the next time it is opened"
     (interactive)
     (howm-mode)
     (let*
	  ((modes (mapcar #'cdr auto-mode-alist))
	   (mode-name (completing-read "Choose major mode: " modes))
	   (mode (intern-soft mode-name)))
	(unless (or (null mode)
	    (eq mode major-mode))
	  (funcall mode)
	  (howm-mode)
	  (add-file-local-variable-prop-line
	   'mode (intern (string-trim-right mode-name "-mode\\'"))))))

flascards

(use-package anki-editor :ensure t)

todo list and pomodoro

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

Work arounds

Use C locale for time on windows

(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)

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

(use-package rmsbolt :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)