Editor settings
As Admin, run secpol.msc and grant your account <<Create Symbolic Link>> permissions.
text-mode-hook and prog-mode-hook hooks are flexible enough due to some modes which can break work of some modes listed here.
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(ayrc/setup-company)
If you found that some mode break editor functionality you must disable it and put comment about this breakage.
So this is intended to be a place to collect and organize information related to Emacs package development. Built with Emacs, by Emacs package developers, for Emacs package developers.
;; -*- lexical-binding: t; -*-
(setq inhibit-splash-screen t
inhibit-startup-message t)
;; Disable dialog box
(setq use-dialog-box nil)
;; Disable indicators
(setq-default indicate-empty-lines t)
(setq-default indicate-buffer-boundaries 'left)
;; Disable ring-bell-function
;; That called when whenever function ‘ding’ is called.
(setq ring-bell-function 'ignore)
(use-package frame
:init
;; Disable cursor blink
(blink-cursor-mode 0)
;; Name of current buffer in window title
(setq frame-title-format "GNU Emacs: %b")
;; Fullscreen at GUI startup
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
(add-to-list 'default-frame-alist '(fullscreen . maximized)))
Also add it to ~/.Xresources to prevent blinking at startup:
Emacs.Background: #292b2e
Emacs.Foreground: #b2b2b2
Emacs.BorderColor: #292b2e
Emacs.SelectionForeground: #b2b2b2
Emacs.mode-line.attributeForeground: #b2b2b2
Emacs.mode-line.attributeBackground: #292b2e
and run xrdb -merge ~/.Xresources
(use-package spacemacs-theme
:straight t
:demand t
:custom-face
(org-link ((nil :height 1.0)))
(org-level-1 ((nil :height 1.0)))
(org-level-2 ((nil :height 1.0)))
(org-level-3 ((nil :height 1.0)))
(org-level-4 ((nil :height 1.0)))
(org-level-5 ((nil :height 1.0)))
(org-level-6 ((nil :height 1.0)))
(org-level-7 ((nil :height 1.0)))
(org-level-8 ((nil :height 1.0)))
(show-paren-match ((t (:background "purple4"))))
(show-paren-mismatch
((((class color)) (:background "red" :foreground "white"))))
:init
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(load-theme 'spacemacs-dark t)))
(load-theme 'spacemacs-dark t)))
(use-package doom-modeline
:straight t
:config
(setq
;; How tall the mode-line should be. It's only respected in GUI.
;; If the actual char height is larger, it respects the actual height.
doom-modeline-height 10
;; How wide the mode-line bar should be. It's only respected in GUI.
doom-modeline-bar-width 3
;; The limit of the window width.
;; If `window-width' is smaller than the limit, some information won't
;; be displayed.
doom-modeline-window-width-limit fill-column
;; How to detect the project root.
;; The default priority of detection is `ffip'
;; > `projectile'
;; > `project'.
;; nil means to use `default-directory'.
;; The project management packages have some issues on detecting
;; project root. e.g. `projectile' doesn't handle symlink folders
;; well, while `project' is unable to hanle sub-projects.
;; You can specify one if you encounter the issue.
doom-modeline-project-detection 'projectile
doom-modeline-buffer-file-name-style 'buffer-name
;; Whether display icons in the mode-line.
;; Respects `all-the-icons-color-icons'.
;; While using the server mode in GUI, should set the value
;; explicitly.
doom-modeline-icon ayrc/icons-enabled
doom-modeline-major-mode-icon ayrc/icons-enabled
doom-modeline-major-mode-color-icon ayrc/icons-enabled
doom-modeline-buffer-state-icon ayrc/icons-enabled
doom-modeline-buffer-modification-icon ayrc/icons-enabled
;; Whether display the modal state icon.
;; Including `evil', `overwrite', `god', `ryo' and `xah-fly-keys',
;; etc.
doom-modeline-modal-icon ayrc/icons-enabled
;; Whether display the perspective name. Non-nil to display in the
;; mode-line.
doom-modeline-persp-name t
;; If non nil the default perspective name is displayed in the
;; mode-line.
doom-modeline-display-default-persp-name t
;; If non nil the perspective name is displayed alongside a folder
;; icon.
doom-modeline-persp-icon ayrc/icons-enabled
;; Whether display the `lsp' state. Non-nil to display in the
;; mode-line.
doom-modeline-lsp t
doom-modeline-unicode-fallback nil
doom-modeline-minor-modes nil
doom-modeline-enable-word-count nil
;; Major modes in which to display word count continuously.
;; Also applies to any derived modes. Respects `doom-modeline-enable-word-count'.
;; If it brings the sluggish issue, disable `doom-modeline-enable-word-count' or
;; remove the modes from `doom-modeline-continuous-word-count-modes'.
doom-modeline-continuous-word-count-modes '(markdown-mode
gfm-mode
org-mode)
;; Whether display the buffer encoding.
doom-modeline-buffer-encoding t
;; Whether display the indentation information.
doom-modeline-indent-info t
;; If non-nil, only display one number for checker information if applicable.
doom-modeline-check-simple-format t
;; The maximum number displayed for notifications.
doom-modeline-number-limit 99
;; The maximum displayed length of the branch name of version
;; control.
doom-modeline-vcs-max-length 12
;; Whether display the GitHub notifications. It requires `ghub' package.
doom-modeline-github nil
doom-modeline-github-interval (* 30 60)
;; Whether display the mu4e notifications. It requires `mu4e-alert'
;; package.
doom-modeline-mu4e nil
;; Whether display the gnus notifications.
doom-modeline-gnus t
;; Wheter gnus should automatically be updated and how often
;; (set to nil to disable)
doom-modeline-gnus-timer 2
;; Whether display the IRC notifications. It requires `circe'
;; or `erc' package.
doom-modeline-irc nil
;; Function to stylize the irc buffer names.
doom-modeline-irc-stylize 'identity
;; Whether display the environment version.
doom-modeline-env-version nil
;; Or for individual languages
doom-modeline-env-enable-python nil
doom-modeline-env-enable-ruby nil
doom-modeline-env-enable-perl nil
doom-modeline-env-enable-go nil
doom-modeline-env-enable-elixir nil
doom-modeline-env-enable-rust nil
;; What to dispaly as the version while a new one is being loaded
doom-modeline-env-load-string "..."
;; Hooks that run before/after the modeline version string is
;; updated
doom-modeline-before-update-env-hook nil
doom-modeline-after-update-env-hook nil)
<<modeline-current-line-segment>>
<<modeline-custom-modeline-setup>>
(doom-modeline-mode 1))
(doom-modeline-def-segment ayrc/my-current-line
"The buffer position information."
(let ((visible (doom-modeline--segment-visible 'buffer-position))
(mouse-face 'doom-modeline-highlight)
(local-map mode-line-column-line-number-mode-map))
(concat
(doom-modeline-wspc)
;; Line and column
(propertize (format-mode-line
(concat "%l/"
(int-to-string (count-lines (point-min) (point-max)))
":%c"))
'face (doom-modeline-face)
'help-echo "Buffer position\n\
mouse-1: Display Line and Column Mode Menu"
'mouse-face mouse-face
'local-map local-map)
;; Position
(cond ((and visible
(bound-and-true-p nyan-mode)
(>= (window-width) nyan-minimum-window-width))
(concat
(doom-modeline-wspc)
(propertize (nyan-create) 'mouse-face mouse-face)))
((and visible
(bound-and-true-p poke-line-mode)
(>= (window-width) poke-line-minimum-window-width))
(concat
(doom-modeline-wspc)
(propertize (poke-line-create) 'mouse-face mouse-face)))
((and visible
(bound-and-true-p mlscroll-mode)
(>= (window-width) mlscroll-minimum-current-width))
(concat
(doom-modeline-wspc)
(let ((mlscroll-right-align nil))
(format-mode-line (mlscroll-mode-line)))))
((and visible
(bound-and-true-p sml-modeline-mode)
(>= (window-width) sml-modeline-len))
(concat
(doom-modeline-wspc)
(propertize (sml-modeline-create) 'mouse-face mouse-face)))
(t ""))
(doom-modeline-spc))))
(doom-modeline-def-modeline 'ayrc/my-simple-line
'(
bar
matches
buffer-info
remote-host
ayrc/my-current-line
parrot
selection-info
)
'(
misc-info
input-method
buffer-encoding
major-mode
process
vcs
lsp
check
)
)
(defun ayrc/setup-custom-doom-modeline ()
(doom-modeline-set-modeline 'ayrc/my-simple-line 'default))
(add-hook 'doom-modeline-mode-hook 'ayrc/setup-custom-doom-modeline)
(use-package bookmark
:config
(setq bookmark-save-flag 1
bookmark-fontify nil
bookmark-default-file (expand-file-name
"bookmarks"
ayrc/path-to-session-configs-dir)))
(use-package recentf
:config
(setq recentf-save-file (expand-file-name
"recentf-save.el"
ayrc/path-to-session-configs-dir)))
(use-package files
:init
(setq
backup-directory-alist `((".*" . ,temporary-file-directory))
auto-save-file-name-transforms `((".*" ,temporary-file-directory t))))
Make Emacs use the $PATH set up by the user’s shell
(use-package exec-path-from-shell
:if (eq system-type 'gnu/linux)
:straight t
:after (:any python)
:commands (exec-path-from-shell-initialize
exec-path-from-shell-copy-env)
:defines (exec-path-from-shell-check-startup-files)
:config
(setq exec-path-from-shell-check-startup-files nil)
(when (memq window-system '(mac ns x))
(add-to-list 'exec-path-from-shell-variables "PYENV_ROOT")))
Revert buffers when files on disk change
(use-package autorevert
:defer t
:diminish auto-revert-mode)
Word abbreviations mode. In Abbrev mode, inserting an abbreviation causes it to expand and be replaced by its expansion
(use-package abbrev
:defer t
:commands (abbrev-mode)
:diminish abbrev-mode
:custom
(save-abbrevs 'silently))
(setq word-wrap t)
(diminish 'visual-line-mode)
When Auto Fill mode is enabled, inserting a space at a column beyond ‘current-fill-column’ automatically breaks the line at a previous space.
This minor-mode have bad behavior almost in all modes.
(diminish 'auto-fill-function)
(auto-fill-mode -1)
(remove-hook 'text-mode-hook #'turn-on-auto-fill)
(setq-default tab-width 4)
(setq-default c-basic-offset 4)
(setq-default standart-indent 4)
(setq-default indent-tabs-mode nil)
(setq select-enable-clipboard t)
(use-package xclip
:if (eq system-type 'gnu/linux)
:straight t
:init
(xclip-mode 1))
(use-package pbcopy
:if (eq system-type 'darwin)
:straight t
:init
(turn-on-pbcopy))
If you enable Delete Selection mode, a minor mode, then inserting text while the mark is active causes the selected text to be deleted first. This also deactivates the mark. Many graphical applications follow this convention, but Emacs does not.
(delete-selection-mode t)
(setq require-final-newline t)
(setq next-line-add-newlines t)
(use-package editorconfig
:straight t
:diminish editorconfig-mode
:init
(editorconfig-mode))
(fset 'yes-or-no-p 'y-or-n-p)
(use-package pixel-scroll
:bind (("M-n" . (lambda nil (interactive) (pixel-scroll-up 1)))
("M-p" . (lambda nil (interactive) (pixel-scroll-down 1)))
([remap scroll-down-command] . #'golden-ratio-scroll-screen-down)
([remap scroll-up-command] . #'golden-ratio-scroll-screen-up))
:init
<<golden-ratio-scroll-screen>>
(defun ayrc/pixel-scroll-pre-command-hook ()
(pixel-scroll-mode)
(remove-hook 'pre-command-hook #'ayrc/pixel-scroll-pre-command-hook))
(add-hook 'pre-command-hook #'ayrc/pixel-scroll-pre-command-hook)
:config
<<scroll-perfomance>>
<<scroll-smoothness>>)
;; Reduce rendering/line scan work for Emacs by not rendering cursors or
;; regions in non-focused windows.
(setq-default cursor-in-non-selected-windows nil)
(setq
;; More performant rapid scrolling over unfontified regions. May cause
;; brief spells of inaccurate syntax highlighting right after scrolling,
;; which should quickly self-correct.
;; No (less) lag while scrolling lots.
fast-but-imprecise-scrolling t
;; Don’t compact font caches during GC.
inhibit-compacting-font-caches t
;; Just don't even fontify if we're still catching up on user input.
jit-lock-defer-time 0
highlight-nonselected-windows nil)
(setq
;; scroll-preserve-screen-position nil
scroll-step 1
scroll-margin 0
scroll-conservatively 0
;; Never go back to the old scrolling behaviour.
pixel-dead-time 0
pixel-wait 0
;; Scroll by number of pixels instead of
;; lines (t = frame-char-height pixels).
pixel-resolution-fine-flag t
;; Distance in pixel-resolution to scroll each mouse wheel event.
mouse-wheel-scroll-amount '(1 ((shift) . 1))
mouse-wheel-follow-mouse t
mouse-wheel-progressive-speed nil)
(use-package golden-ratio-scroll-screen
:straight t
:defer t
:after (pixel-scroll)
:custom-face
(golden-ratio-scroll-highlight-line-face
((t (:background "#3c394a" :foreground "#5b576e"))))
:commands (golden-ratio-scroll-screen-down
golden-ratio-scroll-screen-up))
(use-package font-lock
:defer t
:commands (font-lock-mode global-font-lock-mode)
:config
(setq font-lock-maximum-decoration t))
Highlight matching paren
(use-package paren
:defer t
:commands (show-paren-mode)
:init
(show-paren-mode)
:config
(setq show-paren-delay 0
show-paren-style 'expression))
A library for inserting Developer icons
(use-package all-the-icons
:straight t
:demand t
:config
(unless (member "all-the-icons" (font-family-list))
(all-the-icons-install-fonts t)))
(use-package hl-line
:init
(global-hl-line-mode 1))
(use-package display-line-numbers
:defer t
:after (:any company)
:commands (display-line-numbers)
:init
(line-number-mode t)
(column-number-mode t)
;; Don't show current buffer size
(size-indication-mode nil)
:config
(setq display-line-numbers-width-start 6))
(use-package eldoc
:diminish eldoc-mode
:init
(global-eldoc-mode -1))
(use-package dashboard
:straight t
:diminish page-break-lines-mode
:init
(dashboard-setup-startup-hook)
:custom
(initial-buffer-choice (lambda ()
(get-buffer-create "*dashboard*")
;; Fix icons showing if the server used
(dashboard-refresh-buffer)))
(dashboard-set-footer nil)
(dashboard-startup-banner 'logo)
(dashboard-center-content t)
(dashboard-show-shortcuts t)
(dashboard-set-file-icons ayrc/icons-enabled)
(dashboard-set-heading-icons ayrc/icons-enabled)
(dashboard-banner-logo-title "Welcome to Emacs")
(dashboard-items '((recents . 5)
(bookmarks . 10)
(projects . 5))))
(use-package projectile
:straight t
:delight '(:eval (format "[P<%s>]" (projectile-project-name)))
:bind (:map projectile-mode-map
("<f9>" . projectile-compile-project)
("C-x p o" . projectile-switch-open-project)
("C-x p s" . projectile-switch-project)
("C-c p i" . projectile-invalidate-cache)
("C-c p z" . projectile-cache-current-file)
("C-c p s" . ayrc/helm-projectile-grep-or-rg)
("C-c p h" . helm-projectile)
("C-c p p" . helm-projectile-switch-project)
("C-c p f" . helm-projectile-find-file)
("C-c p F" . helm-projectile-find-file-in-known-projects)
("C-c p g" . helm-projectile-find-file-dwim)
("C-c p d" . helm-projectile-find-dir)
("C-c p e" . helm-projectile-ag)
("C-c p a" . helm-projectile-find-other-file)
("C-c p b" . helm-projectile-switch-to-buffer))
:preface
<<helm-projectile>>
:init
(projectile-mode 1)
:custom
(projectile-completion-system 'helm)
(projectile-switch-project-action 'helm-projectile)
(projectile-enable-caching t)
:config
(setq projectile-project-root-files-bottom-up (append '(".dir-locals.el"
".projectile"
".project")
projectile-project-root-files-bottom-up)
projectile-known-projects-file (expand-file-name
"known-projects.el"
ayrc/path-to-session-configs-dir)))
(use-package helm-projectile
:straight t
:init
<<projectile-helm-rg>>
<<projectile-helm-ag>>
(defun ayrc/helm-projectile-grep-or-rg ()
"Uses helm-projectile-grep, if ag doesn't present"
(interactive)
(if (executable-find "rg") (helm-projectile-rg)
(helm-projectile-grep))))
A helm interface to ripgrep
(use-package helm-rg
:straight t
:commands (helm-projectile-rg)
:bind (:map helm-rg-map
("M-b" . nil)
("M-d" . nil)))
Helm interface to ag. Will be used for single purpose: replace symbol in project
(use-package helm-ag
:straight t
:commands (helm-projectile-ag)
:custom
(helm-ag-fuzzy-match t))
Treemacs is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities.
(use-package treemacs
:straight t
:bind ("<f1>" . #'treemacs)
:init
<<treemacs-all-the-icons>>
<<treemacs-projectile-usepkg>>
:config
(setq treemacs-width 40)
(require 'treemacs-all-the-icons)
(treemacs-load-theme "all-the-icons")
(treemacs-follow-mode 1))
(use-package treemacs-projectile
:after treemacs projectile
:straight t)
(use-package treemacs-all-the-icons
:after treemacs
:straight t)
Incremental and narrowing framework
(use-package helm
:straight t
:diminish helm-mode
:defines (helm-imenu-fuzzy-match
helm-apropos-fuzzy-match
helm-recentf-fuzzy-match
helm-semantic-fuzzy-match
helm-lisp-fuzzy-completion
helm-completion-in-region-fuzzy-match)
:bind
(("M-x" . helm-M-x)
("C-x C-b" . helm-mini)
("C-x b" . helm-mini)
("C-c h /" . helm-find)
("C-c h h" . helm-info)
("C-c h o" . helm-occur)
("C-c h i" . helm-imenu)
("C-c h s" . helm-rg)
;; Pre-configured helm to build regexps.
("C-c h r" . helm-regexp)
("C-c h l" . helm-bookmarks)
("C-c h a" . helm-apropos)
("C-c h x" . helm-register)
("C-c h m" . helm-man-woman)
("C-x C-f" . helm-find-files)
("M-y" . helm-show-kill-ring)
:map helm-map
;; rebind tab to do persistent action
("<tab>" . helm-execute-persistent-action)
("C-i" . helm-execute-persistent-action)
("C-z" . helm-select-action))
:init
<<helm-rg>>
<<helm-ag>>
(helm-mode 1)
(add-to-list 'completion-styles `,(if (version< emacs-version "27") 'helm-flex 'flex) t)
(when (not (eq system-type 'windows-nt))
(setq x-wait-for-event-timeout nil))
:config
;; To prevent "Symbol’s value as variable is void: tramp-methods"
(require 'tramp)
(setq helm-completion-style 'emacs
helm-imenu-fuzzy-match t
helm-locate-fuzzy-match t
helm-apropos-fuzzy-match t
helm-recentf-fuzzy-match t
helm-semantic-fuzzy-match t
helm-lisp-fuzzy-completion t
helm-buffers-fuzzy-matching t
helm-ff-search-library-in-sexp t
helm-ff-file-name-history-use-recentf t
helm-completion-in-region-fuzzy-match t
history-delete-duplicates t
;; Open helm buffer inside current window, not occupy whole
;; other window
helm-split-window-inside-p t
;; Move to end or beginning of source when reaching top or
;; bottom of source.
helm-move-to-line-cycle-in-source nil
;; Scroll 8 lines other window using M-<next>/M-<prior>
helm-scroll-amount 8
helm-autoresize-max-height 50
helm-autoresize-min-height 10
helm-buffer-max-length 50
helm-ff-file-name-history-use-recentf t)
;; Autoresize helm minibufer
(helm-autoresize-mode t))
Treat undo history as a tree
(use-package undo-tree
:straight t
:after (:any company)
:diminish undo-tree-mode
:bind (("C-x u" . undo-tree-visualize)
("C-." . undo-tree-undo))
:custom
(undo-tree-history-directory-alist (list (cons "." (concat ayrc/path-to-session-cache-dir "undo"))))
:init
(global-undo-tree-mode))
Show number of matches in mode-line while searching
(use-package anzu
:straight t
:defines (anzu-cons-mode-line-p)
:defer t
:diminish anzu-mode
:bind (([remap query-replace] . #'anzu-query-replace)
([remap query-replace-regexp] . #'anzu-query-replace-regexp)
:map isearch-mode-map
([remap isearch-query-replace] . #'anzu-isearch-query-replace)
([remap isearch-query-replace-regexp] . #'anzu-isearch-query-replace-regexp)))
Make bindings that stick around
(use-package hydra
:straight t
:defer t
:after (:any dap)
:commands (defhydra))
(use-package subword
:defer t
:after (:any company)
:commands (global-subword-mode)
:diminish (subword-mode global-subword-mode)
:init
(defun ayrc/forward-word (&optional arg)
(interactive "p")
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "_" table)
(with-syntax-table table
(forward-word arg))))
(global-set-key (kbd "M-f") 'ayrc/forward-word)
(defun ayrc/backward-word (&optional arg)
(interactive "p")
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "_" table)
(with-syntax-table table
(backward-word arg))))
(global-set-key (kbd "M-b") 'ayrc/backward-word)
(defun ayrc/kill-word (&optional arg)
(interactive "p")
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "_" table)
(with-syntax-table table
(kill-word arg))))
(global-set-key (kbd "M-d") 'ayrc/kill-word)
(defun ayrc/backward-kill-word (&optional arg)
(interactive "p")
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "_" table)
(with-syntax-table table
(backward-kill-word arg))))
(global-set-key (kbd "M-DEL") 'ayrc/backward-kill-word)
(global-set-key (kbd "M-<backspace>") 'ayrc/backward-kill-word)
(global-subword-mode 1))
(global-set-key (kbd "<C-M-up>") 'shrink-window)
(global-set-key (kbd "<C-M-down>") 'enlarge-window)
(global-set-key (kbd "<C-M-left>") 'shrink-window-horizontally)
(global-set-key (kbd "<C-M-right>") 'enlarge-window-horizontally)
(global-set-key (kbd "<AltGr>") 'toggle-input-method)
(if (equal nil (equal major-mode 'org-mode))
(windmove-default-keybindings 'meta))
(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "M-n") (lambda () (interactive) (scroll-up 1)))
(global-set-key (kbd "M-p") (lambda () (interactive) (scroll-down 1)))
(global-set-key (kbd "C-x M-i") 'string-insert-rectangle)
(global-set-key (kbd "<f5>") (lambda () (interactive) (revert-buffer)))
(global-unset-key (kbd "C-z"))
Jump to arbitrary positions in visible text and select text quickly
(use-package avy
:straight t
:bind (("C-;" . avy-goto-char-2)
("C-'" . avy-goto-line)
("M-g c" . avy-goto-char)
("M-g e" . avy-goto-word-0)
("M-g g" . avy-goto-line)
("M-g w" . avy-goto-word-1)
("M-g (" . avy-goto-open-paren)
("M-g )" . avy-goto-close-paren)
("M-g P" . avy-pop-mark)
("M-g M-g" . avy-goto-line))
:config
(setq avy-case-fold-search nil))
(use-package expand-region
:straight t
:after (:any company)
:commands (er/expand-region)
:bind ("C-=" . er/expand-region))
Increment and decrement numbers in Emacs.
(use-package evil-numbers
:straight t
:after (:any company)
:bind (("C-c +" . #'evil-numbers/inc-at-pt)
("C-c -" . #'evil-numbers/dec-at-pt)
:map org-mode-map
("C-c +" . #'evil-numbers/inc-at-pt)
("C-c -" . #'evil-numbers/dec-at-pt)))
(straight-use-package
`(scratch :type git
:host nil
:repo "https://codeberg.org/emacs-weirdware/scratch"))
(use-package scratch
:straight t
:after (:any company)
:defer t
:bind (("C-c s c" . #'scratch)
("C-c s l" . (lambda () (interactive) (scratch #'emacs-lisp-mode)))
("C-c s t" . (lambda () (interactive) (scratch #'text-mode)))))
(use-package uuidgen
:straight t
:after (:any company)
:bind (("C-c u" . (lambda () (interactive) (uuidgen 'time-based)))))
The library uniquify overrides Emacs default mechanism for making buffer names unique (using suffixes like <2>, <3> etc.) with a more sensible behaviour which use parts of the file names to make the buffer names distinguishable.
For instance, buffers visiting “/u/mernst/tmp/Makefile” and “/usr/projects/zaphod/Makefile” would be named “Makefile|tmp” and “Makefile|zaphod”, respectively (instead of “Makefile” and “Makefile<2>”).
(use-package uniquify
:defer t
:after (:any dashboard)
:custom
(uniquify-buffer-name-style 'post-forward-angle-brackets)
:config
(require 'uniquify))
(straight-use-package-lazy
`(eaf :type git
:host github
:repo "emacs-eaf/emacs-application-framework"
:files ("*.el" "*.py" "*.js" "*.html" "*.json" "core" "app" "node_modules")
:build t
:pre-build ,(pcase system-type
('gnu/linux '(("./install-eaf.py" "--ignore-core-deps" "--ignore-sys-deps" "--ignore-py-deps" "--install-all-apps")))
(_ '(;; ("python" "./install-eaf.py" "--ignore-core-deps" "--ignore-sys-deps" "--ignore-py-deps" "--install-all-apps")
)))))
(use-package eaf
:straight t
:after org
:defines (eaf-browser-enable-adblocker
eaf-open-browser)
:functions (eaf-setq
eaf-bind-key)
:init
(use-package epc
:straight t
:defer t)
(use-package ctable
:straight t
:defer t )
(use-package deferred
:straight t
:defer t)
(use-package s
:straight t
:defer t)
:custom
(eaf-browser-continue-where-left-off t)
(eaf-config-location (concat ayrc/path-to-session-cache-dir "/eaf"))
:init
:config
(when (eq system-type 'gnu/linux)
(require 'eaf-browser)
(require 'eaf-org-previewer)
(require 'eaf-markdown-previewer)
(eaf-setq eaf-browser-enable-adblocker "true")))
(use-package reverse-im
:straight t
:custom
(reverse-im-input-methods '("russian-computer"))
:config
(reverse-im-mode t))
(use-package compile
:defer t
:after (:any company)
:bind (;; Press to compile
("<f9>" . 'compile)
;; Errors switching
("<f7>" . 'next-error)
("<f8>" . 'previous-error))
:config
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start (point))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer))
(use-package envrc
:straight t
:commands (envrc-mode)
:diminish envrc-mode)
(setq ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally)
(global-set-key (kbd "C-x e") 'ediff-buffers)
(use-package csv-mode
:straight t
:diminish csv-mode
:commands (csv-mode))
Minor modes for highlighting indentation
(use-package highlight-indentation
:straight t
:after (:any company)
:diminish highlight-indentation-mode
:commands (highlight-indentation-mode)
:custom-face
(highlight-indentation ((t (:background "#e3e3d3"))))
(highlight-indentation-current-column ((t (:background "#c3b3b3")))))
This package provides the `adaptive-wrap-prefix-mode’ minor mode which sets the wrap-prefix property on the fly so that single-long-line paragraphs get word-wrapped in a way similar to what you’d get with M-q using adaptive-fill-mode, but without actually changing the buffer’s text.
(use-package adaptive-wrap
:straight t
:after (:any company)
:diminish adaptive-wrap-prefix-mode
;; :hook (visual-line-mode . adaptive-wrap-prefix-mode)
:commands (adaptive-wrap-prefix-mode)
:config
(progn
(setq-default adaptive-wrap-extra-indent 2)))
(use-package hungry-delete
:straight t
:defer t
:after (:any company)
:diminish hungry-delete-mode
:commands (hungry-delete-mode))
Smart shift text left/right.
(use-package smart-shift
:straight t
:after (:any company)
:diminish smart-shift-mode
:bind
(:map smart-shift-mode-map
("<C-up>" . smart-shift-up)
("<C-down>" . smart-shift-down)
("<C-left>" . smart-shift-left)
("<C-right>" . smart-shift-right)))
Unobtrusively remove trailing whitespace
(use-package ws-butler
:after (:any company)
:diminish ws-butler-mode
:straight t
:commands (ws-butler-mode))
Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
(use-package smartparens
:straight t
:after (:any company)
:functions (sp-pair)
:diminish smartparens-mode
:commands (smartparens-mode smartparens-strict-mode sp-pair)
:bind (:map smartparens-mode-map
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-n" . sp-next-sexp)
("C-M-p" . sp-previous-sexp)
("C-M-t" . sp-transpose-sexp)
("M-k" . sp-backward-kill-sexp)
("C-M-w" . sp-copy-sexp)
("C-M-d" . delete-sexp)
("M-[" . sp-backward-unwrap-sexp)
("M-]" . sp-rewrap-sexp)
("C-x C-t" . sp-transpose-hybrid-sexp))
:config
(require 'smartparens-config))
Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
(use-package aggressive-indent
:straight t
:after (:any company)
:commands (aggressive-indent-mode)
:hook (aggressive-indent-mode . ayrc/aggressive-indent-hook)
:diminish aggressive-indent-mode
:init
<<aggressive-indent-hook>>)
(defun ayrc/aggressive-indent-hook ()
(electric-indent-local-mode -1))
(use-package hideshow
:after (:any company)
:diminish hs-minor-mode
:commands (hs-minor-mode)
:bind
(:map hs-minor-mode-map
("C-c f TAB" . hs-toggle-hiding)
("C-c f h" . hs-hide-all)
("C-c f s" . hs-show-all))
:init
(progn
;; For yaml mode and others
(defun ayrc/indenation-toggle-fold ()
"Toggle fold all lines larger than indentation on current line"
(interactive)
(let ((col 1))
(save-excursion
(back-to-indentation)
(setq col (+ 1 (current-column)))
(set-selective-display
(if selective-display nil (or col 1)))))))
:config
(progn
(add-to-list 'hs-special-modes-alist
(list 'nxml-mode
"<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--"
'nxml-forward-element
nil))))
(use-package outline
:after (:any company)
:diminish outline-minor-mode
:commands (outline-minor-mode)
:bind (:map outline-minor-mode-map
("C-c f TAB" . ayrc/outline-toggle-entry)
("C-c f h" . ayrc/outline-hide-all)
("C-c f s" . ayrc/outline-show-all))
:hook (outline-minor-mode . ayrc/outline-hook)
:init
(defvar ayrc/outline-toggle-all-flag nil "toggle all flag")
(defvar ayrc/cpos_save nil "current cursor position")
(defun ayrc/outline-hook ()
(make-local-variable 'ayrc/outline-toggle-all-flag)
(make-local-variable 'ayrc/cpos_save))
:config
(defun ayrc/outline-toggle-entry ()
(interactive)
"Toggle outline hiding for the entry under the cursor"
(if (progn
(setq ayrc/cpos_save (point))
(end-of-line)
(get-char-property (point) 'invisible))
(progn
(outline-show-subtree)
(goto-char ayrc/cpos_save))
(progn
(outline-hide-subtree)
(goto-char ayrc/cpos_save))))
(defun ayrc/outline-show-all ()
(interactive)
"Show all outline hidings for the entire file"
(setq ayrc/outline-toggle-all-flag nil)
(outline-show-all))
(defun ayrc/outline-hide-all ()
(interactive)
"Hide all outline hidings for the entire file"
(setq ayrc/outline-toggle-all-flag t)
(outline-hide-sublevels 1))
(defun ayrc/outline-toggle-all ()
(interactive)
"Toggle outline hiding for the entire file"
(if ayrc/outline-toggle-all-flag
(ayrc/outline-show-all)
(ayrc/outline-hide-all))))
Colorize color names in buffers
(use-package rainbow-mode
:straight t
:diminish rainbow-mode
:commands (rainbow-mode))
(use-package hl-todo
:after (:any company)
:straight t
:diminish hl-todo-mode
:commands (hl-todo-mode))
(use-package flyspell
:defer t
:after (:any company))
https://github.com/tmalsburg/guess-language.el http://manuel-uberti.github.io/emacs/2017/02/04/guess-language/
A universal on-the-fly syntax checker
(use-package flymake
:defer t
:after (:any company)
:diminish flymake-mode
:commands (flymake-mode))
On-the-fly syntax checking
<<helm-flycheck-usepkg>>
(use-package flycheck
:straight t
:after (:any company)
:diminish flycheck-mode
:commands (flycheck-mode)
:bind (:map flycheck-mode-map
("C-c h f" . helm-flycheck))
:hook (flycheck-mode . ayrc/flycheck-hook)
:init
<<flycheck-hook>>
:config
(setq flycheck-checker-error-threshold 1000
flycheck-standard-error-navigation nil
flycheck-idle-change-delay 0.01
flycheck-check-syntax-automatically '(save
mode-enabled
idle-buffer-switch
idle-change))
(when (eq system-type 'windows-nt)
(setq-default flycheck-disabled-checkers '(python-pycompile))))
(use-package helm-flycheck
:straight t
:defer t
:after (flycheck)
:commands (helm-flycheck))
(defun ayrc/flycheck-hook ()
(flymake-mode -1))
Auto-format source code with one command
(use-package format-all
:straight t
:after (:any company))
Cross-referencing commands
<<helm-xref-usepkg>>
(use-package xref
:defines (xref-show-definitions-function)
:after (:any company)
:defer t
:init
(defun ayrc/setup-xref-hotkeys ()
(ayrc/local-set-keys '(("M-," . xref-go-back)
("M-?" . xref-find-definitions)
("C-M-." . xref-find-apropos))))
:config
(if (< emacs-major-version 27)
(setq xref-show-xrefs-function 'helm-xref-show-xrefs)
(setq xref-show-xrefs-function 'helm-xref-show-xrefs-27
xref-show-definitions-function 'helm-xref-show-defs-27)))
(use-package helm-xref
:straight t
:defer t
:after (:any xref)
:commands (helm-xref-show-xrefs
helm-xref-show-xrefs-27
helm-xref-show-defs-27))
An Emacs “jump to definition” package for 40+ languages
(use-package dumb-jump
:straight t
:after (:any company)
:custom
(dumb-jump-prefer-searcher 'rg))
(defun ayrc/dumb-jump-setup ()
(interactive)
"Setup dumb jump in current buffer"
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
(use-package yasnippet
:straight t
:defer t
:functions (yas-reload-all)
:commands (yas-minor-mode yas-global-mode yas-reload-all)
:diminish yas-minor-mode
:init
(when (not (eq system-type 'windows-nt))
<<snippets-collection>>)
:config
(setq yas-snippet-dirs
(list (ayrc/expand-config-path "./personal-snippets")))
(when (not (eq system-type 'windows-nt))
(push yasnippet-snippets-dir yas-snippet-dirs))
(yas-reload-all))
A collection of yasnippet snippets for many languages
(use-package yasnippet-snippets
:if (not (eq system-type 'windows-nt))
:straight t
:commands (yasnippet-snippets-initialize))
(use-package company
:straight t
:diminish company-mode
:defer t
:commands (company-mode)
:bind
(:map company-active-map
("<tab>" . company-complete-selection))
:hook (company-mode . ayrc/company-hook)
:init
<<company-box-usepkg>>
<<company-flx-usepkg>>
<<company-quickhelp-usepkg>>
:config
(setq company-tooltip-align-annotations t
company-idle-delay 0.1
company-show-numbers t
company-minimum-prefix-length 1))
(use-package company-quickhelp
:straight t
:after company
:functions (company-quickhelp-manual-begin)
:commands (company-quickhelp-local-mode)
:bind (:map company-active-map
("M-h" . #'company-quickhelp-manual-begin)))
(use-package company-flx
:straight t
:after (company)
:commands (company-flx-mode))
(use-package company-box
:straight t
:disabled
:after (company)
:config
(setq company-box-icons-alist company-box-icons-all-the-icons))
;;;###autoload
(defun ayrc/setup-company (&optional mode-specific-backends)
(company-mode 1)
(or mode-specific-backends (setq mode-specific-backends '()))
(let ((backends (list mode-specific-backends
'(company-files ;; files & directories
company-dabbrev-code ;; dynamic code abbreviations
company-keywords) ;; keywords
'(company-abbrev ;; abbreviations
company-dabbrev)))) ;; dynamic abbreviat
(make-local-variable 'company-backends)
(setq company-backends (-non-nil backends))))
;;;###autoload
(defun ayrc/company-hook ()
;; (company-flx-mode)
;; (company-box-mode)
(company-quickhelp-local-mode))
Emacs frontend to GNU Global source code tagging system
- GNU Global
- intall it and put gtags configuration into HOME/.globalrc or gtags.conf into project root
(use-package ggtags
:straight t
:after (:any company)
:diminish ggtags-mode
:commands (ggtags-mode)
:init
<<helm-gtags-usepkg>>
:config
(setq ggtags-update-on-save nil)
(setq ggtags-use-idutils t)
(setq ggtags-sort-by-nearness t)
(unbind-key "M-<" ggtags-mode-map)
(unbind-key "M->" ggtags-mode-map))
(use-package helm-gtags
:straight t
:after ggtags
:commands (helm-gtags-select helm-gtags-find-tag)
:config
(setq helm-gtags-fuzzy-match t)
(setq helm-gtags-preselect t)
(setq helm-gtags-prefix-key "\C-cg")
(setq helm-gtags-path-style 'relative)
(define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack))
A common protocol for language servers
Emacs client/library for the Language Server Protocol
(setenv "LSP_USE_PLISTS" "true")
(use-package lsp-mode
:straight t
:after (:any company)
:diminish lsp-mode
:commands (lsp-mode lsp-deffered lsp-rename)
:functions (lsp-flycheck-enable)
:hook (lsp-mode . ayrc/lsp-hook)
:bind (:map lsp-mode-map
("C-c h w" . helm-lsp-workspace-symbol))
:custom
(lsp-auto-configure t)
(lsp-enable-snippet nil)
(lsp-keep-workspace-alive nil)
(lsp-use-plists t)
(read-process-output-max (* 1024 1024))
(lsp-keymap-prefix "C-c l")
:init
<<lsp-ui-usepkg>>
<<helm-lsp-usepkg>>)
(setenv "LSP_USE_PLISTS" "false")
(defun ayrc/lsp-hook ()
(ayrc/local-set-keys '(("C-c r" . lsp-rename)
("C-c C-r" . lsp-format-region)
("C-M-\\" . lsp-format-region)
("M-." . lsp-ui-peek-find-definitions)
("M-," . xref-go-back)
("M-?" . lsp-ui-peek-find-references)
("C-M-." . xref-find-apropos)))
(flycheck-mode 1)
(lsp-ui-mode 1)
(lsp-completion-mode 1)
(dap-mode 1))
(use-package helm-lsp
:straight t
:defer t
:after (lsp-mode)
:commands (helm-lsp-workspace-symbol))
(use-package lsp-ui
:straight t
:defer t
:after (lsp-mode)
:defines (lsp-ui-flycheck-enable)
:commands (lsp-ui-mode)
:config
(setq lsp-ui-peek-enable nil
lsp-ui-sideline-enable nil
lsp-ui-imenu-enable t
lsp-ui-doc-enable nil
lsp-ui-flycheck-enable t
lsp-ui-doc-include-signature nil
lsp-ui-sideline-show-symbol nil
lsp-ui-peek-fontify 'always))
Improve the performance of lsp-mode or eglot using a wrapper executable.
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
(when (equal (following-char) ?#)
(let ((bytecode (read (current-buffer))))
(when (byte-code-function-p bytecode)
(funcall bytecode))))
(apply old-fn args)))
(advice-add (if (progn (require 'json)
(fboundp 'json-parse-buffer))
'json-parse-buffer
'json-read)
:around
#'lsp-booster--advice-json-parse)
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(use-package symbol-overlay
:straight t
:after (:any company)
:diminish symbol-overylay-mode
:commands (symbol-overylay-mode))
Debug Adapter Protocol mode
(use-package dap-mode
:straight t
:defer t
:after (lsp-mode)
:diminish dap-mode
:defines (dap-lldb-debug-program)
:commands (dap-register-debug-template)
:hook (dap-mode . ayrc/dap-hook)
:init
(defun ayrc/dap-hook ()
(add-hook 'dap-stopped-hook
(lambda (_debug_session) (call-interactively #'dap-hydra)))
;; use tooltips for mouse hover
;; if it is not enabled `dap-mode' will use the minibuffer.
(tooltip-mode 1)
(dap-ui-mode 1)
;; enables mouse hover support
(dap-tooltip-mode 1))
:config
(defun ayrc/dap-remove-nth-first-templates (count)
"For removing useless dap templates after loading of
language specific dap parts"
(setq dap-debug-template-configurations
(progn
(let ((rest-of-debug-templates
(nthcdr
count
dap-debug-template-configurations)))
(if (listp rest-of-debug-templates)
'()
rest-of-debug-templates))))))
Incremental parsing system
(use-package tree-sitter
:straight t
:after (:any company)
:commands ()
:commands (tree-sitter-mode)
:init
(setq tsc-dyn-get-from '(:compilation))
<<helm-tree-sitter-usepkg>>
<<tree-sitter-langs-usepkg>>
:config
(require 'tree-sitter-langs)
(global-tree-sitter-mode t)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
(use-package helm-tree-sitter
:straight t
:defer t
:after (tree-sitter)
:commands (helm-tree-sitter-or-imenu))
(use-package tree-sitter-langs
:straight t
:defer t
:after (tree-sitter))
Simple automatic indentation for Emacs
(use-package snap-indent
:straight t
:after (:any company)
:custom ((snap-indent-format 'untabify)
(snap-indent-on-save 'nil)))
;;;###autoload
(defun ayrc/open-with (arg)
"Open visited file in default external program.
When in dired mode, open file under the cursor.
With a prefix ARG always prompt for command to use."
(interactive "P")
(let* ((current-file-name
(if (eq major-mode 'dired-mode)
(dired-get-file-for-visit)
buffer-file-name))
(open (pcase system-type
('darwin "open")
((or 'gnu 'gnu/linux 'gnu/kfreebsd) "xdg-open")))
(program (if (or arg (not open))
(read-shell-command "Open current file with: ")
open)))
(call-process program nil 0 nil current-file-name)))
(global-set-key (kbd "C-c o w") #'ayrc/open-with)
;;;###autoload
(defun ayrc/indent-defun ()
"Indent the current defun."
(interactive)
(save-excursion
(mark-defun)
(indent-region (region-beginning) (region-end))))
(global-set-key (kbd "C-M-z") #'ayrc/indent-defun)
;;;###autoload
(defun ayrc/toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
(this-win-2nd (not (and (<= (car this-win-edges)
(car next-win-edges))
(<= (cadr this-win-edges)
(cadr next-win-edges)))))
(splitter
(if (= (car this-win-edges)
(car (window-edges (next-window))))
'split-window-horizontally
'split-window-vertically)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
(if this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
(if this-win-2nd (other-window 1))))))
(global-set-key (kbd "C-x |") #'ayrc/toggle-window-split)
;;;###autoload
(defun ayrc/ispell-word-then-abbrev (p)
"Call `ispell-word', then create an abbrev for it.
With prefix P, create local abbrev. Otherwise it will
be global.
If there's nothing wrong with the word at point, keep
looking for a typo until the beginning of buffer. You can
skip typos you don't want to fix with `SPC', and you can
abort completely with `C-g'."
(interactive "P")
(let (bef aft)
(save-excursion
(while (if (setq bef (thing-at-point 'word))
;; Word was corrected or used quit.
(if (ispell-word nil 'quiet)
nil ; End the loop.
;; Also end if we reach `bob'.
(not (bobp)))
;; If there's no word at point, keep looking
;; until `bob'.
(not (bobp)))
(backward-word))
(setq aft (thing-at-point 'word)))
(if (and aft bef (not (equal aft bef)))
(let ((aft (downcase aft))
(bef (downcase bef)))
(define-abbrev
(if p local-abbrev-table global-abbrev-table)
bef aft)
(message "\"%s\" now expands to \"%s\" %sally"
bef aft (if p "loc" "glob")))
(user-error "No typo at or before point"))))
;;;###autoload
(defun ayrc/reload-configuration ()
"Reload configuration starting from ~/.emacs.d/init.el"
(interactive)
(load-file (ayrc/expand-config-path "./init.el")))
;;;###autoload
(defun ayrc/rename-current-file-and-buffer ()
"Rename the current buffer and file it is visiting."
(interactive)
(let ((filename (buffer-file-name)))
(if (not (and filename (file-exists-p filename)))
(message "Buffer is not visiting a file!")
(let ((new-name (read-file-name "New name: " filename)))
(cond
((vc-backend filename) (vc-rename-file filename new-name))
(t
(rename-file filename new-name t)
(set-visited-file-name new-name t t)))))))
;;;###autoload
(defun ayrc/sudo-edit (&optional arg)
"Edit currently visited file as root.
With a prefix ARG prompt for a file to visit.
Will also prompt for a file to visit if current
buffer is not visiting a file."
(interactive "P")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
;;;###autoload
(defun ayrc/copy-file-name-to-clipboard ()
"Copy the current buffer file name to the clipboard."
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name))))
(when filename
(kill-new filename)
(message "Copied buffer file name '%s' to the clipboard." filename))))
;;;###autoload
(defun ayrc/dos2unix (_buffer)
"Automate M-% C-q C-m RET C-q C-j RET"
(interactive "*b")
(save-excursion
(goto-char (point-min))
(while (search-forward (string ?\C-m) nil t)
(replace-match (string ?\C-j) nil t))))
;;;###autoload
(defun ayrc/copy-hooks-to (from-hook to-hook)
(dolist (hook from-hook)
(add-hook to-hook hook)))
;;;###autoload
(defun ayrc/executable-find (command)
"Search for COMMAND in `exec-path' and return the absolute file name.
Return nil if COMMAND is not found anywhere in `exec-path'."
;; Use 1 rather than file-executable-p to better match the behavior of
;; call-process.
(locate-file command exec-path exec-suffixes 1))
;;;###autoload
(defun ayrc/local-set-keys (key-commands)
"Set multiple local bindings with KEY-COMMANDS list."
(let ((local-map (current-local-map)))
(dolist (kc key-commands)
(define-key local-map
(kbd (car kc))
(cdr kc)))))
;;;###autoload
(defun ayrc/occur-non-ascii ()
"Find any non-ascii characters in the current buffer."
(interactive)
(occur "[^[:ascii:]]"))
;;;###autoload
(defun ayrc/tabify-buffer ()
"Replace spaces by from buffer."
(interactive)
(tabify (point-min) (point-max)))
;;;###autoload
(defun ayrc/untabify-buffer ()
"Remove tabs from buffer."
(interactive)
(untabify (point-min) (point-max)))
;;;###autoload
(defun ayrc/indent-buffer ()
"Indent region."
(interactive)
(indent-region (point-min) (point-max)))
;;;###autoload
(defun ayrc/cleanup-buffer-notabs ()
"Perform a bunch of operations on the whitespace content of a buffer.
Remove tabs."
(interactive)
(ayrc/indent-buffer)
(ayrc/untabify-buffer)
(delete-trailing-whitespace)
nil)
;;;###autoload
(defun ayrc/cleanup-buffer-tabs ()
"Perform a bunch of operations on the whitespace content of a buffer.
Dont remove tabs."
(interactive)
(ayrc/indent-buffer)
(delete-trailing-whitespace)
nil)
(use-package ledger-mode
:straight t
:mode (("\\.ledger\\'" . ledger-mode))
:hook (ledger-mode . ayrc/ledger-hook)
:init
<<company-ledger-usepkg>>
<<flycheck-ledger-usepkg>>
:config)
(use-package company-ledger
:straight t
:after (ledger-mode)
:commands (company-ledger)
:functions (company-ledger))
(use-package flycheck-ledger
:straight t
:defer t
:after ledger-mode)
;;;###autoload
(defun ayrc/ledger-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company '(company-ledger :with company-yasnippet))
(require 'flycheck-ledger)
(ledger-flymake-enable))
Major mode for editing and validating BibTeX files.
(use-package bibtex
:custom
(bibtex-autokey-year-length 4)
(bibtex-autokey-name-year-separator "-")
(bibtex-autokey-year-title-separator "-")
(bibtex-autokey-titleword-separator "-")
(bibtex-autokey-titlewords 2)
(bibtex-autokey-titlewords-stretch 1)
(bibtex-autokey-titleword-length 5)
:init
<<ebib-usepkg>>
<<helm-bibtex-usepkg>>)
Ebib is a program for managing BibTeX and biblatex databases that runs inside Emacs. It allows you to manage bibliography files without having to edit the raw .bib files.
(use-package ebib
:straight t
:bind (("C-c b" . ebib)))
Search and manage bibliographies in Emacs.
(use-package helm-bibtex
:straight t
:after (:any ebib org tex-mode)
:commands (helm-bibtex))
(use-package org
:defer t
:commands (org-mode)
:hook (org-mode . ayrc/orgmode-hook)
:bind (:map org-mode-map
("C-c M-l" . #'org-cliplink)
("C-c a" . #'org-agenda)
("C-c n a" . #'orb-note-actions)
("C-c h i" . #'helm-org-rifle-current-buffer)
("C-c &" . #'org-mark-ring-goto)
("M-." . #'org-open-at-point)
("M-," . #'org-mark-ring-goto)
("C-c s y" . #'org-download-screenshot)
("C-x r p" . #'ayrc/org-capture-at-point)
("C-x r a" . #'org-capture))
:init
<<org-bullets-usepkg>>
<<org-present-usepkg>>
<<org-cliplink-usepkg>>
<<helm-org-rifle-usepkg>>
<<org-ql-usepkg>>
<<org-super-agenda-usepkg>>
<<org-chef-usepkg>>
<<org-journal-usepkg>>
<<org-ref-usepkg>>
<<org-babel-ledger>>
<<org-roam-usepkg>>
<<org-edna-usepkg>>
<<org-download-usepkg>>
<<org-board-usepkg>>
<<anki-editor-usepkg>>
:custom
(org-log-done 'time)
(org-startup-folded 't)
(org-tags-column -120)
(org-capture-bookmark nil)
(org-src-tab-acts-natively t)
(org-list-allow-alphabetical t)
(org-todo-keywords '((sequence
"TODO(t)" "CURRENT" "WAITING(w)"
"|"
"DONE(d!)" "CANCELED(c@)" "SUSPENDED(s@)")))
(org-todo-keyword-faces '(("CURRENT" . "yellow")
("WAITING" . (:foreground "turquoise2"
:weight bold))
("CANCELED" . (:foreground "RoyalBlue3"
:weight bold))
("SUSPENDED" . (:foreground "magenta3"
:weight bold))))
(org-babel-load-languages '((emacs-lisp . t)
(org . t)
(ledger . t))))
((nil . ((eval
. (let* ((notes-dir (locate-dominating-file default-directory dir-locals-file))
(archives-dir (concat notes-dir "Archives"))
(roam-dir (concat notes-dir "Zettelkasten")))
(setq fill-column 100
org-indent-indentation-per-level 1
org-adapt-indentation nil
calendar-week-start-day 1 ;; Monday
org-id-locations-file (concat notes-dir ".org-id-locations")
org-id-track-globally t
org-return-follows-link t
org-support-shift-select t
org-format-latex-options (plist-put org-format-latex-options :scale 1.5)
anki-editor-api-host "127.0.0.1"
anki-editor-api-port "8765"
org-stuck-projects '("+PROJECT/-DONE" ("CURRENT") nil "")
org-agenda-prefix-format '((agenda . " %i %?-12t% s")
(todo . " %i")
(tags . " %i")
(search . " %i"))
org-ql-views-super-agenda-groups '((:name "Lifestyle"
:tag "lifestyle")
(:name "Courses"
:tag "courses")
(:name "Reading"
:tag "reading")
(:name "Periodical"
:tag "periodical")
(:name "Projects"
:auto-category t
:and (:tag "project"
:not (:tag "courses")
:not (:tag "reading")
:not (:tag "periodical")
:not (:tag "lifestyle")))
(:name "Meta projects"
:auto-category t
:and (:tag "metaproject"
:not (:tag "courses")
:not (:tag "reading")
:not (:tag "periodical")
:not (:tag "lifestyle")))
(:name "Ordinary tasks"
:and (:not (:tag "project")
:not (:tag "metaproject")
:not (:tag "courses")
:not (:tag "periodical")
:not (:tag "lifestyle"))))
org-ql-views '(("(-2) Unordered tasks and projects"
:buffers-files org-agenda-files
:query (and (not (tags-local "now"))
(not (tags-local "ordered"))
(not (tags "films"))
(not (tags "games"))
(not (tags "music"))
(not (tags "periodical"))
(not (tags "work"))
(not (tags-inherited "reading"))
(not (tags-inherited "noagenda"))
(not (tags-local "unordered"))
(todo))
:super-groups org-ql-views-super-agenda-groups
:title "(-2) Unordered tasks and projects")
("(-1) Waiting tasks and projects"
:buffers-files org-agenda-files
:query (and (not (tags "work"))
(not (tags-inherited "noagenda"))
(todo "WAITING"))
:super-groups org-ql-views-super-agenda-groups
:title "(-1) Unordered tasks and projects")
("(0) Now tasks and projects"
:buffers-files org-agenda-files
:query (tags-local "now")
:super-groups org-ql-views-super-agenda-groups
:title "Now tasks and projects")
("(1) Tasks and projects of first order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "1"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of first order")
("(2) Tasks and projects of second order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "2"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of second order")
("(3) Tasks and projects of third order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "3"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of third order")
("(4) Tasks and projects of fourth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "4"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of fourth order")
("(5) Tasks and projects of first fifth"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "5"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of fifth order")
("(6) Tasks and projects of sixth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "6"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of sixth order")
("(7) Tasks and projects of seventh order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "7"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of seventh order")
("(8) Tasks and projects of eighth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "8"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of eighth order")
("(9) Tasks and projects of ninth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "9"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of ninth order")
("(10) Tasks and projects of tenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "10"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of tenth order")
("(11) Tasks and projects of eleventh order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "11"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of eleventh order")
("(12) Tasks and projects of twelfth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "12"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of twelfth order")
("(13) Tasks and projects of thirteenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "13"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of thirteenth order")
("(14) Tasks and projects of fourteenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "14"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of fourteenth order")
("(15) Tasks and projects of fifteenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "15"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of fifteenth order")
("(16) Tasks and projects of sixteenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "16"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of sixteenth order")
("(17) Tasks and projects of seventeenth order"
:buffers-files org-agenda-files
:query (and (tags-local "ordered")
(tags-local "17"))
:super-groups org-ql-views-super-agenda-groups
:title "Tasks and projects of seventeenth order"))
org-agenda-custom-commands '(("o" . "Ordered tasks and projects")
("oa" . "Ordered tasks and projects")
("oan" "Now tasks and projects"
((org-ql-block '(tags-local "now")
((org-ql-block-header "Soon tasks and projects"))
:group)))
("oa1" "Tasks and projects of first order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "1"))
((org-ql-block-header "Tasks and projects of first order"))
:group)))
("oa2" "Tasks and projects of second order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "2"))
((org-ql-block-header "Tasks and projects of second order"))
:group)))
("oa3" "Tasks and projects of third order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "3"))
((org-ql-block-header "Tasks and projects of third order"))
:group)))
("oa4" "Tasks and projects of fourth order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "4"))
((org-ql-block-header "Tasks and projects of fourth order"))
:group)))
("oa5" "Tasks and projects of fifth order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "5"))
((org-ql-block-header "Tasks and projects of fifth order"))
:group)))
("oa6" "Tasks and projects of sixth order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "6"))
((org-ql-block-header "Tasks and projects of sixth order"))
:group)))
("oa7" "Tasks and projects of seventh order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "7"))
((org-ql-block-header "Tasks and projects of seventh order"))
:group)))
("oa8" "Tasks and projects of eighth order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "8"))
((org-ql-block-header "Tasks and projects of eighth order"))
:group)))
("oa9" "Tasks and projects of ninth order"
((org-ql-block '(and (tags-local "ordered")
(tags-local "9"))
((org-ql-block-header "Tasks and projects of ninth order"))
:group)))
("oau" . "Unordered soon tasks and projects")
("oaua" "Unordered soon tasks and projects (ALL EXCEPT READING)"
((org-ql-block '(and (not (tags-local "ordered"))
(not (tags-local "reading"))
(todo))
((org-ql-block-header "Not soon tasks and projects (READING)"))
:group)))
("oaur" "Unordered soon tasks and projects (READING)"
((org-ql-block '(and (not (tags-local "ordered"))
(tags-local "reading")
(todo))
((org-ql-block-header "Not soon tasks and projects (READING)"))
:group)))
("op" . "Ordered projects")
("opn" "Now projects"
((org-ql-block '(and (tags-local "project")
(not (tags-local "now")))
((org-ql-block-header "Now projects"))
:group)))
("op1" "Projects to do in the nearest feature, first of all"
((org-ql-block '(and (tags-local "project")
(tags-local "ordered")
(tags-local "1")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, first of all"))
:group)))
("op2" "Projects to do in the nearest feature, secondarily"
((org-ql-block '(and (tags-local "project")
(tags-local "ordered")
(tags-local "2")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, secondarily"))
:group)))
("op3" "Projects to do in the nearest feature, in the third place"
((org-ql-block '(and (tags-local "project")
(tags-local "ordered")
(tags-local "3")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, in the third place"))
:group)))
("op4" "Projects to do in the nearest feature, fourth"
((org-ql-block '(and (tags-local "project")
(tags-local "ordered")
(tags-local "4")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, fourth"))
:group)))
("ot" . "Ordered tasks")
("otn" "Tasks now"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "now"))
((org-ql-block-header "Tasks now"))
:group)))
("ot1" "Tasks to do in the nearest feature, first of all"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "1")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, first of all"))
:group)))
("ot2" "Tasks to do in the nearest feature, secondarily"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "2")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, secondarily"))
:group)))
("ot3" "Tasks to do in the nearest feature, in the third place"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "3")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, in the third place"))
:group)))
("ot4" "Tasks to do in the nearest feature, fourth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "4")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, fourth"))
:group)))
("ot5" "Tasks to do in the nearest feature, fifth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "5")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, fifth"))
:group)))
("ot6" "Tasks to do in the nearest feature, sixth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "6")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, sixth"))
:group)))
("ot7" "Tasks to do in the nearest feature, seventh"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "7")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, seventh"))
:group)))
("ot8" "Tasks to do in the nearest feature, eighth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "8")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, eighth"))
:group)))
("ot9" "Tasks to do in the nearest feature, ninth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "9")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, ninth"))
:group)))
("u" . "Unordered tasks or projects")
("ua" "Unordered tasks and projects (without films, games, music, periodical, work, and reading)"
((org-ql-block '(and (not (tags-local "now"))
(not (tags-local "ordered"))
(not (tags "films"))
(not (tags "games"))
(not (tags "music"))
(not (tags "periodical"))
(not (tags "work"))
(not (tags-inherited "reading"))
(not (tags-inherited "noagenda"))
(not (tags-local "unordered"))
(not (todo "WAITING"))
(todo))
((org-ql-block-header "Unordered tasks and projects (without films, games, music, periodical, work, and reading)"))
:group)))
("up" "Unordered projects (without films, games, music, periodical, work, and reading)"
((org-ql-block '(and (tags-local "project")
(not (tags-local "now"))
(not (tags-local "ordered"))
(not (tags "films"))
(not (tags "games"))
(not (tags "music"))
(not (tags "periodical"))
(not (tags "work"))
(not (tags-inherited "reading"))
(not (tags-inherited "noagenda"))
(not (tags-local "unordered"))
(not (todo "WAITING"))
(todo))
((org-ql-block-header "Unordered projects (without films, games, music, periodical, work, and reading)"))
:group)))
("ut" "Unordered tasks (without films, games, music, periodical, work, and reading)"
((org-ql-block '(and (not (tags-inherited "project"))
(not (tags-local "now"))
(not (tags-local "ordered"))
(not (tags "films"))
(not (tags "games"))
(not (tags "music"))
(not (tags "periodical"))
(not (tags "work"))
(not (tags-inherited "reading"))
(not (tags-inherited "noagenda"))
(not (tags-local "unordered"))
(not (todo "WAITING"))
(todo))
((org-ql-block-header "Unordered tasks (without films, games, music, periodical, work, and reading)"))
:group)))
("h" "Things to buy"
((org-ql-block '(and (tags "shopping")
(todo)
;; Condition to remove shopping inner tasks from shopping list
(parent (not (todo))))
((org-ql-block-header "Things to buy"))
:group)))
;; Projects
("p" . "Projects")
("pa" "All projects"
((org-ql-block '(and (tags-local "project")
(todo))
((org-ql-block-header "All projects"))
:group)))
("pd" "Done or cancelled projects"
((org-ql-block '(and (tags-local "project")
(done))
((org-ql-block-header "Done or cancelled projects"))
:group)))
("pu" "Unordered projects"
((org-ql-block '(and (tags-local "project")
(not (tags-local "now"))
(not (tags-local "ordered")))
((org-ql-block-header "Unordered projects"))
:group)))
("po" . "Ordered projects")
("pon" "Now projects"
((org-ql-block '(and (tags-local "project")
(not (tags-local "now")))
((org-ql-block-header "Now projects"))
:group)))
("po1" "Projects to do in the nearest feature, first of all"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "1")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, first of all"))
:group)))
("po2" "Projects to do in the nearest feature, secondarily"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "2")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, secondarily"))
:group)))
("po3" "Projects to do in the nearest feature, in the third place"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "3")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, in the third place"))
:group)))
("po4" "Projects to do in the nearest feature, fourth"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "4")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, fourth"))
:group)))
("po5" "Projects to do in the nearest feature, fifth"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "5")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, fifth"))
:group)))
("po6" "Projects to do in the nearest feature, sixth"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "6")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, sixth"))
:group)))
("po7" "Projects to do in the nearest feature, seventh"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "7")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, seventh"))
:group)))
("po8" "Projects to do in the nearest feature, eighth"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "8")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, eighth"))
:group)))
("po9" "Projects to do in the nearest feature, ninth"
((org-ql-block '(and
(tags-local "project")
(tags-local "ordered")
(tags-local "9")
(todo))
((org-ql-block-header "Projects to do in the nearest feature, ninth"))
:group)))
;; Tasks
("t" . "Tasks")
("ta" "All tasks except reading"
((org-ql-block '(and (not (tags-local "project"))
(todo)
(not (tags-inherited "reading")))
((org-ql-block-header "All tasks except reading"))
:group)))
("tr" "All reading tasks"
((org-ql-block '(and (not (tags-local "project"))
(todo)
(tags-inherited "reading"))
((org-ql-block-header "All reading tasks"))
:group)))
("td" "Done or cancelled tasks"
((org-ql-block '(and (not (tags-local "project"))
(done))
((org-ql-block-header "Done or cancelled tasks"))
:group)))
("tu" "Unordered projects"
((org-ql-block '(and (tags-local "project")
(not (tags-local "now"))
(not (tags-local "ordered")))
((org-ql-block-header "Unordered projects"))
:group)))
("to" . "Ordered tasks")
("ton" "Tasks now"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "now"))
((org-ql-block-header "Tasks now"))
:group)))
("to1" "Tasks to do in the nearest feature, first of all"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "1")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, first of all"))
:group)))
("to2" "Tasks to do in the nearest feature, secondarily"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "2")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, secondarily"))
:group)))
("to3" "Tasks to do in the nearest feature, in the third place"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "3")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, in the third place"))
:group)))
("to4" "Tasks to do in the nearest feature, fourth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "4")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, fourth"))
:group)))
("to5" "Tasks to do in the nearest feature, fifth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "5")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, fifth"))
:group)))
("to6" "Tasks to do in the nearest feature, sixth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "6")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, sixth"))
:group)))
("to7" "Tasks to do in the nearest feature, seventh"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "7")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, seventh"))
:group)))
("to8" "Tasks to do in the nearest feature, eighth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "8")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, eighth"))
:group)))
("to9" "Tasks to do in the nearest feature, ninth"
((org-ql-block '(and (not (tags-local "project"))
(tags-local "ordered")
(tags-local "9")
(todo))
((org-ql-block-header "Tasks to do in the nearest feature, ninth"))
:group)))
("w" "Waiting tasks and projects"
((org-ql-block '(todo "WAITING")
((org-ql-block-header "Waiting tasks and projects"))
:group)))
("r" . "Reading")
("ra" . "Articles")
("raa" "All articles"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "articles"))
((org-ql-block-header "All articles"))
:group)))
("rar" "Read articles"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "articles")
(done))
((org-ql-block-header "Read articles"))
:group)))
("rau" "Unread articles"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "articles")
(todo))
((org-ql-block-header "Unread articles"))
:group)))
("rad" "Not archived articles"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "articles")
(not (property "ARCHIVED_AT"))
(todo))
((org-ql-block-header "Not archived articles"))
:group)))
("rb" . "Books")
("rba" "All books"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "books"))
((org-ql-block-header "All books"))
:group)))
("rbr" "Read books"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "books")
(done))
((org-ql-block-header "Read books"))
:group)))
("rbn" "Not read books"
((org-ql-block '(and (tags-inherited "reading")
(tags-inherited "books")
(todo))
((org-ql-block-header "Not read books"))
:group))))
org-roam-capture-templates '(("d" "default" plain "%?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}
#+filetags:
")
:unnarrowed t)
("r" "default-with-reading" plain "%?
* Reading :reading:
** Articles :articles:
** Books :books:
"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}
#+filetags:
")
:unnarrowed t))
org-attach-id-dir (concat roam-dir "/Data")
org-roam-directory (concat roam-dir "/Files")
org-roam-index-file (concat roam-dir "/Index.org")
org-roam-db-location (concat roam-dir "/org-roam.db")
org-roam-ui-open-on-start nil
org-roam-node-display-template "${title:*} ${tags:50}"
org-archive-location (concat archives-dir "/%s_archive::")
org-agenda-files (directory-files-recursively (concat roam-dir "/Files") ".*\.org"))
(make-directory archives-dir t)
(make-directory org-roam-directory t)))))
(org-mode . ((mode . org-roam-db-autosync)
(mode . org-roam-bibtex)
(mode . display-fill-column-indicator))))
(defun ayrc/mark-as-project ()
"This function makes sure that the current heading has
(1) the tag :project:
(2) has property COOKIE_DATA set to \"todo recursive\"
(3) a leading progress indicator"
(interactive)
(org-toggle-tag "project" 'on)
(org-set-property "COOKIE_DATA" "todo recursive")
(org-back-to-heading t)
(let* ((title (nth 4 (org-heading-components)))
(keyword (nth 2 (org-heading-components))))
(when (not (string-prefix-p "[" title))
(forward-whitespace (if (bound-and-true-p keyword) 2 1))
(insert "[/] "))))
;;;###autoload
(defun ayrc/individual-visibility-source-blocks ()
"Fold some blocks in the current buffer."
(interactive)
(org-show-block-all)
(org-block-map
(lambda ()
(let ((case-fold-search t))
(when (and
(save-excursion
(beginning-of-line 1)
(looking-at org-block-regexp))
(cl-assoc
':hidden
(cl-third
(org-babel-get-src-block-info))))
(org-hide-block-toggle))))))
;;;###autoload
(defun ayrc/org-capture-at-point ()
"Insert an org capture template at point."
(interactive)
(org-capture 0))
;;;###autoload
(defun sbr/org-promote-subtree-to-zero ()
"Promote the entire subtree. If the root heading is at level 1,
'promote' it to level 0 by removing the heading."
(interactive)
(if (= (org-current-level) 1)
(progn
(org-mark-subtree)
(org-next-visible-heading 1)
(org-do-promote)
(org-previous-visible-heading 1)
(org-mark-subtree)
(org-toggle-heading))
(org-promote-subtree)))
Show bullets in org-mode as UTF-8 characters
(use-package org-bullets
:straight t
:after org
:commands (org-bullets-mode))
Minimalist presentation minor-mode for Emacs org-mode.
(use-package org-present
:straight t
:after org
:commands (org-present))
Insert org-mode links from the clipboard.
(use-package org-cliplink
:straight t
:after org
:commands (org-cliplink))
This is my rifle. There are many like it, but this one is mine. My rifle is my best friend. It is my life. I must master it as I must master my life.
(use-package helm-org-rifle
:straight t
:after org
:commands (helm-org-rifle-current-buffer))
This package provides a query language for Org files. It offers two syntax styles: Lisp-like sexps and search engine-like keywords.
(use-package org-ql
:straight t
:after org
:config
(require 'org-ql-search))
This package lets you “supercharge” your Org daily/weekly agenda. The idea is to group items into sections, rather than having them all in one big list.
(use-package org-super-agenda
:straight t
:after org)
Package for managing recipes in org-mode. One of the main features is that it can automatically extract recipes from websites like allrecipes.com.
(use-package org-chef
:straight t
:after org)
Functions to maintain a simple personal diary / journal using in Emacs.
(use-package org-journal
:straight t
:after org)
org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
(use-package org-ref
:straight t
:after org
:custom
;; Use org-cite links instead of org-ref
(org-ref-insert-cite-function (lambda ()
(org-cite-insert nil))))
Org-Babel support for evaluating ledger entries.
(use-package ob-ledger
:defer t
:ensure nil
:straight nil
:load-path "contrib/ob-ledger")
Rudimentary Roam replica with Org-mode.
(use-package org-roam
:straight t
:bind (("C-c n i" . org-roam-node-insert)
("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 c" . org-roam-capture))
:init
<<org-roam-ui-usepkg>>
<<org-roam-bibtex-usepkg>>
(require 'org-roam-protocol)
(add-to-list 'safe-local-variable-values '(org-roam-db-autosync-mode . t))
;; Increase to allow to run org-roam-migration-wizard without errors.
(setq max-specpdl-size 10000)
:custom
(org-roam-completion-system 'helm)
(org-roam-tag-sources '(prop last-directory)))
;; Dependency of org-roam-ui
(straight-use-package
`(simple-httpd :type git
:host github
:repo "skeeto/emacs-web-server"
:local-repo "simple-httpd"))
(straight-use-package
' (org-roam-ui :host github
:repo "org-roam/org-roam-ui"
:branch "main"
:files ("*.el" "out")))
(use-package org-roam-ui
:straight t
:after org-roam
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow nil
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
Connector between Org-roam, BibTeX-completion, and Org-ref.
(use-package org-roam-bibtex
:straight t
:commands (orb-note-actions
org-roam-bibtex-mode)
:init
(add-to-list 'safe-local-variable-values '(org-roam-bibtex-mode . t)))
Extensible Dependencies ‘N’ Actions
(use-package org-edna
:straight t
:after org)
This extension facilitates moving screenshots to emacs.
(use-package org-download
:straight t
:after org
:commands (org-download-screenshot)
:custom
(org-download-method 'directory)
(org-download-image-dir "images")
(org-download-heading-lvl nil)
(org-download-timestamp "%Y%m%d-%H%M%S_")
(org-download-screenshot-method "xclip -selection clipboard -t image/png -o > %s"))
Org mode’s web archiver.
(use-package org-board
:straight t
:after org
:commands (org-board-archive
org-board-archive-dry-run))
Emacs minor mode for making Anki cards with Org Mode.
(use-package anki-editor
:after org
:straight (:fork "orgtre"))
;;;###autoload
(defun ayrc/orgmode-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smartparens-mode 1)
(yas-minor-mode 1)
(ayrc/setup-company '(company-yasnippet))
(org-bullets-mode 1)
(org-edna-mode 1)
(snap-indent-mode 1)
(ayrc/individual-visibility-source-blocks))
(use-package eshell
:bind (("C-c e" . eshell))
:config
(add-hook 'eshell-mode-hook 'envrc-modep))
(use-package magit
:straight t
:defines (magit-default-tracking-name-function
magit-status-buffer-switch-function
magit-save-some-buffers
magit-set-upstream-on-push
magit-diff-refine-hunk)
:commands (magit-get-top-dir)
:bind (("C-x g" . magit-status)
("C-x C-g b" . magit-blame-addition))
:hook (git-commit-mode-hook . magit-commit-mode-init)
:init
(progn
(delete 'Git vc-handled-backends)
;; Close popup when commiting - this stops the commit window
;; hanging around
;; From: http://git.io/rPBE0Q
(defadvice git-commit-commit (after delete-window activate)
(delete-window))
(defadvice git-commit-abort (after delete-window activate)
(delete-window))
;; these two force a new line to be inserted into a commit window,
;; which stops the invalid style showing up.
;; From: http://git.io/rPBE0Q
(defun magit-commit-mode-init ()
(when (looking-at "\n")
(open-line 1))))
:config
(progn
(add-hook 'magit-mode-hook 'envrc-mode)
;; restore previously hidden windows
(defadvice magit-quit-window (around magit-restore-screen activate)
(let ((current-mode major-mode))
ad-do-it
(when (eq 'magit-status-mode current-mode)
(jump-to-register :magit-fullscreen))))
;; magit settings
(setq magit-default-tracking-name-function 'magit-default-tracking-name-branch-only
;; open magit status in same window as current buffer
magit-status-buffer-switch-function 'switch-to-buffer
;; highlight word/letter changes in hunk diffs
magit-diff-refine-hunk t
;; ask me to save buffers
magit-save-some-buffers t
;; ask me if I want a tracking upstream
magit-set-upstream-on-push 'askifnotset)))
(use-package dired
:defer t
:hook (dired-mode . ayrc/dired-hook)
:custom
;; for deleting of empty dir
(dired-recursive-deletes 'top)
(dired-recursive-deletes 'always)
(dired-recursive-copies 'always)
;; if there is a dired buffer displayed in the next window, use its
;; current subdir, instead of the current subdir of this dired buffe
(dired-dwim-target t)
(dired-k-style 'git)
:init
<<all-the-icons-dired-usepkg>>
<<dired-k-usepkg>>
:config
;; Enable extra Dired functionality
(require 'dired-x)
(add-hook 'dired-mode-hook 'envrc-mode)
;; Auto-refresh dired on file change
(add-hook 'dired-mode-hook 'auto-revert-mode)
(add-hook 'dired-initial-position-hook 'dired-k))
Adds dired support to all-the-icons.
(use-package all-the-icons-dired
:after dired
:straight t
:commands (all-the-icons-dired-mode))
Highlighting dired buffer like k (ZSH plugin)
(use-package dired-k
:after dired
:straight t
:commands (dired-k))
;;;###autoload
(defun ayrc/kill-dired-buffers ()
(interactive)
(mapc (lambda (buffer)
(when (eq 'dired-mode (buffer-local-value 'major-mode buffer))
(kill-buffer buffer)))
(buffer-list)))
;;;###autoload
(defun ayrc/dired-hook ()
(all-the-icons-dired-mode))
(use-package docker
:straight t
:bind ("C-c d" . docker))
(use-package kubernetes
:straight t
:commands (kubernetes-overview))
- emacs-lsp-booster
- Tool for improving lsp performance
(use-package lisp-mode
:mode (("\\.el\\'" . emacs-lisp-mode)
("bookmarks$" . emacs-lisp-mode)
(".dir-locals.el$" . emacs-lisp-mode)
("\\.rkt\\'" . scheme-mode)
("\\.ss\\'" . scheme-mode)
("\\.scm\\'" . scheme-mode)
("\\.sch\\'" . scheme-mode))
:defines (calculate-lisp-indent-last-sexp)
:hook ((eval-expression-minibuffer-setup
. ayrc/eval-expression-minibuffer-setup-hook)
(ielm-mode . ayrc/emacs-lisp-hook)
(lisp-interaction-mode . ayrc/emacs-lisp-hook)
(emacs-lisp-mode . ayrc/emacs-lisp-hook)
(scheme-mode . ayrc/scheme-hook))
:init
<<rainbow-delimiters-usepkg>>
<<lisp-extra-font-lock-usepkg>>
<<elisp-slime-nav-usepkg>>
<<geiser-usepkg>>
:custom
(lisp-body-indent 4)
:config
<<lisp-indentation-func>>
(setq lisp-indent-function #'ayrc/lisp-indent-function))
Such as parentheses, brackets or braces according to their depth
(use-package rainbow-delimiters
:straight t
:after (:any company)
:commands (rainbow-delimiters-mode))
(use-package lisp-extra-font-lock
:straight t
:after (:any company)
:commands (lisp-extra-font-lock-mode)
:diminish lisp-extra-font-lock-mode)
;;;###autoload
(defun ayrc/lisp-indent-function (indent-point state)
"This function is the normal value of the variable `lisp-indent-function'.
The function `calculate-lisp-indent' calls this to determine
if the arguments of a Lisp function call should be indented specially.
INDENT-POINT is the position at which the line being indented begins.
Point is located at the point to indent under (for default indentation);
STATE is the `parse-partial-sexp' state for that position.
If the current line is in a call to a Lisp function that has a non-nil
property `lisp-indent-function' (or the deprecated `lisp-indent-hook'),
it specifies how to indent. The property value can be:
* `defun', meaning indent `defun'-style
\(this is also the case if there is no property and the function
has a name that begins with \"def\", and three or more arguments);
* an integer N, meaning indent the first N arguments specially
(like ordinary function arguments), and then indent any further
arguments like a body;
* a function to call that returns the indentation (or nil).
`lisp-indent-function' calls this function with the same two arguments
that it itself received.
This function returns either the indentation to use, or nil if the
Lisp function does not specify a special indentation."
(let ((normal-indent (current-column))
(orig-point (point)))
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(cond
;; car of form doesn't seem to be a symbol, or is a keyword
((and (elt state 2)
(or (not (looking-at "\\sw\\|\\s_"))
(looking-at ":")))
(if (not (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp))
(progn (goto-char calculate-lisp-indent-last-sexp)
(beginning-of-line)
(parse-partial-sexp (point)
calculate-lisp-indent-last-sexp 0 t)))
;; Indent under the list or under the first sexp on the same
;; line as calculate-lisp-indent-last-sexp. Note that first
;; thing on that line has to be complete sexp since we are
;; inside the innermost containing sexp.
(backward-prefix-chars)
(current-column))
((and (save-excursion
(goto-char indent-point)
(skip-syntax-forward " ")
(not (looking-at ":")))
(save-excursion
(goto-char orig-point)
(looking-at ":")))
(save-excursion
(goto-char (+ 2 (elt state 1)))
(current-column)))
(t
(let ((function (buffer-substring (point)
(progn (forward-sexp 1) (point))))
method)
(setq method (or (function-get (intern-soft function)
'lisp-indent-function)
(get (intern-soft function) 'lisp-indent-hook)))
(cond ((or (eq method 'defun)
(and (null method)
(> (length function) 3)
(string-match "\\`def" function)))
(lisp-indent-defform state indent-point))
((integerp method)
(lisp-indent-specform method state
indent-point normal-indent))
(method
(funcall method indent-point state))))))))
;;;###autoload
(defun ayrc/lisp-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(yas-minor-mode 1)
(abbrev-mode 1)
(hl-todo-mode 1)
(flycheck-mode 1)
;; eval-expression-minibuffer doesn't support this mode
;; (hs-minor-mode -1)
(aggressive-indent-mode 1)
(add-hook 'after-change-major-mode-hook
(lambda() (electric-indent-mode -1)))
(rainbow-delimiters-mode 1)
(eldoc-mode 1)
(lisp-extra-font-lock-mode 1)
(prettify-symbols-mode 1)
(setq prettify-symbols-unprettify-at-point 'right-edge)
(push '(">=" . ?≥) prettify-symbols-alist)
(push '("<=" . ?≤) prettify-symbols-alist)
(push '("lambda" . ?λ) prettify-symbols-alist)
(snap-indent-mode 1)
(add-hook 'write-contents-functions
'ayrc/cleanup-buffer-notabs nil t))
(use-package elisp-slime-nav
:straight t
:after (:any company)
:commands (elisp-slime-nav-mode)
:diminish elisp-slime-nav-mode)
;;;###autoload
(defun ayrc/emacs-lisp-hook ()
(ayrc/lisp-hook)
(hs-minor-mode t)
(elisp-slime-nav-mode)
(ayrc/setup-company '(company-elisp :with company-yasnippet)))
;;;###autoload
(defun ayrc/eval-expression-minibuffer-setup-hook ()
(ayrc/lisp-hook)
(elisp-slime-nav-mode)
(ayrc/setup-company '(company-elisp :with company-yasnippet)))
- Racket
- General purpose, multi-paradigm Lisp-Scheme programming language
- Guile
- GNU Ubiquitous Intelligent Language for Extensions
(use-package geiser
:straight t
:after (:any company)
:commands (geiser-mode)
:custom
(geiser-active-implementations '(guile racket))
(geiser-repl-query-on-exit-p t))
;;;###autoload
(defun ayrc/scheme-hook ()
(ayrc/lisp-hook)
(hs-minor-mode 1)
(geiser-mode 1)
(ayrc/setup-company '(company-capf :with company-yasnippet)))
(use-package cc-mode
:mode (("\\.h\\'" . c-mode)
("\\.c\\'" . c-mode)
("\\.hpp\\'" . c++-mode)
("\\.cpp\\'" . c++-mode))
:hook ((c-mode . ayrc/c-hook)
(c++-mode . ayrc/cpp-hook))
:init
<<clang-format-usepkg>>
<<irony-usepkg>>
<<gtags-usepkg>>
<<ccls-usepkg>>
<<clangd-setup>>
<<cmake-ide-usepkg>>
<<modern-cpp-font-lock-usepkg>>
<<cc-configuration>>
<<c-configuration>>
<<cpp-configuration>>
:config
(setq c-basic-offset 4
tab-width 4
c-tab-always-indent t
c-default-style '((c-mode . "k&r")
(c++-mode . "stroustrup")
(java-mode . "java"))
c-doc-comment-style '((java-mode . javadoc)
(c-mode . javadoc)
(c++-mode . javadoc))))
;;;###autoload
(defun ayrc/cc-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hs-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
;; Uncomfortable
;; (hungry-delete-mode -1)
;; Setup minor mods if any component need it
(let ((conf-variables-for-cc (list ayrc/cc-eldoc-plugin
ayrc/cc-syntax-check-plugin
ayrc/cc-autocompletion-plugin)))
(if (member "irony" conf-variables-for-cc)
(ayrc/irony-setup))
(if (member "gtags" conf-variables-for-cc)
(ayrc/gtags-setup))
(if (member "ccls" conf-variables-for-cc)
(ayrc/ccls-setup))
(if (member "clangd" conf-variables-for-cc)
(ayrc/clangd-setup)))
;; Autocompletion setup
(funcall (pcase ayrc/cc-autocompletion-plugin
("irony" 'ayrc/irony-autocompletion-setup)
("gtags" 'ayrc/gtags-autocompletion-setup)
("ccls" 'ayrc/ccls-autocompletion-setup)
("clangd" 'ayrc/clangd-autocompletion-setup)))
;; Syntax check setup
(funcall (pcase ayrc/cc-syntax-check-plugin
("irony" 'ayrc/irony-syntax-check-setup)
("gtags" 'ayrc/gtags-syntax-check-setup)
("ccls" 'ayrc/ccls-syntax-check-setup)
("clangd" 'ayrc/clangd-syntax-check-setup)))
;; Eldoc setup
(funcall (pcase ayrc/cc-eldoc-plugin
("irony" 'ayrc/irony-eldoc-setup)
("gtags" 'ayrc/gtags-eldoc-setup)
("ccls" 'ayrc/ccls-eldoc-setup)
("clangd" 'ayrc/clangd-eldoc-setup))))
Format code using clang-format
(use-package clang-format
:straight t
:defer t
:after cc-mode
:commands (clang-format clang-buffer clang-format-region))
A C/C++ minor mode for Emacs powered by libclang
- irony-server
- A C/C++ minor mode for Emacs powered by libclang
(use-package irony
:straight t
:defer t
:after cc-mode
:defines (irony-cdb-compilation-databases)
:diminish irony-mode
:commands (irony-mode)
:init
<<irony-autocompletion-usepkg>>
<<irony-syntax-analytics-usepkg>>
<<irony-eldoc-usepkg>>
<<irony-autocompletion-config>>
<<irony-syntax-analytics-config>>
<<irony-eldoc-config>>
(defun ayrc/irony-setup ()
(ayrc/local-set-keys '(("C-c C-r" . clang-format-region)))
(setq irony-server-install-prefix
(concat user-emacs-directory
"/contrib/servers/irony"))
(irony-mode 1)))
<<irony-company-usepkg>>
<<irony-company-c-headers-usepkg>>
(use-package company-irony
:straight t
:defer t
:after irony
:commands (company-irony
company-irony-setup-begin-commands))
(use-package company-irony-c-headers
:straight t
:defer t
:after irony
:commands (company-irony-c-headers))
(defun ayrc/irony-autocompletion-setup ()
(setq company-irony-ignore-case 'smart
;; Use compilation database first, clang_complete as fallback.
irony-cdb-compilation-databases '(irony-cdb-libclang
irony-cdb-clang-complete))
(ayrc/setup-company '(company-irony :with
company-irony-c-headers
company-yasnippet))
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async)
(irony-cdb-autosetup-compile-options)
;; (optional) adds CC special commands to
;; `company-begin-commands' in order to
;; trigger completion at interesting places, such as after
;; scope operator std::|
(company-irony-setup-begin-commands))
C, C++ and Objective-C support for Flycheck, using Irony Mode
(use-package flycheck-irony
:straight t
:defer t
:after irony
:commands (flycheck-irony-setup))
(defun ayrc/irony-syntax-check-setup ()
(flycheck-mode 1)
(flycheck-irony-setup))
Irony mode support for eldoc-mode
(use-package irony-eldoc
:straight t
:defer t
:after irony
:commands (irony-eldoc))
(defun ayrc/irony-eldoc-setup ()
(eldoc-mode 1)
(irony-eldoc 1))
Emacs frontend to GNU Global source code tagging system
- GNU Global
- tag system to find an object location in various sources
(use-package ggtags
:straight t
:defer t
:after cc-mode
:commands (ggtags-mode)
:init
<<gtags-autocompletion-config>>
<<gtags-syntax-analytics-config>>
<<gtags-eldoc-config>>
(defun ayrc/gtags-setup ()
(ayrc/local-set-keys '(("C-c C-r" . clang-format-region)))
(setq-local imenu-create-index-function
#'ggtags-build-imenu-index)
(ggtags-mode 1)))
(defun ayrc/gtags-autocompletion-setup ()
(ayrc/setup-company '(company-gtags :with company-yasnippet)))
(defun ayrc/gtags-syntax-check-setup ()
(flycheck-mode 1))
(defun ayrc/gtags-eldoc-setup ()
(eldoc-mode 1))
Emacs client for ccls, a C/C++ language server
- ccls
- C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
(use-package ccls
:straight t
:defer t
:after cc-mode
:defines (ccls-extra-init-params)
:diminish ccls-code-lens-mode
:init
<<ccls-autocompletion-config>>
<<ccls-syntax-analytics-config>>
<<ccls-eldoc-config>>
(defun ayrc/ccls-setup ()
(require 'ccls)
(setq ccls-executable (executable-find "ccls"))
;; Log file
;; (setq ccls-args '("--log-file=/tmp/ccls-9999.log"))
(setq ccls-extra-init-params
'(
:index (:comments 2)
:completion (:detailedLabel t)))
;; Add a lot of highlight mistakes
;; (setq ccls-sem-highlight-method 'overlay)
(lsp-deferred)
<<ccls-debug-support>>))
(defun ayrc/ccls-autocompletion-setup ())
(defun ayrc/ccls-syntax-check-setup ())
(defun ayrc/ccls-eldoc-setup ()
(eldoc-mode 1))
(require 'dap-lldb)
(ayrc/dap-remove-nth-first-templates 1)
(dap-register-debug-template
"AYRC Initial Configuration of LLDB::Run"
(list :type "lldb"
:cwd "absolute path to working directory"
:request "launch"
:program "absolute path to executable"
:args (list
"--first_flag"
"--second_flag" "third_argumnt")
:name "LLDB::Run"))
clangd is a language server that can work with many editors via a plugin.
- clangd
- C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
<<clangd-autocompletion-config>>
<<clangd-syntax-analytics-config>>
<<clangd-eldoc-config>>
(defun ayrc/clangd-setup ()
(setq lsp-clangd-binary-path (executable-find "clangd"))
(lsp-deferred))
(defun ayrc/clangd-autocompletion-setup ())
(defun ayrc/clangd-syntax-check-setup ())
(defun ayrc/clangd-eldoc-setup ()
(eldoc-mode 1))
Use Emacs as a C/C++ IDE
(use-package cmake-ide
:straight t
:defer t
:after cc-mode
:commands (cmake-ide-setup))
;;;###autoload
(defun ayrc/c-hook ()
(ayrc/cc-hook)
(setq clang-format-style "Linux"
flycheck-clang-language-standard "c99"
irony-additional-clang-options '("-Wall"
"-Wextra")))
C++ font-lock for Emacs
(use-package modern-cpp-font-lock
:straight t
:defer t
:after cc-mode
:diminish modern-c++-font-lock-mode
:commands (modern-c++-font-lock-mode))
;;;###autoload
(defun ayrc/cpp-hook ()
(ayrc/cc-hook)
(modern-c++-font-lock-mode 1)
(setq clang-format-style "Google"
flycheck-clang-language-standard "c++17"
irony-additional-clang-options '("-Wall"
"-Wextra")))
Python mode settings for Emacs
(use-package python
:mode (("wscript" . python-mode)
("\\.py\\'" . python-mode))
:hook (python-mode . ayrc/python-hook)
:bind (:map python-mode-map
("C-c i" . run-python))
:init
<<venv-support-packages>>
<<sphinx-doc-usepkg>>
<<lsp-pyright-usepkg>>
:config
<<python-install-pkgs>>
(setq
python-indent-offset 4
python-indent-guess-indent-offset-verbose nil
python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt"
python-shell-completion-native-disabled-interpreters '("python")))
Installation path: pyenv -> python -> virtualenv -> install all packages by running function above
- Python
- The Python programming language
- Pyenv
- pyenv-installer and take a look at common build problems
- Pipenv
- Python Development Workflow for Humans
- Poetry
- Python dependency management and packaging made easy
Add language prerequisite to this list after its first mention in list after function definition below:
(defvar ayrc/python-language-prerequisites '()
"Dependencies for fully working python mode")
<<python-pyls>>
<<python-pyls-isort>>
<<python-pyls-black>>
<<python-pylint>>
<<python-jedi>>
<<python-rope>>
<<python-pyflakes>>
<<python-mccabe>>
<<python-pycodestyle>>
<<python-pydocstyle>>
<<python-autopep8>>
<<python-yapf>>
<<python-ipython>>
;;;###autoload
(defun ayrc/install-python-language-prerequisites ()
"Install python language prerequisites.
Prerequisites listed in ayrc/python-language-prerequisites
global variable"
(interactive)
(when (and (buffer-modified-p)
(y-or-n-p (format "Save file %s? " (buffer-file-name))))
(save-buffer))
(let* ((buf-name "*prerequisites-installation*")
(buffer (get-buffer-create buf-name))
(process (get-buffer-process buffer))
(cmd-args (append (list "-m" "pip" "install")
ayrc/python-language-prerequisites)))
(when (and process
(process-live-p process))
(setq buffer (generate-new-buffer buf-name)))
(with-current-buffer buffer
(let ((inhibit-read-only t))
(erase-buffer))
(insert "Installing python language prerequisites\n")
(pythonic-start-process
:process "PrerequisitesInstaller"
:buffer buffer
:args cmd-args)
(move-marker (process-mark (get-buffer-process buffer))
(point-max)
buffer)
(comint-mode)
(setq-local comint-prompt-read-only t)
(pop-to-buffer buffer))))
Prerequisites:
(add-to-list 'ayrc/python-language-prerequisites "python-language-server")
(add-to-list 'ayrc/python-language-prerequisites "pyls-mypy")
(add-to-list 'ayrc/python-language-prerequisites "pyls-isort")
(add-to-list 'ayrc/python-language-prerequisites "pyls-black")
(add-to-list 'ayrc/python-language-prerequisites "pylint")
(add-to-list 'ayrc/python-language-prerequisites "jedi")
(add-to-list 'ayrc/python-language-prerequisites "rope")
(add-to-list 'ayrc/python-language-prerequisites "pyflakes")
(add-to-list 'ayrc/python-language-prerequisites "mccabe")
(add-to-list 'ayrc/python-language-prerequisites "pycodestyle")
(add-to-list 'ayrc/python-language-prerequisites "pydocstyle")
(add-to-list 'ayrc/python-language-prerequisites "autopep8")
(add-to-list 'ayrc/python-language-prerequisites "yapf")
(add-to-list 'ayrc/python-language-prerequisites "ipython")
<<pyenv-mode-usepkg>>
<<pipenv-mode-usepkg>>
<<poetry-usepkg>>
(use-package pyenv-mode
:if (eq system-type 'gnu/linux)
:straight t
:defer t
:after python
:defines (pyenv-show-active-python-in-modeline)
:diminish pyenv-mode
:config
(setq pyenv-show-active-python-in-modeline t))
(use-package pipenv
:straight t
:defer t
:after python
:diminish pipenv-mode
:init
(setq pipenv-with-projectile nil))
(use-package poetry
:straight t
:defer t
:after python)
(use-package lsp-pyright
:straight t)
;;;###autoload
(defun ayrc/python-hook ()
(when (eq system-type 'gnu/linux)
(exec-path-from-shell-initialize))
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
;; Select LSP language server
(cond
((string-equal ayrc/python-lsp-server "pylsp") (require 'lsp-pylsp))
((string-equal ayrc/python-lsp-server "pyright") (require 'lsp-pyright))
((string-equal ayrc/python-lsp-server "ruff") (require 'lsp-ruff))
(t (require 'lsp-pylsp)))
;; Enable debugging support
(require 'dap-python)
(lsp-deferred))
Major mode for editing pip requirements files
(use-package pip-requirements
:straight t
:mode (("requirements.txt$" . pip-requirements-mode)
("requirements.pip$" . pip-requirements-mode))
:hook (pip-requirements-mode . ayrc/pip-hook))
;;;###autoload
(defun ayrc/pip-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1))
Cython mode for Emacs
(use-package cython-mode
:straight t
:mode (("\\.pyx\\'" . cython-mode))
:hook (python-mode . ayrc/cython-hook)
:custom
(cython-indent-offset 4)
(cython-indent-guess-indent-offset-verbose nil))
;;;###autoload
(defun ayrc/cython-hook ()
(when (eq system-type 'gnu/linux)
(exec-path-from-shell-initialize))
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(hindent-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company '(company-yasnippet)))
(use-package tex-mode
:defines (TeX-auto-save
TeX-parse-self
TeX-PDF-mode)
:mode (("\\.tex\\'" . latex-mode)
("\\.def\\'" . latex-mode))
:commands (latex-mode
LaTeX-mode
plain-tex-mode
LaTeX-preview-setup)
:hook ((latex-mode . ayrc/tex-hook)
(LaTeX-mode . ayrc/tex-hook)
(plain-tex-mode . ayrc/tex-hook))
:init
<<auctex-usepkg>>
<<auctex-company-usepkg>>
<<latex-math-company-usepkg>>
<<latex-math-preview-usepkg>>
<<latex-preview-pane-usepkg>>
<<latex-pretty-symbols-usepkg>>)
Sophisticated document creation
(use-package auctex
:straight t
:defer t
:after tex-mode)
Minor mode that enables you to preview your LaTeX files directly in Emacs
(use-package latex-preview-pane
:straight t
:defer t
:after auctex
:commands (latex-preview-pane-enable)
:config (progn
(setq pdf-latex-command "xelatex")))
(setq-default
preview-scale 1.4
preview-scale-function '(lambda ()
(* (/ 10.0 (preview-document-pt))
preview-scale)))
Previews a mathematical expression pointed by the cursor
(use-package latex-math-preview
:straight t
:defer t
:after (auctex))
Makes emacs display unicode characters instead of latex commands
(use-package latex-pretty-symbols
:straight t
:defer t
:after auctex)
(use-package company-math
:straight t
:defer t
:after auctex
:commands (company-math-symbols-latex
company-latex-commands))
company-mode autocompletion for auctex
(use-package company-auctex
:straight t
:defer t
:after auctex
:commands (company-auctex-init))
;;;###autoload
(defun ayrc/tex-hook ()
(setq TeX-auto-save t
TeX-parse-self t
TeX-PDF-mode t)
(setq-default TeX-PDF-mode t)
(setq-default TeX-master nil)
(setq-default TeX-engine 'xetex)
<<latex-separated-preview-setup>>
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
;; Code listings indented too
;; (aggressive-indent-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(hs-minor-mode 1)
(flycheck-mode 1)
(tex-fold-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company '(company-math-symbols-latex
company-latex-commands))
(company-auctex-init)
(LaTeX-preview-setup))
(use-package haskell-mode
:straight t
:defer t
:mode ("\\.hs\\'" . haskell-mode)
:hook ((haskell-mode . ayrc/haskell-hook)
(haskell-literate-mode . ayrc/haskell-hook))
:commands (haskell-mode haskell-literate-mode)
:custom ((haskell-interactive-popup-errors nil)
(haskell-process-suggest-remove-import-lines t)
(haskell-process-auto-import-loaded-modules t)
(haskell-stylish-on-save t))
:init
<<hindent-usepkg>>
<<lsp-haskell-usepkg>>)
(use-package hindent
:straight t
:defer t
:commands (hindent-mode)
:bind (:map hindent-mode-map
("C-c R" . hindent-reformat-buffer)))
(straight-use-package
`(lsp-haskell :type git
:host nil
:repo "https://github.com/emacs-lsp/lsp-haskell.git"))
(use-package lsp-haskell
:straight t)
(defun ayrc/haskell-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(lsp-deferred))
C# mode for Emacs
(use-package csharp-mode
:straight t
:mode (("\\.cs\\'" . csharp-mode))
:hook (csharp-mode . ayrc/csharp-hook)
:functions (assess-face-at=))
;;;###autoload
(defun ayrc/csharp-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/dumb-jump-setup)
(ayrc/setup-company '(company-yasnippet)))
(use-package cperl-mode
:mode ("\.pl$" . cperl-mode)
:hook (cperl-mode . ayrc/perl-hook)
:functions (cperl-set-style)
:custom
(cperl-indent-level 4)
(cperl-continued-statement-offset 4)
(cperl-close-paren-offset -4)
(cperl-label-offset -4)
(cperl-comment-column 40)
(cperl-highlight-variables-indiscriminately t)
(cperl-indent-parens-as-block t)
(cperl-tab-always-indent nil)
(cperl-font-lock t)
:config
(cperl-set-style "PerlStyle"))
;;;###autoload
(defun ayrc/perl-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
VHDL mode for Emacs
(use-package vhdl-mode
:defer t)
(use-package sh-script
:mode (("\\.ebuild\\'" . shell-script-mode)
("\\.sh\\'" . shell-script-mode))
:hook (sh-mode . ayrc/shell-hook)
:init
<<company-shell-usepkg>>
(setq explicit-shell-file-name "/bin/bash")
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name))
(use-package company-shell
:straight t
:defer t
:after sh-script
:commands (company-shell))
;;;###autoload
(defun ayrc/shell-hook()
(setq indent-tabs-mode t)
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(hs-minor-mode 1)
(flycheck-mode 1)
(snap-indent-mode 1)
(setq snap-indent-format 'nil) ;; Remove untabify
(ayrc/setup-company '(company-shell
company-yasnippet)))
(use-package matlab
:straight matlab-mode
:mode ("\\.m$" . matlab-mode)
:hook (matlab-mode . ayrc/matlab-hook)
:custom
(matlab-indent-level 2)
(matlab-indent-function t)
(matlab-shell-command "matlab"))
;;;###autoload
(defun ayrc/matlab-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package tcl
:mode (("\\.tcl$" . tcl-mode)
("\\.pt$" . tcl-mode))
:hook (tcl-mode . ayrc/tcl-hook)
:custom
(tcl-indent-level 2))
;;;###autoload
(defun ayrc/tcl-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package powershell
:straight t
:mode (("\\.ps1\\'" . powershell-mode)
("\\.psc1\\'" . powershell-mode))
:hook (powershell-mode . ayrc/powershell-hook)
:custom
(powershell-indent 4)
(powershell-continuation-indent 2))
;;;###autoload
(defun ayrc/powershell-hook()
(setq indent-tabs-mode t)
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(hs-minor-mode 1)
(flycheck-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package bat-mode
:mode ("\.bat$" . bat-mode)
:hook (bat-mode . ayrc/bat-hook))
;;;###autoload
(defun ayrc/bat-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(highlight-indentation-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(hs-minor-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(smartparens-mode 1)
(smart-shift-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package dockerfile-mode
:straight t
:mode (("Dockerfile'" . dockerfile-mode)
("\\.Dockerfile\\'" . dockerfile-mode))
:hook (dockerfile-mode . ayrc/dockerfile-hook))
;;;###autoload
(defun ayrc/dockerfile-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package nginx-mode
:straight t
:mode (("nginx\.conf\.?.*$" . nginx-mode))
:hook (nginx-mode . ayrc/nginx-hook)
:init
<<company-nginx-usepkg>>)
(straight-use-package
`(company-nginx :type git
:host nil
:repo "https://repo.or.cz/company-nginx.git"))
(use-package company-nginx
:straight t
:defer t
:after (nginx-mode)
:commands (company-nginx-keywords)
:functions (company-nginx-keywords))
;;;###autoload
(defun ayrc/nginx-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company)
(company-nginx-keywords))
(use-package systemd
:straight t
:mode (("\\.service\\'" . systemd-mode)
("\\.target\\'" . systemd-mode)
("\\.socket\\'" . systemd-mode)
("\\.service\\'" . systemd-mode)
("\\.timer\\'" . systemd-mode)
("\\.mount\\'" . systemd-mode)
("\\.automount\\'" . systemd-mode)
("\\.slice\\'" . systemd-mode)
("\\.path\\'" . systemd-mode)
("\\.netdev\\'" . systemd-mode)
("\\.network\\'" . systemd-mode)
("\\.link\\'" . systemd-mode))
:hook (systemd-mode . ayrc/systemd-hook))
;;;###autoload
(defun ayrc/systemd-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package conf-mode
:mode (("\\.toml$" . conf-toml-mode)
("\\.ini$" . conf-windows-mode)
("Pipfile$" . conf-windows-mode))
:hook ((conf-toml-mode-hook . ayrc/conf-hook)
(conf-windows-mode-hook . ayrc/conf-hook)))
;;;###autoload
(defun ayrc/conf-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package plantuml-mode
:straight t
:mode (("\\.plantuml\\'" . plantuml-mode))
:hook (plantuml-mode . ayrc/plantuml-hook)
:init
<<flycheck-plantuml-usepkg>>)
(use-package flycheck-plantuml
:straight t
:defer t
:after plantuml-mode
:commands (flycheck-plantuml-setup))
;;;###autoload
(defun ayrc/plantuml-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company)
(flycheck-plantuml-setup)
(setq plantuml-jar-path "/usr/share/plantuml/lib/plantuml.jar")
(setq plantuml-output-type "svg"))
(use-package dotenv-mode
:straight t
:mode (("\\.env\\'" . dotenv-mode))
:hook (dotenv-mode . ayrc/dotenv-hook))
;;;###autoload
(defun ayrc/dotenv-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package json-mode
:straight t
:mode (("\\.json\\'" . json-mode))
:hook (json-mode . ayrc/json-hook)
:bind (:map json-mode-map
("C-c C-r" . json-pretty-print)))
;;;###autoload
(defun ayrc/json-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(ayrc/setup-company)
(hs-minor-mode 1)
(snap-indent-mode 1)
(setq js-indent-level 4))
- yamllint
- A linter for YAML files
(use-package yaml-mode
:straight t
:mode (("\\.yml\\'" . yaml-mode)
("\\.yaml\\'" . yaml-mode))
:bind (:map yaml-mode-map
("C-c f TAB" . indenation-toggle-fold))
:hook (yaml-mode . ayrc/yaml-hook))
;;;###autoload
(defun ayrc/yaml-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(highlight-indentation-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(outline-minor-mode)
(setq outline-regexp
(format
"^\\([ ]\\{%d\\}\\)*\\([-] \\)?\\([\"][^\"]*[\"]\\|[a-zA-Z0-9_-]*\\): *\\([>|]\\|&[a-zA-Z0-9_-]*\\)?$"
yaml-indent-offset))
(defun yaml-outline-level ()
"Return the outline level based on the indentation"
(s-count-matches (format "[ ]\\{%d\\}" yaml-indent-offset)
(match-string 0)))
(setq outline-level 'yaml-outline-level)
(flycheck-mode 1)
(ayrc/setup-company)
(setq yaml-indent-offset 2))
(use-package nxml-mode
:commands (nxml-mode)
:mode (("\\.xml$" . nxml-mode)
("\\.axml$" . nxml-mode)
("\\.xsl$" . nxml-mode)
("\\.pom$" . nxml-mode)
("\\.xaml$" . nxml-mode))
:hook (nxml-mode . ayrc/nxml-hook))
;;;###autoload
(defun ayrc/nxml-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(hs-minor-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company '(company-nxml :with company-yasnippet)))
(use-package jinja2-mode
:straight t
:commands (jinja2-mode)
:mode (("\\.j2\\'" . jinja2-mode))
:hook (jinja2-mode . ayrc/jinja2-hook))
;;;###autoload
(defun ayrc/jinja2-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package rst
:mode (("\\.txt$" . rst-mode)
("\\.rst$" . rst-mode))
:hook (rst-mode . ayrc/rst-hook))
;;;###autoload
(defun ayrc/rst-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
- python-markdown2
- A fast and complete implementation of Markdown
(use-package markdown-mode
:straight t
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:hook (markdown-mode . ayrc/markdown-hook)
:init
<<markdown-plus-usepkg>>
<<markdown-preview-usepkg>>)
Additional functions for Emacs [markdown-mode]
(use-package markdown-mode+
:straight t
:defer t
:after markdown-mode
:commands (markdown-cleanup-list-numbers
markdown-export-latex
markdown-copy-html
markdown-copy-rtf))
(use-package markdown-preview-mode
:straight t
:defer t
:after markdown-mode
:commands (markdown-preview-mode
markdown-preview-open-browser
markdown-preview-cleanup)
:defines (markdown-preview-stylesheets
markdown-preview-javascript)
:config
(add-to-list 'markdown-preview-stylesheets
"https://raw.githubusercontent.com/richleland/pygments-css/master/emacs.css")
(add-to-list 'markdown-preview-javascript
"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML")
(add-to-list 'markdown-preview-javascript
'("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" . async)))
;;;###autoload
(defun ayrc/markdown-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company)
(setq markdown-command "markdown2"))
(use-package make-mode
:mode (("[Mm]akefile\\'" . makefile-gmake-mode))
:hook ((makefile-mode . ayrc/make-hook)
(makefile-gmake-mode . ayrc/make-hook)
(makefile-imake-mode . ayrc/make-hook)
(makefile-bsdmake-mode . ayrc/make-hook)
(makefile-automake-mode . ayrc/make-hook)
(makefile-mode . ayrc/make-hook)))
Package is not ready yet.
(use-package company-makefile
:straight t
:commands (company-makefile-init company-makefile-capf))
;;;###autoload
(defun ayrc/make-hook ()
(setq indent-tabs-mode t)
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(setq snap-indent-format 'nil) ;; Remove untabify
(ayrc/setup-company '(company-capf :with company-yasnippet)))
(use-package cmake-mode
:straight t
:mode (("CMakeLists.txt$" . cmake-mode)
("\\.cmake\\'" . cmake-mode))
:hook (cmake-mode . ayrc/cmake-hook)
:init
<<cmake-font-lock-usepkg>>
:config
(setq cmake-tab-width 4))
Emacs Font-lock rules for CMake
(use-package cmake-font-lock
:straight t
:after cmake-mode
:defer t
:commands (cmake-font-lock-setup)
:config
(defun ayrc/cmake-font-lock-activate ()
"Activate advanced CMake colorization.
To activate this every time a CMake file is opened, use the following:
(add-hook 'cmake-mode-hook 'cmake-font-lock-activate)"
(interactive)
(cmake-font-lock-setup)
(when (boundp 'font-lock-set-defaults)
(kill-local-variable 'font-lock-set-defaults))
(when (and (boundp 'font-lock-mode) font-lock-mode)
(font-lock-mode -1)
(font-lock-mode 1))))
;;;###autoload
(defun ayrc/cmake-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
;; Conflicts with cmake-font-lock mode
;; (hl-todo-mode 1)
(ayrc/setup-company '(company-cmake :with company-yasnippet))
(hs-minor-mode 1)
(snap-indent-mode 1)
(flycheck-mode 1)
(ayrc/cmake-font-lock-activate))
(use-package meson-mode
:straight t
:mode (("meson.build$" . meson-mode)
("meson.options$" . meson-mode))
:hook (meson-mode . ayrc/meson-hook))
;;;###autoload
(defun ayrc/meson-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(ayrc/setup-company)
(hs-minor-mode 1)
(snap-indent-mode 1)
(flycheck-mode 1))
(use-package nix-mode
:straight t
:mode (("\\.nix\\'" . nix-mode))
:hook (nix-mode . ayrc/nix-hook))
;;;###autoload
(defun ayrc/nix-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(hs-minor-mode 1)
(snap-indent-mode 1)
(flycheck-mode 1)
(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
:major-modes '(nix-mode)
:server-id 'nix))
(lsp-deferred))
(straight-use-package
`(mmm-mode :type git
:host github
:repo "purcell/mmm-mode"))
(use-package bitbake
:straight t
:mode (("\\.bb$" . bitbake-mode)
("\\.inc$" . bitbake-mode)
("\\.bbappend$" . bitbake-mode)
("\\.bbclass$" . bitbake-mode))
:hook (bitbake-mode . ayrc/bitbake-hook))
;;;###autoload
(defun ayrc/bitbake-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(ayrc/setup-company '(company-cmake :with company-yasnippet))
(hs-minor-mode 1)
(flycheck-mode 1)
(snap-indent-mode 1))
(use-package dts-mode
:straight t
:mode (("\\.dts$" . dts-mode)
("\\.dtsi$" . dts-mode))
:hook (dts-mode . ayrc/dts-hook))
;;;###autoload
(defun ayrc/dts-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package lua-mode
:straight t
:mode (("\\.lua$" . lua-mode))
:hook (lua-mode . ayrc/lua-hook)
:custom
(lua-indent-level 2))
;;;###autoload
(defun ayrc/lua-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode -1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hl-todo-mode 1)
(snap-indent-mode 1)
(ayrc/setup-company))
(use-package rustic
:straight t
:hook (rustic-mode . ayrc/rust-hook)
:config
(setq rustic-format-on-save nil))
;;;###autoload
(defun ayrc/rust-hook ()
(envrc-mode 1)
(display-line-numbers-mode 1)
(visual-line-mode 1)
(ws-butler-mode 1)
(smart-shift-mode 1)
(smartparens-mode 1)
(abbrev-mode 1)
(yas-minor-mode 1)
(hs-minor-mode 1)
(hl-todo-mode 1)
;; Disable due to lack of performance
;; https://github.com/brotzeit/rustic/issues/107
(adaptive-wrap-prefix-mode -1)
(snap-indent-mode 1))