summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-24 06:37:46 +0100
committerjao <jao@gnu.org>2021-05-24 06:37:46 +0100
commit832d146adb888974ed181147ca87bb49f371e79a (patch)
treeb6aa2c44913f69de4723fffc8ad26895f01cedc1
parent74d813373f82c4a5321a37ee0c308a3f54a8b702 (diff)
downloadelibs-832d146adb888974ed181147ca87bb49f371e79a.tar.gz
elibs-832d146adb888974ed181147ca87bb49f371e79a.tar.bz2
lexical tangling and optional loading
-rw-r--r--.gitignore6
-rw-r--r--blog.org5
-rw-r--r--completion.org4
-rw-r--r--email.org8
-rw-r--r--eww.org4
-rw-r--r--exwm.org4
-rw-r--r--init.org27
-rw-r--r--org.org8
-rw-r--r--readme.org16
9 files changed, 54 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
index 919aafa..32266aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,9 @@
/gnus.el
/init.el
/bin/
+/blog.el
+/completion.el
+/email.el
+/eww.el
+/exwm.el
+/org.el
diff --git a/blog.org b/blog.org
index 624e602..0fd86a7 100644
--- a/blog.org
+++ b/blog.org
@@ -1,8 +1,11 @@
#+title: Org static blog
-#+PROPERTY: header-args :tangle no :comments yes :results silent
+#+property: header-args lexical: t :tangle yes :comments no :results silent
+#+auto_tangle: t
* Vars and setup
#+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(jao-load-path "org-static-blog")
(when (> emacs-major-version 26) (use-package htmlize :ensure t))
(defvar jao-blog-base-dir "~/doc/jao.io")
diff --git a/completion.org b/completion.org
index f245e70..5e0e800 100644
--- a/completion.org
+++ b/completion.org
@@ -1,7 +1,11 @@
#+title: Completion configuration using vertico, consult and friends
+#+property: header-args :lexical t :tangle yes :comments no :results silent
+#+auto_tangle: t
* completion styles
#+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(use-package emacs
:init
(setq completion-category-defaults nil
diff --git a/email.org b/email.org
index 8454f13..6fb334f 100644
--- a/email.org
+++ b/email.org
@@ -1,10 +1,12 @@
#+title: email handling (message mode, bbdb, notmuch, mu4e et al.)
-#+property: header-args :tangle no :comments no :results silent :shebang "#!/bin/bash"
+#+property: header-args :lexical t :tangle yes :comments no :results silent
#+auto_tangle: t
* message mode
*** Customization
#+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(defvar jao-mails "")
(defvar jao-mails-regexp)
(setq jao-mails-regexp (regexp-opt jao-mails))
@@ -399,7 +401,7 @@
:description description)))))))
#+end_src
*** tag shell script
- #+begin_src bash :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755)
+ #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755)
notmuch new > $HOME/var/log/notmuch.log 2>&1
function tag_deleted {
@@ -433,7 +435,7 @@
notmuch tag +deleted +trash -new -unread -- "folder:trash and tag:new"
#+end_src
*** delete tagged shell script
- #+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
+ #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm
notmuch new > $HOME/var/log/notmuch-expire.log 2>&1
notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1
diff --git a/eww.org b/eww.org
index 676e4df..ebabf42 100644
--- a/eww.org
+++ b/eww.org
@@ -1,7 +1,11 @@
#+title: Web browsing using eww
+#+property: header-args :lexical t :tangle yes :comments no :results silent
+#+auto_tangle: t
* Integration with browse-url and afio
#+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(defun jao-eww-browse-url (url &rest r)
"Browse URL using eww."
(jao-afio--goto-www)
diff --git a/exwm.org b/exwm.org
index dd3f67c..ed61a21 100644
--- a/exwm.org
+++ b/exwm.org
@@ -1,7 +1,11 @@
#+title: exwm configuration
+#+property: header-args :lexical t :tangle yes :comments no :results silent
+#+auto_tangle: t
* Load and basic config
#+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(defvar jao-exwm--use-afio t)
(use-package exwm
diff --git a/init.org b/init.org
index dc8c28f..07398f6 100644
--- a/init.org
+++ b/init.org
@@ -1,9 +1,12 @@
-#+PROPERTY: header-args :tangle yes :comments yes :results silent
+#+property: header-args :lexical t :tangle yes :comments no :results silent
+#+auto_tangle: t
* Packages
+*** Header
+ #+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+ #+end_src
*** Use package
- Bootstrap `use-package' (from [[http://www.lunaryorn.com/2015/01/06/my-emacs-configuration-with-use-package.html][here]])
-
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
(package-refresh-contents)
@@ -11,18 +14,18 @@
(require 'use-package)
#+end_src
*** Literate elisp and autotangle
- #+BEGIN_SRC emacs-lisp
+ #+begin_src emacs-lisp
(use-package poly-org :ensure t)
- (use-package literate-elisp :ensure t)
+ ;; (use-package literate-elisp :ensure t)
(use-package org-auto-tangle
:ensure t
:hook (org-mode . org-auto-tangle-mode)
:diminish)
- #+END_SRC
+ #+end_src
*** ELPA Keyring
- #+BEGIN_SRC emacs-lisp
+ #+begin_src emacs-lisp
(use-package gnu-elpa-keyring-update :ensure t)
- #+END_SRC
+ #+end_src
*** Loading .el newer than .elc files, and eln stuff
#+begin_src emacs-lisp
(setq load-prefer-newer t)
@@ -31,9 +34,6 @@
#+end_src
* Initialisation
*** Portability macros
-
- From when we want our configurations to work on an apple tree...
-
#+begin_src emacs-lisp
(defmacro jao-syscase (clauses)
(let ((cls (assoc system-type clauses)))
@@ -48,7 +48,6 @@
(defmacro jao-when-linux (&rest body)
`(jao-syscase ((gnu/linux ,@body))))
#+end_src
-
*** Paths
#+begin_src emacs-lisp
(defvar jao-local-lisp-dir "~/lib/elisp"
@@ -75,10 +74,6 @@
(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))))
-
(defun jao-exec-path (file)
(let ((fn (expand-file-name file)))
(add-to-list 'exec-path fn nil)
diff --git a/org.org b/org.org
index 3dc6b18..3844a88 100644
--- a/org.org
+++ b/org.org
@@ -1,7 +1,11 @@
#+title: Org (and related) mode configuration
+#+property: header-args :lexical t :tangle yes :comments no :results silent
+#+auto_tangle: t
* General configuration
- #+BEGIN_SRC emacs-lisp
+ #+begin_src emacs-lisp
+ ;; -*- lexical-binding: t; -*-
+
(use-package org
:ensure t
:init
@@ -46,7 +50,7 @@
org-use-speed-commands nil ;; t and then ? to see help
org-gnus-prefer-web-links nil))
(require 'org)
- #+END_SRC
+ #+end_src
* Agenda
#+begin_src emacs-lisp
(setq org-agenda-custom-commands
diff --git a/readme.org b/readme.org
index 3a09675..4e0add8 100644
--- a/readme.org
+++ b/readme.org
@@ -1,5 +1,5 @@
#+title: Emacs configuration and personal packages
-#+property: header-args :tangle ~/.emacs.d/init.el :comments yes :results silent
+#+property: header-args :tangle ~/.emacs.d/init.el :comments no :results silent
#+auto_tangle: t
* Bootstrap
@@ -34,7 +34,7 @@
(package-initialize)
#+end_src
- and a tangling helper:
+ and a couple of tangling helper:
#+begin_src emacs-lisp
(defun jao-maybe-tangle (basename)
@@ -44,15 +44,20 @@
(require 'ob-tangle)
(org-babel-tangle-file org el))
el))
+
+ (defun jao-load-org (file)
+ (let ((b (file-name-sans-extension file)))
+ (if (require 'literate-elisp nil t)
+ (let ((file (format "%s.org" b)))
+ (literate-elisp-load-file (expand-file-name file jao-emacs-dir)))
+ (load-file (jao-maybe-tangle b)))))
#+end_src
Finally, we load either init.org or its tangled version from
~jao-emacs-dir~:
#+begin_src emacs-lisp
- (if (require 'literate-elisp nil t)
- (literate-elisp-load-file (expand-file-name "init.org" jao-emacs-dir))
- (load-file (jao-maybe-tangle "init")))
+ (jao-load-org "init")
#+end_src
You can tangle this readme to generate the minimal init.el file above.
@@ -68,7 +73,6 @@
- [[./email.org][email.org]]: generic email handling in emacs.
- [[./gnus.org][gnus.org]]: tangled to gnus.el automatically by init.org, so that it's
ready for loading by Gnus.
-- [[./w3m.org][w3m.org]]: browsing with emacs-w3m.
- [[./eww.org][eww.org]]: browsing with eww.
- [[./exwm.org][exwm.org]]: configuration for exwm, loaded when ~jao-exwmn-enable~ is
called.