From a8fd139a791364b8484b9f82669bd31a0f55153e Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sat, 3 Jul 2021 12:43:58 +0200 Subject: Update configurations --- doom/config.el | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++- doom/init.el | 2 +- doom/packages.el | 10 +++ isync/.mbsyncrc | 8 +- macos/yabai/yabairc | 1 + zsh/.zsh/export.zsh | 2 + zsh/.zshrc | 7 +- 7 files changed, 234 insertions(+), 12 deletions(-) diff --git a/doom/config.el b/doom/config.el index 32ab02f..6dbe26b 100644 --- a/doom/config.el +++ b/doom/config.el @@ -32,6 +32,9 @@ ;; numbers are disabled. For relative line numbers, set this to `relative'. (setq display-line-numbers-type nil) +(setq auth-sources '("~/.authinfo.gpg" + "~/.authinfo")) + ;; Add some keybinding customisations. ;; Stop emacs from freezing when trying to minimize it on a tiling WM. @@ -184,7 +187,10 @@ ;; Configure activation for whitespace mode (use-package! whitespace - :bind (("C-x w" . whitespace-mode))) + :bind (("C-x w" . whitespace-mode)) + :init + (setq whitespace-style '(newline newline-mark)) + (setq whitespace-display-mappings '((newline-mark 10 [?¬ 10])))) ;; Configure expand-region mode. (use-package! expand-region @@ -209,7 +215,7 @@ org-use-speed-commands t org-hide-emphasis-markers t org-adapt-indentation nil - org-cycle-separator-lines 1 + org-cycle-separator-lines 2 org-structure-template-alist '(("a" . "export ascii") ("c" . "center") ("C" . "comment") @@ -248,8 +254,12 @@ "~/Dropbox/bibliography/reading_list.org"))) (setq org-refile-targets `(("~/Dropbox/org/main.org" :level . 1) ("~/Dropbox/org/someday.org" :level . 1) - ("~/Dropbox/org/projects.org" :level . 1) + ("~/Dropbox/org/projects.org" :maxlevel . 2) (,(format-time-string "~/Dropbox/org/%Y-%m.org") :level . 1))) + (setq org-agenda-text-search-extra-files '("~/Dropbox/zk/hls.org" + "~/Dropbox/zk/computing.org" + "~/Dropbox/zk/verification.org" + "~/Dropbox/zk/mathematics.org")) ;; Set custom agenda commands which can be activated in the agenda viewer. (setq org-agenda-custom-commands '(("w" "At work" tags-todo "@work" @@ -262,6 +272,7 @@ (setq org-agenda-span 7 org-agenda-start-day "." org-agenda-start-on-week 1) + (setq org-agenda-include-diary t) (setq org-capture-templates `(("t" "Todo" entry (file "inbox.org") @@ -320,6 +331,59 @@ (content "article" "content") (postamble "footer" "postamble"))) + (require 'calendar) + (setq calendar-mark-diary-entries-flag t) + (setq calendar-mark-holidays-flag t) + (setq calendar-mode-line-format nil) + (setq calendar-time-display-form + '(24-hours ":" minutes + (when time-zone + (format "(%s)" time-zone)))) + (setq calendar-week-start-day 1) ; Monday + (setq calendar-date-style 'iso) + (setq calendar-date-display-form calendar-iso-date-display-form) + (setq calendar-time-zone-style 'numeric) ; Emacs 28.1 + + (require 'cal-dst) + (setq calendar-standard-time-zone-name "+0000") + (setq calendar-daylight-time-zone-name "+0100") + + (require 'diary-lib) + (setq diary-file "~/Dropbox/org/diary") + (setq diary-date-forms diary-iso-date-forms) + (setq diary-comment-start ";;") + (setq diary-comment-end "") + (setq diary-nonmarking-symbol "!") + (setq diary-show-holidays-flag t) + (setq diary-display-function #'diary-fancy-display) ; better than its alternative + (setq diary-header-line-format nil) + (setq diary-list-include-blanks nil) + (setq diary-number-of-entries 2) + (setq diary-mail-days 2) + (setq diary-abbreviated-year-flag nil) + + (add-hook 'calendar-today-visible-hook #'calendar-mark-today) + (add-hook 'diary-list-entries-hook 'diary-sort-entries t) + + (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) + (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files) + ;; Prevent Org from interfering with my key bindings. + (remove-hook 'calendar-mode-hook #'org--setup-calendar-bindings) + + (let ((map calendar-mode-map)) + (define-key map (kbd "s") #'calendar-sunrise-sunset) + (define-key map (kbd "l") #'lunar-phases) + (define-key map (kbd "i") nil) ; Org sets this, much to my chagrin (see `remove-hook' above) + (define-key map (kbd "i a") #'diary-insert-anniversary-entry) + (define-key map (kbd "i c") #'diary-insert-cyclic-entry) + (define-key map (kbd "i d") #'diary-insert-entry) ; for current "day" + (define-key map (kbd "i i") #'diary-insert-entry) ; most common action, easier to type + (define-key map (kbd "i m") #'diary-insert-monthly-entry) + (define-key map (kbd "i w") #'diary-insert-weekly-entry) + (define-key map (kbd "i y") #'diary-insert-yearly-entry) + (define-key map (kbd "M-n") #'calendar-forward-month) + (define-key map (kbd "M-p") #'calendar-backward-month)) + (require 'ox-extra) (ox-extras-activate '(ignore-headlines)) @@ -349,11 +413,24 @@ TeX-engine 'xetex) (setq org-beamer-environments-extra '(("onlyenv" "o" "\\begin{onlyenv}%a{%h}" "\\end{onlyenv}") ("onlyenvNH" "o" "\\begin{onlyenv}%a" "\\end{onlyenv}") - ("blockNH" "o" "\\begin{block}%a{}" "\\end{block}")))) + ("blockNH" "o" "\\begin{block}%a{}" "\\end{block}") + ("minipage" "o" "\\begin{minipage}[t]%o[t]{1.0\\textwidth}" "\\end{minipage}")))) (use-package! ox-tufte :after org) +(use-package appt + :config + (setq appt-display-diary nil) + (setq appt-disp-window-function #'appt-disp-window) + (setq appt-display-mode-line t) + (setq appt-display-interval 3) + (setq appt-audible nil) + (setq appt-warning-time-regexp "appt \\([0-9]+\\)") + (setq appt-message-warning-time 15) + (run-at-time 10 nil #'appt-activate 1)) + + ;; Set up org ref for PDFs (use-package! org-ref :demand @@ -366,6 +443,11 @@ org-ref-bib-html "") (setq reftex-default-bibliography '("~/Dropbox/bibliography/references.bib"))) +(use-package! org-transclusion + :after org + :config + (setq org-transclusion-exclude-elements '(property-drawer headline))) + ;; Set up org-noter (use-package! org-noter :after org @@ -432,6 +514,11 @@ :bind-keymap ("C-c k" . zettelkasten-mode-map)) +(use-package! elfeed-org + :config + (elfeed-org) + (setq rmh-elfeed-org-files (list "~/Dropbox/org/elfeed.org"))) + ;; Proof general configuration (setq proof-splash-enable nil proof-auto-action-when-deactivating-scripting 'retract @@ -485,6 +572,13 @@ ;; (:map haskell-mode-map ;; ("C-c r" . ormolu-format-buffer))) +(use-package! lsp-haskell + :config + (setq lsp-haskell-process-path-hie "haskell-language-server-wrapper") + ;; Comment/uncomment this line to see interactions between lsp client/server. + ;;(setq lsp-log-io t) +) + (after! writeroom-mode (setq +zen-text-scale 1)) @@ -562,6 +656,120 @@ (define-key org-mode-map (kbd "C-c y n") #'org-zettelkasten-create-dwim) (define-key org-mode-map (kbd "C-c y s") #'org-zettelkasten-search-current-id) +(use-package! ox-hugo + :after ox) + +(defun sci-hub-pdf-url (doi) + "Get url to the pdf from SCI-HUB using DOI." + (setq *doi-utils-pdf-url* (concat "https://sci-hub.do/" doi) ;captcha + *doi-utils-waiting* t + ) + ;; try to find PDF url (if it exists) + (url-retrieve (concat "https://sci-hub.do/" doi) + (lambda (_) + (goto-char (point-min)) + (while (search-forward-regexp + "\\(https://\\|//sci-hub.do/downloads\\).+download=true'" nil t) + (let ((foundurl (match-string 0))) + (message foundurl) + (if (string-match "https:" foundurl) + (setq *doi-utils-pdf-url* foundurl) + (setq *doi-utils-pdf-url* (concat "https:" foundurl)))) + (setq *doi-utils-waiting* nil)))) + (while *doi-utils-waiting* (sleep-for 0.1)) + *doi-utils-pdf-url*) + +(defun download-pdf-from-doi (doi key) + "Download pdf from doi with KEY name." + (url-copy-file (sci-hub-pdf-url doi) + (concat "~/Dropbox/bibliography/papers/" key ".pdf"))) + +(defun get-bib-from-doi (doi) + "Get the bibtex from DOI." + (shell-command (concat "curl -L -H \"Accept: application/x-bibtex; charset=utf-8\" " + "https://doi.org/" doi))) + +(use-package erc + :commands (erc erc-tls) + :bind (:map erc-mode-map + ("C-c r" . reset-erc-track-mode)) + :preface + (defun irc () + (interactive) + (erc :server "ee-ymh15.ee.ic.ac.uk" :port 12844 :nick "ymherklotz" + :password "ymherklotz/freenode:xxx")) + + (defun ymhg/erc-notify (nickname message) + "Displays a notification message for ERC." + (let* ((channel (buffer-name)) + (nick (erc-hl-nicks-trim-irc-nick nickname)) + (title (if (string-match-p (concat "^" nickname) channel) + nick + (concat nick " (" channel ")"))) + (msg (s-trim (s-collapse-whitespace message)))) + (alert (concat nick ": " msg) :title title))) + :hook ((ercn-notify . ymhg/erc-notify)) + :config + (setq erc-autojoin-timing 'ident) + (setq erc-fill-function 'erc-fill-static) + (setq erc-fill-static-center 22) + (setq erc-hide-list '("JOIN" "PART" "QUIT")) + (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT")) + (setq erc-lurker-threshold-time 43200) + (setq erc-prompt-for-password nil) + (setq erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" + "324" "329" "332" "333" "353" "477")) + (setq erc-fill-column 100) + (add-to-list 'erc-modules 'notifications) + (add-to-list 'erc-modules 'spelling) + (erc-services-mode 1) + (erc-update-modules) + (erc-track-minor-mode 1) + (erc-track-mode 1)) + +(use-package erc-hl-nicks + :after erc) + +(use-package znc + :after erc + :config + (setq znc-servers '(("ee-ymh15.ee.ic.ac.uk" 12843 t ((freenode "ymherklotz" "xxx")))))) + +(use-package alert + :custom + (alert-default-style 'osx-notifier)) + +;; Bug fixes + +;; Projectile compilation buffer not there anymore for some reason +(setq compilation-buffer-name-function #'compilation--default-buffer-name) + +(defun diary-last-day-of-month (date) + "Return `t` if DATE is the last day of the month." + (let* ((day (calendar-extract-day date)) + (month (calendar-extract-month date)) + (year (calendar-extract-year date)) + (last-day-of-month + (calendar-last-day-of-month month year))) + (= day last-day-of-month))) + +;;(setq smtpmail-smtp-server "smtp.mailbox.org" ;; <-- edit this !!! +;; smtpmail-smtp-service 587 ;; 25 is default -- uncomment and edit if needed +;; smtpmail-stream-type 'starttls) + +(setq user-mail-address "ymh15@ic.ac.uk" + smtpmail-smtp-server "smtp.office365.com" + smtpmail-smtp-service 587 + smtpmail-stream-type 'starttls) + +(setq message-signature "Yann Herklotz +Imperial College London +https://yannherklotz.com") + +(setq message-send-mail-function 'message-smtpmail-send-it) + +(setq auth-sources '("~/.authinfo" "~/.authinfo.gpg" "~/.netrc")) + ;;(use-package! ox-ssh ;; :after org ;; :config diff --git a/doom/init.el b/doom/init.el index 891f55c..4e8cff9 100644 --- a/doom/init.el +++ b/doom/init.el @@ -119,7 +119,7 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;go ; the hipster dialect - haskell ; a language that's lazier than I am + (haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python idris ; ;;(java +meghanada) ; the poster child for carpal tunnel syndrome diff --git a/doom/packages.el b/doom/packages.el index 18c8386..b59fd0a 100644 --- a/doom/packages.el +++ b/doom/packages.el @@ -61,6 +61,9 @@ (package! ox-reveal) ;(package! ox-ssh) (package! ox-tufte) +(package! ox-hugo) +(package! org-transclusion + :recipe (:host github :repo "nobiot/org-transclusion")) ;; Bibtex stuff (package! ebib) @@ -71,6 +74,13 @@ (package! direnv) (package! yaml-mode) +(package! erc-hl-nicks) +(package! alert) +(package! znc) + +(package! elfeed) +(package! elfeed-org) + ;; Misc dependencies (package! hungry-delete) (package! vagrant-tramp) diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc index 6671e1c..c85c1f4 100644 --- a/isync/.mbsyncrc +++ b/isync/.mbsyncrc @@ -29,8 +29,8 @@ Path ~/.mail/mailbox/ Inbox ~/.mail/mailbox/Inbox Channel imperial -Master :imperial-remote: -Slave :imperial-local: +Far :imperial-remote: +Near :imperial-local: Patterns "Sent Items" Archive "Deleted Items" INBOX Drafts Create Both SyncState * @@ -38,8 +38,8 @@ ExpireUnread no Expunge Both Channel mailbox -Master :mailbox-remote: -Slave :mailbox-local: +Far :mailbox-remote: +Near :mailbox-local: Patterns * Create Both SyncState * diff --git a/macos/yabai/yabairc b/macos/yabai/yabairc index 7c4806b..4c5fa56 100755 --- a/macos/yabai/yabairc +++ b/macos/yabai/yabairc @@ -16,4 +16,5 @@ yabai -m config window_gap 5 yabai -m config --space 2 layout float yabai -m rule --add app=Emacs manage=on +yabai -m rule --add app=zathura manage=on yabai -m rule --add app="System Preferences" manage=off diff --git a/zsh/.zsh/export.zsh b/zsh/.zsh/export.zsh index a4392bc..8186e73 100644 --- a/zsh/.zsh/export.zsh +++ b/zsh/.zsh/export.zsh @@ -38,6 +38,8 @@ prepend_path "${HOME}/.local/bin" append_path "/opt/Xilinx/Vivado/2019.1/bin" append_path "/opt/intelFPGA_lite/18.1/quartus/bin" +append_path "$HOME/projects/vericert/bin" +append_path "/opt/bin" export PATH diff --git a/zsh/.zshrc b/zsh/.zshrc index 8f7c2ae..a8739a9 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -27,9 +27,11 @@ setopt HIST_FIND_NO_DUPS if [ -d ~/.cache/wal ]; then (cat ~/.cache/wal/sequences &) fi +export MINIMAL_MAGIC_ENTER=no + # Sourcing everything -if [ -e /usr/share/fzf/key-bindings.zsh ]; then source /usr/share/fzf/key-bindings.zsh; fi -if [ -e /usr/share/fzf/completion.zsh ]; then source /usr/share/fzf/completion.zsh; fi +#if [ -e /usr/share/fzf/key-bindings.zsh ]; then source /usr/share/fzf/key-bindings.zsh; fi +#if [ -e /usr/share/fzf/completion.zsh ]; then source /usr/share/fzf/completion.zsh; fi if [ -e $HOME/.zsh/export.zsh ]; then source $HOME/.zsh/export.zsh; fi if [ -e $HOME/.zsh/minimal.zsh ]; then source $HOME/.zsh/minimal.zsh; fi if [ -e $HOME/.zsh/function.zsh ]; then source $HOME/.zsh/function.zsh; fi @@ -40,4 +42,3 @@ bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down bindkey -M emacs '^P' history-substring-search-up bindkey -M emacs ^N history-substring-search-down - -- cgit