;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; 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
;; 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
;; 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"))
;; from its README.md
(eval-when-compile
(require 'use-package))
-
+(use-package use-package-ensure-system-package
+ :ensure t)
;; Ubiquitous Packages. these could go anywhere actually
;; 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)
(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))
;; 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
;; 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)
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
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)
(defun variable-pitch-off ()
(variable-pitch-mode 0))
(add-hook 'yaml-mode-hook 'variable-pitch-off)
+(add-hook 'dns-mode-hook 'variable-pitch-off)
(defun my-org-face-init()
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
;; # eval: (outline-minor-mode)
;; # outline-regexp: "\\( *\\)# [*]\\{1,8\\} "
+(defun outline-level ()
+ "Return the depth to which a statement is nested in the outline.
+Point must be at the beginning of a header line.
+This is actually either the level specified in `outline-heading-alist'
+or else the number of characters matched by `outline-regexp'."
+ (or (cdr (assoc (match-string 0) outline-heading-alist))
+ (let ((whitespace-end (match-end 1))
+ (match-begin (match-beginning 0)))
+ (if (= whitespace-end match-begin)
+ (- (match-end 0) match-begin)
+ (- (match-end 0) whitespace-end)
+ ))))
+;; originally:
+;;(or (cdr (assoc (match-string 0) outline-heading-alist))
+;; (- (match-end 0) (match-beginning 0))))
+
+
;; avoid stupid git crap like "warning, terminal not fully functional"
(setenv "PAGER" "cat")
: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
;;; znc/erc
(defun chirp()
(interactive)
- (setq vol 50)
+ (setq vol 20)
(when (string= (system-name) "kd") (setq vol 80))
;; speed is there so i can adjust and make it go slow so it plays long enough to adjust in pavucontrol
(start-process-shell-command "ignoreme" nil (format "mpv --speed=1 --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol)))
;; 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"))
(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
(define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
;;;;; M-r ?? unused
+
+
;;;;; C-a copy buffer
(defun copy-all ()
(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
;; 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)
(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)
(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