diff options
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/init.org | 200 |
1 files changed, 101 insertions, 99 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 75811af..ed21bd1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1995,35 +1995,36 @@ With =web-mode= being so good, I don’t really use this much. It’s good for embedded SQL though. #+BEGIN_SRC emacs-lisp -(req-package mmm-auto - :config (progn - (mmm-add-classes - '((php-sql - :submode sql-mode - :front "<<<SQL[\r\n]+" - :back "SQL;?" - :face mmm-code-submode-face))) - (mmm-add-mode-ext-class 'php-mode "\\.php$" 'php-sql) - (mmm-add-classes - '((markdown-toml - :submode toml-mode - :face mmm-declaration-submode-face - :front "\\`+++[\n\r]+" - :back "^+++$") - (markdown-lisp - :submode common-lisp-mode - :face mmm-code-submode-face - :front "^{{% highlight cl %}}[\r\n]+" - :back "^{{% /highlight %}}$") - (markdown-shell - :submode shell-script-mode - :face mmm-code-submode-face - :front "^{{% highlight sh %}}[\r\n]+" - :back "^{{% /highlight %}}$"))) - (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-toml) - (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-lisp) - (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-shell)) - :init (setq mmm-global-mode 'maybe)) + (req-package mmm-auto + :ensure mmm-mode + :config (progn + (mmm-add-classes + '((php-sql + :submode sql-mode + :front "<<<SQL[\r\n]+" + :back "SQL;?" + :face mmm-code-submode-face))) + (mmm-add-mode-ext-class 'php-mode "\\.php$" 'php-sql) + (mmm-add-classes + '((markdown-toml + :submode toml-mode + :face mmm-declaration-submode-face + :front "\\`+++[\n\r]+" + :back "^+++$") + (markdown-lisp + :submode common-lisp-mode + :face mmm-code-submode-face + :front "^{{% highlight cl %}}[\r\n]+" + :back "^{{% /highlight %}}$") + (markdown-shell + :submode shell-script-mode + :face mmm-code-submode-face + :front "^{{% highlight sh %}}[\r\n]+" + :back "^{{% /highlight %}}$"))) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-toml) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-lisp) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-shell)) + :init (setq mmm-global-mode 'maybe)) #+END_SRC **** TODO Setup for javascript + SQL @@ -2214,77 +2215,78 @@ I like using typographic symbols, but I don’t always remember (how) to type them. #+BEGIN_SRC emacs-lisp -(req-package typopunct - :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)))) + (req-package typopunct + :commands (typopunct-mode) + :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 - (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 - (add-hook 'text-mode-hook #'typopunct-mode))) + ((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))))) + :init (progn + (add-hook 'text-mode-hook #'typopunct-mode))) #+END_SRC ** avy |