From 318f10aac932014c2ec2531bc49ccc26d7510edc Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Fri, 4 Sep 2020 03:52:30 -0400 Subject: [PATCH] optimize startup --- init.el | 89 ++++++++++++++++-------------------------------- misc-disabled.el | 46 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 59 deletions(-) diff --git a/init.el b/init.el index 6cfc1d6..021fc6c 100644 --- a/init.el +++ b/init.el @@ -41,15 +41,16 @@ (add-hook 'after-init-hook `(lambda () (setq file-name-handler-alist file-name-handler-alist-old - gc-cons-threshold 800000 - gc-cons-percentage 0.1) - (garbage-collect)) t) + ;; 100 mb + gc-cons-threshold 100000000)) + ;; taken from wiegley, dunno why the t is there. + t) ;; 2019-6-26, 1.26s ;; ; to profile init: ;; ; uncomment the following block -;; (require 'benchmark-init) -;; (add-hook 'after-init-hook 'benchmark-init/deactivate) + (require 'benchmark-init) + (add-hook 'after-init-hook 'benchmark-init/deactivate) ;; ; Then run: ;; ; emacs -f benchmark-init/show-durations-tabulated ;; ; emacs -f benchmark-init/show-durations-tree @@ -232,7 +233,8 @@ ;; keep our init.el clean, by moving customization elisp to it's own file (setq custom-file "~/.emacs.d/custom.el") -(load custom-file 'noerror) +;; empty atm +;;(load custom-file 'noerror) ;;; auto-complete @@ -1048,7 +1050,9 @@ and Ian Kelling as the name" (ws-butler-global-mode) -(require 'nginx-mode) +;; disabled because i dont edit nginx files enough +;; to have this loaded at startup +;;(use-package nginx-mode) ;;The mode should automatically activate for files called nginx.conf and files under /etc/nginx - if not, you can add something like this to your init file: ;;(add-to-list 'auto-mode-alist '("/etc/nginx/sites-available/.*" . nginx-mode)) @@ -1140,6 +1144,20 @@ and Ian Kelling as the name" ;;; misc general settings + +;; I tried to look for a function that would set this that is +;; not part of the emacs interactive customize stuff, but didn't see one +;; in the faces documentation. + +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil)))) + '(region ((t nil)))) + + ;; from tramp manual, use the same ssh controlmaster. I was having problems with ;; tramp prompting me for a username and pass. (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) @@ -1651,7 +1669,8 @@ Go to the next directory based on where the cursor is." ;; this says do autofilling using newcomment.el. The "only" is a misnomer. (set (make-local-variable 'comment-auto-fill-only-comments) t) (column-number-mode t) - (turn-on-smartparens-mode) + ;; trying without + ;; (turn-on-smartparens-mode) ;; prettify lambdas (font-lock-add-keywords @@ -1750,62 +1769,13 @@ indent yanked text (with prefix arg don't indent)." (shell))) (add-hook 'shell-mode-hook 'track-shell-directory/procfs) -;;; smartparens -;; the melpa git version had a catastrophic bug I reported. -;; downgraded to marmalade version and everything is working fine. -(require 'smartparens-config) -(show-smartparens-global-mode t) - - -(defun gp/sp/pair-on-newline-and-indent (id action context) - "Open a new brace or bracket expression, with relevant newlines and indent. " - (save-excursion - (newline) - (indent-according-to-mode)) - (indent-according-to-mode)) - -;; when opening a pair, and then inserting a newline, push the closing pair to another newline -(sp-pair "{" nil :post-handlers - '(:add ((lambda (id action context) - (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) -(sp-pair "[" nil :post-handlers - '(:add ((lambda (id action context) - (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) - - -;; in my version, this is not a pairing. -;; not sure if it is in a future version since I reverted to marmalade -;; Don't need c-comments in strings -- they frustrate filename globs -;; (sp-pair "/*" nil :unless '(sp-in-string-p)) - -;; Don't need quotes to pair next to words -(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p)) -(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p)) - - -;; todo, testout these mode specific settings from graphene. -;; Ruby-specific pairs and handlers - -(eval-after-load "ruby" - '(require 'smartparens-ruby)) - -;; Markdown -(sp-local-pair '(markdown-mode gfm-mode) "*" "*" - :unless '(sp-in-string-p) - :actions '(insert wrap)) - -;; Except in HTML -(sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p)) - - - - ;;; spell correction (setq ispell-program-name "hunspell" ispell-silently-savep t) ; don't prompt to save personal dictionary -(require 'rw-hunspell) +(use-package rw-hunspell + :defer t) ;; rw-hunspell sets up hunspell dictionary automagically. @@ -1888,6 +1858,7 @@ indent yanked text (with prefix arg don't indent)." (chirp))) (use-package erc + :defer t :init (setq erc-fill-prefix "" ;; consider invisible frames to be unseen. seems like an obvious default diff --git a/misc-disabled.el b/misc-disabled.el index 59a8851..2804aa6 100644 --- a/misc-disabled.el +++ b/misc-disabled.el @@ -393,3 +393,49 @@ ;; give us a shell to start instead of scratch ;;(setq initial-buffer-choice (lambda () (new-shell))) + + +;;; smartparens +;; the melpa git version had a catastrophic bug I reported. +;; downgraded to marmalade version and everything is working fine. +(require 'smartparens-config) + +(defun gp/sp/pair-on-newline-and-indent (id action context) + "Open a new brace or bracket expression, with relevant newlines and indent. " + (save-excursion + (newline) + (indent-according-to-mode)) + (indent-according-to-mode)) + +;; when opening a pair, and then inserting a newline, push the closing pair to another newline +(sp-pair "{" nil :post-handlers + '(:add ((lambda (id action context) + (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) +(sp-pair "[" nil :post-handlers + '(:add ((lambda (id action context) + (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) + + +;; in my version, this is not a pairing. +;; not sure if it is in a future version since I reverted to marmalade +;; Don't need c-comments in strings -- they frustrate filename globs +;; (sp-pair "/*" nil :unless '(sp-in-string-p)) + +;; Don't need quotes to pair next to words +(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p)) +(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p)) + + +;; todo, testout these mode specific settings from graphene. +;; Ruby-specific pairs and handlers + +(eval-after-load "ruby" + '(require 'smartparens-ruby)) + +;; Markdown +(sp-local-pair '(markdown-mode gfm-mode) "*" "*" + :unless '(sp-in-string-p) + :actions '(insert wrap)) + +;; Except in HTML +(sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p)) -- 2.30.2