@ -25,6 +25,7 @@
;; There are two ways to load a theme. Both assume the theme is installed and
;; 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
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
;; `load-theme' function. This is the default:
( setq doom-font ( font-spec :family " Fira Code " :size 12 ) )
( setq doom-theme 'doom-solarized-light )
( setq doom-theme 'doom-solarized-light )
;; If you use `org' and don't want your org files in the default location below,
;; If you use `org' and don't want your org files in the default location below,
@ -55,6 +56,7 @@
( setq +mu4e-backend 'offlineimap )
( 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_ )
( 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 "
" NAME is the name in offlineimap directory "
( let (
( let (
@ -82,26 +84,30 @@
` ( user-mail-address . , ( car addresses ) )
` ( user-mail-address . , ( car addresses ) )
` ( user-full-name . , fullname )
` ( user-full-name . , fullname )
` ( mu4e-compose-signature . , fullname )
` ( mu4e-compose-signature . , fullname )
` ( org-msg-signature . , ( concat " #+begin_signature
--
" fullname " \\\\
# +end_signature " ))
` ( mu4e-drafts-folder . , ( concat " / " name " / " inbox-prefix " Drafts " ) )
` ( mu4e-drafts-folder . , ( concat " / " name " / " inbox-prefix " Drafts " ) )
` ( mu4e-sent-folder . , ( concat " / " name " / " inbox-prefix " Sent " ) )
` ( mu4e-sent-folder . , ( concat " / " name " / " inbox-prefix " Sent " ) )
` ( mu4e-trash-folder . , ( concat " / " name " / " inbox-prefix " Trash " ) )
` ( mu4e-trash-folder . , ( concat " / " name " / " inbox-prefix " Trash " ) )
` ( mu4e-refile-folder . , ( lambda ( msg )
` ( mu4e-refile-folder . , ( lambda ( msg )
( or
( or
( some
( some
'identity
'identity
( mapcar ( lambda ( addr )
( mapcar ( lambda ( addr )
( cond
( cond
( ( mu4e-message-contact-field-matches msg :to addr ) ( concat " / " name " / " inbox-prefix " Archives " ) )
( ( 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 " ) )
( ( mu4e-message-contact-field-matches msg :from addr ) ( concat " / " name " / " inbox-prefix " Sent " ) )
( t nil )
( t nil )
)
)
)
)
addresses
addresses
)
)
)
)
( concat " / " name " / " inbox-prefix " Archives " )
( concat " / " name " / " inbox-prefix " Archives " )
)
)
) )
) )
` ( smtpmail-smtp-server . , smtp-server )
` ( smtpmail-smtp-server . , smtp-server )
` ( smtpmail-smtp-service . , smtp-port )
` ( smtpmail-smtp-service . , smtp-port )
` ( smtpmail-smtp-user . , smtp-user )
` ( smtpmail-smtp-user . , smtp-user )
@ -114,7 +120,7 @@
( defun kuba/setup-mu4e-accounts ( deflist )
( defun kuba/setup-mu4e-accounts ( deflist )
( setq mu4e-contexts ( mapcar ( lambda ( def ) ( apply 'kuba/generate-mu4-context def ) ) 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 ) ) )
( 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
( -each
( seq-group-by ( lambda ( def ) ( nth 1 def ) ) deflist )
( 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 ) )
( 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):
;; to fix the highlight in mu4e disappearing (https://github.com/hlissner/emacs-doom-themes/issues/504):
( after! hl-line
( after! hl-line
@ -158,7 +170,7 @@
( org-save-all-org-buffers )
( org-save-all-org-buffers )
( message " downloading inbox... " )
( message " downloading inbox... " )
;; (org-mobile-pull)
;; (org-mobile-pull)
( shell-command " /home/kuba/ scripts /inbox-download.sh" )
( shell-command " /home/kuba/ bin /inbox-download.sh" )
;; (org-mobile-push)
;; (org-mobile-push)
( shell-command " notify-send \" org-sync finished \" --icon=ok " )
( shell-command " notify-send \" org-sync finished \" --icon=ok " )
( find-file " ~/org/inbox.org " )
( 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 ( )
( defun kuba/open-org-main ( )
( interactive )
( interactive )
@ -190,6 +202,37 @@
( map! :g " M-c " #' org-capture )
( 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
;;;;;;;;;;;;;;; spell-fu
@ -201,21 +244,135 @@
( spell-fu-mode 0 ) ) )
( 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
;;;; popup
;;disable hiding modeline in popups
;;disable hiding modeline in popups
( plist-put +popup-defaults :modeline t )
;; (plist-put +popup-defaults :modeline t )
;;;;;;;;;;;;;;; prettier
;;;;;;;;;;;;;;; prettier
( after! prettier-js
;; (after! prettier-js
( add-hook 'js2-mode-hook 'prettier-js-mode )
;; (add-hook 'js2-mode-hook 'prettier-js-mode)
( add-hook 'web-mode-hook 'prettier-js-mode )
;; (add-hook 'web-mode-hook 'prettier-js-mode)
)
;; (add-hook 'typescript-mode-hook 'prettier-js-mode)
;; )
;;;; file editing shortcuts
;;;; file editing shortcuts
( map! :g " C-a " #' move-beginning-of-line )
( 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 )
)
)