diff options
author | Alan Pearce | 2015-11-16 15:38:19 +0100 |
---|---|---|
committer | Alan Pearce | 2015-11-16 15:42:24 +0100 |
commit | a48acf4d16a03bc2b2945f37a697925f810296c1 (patch) | |
tree | 04ca5070b674916ed2743c6b1fd340d415fad458 | |
parent | eaad53be0b89234332b67f6c4d980c4cd8efcf8c (diff) | |
download | nixfiles-a48acf4d16a03bc2b2945f37a697925f810296c1.tar.lz nixfiles-a48acf4d16a03bc2b2945f37a697925f810296c1.tar.zst nixfiles-a48acf4d16a03bc2b2945f37a697925f810296c1.zip |
Emacs: Replace typopunct-mode with typo-mode
-rw-r--r-- | tag-emacs/emacs.d/init.org | 73 |
1 files changed, 3 insertions, 70 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 720f14df..ed0139f3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2170,78 +2170,11 @@ I like using typographic symbols, but I don’t always remember (how) to type them. #+BEGIN_SRC emacs-lisp - (req-package typopunct - :commands (typopunct-mode) + (req-package typo :config (progn - (typopunct-change-language 'english t) - (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))) - - (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))))) + (typo-global-mode 1)) :init (progn - (add-hook 'text-mode-hook #'typopunct-mode))) + (add-hook 'text-mode-hook #'typo-mode))) #+END_SRC ** avy |