diff options
-rw-r--r-- | config.org | 94 |
1 files changed, 29 insertions, 65 deletions
diff --git a/config.org b/config.org index 9a449fc..705615c 100644 --- a/config.org +++ b/config.org | |||
@@ -527,10 +527,11 @@ The =saveplace= package saves where I've been in my visited files. | |||
527 | 527 | ||
528 | Since storage is cheap, but I'm impatient -- especially on Windows -- | 528 | Since storage is cheap, but I'm impatient -- especially on Windows -- |
529 | I'm not going to check whether the files =save-place= saves the places | 529 | I'm not going to check whether the files =save-place= saves the places |
530 | of are readable or not. | 530 | of are readable or not when I'm not at home. |
531 | 531 | ||
532 | #+begin_src emacs-lisp :noweb-ref settings | 532 | #+begin_src emacs-lisp :noweb-ref settings |
533 | (setq-default save-place-forget-unreadable-files (when-at :home)) | 533 | (setq-default save-place-forget-unreadable-files |
534 | (memq system-type '(gnu gnu/linux gnu/kfreebsd))) | ||
534 | #+end_src | 535 | #+end_src |
535 | 536 | ||
536 | #+begin_src emacs-lisp :noweb-ref modes | 537 | #+begin_src emacs-lisp :noweb-ref modes |
@@ -730,7 +731,6 @@ contents of the files the represent on-disk. Thus, we have | |||
730 | (global-auto-revert-mode +1) | 731 | (global-auto-revert-mode +1) |
731 | #+end_src | 732 | #+end_src |
732 | 733 | ||
733 | |||
734 | * Editing | 734 | * Editing |
735 | 735 | ||
736 | ** Lines | 736 | ** Lines |
@@ -976,7 +976,6 @@ checks for a shebang). | |||
976 | (setq-default lisp-indent-function #'common-lisp-indent-function) | 976 | (setq-default lisp-indent-function #'common-lisp-indent-function) |
977 | #+end_src | 977 | #+end_src |
978 | 978 | ||
979 | |||
980 | * Applications | 979 | * Applications |
981 | 980 | ||
982 | Emacs is well-known for its ability to subsume one's entire computing | 981 | Emacs is well-known for its ability to subsume one's entire computing |
@@ -1317,42 +1316,6 @@ I use both Linux (at home) and Windows (at work). To make Emacs | |||
1317 | easier to use in both systems, I've included various system-specific | 1316 | easier to use in both systems, I've included various system-specific |
1318 | settings and written some ancillary scripts. | 1317 | settings and written some ancillary scripts. |
1319 | 1318 | ||
1320 | ** Determine where I am | ||
1321 | :PROPERTIES: | ||
1322 | :header-args: :noweb-ref when-at | ||
1323 | :END: | ||
1324 | |||
1325 | This macro needs to go into =init.el=, /before/ loading =config.el= -- | ||
1326 | because I've used the =when-at= form in the =:tangle= directive for | ||
1327 | the scripts in this section. | ||
1328 | |||
1329 | #+begin_src emacs-lisp | ||
1330 | (defmacro when-at (conditions &rest commands) | ||
1331 | "Run COMMANDS, or let the user know, when at a specific place. | ||
1332 | |||
1333 | CONDITIONS are one of `:work', `:home', or a list beginning with | ||
1334 | those and other conditions to check. COMMANDS are only run if | ||
1335 | all CONDITIONS are met. | ||
1336 | |||
1337 | If COMMANDS is empty or nil, simply return the result of CONDITIONS." | ||
1338 | (declare (indent 1)) | ||
1339 | (let ((at-work '(memq system-type '(ms-dos windows-nt))) | ||
1340 | (at-home '(memq system-type '(gnu gnu/linux gnu/kfreebsd)))) | ||
1341 | (pcase conditions | ||
1342 | (:work (if commands `(when ,at-work ,@commands) at-work)) | ||
1343 | (:home (if commands `(when ,at-home ,@commands) at-home)) | ||
1344 | ((guard (eq (car conditions) :work)) | ||
1345 | (if commands | ||
1346 | `(when (and ,at-work ,@(cdr conditions)) | ||
1347 | ,@commands) | ||
1348 | `(and ,at-work ,@(cdr conditions)))) | ||
1349 | ((guard (eq (car conditions) :home)) | ||
1350 | (if commands | ||
1351 | `(when (and ,at-home ,@(cdr conditions)) | ||
1352 | ,@commands) | ||
1353 | `(and ,at-work ,@(cdr conditions))))))) | ||
1354 | #+end_src | ||
1355 | |||
1356 | ** Linux (home) | 1319 | ** Linux (home) |
1357 | :PROPERTIES: | 1320 | :PROPERTIES: |
1358 | :header-args: :noweb-ref linux-specific | 1321 | :header-args: :noweb-ref linux-specific |
@@ -1510,60 +1473,61 @@ my config here /logically/, while keeping the generated file organized | |||
1510 | ) | 1473 | ) |
1511 | ;;; FUNCTIONS | 1474 | ;;; FUNCTIONS |
1512 | <<functions>> | 1475 | <<functions>> |
1476 | |||
1513 | ;;; SETTINGS | 1477 | ;;; SETTINGS |
1514 | <<settings>> | 1478 | <<settings>> |
1479 | |||
1515 | ;;; SYSTEM-DEPENDENT SETTINGS | 1480 | ;;; SYSTEM-DEPENDENT SETTINGS |
1516 | (when-at :home | 1481 | ;; at home |
1517 | <<linux-specific>> | 1482 | (eval-and-compile |
1518 | ) ; end when-at :home | 1483 | (when (memq system-type '(gnu gnu/linux gnu/kfreebsd)) |
1519 | (when-at :work | 1484 | <<linux-specific>> |
1520 | <<windows-specific>> | 1485 | )) |
1521 | ) ; end when-at :work | 1486 | ;; at work |
1487 | (eval-and-compile | ||
1488 | (when (memq system-type '(ms-dos windows-nt)) | ||
1489 | <<windows-specific>> | ||
1490 | )) | ||
1491 | |||
1522 | ;;; MODES | 1492 | ;;; MODES |
1523 | <<modes>> | 1493 | <<modes>> |
1494 | |||
1524 | ;;; HOOKS | 1495 | ;;; HOOKS |
1525 | <<hooks>> | 1496 | <<hooks>> |
1497 | |||
1526 | ;;; BINDINGS | 1498 | ;;; BINDINGS |
1527 | <<bindings>> | 1499 | <<bindings>> |
1500 | ;;; config.el ends here | ||
1528 | #+end_src | 1501 | #+end_src |
1529 | 1502 | ||
1530 | ** Emacs's files | 1503 | ** init.el |
1531 | |||
1532 | *** init.el | ||
1533 | :PROPERTIES: | 1504 | :PROPERTIES: |
1534 | :header-args: :tangle init.el :noweb yes | 1505 | :header-args: :tangle init.el :noweb yes |
1535 | :END: | 1506 | :END: |
1536 | 1507 | ||
1537 | The classic Emacs initiation file. | 1508 | The classic Emacs initiation file. |
1538 | 1509 | ||
1539 | **** Use lexical binding when evaluating =init.el= | 1510 | *** Header |
1540 | 1511 | ||
1541 | #+begin_src emacs-lisp | 1512 | #+begin_src emacs-lisp |
1542 | ;; init.el -*- lexical-binding: t -*- | 1513 | ;;; init.el -*- lexical-binding: t -*- |
1543 | <<disclaimer>> | 1514 | <<disclaimer>> |
1515 | ;;; Code: | ||
1544 | #+end_src | 1516 | #+end_src |
1545 | 1517 | ||
1546 | **** Prefer newer files to older files | 1518 | *** Prefer newer files to older files |
1547 | 1519 | ||
1548 | #+begin_src emacs-lisp | 1520 | #+begin_src emacs-lisp |
1549 | (setq-default load-prefer-newer t) | 1521 | (setq-default load-prefer-newer t) |
1550 | #+end_src | 1522 | #+end_src |
1551 | 1523 | ||
1552 | **** =when-at= | 1524 | *** Load the config |
1553 | |||
1554 | See [[*Determine where I am][the definition above]] for rationale as to why this is here. | ||
1555 | |||
1556 | #+begin_src emacs-lisp | ||
1557 | <<when-at>> | ||
1558 | #+end_src | ||
1559 | |||
1560 | **** Load the config | ||
1561 | 1525 | ||
1562 | I keep most of my config in =config.el=, which is tangled directly from | 1526 | I keep most of my config in =config.el=, which is tangled directly from |
1563 | this file. This init just loads that file, either from lisp ~or | 1527 | this file. This init just loads that file, either from lisp |
1564 | directly from Org if it's newer~. I found out that =org-babel-load-file= | 1528 | or directly from Org if it's newer. /Note/ the longish comment before |
1565 | /caches/ its runs, and checks for me whether the .org or .el file is | 1529 | the =unless= form -- it was pretty tough for me to wrap my head around |
1566 | newer. /Plus/ it can byte-compile!! | 1530 | the needed boolean expression to tangle config.org. Booleans, yall! |
1567 | 1531 | ||
1568 | #+begin_src emacs-lisp | 1532 | #+begin_src emacs-lisp |
1569 | (let* (;; Speed up init | 1533 | (let* (;; Speed up init |