diff --git a/init.d/text/common.el b/init.d/text/common.el index 22a5905..34bc976 100644 --- a/init.d/text/common.el +++ b/init.d/text/common.el @@ -1,6 +1,6 @@ ;;; common.el --- Common settings for text files. -*- lexical-binding: t; -*- -;; Time-stamp: <2020-08-22T20:54:31+0200> +;; Time-stamp: <2020-08-24T01:19:01+0200> ;;; Commentary: @@ -155,12 +155,20 @@ (if company-candidates (company-complete-selection) (yas-next-field))) - (yas-reload-all)) + (yas-reload-all) + + (defun my/string-to-var (string) + "Replace characters that usually are illegal in variable names in STRING with _." + (interactive) + (replace-regexp-in-string + "[[:space:]]" "_" + (replace-regexp-in-string "[^[:ascii:]]" "_" string)))) :bind (:map yas-keymap ("" . my/tab-yas-or-company) ("TAB" . my/tab-yas-or-company)) - :hook (prog-mode . yas-minor-mode)) + :hook ((prog-mode . yas-minor-mode) + (org-mode . yas-minor-mode))) ;; Install snippet-collection but don't use it. (use-package yasnippet-snippets