.emacs-defs
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 02 Jan 2021 20:37:29 +0200
changeset 1682 32e95bb034b6
parent 1675 08f7fd3c4d5b
child 1687 3f69332472cb
permissions -rw-r--r--
Disable population of `file-name-history', it causes calls to abbreviate-file-name => file-name-case-insensitive-p => tramp-autoload-file-name-handler taking 40% of startup time. `ido-switch-buffer' doesn't depends on `file-name-history', nothing to lose. Profiling data for startup: - eval-buffer 4340 99% - recentf-mode 1684 38% - recentf-load-list 1684 38% - mapcar 1684 38% - abbreviate-file-name 1684 38% - file-name-case-insensitive-p 1250 28% + tramp-autoload-file-name-handler 1172 26% + tramp-file-name-handler 78 1%
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1284
0e25700290c4 Simplify expression.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1278
diff changeset
     1
;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78; no-byte-compile: t; -*-
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
     3
(defvar my-lisp-usr-home-dir
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
  (expand-file-name "~/usr/share/emacs/site-lisp")
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
     5
  "There is a place for additional lisp packages installed via 'DIST=~/usr make install'.")
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
(defvar my-lisp-dir
1674
68a521583d8e Added suffix "/" to my-lisp-dir for next easy/safe concat operations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1672
diff changeset
     8
  (expand-file-name (concat user-emacs-directory "mylisp/"))
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
  "Here live my lisp packages.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
(add-to-list 'load-path my-lisp-dir)
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
(defvar my-lisp-autoload (concat my-lisp-dir "loaddefs.el")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  "Path to autoload for mode files.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
(defvar my-lisp-auth (concat user-emacs-directory ".emacs-auth")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  "Path to auth info for Emacs.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
(defvar my-lisp-autogen (concat user-emacs-directory ".emacs-autogen")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
  "Path to automatically generated config file. It content depend on
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  installation environment and it was overridden on install.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
(defvar my-lisp-pre (concat user-emacs-directory ".emacs-pre")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
  "Path to file with pre-settings. Intended for local modifications.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
(defvar my-lisp-dotemacs (concat user-emacs-directory ".emacs-my")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  "Path to file with settings. Overwritten on install.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
(defvar my-lisp-post (concat user-emacs-directory ".emacs-post")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  "Path to file with post-settings. Intended for local modifications.")
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
(setq custom-file (concat user-emacs-directory ".emacs-custom"))
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
(setq save-place-file (concat user-emacs-directory ".emacs-places"))
1285
8e2c4332223d Use newer recommended place for bookmarks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1284
diff changeset
    28
(setq bookmark-default-file (concat user-emacs-directory "bookmarks"))
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
(setq ido-save-directory-list-file (concat user-emacs-directory ".ido.last"))
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    31
(defun my-lisp--load-pre ()
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    32
  (mapc (lambda (f)
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    33
          (when (file-exists-p f)
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    34
            (load f nil nil t)))
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    35
        (list custom-file my-lisp-autogen my-lisp-auth my-lisp-pre my-lisp-autoload)))
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    36
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    37
(defun my-lisp--load-usr-home ()
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    38
  "Add hierarchy `my-lisp-usr-home-dir' to `load-path'."
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    39
  (when (file-directory-p my-lisp-usr-home-dir)
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    40
    (add-to-list 'load-path my-lisp-usr-home-dir)
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    41
    (let ((default-directory my-lisp-usr-home-dir))
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    42
      (normal-top-level-add-subdirs-to-load-path))))
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    43
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    44
(defun my-lisp--load-all ()
1672
e2d0fc84c6f5 Simplified Makefile byte compillation recipe by moving some logic from CLI to elisp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1670
diff changeset
    45
  "Load everything to help during byte compilation to spot errors
e2d0fc84c6f5 Simplified Makefile byte compillation recipe by moving some logic from CLI to elisp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1670
diff changeset
    46
better. Not for regular use but for the Makefile."
1675
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    47
  (my-lisp--load-usr-home)
08f7fd3c4d5b Load more files for byte compilation check. Switched to my-lisp-* prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1674
diff changeset
    48
  (my-lisp--load-pre))
1241
4f22d9fe2e5b Byte compile '.emacs-my' and 'my/*.el'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    50
(defmacro my--eval-after-load (feature &rest forms)
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
    51
  (declare (indent defun))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    52
  `(,(if (or (not (boundp 'byte-compile-current-file))
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    53
             (not byte-compile-current-file)
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    54
             (if (symbolp feature)
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    55
                 (require feature nil :no-error)
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    56
               (load feature :no-message :no-error)))
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    57
         'progn
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    58
       (message "my--eval-after-load: cannot find %s" feature)
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    59
       'with-no-warnings)
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    60
    (eval-after-load ',feature
1284
0e25700290c4 Simplify expression.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1278
diff changeset
    61
      '(funcall (lambda () ,@forms)))))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1241
diff changeset
    62