literate tangle to modules/ with read-only

This commit is contained in:
Frieder Schlesier 2024-04-18 14:31:30 +02:00
parent 0b81c0e260
commit 2926e77068
8 changed files with 155 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#+title: Setup Fschl Ide Configuration #+title: Setup Fschl Ide Configuration
#+PROPERTY: header-args:emacs-lisp :tangle ./fschl-ide.el :mkdirp yes #+PROPERTY: header-args:emacs-lisp :tangle ./modules/fschl-ide.el :mkdirp yes :tangle-mode "ugo=r"
* Basic configuration * Basic configuration
** Additional Packages ** Additional Packages

View File

@ -1,5 +1,5 @@
#+title: Setup Fschl Org Configuration #+title: Setup Fschl Org Configuration
#+PROPERTY: header-args:emacs-lisp :tangle ./fschl-org.el :mkdirp yes #+PROPERTY: header-args:emacs-lisp :tangle ./modules/fschl-org.el :mkdirp yes :tangle-mode "ugo=r"
* Basic configuration * Basic configuration
** Additional Packages ** Additional Packages
@ -37,7 +37,7 @@ https://github.com/minad/org-modern
(keymap-global-set "C-c o a" #'org-agenda) (keymap-global-set "C-c o a" #'org-agenda)
(keymap-global-set "<f7>" #'org-cycle-agenda-files) (keymap-global-set "<f7>" #'org-cycle-agenda-files)
(keymap-global-set "<f8>" #'find-file org-default-notes-file) ;(keymap-global-set "<f8>" #'find-file org-default-notes-file)
#+end_src #+end_src
* Setup Agenda Files * Setup Agenda Files
@ -71,7 +71,7 @@ https://github.com/minad/org-modern
("PHONE" :foreground "forest green" :weight bold)))) ("PHONE" :foreground "forest green" :weight bold))))
#+end_src #+end_src
* TODO Add Week to Calendar * Add Week to Calendar
- [ ] this should go into 'fschl-ui.el' - [ ] this should go into 'fschl-ui.el'
@ -95,7 +95,7 @@ https://github.com/minad/org-modern
- https://orgmode.org/manual/Template-elements.html - https://orgmode.org/manual/Template-elements.html
- https://orgmode.org/manual/Template-expansion.html - https://orgmode.org/manual/Template-expansion.html
** TODO Export Letter ** TODO Export Letter [0/1]
- [ ] hide behind a 'latex installed' guard - [ ] hide behind a 'latex installed' guard
#+begin_src emacs-lisp #+begin_src emacs-lisp
(eval-after-load 'ox '(require 'ox-koma-letter)) (eval-after-load 'ox '(require 'ox-koma-letter))
@ -122,6 +122,28 @@ https://github.com/minad/org-modern
(expand-file-name (format "%s.org" name) "~/Documents/letters/") )) (expand-file-name (format "%s.org" name) "~/Documents/letters/") ))
#+end_src #+end_src
** Org-Tempo shortcuts
#+begin_src emacs-lisp
;; This is needed as of Org 9.2
(use-package org-tempo
:ensure nil
:after org
:config
(dolist (item '(("sh" . "src sh")
("el" . "src emacs-lisp")
("li" . "src lisp")
("sc" . "src scheme")
("ts" . "src typescript")
("py" . "src python")
("go" . "src go")
("einit" . "src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes")
("emodule" . "src emacs-lisp :tangle ~/.config/emacs/modules/fschl-MODULE.el :mkdirp yes")
("yaml" . "src yaml")
("json" . "src json")))
(add-to-list 'org-structure-template-alist item)))
#+end_src
** Capture Templates ** Capture Templates
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-capture-templates (setq org-capture-templates

View File

@ -16,7 +16,7 @@ solution, e.g. set it up to auto-tangle all .org files within/below
- State "HOLD" from "TODO" [2024-02-21 Wed 17:19] \\ - State "HOLD" from "TODO" [2024-02-21 Wed 17:19] \\
would make it impossible to use the config on windows. would make it impossible to use the config on windows.
windows compatiblity is the only reason to keep this separate from my =guix home= config windows compatiblity is the only reason to keep this separate from my =guix home= config
*** TODO refactor to use crafted-emacs as git-submodule *** DONE refactor to use crafted-emacs as git-submodule
*** TODO attempt windows-compatibility for work *** TODO attempt windows-compatibility for work
** Missing Features ** Missing Features
@ -45,7 +45,9 @@ is it possible to detect based on existing content?
*** TODO make org-roam work with simple key chords *** TODO make org-roam work with simple key chords
*** TODO beautify org-mode *** CANCELLED beautify org-mode
- State "CANCELLED" from "TODO" [2024-04-18 Thu 14:08] \\
org-modern is fine enough
- https://zhangda.wordpress.com/2016/02/15/configurations-for-beautifying-emacs-org-mode/ - https://zhangda.wordpress.com/2016/02/15/configurations-for-beautifying-emacs-org-mode/
- https://zzamboni.org/post/beautifying-org-mode-in-emacs/ - https://zzamboni.org/post/beautifying-org-mode-in-emacs/
- https://lucidmanager.org/productivity/ricing-org-mode/ - https://lucidmanager.org/productivity/ricing-org-mode/

51
init.el
View File

@ -19,6 +19,9 @@
(require 'crafted-writing-packages) (require 'crafted-writing-packages)
(add-to-list 'package-selected-packages 'vterm) (add-to-list 'package-selected-packages 'vterm)
(add-to-list 'package-selected-packages 'all-the-icons-dired)
(add-to-list 'package-selected-packages 'ranger)
(add-to-list 'package-selected-packages 'dired-ranger)
(package-install-selected-packages :noconfirm) (package-install-selected-packages :noconfirm)
@ -36,6 +39,16 @@
(unless crafted-startup-inhibit-splash (unless crafted-startup-inhibit-splash
(setq initial-buffer-choice #'crafted-startup-screen)) (setq initial-buffer-choice #'crafted-startup-screen))
(defvar dw/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
(defvar dw/is-guix-system (and (eq system-type 'gnu/linux)
(file-exists-p "/etc/os-release")
(with-temp-buffer
(insert-file-contents "/etc/os-release")
(search-forward "ID=guix" nil t))
t))
(keymap-global-unset "M-#") (keymap-global-unset "M-#")
(define-key global-map (kbd "s-b") 'switch-to-buffer) (define-key global-map (kbd "s-b") 'switch-to-buffer)
@ -44,12 +57,34 @@
(define-key global-map (kbd "s-o") 'other-window) (define-key global-map (kbd "s-o") 'other-window)
(define-key global-map (kbd "C-z") nil) (define-key global-map (kbd "C-z") nil)
(defvar fschl-org-file (expand-file-name "fschl-org.el" user-emacs-directory)) (use-package all-the-icons-dired)
(when (and fschl-org-file (use-package dired-ranger)
(file-exists-p fschl-org-file))
(load fschl-org-file nil :nomessage))
(defvar fschl-ide-file (expand-file-name "fschl-ide.el" user-emacs-directory)) (defun dw/dired-mode-hook ()
(when (and fschl-ide-file (interactive)
(file-exists-p fschl-ide-file)) (dired-hide-details-mode 0)
(load fschl-ide-file nil :nomessage)) (unless (or dw/is-termux
(string-equal "/gnu/store/" (expand-file-name default-directory)))
(all-the-icons-dired-mode 1))
(hl-line-mode 1))
(use-package dired
:ensure nil
:bind (:map dired-mode-map
("b" . dired-up-directory)
("H" . dired-hide-details-mode))
:config
(setq dired-listing-switches "-agho --group-directories-first"
dired-omit-files "^\\.[^.].*"
dired-omit-verbose nil
dired-dwim-target 'dired-dwim-target-next
dired-hide-details-hide-symlink-targets nil
dired-kill-when-opening-new-dired-buffer t
delete-by-moving-to-trash t)
(add-hook 'dired-mode-hook #'dw/dired-mode-hook)
(global-set-key (kbd "s-j") #'dired-jump))
(load (expand-file-name "modules/fschl-ide.el" user-emacs-directory))
(load (expand-file-name "modules/fschl-org.el" user-emacs-directory))

View File

@ -1,5 +1,5 @@
#+title: Setup Crafted Emacs User Configuration File #+title: Setup Crafted Emacs User Configuration File
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes #+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes :tangle-mode "ugo=r"
* Basic configuration * Basic configuration
@ -27,8 +27,14 @@
(require 'crafted-ui-packages) (require 'crafted-ui-packages)
(require 'crafted-ide-packages) (require 'crafted-ide-packages)
(require 'crafted-writing-packages) (require 'crafted-writing-packages)
#+end_src
** Add more packages
#+begin_src emacs-lisp
(add-to-list 'package-selected-packages 'vterm) (add-to-list 'package-selected-packages 'vterm)
(add-to-list 'package-selected-packages 'all-the-icons-dired)
(add-to-list 'package-selected-packages 'ranger)
(add-to-list 'package-selected-packages 'dired-ranger)
(package-install-selected-packages :noconfirm) (package-install-selected-packages :noconfirm)
#+end_src #+end_src
@ -50,6 +56,24 @@
(setq initial-buffer-choice #'crafted-startup-screen)) (setq initial-buffer-choice #'crafted-startup-screen))
#+end_src #+end_src
** Identify the system
Some of my personal configuration depends on the system we're running on.
- [ ] add windows
#+begin_src emacs-lisp
(defvar dw/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
(defvar dw/is-guix-system (and (eq system-type 'gnu/linux)
(file-exists-p "/etc/os-release")
(with-temp-buffer
(insert-file-contents "/etc/os-release")
(search-forward "ID=guix" nil t))
t))
#+end_src
** Custom key remap ** Custom key remap
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -61,16 +85,43 @@
(define-key global-map (kbd "s-o") 'other-window) (define-key global-map (kbd "s-o") 'other-window)
(define-key global-map (kbd "C-z") nil) (define-key global-map (kbd "C-z") nil)
#+end_src #+end_src
** Load my custom files
#+begin_src emacs-lisp
(defvar fschl-org-file (expand-file-name "fschl-org.el" user-emacs-directory))
(when (and fschl-org-file
(file-exists-p fschl-org-file))
(load fschl-org-file nil :nomessage))
(defvar fschl-ide-file (expand-file-name "fschl-ide.el" user-emacs-directory)) ** Dired
(when (and fschl-ide-file
(file-exists-p fschl-ide-file)) #+begin_src emacs-lisp
(load fschl-ide-file nil :nomessage))
(use-package all-the-icons-dired)
(use-package dired-ranger)
(defun dw/dired-mode-hook ()
(interactive)
(dired-hide-details-mode 0)
(unless (or dw/is-termux
(string-equal "/gnu/store/" (expand-file-name default-directory)))
(all-the-icons-dired-mode 1))
(hl-line-mode 1))
(use-package dired
:ensure nil
:bind (:map dired-mode-map
("b" . dired-up-directory)
("H" . dired-hide-details-mode))
:config
(setq dired-listing-switches "-agho --group-directories-first"
dired-omit-files "^\\.[^.].*"
dired-omit-verbose nil
dired-dwim-target 'dired-dwim-target-next
dired-hide-details-hide-symlink-targets nil
dired-kill-when-opening-new-dired-buffer t
delete-by-moving-to-trash t)
(add-hook 'dired-mode-hook #'dw/dired-mode-hook)
(global-set-key (kbd "s-j") #'dired-jump))
#+end_src #+end_src
** Load my custom files
#+begin_src emacs-lisp
(load (expand-file-name "modules/fschl-ide.el" user-emacs-directory))
(load (expand-file-name "modules/fschl-org.el" user-emacs-directory))
#+end_src

View File

@ -22,7 +22,7 @@
(keymap-global-set "C-c o a" #'org-agenda) (keymap-global-set "C-c o a" #'org-agenda)
(keymap-global-set "<f7>" #'org-cycle-agenda-files) (keymap-global-set "<f7>" #'org-cycle-agenda-files)
(keymap-global-set "<f8>" #'find-file org-default-notes-file) ;(keymap-global-set "<f8>" #'find-file org-default-notes-file)
(setq org-agenda-files (setq org-agenda-files
(quote ("~/Documents/Org/inbox.org" (quote ("~/Documents/Org/inbox.org"
@ -84,6 +84,24 @@
(let ((name (read-string "Filename: "))) (let ((name (read-string "Filename: ")))
(expand-file-name (format "%s.org" name) "~/Documents/letters/") )) (expand-file-name (format "%s.org" name) "~/Documents/letters/") ))
;; This is needed as of Org 9.2
(use-package org-tempo
:ensure nil
:after org
:config
(dolist (item '(("sh" . "src sh")
("el" . "src emacs-lisp")
("li" . "src lisp")
("sc" . "src scheme")
("ts" . "src typescript")
("py" . "src python")
("go" . "src go")
("einit" . "src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes")
("emodule" . "src emacs-lisp :tangle ~/.config/emacs/modules/fschl-MODULE.el :mkdirp yes")
("yaml" . "src yaml")
("json" . "src json")))
(add-to-list 'org-structure-template-alist item)))
(setq org-capture-templates (setq org-capture-templates
'(("t" "todo list item" entry '(("t" "todo list item" entry
(file+olp+datetree "~/Documents/Org/inbox.org") (file+olp+datetree "~/Documents/Org/inbox.org")