summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2022-12-28 16:46:36 +0000
committerYann Herklotz <git@yannherklotz.com>2022-12-28 23:25:25 +0000
commitbc14498b06022b62f093cd3c34707ad690028a88 (patch)
treea8d8323c2951492b6848136d52fc204a9891d1ad
parent2b6c6f9e21a876631cebe9f15d6e89460c739d71 (diff)
downloadymh-emacs-bc14498b06022b62f093cd3c34707ad690028a88.tar.gz
ymh-emacs-bc14498b06022b62f093cd3c34707ad690028a88.zip
Define org and bib files using expand-file-name
-rw-r--r--init.el105
1 files changed, 62 insertions, 43 deletions
diff --git a/init.el b/init.el
index 6b5405b..745363f 100644
--- a/init.el
+++ b/init.el
@@ -11,7 +11,7 @@
(global-set-key (kbd "C-c z") #'quick-calc)
(global-set-key (kbd "<f5>") #'revert-buffer)
(global-set-key (kbd "C-.") #'other-window)
-(global-set-key (kbd "C-,") #'ymhg/prev-window)
+(global-set-key (kbd "C-,") #'ymh/prev-window)
(global-set-key (kbd "C-\\") #'undo-only)
(global-set-key (kbd "M-SPC") (lambda () (interactive) (insert " ")))
(global-set-key (kbd "C-<tab>") #'tab-bar-switch-to-recent-tab)
@@ -21,17 +21,34 @@
(define-prefix-command 'ymh-map)
(global-set-key (kbd "C-c y") 'ymh-map)
-(define-key ymh-map (kbd "o") #'ymhg/reset-coq-windows)
+(define-key ymh-map (kbd "o") #'ymh/reset-coq-windows)
(define-key ymh-map (kbd "c") #'calendar)
(define-key ymh-map (kbd "C-l") #'org-agenda-open-link)
(define-key ymh-map (kbd "C-p") #'org-previous-link)
(define-key ymh-map (kbd "C-n") #'org-next-link)
-(set-register ?l (cons 'file "~/.emacs.d/loader.org"))
-(set-register ?m (cons 'file "~/Dropbox/org/meetings.org"))
-(set-register ?i (cons 'file "~/Dropbox/org/inbox.org"))
-(set-register ?p (cons 'file "~/Dropbox/org/projects.org"))
-(set-register ?c (cons 'file (format-time-string "~/Dropbox/org/%Y-%m.org")))
+(defvar ymh/org-base-dir)
+(setq ymh/org-base-dir "~/Dropbox/org")
+
+(defvar ymh/bib-base-dir)
+(setq ymh/bib-base-dir "~/Dropbox/bibliography")
+
+(defun ymh/expand-org-file (file)
+ "Expand file name relative to `ymh/org-base-dir'."
+ (expand-file-name file ymh/org-base-dir))
+
+(defun ymh/expand-bib-file (file)
+ "Expand file name relative to `ymh/bib-base-dir'."
+ (expand-file-name file ymh/bib-base-dir))
+
+(set-register ?l (cons 'file (expand-file-name "init.el" user-emacs-directory)))
+(set-register ?m (cons 'file (ymh/expand-org-file "meetings.org")))
+(set-register ?i (cons 'file (ymh/expand-org-file "inbox.org")))
+(set-register ?p (cons 'file (ymh/expand-org-file "projects.org")))
+(set-register ?c (cons 'file (ymh/expand-org-file
+ (format-time-string "%Y-%m.org"))))
+
+(when (eq system-type 'darwin) (customize-set-variable 'native-comp-driver-options '("-Wl,-w")))
(defvar emacs-29-p)
(setq emacs-29-p (version<= "29" emacs-version))
@@ -128,8 +145,7 @@
(dolist (c '(overwrite-mode narrow-to-region narrow-to-page upcase-region downcase-region))
(put c 'disabled nil))
- ;; (set-face-attribute 'default nil :font "Iosevka YMHG Medium-12")
- (set-face-attribute 'default nil :font "IBM Plex Mono SmBld-9")
+ (set-face-attribute 'default nil :font "IBM Plex Mono SmBld-14")
(setq auto-mode-alist
(append
@@ -145,7 +161,7 @@
(progn (setq mac-right-option-modifier 'none
mac-command-modifier 'meta
mac-option-modifier nil)
- (add-hook 'ns-system-appearance-change-functions #'ymhg/apply-theme))))
+ (add-hook 'ns-system-appearance-change-functions #'ymh/apply-theme))))
(use-package ymh-diary
:load-path "ymh-emacs")
@@ -254,7 +270,7 @@ https://yannherklotz.com"))
(use-package diary-lib
:config
- (setq diary-file "~/Dropbox/org/diary")
+ (setq diary-file (ymh/expand-org-file "diary"))
(setq diary-date-forms diary-iso-date-forms)
(setq diary-comment-start ";;")
(setq diary-comment-end "")
@@ -346,10 +362,10 @@ https://yannherklotz.com"))
(setq org-icalendar-include-todo t)
(setq org-icalendar-include-bbdb-anniversaries t)
- (setq org-refile-targets `(("~/Dropbox/org/main.org" :level . 1)
- ("~/Dropbox/org/someday.org" :level . 1)
- ("~/Dropbox/org/projects.org" :maxlevel . 2)
- (,(format-time-string "~/Dropbox/org/%Y-%m.org") :level . 1)))
+ (setq org-refile-targets `((,(ymh/expand-org-file "main.org") :level . 1)
+ (,(ymh/expand-org-file "someday.org") :level . 1)
+ (,(ymh/expand-org-file "projects.org") :maxlevel . 2)
+ (,(ymh/expand-org-file (format-time-string "%Y-%m.org")) :level . 1)))
(setq org-todo-keywords
'((sequence
@@ -397,13 +413,13 @@ https://yannherklotz.com"))
(use-package org-agenda
:bind ("C-c a" . org-agenda)
:init
- (setq org-agenda-files (mapcar 'expand-file-name
- (list "~/Dropbox/org/inbox.org"
- "~/Dropbox/org/main.org"
- "~/Dropbox/org/tickler.org"
- "~/Dropbox/org/projects.org"
- (format-time-string "~/Dropbox/org/%Y-%m.org")
- "~/Dropbox/bibliography/reading_list.org")))
+ (setq org-agenda-files (cons (ymh/expand-bib-file "reading_list.org")
+ (mapcar #'ymh/expand-org-file
+ (list "inbox.org"
+ "main.org"
+ "tickler.org"
+ "projects.org"
+ (format-time-string "%Y-%m.org")))))
(setq org-agenda-custom-commands
'(("w" "At work" tags-todo "@work"
((org-agenda-overriding-header "Work")))
@@ -424,7 +440,7 @@ https://yannherklotz.com"))
:bind ("C-c c" . org-capture)
:init
(setq org-capture-templates
- `(("t" "Todo" entry (file "~/Dropbox/org/inbox.org")
+ `(("t" "Todo" entry (file ,(ymh/expand-bib-file "inbox.org"))
"* TODO %?
:PROPERTIES:
:ID: %(org-id-uuid)
@@ -432,7 +448,7 @@ https://yannherklotz.com"))
:LOGBOOK:
- State \"TODO\" from \"\" %U
:END:" :empty-lines 1)
- ("l" "Link Todo" entry (file "~/Dropbox/org/inbox.org")
+ ("l" "Link Todo" entry (file ,(ymh/expand-bib-file "inbox.org"))
"* TODO %?
:PROPERTIES:
:ID: %(org-id-uuid)
@@ -442,7 +458,7 @@ https://yannherklotz.com"))
:END:
%a" :empty-lines 1)
- ("c" "Contacts" entry (file "~/Dropbox/org/contacts.org")
+ ("c" "Contacts" entry (file ,(ymh/expand-bib-file "contacts.org"))
"* %(org-contacts-template-name)
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
@@ -561,7 +577,7 @@ https://yannherklotz.com"))
(use-package notmuch
:ensure t
:config
- (defun ymhg/notmuch-search-delete-mail (&optional beg end)
+ (defun ymh/notmuch-search-delete-mail (&optional beg end)
"Delete a message."
(interactive (notmuch-interactive-region))
(if (member "deleted" (notmuch-search-get-tags))
@@ -570,7 +586,7 @@ https://yannherklotz.com"))
(notmuch-search-tag (list "+deleted" "-unread") beg end)
(notmuch-search-next-thread))))
- (defun ymhg/notmuch ()
+ (defun ymh/notmuch ()
"Delete a message."
(interactive)
(let ((tab (tab-bar--tab-index-by-name "*MAIL*")))
@@ -580,7 +596,7 @@ https://yannherklotz.com"))
(tab-bar-rename-tab "*MAIL*")
(notmuch)))))
- (defun ymhg/notmuch-show-delete-mail (&optional beg end)
+ (defun ymh/notmuch-show-delete-mail (&optional beg end)
"Delete a message."
(interactive (notmuch-interactive-region))
(if (member "deleted" (notmuch-show-get-tags))
@@ -592,10 +608,10 @@ https://yannherklotz.com"))
(setq notmuch-archive-tags '("-inbox" "-unread" "+archive"))
(setq-default notmuch-search-oldest-first nil)
- (define-key notmuch-show-mode-map (kbd "d") #'ymhg/notmuch-show-delete-mail)
- (define-key notmuch-search-mode-map (kbd "d") #'ymhg/notmuch-search-delete-mail)
+ (define-key notmuch-show-mode-map (kbd "d") #'ymh/notmuch-show-delete-mail)
+ (define-key notmuch-search-mode-map (kbd "d") #'ymh/notmuch-search-delete-mail)
- (global-set-key (kbd "C-c o m") #'ymhg/notmuch)
+ (global-set-key (kbd "C-c o m") #'ymh/notmuch)
(setq notmuch-saved-searches
`((:name "inbox" :query "date:last_month..this_month and tag:inbox not tag:deleted and tag:unread" :key "n")
@@ -623,16 +639,16 @@ https://yannherklotz.com"))
:bind (("C-c y b" . ebib)
("C-c [" . ebib-insert-citation))
:init
- (defun ymhg/ebib-create-identifier (key _) key)
- (setq ebib-preload-bib-files '("~/Dropbox/bibliography/references.bib"))
- (setq ebib-notes-default-file "~/Dropbox/bibliography/notes.org")
+ (defun ymh/ebib-create-identifier (key _) key)
+ (setq ebib-preload-bib-files (list (ymh/expand-bib-file "references.bib")))
+ (setq ebib-notes-default-file (ymh/expand-bib-file "notes.org"))
(setq ebib-notes-template "* %T\n:PROPERTIES:\n%K\n:NOTER_DOCUMENT: papers/%k.pdf\n:END:\n%%?\n")
- (setq ebib-keywords (expand-file-name "~/Dropbox/bibliography/keywords.txt"))
- (setq ebib-reading-list-file "~/Dropbox/bibliography/reading_list.org")
+ (setq ebib-keywords (ymh/expand-bib-file "keywords.txt"))
+ (setq ebib-reading-list-file (ymh/expand-bib-file "reading_list.org"))
(setq ebib-notes-storage 'multiple-notes-per-file)
:config
- (add-to-list 'ebib-notes-template-specifiers '(?k . ymhg/ebib-create-identifier))
- (add-to-list 'ebib-file-search-dirs "~/Dropbox/bibliography/papers")
+ (add-to-list 'ebib-notes-template-specifiers '(?k . ymh/ebib-create-identifier))
+ (add-to-list 'ebib-file-search-dirs (ymh/expand-bib-file "papers"))
(if (eq system-type 'darwin)
(add-to-list 'ebib-file-associations '("pdf" . "open"))
(add-to-list 'ebib-file-associations '("pdf" . nil)))
@@ -711,11 +727,11 @@ https://yannherklotz.com"))
(setq coq-max-background-compilation-jobs 4)
(setq coq-indent-modulestart 0)
- (defun ymhg--reset-coq-indentation ()
+ (defun ymh--reset-coq-indentation ()
"Reset slow indentation."
(setq-local indent-line-function #'indent-relative))
- (add-hook 'coq-mode-hook #'ymhg--reset-coq-indentation t)
+ (add-hook 'coq-mode-hook #'ymh--reset-coq-indentation t)
;;(define-key coq-mode-map (kbd "C-c TAB") #'smie-indent-line)
)
@@ -726,7 +742,7 @@ https://yannherklotz.com"))
:config
(when (eq system-type 'darwin)
(setq alectryon-executable "/nix/store/bvlk3hyrjdgl0sg93rrdr2z71hgza0m9-python3.9-alectryon-1.4.0/bin/alectryon"))
- (defun ymhg/alectryon-preview ()
+ (defun ymh/alectryon-preview ()
"Display an HTML preview of the current buffer."
(interactive)
(let* ((html-fname (make-temp-file "alectryon" nil ".html"))
@@ -735,7 +751,7 @@ https://yannherklotz.com"))
(message "Compilation complete")
(browse-url html-fname)))
(define-key alectryon-mode-map (kbd "C-c u t") #'alectryon-toggle)
- (define-key alectryon-mode-map (kbd "C-c u p") #'ymhg/alectryon-preview))
+ (define-key alectryon-mode-map (kbd "C-c u p") #'ymh/alectryon-preview))
(use-package tex
:ensure auctex
@@ -760,7 +776,7 @@ https://yannherklotz.com"))
(with-eval-after-load 'latex
(define-key LaTeX-mode-map
" "
- #'ymhg/electric-space)))
+ #'ymh/electric-space)))
(use-package ox-hugo
:ensure t)
@@ -836,6 +852,9 @@ https://yannherklotz.com"))
("https://krystalguo.com/?feed=rss2" blog math)
("https://scottaaronson.blog/?feed=rss2" blog math))))
+(use-package markdown-mode
+ :ensure t)
+
(setq gc-cons-threshold (* 1024 1024 10))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))