From 94644d01f2a816fdaa61c8e2b435fce51a68090d Mon Sep 17 00:00:00 2001 From: dx Date: Fri, 17 Jul 2020 21:31:16 +0100 Subject: +doom dashboard config to obsolete folder --- Doom/.config/doom/obsolete/literate.org | 105 ++++++++++++++++++++++++++++++ Doom/.config/doom/obsolete/no_compile.org | 53 +++++++++++++++ Doom/.config/doom/org/literate.org | 105 ------------------------------ 3 files changed, 158 insertions(+), 105 deletions(-) create mode 100644 Doom/.config/doom/obsolete/literate.org create mode 100644 Doom/.config/doom/obsolete/no_compile.org delete mode 100644 Doom/.config/doom/org/literate.org (limited to 'Doom/.config') diff --git a/Doom/.config/doom/obsolete/literate.org b/Doom/.config/doom/obsolete/literate.org new file mode 100644 index 0000000..53bd6a2 --- /dev/null +++ b/Doom/.config/doom/obsolete/literate.org @@ -0,0 +1,105 @@ +#+TITLE: Literate configuration (NO LONGER IN USE) + +* Preclude +My setup to produce a literate configuration. +Allows me to write org files all around the /doom-private-dir/ and access them. +Also shaved like 0.2s off my loading time. + +/Note/: My current literate system now uses the =org-babel-load*= functions to handle most of the hard work. +It's easier to use and manage, and I just don't use that many org files anymore so no need for such a big setup. +* Constants +Initialise some basic constants for where stuff is. +- literate/bin-dir: Where to compile to +- literate/preloaded-files: Relative to ~$DOOM~, which files are already + preloaded/don't need to be compiled +#+BEGIN_SRC elisp +(defconst dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")) "Directory to store elisp compiled files") +(defconst dx:literate/load-files '("~/.doom.d/org/personal.org") "Files to load after compilation") +(defconst dx:literate/directory (expand-file-name (concat doom-private-dir "org/")) "Directory to get org files from") +#+END_SRC +* Remove function +When loading the lisp, we need to load everything excluding "config.el" (preloaded by doom) and "literate.el" (loaded by "config.el"). +We'll make a very specific remove function that will remove entries from a given list and return the new list, given the fact that the files variable will be a list of fully expanded file names. +#+BEGIN_SRC elisp +(defun dx:literate/remove-mult (remove-files files) + "Remove any occurrences of `remove-files' from `files'" + (let ((parsed-remove-files (map 'list + #'(lambda (i) (expand-file-name (concat doom-private-dir i))) + remove-files))) ; Generate a list of all fully expanded files to remove + (remove-if #'(lambda (l) (member l parsed-remove-files)) files))) ; remove any files that are in the remove-files +#+END_SRC +* Destination for parser +Generate the destination for a literate config org file to parse to, in this case the bin folder in the private directory. +This is not fitted onto the parser because the parser could be fitted to multiple /differing/ outputs easily if it isn't specified a destination. +#+BEGIN_SRC elisp +(defun dx:literate/destination(SRC) + "Parse a src.org file to a bin/src.el file" + (replace-regexp-in-string ".*/\\(\\w+\\).org" + (expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC)) +#+END_SRC +* Parser +** Tangle function +First we need to get some sort of parser which can, given a source org file and a destination, parse and produce an Emacs lisp file. +We'll copy this from the literate module of doom. +#+BEGIN_SRC elisp +(defun dx:literate/tangle (SRC DEST) + "Tangle a source org file into a destination el file using a new emacs instance" + (let ((default-directory doom-private-dir)) + (when (file-newer-than-file-p SRC DEST) + (let ((output (get-buffer-create "*org-tangle*"))) + (unwind-protect + (async-shell-command + (concat "emacs " + "-q " "--batch " + "-l " "ob-tangle " + "--eval " + (format "'(org-babel-tangle-file %S %S)'" SRC DEST)) + "*org-tangle-messages*" + "*org-tangle-errors*")))))) +#+END_SRC +** Popup rules +I don't want Emacs to focus onto the output buffer of the tangling process when I save, which is what happens with a standard async-shell-command. +So setup a rule for the 'messages' and 'errors' buffers to not focus them (by setting their time to live to 0). +#+BEGIN_SRC elisp +(set-popup-rule! "\*org-tangle-.*" :ttl 0 :quit t) +#+END_SRC +* Hook on save +Now we need to make a hook function that, when the current buffer is an org file in the doom directory, will run the literate config procedure from above. +Use this hook function and add it to the after-save-hook once org mode has been loaded. +README.org has been added as an exception because it doesn't contain literate contents. +#+BEGIN_SRC elisp +(defun dx:literate/compile-hook () + "Any org file within $DOOM/org will be compiled on save" + (when (and (eq major-mode 'org-mode) + (or (file-in-directory-p buffer-file-name doom-private-dir) + (file-in-directory-p buffer-file-name (concat doom-private-dir "org"))) + (not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org"))))) + (dx:literate/tangle buffer-file-name (dx:literate/destination buffer-file-name)))) + +(after! org + (add-hook 'after-save-hook #'dx:literate/compile-hook)) +#+END_SRC +* Procedure for all files +A procedure that parses all the org files in a given directory into Emacs lisp +files, using the parser function made. Assume all org files in the "location" +directory contribute to the config. +The location is not set because this function could be easily programmed to use +multiple /differing/ sources to produce the config. The tangle function is set +because this is the function we'll be using for tangling all org files to ELisp files. +#+BEGIN_SRC elisp +(defun dx:literate/tangle-all (&optional location) + "Tangle all org files in `location' to el files in the `destination'" + (interactive) + (or location (setq location doom-private-dir)) + (message "Starting compilation process") + (let ((files (directory-files-recursively location ".org"))) + (dolist (file files) + (message "Compiling and parsing %s" file) + (dx:literate/tangle file (dx:literate/destination file))))) +#+END_SRC +* Load configuration +Final step of the literate cycle: load the config for the first time. Load any org files in =dx:literate/load-files=. +#+BEGIN_SRC elisp +(dolist (file dx:literate/load-files) + (load (dx:literate/destination file))) +#+END_SRC diff --git a/Doom/.config/doom/obsolete/no_compile.org b/Doom/.config/doom/obsolete/no_compile.org new file mode 100644 index 0000000..fb6e217 --- /dev/null +++ b/Doom/.config/doom/obsolete/no_compile.org @@ -0,0 +1,53 @@ +#+TITLE: Don't compile this +#+DESCRIPTION: Old bits and bobs that shouldn't exist anymore + +* Dashboard config +My very own dashboard config using doom dashboard, with these features: +- Custom load message +- Custom splash image and dashboard buffer name +- Custom dashboard sections for myself + +** Benchmark display +Redo the display-benchmark function to display a different message +#+BEGIN_SRC elisp +(defun doom-display-benchmark-h (&optional return-p) + "Display a benchmark, showing number of packages and modules, and how quickly +they were loaded at startup. + +If RETURN-P, return the message as a string instead of displaying it." + (funcall (if return-p #'format #'message) + "εmacs loaded %d packages, %d modules in %.03fs" + (- (length load-path) (length doom--initial-load-path)) + (if doom-modules (hash-table-count doom-modules) 0) + (or doom-init-time + (setq doom-init-time + (float-time (time-subtract (current-time) before-init-time)))))) +#+END_SRC + +** Image and buffer name +Set the splash-image and dashboard buffer name +Space image comes from [[https://flaticon.com][website]] +#+BEGIN_SRC elisp +(setq fancy-splash-image "~/Pictures/SplashScreens/space2.png") ; splash image +(setq +doom-dashboard-name "*dashboard*") +#+END_SRC +** Dashboard items +Set the dashboard functions (segments in overall buffer), set the sections of the interactive menu as well. +#+BEGIN_SRC elisp +(setq +doom-dashboard-functions ; limit the dashboard items + '(doom-dashboard-widget-banner + doom-dashboard-widget-loaded + doom-dashboard-widget-shortmenu)) + +(setq +doom-dashboard-menu-sections ; Set a specific amount of items + '(("Open org-agenda" + :icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face) + :when (fboundp 'org-agenda) + :action org-agenda) + ("Jump to bookmark" + :icon (all-the-icons-octicon "bookmark" :face 'font-lock-keyword-face) + :action bookmark-jump) + ("Open project" + :icon (all-the-icons-material "folder" :face 'font-lock-keyword-face) + :action projectile-switch-project))) +#+END_SRC diff --git a/Doom/.config/doom/org/literate.org b/Doom/.config/doom/org/literate.org deleted file mode 100644 index 53bd6a2..0000000 --- a/Doom/.config/doom/org/literate.org +++ /dev/null @@ -1,105 +0,0 @@ -#+TITLE: Literate configuration (NO LONGER IN USE) - -* Preclude -My setup to produce a literate configuration. -Allows me to write org files all around the /doom-private-dir/ and access them. -Also shaved like 0.2s off my loading time. - -/Note/: My current literate system now uses the =org-babel-load*= functions to handle most of the hard work. -It's easier to use and manage, and I just don't use that many org files anymore so no need for such a big setup. -* Constants -Initialise some basic constants for where stuff is. -- literate/bin-dir: Where to compile to -- literate/preloaded-files: Relative to ~$DOOM~, which files are already - preloaded/don't need to be compiled -#+BEGIN_SRC elisp -(defconst dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")) "Directory to store elisp compiled files") -(defconst dx:literate/load-files '("~/.doom.d/org/personal.org") "Files to load after compilation") -(defconst dx:literate/directory (expand-file-name (concat doom-private-dir "org/")) "Directory to get org files from") -#+END_SRC -* Remove function -When loading the lisp, we need to load everything excluding "config.el" (preloaded by doom) and "literate.el" (loaded by "config.el"). -We'll make a very specific remove function that will remove entries from a given list and return the new list, given the fact that the files variable will be a list of fully expanded file names. -#+BEGIN_SRC elisp -(defun dx:literate/remove-mult (remove-files files) - "Remove any occurrences of `remove-files' from `files'" - (let ((parsed-remove-files (map 'list - #'(lambda (i) (expand-file-name (concat doom-private-dir i))) - remove-files))) ; Generate a list of all fully expanded files to remove - (remove-if #'(lambda (l) (member l parsed-remove-files)) files))) ; remove any files that are in the remove-files -#+END_SRC -* Destination for parser -Generate the destination for a literate config org file to parse to, in this case the bin folder in the private directory. -This is not fitted onto the parser because the parser could be fitted to multiple /differing/ outputs easily if it isn't specified a destination. -#+BEGIN_SRC elisp -(defun dx:literate/destination(SRC) - "Parse a src.org file to a bin/src.el file" - (replace-regexp-in-string ".*/\\(\\w+\\).org" - (expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC)) -#+END_SRC -* Parser -** Tangle function -First we need to get some sort of parser which can, given a source org file and a destination, parse and produce an Emacs lisp file. -We'll copy this from the literate module of doom. -#+BEGIN_SRC elisp -(defun dx:literate/tangle (SRC DEST) - "Tangle a source org file into a destination el file using a new emacs instance" - (let ((default-directory doom-private-dir)) - (when (file-newer-than-file-p SRC DEST) - (let ((output (get-buffer-create "*org-tangle*"))) - (unwind-protect - (async-shell-command - (concat "emacs " - "-q " "--batch " - "-l " "ob-tangle " - "--eval " - (format "'(org-babel-tangle-file %S %S)'" SRC DEST)) - "*org-tangle-messages*" - "*org-tangle-errors*")))))) -#+END_SRC -** Popup rules -I don't want Emacs to focus onto the output buffer of the tangling process when I save, which is what happens with a standard async-shell-command. -So setup a rule for the 'messages' and 'errors' buffers to not focus them (by setting their time to live to 0). -#+BEGIN_SRC elisp -(set-popup-rule! "\*org-tangle-.*" :ttl 0 :quit t) -#+END_SRC -* Hook on save -Now we need to make a hook function that, when the current buffer is an org file in the doom directory, will run the literate config procedure from above. -Use this hook function and add it to the after-save-hook once org mode has been loaded. -README.org has been added as an exception because it doesn't contain literate contents. -#+BEGIN_SRC elisp -(defun dx:literate/compile-hook () - "Any org file within $DOOM/org will be compiled on save" - (when (and (eq major-mode 'org-mode) - (or (file-in-directory-p buffer-file-name doom-private-dir) - (file-in-directory-p buffer-file-name (concat doom-private-dir "org"))) - (not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org"))))) - (dx:literate/tangle buffer-file-name (dx:literate/destination buffer-file-name)))) - -(after! org - (add-hook 'after-save-hook #'dx:literate/compile-hook)) -#+END_SRC -* Procedure for all files -A procedure that parses all the org files in a given directory into Emacs lisp -files, using the parser function made. Assume all org files in the "location" -directory contribute to the config. -The location is not set because this function could be easily programmed to use -multiple /differing/ sources to produce the config. The tangle function is set -because this is the function we'll be using for tangling all org files to ELisp files. -#+BEGIN_SRC elisp -(defun dx:literate/tangle-all (&optional location) - "Tangle all org files in `location' to el files in the `destination'" - (interactive) - (or location (setq location doom-private-dir)) - (message "Starting compilation process") - (let ((files (directory-files-recursively location ".org"))) - (dolist (file files) - (message "Compiling and parsing %s" file) - (dx:literate/tangle file (dx:literate/destination file))))) -#+END_SRC -* Load configuration -Final step of the literate cycle: load the config for the first time. Load any org files in =dx:literate/load-files=. -#+BEGIN_SRC elisp -(dolist (file dx:literate/load-files) - (load (dx:literate/destination file))) -#+END_SRC -- cgit v1.2.3-13-gbd6f