summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tag-emacs/emacs.d/Cask4
-rw-r--r--tag-emacs/emacs.d/init.el88
2 files changed, 81 insertions, 11 deletions
diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask
index 57de007..398b412 100644
--- a/tag-emacs/emacs.d/Cask
+++ b/tag-emacs/emacs.d/Cask
@@ -20,6 +20,7 @@
 (depends-on "company")
 (depends-on "company-go")
 (depends-on "company-tern")
+(depends-on "csv-mode")
 (depends-on "dash")
 (depends-on "dash-functional")
 (depends-on "deferred")
@@ -61,6 +62,7 @@
 (depends-on "help-fns+")
 (depends-on "hemisu-theme")
 (depends-on "highlight-stages")
+(depends-on "ido-completing-read+")
 (depends-on "ido-vertical-mode")
 (depends-on "jinja2-mode")
 (depends-on "jquery-doc")
@@ -122,7 +124,7 @@
 (depends-on "tern")
 (depends-on "toml-mode")
 (depends-on "tup-mode")
-(depends-on "typo")
+(depends-on "typopunct")
 (depends-on "undo-tree")
 (depends-on "use-package")
 (depends-on "visual-regexp")
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index b8835d9..d523107 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -588,8 +588,7 @@
   :bind (("C-x i" . helm-semantic-or-imenu))
   :config (progn
             (setq helm-idle-delay .1
-                  helm-input-idle-delay 0
-                  ido-use-virtual-buffers t)
+                  helm-input-idle-delay 0)
             (when (fboundp #'helm-adaptive-mode)
               (helm-adaptive-mode 1))))
 
@@ -623,6 +622,12 @@
               (ido-initiate-auto-merge (current-buffer)))
             (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map)))
 
+(req-package ido-completing-read+
+  :require ido
+  :config (progn
+            (setq ido-cr+-fallback-function #'helm-completing-read
+                  ido-cr+-max-items 2000)))
+
 (defun ap/ido-projectile-switch-buffer-dwim (force-ido)
   (interactive "p")
   (if (and (projectile-project-p) (eq force-ido 1))
@@ -1164,10 +1169,78 @@ symbol, not word, as I need this for programming the most."
   :bind (("M-z" . zap-up-to-char)
          ("M-Z" . zap-to-char)))
 
-(req-package typo
+(req-package typopunct
+  :config (progn
+            (defconst typopunct-minus (decode-char 'ucs #x2212))
+            (defadvice typopunct-insert-typographical-dashes
+                (around minus-or-pm activate)
+              (cond
+               ((or (eq (char-before) typopunct-em-dash)
+                    (looking-back "\\([[:blank:]]\\|^\\)\\^"))
+                (delete-char -1)
+                (insert typopunct-minus))
+               ((looking-back "[^[:blank:]]\\^")
+                (insert typopunct-minus))
+               (t ad-do-it)))
+            (define-key typopunct-map "+" 'typopunct-insert-mp)
+
+            (defconst typopunct-ellipsis (decode-char 'ucs #x2026))
+            (defconst typopunct-middot   (decode-char 'ucs #xB7)) ; or 2219
+            (defun typopunct-insert-ellipsis-or-middot (arg)
+              "Change three consecutive dots to a typographical ellipsis mark."
+              (interactive "p")
+              (cond
+               ((and (= 1 arg)
+                     (eq (char-before) ?^))
+                (delete-char -1)
+                (insert typopunct-middot))
+               ((and (= 1 arg)
+                     (eq this-command last-command)
+                     (looking-back "\\.\\."))
+                (replace-match "")
+                (insert typopunct-ellipsis))
+               (t
+                (self-insert-command arg))))
+            (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot)
+
+            (defconst typopunct-times (decode-char 'ucs #xD7))
+            (defun typopunct-insert-times (arg)
+              (interactive "p")
+              (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^"))
+                  (progn (delete-char -1)
+                         (insert typopunct-times))
+                (self-insert-command arg)))
+            (define-key typopunct-map "x" 'typopunct-insert-times)
+
+            (defadvice typopunct-insert-quotation-mark (around wrap-region activate)
+              (let* ((lang (or (get-text-property (point) 'typopunct-language)
+                               typopunct-buffer-language))
+                     (omark (if single
+                                (typopunct-opening-single-quotation-mark lang)
+                              (typopunct-opening-quotation-mark lang)))
+                     (qmark (if single
+                                (typopunct-closing-single-quotation-mark lang)
+                              (typopunct-closing-quotation-mark lang))))
+                (cond
+                 (mark-active
+                  (let ((skeleton-end-newline nil)
+                        (singleo (typopunct-opening-single-quotation-mark lang))
+                        (singleq (typopunct-closing-single-quotation-mark lang)))
+                    (if (> (point) (mark))
+                        (exchange-point-and-mark))
+                    (save-excursion
+                      (while (re-search-forward (regexp-quote (string omark)) (mark) t)
+                        (replace-match (regexp-quote (string singleo)) nil nil)))
+                    (save-excursion
+                      (while (re-search-forward (regexp-quote (string qmark)) (mark) t)
+                        (replace-match (regexp-quote (string singleq)) nil nil)))
+                    (skeleton-insert (list nil omark '_ qmark) -1)))
+                 ((looking-at (regexp-opt (list (string omark) (string qmark))))
+                  (forward-char 1))
+                 (t ad-do-it)))))
   :init (progn
-          (typo-global-mode t)
-          (add-hook 'text-mode-hook 'typo-mode)))
+          (typopunct-change-language 'english t)
+          (add-hook 'text-mode-hook #'typopunct-mode)))
 
 (req-package ap-functions
   :commands (ap/remove-extra-cr)
@@ -1242,11 +1315,6 @@ symbol, not word, as I need this for programming the most."
 (req-package paredit
   :diminish "()"
   :commands (paredit-mode)
-  :config (progn
-            (defun ap/cedit-space-delimiter-p (endp delimiter)
-              "Don't insert a space before delimiters in c-style modes"
-              (not cedit-mode))
-            (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p))
   :init (progn
           (add-hook 'lisp-mode-common-hook #'enable-paredit-mode)
           (put #'paredit-forward-delete 'delete-selection 'supersede)