code folding
[dot-emacs] / init.el
diff --git a/init.el b/init.el
index 150669d27659899fa13c92750784fd7884f081f5..4855c41e3683d550e0a02ef607eb35299e546e98 100644 (file)
--- a/init.el
+++ b/init.el
@@ -20,7 +20,7 @@
 
 ;;; 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
 ;; 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
 
@@ -939,7 +945,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)
@@ -1350,6 +1355,7 @@ Go to the next directory based on where the cursor is."
 (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()
@@ -1418,8 +1424,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
@@ -1468,6 +1472,23 @@ indent yanked text (with prefix arg don't 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")
@@ -1516,6 +1537,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
@@ -1575,7 +1600,7 @@ indent yanked text (with prefix arg don't indent)."
 ;;; 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)))
@@ -2220,7 +2245,7 @@ modes like org-mode which have their own yank function."
 
 ;;;;; C-M-d - split-window-horizontally
 
-(global-set-key (kbd "C-M-c") 'split-window-horizontally)
+(global-set-key (kbd "C-M-d") 'split-window-horizontally)
 
 
 ;;;;; C-f - kill-whole-line
@@ -2318,7 +2343,7 @@ modes like org-mode which have their own yank function."
 
 ;;;;; C-M-c - copy-to-register
 
-(global-set-key (kbd "C-M-d") 'copy-to-register)
+(global-set-key (kbd "C-M-c") 'copy-to-register)
 
 ;;;;; C-v - yank