init.el
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 30 Jan 2021 22:44:34 +0200
changeset 1712 5ed78a45b299
parent 1711 621215ccccf9
child 1718 9d72f4424570
permissions -rw-r--r--
Grouped startup profiler related code with debug related.

;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*-
;;
;; Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008-2010.
;;
;; This file placed in public domain.
;;
;; For load order see README.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "turn on debugger/profiler during loading")

(when my-profiler-enabled
  (profiler-start 'cpu))

(defun my-debug (mode)
  "With any prefix enables entering into a debuger and shows the
backtrace when problems occur. Also activates entering into
debugger on C-g.

With double prefix (or any number) additonally enable debugging
on events and signals.

Without prefix (or `nil' argument) disables entering into the
debugger."
  (interactive "P")
  (let ( (lvl1 (not (not mode)))
         (lvl2 (or (equal mode '(16)) (numberp mode))) )
    (setq debug-on-error lvl1)
    ;; Get trace when press C-g.
    (setq debug-on-quit lvl1)
    (setq debug-on-event lvl2)
    (setq debug-on-signal lvl2)
    (cond
     (lvl2 (message "Debugging on quit/event/signal..."))
     (lvl1 (message "Debugging on quit..."))
     (t (message "Debugging disabled...")))))

;; Instead of launching Emacs with "--debug-init" I enable entering into
;; debugger on error & on C-g.
(my-debug t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "load-path")

(load "~/.emacs.d/.emacs-defs")

(load custom-file t)
(load my-lisp-autogen t)
(load my-lisp-auth t)
(load my-lisp-pre)

(my-lisp--load-usr-home)

;; (setq package-enable-at-startup t)
(when (fboundp 'package-initialize)
  (package-initialize))

(load my-lisp-autoload t)
(load my-lisp-dotemacs t)
(load my-lisp-post t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "turn off debugger/profiler after loading")

(my-debug nil)

(when my-profiler-enabled
  (profiler-report)
  (profiler-stop))