diff --git a/dictionaries/elisp/cspell-ext.json b/dictionaries/elisp/cspell-ext.json index acad55f2e94..945dcd3c8ff 100644 --- a/dictionaries/elisp/cspell-ext.json +++ b/dictionaries/elisp/cspell-ext.json @@ -1,11 +1,9 @@ -// cSpell Settings { "id": "elisp", "version": "0.2", "name": "Emacs Lisp", "description": "Emacs Lisp dictionary for cspell.", "readonly": true, - // List of dictionary files to add to the global list of dictionaries "dictionaryDefinitions": [ { "name": "elisp", @@ -13,32 +11,22 @@ "description": "Emacs Lisp dictionary for cspell." } ], - // Dictionaries to always be used. - // Generally left empty "dictionaries": [], - // Language Rules to apply to matching files. - // Files are matched on `languageId` and `locale` "languageSettings": [ { - // VSCode languageId. i.e. typescript, java, go, cpp, javascript, markdown, latex - // * will match against any file type. - "languageId": "elisp", - // Language locale. i.e. en-US, de-AT, or ru. * will match all locales. - // Multiple locales can be specified like: "en, en-US" to match both English and English US. + "languageId": "elisp,lisp", "locale": "*", - // By default the whole text of a file is included for spell checking - // Adding patterns to the "includeRegExpList" to only include matching patterns "includeRegExpList": [], - // To exclude patterns, add them to "ignoreRegExpList" "ignoreRegExpList": [], - // regex patterns than can be used with ignoreRegExpList or includeRegExpList - // Example: "pattern": [{ "name": "mdash", "pattern": "—" }] - // This could be included in "ignoreRegExpList": ["mdash"] "patterns": [], - // List of dictionaries to enable by name in `dictionaryDefinitions` "dictionaries": ["elisp"], - // Dictionary definitions can also be supplied here. They are only used iff "languageId" and "locale" match. "dictionaryDefinitions": [] } + ], + "overrides": [ + { + "filename": ["**/*.{el,lisp,lsp,l}"], + "dictionaries": ["elisp"] + } ] } diff --git a/dictionaries/elisp/cspell.json b/dictionaries/elisp/cspell.json index 90d14d2f4b0..575df58da98 100644 --- a/dictionaries/elisp/cspell.json +++ b/dictionaries/elisp/cspell.json @@ -3,10 +3,9 @@ "files": [ "**/*.{md,txt}" ], - "dictionaries": [ - "elisp" - ], "import": [ "./cspell-ext.json" - ] + ], + "enableFiletypes": ["elisp", "lisp"], + "overrides": [{ "filename": "**/*.{md,txt}", "dictionaries": ["elisp"]}] } diff --git a/dictionaries/elisp/package.json b/dictionaries/elisp/package.json index 3547b78f4a7..8074adb5cde 100644 --- a/dictionaries/elisp/package.json +++ b/dictionaries/elisp/package.json @@ -1,8 +1,7 @@ { "name": "@cspell/dict-elisp", "version": "1.0.0", - "description": "Emacs Lisp dictionary for cspell. -- Private until verified", - "private": true, + "description": "Emacs Lisp dictionary for cspell.", "publishConfig": { "access": "public" }, @@ -13,7 +12,9 @@ }, "scripts": { "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 cspell-tools-cli build", - "test": "head -n 1000 \"src/elisp.txt\" | cspell -c ./cspell-ext.json \"--locale=*\" \"--languageId=elisp\" stdin", + "test": "pnpm test:words && pnpm test:samples", + "test:words": "head -n 1000 \"src/elisp.txt\" | cspell -c ./cspell-ext.json \"--locale=*\" \"--languageId=elisp\" stdin", + "test:samples": "cspell -r samples .", "prepublishOnly": "echo OK", "prepare:dictionary": "pnpm run build" }, diff --git a/dictionaries/elisp/samples/cspell.json b/dictionaries/elisp/samples/cspell.json new file mode 100644 index 00000000000..52f2efc8582 --- /dev/null +++ b/dictionaries/elisp/samples/cspell.json @@ -0,0 +1,5 @@ +{ + "import": ["../cspell-ext.json"], + "enableFiletypes": ["elisp", "lisp"], + "words": ["elisp"] +} diff --git a/dictionaries/elisp/samples/examples.el b/dictionaries/elisp/samples/examples.el new file mode 100644 index 00000000000..f1cde1298f5 --- /dev/null +++ b/dictionaries/elisp/samples/examples.el @@ -0,0 +1,54 @@ +;;;; http://xahlee.info/emacs/emacs/elisp_examples.html + +;;;; Insert Text +(defun my-insert-p-tag () + "Insert

at cursor point." + (interactive) + (insert "

") + (backward-char 4)) + +;;;; Insert Around Region +(defun my-wrap-markup-region () + "Insert a markup around a region." + (interactive) + (let ((p1 (region-beginning)) + (p2 (region-end))) + (goto-char p2) + (insert "") + (goto-char p1) + (insert ""))) + +;;;; Select Current Word + +;; turn on highlight selection +(transient-mark-mode 1) + +(defun my-select-current-word () + "Select the word under cursor. +“word” here is considered any alphanumeric sequence with “_” or “-”." + (interactive) + (let (pt) + (skip-chars-backward "-_A-Za-z0-9") + (setq pt (point)) + (skip-chars-forward "-_A-Za-z0-9") + (set-mark pt))) + +;;;; Find Replace String in Region + +(defun my-replace-greek-region () + "Replace “alpha” to “α” and other greek letters in current region." + (interactive) + (let ( + (p1 (region-beginning)) + (p2 (region-end))) + (save-restriction + (narrow-to-region p1 p2) + (goto-char (point-min)) + (while (search-forward " alpha" nil t) + (replace-match " α" nil t)) + (goto-char (point-min)) + (while (search-forward " beta" nil t) + (replace-match " β" nil t)) + (goto-char (point-min)) + (while (search-forward " gamma" nil t) + (replace-match " γ" nil t)))))