Skip to content

Instantly share code, notes, and snippets.

@markokocic
Created January 9, 2023 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markokocic/62d1dfc5087de4eab865750682b4e7d9 to your computer and use it in GitHub Desktop.
Save markokocic/62d1dfc5087de4eab865750682b4e7d9 to your computer and use it in GitHub Desktop.
;;;; ~/.emacs
;;;; My $HOME is where my .emacs is ;)
;;;; Startut options
(setq inhibit-startup-screen t)
(setq show-paren-mode t)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
;;;; Fix cut and paste under X
(setf x-select-enable-clipboard t)
;;;; Set custom file, but not load it
(setq custom-file "~/.emacs.d/custom-init.el")
;; (load custom-file 'noerror)
;;;; Coding system settings
(set-language-environment 'utf-8)
(set-default-coding-systems 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)
(setq system-time-locale "C")
;;;; input-method
(setq default-input-method "cyrillic-serbian")
;;;; garbage-collector
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
(let ((ff "Courier New"))
(when (member ff (font-family-list))
;; (print ff)
(set-face-attribute 'default nil :family ff :height 100)))
(when (fboundp 'set-fontset-font)
(set-fontset-font
t 'symbol
(cond
((member "Segoe UI Symbol" (font-family-list)) "Segoo UI Symbol")))
(set-fontset-font
t
'(#x1f300 . #x1fad0)
(cond
((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji")
((member "NotoEmoji NF" (font-family-list)) "NotoEmoji NF"))))
;;;; Indentation options
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
;;;; Add ~/.emacs.d to load-path
(add-to-list 'load-path "~/emacs/elisp")
;;;; Configure shell/comint mode
(ansi-color-for-comint-mode-on)
(setq comint-prompt-read-only t)
;;;; Use ido mode for C-x b
(setq ido-everywhere t)
(setq ido-enable-flex-matching t)
;;(setq ido-enable-prefix nil)
(setq ido-create-new-buffer 'always)
(setq completion-ignore-case t)
;; (setq ido-enable-regexp nil)
(ido-mode t)
;;;; Bind undo to C-z
(global-set-key "\C-z" 'undo)
;;;;
;;;; Configure package manager
;;;;
(setq package-archives
'(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")
("non-gnu" . "https://elpa.nongnu.org/nongnu/")))
(require 'package)
(setq package-enable-at-startup nil)
(package-initialize)
;; use-package install
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(defun mk/ignore-builtin (pkg)
(assq-delete-all pkg package--builtins)
(assq-delete-all pkg package--builtin-versions))
(use-package diminish :ensure t :defer t)
;;;;
;;;; Choose color theme
;;;;
(use-package modus-themes :ensure t
:init
(setq modus-themes-headings '((t . (regular))))
:config
(if (display-graphic-p)
(load-theme 'modus-operandi :no-confirm)
(load-theme 'modus-vivendi :no-confirm)))
;;;;
;;;; org
;;;;
(setq mk/org-dir
(if (string= (system-name) "TSSSTRL380V8D3") "s:/org/" "~/sync/org/"))
(defun mk/org-file (name)
(concat mk/org-dir name ".org"))
(mk/ignore-builtin 'org)
(use-package org
:pin gnu
:ensure t :defer t
:mode (("\\.org$" . org-mode))
:config
(add-to-list 'org-modules 'org-tempo)
(add-to-list 'org-modules 'org-habit)
(add-hook 'org-mode-hook 'visual-line-mode)
(set-face-attribute 'org-block nil :inherit 'default)
(set-face-attribute 'org-block-begin-line nil :inherit 'default)
(set-face-attribute 'org-table nil :inherit 'default)
(set-face-attribute 'org-verbatim nil :inherit 'default)
(setq org-plantuml-jar-path
(expand-file-name "~/scoop/apps/plantuml/current/plantuml.jar"))
(add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
(org-babel-do-load-languages
'org-babel-load-languages
'((plantuml . t)
(C . t)))
:custom
(org-pretty-entities t)
(org-hide-emphasis-markers t)
(org-log-into-drawer t)
(org-archive-location (concat (mk/org-file "archive") "::* From %s"))
(org-todo-keywords '("TODO(t)" "NEXT(n)" "STARTED(s)" "WAIT(w)" "|" "DONE(d)"))
(org-agenda-files
(mapcar
'mk/org-file
'("index" "reminders" "termine" "notes" "habits"
"projects" "reading" "tss" "finance")))
(org-capture-templates
`(("t" "TODO Reminder" entry
(file ,(mk/org-file "reminders"))
"* TODO %i%?")
("n" "Note" entry
(file ,(mk/org-file "notes"))
"* %i%?")))
(org-refile-targets '((org-agenda-files :maxlevel . 2)))
(org-refile-use-outline-path 'file)
(org-refile-allow-creating-parent-nodes 'confirm)
(org-agenda-sorting-strategy
'((agenda habit-down time-up todo-state-down priority-down category-keep)
(todo priority-down category-keep)
(tags priority-down category-keep)
(search category-keep)))
:bind (("C-c c" . org-capture)
("C-c a" . org-agenda)))
(use-package org-roam
:ensure t :defer t
:custom
(org-roam-directory (file-truename (concat mk/org-dir "roam")))
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "${slug}.org" "#+setupfile: ../setup.org\n#+title: ${title}\n")
:unnarrowed t)))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today))
:config
;; If you're using a vertical completion framework,
;; you might want a more informative completion interface
;; (setq org-roam-node-display-template
;; (concat "${title:*} "
;; (propertize "${tags:10}" 'face 'org-tag)
(org-roam-db-autosync-mode)
;; If using org-roam-protocol
(require 'org-roam-protocol))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment