(setq gc-cons-threshold 100000000)
;; 2019-6-26, 1.26s
- ;; to profile init:
- ;; emacs -f benchmark-init/show-durations-tabulated
- ;; emacs -f benchmark-init/show-durations-tree
- ;; to catch things post-init
- ;; emacs -f benchmark-init/deactivate
- (require 'benchmark-init)
- (add-hook 'after-init-hook 'benchmark-init/deactivate)
- ;;
+ ;;; to profile init:
+ ;;; uncomment the following block
+ ;; (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
+ ;;; to catch things post-init
+ ;;; emacs -f benchmark-init/deactivate
+
;; these need to be done before the hook in order to satisfy the byte compiler or batch mode
(add-to-list 'load-path "~/.emacs.d/src/visible-mark")
- ;; git version of gnus
- ;; (add-to-list 'load-path "~/.emacs.d/src/gnus/lisp")
- ;; (eval-after-load "info"
- ;; (quote (add-to-list 'Info-default-directory-list "~/.emacs.d/src/gnus/texi")))
-
-
- ;; needed for git version
- ;;(add-to-list 'load-path "~/.emacs.d/src/haskell-mode")
- ;;(require 'haskell-mode-autoloads)
- ;;(add-to-list 'Info-default-directory-list "~/.emacs.d/src/haskell-mode")
-
- ;; for using custom/upstream bbdb
- ;;(require 'bbdb-loaddefs "~/.emacs.d/src/bbdb/lisp/bbdb-loaddefs.el")
- ;;(setq bbdb-print-tex-path "~/.emacs.d/src/bbdb/tex")
-
-
- ;; iank: dunno what this was about
- ;;(add-hook 'server-visit-hook 'raise-frame)
(setq init-dir (file-name-directory load-file-name))
;; previously, i was doing byte-recompile-directory, but
;; now i just have one init file
(unless (equal (user-uid) 0) ; don't make root owned files
(byte-recompile-file (expand-file-name "init.el" init-dir) nil 0)
- (byte-recompile-file "/p/c/mymu4e.el" nil 0)
+ (when (file-exists-p "/p/c/mymu4e.el")
+ (byte-recompile-file "/p/c/mymu4e.el" nil 0))
)
- ;; load init in `after-init-hook' so all packages are loaded. However, disabled because
- ;; there seems to be no need.
- ;; todo, learn about the weird evaluation order of this hook that requires the quoting.
- ;; adapted from starter-kit
- ;; (add-hook 'after-init-hook
- ;; `(lambda ()
- ;; (load-file (expand-file-name "myinit.el" init-dir))
- ;; ))
-
-
-;;; Weird package bug workaround
-
-
- ;; without this, when installing a package, this message happens
- ;;
- ;; custom-handle-keyword: Unknown keyword :group
- ;;
- ;; but when i lookup the function, i get the following, and if
- ;; I evaluate it, the error goes away. so I think the real
- ;; definition is happening somewhere else
-
- (defun custom-handle-keyword (symbol keyword value type)
- "For customization option SYMBOL, handle KEYWORD with VALUE.
-Fourth argument TYPE is the custom option type."
- (if purify-flag
- (setq value (purecopy value)))
- (cond ((eq keyword :group)
- (custom-add-to-group value symbol type))
- ((eq keyword :version)
- (custom-add-version symbol value))
- ((eq keyword :package-version)
- (custom-add-package-version symbol value))
- ((eq keyword :link)
- (custom-add-link symbol value))
- ((eq keyword :load)
- (custom-add-load symbol value))
- ((eq keyword :tag)
- (put symbol 'custom-tag value))
- ((eq keyword :set-after)
- (custom-add-dependencies symbol value))
- (t
- (error "Unknown keyword %s" keyword))))
-
-
;;; misc emacs documentation
;;;; how to find auto-saved files that need recovering
;;; things that should be at the beginning
- ;; packages installed from package manager: i pretty much prioritize repos this way: gnu, then melpa, then marmalade.
-
- ;; package-activated-list:
- ;; ac-dabbrev ac-haskell-process ack-and-a-half alect-themes auctex bash-completion bbdb csv-mode cyberpunk-theme dot-mode expand-region f find-file-in-project flycheck foreign-regexp ggtags ghc gnuplot-mode goto-chg haskell-mode heroku-theme highlight-indentation highlight-symbol htmlize inf-ruby info+ inkpot-theme jedi auto-complete jedi-core epc ctable concurrent key-chord leuven-theme logstash-conf magit git-commit magit-popup misc-fns mouse+ naquadah-theme nginx-mode occidental-theme org paredit pcsv php-mode pkg-info epl popup py-autopep8 python-environment deferred python-info python-mode rainbow-mode rust-mode rw-hunspell s smartparens smex smooth-scroll sr-speedbar strings swiper ivy tabulated-list tangotango-theme thingatpt+ undo-tree vimrc-mode volatile-highlights web-mode with-editor dash async ws-butler yasnippet
-
-;;;; alternate keyboards
- ;; todo, figure out an easy way to disable this when using external keyboard
- (if (display-graphic-p)
- (setq
- enter-key (kbd "<return>")
- s-enter-key (kbd "<S-return>")
- c-m-enter-key (kbd "<C-M-return>")
- m-enter (kbd "<M-return>")
- c-enter (kbd "<C-return>"))
- (setq
- enter-key (kbd "C-m")
- s-enter-key (kbd "C-8")
- c-m-enter-key (kbd "C-M-8")
- m-enter (kbd "M-m")
- c-enter (kbd "C-8")))
-
- (setq tp (string= (system-name) "tp"))
- (setq x200 (string= (system-name) "x2"))
- (setq laptop-keyboard (or tp x200))
;; Ubiquitous Packages which should be loaded on startup rather than
;; autoloaded on demand since they are likely to be used in every
(require 'saveplace)
(require 'ffap)
(require 'uniquify)
- ;; iank: dunno why this was here
- ;;(require 'ansi-color)
(require 'recentf)
;; Better to have a list of packages in here vs installed manually.
(define-key ac-completing-map (kbd "<down>") nil)
(define-key ac-completing-map (kbd "<S-return>") 'ac-expand)
(define-key ac-completing-map "\t" 'ac-complete)
- (define-key ac-completing-map (kbd "<tab>") 'ac-complete)
+ ;;(define-key ac-completing-map (kbd "<tab>") 'ac-complete)
+ (define-key ac-completing-map (kbd "TAB") 'ac-complete)
(add-hook 'shell-mode-hook
(lambda ()
- (define-key shell-mode-map (kbd "<tab>") 'auto-complete)))
+ ;;(define-key shell-mode-map (kbd "<tab>") 'auto-complete)
+ (define-key shell-mode-map (kbd "TAB") 'auto-complete)
+ ))
;;; readline complete fix
;; mu4e-user-mail-address-list
;; and a function
;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
- (load "/p/c/mymu4e.el")
+ (when (file-exists-p "/p/c/mymu4e.el")
+ (load "/p/c/mymu4e.el"))
(defun my-decrypt ()
;; use for decrypting in mu4e
(add-hook 'haskell-interactive-mode-hook
(lambda ()
(define-key haskell-interactive-mode-map "\r" nil)
- (define-key haskell-interactive-mode-map (kbd "<return>") 'haskell-interactive-mode-return)))
+ (define-key haskell-interactive-mode-map (kbd "RET")
+ 'haskell-interactive-mode-return)))
(add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil)))
(setq css-indent-offset 2)
- (load-file "/a/h/iank-mod.el")
+ (when (file-exists-p "/a/h/iank-mod.el")
+ (load-file "/a/h/iank-mod.el"))
;; from when i was running my own patches
;;(add-to-list 'load-path "/a/opt/ws-butler")
(defun prog-mode-defaults ()
"Default coding hook, useful with any programming language."
;; so that I can do completion before the dialog pops up
- (local-set-key (kbd "<tab>") 'auto-complete)
+ ;;(local-set-key (kbd "<tab>") 'auto-complete)
+ (local-set-key (kbd "TAB") 'auto-complete)
;; todo, this is causing error message on loading file, prolly not working
;;(flycheck-mode +1)
(setq ac-sources (delq 'ac-source-dictionary ac-sources))
;; 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 "<return>"))))
+ (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 "<return>"))))
+ (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
;; in my version, this is not a pairing.
;;;; single/special keys
;;;;; tab - isearch
- (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace)
+ ;; todo: this doesnt work. needs <tab>, which doesnt work in terminal. fix that.
+ ;; (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace)
+ (define-key isearch-mode-map (kbd "M-f") 'isearch-query-replace)
;;;;; f12 - isearch-forward
;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs
(add-hook 'comint-mode-hook
(lambda ()
(define-key comint-mode-map "\r" nil)
- (define-key comint-mode-map (kbd "<return>") 'comint-send-input)))
+ (define-key comint-mode-map (kbd "RET") 'comint-send-input)))
(add-hook 'comint-mode-hook
(lambda ()
;;;;; C-z - undo-only
(global-set-key (kbd "C-z") 'undo-tree-undo)
;;;;; C-M-z - suspend-frame
- (global-set-key (kbd "C-z") 'suspend-frame)
- ;; previously, i meant to only use gui and ran this to
- ;; be sure it never got ran
- ;;(defun suspend-frame() (interactive))
+ (global-set-key (kbd "C-M-z") 'suspend-frame)
+ ;; this is never good in a gui
+ (when (window-system)
+ (defun suspend-frame() (interactive)))
;;;;; C-x - kill-region
(interactive)
(end-of-line)
(newline-and-indent))
+ ;; todo use alternate keybind make this work for terminal
(global-set-key (kbd "<C-return>") 'newline-anywhere)
(defun plain-newline ()
(interactive)
(insert "\n"))
- (global-set-key (kbd "<M-return>") 'plain-newline)
+ (global-set-key (kbd "M-RET") 'plain-newline)
;;;;; C-space - org-edit-special