add org-roam stuff, add email

This commit is contained in:
opfez 2021-07-17 19:35:14 +02:00
parent 8c45a40b39
commit b09b6ab15e
3 changed files with 62 additions and 3 deletions

View File

@ -131,14 +131,48 @@
(sleep-for 1)
(sly-connect "localhost" 4005))
(defmacro fez/save-buffer-excursion (&rest body)
(declare (indent defun))
(let ((original-buffer (gensym)))
`(let ((,original-buffer (current-buffer)))
,@body
(switch-to-buffer ,original-buffer))))
(defun fez/goto-first-occurrence (str)
(goto-char (point-min))
(search-forward-regexp str)
(beginning-of-thing 'symbol))
;; https://emacs.stackexchange.com/a/33709
(defmacro with-keybinding (map key command &rest body)
`(let* ((map ,map)
(key ,key)
(newcommand ,command)
(prevbinding (lookup-key map key)))
(unwind-protect
(progn
(define-key map key newcommand)
,@body)
(define-key map key prevbinding))))
(defun fez/org-roam-new-note ()
"Creates a new org-roam note, and adds an entry to that note in my index.org file."
(interactive)
(let ((category (read-string "Category: ")))
(find-file (concat org-roam-directory "/index.org"))
(fez/goto-first-occurrence (concat "^\* " category))
(end-of-line)
(newline)
(org-cycle)
(with-keybinding selectrum-minibuffer-map (kbd "SPC") (lambda () (interactive (insert-char ?-)))
(org-roam-insert))))
;; Eshell convinience commands.
(defalias 'open 'find-file-other-window)
(defalias 'clean 'eshell/clear-scrollback)
;;; Keybinds
;; C-x C-z and C-z are normally mapped to suspend-frame, an absolutely useless function.
;; Unbind them before making the keybind useful.
(global-unset-key (kbd "C-x C-z"))

17
init.el
View File

@ -45,6 +45,23 @@
(?\" . ?\")))
(electric-pair-mode t)
(setq-default rmail-display-summary t)
(setq
send-mail-function 'smtpmail-send-it
rmail-preserve-inbox 1
rmail-delete-after-output 1
rmail-mail-new-frame 1
rmail-mime-prefer-html nil
rmail-file-name "~/mail/inbox"
rmail-primary-inbox-list '("~/mail/inboxes/disroot")
rmail-default-file "~/mbox/archive"
rmail-secondary-file-directory "~/mail"
message-default-headers "Fcc: ~/mail/sent"
user-full-name "opfez"
user-mail-address "opfez@disroot.org"
message-signature "")
;; C configuration
(setq c-default-style "linux"
c-basic-offset 4)

View File

@ -169,7 +169,8 @@
:ensure t
:bind
("C-c o i" . org-roam-jump-to-index)
:config
("C-c o n" . fez/org-roam-new-note)
:init
(setq org-roam-directory "~/Documents/org-roam"))
;; better shell-command
@ -178,6 +179,13 @@
:config
(global-set-key (kbd "M-!") 'shell-command+))
;; Jump to definitions without tags
(use-package dumb-jump
:ensure t
:init
(add-hook 'xref-backend-functions 'dumb-jump-xref-activate)
(setq xref-show-definitions-function 'xref-show-definitions-completing-read))
;; Snippets
(use-package yasnippet
:ensure t