-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore (elisp): add example and prepare to publish (#3092)
- Loading branch information
Showing
5 changed files
with
73 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,32 @@ | ||
// 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", | ||
"path": "./dict/elisp.txt", | ||
"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"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"import": ["../cspell-ext.json"], | ||
"enableFiletypes": ["elisp", "lisp"], | ||
"words": ["elisp"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
;;;; http://xahlee.info/emacs/emacs/elisp_examples.html | ||
|
||
;;;; Insert Text | ||
(defun my-insert-p-tag () | ||
"Insert <p></p> at cursor point." | ||
(interactive) | ||
(insert "<p></p>") | ||
(backward-char 4)) | ||
|
||
;;;; Insert Around Region | ||
(defun my-wrap-markup-region () | ||
"Insert a markup <b></b> around a region." | ||
(interactive) | ||
(let ((p1 (region-beginning)) | ||
(p2 (region-end))) | ||
(goto-char p2) | ||
(insert "</b>") | ||
(goto-char p1) | ||
(insert "<b>"))) | ||
|
||
;;;; 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))))) |