init.el
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 25 Dec 2023 20:15:49 +0200
changeset 1772 d97be992a1f9
parent 1721 f9fb82deb6b7
permissions -rw-r--r--
Introduced Org state FAILED.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
604
9084d12d924d Fix mode name for elisp files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 386
diff changeset
     1
;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*-
42
04fd7747bc49 Update copyright notice.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
     2
;;
351
e30e4bd7e85e Small spell correction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 349
diff changeset
     3
;; For load order see README.
6
d1c4515c3cfa Add copyright notice.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 0
diff changeset
     4
1721
f9fb82deb6b7 Fixed: Symbol's value as variable is void: my-profiler-enabled.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1718
diff changeset
     5
(load "~/.emacs.d/.emacs-defs")
f9fb82deb6b7 Fixed: Symbol's value as variable is void: my-profiler-enabled.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1718
diff changeset
     6
1687
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
     7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1712
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
     8
(message "turn on debugger/profiler during loading")
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
     9
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    10
(when my-profiler-enabled
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    11
  (profiler-start 'cpu))
1711
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    12
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    13
(defun my-debug (mode)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    14
  "With any prefix enables entering into a debuger and shows the
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    15
backtrace when problems occur. Also activates entering into
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    16
debugger on C-g.
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    17
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    18
With double prefix (or any number) additonally enable debugging
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    19
on events and signals.
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    20
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    21
Without prefix (or `nil' argument) disables entering into the
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    22
debugger."
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    23
  (interactive "P")
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    24
  (let ( (lvl1 (not (not mode)))
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    25
         (lvl2 (or (equal mode '(16)) (numberp mode))) )
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    26
    (setq debug-on-error lvl1)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    27
    ;; Get trace when press C-g.
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    28
    (setq debug-on-quit lvl1)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    29
    (setq debug-on-event lvl2)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    30
    (setq debug-on-signal lvl2)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    31
    (cond
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    32
     (lvl2 (message "Debugging on quit/event/signal..."))
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    33
     (lvl1 (message "Debugging on quit..."))
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    34
     (t (message "Debugging disabled...")))))
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    35
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    36
;; Instead of launching Emacs with "--debug-init" I enable entering into
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    37
;; debugger on error & on C-g.
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    38
(my-debug t)
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    39
621215ccccf9 Activate debugger of errors during Emacs initialization. This allows to get backtrace without passing --debug-init.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1688
diff changeset
    40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1687
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    41
(message "load-path")
765
bbeae3f53afa Recursively add dirs from 'my-usr-el-dir' to 'load-path'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 604
diff changeset
    42
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1228
diff changeset
    43
(load "~/.emacs.d/.emacs-defs")
1687
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    44
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    45
(load custom-file t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    46
(load my-lisp-autogen t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    47
(load my-lisp-auth t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    48
(load my-lisp-pre)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    49
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1439
diff changeset
    50
(my-lisp--load-usr-home)
1199
dff272add01e Move all configs to "~/.emacs.d/my".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1198
diff changeset
    51
1687
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    52
;; (setq package-enable-at-startup t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    53
(when (fboundp 'package-initialize)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    54
  (package-initialize))
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    55
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    56
(load my-lisp-autoload t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    57
(load my-lisp-dotemacs t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    58
(load my-lisp-post t)
3f69332472cb Added Make target to preinstall packages from ELPA.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1675
diff changeset
    59
1712
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    60
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    61
(message "turn off debugger/profiler after loading")
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    62
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    63
(my-debug nil)
5ed78a45b299 Grouped startup profiler related code with debug related.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
    64
1688
0bab53c47567 Moved startup profiler settings to init.el and simplified activation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
    65
(when my-profiler-enabled
0bab53c47567 Moved startup profiler settings to init.el and simplified activation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
    66
  (profiler-report)
0bab53c47567 Moved startup profiler settings to init.el and simplified activation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
    67
  (profiler-stop))