Checkpoint

master
Kuba Orlik 3 years ago
parent 5e338da158
commit 2daf1fbade

@ -25,6 +25,7 @@
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-font (font-spec :family "Fira Code" :size 12))
(setq doom-theme 'doom-solarized-light)
;; If you use `org' and don't want your org files in the default location below,
@ -55,6 +56,7 @@
(setq +mu4e-backend 'offlineimap)
(setf lexical-binding t)
(defun kuba/generate-mu4-context (key_ category_ name_ addresses_ fullname_ smtp-server_ smtp-port_ smtp-user_ smtp-stream-type_ inbox-prefix_)
"NAME is the name in offlineimap directory"
(let (
@ -82,26 +84,30 @@
`(user-mail-address . ,(car addresses))
`(user-full-name . ,fullname)
`(mu4e-compose-signature . ,fullname)
`(org-msg-signature . ,(concat "#+begin_signature
--
" fullname " \\\\
#+end_signature"))
`(mu4e-drafts-folder . ,(concat "/" name "/" inbox-prefix "Drafts"))
`(mu4e-sent-folder . ,(concat "/" name "/" inbox-prefix "Sent"))
`(mu4e-trash-folder . ,(concat "/" name "/" inbox-prefix "Trash"))
`(mu4e-refile-folder . ,(lambda (msg)
(or
(some
'identity
(mapcar (lambda (addr)
(cond
((mu4e-message-contact-field-matches msg :to addr) (concat "/" name "/" inbox-prefix "Archives"))
((mu4e-message-contact-field-matches msg :from addr) (concat "/" name "/" inbox-prefix "Sent"))
(t nil)
)
)
addresses
)
)
(concat "/" name "/" inbox-prefix "Archives")
)
))
(or
(some
'identity
(mapcar (lambda (addr)
(cond
((mu4e-message-contact-field-matches msg :to addr) (concat "/" name "/" inbox-prefix "Archives"))
((mu4e-message-contact-field-matches msg :from addr) (concat "/" name "/" inbox-prefix "Sent"))
(t nil)
)
)
addresses
)
)
(concat "/" name "/" inbox-prefix "Archives")
)
))
`(smtpmail-smtp-server . ,smtp-server)
`(smtpmail-smtp-service . ,smtp-port)
`(smtpmail-smtp-user . ,smtp-user)
@ -114,7 +120,7 @@
(defun kuba/setup-mu4e-accounts (deflist)
(setq mu4e-contexts (mapcar (lambda (def) (apply 'kuba/generate-mu4-context def)) deflist))
(setq mu4e-user-mail-address-list (apply 'append (mapcar (lambda (def) (nth 3 def)) deflist)))
(push (list (mapconcat 'identity (mapcar (lambda (def) (concat "maildir:/" (nth 2 def) "/INBOX")) deflist) " OR ") "Merged inbox" 109) mu4e-bookmarks)
(push (list (concat "(" (mapconcat 'identity (mapcar (lambda (def) (concat "maildir:/" (nth 2 def) "/INBOX")) deflist) " OR ") ") and not maildir:/kontakt@jakub/INBOX") "Merged inbox" 109) mu4e-bookmarks)
(-each
(seq-group-by (lambda (def) (nth 1 def)) deflist)
(lambda (defgroup) (push (list (mapconcat 'identity (mapcar (lambda (def) (concat "maildir:/" (nth 2 def) "/INBOX")) (-slice defgroup 1)) " OR ") (nth 0 defgroup) (aref (nth 0 defgroup) 0)) mu4e-bookmarks))
@ -140,6 +146,12 @@
)
(after! mu4e
(setq mu4e-update-interval 20)
(mu4e-alert-enable-mode-line-display)
(setq mu4e-alert-interesting-mail-query (concat (mu4e-get-bookmark-query ?m) " and flag:unread"))
)
;; to fix the highlight in mu4e disappearing (https://github.com/hlissner/emacs-doom-themes/issues/504):
(after! hl-line
@ -158,7 +170,7 @@
(org-save-all-org-buffers)
(message "downloading inbox...")
;; (org-mobile-pull)
(shell-command "/home/kuba/scripts/inbox-download.sh")
(shell-command "/home/kuba/bin/inbox-download.sh")
;; (org-mobile-push)
(shell-command "notify-send \"org-sync finished\" --icon=ok")
(find-file "~/org/inbox.org")
@ -166,7 +178,7 @@
)
(map! :g "C-c m s" #'sync-org)
(map! :g "C-c c m s" #'sync-org)
(defun kuba/open-org-main ()
(interactive)
@ -190,6 +202,37 @@
(map! :g "M-c" #'org-capture)
(after! org
(setq org-capture-templates
'(("t" "Inbox item" entry
(file "~/org/inbox.org")
"* TODO %?
CREATED: %U")
("T" "Inbox item with Capture Target" entry
(file "~/org/inbox.org")
"* TODO %? (link)
%a")
("s" "test" entry
(file "~/org/inbox.org")
"* TODO %a %?")))
(setq org-agenda-start-day "-0d")
(setq org-hide-leading-stars nil)
(setq org-startup-indented nil)
(setq org-startup-folded t)
(setq org-refile-targets
(quote
(("/home/kuba/org/ideas.org" :maxlevel . 2)
("/home/kuba/org/main.org" :level . 2)
("/home/kuba/org/main.org" :level . 3)
("/home/kuba/org/entertainment.org" :level . 1))))
(require 'org-mu4e)
(add-hook 'org-store-link-functions 'org-mu4e-store-link)
(add-hook 'org-capture-after-finalize-hook #'org-save-all-org-buffers)
(add-hook 'org-capture-after-refile-insert-hook #'org-save-all-org-buffers)
(add-hook 'org-after-todo-state-change-hook #'org-save-all-org-buffers)
)
;;;;;;;;;;;;;;; spell-fu
@ -201,21 +244,135 @@
(spell-fu-mode 0)))
)
(defun lang-pl ()
(interactive)
(setq ispell-dictionary "pl_PL")
(setq langtool-default-language "pl-PL")
)
(defun lang-en ()
(interactive)
(setq ispell-dictionary "en_US")
(setq langtool-default-language "en-US")
)
(map! :g "C-c t g" #'writegood-mode)
(map! :g "C-c L c" #'langtool-check)
(map! :g "C-c L d" #'langtool-check-done)
(map! :g "C-c L l e" #'lang-en)
(map! :g "C-c L l p" #'lang-pl)
;;;; popup
;;disable hiding modeline in popups
(plist-put +popup-defaults :modeline t)
;; (plist-put +popup-defaults :modeline t)
;;;;;;;;;;;;;;; prettier
(after! prettier-js
(add-hook 'js2-mode-hook 'prettier-js-mode)
(add-hook 'web-mode-hook 'prettier-js-mode)
)
;; (after! prettier-js
;; (add-hook 'js2-mode-hook 'prettier-js-mode)
;; (add-hook 'web-mode-hook 'prettier-js-mode)
;; (add-hook 'typescript-mode-hook 'prettier-js-mode)
;; )
;;;; file editing shortcuts
(map! :g "C-a" #'move-beginning-of-line)
(remove-hook 'doom-first-buffer-hook #'smartparens-global-mode)
(after! flycheck
(setq! flycheck-check-syntax-automatically
(if (string= (system-name) "kuba-desktop")
'(save idle-change new-line mode-enabled idle-buffer-switch)
'(save mode-enabled idle-buffer-switch)
)))
(setq +format-on-save-enabled-modes
'(mhtml-mode
html-mode
;; typescript-mode
;; js2-mode
;; web-mode
))
;; (set-formatter! 'web-mode 'prettier-prettify)
(add-hook 'after-init-hook #'global-prettier-mode)
(add-hook 'web-mode-hook #'prettier-mode)
(add-hook 'css-mode-hook #'prettier-mode)
(add-hook 'typescript-mode-hook #'prettier-mode)
(fset 'sm
(kmacro-lambda-form [return ?\C-s ?i ?d ?e ?n ?\C-e 134217794 ?\M-w ?\M-c ?T ?Z ?g ?o ?s ?z ?e ?n ?i ?e ? ?# ?\C-y ?\C-c ?\C-w ?Z ?g ?o return ?r ?\M-: ?\( ?s ?l ?e ?e ?p ?- ?f ?o ?r ? ?0 ?. ?1 ?\) return] 0 "%d"))
;; (defun org-agenda-skip-if-scheduled-later ()
;; "If this function returns nil, the current match should not be skipped.
;; Otherwise, the function must return a position from where the search
;; should be continued."
;; (ignore-errors
;; (let ((subtree-end (save-excursion (org-end-of-subtree t)))
;; (scheduled-seconds
;; (time-to-seconds
;; (org-time-string-to-time
;; (org-entry-get nil "SCHEDULED"))))
;; (now (time-to-seconds (current-time))))
;; (and scheduled-seconds
;; (>= scheduled-seconds now)
;; subtree-end))))
(defun mu4e-copy-message-at-point (&optional dir)
"Copy message at point to somewhere else as <date>_<subject>.eml."
(interactive)
(let* ((msg (mu4e-message-at-point))
(target (format "%s_%s.eml"
(format-time-string "%F" (mu4e-message-field msg :date))
(or (mu4e-message-field msg :subject) "No subject"))))
(copy-file
(mu4e-message-field msg :path)
(format "%s/%s" (or dir (read-directory-name "Copy message to: ")) target) 1)))
(after! lsp-mode
(message "after LSP!")
(setq! lsp-log-io nil)
(lsp-register-client
(make-lsp-client :new-connection (lsp-tramp-connection '("typescript-language-server" "--stdio"))
:major-modes '(typescript-mode)
:remote? t
:server-id 'ts-remote))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("typescript-language-server" "--stdio"))
:major-modes '(typescript-mode)
:server-id 'ts-ls-better))
(setq company-idle-delay 0.5)
;; (lsp-register-client
;; (make-lsp-client :new-connection (lsp-tramp-connection '("javascript-typescript-langserver"))
;; :major-modes '(typescript-mode)
;; :remote? t
;; :server-id 'jsts-remote))
)
(defun remote-prettier ()
"Run prettier on a remote file"
(interactive)
(let ((filename buffer-file-name))
(shell-command (concat "prettier -w " (file-remote-p buffer-file-name 'localname)))
(kill-buffer (buffer-name))
(find-file filename)
)
)
(defun reopen-file ()
"kills the buffer and reopens the file"
(interactive)
(let ((filename buffer-file-name))
(kill-buffer (buffer-name))
(find-file filename)
)
)

@ -3,6 +3,98 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["#FDF6E3" "#CC9393" "#7F9F7F" "#F0DFAF" "#8CD0D3" "#DC8CC3" "#93E0E3" "#DCDCDC"])
'(calendar-week-start-day 1)
'(counsel-projectile-switch-project-action
'(4
("o" counsel-projectile-switch-project-action "jump to a project buffer or file")
("f" counsel-projectile-switch-project-action-find-file "jump to a project file")
("d" counsel-projectile-switch-project-action-find-dir "jump to a project directory")
("D" counsel-projectile-switch-project-action-dired "open project in dired")
("b" counsel-projectile-switch-project-action-switch-to-buffer "jump to a project buffer")
("m" counsel-projectile-switch-project-action-find-file-manually "find file manually from project root")
("S" counsel-projectile-switch-project-action-save-all-buffers "save all project buffers")
("k" counsel-projectile-switch-project-action-kill-buffers "kill all project buffers")
("K" counsel-projectile-switch-project-action-remove-known-project "remove project from known projects")
("c" counsel-projectile-switch-project-action-compile "run project compilation command")
("C" counsel-projectile-switch-project-action-configure "run project configure command")
("E" counsel-projectile-switch-project-action-edit-dir-locals "edit project dir-locals")
("v" counsel-projectile-switch-project-action-vc "open project in vc-dir / magit / monky")
("sg" counsel-projectile-switch-project-action-grep "search project with grep")
("si" counsel-projectile-switch-project-action-git-grep "search project with git grep")
("ss" counsel-projectile-switch-project-action-ag "search project with ag")
("sr" counsel-projectile-switch-project-action-rg "search project with rg")
("xs" counsel-projectile-switch-project-action-run-shell "invoke shell from project root")
("xe" counsel-projectile-switch-project-action-run-eshell "invoke eshell from project root")
("xt" counsel-projectile-switch-project-action-run-term "invoke term from project root")
("xv" counsel-projectile-switch-project-action-run-vterm "invoke vterm from project root")
("Oc" counsel-projectile-switch-project-action-org-capture "capture into project")
("Oa" counsel-projectile-switch-project-action-org-agenda "open project agenda")))
'(custom-safe-themes
'("2cdc13ef8c76a22daa0f46370011f54e79bae00d5736340a5ddfe656a767fddf" "93ed23c504b202cf96ee591138b0012c295338f38046a1f3c14522d4a64d7308" "4bca89c1004e24981c840d3a32755bf859a6910c65b829d9441814000cf6c3d0" "5d09b4ad5649fea40249dd937eaaa8f8a229db1cec9a1a0ef0de3ccf63523014" "711efe8b1233f2cf52f338fd7f15ce11c836d0b6240a18fffffc2cbd5bfe61b0" default))
'(doom-modeline-mu4e t)
'(fci-rule-color "#4F4F4F")
'(flycheck-html-tidy-executable "/usr/bin/tidy")
'(jdee-db-active-breakpoint-face-colors (cons "#000000" "#8CD0D3"))
'(jdee-db-requested-breakpoint-face-colors (cons "#000000" "#7F9F7F"))
'(jdee-db-spec-breakpoint-face-colors (cons "#000000" "#494949"))
'(mu4e-attachment-dir "/home/kuba/Downloads")
'(mu4e-completing-read-function 'ivy-completing-read)
'(mu4e-compose-context-policy 'ask-if-none)
'(mu4e-compose-format-flowed t)
'(mu4e-confirm-quit nil)
'(mu4e-context-policy 'pick-first)
'(mu4e-drafts-folder "/kontakt@kuba-orlik.name/Drafts")
'(mu4e-get-mail-command "offlineimap -o -q")
'(mu4e-headers-visible-columns 120)
'(mu4e-hide-index-messages t)
'(mu4e-refile-folder
'(closure
((inbox-prefix . "")
(smtp-stream-type . starttls)
(smtp-user . "kuba")
(smtp-port . 587)
(smtp-server . "yuno.kuba-orlik.name")
(fullname . "Kuba Orlik")
(addresses "kontakt@kuba-orlik.name")
(name . "kontakt@kuba-orlik.name")
(category . "personal")
(key . "1")
(inbox-prefix_ . "")
(smtp-stream-type_ . starttls)
(smtp-user_ . "kuba")
(smtp-port_ . 587)
(smtp-server_ . "yuno.kuba-orlik.name")
(fullname_ . "Kuba Orlik")
(addresses_ "kontakt@kuba-orlik.name")
(name_ . "kontakt@kuba-orlik.name")
(category_ . "personal")
(key_ . "1")
t)
(msg)
(or
(some 'identity
(mapcar
#'(lambda
(addr)
(cond
((mu4e-message-contact-field-matches msg :to addr)
(concat "/" name "/" inbox-prefix "Archives"))
((mu4e-message-contact-field-matches msg :from addr)
(concat "/" name "/" inbox-prefix "Sent"))
(t nil)))
addresses))
(concat "/" name "/" inbox-prefix "Archives"))))
'(mu4e-sent-folder "/kontakt@kuba-orlik.name/Sent")
'(mu4e-split-view 'vertical)
'(mu4e-trash-folder "/kontakt@kuba-orlik.name/Trash")
'(mu4e-update-interval 20)
'(mu4e-view-show-addresses t)
'(mu4e-view-show-images t)
'(objed-cursor-color "#CC9393")
'(org-agenda-custom-commands
'(("n" "Agenda and all TODOs"
((agenda "" nil)
@ -11,8 +103,7 @@
("p" . "Personal context")
("pa" "Agenda + todo"
((agenda ""
((org-agenda-span 'day)
(org-agenda-category-filter-preset 'nil)))
((org-agenda-span 'day)))
(alltodo "" nil))
((org-agenda-category-filter-preset
'("-work")))
@ -21,8 +112,7 @@
("w" . "Work context")
("wa" "Agenda + todo"
((agenda ""
((org-agenda-span 'day)))
(alltodo "" nil))
((org-agenda-span 'day))))
nil nil)
("x" "Describe command here" alltodo ""
((org-agenda-files
@ -41,17 +131,51 @@ CREATED: %U")
%a")
("s" "test" entry
(file "~/org/inbox.org")
"* TODO %a %?")) t)
"* TODO %a %?")))
'(org-clock-in-resume t)
'(org-clock-mode-line-total 'current)
'(org-clock-persist 'history)
'(org-fontify-done-headline nil)
'(org-fontify-quote-and-verse-blocks t)
'(org-fontify-whole-heading-line t)
'(org-modules '(org-bbdb org-docview org-gnus org-habit org-info))
'(org-modules '(org-habit))
'(org-priority-lowest 70)
'(org-refile-targets
'(("/home/kuba/org/ideas.org" :maxlevel . 2)
("/home/kuba/org/main.org" :level . 2)
("/home/kuba/org/entertainment.org" :level . 1)))
'(org-todo-keywords '((sequence "TODO" "DONE(!)" "HOLD"))))
'(org-todo-keywords '((sequence "TODO" "DONE(!)" "HOLD")))
'(package-selected-packages '(htmlize))
'(pdf-view-midnight-colors (cons "#DCDCDC" "#3F3F3F"))
'(projectile-auto-discover nil)
'(projectile-dynamic-mode-line nil)
'(projectile-enable-caching t)
'(projectile-git-submodule-command nil)
'(projectile-mode t nil (projectile))
'(rustic-ansi-faces
["#3F3F3F" "#CC9393" "#7F9F7F" "#F0DFAF" "#8CD0D3" "#DC8CC3" "#93E0E3" "#DCDCDC"])
'(vc-annotate-background "#3F3F3F")
'(vc-annotate-color-map
(list
(cons 20 "#7F9F7F")
(cons 40 "#a4b48f")
(cons 60 "#cac99f")
(cons 80 "#F0DFAF")
(cons 100 "#eacfa4")
(cons 120 "#e4bf99")
(cons 140 "#DFAF8F")
(cons 160 "#dea3a0")
(cons 180 "#dd97b1")
(cons 200 "#DC8CC3")
(cons 220 "#d68eb3")
(cons 240 "#d190a3")
(cons 260 "#CC9393")
(cons 280 "#ab8080")
(cons 300 "#8a6d6d")
(cons 320 "#695b5b")
(cons 340 "#4F4F4F")
(cons 360 "#4F4F4F")))
'(vc-annotate-very-old-color nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@ -64,3 +188,4 @@ CREATED: %U")
'(mu4e-replied-face ((t (:inherit 'mu4e-header-face :slant italic))))
'(mu4e-unread-face ((t (:inherit 'font-lock-keyword-face))))
'(org-headline-done ((t (:inherit org-headline-todo)))))
(put 'customize-themes 'disabled nil)

@ -29,7 +29,7 @@
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs
;; doom-quit ; DOOM quit-message prompts when you quit Emacs
;;fill-column ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
@ -40,9 +40,9 @@
nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;; (popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
@ -54,10 +54,10 @@
;(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
@ -72,19 +72,19 @@
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
eshell ; the elisp shell that works everywhere
shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
spell ; tasing you for misspelling mispelling
;(spell +flyspell) ; tasing you for misspelling mispelling
grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;debugger ; FIXME stepping through code, to help you add bugs
;; debugger ; FIXME stepping through code, to help you add bugs
;;direnv
;;docker
;;editorconfig ; let someone else argue about tabs vs spaces
@ -92,7 +92,7 @@
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
;;lsp
lsp
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
@ -133,7 +133,7 @@
;;idris ;
json ; At least it ain't XML
;;(java +meghanada) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here))))))
(javascript +lsp) ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
@ -164,7 +164,7 @@
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
;; web ; the tubes
(web +lsp) ; the tubes
yaml ; JSON, but readable
:email
@ -180,4 +180,4 @@
:config
;;literate
(default +bindings +smartparens))
(default +bindings))

@ -49,4 +49,19 @@
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)
(package! prettier-js)
;; (package! prettier-js)
(package! mu4e-alert)
(package! doom-themes
:recipe (:host github :repo "kuba-orlik/emacs-doom-themes"))
(unpin! doom-themes)
(package! pkgbuild-mode)
(package! dockerfile-mode)
(package! docker-compose-mode)
(package! qml-mode)
(package! ripgrep)
(package! ag)
(package! org-msg :pin "c19f54beebe268833c44a015861bf02531591011") ;; aby pozwolić na drag&drop
(package! prettier)
(package! lsp-treemacs)
(package! nginx-mode)

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: flora html template
# key: html
# --
html/* HTML */ \`$0\`
Loading…
Cancel
Save