{"id":13894578,"url":"https://github.com/anuvyklack/emacs","last_synced_at":"2026-01-26T21:53:00.994Z","repository":{"id":107001124,"uuid":"292080308","full_name":"anuvyklack/emacs","owner":"anuvyklack","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-01T18:58:50.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T16:42:56.031Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anuvyklack.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-01T18:45:37.000Z","updated_at":"2022-01-06T08:57:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"38d4de9c-27a3-4ae1-a656-14e5d094b1d0","html_url":"https://github.com/anuvyklack/emacs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuvyklack%2Femacs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuvyklack%2Femacs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuvyklack%2Femacs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuvyklack%2Femacs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anuvyklack","download_url":"https://codeload.github.com/anuvyklack/emacs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247124989,"owners_count":20887606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:01:38.523Z","updated_at":"2026-01-26T21:53:00.971Z","avatar_url":"https://github.com/anuvyklack.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# -*- evil-shift-width: 2; fill-column: 80; comment-column: 75; -*-\n#+title: Emacs configuration with Org Mode\n#+author: Yuriy Artemyev\n#+email: anuvyklack@gmail.com\n#+startup: content\n#+property: header-args :tangle \"./init.el\" :results silent\n#                       :tangle (identity user-init-file)\n \n* =init.el= preamble\nGood Emacs Lisp file starts with such commentary:\n\n#+begin_src emacs-lisp\n;;; init.el --- Emacs main configuration file -*- lexical-binding: t; buffer-read-only: t; no-byte-compile: t -*-\n;;;\n;;; Commentary:\n;;; Emacs config by Yuriy Artemyev.\n;;; This file was automatically generated by `org-babel-tangle'.\n;;; Do not change this file.  Main config is located in .config/emacs/README.org\n;;;\n;;; Code:\n#+end_src\n\n* =early-init.el=\n:properties:\n:header-args+: :tangle \"./early-init.el\"\n:end:\nThese settings are going into different init file: =earli-init.el=.\nWe are going to use some speedup tricks from [[https://github.com/hlissner/doom-emacs][doom-emacs]] here.\n** Preamble\n\n#+begin_src emacs-lisp\n;;; early-init.el --- early configurations -*- lexical-binding: t; buffer-read-only: t; no-byte-compile: t -*-\n;;;\n;;; Commentary:\n;;; Emacs confi by Andrey Orst.\n;;; This file was automatically generated by `org-babel-tangle'.\n;;; Do not change this file.  Main config is located in .config/emacs/README.org\n;;;\n;;; Code:\n#+end_src\n\n** COMMENT Garbage Collection\nThe main problem  with Emacs startup is garbage  collection system. It\nis invoked so many times on startup that it causes quite big impact on\nstartup time.   We're talking  /seconds/.  One can  raise limit  when to\ntrigger garbage collection, but this will end up in unpleasant editing\nexperience. So I'm  declaring these variables to  store default values\nfor the GC, to restore them after initialization is finished:\n\n#+begin_src emacs-lisp\n(defvar aorst--gc-cons-threshold gc-cons-threshold)\n(defvar aorst--gc-cons-percentage gc-cons-percentage)\n(defvar aorst--file-name-handler-alist file-name-handler-alist)\n#+end_src\n\nNow we can tweak CG. We need to raise threshold to prevent it running:\n\n#+begin_src emacs-lisp\n(setq-default gc-cons-threshold 402653184\n            gc-cons-percentage 0.6\n            inhibit-compacting-font-caches t\n            message-log-max 16384\n            file-name-handler-alist nil)\n#+End_src\n\nThen we need  a hook that restores initial  values once initialization\ndone:\n\n#+begin_src emacs-lisp\n(add-hook 'after-init-hook\n        (lambda ()\n          (setq gc-cons-threshold aorst--gc-cons-threshold\n                gc-cons-percentage aorst--gc-cons-percentage\n                file-name-handler-alist aorst--file-name-handler-alist)))\n#+end_src\n\n** Native Compiled Emacs Lisp\nThere's a very interesting project that I'm currently using, called [[http://akrl.sdf.org/gccemacs.html][gccemacs]].\nIt provides a way to compile Emacs Lisp into native code, thus making Emacs\nmuch more robust and snappy. In order to compile everything that Emacs loads\nasynchronously we can set this variable to =true=.\n\n#+begin_src emacs-lisp\n(defvar comp-deferred-compilation)\n(setq comp-deferred-compilation t)\n#+end_src\n\nThis way I can compile Emacs from source as I usually do, and then continue\nusing it as normal, and Emacs will do it's native compilation in background\nfor every loaded package. That's amazing!\n\n** =straight.el= and =use-package=\nStraight is an alternative way  to manage package installations. It is\na purely  functional package  manager. It  installs packages  from Git\nrepositories listed on ELPA and MELPA, or from Git URL.\n\n=Straight.el= settings:\n\n#+begin_src emacs-lisp\n  (custom-set-variables\n   '(straight-repository-branch \"develop\")\n   '(straight-check-for-modifications '(check-on-save find-when-checking))\n   '(straight-vc-git-default-clone-depth 1)\n   ;; '(straight-use-package-by-default t) \n  )\n#+end_src\n\nBootstrap =Straight.el=:\n\n#+begin_src emacs-lisp\n(defvar bootstrap-version)\n(defvar straight-repository-branch)\n(setq straight-repository-branch \"develop\")\n(let ((bootstrap-file\n       (expand-file-name \"straight/repos/straight.el/bootstrap.el\" user-emacs-directory))\n      (bootstrap-version 5))\n  (unless (file-exists-p bootstrap-file)\n    (with-current-buffer\n        (url-retrieve-synchronously\n         \"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el\"\n         'silent 'inhibit-cookies)\n      (goto-char (point-max))\n      (eval-print-last-sexp)))\n  (load bootstrap-file nil 'nomessage))\n#+end_src\n\nNow we can install =use-package= with it:\n\n#+begin_src emacs-lisp\n  (straight-use-package 'use-package)\n#+end_src\n\n#+begin_src emacs-lisp\n  ;; (setq use-package-always-defer t\n  ;;       ;; use-package-minimum-reported-time .001\n  ;;       ;; use-package-verbose t\n  ;;       ;; use-package-compute-statistics t\n  ;; )\n#+end_src\n\n** Garbage Collector Magic Hack\n[[https://gitlab.com/koral/gcmh][Source]]\n\n#+begin_src emacs-lisp\n  (use-package gcmh\n    :straight t \n    :init\n    (gcmh-mode 1))\n#+end_src\n\n** COMMENT User Interface AORST\nPrevent the glimpse of un-styled  Emacs by disabling these UI elements\nearly.\n\n#+begin_src emacs-lisp\n(setq initial-frame-alist '((width . 170)\n                            (height . 56)\n                            (tool-bar-lines . 0)\n                            (left-fringe . 0)\n                            (right-fringe . 0)\n                            (bottom-divider-width . 0)\n                            (right-divider-width . 1))\n      default-frame-alist initial-frame-alist)\n#+end_src\n\nResizing frame is also expensive so we inhibit it, and latest patch to\nEmacs  introduced =x-gtk-resize-child-frames=  variable  that fixes  the\nissue  with  child frames  not  being  resized correctly  under  GNOME\nShell, so let's set it to =resize-mode=.\n\n#+begin_src emacs-lisp\n(setq frame-inhibit-implied-resize t\n    x-gtk-resize-child-frames 'resize-mode)\n#+end_src\n\n** COMMENT Visual settings old\n\nArbitrary frame size and position.\nUseful functions:\n - set-frame-height\n - set-frame-width\n - set-frame-size\n - set-frame-position\n\n#+begin_src emacs-lisp\n(when window-system\n  (set-frame-size (selected-frame) 120 35)\n  (set-frame-position (selected-frame) 100 70))\n\n(setq scroll-preserve-screen-position nil)\n\n;; ;; Set size parameters of ‘initial-frame-alist’ or\n;; ;; ‘default-frame-alist’. E.g.,\n;; (add-to-list 'default-frame-alist '(height . 24))\n;; (add-to-list 'default-frame-alist '(width . 80))\n\n;; (set-frame-font \"Liga Inconsolata LGC NF-10.6\")\n;; (set-frame-font \"Liga Inconsolata LGC NF OT-10.5\")\n\n;; (set-frame-font \"PragmataPro-11.5\")\n(set-frame-font \"PragmataPro Mono-11.7:antialias=subpixel\")\n;; (set-frame-font \"PragmataPro Mono-11.7:antialias=natural\")\n;; (set-frame-font \"Pragmata Pro Mono-11.7:antialias=natural\")\n\n;; (set-frame-font \"Symbola-11.7\")\n\n ;; set-fontset-font\n;; (set-frame-font \"Victor Mono-10.7\")\n;; (set-frame-font \"Operator Mono-11.5\")\n;; (set-frame-font \"Input-11.5\")\n;; (set-frame-font \"Fira Code-10.7\")\n\n(setq-default frame-background-mode 'dark)\n\n(setq frame-resize-pixelwise t)\n\n;; ;; Fullscreen by default, as early as possible.\n;; (add-to-list 'default-frame-alist '(fullscreen . maximized))\n\n;; Disable otiose GUI settings: they just waste space.\n;; fringe-mode is especially ruinous performance-wise.\n(when (window-system)\n  (tool-bar-mode -1)\n  (menu-bar-mode -1)\n  (scroll-bar-mode -1)\n  (tooltip-mode -1)\n  ;; (fringe-mode 10)  ;; Margin from the frame in pixels\n  (fringe-mode -1)  ;; Margin from the frame in pixels\n  (blink-cursor-mode -1)\n)\n\n;; (global-linum-mode t)  ;; show line numbers\n\n;; (global-hl-line-mode) ;; highlight the line with cursor\n\n;; Say to Emacs that it should split frame vertically rather than\n;; horizontally when Emacs has the choice (eg when bringing up help).\n(setq split-height-threshold nil)\n;; How many columns emacs should have in a frame to split a window\n;; vertically but not horizontally.\n(setq split-width-threshold 150)\n\n(add-to-list 'display-buffer-alist\n  ;; '(\"*Help*\" display-buffer-same-window)\n  ;; Open *Help* buffers into vertical split on the left\n  '(\"*Help\"\n   (display-buffer-reuse-window display-buffer-in-side-window)\n   (side . left)\n   (slot . 1)\n   (window-width . 0.5)\n   (reusable-frames . nil))\n)\n#+end_src\n\n** Early =package.el= settings\n=package.el= initialization is expensive so we disable it at startup:\n\n#+begin_src emacs-lisp\n(setq package-enable-at-startup nil)\n#+end_src\n\n** ~(provide 'early-init)~\nThis concludes the =early-init.el= file.\n\n#+begin_src emacs-lisp\n(provide 'early-init)\n;;; early-init.el ends here\n#+end_src\n\n** COMMENT Loading =early-init.el= in Emacs 26 and earlier\n:properties:\n:header-args+: :tangle \"./init.el\"\n:end:\nBefore Emacs  27 there were  no such thing  as =eraly-init.el=, so  if I\nwill use  older Emacs  with this configuration  it will  miss settings\nthat are done there. This code manually loads this file in such case:\n\n#+begin_src emacs-lisp\n  (unless (featurep 'early-init)\n    (message \"not early-init\")\n    (load (expand-file-name \"early-init\" user-emacs-directory)))\n#+end_src\n\n* Variables\n\n#+begin_src emacs-lisp\n(setq init-file (expand-file-name \"init.el\" user-emacs-directory)\n      config-org-file (expand-file-name \"README.org\" user-emacs-directory))\n#+end_src\n\n* User Interface\n\nArbitrary frame size and position. Use functions `set-frame-height`,\n`set-frame-width`, `set-frame-size`, and `set-frame-position`.\n\n#+begin_src emacs-lisp\n(when window-system\n  ;; (set-frame-size (selected-frame) 92 35)\n  (set-frame-size (selected-frame) 145 53)\n  (set-frame-position (selected-frame) 500 70)\n)\n\n;; ;; Set size parameters of ‘initial-frame-alist’ or\n;; ;; ‘default-frame-alist’. E.g.,\n;; (add-to-list 'default-frame-alist '(height . 24))\n;; (add-to-list 'default-frame-alist '(width . 80))\n\n;; Iosevka is my font of choice, but don't freak out if it's present.\n;; (ignore-errors (set-frame-font \"Iosevka-13\"))\n(set-frame-font \"Liga Inconsolata LGC NF OT-12.0\")\n;; (set-frame-font \"PragmataPro-10.5\")\n\n;; (setq-default frame-background-mode 'dark)\n;; \n;; (setq frame-resize-pixelwise t)\n;; \n;; ;; ;; Fullscreen by default, as early as possible.\n;; ;; (add-to-list 'default-frame-alist '(fullscreen . maximized))\n;; \n;; ;; Disable otiose GUI settings: they just waste space.\n;; ;; fringe-mode is especially ruinous performance-wise.\n;; (when (window-system)\n;;   (tool-bar-mode -1)\n;;   (menu-bar-mode -1)\n;;   (scroll-bar-mode -1)\n;;   (tooltip-mode -1)\n;;   ;; (fringe-mode 10)  ;; Margin from the frame in pixels\n;;   (fringe-mode -1)  ;; Margin from the frame in pixels\n;;   (blink-cursor-mode -1)\n;; )\n;; \n;; ;; (global-linum-mode t)  ;; show line numbers\n;; \n;; ;; (global-hl-line-mode) ;; highlight the line with cursor\n;; \n;; ;; Say to Emacs that it should split frame vertically rather than\n;; ;; horizontally when Emacs has the choice (eg when bringing up help).\n;; (setq split-height-threshold nil)\n;; ;; How many columns emacs should have in a frame to split a window\n;; ;; vertically but not horizontally.\n;; (setq split-width-threshold 150)\n;; \n;; (add-to-list 'display-buffer-alist\n;;   ;; '(\"*Help*\" display-buffer-same-window)\n;;   ;; Open *Help* buffers into vertical split on the left\n;;   '(\"*Help\"\n;;    (display-buffer-reuse-window display-buffer-in-side-window)\n;;    (side . left)\n;;    (slot . 1)\n;;    (window-width . 0.5)\n;;    (reusable-frames . nil))\n;; )\n#+end_src\n\n* Customize\nStore customize settgins in separate file.\n\n#+begin_src emacs-lisp\n(setq custom-file (expand-file-name \"custom.el\" user-emacs-directory))\n(when (file-exists-p custom-file) (load custom-file))\n#+end_src\n\n* General settings\n\nBetter-defaults:\n#+begin_src emacs-lisp\n  (use-package better-defaults\n    :straight t)\n#+end_src\n\n#+begin_src emacs-lisp\n  (setq-default indent-tabs-mode nil   ; no tab characters in files\n                tab-width 4\n                comment-empty-lines t  ; comment empty lines\n                ;; При обращении к файлу уже открытому в буфере Emacs-а\n                ;; по другому имени (по символической или жёсткой\n                ;; ссылке), Emacs откроет уже существующий буфер, а не\n                ;; создасть новый.\n                find-file-existing-other-name t\n                ;; delete-indentation t\n  )\n#+end_src\n\n* Libraries\n** emacs-async\n[[https://github.com/jwiegley/emacs-async][Source]]\n=async.el= is a module for doing asynchronous processing in Emacs.\n\n#+begin_src emacs-lisp\n  (use-package async\n    :straight t)\n#+end_src\n\n* Color themes\n** Doom-themes\n\n#+begin_src emacs-lisp\n  (use-package doom-themes\n    :straight t\n    :config\n    ;; Global settings (defaults)\n    (setq\n      doom-themes-enable-bold nil  ; if nil, bold is universally disabled\n      doom-themes-enable-italic t) ; if nil, italics is universally disabled\n    (load-theme 'doom-one t)\n    ;; (load-theme 'doom-gruvbox t)\n    ;; (load-theme 'doom-material t)\n    ;; (load-theme 'doom-peacoc t)\n    ;; (load-theme 'doom-nova t)\n  )\n#+end_src\n\n** COMMENT Tron\n\n#+begin_src emacs-lisp\n  (use-package tron-legacy-theme\n    :straight t\n    :config\n      (setq tron-legacy-theme-vivid-cursor t)\n      (setq tron-legacy-theme-softer-bg t)\n      (load-theme 'tron-legacy t)\n  )\n#+end_src\n\nChange comment color:\n\n#+begin_src emacs-lisp\n(custom-theme-set-faces\n  'tron-legacy\n  '(font-lock-comment-face ((t (:foreground \"#758b9c\" :slant normal))))\n  ;; '(font-lock-comment-face ((t (:foreground \"#758b9c\" :slant italic))))\n  ;; '(font-lock-comment-face ((t (:foreground \"#6a8193\" :slant italic))))\n)\n#+end_src\n\n** COMMENT Afternoon\n\n#+begin_src emacs-lisp\n  (use-package afternoon-theme\n    :straight (:depth 1)\n    :config\n    (load-theme 'afternoon t)\n  )\n#+end_src\n\n** COMMENT Elemental-theme\n\n#+begin_src emacs-lisp\n  (use-package elemental-theme\n    :straight (:host github :repo \"zk-phi/elemental-theme\"))\n#+end_src\n\n** COMMENT Gruvbox\n\n#+begin_src emacs-lisp\n  (use-package gruvbox-theme\n    :straight t\n    :config\n    ;; (load-theme 'gruvbox t)\n    ;; (load-theme 'gruvbox-dark-soft t)\n    (load-theme 'gruvbox-dark-hard t)\n  )\n#+end_src\n\n** COMMENT One Dark\n\n#+begin_src emacs-lisp\n  (use-package atom-one-dark-theme\n    :straight t\n    :config\n    (load-theme 'atom-one-dark t))\n#+end_src\n\nChange comment color:\n\n#+begin_src emacs-lisp\n(custom-theme-set-faces\n  'atom-one-dark\n  '(font-lock-comment-face ((t (:foreground \"#758b9c\" :slant normal))))\n  ;; '(font-lock-comment-face ((t (:foreground \"#758b9c\" :slant italic))))\n  ;; '(font-lock-comment-face ((t (:foreground \"#6a8193\" :slant italic))))\n)\n#+end_src\n\n** COMMENT Zerodark\n\n#+begin_src emacs-lisp\n  (use-package zerodark-theme\n    :straight t\n    :config\n    (load-theme 'zerodark t)\n    ;; Optionally setup the modeline\n    (zerodark-setup-modeline-format)\n  )\n#+end_src\n\n** COMMENT Srcery\n\n#+begin_src emacs-lisp\n  (use-package srcery-theme\n    :straight t\n    :config\n    (load-theme 'srcery t)\n  )\n#+end_src\n\n** COMMENT Nord\n\n#+begin_src emacs-lisp\n  (use-package nord-theme\n    :straight t\n    :config\n    (load-theme 'nord t)\n  )\n#+end_src\n\n* Filetypes (Major-modes)\n** Emacs-lisp\nMy emacs lisp mode settings.\n\n#+begin_src emacs-lisp\n(add-hook 'emacs-lisp-mode-hook\n          (lambda ()\n            (setq lisp-indent-offset 2\n                  evil-shift-width lisp-indent-offset)\n          )\n)\n#+end_src\n\n** COMMENT Python\n\n#+begin_src emacs-lisp\n(add-hook 'python-mode-hook\n          (lambda ()\n            ;; (setq python-indent-offset 4)\n            (setq indent-tabs-mode nil\n                  tab-width 4  ;; how many spaces show in TAB character\n                  tab-stop-list 4\n                  evil-shift-width 4)\n          )\n)\n#+end_src\n\n** COMMENT Text-mode\n[[https://stackoverflow.com/questions/69934/set-4-space-indent-in-emacs-in-text-mode][Source]]\n\n#+begin_src emacs-lisp\n  (add-hook 'text-mode-hook\n            (lambda ()\n              (abbrev-mode 1)\n              (auto-fill-mode 1)\n              (setq tab-stop-list (number-sequence 4 200 4))))\n#+end_src\n\n* Evil\n** Evil itself\n\n #+begin_src emacs-lisp\n   (use-package evil\n     :straight (:depth 1)\n     :init ;; tweak evil's configuration before loading it\n     (setq evil-search-module 'evil-search)\n     (setq evil-ex-complete-emacs-commands nil)\n     (setq evil-vsplit-window-right t)\n     (setq evil-split-window-below t)\n     (setq evil-shift-round nil)\n     (setq evil-want-C-u-scroll t)\n     (setq evil-want-keybinding nil)\n     ;; (setq evil-want-integration nil)\n     :config ;; tweak evil after loading it\n     (evil-mode 1)\n\n     ;; example how to map a command in normal mode (called 'normal state' in evil)\n     (define-key evil-normal-state-map (kbd \", w\") 'evil-window-vsplit)\n   )\n #+end_src\n\n** evil-collection\n\n#+begin_src emacs-lisp\n  (use-package evil-collection\n    :straight (:depth 1)\n    :after evil\n    ;; :straight (drag-stuff :type git :host github :repo \"rejeep/drag-stuff.el\"\n    ;;                     :fork (:host github\n    ;;                            :repo \"your-name/el-patch\")))\n    :config\n    (evil-collection-init))\n#+end_src\n\n** evil-commentary\n\nUse =gc{motion}= to comment target or =gcc= to comment line.\n\n#+begin_src emacs-lisp\n  (use-package evil-commentary\n    :straight (:depth 1)\n    :after evil\n    :config\n    (evil-commentary-mode)\n  )\n#+end_src\n\n** evil-org-mode\n\n#+begin_src emacs-lisp\n  (use-package evil-org\n    :straight (:depth 1)\n    :after org\n    :config\n    (add-hook 'org-mode-hook 'evil-org-mode)\n    (add-hook 'evil-org-mode-hook\n              (lambda () (evil-org-set-key-theme)))\n    (require 'evil-org-agenda)\n    (evil-org-agenda-set-keys)\n    ;; (setq org-special-ctrl-a/e t)\n\n    (with-eval-after-load 'evil-maps\n      ;; (define-key evil-motion-state-map (kbd \"SPC\") nil)\n      (define-key evil-motion-state-map (kbd \"RET\") nil)  ; отменить привязку клавиши Enter в evil-mode.\n      ;; (define-key evil-motion-state-map (kbd \"TAB\") nil)\n    )\n  )\n#+end_src\n\n** Surround\n\n#+begin_src emacs-lisp\n  (use-package evil-surround\n    :straight t\n    :after evil\n    :config\n    (global-evil-surround-mode 1))\n#+end_src\n\n* Plugins\n** Org-mode\n*** Org-mode as major mode settings\n\nEmacs settings which will be enabled only when org-mode will be set as a buffer\nmajor mode:\n\n#+begin_src emacs-lisp\n  (add-hook 'org-mode-hook\n            (lambda ()\n              (setq fill-column 80)  ;; set textwidth to 80\n\n              ;; Включить автоматический пренос строк (auto fill mode).\n              ;; When enabled `auto-fill-function` variable is not nil.\n              ;; The same as: (auto-fill-mode 1).\n              (turn-on-auto-fill)\n            )\n  )\n#+end_src\n\n*** Org-mode settings for it self\nSource code block indentation / editing / syntax highlighting:\nUse ~:custom~ instead of ~setq~ in ~:config~, since the former doesn't require\npackage.\n\n#+begin_src emacs-lisp\n  (use-package org\n    :straight (:type built-in)\n    ;; :init\n    :custom\n      ;; ------------------- Appearance (Внешний вид) -------------------------\n      ;; Turn on ‘org-indent-mode’ on startup, which softly indent text\n      ;; according to outline structure.\n      (org-startup-indented t)\n\n      ;; See also \"org-indent.el\" which does level-dependent indentation in a\n      ;; virtual way, i.e. at display time in Emacs.\n      (org-adapt-indentation nil)\n      ;; WARNING: Seams it doesn't work with ‘org-startup-indented’.\n      (org-odd-levels-only t)\n\n      ;; Скрывать символы разметки такие как '*..*' чтобы отображать текст\n      ;; жирным, или '~..~' для кода и т.д.\n      (org-hide-emphasis-markers nil)\n\n      (org-tags-column -75)  ;; Прижимать тэги с 75 колонке справа.\n\n      ;; The maximum level for Imenu access to Org headlines.\n      (org-imenu-depth 20)\n\n      ;; Show inline images by default in org-mode\n      (org-startup-with-inline-images t)\n      (org-image-actual-width '(400))\n\n      ;; ;; Строка, которая будет использована для обозначения свёрнугото блока\n      ;; ;; текста. По умолчанию -- три точки.\n      ;; (org-ellipsis \"↴\") ;; ↴, ▼, ▶, ⤵\n      ;; ----------------------------------------------------------------------\n\n      ;; --------------------- Source code blocks ----------------------------\n      (org-src-fontify-natively t) ;; Fontify code in code blocks.\n\n      ;; Edit src block buffer to the right of the current window, keeping all\n      ;; other windows.\n      (org-src-window-setup 'split-window-right)\n      ;; (org-src-window-setup 'current-window)  ;; edit in current window\n\n      ;; WARNING: It seems that this variable has been removed in current\n      ;; versions of org-mode.\n      ;; If non-nil, blank lines are removed when exiting the code edit buffer.\n      (org-src-strip-leading-and-trailing-blank-lines t)\n\n      ;; Put two spaces additional to indentation at the beginning\n      ;; of the line in source blocks.\n      (org-edit-src-content-indentation 2)\n      (org-src-preserve-indentation nil)\n\n      ;; If non-nil, the effect of TAB in a code block is as if it were\n      ;; issued in the language major mode buffer.\n      (org-src-tab-acts-natively t)\n      ;; ----------------------------------------------------------------------\n\n      ;; ---------------------------- Links -----------------------------------\n      ;; Enter откроет сслыку при условии, что курсор находится на ней.\n      ;; Follow org links by press Enter with point on it.\n      (org-return-follows-link t) \n\n      ;; ;; Follow org links by press Tab with point on it.\n      ;; (org-tab-follows-link t) \n      ;; ----------------------------------------------------------------------\n\n    :config\n    ;; Languages which can be evaluated in Org buffers.\n    (org-babel-do-load-languages 'org-babel-load-languages '((python . t)\n                                                             (emacs-lisp . t)\n                                                             (shell . t)))\n    :hook\n    ;; (org-mode . prettify-symbols-mode)\n    ;; (org-mode . (lambda () (setq prettify-symbols-alist\n    ;;                              '((\"[ ]\" . \"☐\")\n    ;;                                (\"[X]\" . \"☑\") ;; ✔\n    ;;                                (\"[-]\" . \"◿\"))))) ;; ◪, ⬔\n    (org-babel-after-execute . org-redisplay-inline-images)\n\n  )\n#+end_src\n\nOrg 9.2 introduced a new template expansion mechanism, combining\n~org-insert-structure-template~ bound to =C-c C-,=.  The previous\n~easy-templates~ mechanism (=\u003cs Tab=) should be enabled manualy:\n\n#+begin_src emacs-lisp\n  (use-package org-tempo\n    :straight (:type built-in)\n    :after org\n    :config\n    ;; Type `\u003cel Tab` to insert emacs-lisp source code block.\n    ;; And type `\u003csh Tab` to insert bash source block.\n    (add-to-list 'org-structure-template-alist '(\"el\" . \"src emacs-lisp\"))\n    (add-to-list 'org-structure-template-alist '(\"sh\" . \"src sh\"))\n  )\n#+end_src\n \n*** Org Superstar (Org Bullets)\n[[https://github.com/integral-dw/org-superstar-mode][Source]]\n#+begin_src emacs-lisp\n  (use-package org-superstar\n    :straight t\n    :hook (org-mode . org-superstar-mode)\n    ;; :custom\n    ;; (org-bullets-bullet-list '(\"⁖\"))\n  )\n#+end_src\n\n** COMMENT Sublimity\n\n#+begin_src emacs-lisp\n  (use-package sublimity\n    :straight t\n    ;; :custom\n    ;;   (sublimity-scroll-weight 10)\n    ;;   (sublimity-scroll-drift-length 5)\n    :config \n      (require 'sublimity)\n      (require 'sublimity-scroll)\n      ;; (require 'sublimity-map)\n      ;; (require 'sublimity-attractive)\n      ;; (sublimity-map-set-delay 3)\n      (sublimity-mode 1)\n  )\n  ;; (sublimity-mode 1)\n#+end_src\n\n** COMMENT Visual tweaks\n\nRainbow delimiters:\n\n#+begin_src emacs-lisp\n  (use-package rainbow-delimiters\n    :straight (:depth 1)\n    :init\n    (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)\n    (add-hook 'org-mode-hook #'rainbow-delimiters-mode)\n  )\n#+end_src\n\nDisplay ugly ^L page breaks as tidy horizontal lines.\n\n#+begin_src emacs-lisp\n  (use-package page-break-lines\n    :straight (:depth 1)\n    ;; :init\n    :config\n    (global-page-break-lines-mode)\n    ;; (page-break-lines-modes)\n  )\n#+end_src\n\n#+begin_src emacs-lisp\n  (use-package all-the-icons\n    :straight (:depth 1))\n#+end_src\n** COMMENT ob-async\n[[https://github.com/astahlman/ob-async][Source]]\nEnables asynchronous execution of org-babel src blocks.\n\n#+begin_src emacs-lisp\n  (use-package ob-async\n    :straight t)\n#+end_src\n\n* COMMENT Retangle =init.el= file if source is changed\n\nThe modification time of the =init.el= file.\n\n#+begin_src emacs-lisp\n(file-attribute-modification-time (file-attributes init-file))\n#+end_src\n\nCheck if one file is newer then another.\n\n#+begin_src emacs-lisp\n(file-newer-than-file-p config-org-file init-file)\n(org-babel-tangle-file config-org-file)\n(add-hook 'kill-emacs-hook 'my/config-update)\n#+end_src\n\n#+begin_src emacs-lisp\n(progn\n  (require 'ob-tangle)\n  (message \"Tangling %s → %s.\" config-org-file init-file)\n)\n#+end_src\n\n* Asynchronous tangle emacs config on save\n\nAsynchronous tangle, using =emacs-async=, an org file with emacs settings.\nClosely inspired by [[https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles][this example]]\n\nTODO: работает, но не показывает рузультат!\n\n#+begin_src emacs-lisp\n(with-eval-after-load 'org\n  (defvar my/show-async-tangle-results nil\n    \"Keep *emacs* async buffers around for later inspection.\")\n\n  (defvar my/show-async-tangle-time nil\n    \"Show the time spent tangling the file.\")\n\n  (defun my/config-tangle ()\n    \"Tangles the org file asynchronously.\"\n    ;; (when (file-newer-than-file-p config-org-file init-file))\n      (my/async-babel-tangle config-org-file))\n\n  (defun my/async-babel-tangle (org-file)\n    \"Tangles the org file asynchronously.\"\n    (let ((init-tangle-start-time (current-time))\n          (file (buffer-file-name))\n          (async-quiet-switch \"-q\"))\n      (async-start\n        `(lambda ()\n           (require 'org)\n           (org-babel-tangle-file ,org-file))\n        ;; (unless *show-async-tangle-results*\n        ;;   `(lambda (result)\n        ;;      (if result\n        ;;          (message \"SUCCESS: %s successfully tangled (%.2fs).\"\n        ;;                   ,org-file\n        ;;                   (float-time (time-subtract (current-time)\n        ;;                                              ',init-tangle-start-time)))\n        ;;        (message \"ERROR: %s as tangle failed.\" ,org-file))))\n      )\n    )\n  )\n)\n\n;; (add-to-list\n;;   'safe-local-variable-values\n;;   '(eval add-hook 'after-save-hook #'my/async-babel-tangle 'append 'local))\n\n(add-hook 'after-save-hook #'my/config-tangle)\n#+end_src\n\n* ~(provide 'init.el)~\nThis concludes the =early-init.el= file.\n\n#+begin_src emacs-lisp\n(provide 'init.el)\n;;; init.el ends here\n#+end_src\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuvyklack%2Femacs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuvyklack%2Femacs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuvyklack%2Femacs/lists"}