;; Initialization of my Emacs sessions, part one  │ -*- lexical-binding: t; no-byte-compile: t; -*-
;;
;; PUBLIC at `http://reluk.ca/.config/emacs/` because part two of the initialization refers to it there.
;; http://reluk.ca/.config/emacs/initialization.el


;; Byte compilation
;; ────────────────
;; To load from source when the compiled code is out of date, uncomment the following.
;;
;;;    (setq load-prefer-newer t)
;;
;; To regenerate autoload files, run the following in a `*scratch*` buffer. [AG]
;;
;;     (package-generate-autoloads "brec-mode"    "~/work/Breccia/Emacs/")
;;     (package-generate-autoloads "jmt-mode"     "~/work/Java/Emacs/")
;;     (package-generate-autoloads "waybrec-mode" "~/code/WP3/wayic/Waybrec/Emacs/")
;;
;; To recompile modified source code, run the following in a `*scratch*` buffer.
;;
;;     (byte-recompile-directory "/etc/emacs/")
;;     (byte-recompile-directory "~/.config/emacs/lisp/")
;;
;;        Recompiling `/etc/emacs/` while debugging a mode with `load-prefer-newer`?  (see § below)
;;        Then run the `touch` commands listed there.
;;
;;        Compile neither `~/.config/emacs/init.el` nor `~/.config/emacs/initialization.el`,
;;        else the editor may fail to start on a root-copy partion that has a different version
;;        of Emacs installed.
;;
;; To forcefully recompile even the *un*modified source code, append `t` as a further argument:
;;
;;     (byte-recompile-directory "~/.config/emacs/lisp/" nil t)
;;     (byte-recompile-directory "/etc/emacs/" nil t)


;; Debugging a particular mode
;; ───────────────────────────
;; To enable for a particular major mode `debug-on-error`, `debug-on-quit`, or the like, add something
;; like the following to the mode’s entry in `~/.config/emacs/initialization.el`.
;;
;;     (add-hook
;;      'MODENAME-mode-hook
;;      (lambda ()
;;        (setq debug-on-error t
;;              font-lock-support-mode nil)))
;;
;; To debug the mode uncompiled, in case that helps:
;; (a) Uncomment the following.
;;
;;;    (setq load-prefer-newer t)
;;
;; (b) List here a touch command for each source file being debugged.
;;
;;     touch ~/work/Java/Emacs/jmt-mode.el
;;
;; (c) Run those command now, and after each recompilation (q.v. further above).


;; Debugging in general
;; ────────────────────
;; http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/DEBUG
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Debugger.html
;;
;; Lintwise I have `checkdoc-minor-mode`, `package-lint-current-buffer` and Flycheck. To enable Flycheck:
;;
;;;    (add-hook 'after-init-hook #'global-flycheck-mode)
;;;    (eval-after-load 'flycheck '(flycheck-package-setup)); https://github.com/purcell/flycheck-package
;;
;; To debug an error, uncomment the following.  Or use `emacs` option `--debug-init`,
;; e.g. if this initialization file itself has errors.
;;
;;;    (setq debug-on-error t); Or use `toggle-debug-on-error`.
;;
;; And for errors under JIT Lock, uncomment (or otherwise execute) the following, too.
;;
;;;    (setq font-lock-support-mode nil)
;;
;; To debug Font Lock fontifications, address `~/.config/emacs/lisp/._/highlight-refontification.txt`,
;; the uncomment the following and see `https://github.com/Lindydancer/highlight-refontification`.
;;
;;;    (load "~/.config/emacs/lisp/highlight-refontification" nil t)


;; Running a custom build `~/code/emacs/src/emacs`
;; ──────────────────────
;;;    (when (member "/home/mike/code/emacs/lisp" load-path); Then a custom build is running.
;;;      (add-to-list 'load-path "/etc/emacs");               Orient it to the present site.
;;;      (add-to-list 'load-path "/usr/share/emacs/site-lisp")
;;;      (require 'site-gentoo))



;; Initialization part two
;; ───────────────────────
(load "~/.config/emacs/initialization" nil t); Q.v. at `http://reluk.ca/.config/emacs/`.  Loading from
  ;;; there explicitly rather than adding `~/.config/emacs/` to `load-path`, which already is overlong.
(init/part-two)


;; Note
;; ────
;;   GAF  Generation of autoload files.  While `package-generate-autoloads` is undocumented,
;;        the documented alternatives of `update-file-autoloads` and `update-directory-autoloads`
;;        commonly fail with obscure error messages.  https://stackoverflow.com/a/50100170/2402790