From 5493751e00ef34c2ac445cf9a9dfd864f89fc203 Mon Sep 17 00:00:00 2001 From: Sinkerine Date: Mon, 23 Sep 2019 00:19:47 -0700 Subject: [PATCH] Add PR #102 changes into src/ --- emmet-mode.el | 10 ++++++++-- src/html-abbrev.el | 22 ++++++++++++---------- src/mode-def.el | 8 +++++++- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/emmet-mode.el b/emmet-mode.el index 7af5741..1bafb22 100644 --- a/emmet-mode.el +++ b/emmet-mode.el @@ -238,7 +238,6 @@ NOTE: only \" /\", \"/\" and \"\" are valid." e. g. without semicolons") (make-variable-buffer-local 'emmet-use-sass-syntax) - (defvar emmet-css-major-modes '(css-mode scss-mode @@ -251,6 +250,13 @@ e. g. without semicolons") '(rjsx-mode typescript-tsx-mode)) +(defvar emmet-fallback-filter '("html") + "Fallback filter for `emmet-default-filter', if none is found.") + +(defvar emmet-file-filter nil + "File local filter used by `emmet-default-filter'.") +(make-variable-buffer-local 'emmet-file-filter) + (defun emmet-transform (input) (if (or (emmet-detect-style-tag-and-attr) emmet-use-css-transform) (emmet-css-transform input) @@ -4129,7 +4135,7 @@ tbl)) (emmet-join-string (mapcar #'(lambda (expr) - (let* + (let* ((hash-map (if emmet-use-sass-syntax emmet-sass-snippets emmet-css-snippets)) (basement (emmet-aif diff --git a/src/html-abbrev.el b/src/html-abbrev.el index 2cd2835..da4a191 100644 --- a/src/html-abbrev.el +++ b/src/html-abbrev.el @@ -51,16 +51,18 @@ (defun emmet-default-filter () "Default filter(s) to be used if none is specified." - (let* ((file-ext (car (emmet-regex ".*\\(\\..*\\)" (or (buffer-file-name) "") 1))) - (defaults '(".html" ("html") - ".htm" ("html") - ".haml" ("haml") - ".clj" ("hic"))) - (default-else '("html")) - (selected-default (member file-ext defaults))) - (if selected-default - (cadr selected-default) - default-else))) + (or emmet-file-filter + (let* ((file-ext (car (emmet-regex ".*\\(\\..*\\)" (or (buffer-file-name) "") 1))) + (defaults '(".html" ("html") + ".htm" ("html") + ".haml" ("haml") + ".clj" ("hic") + ".cljs" ("hic"))) + (default-else emmet-fallback-filter) + (selected-default (member file-ext defaults))) + (if selected-default + (cadr selected-default) + default-else)))) (defun emmet-numbering (input) (emmet-parse diff --git a/src/mode-def.el b/src/mode-def.el index 160fd73..07e0df7 100644 --- a/src/mode-def.el +++ b/src/mode-def.el @@ -82,7 +82,6 @@ NOTE: only \" /\", \"/\" and \"\" are valid." e. g. without semicolons") (make-variable-buffer-local 'emmet-use-sass-syntax) - (defvar emmet-css-major-modes '(css-mode scss-mode @@ -95,6 +94,13 @@ e. g. without semicolons") '(rjsx-mode typescript-tsx-mode)) +(defvar emmet-fallback-filter '("html") + "Fallback filter for `emmet-default-filter', if none is found.") + +(defvar emmet-file-filter nil + "File local filter used by `emmet-default-filter'.") +(make-variable-buffer-local 'emmet-file-filter) + (defun emmet-transform (input) (if (or (emmet-detect-style-tag-and-attr) emmet-use-css-transform) (emmet-css-transform input)