blob: 056d4dccd63a4aea7d8978c46dd6fbd2fef04442 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
(defvar my/default-file-name-handler-alist file-name-handler-alist)
(defun my/set-max-gc-cons-threshold ()
(setq gc-cons-threshold most-positive-fixnum)) ; 2^61 bytes
(defun my/set-default-gc-cons-threshold ()
(run-at-time 1 nil
(lambda () (setq gc-cons-threshold 16777216)))) ; 16 Mb
(defun my/erase-file-name-handler-alist ()
(setq file-name-handler-alist nil))
(defun my/restore-file-name-handler-alist ()
(setq file-name-handler-alist my/default-file-name-handler-alist))
(my/set-max-gc-cons-threshold)
(my/erase-file-name-handler-alist)
(add-hook 'emacs-startup-hook 'my/set-default-gc-cons-threshold)
(add-hook 'emacs-startup-hook 'my/restore-file-name-handler-alist)
(defun my/ad-timestamp-message (FORMAT-STRING &rest args)
"Advice to run before `message' that prepends a timestamp to each message.
Activate this advice with:
(advice-add 'message :before 'my/ad-timestamp-message)
Deactivate this advice with:
(advice-remove 'message 'my/ad-timestamp-message)"
(if message-log-max
(let ((deactivate-mark nil)
(inhibit-read-only t))
(with-current-buffer "*Messages*"
(goto-char (point-max))
(if (not (bolp))
(newline))
(insert (format-time-string "[%F %T.%3N] "))))))
(advice-add 'message :before 'my/ad-timestamp-message)
|