浏览代码

Fixed TODO's in emacs config.

Tom Flucke 7 年之前
父节点
当前提交
dbd1f9c118
共有 1 个文件被更改,包括 124 次插入39 次删除
  1. 124 39
      .emacs.d/init.el

+ 124 - 39
.emacs.d/init.el

@@ -3,6 +3,9 @@
 ;; Optional:
 ;; clang
 
+;; TODO
+;; Look up authors of projects.  See what other useful things they make.
+
 ;; ----------- Default Variables -----------
 ;; Global variables
 (defvar backup-directory (concat user-emacs-directory "backups"))
@@ -44,10 +47,10 @@ If point was already at that position, move point to beginning of line."
 (global-set-key (kbd "C-c C-k") 'compile)
 (global-set-key (kbd "M-<left>") 'backward-list)
 (global-set-key (kbd "M-<right>") 'forward-list)
-;; TODO: See if can get working without smartparen lib.
-;; Otherwise, switch to smartparen
-;;(global-set-key (kbd "M-<up>") 'sp-up-sexp)
-;;(global-set-key (kbd "M-<down>") 'sp-down-sexp)
+(global-set-key (kbd "M-<up>") 'racket-backward-up-list)
+;; Can't seem to find forward-down-list.
+;; Not very important since I would rarely use it anyway
+;;(global-set-key (kbd "M-<down>") '?)
 (global-set-key (kbd "M-<delete>") 'kill-sexp)
 
 ;; ----------- Package Managing -----------
@@ -57,9 +60,9 @@ If point was already at that position, move point to beginning of line."
 ;; Add package sources
 (setq package-archives
       '(("gnu" . "https://elpa.gnu.org/packages/")
-        ("org" . "https://orgmode.org/elpa/")
         ("melpa" . "https://melpa.org/packages/")
-        ("melpa-stable" . "https://stable.melpa.org/packages/"))
+        ("melpa-stable" . "https://stable.melpa.org/packages/")
+        ("org" . "https://orgmode.org/elpa/"))
       package-archive-priorities '(("melpa" . 1)))
 (package-initialize)
 
@@ -69,23 +72,32 @@ If point was already at that position, move point to beginning of line."
 (require 'use-package)
 (setq use-package-always-ensure t)
 
+(use-package auto-package-update
+  :config
+  (add-hook 'auto-package-update-before-hook
+            (lambda () (package-refresh-contents)))
+  (setq auto-package-update-delete-old-versions t
+        auto-package-update-interval 4
+        auto-package-update-prompt-before-update t
+        auto-package-update-hide-results t)
+  (auto-package-update-maybe))
+
 ;; ---------- Color Themes ----------
 ;; TODO: Fix warning underline to always be orange/yellow
+;; Update: Seems it always takes the color of the foreground.
+;; Also seems to ignore most properties. (e.g. overline, underline,
+;; strike-though, etc.)  Maybe it's an xterm problem?
 (use-package color-theme
-  :init
-  ;; TODO: Fixes error about missing directory.  Don't know why.
-  ;(unless (file-exists-p "~/.emacs.d/elpa/color-theme-20070910.1007/themes")
-  ;  (make-directory "~/.emacs.d/elpa/color-theme-20070910.1007/themes"))
   :config
   (color-theme-initialize)
   (load-theme 'Thomas-Experiement t))
 
 ;; ---------- Use X11 clipboard -----------
-;; TODO: Bug.  Copy to xclip doesn't work.  Paste from does.
 (use-package xclip
   :if (executable-find "xclip")
-  ;;:config (xclip-mode 1)
-  )
+  :config
+  (add-to-list 'load-path "~/.emacs.d/elpa/xclip-1.4/")
+  (xclip-mode 1))
 
 ;; --------- Parentheses Matching ---------
 (show-paren-mode)
@@ -97,9 +109,11 @@ If point was already at that position, move point to beginning of line."
 	  (highlight-parentheses-mode t)))
   (global-highlight-parentheses-mode t))
 
-(use-package autopair
-  :config
-  (autopair-global-mode))
+(if (version<= "24.4" emacs-version)
+    (electric-pair-mode)
+  (use-package autopair
+    :config
+    (autopair-global-mode)))
 
 ;; ------------ xTerm Mouse ------------
 ;; Disable because it became annoying, sounds cool though.
@@ -116,26 +130,22 @@ If point was already at that position, move point to beginning of line."
 ;; * Jump to source/docs
 ;; * Refactoring
 ;; * Error detection
-(use-package scala-mode
-  ;; TODO: Disabled.  Forgot why (Maybe redundant?).  Figure out later.
-  :disabled
-  :commands (scala-mode))
-
 (use-package company)
 
-(when (version<= "24.4" emacs-version)
-  (use-package ensime
-    :requires company
-    :hook (scala-mode java-mode)
-    :pin melpa-stable
-    :config
-    (setq ensime-startup-notification nil)
-    (eval-after-load 'ensime-mode
-      '(define-key ensime-mode-map (kbd "C-c i")
-         (lambda () "Generate ensime.sbt file"
-           (interactive)
-           (write-region "ensimeScalaVersion in ThisBuild := \"2.11.8\""
-                                  nil (concat (read-directory-name "SBT Root:") "ensime.sbt")))))))
+(if (version<= "24.4" emacs-version)
+    (use-package ensime
+      :requires company
+      :hook (scala-mode java-mode)
+      :config
+      (setq ensime-startup-notification nil)
+      (eval-after-load 'ensime-mode
+        '(define-key ensime-mode-map (kbd "C-c i")
+           (lambda () "Generate ensime.sbt file"
+             (interactive)
+             (write-region "ensimeScalaVersion in ThisBuild := \"2.11.8\""
+                           nil (concat (read-directory-name "SBT Root:") "ensime.sbt"))))))
+  (use-package scala-mode
+    :commands (scala-mode)))
 
 ;; --------- C Syntax checker ---------
 ;; TODO: C autocomplete.  Both with clang integration and backup naive method
@@ -177,7 +187,6 @@ If point was already at that position, move point to beginning of line."
 ;; ;  :mode ("\\.c\\'" "\\.h\\'")
 
 ;; ------------ Web Mode ------------
-;; TODO: Automatic closing tag would be nice
 (defun my-sgml-insert-gt ()
   "Inserts a `>' character and calls 
 `my-sgml-close-tag-if-necessary', leaving point where it is."
@@ -194,6 +203,7 @@ an opening tag that is not followed by a matching closing tag."
            (looking-at (concat "\\s-*<\\s-*/\\s-*" tag "\\s-*>")))
         (sgml-close-tag)))))
 
+;; TODO: Disable autopair in HTML.  Interferes with autoclose tab.
 (use-package multi-web-mode
   :init
   (setq mweb-default-major-mode 'html-mode
@@ -232,7 +242,6 @@ an opening tag that is not followed by a matching closing tag."
 
 ;; ---------- C# Mode -------------
 (use-package csharp-mode
-  :disabled ;; TODO: Disabled because compiler warnings with newest version
   :if (version<= "24.4" emacs-version))
 
 ;; ------- Markdown Mode ----------
@@ -241,8 +250,74 @@ an opening tag that is not followed by a matching closing tag."
 
 ;; ---- StackOverflow Client ------
 (use-package sx
-  ;; TODO: I don't even know if this works.  Doesn't seem well maintained
-  :disabled)
+  ;; TODO: More keybindings if useful
+  :bind (("C-c C-q" . sx-search))
+  :config
+  (defvar sx-dir (concat user-emacs-directory ".sx"))
+  (if (file-exists-p sx-dir)
+      (and (shell-command (concat "chmod 700 " sx-dir))
+           (shell-command (concat "chmod 600 " sx-dir "/*.el")))
+    )
+  :commands (sx-accept
+             sx-answer
+             sx-ask
+             sx-authenticate
+             sx-bug-report
+             sx-button-copy
+             sx-button-edit-this
+             sx-button-follow-link
+             sx-cache-invalidate-all
+             sx-comment
+             sx-compose-insert-tags
+             sx-compose-mode
+             sx-compose-quit
+             sx-compose-send
+             sx-delete
+             sx-display
+             sx-display-question
+             sx-downvote
+             sx-edit
+             sx-favorite
+             sx-inbox
+             sx-inbox-mode
+             sx-inbox-notifications
+             sx-open-link
+             sx-question-list-hide
+             sx-question-list-mark-read
+             sx-question-list-mode
+             sx-question-list-next
+             sx-question-list-next-far
+             sx-question-list-next-page
+             sx-question-list-order-by
+             sx-question-list-previous
+             sx-question-list-previous-far
+             sx-question-list-refresh
+             sx-question-list-switch-site
+             sx-question-list-view-next
+             sx-question-list-view-previous
+             sx-question-mode
+             sx-question-mode-hide-show-section
+             sx-question-mode-next-section
+             sx-question-mode-order-by
+             sx-question-mode-previous-section
+             sx-question-mode-refresh
+             sx-search
+             sx-search-tag-at-point
+             sx-star
+             sx-tab-all-questions
+             sx-tab-featured
+             sx-tab-frontpage
+             sx-tab-hot
+             sx-tab-month
+             sx-tab-newest
+             sx-tab-starred
+             sx-tab-topvoted
+             sx-tab-unanswered
+             sx-tab-unanswered-my-tags
+             sx-tab-week
+             sx-upvote
+             sx-version
+             sx-visit-externally))
 
 ;; -------- Spellcheck ------------
 (defun flyspell-detect-ispell-args (&optional run-together)
@@ -287,12 +362,20 @@ an opening tag that is not followed by a matching closing tag."
              restclient-toggle-body-visibility-or-indent))
 
 ;; ------- Highlight TODO -------
+;; Remove transpose bindings.  I don't have any reasonable use for them
+;; and would much rather use them for navigating TODO's.
+
+(let ((trans-chars "\C-t");; Transpose (swap) adjacent characters
+      )
+  (global-unset-key trans-chars))
 (use-package hl-todo
   :commands (hl-todo-mode
              hl-todo-next
              hl-todo-occur
              hl-todo-previous)
-  :hook (prog-mode . hl-todo-mode))
+  :hook (prog-mode . hl-todo-mode)
+  :bind (("C-t n" . hl-todo-next)
+         ("C-t p" . hl-todo-previous)))
 
 ;; ---- Printer Integration -----
 (use-package printing
@@ -304,3 +387,5 @@ an opening tag that is not followed by a matching closing tag."
              lpr-region)
   :config
   (pr-update-menus t))
+
+