diff options
author | jao <jao@gnu.org> | 2021-02-02 06:51:12 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-02-02 06:51:12 +0000 |
commit | 1201c387a5473a6f98d4ae936fbddad834c179a0 (patch) | |
tree | 61c6b34746dee35a9919cb4ae043f26b6b1fdc6d | |
parent | 8b6a44f89550665cce3ec7c7ffab7a9cecf59a4f (diff) | |
download | elibs-1201c387a5473a6f98d4ae936fbddad834c179a0.tar.gz elibs-1201c387a5473a6f98d4ae936fbddad834c179a0.tar.bz2 |
path definitions clean up (and using new libs/config layout)
-rw-r--r-- | init.org | 160 | ||||
-rw-r--r-- | org.org | 4 |
2 files changed, 57 insertions, 107 deletions
@@ -38,14 +38,10 @@ #+BEGIN_SRC emacs-lisp (use-package gnu-elpa-keyring-update :ensure t) #+END_SRC -*** Loading .el files - - Let's prefer .el files over .elc when they former are newer - +*** Loading .el newer than .elc files #+begin_src emacs-lisp (setq load-prefer-newer t) #+end_src - * Initialisation *** Portability macros @@ -67,97 +63,62 @@ #+end_src *** Paths (load, info, exec) - #+begin_src emacs-lisp - (defun jao-exec-path (file) - (let ((fn (expand-file-name file))) - (add-to-list 'exec-path fn nil) - (setenv "PATH" (concat fn ":" (getenv "PATH"))))) - - (defun jao-add-info-path (path) - (require 'info) - (add-to-list 'Info-directory-list path) ) - - (defun jao-load-path (subdir) - (let ((path (expand-file-name subdir local-lisp-dir))) - (when (file-directory-p path) (add-to-list 'load-path path)))) - #+end_src -***** Access to local directories and files - +***** Paths #+begin_src emacs-lisp - (defconst jao-info-dir - (expand-file-name (jao-d-l "~/.emacs.d/info" "~/doc/info"))) - - ;; Defined in bootstrap, just the same in all systems - ;; (defconst jao-emacs-dir - ;; (expand-file-name (jao-d-l "~/.emacs.d/config" "~/etc/emacs"))) + (defvar jao-local-lisp-dir "~/lib/elisp" + "Directory for external elisp libraries and repos") - (defconst jao-custom-dir (expand-file-name "custom" jao-emacs-dir)) + (defvar jao-data-dir (expand-file-name "data" jao-emacs-dir) + "Directory containing static data, such as images.") - (defconst local-lisp-dir (jao-d-l "~/.emacs.d/lib" "~/lib/elisp")) - - (defconst jao-docs-dir (jao-d-l "~/Documents" "~/doc")) - - (defconst jao-data-dir (expand-file-name "data" jao-emacs-dir)) (defun jao-data-file (file) (expand-file-name file jao-data-dir)) - (defconst jao-notes-dir (expand-file-name "~/org")) - - (defconst jao-sink-dir - (file-name-as-directory (expand-file-name "sink" jao-docs-dir))) + (defvar jao-org-dir (expand-file-name "~/org")) - ;; (defvar jao-site-name (if (string-match "^\\([^.]+\\)\\.?" system-name) - ;; (match-string 1 system-name) - ;; system-name)) + (defvar jao-sink-dir + (file-name-as-directory (expand-file-name "~/doc/sink")) + "Directory used for downloads and such.") - (defvar jao-site-name "site") - (defvar jao-site-dir nil) - (setq jao-site-dir (expand-file-name jao-site-name jao-emacs-dir)) - - (defun jao-site-custom-dir () - (expand-file-name "custom" jao-site-dir)) - - (defun jao-local-el (basename) + (defvar jao-site-dir (expand-file-name "site" jao-emacs-dir)) + (defun jao-site-el (basename) (expand-file-name (concat basename ".el") jao-site-dir)) - (defun jao-lib-file (basename) - (expand-file-name basename local-lisp-dir)) - - (defun jao-load-local-el (basename &optional no-def) - (let ((f (concat basename ".el")) - (lf (jao-local-el basename))) - (if (file-exists-p lf) (load lf) - (if (and (not no-def) (file-exists-p f)) (load f))))) + (defun jao-load-site-el (basename) + (let ((lf (jao-site-el basename))) + (if (file-exists-p lf) + (load lf) + (message "Attempted to load non existing %s" lf)))) (defun jao-load-org (file) (let ((file (format "%s.org" (file-name-sans-extension file)))) (literate-elisp-load-file (expand-file-name file jao-emacs-dir)))) #+end_src - +***** Extending paths + #+begin_src emacs-lisp + (defun jao-exec-path (file) + (let ((fn (expand-file-name file))) + (add-to-list 'exec-path fn nil) + (setenv "PATH" (concat fn ":" (getenv "PATH"))))) + + (defun jao-load-path (subdir) + "Add to load path a subdir of `jao-local-lisp-dir'" + (let ((path (expand-file-name subdir jao-local-lisp-dir))) + (when (file-directory-p path) (add-to-list 'load-path path)))) + #+end_src ***** Load path initialisation - #+begin_src emacs-lisp - (add-to-list 'load-path local-lisp-dir) - (add-to-list 'load-path jao-custom-dir) - (add-to-list 'load-path (expand-file-name "lib" jao-emacs-dir)) + (add-to-list 'load-path jao-local-lisp-dir) + (let ((libd (expand-file-name "lib" jao-emacs-dir))) + (add-to-list 'load-path libd) + (dolist (f (directory-files libd t "^[^.]+$")) + (when (file-directory-p f) (add-to-list 'load-path f)))) #+end_src - - Let's also add to our load path all the 'jao' library files which - we publish in a separate repo: - - #+BEGIN_SRC emacs-lisp - (dolist (f (directory-files (expand-file-name "jao" local-lisp-dir) t "^[^.]+$")) - (when (file-directory-p f) (add-to-list 'load-path f))) - #+END_SRC - ***** Info paths - - And extend the info paths to include local stuff: - #+begin_src emacs-lisp - (jao-add-info-path jao-info-dir) - ;; (jao-add-info-path "/usr/local/info") - ;; (jao-add-info-path "/usr/local/share/info") - ;; (jao-add-info-path "/usr/share/info") + (defvar jao-info-dir + (expand-file-name (jao-d-l "~/.emacs.d/info" "~/doc/info"))) + (require 'info) + (add-to-list 'Info-directory-list jao-info-dir) #+end_src *** Preamble (pre.el) Private variables defined in pre.el @@ -173,17 +134,15 @@ Loading pre.el #+begin_src emacs-lisp - (jao-load-local-el "pre" t) + (jao-load-site-el "pre") (setq jao-mails-regexp (regexp-opt jao-mails)) #+end_src *** Custom location of custom.el and co. #+begin_src emacs-lisp - (defvar jao-custom-file (jao-local-el "custom")) - (setq custom-file jao-custom-file) + (setq custom-file (jao-site-el "custom")) (load custom-file) (setq custom-unlispify-tag-names nil) (setq custom-buffer-done-kill t) - (setq widget-image-enable nil) #+end_src *** Bookmarks #+BEGIN_SRC emacs-lisp @@ -455,7 +414,7 @@ (equal "dark" (getenv "JAO_COLOR_SCHEME"))) (setq custom-theme-directory - (expand-file-name "jao/themes" local-lisp-dir)) + (expand-file-name "lib/themes" jao-emacs-dir)) (setq jao-frames-default-font "Hack-9") ;; "Iosevka-10" @@ -585,13 +544,6 @@ (add-hook 'after-init-hook #'jao-trisect t) (message "Welcome to exwm")) #+end_src - - #+begin_src shell :tangle ~/etc/config/X/exwm/xinitrc - unclutter & - xmobar-exwm -d & - emacs=${emacs:-emacs} - $emacs -mm -f jao-exwm-enable - #+end_src *** sway #+begin_src emacs-lisp (defun jao-swaymsg (msg) @@ -614,8 +566,6 @@ (defun jao-sway-enable () (setq jao-sway-enabled-p t) (setq jao-browse-doc-use-emacs-p t) - ;; (setq frame-background-mode (if (jao-colors-scheme-dark-p) 'dark 'light)) - ;; (frame-set-background-mode nil) (jao-themes-setup) (jao-toggle-inactive-mode-line t) (jao-trisect) @@ -993,7 +943,7 @@ * Calendar, diary, weather *** Diary #+BEGIN_SRC emacs-lisp - (setq diary-file (expand-file-name "diary" jao-notes-dir) + (setq diary-file (expand-file-name "diary" jao-org-dir) diary-display-function 'diary-fancy-display diary-mail-addr "jao@localhost") @@ -1306,6 +1256,7 @@ *** images #+begin_src emacs-lisp (setq image-use-external-converter t) + (setq widget-image-enable nil) #+end_src *** misc #+begin_src emacs-lisp @@ -2444,7 +2395,7 @@ (w3m-display-mode 'dual-pane)) :init (setq w3m-add-user-agent nil - w3m-command (jao-d-l "/usr/local/bin/w3m" "w3m") + w3m-command "w3m" w3m-confirm-leaving-secure-page nil w3m-cookie-accept-bad-cookies t w3m-use-tab nil @@ -2455,7 +2406,6 @@ w3m-form-input-textarea-buffer-lines 40 w3m-history-minimize-in-new-session t w3m-history-reuse-history-elements nil - w3m-icon-directory (expand-file-name "w3m/icons/" local-lisp-dir) w3m-image-no-idle-timer t w3m-make-new-session t w3m-profile-directory "~/.w3m" @@ -3329,6 +3279,11 @@ :ensure t :commands company-lsp) #+end_src +*** JSON + #+BEGIN_SRC emacs-lisp + (use-package json-mode :ensure t) + ;; (use-package json-navigator :ensure nil) + #+END_SRC * Programming languages *** Elisp Reporting bugs @@ -3717,7 +3672,7 @@ #+END_SRC *** Coq #+BEGIN_SRC emacs-lisp :tangle no :load no - (load (expand-file-name "pg/generic/proof-site" local-lisp-dir)) + (load (expand-file-name "pg/generic/proof-site" jao-local-lisp-dir)) (use-package company-coq :ensure t @@ -3735,20 +3690,15 @@ (when (jao-load-path "ri-emacs") (setq ri-ruby-script - (expand-file-name "ri-emacs/ri-emacs.rb" local-lisp-dir)) + (expand-file-name "ri-emacs/ri-emacs.rb" jao-local-lisp-dir)) (setq ri-ruby-program "ruby") - (autoload 'ri (expand-file-name "ri-emacs/ri-ruby.el" local-lisp-dir)) + (autoload 'ri (expand-file-name "ri-emacs/ri-ruby.el" jao-local-lisp-dir)) (add-hook 'ruby-mode-hook (lambda () (local-set-key [f1] 'ri) (local-set-key [f2] 'ri-ruby-complete-symbol) (local-set-key [f4] 'ri-ruby-show-args)))) #+END_SRC -*** JSON - #+BEGIN_SRC emacs-lisp - (use-package json-mode :ensure t) - ;; (use-package json-navigator :ensure nil) - #+END_SRC * Graphics *** Images #+begin_src emacs-lisp @@ -3958,7 +3908,7 @@ #+end_src *** Signel #+begin_src emacs-lisp - (literate-elisp-load-file (jao-lib-file "jao/net/signel.org")) + (jao-load-org "lib/net/signel.org") (with-eval-after-load "tracking" (jao-tracking-face 'signel-notification) (jao-shorten-modes 'signel-chat-mode)) @@ -4169,7 +4119,7 @@ #+end_src *** spotify #+begin_src emacs-lisp - (jao-maybe-tangle (jao-lib-file "jao/media/espotify")) + (jao-maybe-tangle "lib/media/espotify") (use-package espotify) @@ -4389,5 +4339,5 @@ #+end_src * Last minute (post.el) #+begin_src emacs-lisp - (jao-load-local-el "post" t) + (jao-load-site-el "post") #+end_src @@ -8,7 +8,7 @@ org-completion-use-ido nil org-cycle-separator-lines 0 ;; no blank lines when all colapsed org-deadline-warning-days 14 - org-directory jao-notes-dir + org-directory jao-org-dir org-default-notes-file (expand-file-name "inbox.org" org-directory) org-ellipsis " .." ;; ↴ org-email-link-description-format "Email %c: %s" @@ -51,7 +51,7 @@ (setq org-agenda-custom-commands '(("w" todo "WAITING" nil) ("W" agenda "" ((org-agenda-ndays 21)))) - org-agenda-files (list jao-notes-dir) + org-agenda-files (list jao-org-dir) org-agenda-include-diary t org-agenda-include-inactive-timestamps t org-agenda-inhibit-startup nil |