|
|
@ -38,15 +38,14 @@ Emacs variables are dynamically scoped. That's unusual for most languages, so di |
|
|
|
These functions updates config.el whenever changes in config.org are made. The update will be active after saving. |
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(defun me/tangle-config () |
|
|
|
"Export code blocks from the literate config file |
|
|
|
asynchronously." |
|
|
|
(defun my/tangle-config () |
|
|
|
"Export code blocks from the literate config file." |
|
|
|
(interactive) |
|
|
|
;; prevent emacs from killing until tangle-process finished |
|
|
|
(add-to-list 'kill-emacs-query-functions |
|
|
|
(lambda () |
|
|
|
(or (not (process-live-p (get-process "tangle-process"))) |
|
|
|
(y-or-n-p "\"me/tangle-config\" is running; kill it? ")))) |
|
|
|
(y-or-n-p "\"my/tangle-config\" is running; kill it? ")))) |
|
|
|
(org-babel-tangle-file config-org config-el) |
|
|
|
(message "reloading user-init-file") |
|
|
|
(load-file config-el)) |
|
|
@ -54,13 +53,13 @@ asynchronously." |
|
|
|
(add-hook 'org-mode-hook |
|
|
|
(lambda () |
|
|
|
(if (equal (buffer-file-name) config-org) |
|
|
|
(me/add-local-hook 'after-save-hook 'me/tangle-config)))) |
|
|
|
(my--add-local-hook 'after-save-hook 'my/tangle-config)))) |
|
|
|
|
|
|
|
(defun me/add-local-hook (hook function) |
|
|
|
(defun my--add-local-hook (hook function) |
|
|
|
"Add buffer-local hook." |
|
|
|
(add-hook hook function :local t)) |
|
|
|
|
|
|
|
(defun me/async-process (command &optional name filter) |
|
|
|
(defun my/async-process (command &optional name filter) |
|
|
|
"Start an async process by running the COMMAND string with bash. Return the |
|
|
|
process object for it. |
|
|
|
|
|
|
@ -148,15 +147,15 @@ Restore it to reasonable value after init. Also stop garbage collection during m |
|
|
|
(defconst 30mb 31457280) |
|
|
|
(defconst 50mb 52428800) |
|
|
|
|
|
|
|
(defun me/defer-garbage-collection () |
|
|
|
(defun my--defer-garbage-collection () |
|
|
|
(setq gc-cons-threshold most-positive-fixnum)) |
|
|
|
|
|
|
|
(defun me/restore-garbage-collection () |
|
|
|
(defun my--restore-garbage-collection () |
|
|
|
(run-at-time 1 nil (lambda () (setq gc-cons-threshold 30mb)))) |
|
|
|
|
|
|
|
(add-hook 'emacs-startup-hook 'me/restore-garbage-collection 100) |
|
|
|
(add-hook 'minibuffer-setup-hook 'me/defer-garbage-collection) |
|
|
|
(add-hook 'minibuffer-exit-hook 'me/restore-garbage-collection) |
|
|
|
(add-hook 'emacs-startup-hook 'my--restore-garbage-collection 100) |
|
|
|
(add-hook 'minibuffer-setup-hook 'my--defer-garbage-collection) |
|
|
|
(add-hook 'minibuffer-exit-hook 'my--restore-garbage-collection) |
|
|
|
|
|
|
|
(setq read-process-output-max 1mb) ;; lsp-mode's performance suggest |
|
|
|
#+end_src |
|
|
@ -302,7 +301,7 @@ Restore it to reasonable value after init. Also stop garbage collection during m |
|
|
|
|
|
|
|
** Themes |
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(defun me/toggle-theme () |
|
|
|
(defun my/toggle-theme () |
|
|
|
(interactive) |
|
|
|
(when (or *sys/windows* *sys/linux*) |
|
|
|
(if (eq (car custom-enabled-themes) 'tango-dark) |
|
|
@ -312,7 +311,7 @@ Restore it to reasonable value after init. Also stop garbage collection during m |
|
|
|
(disable-theme 'tango) |
|
|
|
(load-theme 'tango-dark))))) |
|
|
|
|
|
|
|
(bind-key "C-c t" 'me/toggle-theme) |
|
|
|
(bind-key "C-c t" 'my/toggle-theme) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
Windows Theme: |
|
|
@ -708,17 +707,17 @@ end_src |
|
|
|
("<escape>" . company-abort)) |
|
|
|
:hook |
|
|
|
(after-init . global-company-mode) |
|
|
|
(emacs-lisp-mode . me/company-elisp) |
|
|
|
(org-mode . me/company-org) |
|
|
|
(emacs-lisp-mode . my--company-elisp) |
|
|
|
(org-mode . my--company-org) |
|
|
|
:config |
|
|
|
(defun me/company-elisp () |
|
|
|
(defun my--company-elisp () |
|
|
|
(message "set up company for elisp") |
|
|
|
(set (make-local-variable 'company-backends) |
|
|
|
'(company-capf ;; capf needs to be before yasnippet, or lsp fucks up completion for elisp |
|
|
|
company-yasnippet |
|
|
|
company-dabbrev-code |
|
|
|
company-files))) |
|
|
|
(defun me/company-org () |
|
|
|
(defun my--company-org () |
|
|
|
(set (make-local-variable 'company-backends) |
|
|
|
'(company-capf company-files)) |
|
|
|
;; (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) |
|
|
@ -778,7 +777,7 @@ When moving BAR to archive, it will go to FILENAME.org_archive below the heading |
|
|
|
[[http://doc.endlessparentheses.com/Var/org-archive-location.html][Other examples]] |
|
|
|
** org |
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(defun me--buffer-prop-set (name value) |
|
|
|
(defun my--buffer-prop-set (name value) |
|
|
|
"Set a file property called NAME to VALUE in buffer file. |
|
|
|
If the property is already set, replace its value." |
|
|
|
(setq name (downcase name)) |
|
|
@ -797,7 +796,7 @@ If the property is already set, replace its value." |
|
|
|
(beginning-of-line))) |
|
|
|
(insert "#+" name ": " value "\n"))))) |
|
|
|
|
|
|
|
(defun me--buffer-prop-remove (name) |
|
|
|
(defun my--buffer-prop-remove (name) |
|
|
|
"Remove a buffer property called NAME." |
|
|
|
(org-with-point-at 1 |
|
|
|
(when (re-search-forward (concat "\\(^#\\+" name ":.*\n?\\)") |
|
|
@ -821,7 +820,7 @@ If the property is already set, replace its value." |
|
|
|
("S-<left>" . org-shiftleft)) |
|
|
|
|
|
|
|
:config |
|
|
|
(defun me/org-company () |
|
|
|
(defun my--org-company () |
|
|
|
(set (make-local-variable 'company-backends) |
|
|
|
'(company-capf company-files)) |
|
|
|
(add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) |
|
|
@ -992,7 +991,7 @@ Sort agenda by deadline and priority |
|
|
|
|
|
|
|
Customize the org agenda |
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(defun me--org-skip-subtree-if-priority (priority) |
|
|
|
(defun my--org-skip-subtree-if-priority (priority) |
|
|
|
"Skip an agenda subtree if it has a priority of PRIORITY. |
|
|
|
|
|
|
|
PRIORITY may be one of the characters ?A, ?B, or ?C." |
|
|
@ -1013,7 +1012,7 @@ Customize the org agenda |
|
|
|
(org-agenda-start-on-weekday nil) |
|
|
|
(org-agenda-overriding-header "Nächste 7 Tage:"))) |
|
|
|
(alltodo "" |
|
|
|
((org-agenda-skip-function '(or (me--org-skip-subtree-if-priority ?A) |
|
|
|
((org-agenda-skip-function '(or (my--org-skip-subtree-if-priority ?A) |
|
|
|
(org-agenda-skip-if nil '(scheduled deadline)))) |
|
|
|
(org-agenda-overriding-header "Sonstige Aufgaben:"))))))) |
|
|
|
#+END_SRC |
|
|
@ -1068,33 +1067,33 @@ org-roam-db-sync |
|
|
|
:init |
|
|
|
(setq org-roam-v2-ack t) |
|
|
|
|
|
|
|
(defun me--buffer-roam-note-p () |
|
|
|
(defun my--buffer-roam-note-p () |
|
|
|
"Return non-nil if the currently visited buffer is a note." |
|
|
|
(and buffer-file-name |
|
|
|
(string-prefix-p |
|
|
|
(expand-file-name (file-name-as-directory MY--PATH_ORG_ROAM)) |
|
|
|
(file-name-directory buffer-file-name)))) |
|
|
|
|
|
|
|
(defun me/org-roam-filter-by-tag (tag-name) |
|
|
|
(defun my--org-roam-filter-by-tag (tag-name) |
|
|
|
(lambda (node) |
|
|
|
(member tag-name (org-roam-node-tags node)))) |
|
|
|
|
|
|
|
(defun me/org-roam-list-notes-by-tag (tag-name) |
|
|
|
(defun my--org-roam-list-notes-by-tag (tag-name) |
|
|
|
(mapcar #'org-roam-node-file |
|
|
|
(seq-filter |
|
|
|
(me/org-roam-filter-by-tag tag-name) |
|
|
|
(my--org-roam-filter-by-tag tag-name) |
|
|
|
(org-roam-node-list)))) |
|
|
|
|
|
|
|
(defun me/org-roam-refresh-agenda-list () |
|
|
|
(defun my/org-roam-refresh-agenda-list () |
|
|
|
"Add all org roam files with #+filetags: Project" |
|
|
|
(interactive) |
|
|
|
(nconc org-agenda-files |
|
|
|
(me/org-roam-list-notes-by-tag "Project"))) |
|
|
|
(my--org-roam-list-notes-by-tag "Project"))) |
|
|
|
:config |
|
|
|
(require 'org-roam-dailies) ;; ensure the keymap is available |
|
|
|
(org-roam-db-autosync-mode) |
|
|
|
;; build the agenda list the first ime for the session |
|
|
|
(me/org-roam-refresh-agenda-list) |
|
|
|
(my/org-roam-refresh-agenda-list) |
|
|
|
|
|
|
|
:custom |
|
|
|
(org-roam-directory MY--PATH_ORG_ROAM) |
|
|
@ -1583,11 +1582,11 @@ deactivate |
|
|
|
:mode |
|
|
|
("\\.beancount$" . beancount-mode) |
|
|
|
:hook |
|
|
|
(beancount-mode . me/beancount-company) |
|
|
|
(beancount-mode . my--beancount-company) |
|
|
|
:init |
|
|
|
(add-hook 'beancount-mode-hook 'company/beancount-mode-hook) |
|
|
|
:config |
|
|
|
(defun me/beancount-company () |
|
|
|
(defun my--beancount-company () |
|
|
|
(set (make-local-variable 'company-backends) |
|
|
|
'(company-beancount))) |
|
|
|
(setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")) |
|
|
|