update to lsp mode

master
Rostyslav Hnatyshyn 3 years ago
parent 1cabbbed46
commit 4ce08af69a
  1. 592
      emacs
  2. 175
      emacs_home.el

592
emacs

@ -13,13 +13,37 @@
(setq-default cursor-type 'bar)
(global-hl-line-mode 1)
(toggle-scroll-bar -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(column-number-mode t)
(set-fringe-mode 10)
(set-fringe-mode 5)
(setq doc-view-scale-internally nil)
(setq visible-bell t)
(setq vc-handled-backends nil)
(fset 'yes-or-no-p 'y-or-n-p)
(show-paren-mode t)
(setq show-paren-style 'expression)
(save-place-mode t)
(setq-default indent-tabs-mode nil
tab-width 4)
(set-language-environment "utf-8")
(prefer-coding-system 'utf-8-unix)
(set-locale-environment "en_US.UTF-8")
(set-default-coding-systems 'utf-8-unix)
(set-selection-coding-system 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)
(set-clipboard-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)
(defun remove-scratch-buffer ()
(if (get-buffer "*scratch*")
(kill-buffer "*scratch*")))
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)
(setf epa-pinentry-mode 'loopback)
@ -59,16 +83,106 @@ Return a list of installed packages or nil for every skipped package."
(or (file-exists-p package-user-dir)
(package-refresh-contents))
(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'eglot 'dashboard 'multiple-cursors 'flycheck 'which-key 'doom-themes 'rainbow-mode 'rainbow-delimiters 'all-the-icons 'elpy 'rustic 'simpleclip 'messages-are-flowing 'hl-todo 'powerline 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam 'smex 'smartparens 'origami 'dumb-jump 'kaolin-themes 'company-quickhelp 'treemacs 'treemacs-projectile 'treemacs-magit 'treemacs-icons-dired 'org-mime 'hydra 'verb 'telephone-line 'bm 'undo-fu 'ranger)
(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'lsp-mode 'lsp-ui 'lsp-ivy 'dashboard 'flycheck 'which-key 'doom-themes 'rainbow-mode 'rainbow-delimiters 'all-the-icons 'rustic 'simpleclip 'hl-todo 'powerline 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam 'smex 'smartparens 'origami 'company-quickhelp 'org-mime 'verb 'telephone-line 'undo-fu 'neotree 'restart-emacs 'git-timemachine 'org-super-agenda 'pyvenv)
;; need it after installation - makes it possible to bootstrap
;; need this after installation - makes it possible to bootstrap
(eval-when-compile
(require 'use-package))
(use-package ranger
(use-package flycheck
:hook (prog-mode . flycheck-mode)
:config (setq flycheck-checker-error-threshold 1000))
(use-package company
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0)
(company-tooltip-align-annotations t)
:config
(global-company-mode)
)
(use-package company-quickhelp
:ensure t
:init
(company-quickhelp-mode))
(use-package lsp-mode
:after company
:commands lsp
:config
(flyspell-prog-mode)
(setq gc-cons-threshold 100000000
read-process-output-max (* 1024 1024)
lsp-completion-provider :capf
lsp-keep-workspace-alive nil
lsp-enable-xref t
lsp-enable-indentation t
lsp-signature-auto-activate t
lsp-idle-delay 0.2
create-lockfiles nil
lsp-enable-on-type-formatting t
lsp-before-save-edits t
lsp-enable-imenu nil
lsp-completion-enable t
lsp-enable-snippet nil
lsp-eldoc-render-all t
lsp-enable-file-watchers nil
lsp-enable-folding nil
lsp-modeline-diagnostics-enable nil
lsp-headerline-breadcrumb-enable nil
lsp-semantic-tokens-enable nil)
:hook ((js-mode js-jsx-mode python-mode svelte-mode ) . lsp-deferred)
)
(with-eval-after-load 'js
(define-key js-mode-map (kbd "M-.") nil))
(use-package lsp-pyright
:ensure t
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred))))
(use-package yasnippet
:defer nil
:hook (lsp-mode . yas-minor-mode)
:diminish yas-minor-mode
:custom
(yas-indent-line nil)
(yas-inhibit-overlap-modification-protection t)
:custom-face
(yas-field-highlight-face ((t (:inherit region)))))
(use-package lsp-ui
:after flycheck
:diminish
:commands lsp-ui-mode
:bind
(:map lsp-ui-mode-map
("M-i" . lsp-ui-doc-focus-frame))
:custom
(lsp-ui-flycheck-enable t)
(lsp-ui-doc-header t)
(lsp-ui-doc-show-with-cursor t)
(lsp-ui-doc-include-signature t)
(lsp-ui-sideline-show-code-actions t)
(lsp-ui-doc-delay 0.2)
(lsp-ui-peek-enable t)
(lsp-ui-peek-show-directory nil)
:hook
(lsp-mode . lsp-ui-mode)
)
(use-package pyvenv
:defer t)
(use-package neotree
:config
(setq ranger-preview-file nil)
(ranger-override-dired-mode t))
(global-set-key [f8] 'neotree-toggle)
(setq neo-show-hidden-files t
neo-theme 'icons
neo-smart-open t))
(use-package undo-fu
:config
@ -81,215 +195,77 @@ Return a list of installed packages or nil for every skipped package."
(setq telephone-line-primary-left-separator 'telephone-line-cubed-left
telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
telephone-line-primary-right-separator 'telephone-line-cubed-right
telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right)
(setq telephone-line-height 24)
telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right
telephone-line-height 24)
:config
(telephone-line-mode 1))
(use-package magit
:defer
:ensure t)
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display t
treemacs-file-event-delay 5000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch t
treemacs-silent-refresh t
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(treemacs-git-mode 'deferred))
;; (use-package bm
;; :ensure t
;; :demand t
;; :init
;; (setq bm-restore-repository-on-load t)
;; (setq bm-repository-file "~/.emacs.d/bm-repository")
;; ;; save bookmarks
;; (setq-default bm-buffer-persistence t)
;; :config
;; (add-hook 'after-init-hook 'bm-repository-load)
;; ;; Saving bookmarks
;; (add-hook 'kill-buffer-hook #'bm-buffer-save)
;; (add-hook 'kill-emacs-hook #'(lambda nil
;; (bm-buffer-save-all)
;; (bm-repository-save)))
;; (add-hook 'find-file-hook #'bm-buffer-restore)
;; :bind (("<f2>" . bm-next)
;; ("S-<f2>" . bm-previous)
;; ("C-<f2>" . bm-toggle)))
;; (global-set-key (kbd "<left-fringe> <mouse-5>") 'bm-next-mouse)
;; (global-set-key (kbd "<left-fringe> <mouse-4>") 'bm-previous-mouse)
;; (global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
(use-package origami
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("<f8>" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-projectile
:after (treemacs projectile)
:ensure t)
(use-package treemacs-icons-dired
:hook (dired-mode . treemacs-icons-dired-enable-once)
:ensure t)
(use-package treemacs-magit
:after (treemacs magit)
:ensure t)
(use-package bm
:ensure t
:demand t
:init
;; restore on load (even before you require bm)
(setq bm-restore-repository-on-load t)
:config
;; Allow cross-buffer 'next'
(setq bm-cycle-all-buffers t)
;; where to store persistant files
(setq bm-repository-file "~/.emacs.d/bm-repository")
;; save bookmarks
(setq-default bm-buffer-persistence t)
;; Loading the repository from file when on start up.
(add-hook 'after-init-hook 'bm-repository-load)
;; Saving bookmarks
(add-hook 'kill-buffer-hook #'bm-buffer-save)
;; Saving the repository to file when on exit.
;; kill-buffer-hook is not called when Emacs is killed, so we
;; must save all bookmarks first.
(add-hook 'kill-emacs-hook #'(lambda nil
(bm-buffer-save-all)
(bm-repository-save)))
;; The `after-save-hook' is not necessary to use to achieve persistence,
;; but it makes the bookmark data in repository more in sync with the file
;; state.
(add-hook 'after-save-hook #'bm-buffer-save)
;; Restoring bookmarks
(add-hook 'find-file-hooks #'bm-buffer-restore)
(add-hook 'after-revert-hook #'bm-buffer-restore)
;; The `after-revert-hook' is not necessary to use to achieve persistence,
;; but it makes the bookmark data in repository more in sync with the file
;; state. This hook might cause trouble when using packages
;; that automatically reverts the buffer (like vc after a check-in).
;; This can easily be avoided if the package provides a hook that is
;; called before the buffer is reverted (like `vc-before-checkin-hook').
;; Then new bookmarks can be saved before the buffer is reverted.
;; Make sure bookmarks is saved before check-in (and revert-buffer)
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
:bind (("<f2>" . bm-next)
("S-<f2>" . bm-previous)
("C-<f2>" . bm-toggle))
)
(global-set-key (kbd "<left-fringe> <mouse-5>") 'bm-next-mouse)
(global-set-key (kbd "<left-fringe> <mouse-4>") 'bm-previous-mouse)
(global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
(use-package dumb-jump)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
(setq xref-show-definitions-function #'xref-show-definitions-completing-read)
(use-package origami)
(bind-keys
:map origami-mode-map
("C-c C-<tab>" . origami-toggle-node))
(:map origami-mode-map
("C-c C-<tab>" . origami-toggle-node)))
(add-hook 'prog-mode-hook #'origami-mode)
(use-package smartparens-config
:config
(add-hook 'prog-mode-hook #'smartparens-mode))
(bind-keys
:map smartparens-mode-map
:bind
(:map smartparens-mode-map
("C-M-a" . sp-beginning-of-sexp)
("C-M-e" . sp-end-of-sexp)
("C-<down>" . sp-down-sexp)
("C-<up>" . sp-up-sexp)
("M-<down>" . sp-backward-down-sexp)
("M-<up>" . sp-backward-up-sexp)
("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-S-f" . sp-forward-symbol)
("C-S-b" . sp-backward-symbol)
("C-<right>" . sp-forward-slurp-sexp)
("M-<right>" . sp-forward-barf-sexp)
("C-<left>" . sp-backward-slurp-sexp)
("M-<left>" . sp-backward-barf-sexp)
("C-M-t" . sp-transpose-sexp)
("C-M-k" . sp-kill-sexp)
("C-k" . sp-kill-hybrid-sexp)
("M-k" . sp-backward-kill-sexp)
("C-M-w" . sp-copy-sexp)
("C-M-d" . delete-sexp)
("M-<backspace>" . backward-kill-word)
("C-<backspace>" . sp-backward-kill-word)
([remap sp-backward-kill-word] . backward-kill-word)
("M-[" . sp-backward-unwrap-sexp)
("M-]" . sp-unwrap-sexp)
("C-x C-t" . sp-transpose-hybrid-sexp)
("C-c (" . wrap-with-parens)
("C-c [" . wrap-with-brackets)
("C-c {" . wrap-with-braces)
@ -297,28 +273,21 @@ Return a list of installed packages or nil for every skipped package."
("C-c \"" . wrap-with-double-quotes)
("C-c _" . wrap-with-underscores)
("C-c `" . wrap-with-back-quotes))
:config
(add-hook 'prog-mode-hook #'smartparens-mode))
(use-package company)
(add-hook 'after-init-hook 'global-company-mode)
(company-quickhelp-mode)
(use-package eglot :ensure t)
(add-hook 'c++-mode-hook 'eglot-ensure)
(add-hook 'c-mode-hook 'eglot-ensure)
(add-hook 'js-mode-hook 'eglot-ensure)
(use-package centaur-tabs :init
(use-package centaur-tabs
:init
(setq centaur-tabs-enable-key-bindings t
centaur-tabs-set-icons t
centaur-tabs-set-modified-marker t
centaur-tabs-style "chamfer"
centaur-tabs-gray-out-icons 'buffer))
;;(centaur-tabs-group-by-projectile-project) breaks w/ buffers unrelated to projects
centaur-tabs-gray-out-icons 'buffer)
:config
(centaur-tabs-group-by-projectile-project)
(centaur-tabs-headline-match)
(centaur-tabs-mode 1)
(use-package flycheck)
(centaur-tabs-mode 1))
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
@ -331,34 +300,14 @@ Return a list of installed packages or nil for every skipped package."
:config
(which-key-mode))
(use-package dashboard
:init
(setq dashboard-set-footer nil
dashboard-org-agenda-categories '("Tasks" "appointments")
dashboard-center-content t
dashboard-set-heading-icons t
dashboard-set-file-icons t)
:ensure t
:config (dashboard-setup-startup-hook))
(use-package multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(use-package elpy
:ensure t
:defer t
:init
(advice-add 'python-mode :before 'elpy-enable)
:config
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
;; (use-package multiple-cursors)
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
;; (global-set-key (kbd "C->") 'mc/mark-next-like-this)
;; (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
;; (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(use-package ivy :ensure t
:diminish ivy-mode
:init (setq projectile-completion-system 'ivy)
:config
(ivy-mode 1)
(setq ivy-height 13)
@ -366,13 +315,15 @@ Return a list of installed packages or nil for every skipped package."
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) "))
(use-package lsp-ivy
:after lsp-mode ivy
:commands lsp-ivy-workspace-symbol)
(use-package counsel
:ensure t
:bind*
(("M-x" . counsel-M-x)
("C-c d d" . counsel-descbinds)
("C-c s s" . counsel-ag)
("C-c s d" . counsel-ag-projectile)
("C-x C-f" . counsel-find-file)
("C-x r f" . counsel-recentf)
("C-c g g" . counsel-git)
@ -394,43 +345,188 @@ Return a list of installed packages or nil for every skipped package."
:ensure t
:init
(projectile-mode +1)
:config
(setq projectile-sort-order 'recentf
projectile-require-project-root t
projectile-completion-system 'ivy
projectile-switch-project-action 'neotree-projectile-action)
:bind (:map projectile-mode-map
("s-p" . projectile-command-map)
("C-c p" . projectile-command-map)))
(setq projectile-sort-order 'recentf)
(setq projectile-require-project-root t)
(setq projectile-completion-system 'ivy)
(defun trigger-org-company-complete ()
"Begins company-complete in org-mode buffer after pressing #+ chars."
(interactive)
(if (string-equal "#" (string (preceding-char)))
(progn
(insert "+")
(company-complete))
(insert "+")))
;; org settings
(use-package org
:mode ("\\.org\\'" . org-mode)
:config (define-key org-mode-map (kbd "C-c C-r") verb-command-map))
(setq org-replace-disputed-keys t)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-log-done t)
(setq org-startup-with-inline-images t)
(setq org-startup-with-latex-preview t)
(setq-default org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%a %b %e %Y>" . "<%a %b %e %Y %H:%M>"))
; agenda settings
(setq org-agenda-include-diary t)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-skip-deadline-if-done t)
(setq org-agenda-todo-ignore-deadlines t)
(setq org-agenda-todo-ignore-with-date t)
(setq org-agenda-todo-ignore-scheduled t)
(setq org-agenda-start-on-weekday nil)
(setq org-agenda-start-day "+0d")
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)
:bind
(:map org-mode-map
("C-c C-r" . verb-command-map)
("+" . 'trigger-org-company-complete))
(:map global-map
("C-c a" . org-agenda)
("C-c l" . org-store-link))
:config
(setq org-replace-disputed-keys t
org-enforce-todo-dependencies t
org-enforce-todo-checkbox-dependencies t
org-log-done nil
org-clock-idle-time 10
org-startup-with-inline-images t
org-startup-folded t
org-pretty-entities t
org-hide-leading-stars t
org-hide-emphasis-markers t
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-startup-with-latex-preview t
org-src-tab-acts-natively t
org-src-fontify-natively t
org-confirm-elisp-link-function nil
org-display-custom-times t
org-time-stamp-custom-formats '("<%a %b %e %Y>" . "<%a %b %e %Y %H:%M>")
org-tag-alist '(("bug" . ?b) ("feature" . ?f) ("polish" . ?p) ("optimization" . ?o) ("devops" . ?d) ("reading" . ?r) ("writing" . ?w))
org-agenda-custom-commands
'(("p" "Projects" todo "TODO"
((org-agenda-files '("~/Documents/org-mode/projects.org"))
(org-agenda-sorting-strategy '(priority-down)))
))
org-agenda-skip-scheduled-if-done t
org-agenda-skip-deadline-if-done t
org-agenda-todo-ignore-deadlines t
org-agenda-todo-ignore-with-date t
org-agenda-todo-ignore-scheduled t
org-agenda-start-on-weekday nil
org-agenda-skip-additional-timestamps-same-entry nil
org-agenda-compact-blocks t
org-agenda-block-separator nil
org-agenda-start-day "+0d")
:hook
(org-agenda-mode . origami-mode)
)
(use-package org-super-agenda
:after org
:ensure t
:config
(setq org-super-agenda-groups
'(
(:auto-category t)
)
)
)
(use-package dashboard
:after org
:init
(setq dashboard-set-footer nil
dashboard-org-agenda-categories '("Tasks" "appointments")
dashboard-center-content t
dashboard-set-heading-icons t
dashboard-set-file-icons t
initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
:ensure t
:config (dashboard-setup-startup-hook))
(use-package org-projectile
:after org
:bind ("C-c n p" . org-projectile-project-todo-completing-read)
:config
(progn
(setq org-projectile-projects-file
"~/Documents/org-mode/projects.org")
;;(setq org-agenda-files (append org-agenda-files (org-projectile-todo-files)))
(push (org-projectile-project-todo-entry) org-capture-templates))
:ensure t)
(add-hook 'text-mode-hook 'turn-on-visual-line-mode)
(use-package org-alert
:ensure t
:config
(org-alert-enable)
(setq alert-default-style 'libnotify
org-alert-notify-cutoff 300
))
(add-hook 'org-mode-hook 'flyspell-mode)
(setq org-agenda-files
(list
"~/Documents/org-mode/school.org"
"~/Documents/org-mode/personal.org"
"~/Documents/org-mode/tweaking.org"
"~/Documents/org-mode/projects.org"
)
)
(use-package org-roam
:ensure t
:after org
:init
(setq org-roam-v2-ack t)
:bind* (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n c" . org-roam-dailies-capture-today))
:bind (:map org-mode-map
("C-c n i" . org-roam-node-insert))
:custom
(org-roam-directory "~/Documents/slipbox")
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("e" "encrypted" plain "%?"
:target (file+head "${slug}.org.gpg"
"#+title: ${title}\n")
:unnarrowed t)
)
)
(org-roam-completion-everywhere t)
(org-roam-completion-system 'default)
(org-roam-dailies-directory "daily/")
:config
(use-package org-roam-dailies)
(org-roam-setup)
(org-roam-db-autosync-mode))
(use-package rustic
:config
(setq rustic-cargo-clippy-trigger-fix 'on-compile))
;;(push 'rustic-clippy flycheck-checkers)
(use-package all-the-icons)
(defun notify-send (title msg)
(interactive)
;; only the first line of the message is returned
;; (subseq msg 0 (search msg "\n"))
(shell-command (concat "notify-send '" title "' '" msg "'")))
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
;;(use-package org-notify)
;;(org-notify-start)
;;(org-notify-add 'appt
;; '(:time "15m" :period "5m" :duration "30s" :action (notify-send org-notify-action-message)))
;;(add-hook 'org-mode-hook 'flyspell-mode 1)
;;(setq appt-disp-window-function (function facade-notify-appt))
(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
(cond ((file-exists-p "~/.emacs_work.el") (load "~/.emacs_work.el")))
;;(load-library ".emacs_home")
;;(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
;;(cond ((file-exists-p "~/.emacs_work.el") (load "~/.emacs_work.el")))
;;; .emacs ends here

@ -1,177 +1,2 @@
(setq org-agenda-files (list "~/Documents/home-org-mode/tweaking.org"
"~/Documents/org-mode/school.org"
"~/Documents/home-org-mode/untitled_project.org"
"~/Documents/home-org-mode/personal.org"))
(set-frame-font "Iosevka:size=16" nil t)
(ensure-package-installed 'rustic)
(use-package rustic
:config
(setq rustic-lsp-client 'eglot)
(setq rustic-cargo-clippy-trigger-fix 'on-compile))
(push 'rustic-clippy flycheck-checkers)
;;(add-hook 'eglot--managed-mode-hook (lambda () (flymake-mode -1)))
(eval-after-load 'gnus-group
'(progn
(defhydra hydra-gnus-group (:color blue)
"
[_A_] Remote groups (A A) [_g_] Refresh
[_L_] Local groups [_\\^_] List servers
[_c_] Mark all read [_m_] Compose new mail
[_G_] Search mails (G G) [_#_] Mark mail
"
("A" gnus-group-list-active)
("L" gnus-group-list-all-groups)
("c" gnus-topic-catchup-articles)
("G" dianyou-group-make-nnir-group)
("g" gnus-group-get-new-news)
("^" gnus-group-enter-server-mode)
("m" gnus-group-new-mail)
("#" gnus-topic-mark-topic)
("q" nil))
;; y is not used by default
(define-key gnus-group-mode-map "y" 'hydra-gnus-group/body)))
;; gnus-summary-mode
(eval-after-load 'gnus-sum
'(progn
(defhydra hydra-gnus-summary (:color blue)
"
[_s_] Show thread [_F_] Forward (C-c C-f)
[_h_] Hide thread [_e_] Resend (S D e)
[_n_] Refresh (/ N) [_r_] Reply
[_!_] Mail -> disk [_R_] Reply with original
[_d_] Disk -> mail [_w_] Reply all (S w)
[_c_] Read all [_W_] Reply all with original (S W)
[_#_] Mark [_G_] Search mails
"
("s" gnus-summary-show-thread)
("h" gnus-summary-hide-thread)
("n" gnus-summary-insert-new-articles)
("F" gnus-summary-mail-forward)
("!" gnus-summary-tick-article-forward)
("d" gnus-summary-put-mark-as-read-next)
("c" gnus-summary-catchup-and-exit)
("e" gnus-summary-resend-message-edit)
("R" gnus-summary-reply-with-original)
("r" gnus-summary-reply)
("W" gnus-summary-wide-reply-with-original)
("w" gnus-summary-wide-reply)
("#" gnus-topic-mark-topic)
("G" dianyou-group-make-nnir-group)
("q" nil))
;; y is not used by default
(define-key gnus-summary-mode-map "y" 'hydra-gnus-summary/body)))
;; gnus-article-mode
(eval-after-load 'gnus-art
'(progn
(defhydra hydra-gnus-article (:color blue)
"
[_o_] Save attachment [_F_] Forward
[_v_] Play video/audio [_r_] Reply
[_d_] CLI to download stream [_R_] Reply with original
[_b_] Open external browser [_w_] Reply all (S w)
[_f_] Click link/button [_W_] Reply all with original (S W)
[_g_] Focus link/button
"
("F" gnus-summary-mail-forward)
("r" gnus-article-reply)
("R" gnus-article-reply-with-original)
("w" gnus-article-wide-reply)
("W" gnus-article-wide-reply-with-original)
("o" gnus-mime-save-part)
("v" w3mext-open-with-mplayer)
("d" w3mext-download-rss-stream)
("b" w3mext-open-link-or-image-or-url)
("f" w3m-lnum-follow)
("g" w3m-lnum-goto)
("q" nil))
;; y is not used by default
(define-key gnus-article-mode-map "y" 'hydra-gnus-article/body)))
;; message-mode
(eval-after-load 'message
'(progn
(defhydra hydra-message (:color blue)
"
[_c_] Complete mail address
[_a_] Attach file
[_s_] Send mail (C-c C-c)
"
("c" counsel-bbdb-complete-mail)
("a" mml-attach-file)
("s" message-send-and-exit)
("i" dianyou-insert-email-address-from-received-mails)
("q" nil))))
(defun message-mode-hook-hydra-setup ()
(local-set-key (kbd "C-c C-y") 'hydra-message/body))
(add-hook 'message-mode-hook 'message-mode-hook-hydra-setup)
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
(use-package all-the-icons)
(use-package org-roam
:ensure t
:init
(setq org-roam-v2-ack t)
:custom
(org-roam-directory "~/Documents/slipbox")
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("e" "encrypted" plain "%?"
:target (file+head "${slug}.org.gpg"
"#+title: ${title}\n")
:unnarrowed t)
("b" "book notes" plain
"\n* Source\n\nAuthor: %^{Author}\nTitle: ${title}\nYear: %^{Year}\n\n %?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)))
(org-roam-completion-everywhere t)
(org-roam-completion-system 'default)
(org-roam-dailies-directory "daily/")
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n d" . org-roam-dailies-find-date)
("C-c n c" . org-roam-dailies-capture-today)
("C-c n C r" . org-roam-dailies-capture-tomorrow)
("C-c n t" . org-roam-dailies-find-today)
("C-c n y" . org-roam-dailies-find-yesterday)
("C-c n r" . org-roam-dailies-find-tomorrow)
:map org-mode-map
("C-M-i" . completion-at-point))
:config
(require 'org-roam-dailies)
(org-roam-setup)
(org-roam-db-autosync-mode))
(add-to-list 'auto-mode-alist '("neomutt" . mail-mode))
(setq appt-message-warning-time 15
appt-audible nil
appt-visible t
appt-display-format 'window)
(appt-activate 1)
(defun notify-send (title msg)
(interactive)
;; only the first line of the message is returned
;; (subseq msg 0 (search msg "\n"))
(shell-command (concat "notify-send '" title "' '" msg "'")))
(defun facade-notify-appt (min-to-app new-time msg)
(notify-send (format "Appointment in %s minute(s)" min-to-app) msg))
(add-hook 'mail-mode-hook 'flyspell-mode 1)
(add-hook 'org-mode-hook 'flyspell-mode 1)
(setq appt-disp-window-function (function facade-notify-appt))
(provide 'emacs_home)
;;; emacs_home.el ends here

Loading…
Cancel
Save