X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=init.el;h=66d28bb93684cfe10b7b2505398151780378c14e;hb=d39c4d97e9cbd13c9745336427bf99e61cb550b1;hp=61e347ecc8edfbf4c4a5654b8d923d40b436a663;hpb=38ab2149c487ef7ea4c99d1cdc321fa9065ab2c3;p=dot-emacs diff --git a/init.el b/init.el index 61e347e..66d28bb 100644 --- a/init.el +++ b/init.el @@ -14,13 +14,13 @@ ;; along with this program. If not, see . ;; do m-x benchmark-init to see some benchmark stats -;;(add-to-list 'load-path "~/.emacs.d/src/benchmark-init-el/") +;;(add-to-list 'load-path (concat user-emacs-directory "src/benchmark-init-el/") ;;(require 'benchmark-init-loaddefs) ;;(benchmark-init/activate) ;;; init.el --- the start of customization -(toggle-debug-on-error) ;uncomment to help debug +;;(toggle-debug-on-error) ;uncomment to help debug ;; stop from minimizing & freezing the gui @@ -46,11 +46,16 @@ ;; taken from wiegley, dunno why the t is there. t) +;; stuff to allow an alternate location for ~/.emacs.d +(setq user-emacs-directory (file-name-directory user-init-file)) +(when (getenv "EHOME") + (setenv "HOME" (getenv "EHOME"))) + ;; 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 @@ -60,18 +65,13 @@ ;; these need to be done before the hook in order to satisfy the byte compiler or batch mode -;; this is the builtin org mode -;;(add-to-list 'load-path "~/.emacs.d/emacs/site-lisp/org") - -(add-to-list 'load-path "~/.emacs.d/src/readline-complete") +(add-to-list 'load-path (concat user-emacs-directory "src/readline-complete")) ;; disabled since not used. -;;(add-to-list 'load-path "~/.emacs.d/src/bbdb-csv-import") -;;(add-to-list 'load-path "~/.emacs.d/src/ghci-completion") -;;(add-to-list 'load-path "~/.emacs.d/src/mediawiki-el") -;;(add-to-list 'load-path "~/.emacs.d/src/spray") +;;(add-to-list 'load-path (concat user-emacs-directory "src/bbdb-csv-import")) +;;(add-to-list 'load-path (concat user-emacs-directory "src/spray")) -(add-to-list 'load-path "~/.emacs.d/src/visible-mark") +(add-to-list 'load-path (concat user-emacs-directory "src/visible-mark")) @@ -231,7 +231,7 @@ ;; keep our init.el clean, by moving customization elisp to it's own file -(setq custom-file "~/.emacs.d/custom.el") +(setq custom-file (concat user-emacs-directory "custom.el")) ;; empty atm ;;(load custom-file 'noerror) @@ -640,7 +640,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (setq save-place-version-control 'nospecial save-place-limit 4000 - save-place-file "~/.emacs.d/places") + save-place-file (concat user-emacs-directory "places")) (save-place-mode 1)) @@ -652,7 +652,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; save every minute savehist-autosave-interval 60 ;; keep the home clean - savehist-file "~/.emacs.d/.savehist") + savehist-file (concat user-emacs-directory ".savehist")) (savehist-mode 1)) ;;; dired @@ -944,7 +944,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; todo, turn on auto-fill just for txt files ;;(add-hook 'text-mode-hook 'turn-on-auto-fill) -(add-hook 'text-mode-hook 'turn-on-flyspell) ;; random extra highlights (require 'volatile-highlights) @@ -1056,7 +1055,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." shift-select-mode nil truncate-partial-width-windows nil uniquify-buffer-name-style 'forward - oddmuse-directory "~/.emacs.d/oddmuse" + oddmuse-directory (concat user-emacs-directory "oddmuse") echo-keystrokes 0.1 mark-ring-max 160 sort-fold-case t ; case insensitive line sorting @@ -1080,18 +1079,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." imenu-auto-rescan t indicate-empty-lines t) ; mark end of buffer -(require 'smooth-scroll) -;; long gnus summary buffers lags too much with this, -;; but I like it enough to leave it enabled by default -;; and crank up the step size to be faster -;; and it doesn't have a way to enable it only for certain modes etc. -;; todo sometime, make it work for certain modes only -(smooth-scroll-mode t) -;; its too slow with the default of 2 -(setq smooth-scroll/vscroll-step-size 6) -;; sublimity doesn't work as good going fast by default -;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location - (blink-cursor-mode '(-4)) (menu-bar-mode -1) @@ -1435,8 +1422,6 @@ Go to the next directory based on where the cursor is." nil)))))) (add-hook 'prog-mode-hook 'prog-mode-defaults) -;; enable flyspell in prog mode. text mode is handled -(add-hook 'prog-mode-hook 'flyspell-prog-mode) ;;; yank auto-indent @@ -1533,6 +1518,10 @@ indent yanked text (with prefix arg don't indent)." :defer t) ;; rw-hunspell sets up hunspell dictionary automagically. +(use-package flyspell + :ensure-system-package hunspell + :hook ((prog-mode . flyspell-prog-mode) + (text-mode . turn-on-flyspell))) ;; Rant: Hunspell SHOULD be standard. its used by firefox and openoffice and ;; osx. In contrast, the first few words I added to aspell dictionary were @@ -1655,7 +1644,7 @@ indent yanked text (with prefix arg don't indent)." ;; worth the benefit of only having one concept in my mind. (dolist (r `( - (?i (file . ,"~/.emacs.d/init.el")) + (?i (file . ,(concat user-emacs-directory "init.el"))) (?o (file . ,"/a/work.org")) (?t (file . ,"/a/t.org")) (?s (file . ,"/usr/share/doc/exim4-base/spec.txt.gz")) @@ -1677,7 +1666,7 @@ indent yanked text (with prefix arg don't indent)." (use-package undo-tree :config ;; more resilient undo-tree-history if we have its location set up front. - (setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history")) + (setq undo-tree-history-directory-alist '(("." . (concat user-emacs-directory ".undo-tree-history"))) undo-outer-limit 100000000 ; per undo command undo-limit 500000000 ; undo history limit undo-strong-limit 600000000 ; undo history limit plus some extra @@ -2170,6 +2159,8 @@ modes like org-mode which have their own yank function." (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp))) ;;;;; M-r ?? unused + + ;;;;; C-a copy buffer (defun copy-all () @@ -2233,34 +2224,10 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "M-d") 'run) -;;;;; C-M-d - swap buffer across windows -;; from http://www.emacswiki.org/emacs/TransposeWindows +;;;;; C-M-d - split-window-horizontally + +(global-set-key (kbd "C-M-d") 'split-window-horizontally) -(setq swapping-buffer nil) -(setq swapping-window nil) -(defun swap-buffers-in-windows () - "Swap buffers between two windows" - (interactive) - (if (and swapping-window - swapping-buffer) - (let ((this-buffer (current-buffer)) - (this-window (selected-window))) - (if (and (window-live-p swapping-window) - (buffer-live-p swapping-buffer)) - (progn (switch-to-buffer swapping-buffer) - (select-window swapping-window) - (switch-to-buffer this-buffer) - (select-window this-window) - (message "Swapped buffers.")) - (message "Old buffer/window killed. Aborting.")) - (setq swapping-buffer nil) - (setq swapping-window nil)) - (progn - (setq swapping-buffer (current-buffer)) - (setq swapping-window (selected-window)) - (message "Buffer and window marked for swapping.")))) - -(global-set-key (kbd "C-M-d") 'swap-buffers-in-windows) ;;;;; C-f - kill-whole-line @@ -2318,7 +2285,7 @@ modes like org-mode which have their own yank function." ;; todo; check out smex-show-unbound-commands shows frequently used commands that have no key bindings. ;; this must be before smex-initialize (setq - smex-save-file "~/.emacs.d/.smex-items") + smex-save-file (concat user-emacs-directory ".smex-items")) ;; this uses smex (global-set-key (kbd "M-x") 'counsel-M-x) @@ -2483,8 +2450,7 @@ modes like org-mode which have their own yank function." (progn (basic-save-buffer) (delete-frame)) (save-buffers-kill-terminal t)))) -;;;;; C-* - split-window-horizontally -(global-set-key (kbd "C-*") 'split-window-horizontally) +;;;;; C-* - --- terminal ;;;;; C-M-* - calc-dispatch (global-set-key (kbd "C-M-*") 'calc-dispatch) @@ -2665,8 +2631,12 @@ modes like org-mode which have their own yank function." (defun vim-style-join-line () (interactive) (join-line '(4))) +;; terminal +(global-set-key (kbd "C-_") 'vim-style-join-line) +;; gui (global-set-key (kbd "C-/") 'vim-style-join-line) (define-key undo-tree-map (kbd "C-/") nil) +(define-key undo-tree-map (kbd "C-_") nil) ;;;;; C-M-/ - copy-buffer-file-name