update readme
This commit is contained in:
parent
8b3dcbbac2
commit
c8383cb462
26
README.md
26
README.md
@ -209,8 +209,8 @@ A complete overview of all tp.el functions organized by category:
|
|||||||
| [`tp-define-layer`](#tp-define-layer---define-layers) | Define a layer or layer group |
|
| [`tp-define-layer`](#tp-define-layer---define-layers) | Define a layer or layer group |
|
||||||
| [`tp-layer-props`](#tp-layer-props--tp-group-props) | Get properties for a layer |
|
| [`tp-layer-props`](#tp-layer-props--tp-group-props) | Get properties for a layer |
|
||||||
| [`tp-group-props`](#tp-layer-props--tp-group-props) | Get properties for all layers in a group |
|
| [`tp-group-props`](#tp-layer-props--tp-group-props) | Get properties for all layers in a group |
|
||||||
| [`tp-layer-undefine`](#tp-layer-undefine--tp-group-undefine) | Remove layer definition |
|
| [`tp-undefine-layer`](#tp-undefine-layer--tp-undefine-group) | Remove layer definition |
|
||||||
| [`tp-group-undefine`](#tp-layer-undefine--tp-group-undefine) | Remove group definition |
|
| [`tp-undefine-group`](#tp-undefine-layer--tp-undefine-group) | Remove group definition |
|
||||||
| [`tp-layer-reset`](#tp-layer-reset) | Clear all layer/group definitions |
|
| [`tp-layer-reset`](#tp-layer-reset) | Clear all layer/group definitions |
|
||||||
|
|
||||||
#### Property Layer Placement Functions
|
#### Property Layer Placement Functions
|
||||||
@ -1139,11 +1139,11 @@ Get properties for a layer or all layers in a group.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
#### `tp-layer-undefine` / `tp-group-undefine`
|
#### `tp-undefine-layer` / `tp-undefine-group`
|
||||||
|
|
||||||
```elisp
|
```elisp
|
||||||
(tp-layer-undefine NAME)
|
(tp-undefine-layer NAME)
|
||||||
(tp-group-undefine NAME)
|
(tp-undefine-group NAME)
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove layer or group definition.
|
Remove layer or group definition.
|
||||||
@ -1155,7 +1155,7 @@ Remove layer or group definition.
|
|||||||
(progn
|
(progn
|
||||||
(setq tp-layer-alist nil)
|
(setq tp-layer-alist nil)
|
||||||
(tp-define-layer temp-layer (face bold))
|
(tp-define-layer temp-layer (face bold))
|
||||||
(tp-layer-undefine 'temp-layer)
|
(tp-undefine-layer 'temp-layer)
|
||||||
(tp-layer-props 'temp-layer))
|
(tp-layer-props 'temp-layer))
|
||||||
;; => nil
|
;; => nil
|
||||||
|
|
||||||
@ -1165,7 +1165,7 @@ Remove layer or group definition.
|
|||||||
(setq tp-layer-groups nil)
|
(setq tp-layer-groups nil)
|
||||||
(tp-define-layer l1 (face bold))
|
(tp-define-layer l1 (face bold))
|
||||||
(tp-define-layer my-group l1)
|
(tp-define-layer my-group l1)
|
||||||
(tp-group-undefine 'my-group)
|
(tp-undefine-group 'my-group)
|
||||||
(assoc 'my-group tp-layer-groups))
|
(assoc 'my-group tp-layer-groups))
|
||||||
;; => nil
|
;; => nil
|
||||||
```
|
```
|
||||||
@ -1796,18 +1796,6 @@ Get name of the top (visible) layer.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Aliases
|
|
||||||
|
|
||||||
For convenience, tp.el provides these aliases:
|
|
||||||
|
|
||||||
| Alias | Original Function |
|
|
||||||
|-------|-------------------|
|
|
||||||
| `tp-layer-properties` | `tp-layer-props` |
|
|
||||||
| `tp-layer-group-properties` | `tp-group-props` |
|
|
||||||
| `tp-layer-group-undefine` | `tp-group-undefine` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
GNU General Public License v2 or later.
|
GNU General Public License v2 or later.
|
||||||
|
|||||||
26
README_CN.md
26
README_CN.md
@ -208,8 +208,8 @@ tp.el 所有函数按类别组织的完整概览:
|
|||||||
| [`tp-define-layer`](#tp-define-layer---定义属性层) | 定义属性层或属性层组 |
|
| [`tp-define-layer`](#tp-define-layer---定义属性层) | 定义属性层或属性层组 |
|
||||||
| [`tp-layer-props`](#tp-layer-props--tp-group-props) | 获取属性层的属性 |
|
| [`tp-layer-props`](#tp-layer-props--tp-group-props) | 获取属性层的属性 |
|
||||||
| [`tp-group-props`](#tp-layer-props--tp-group-props) | 获取属性层组中所有属性层的属性 |
|
| [`tp-group-props`](#tp-layer-props--tp-group-props) | 获取属性层组中所有属性层的属性 |
|
||||||
| [`tp-layer-undefine`](#tp-layer-undefine--tp-group-undefine) | 移除属性层定义 |
|
| [`tp-undefine-layer`](#tp-undefine-layer--tp-undefine-group) | 移除属性层定义 |
|
||||||
| [`tp-group-undefine`](#tp-layer-undefine--tp-group-undefine) | 移除属性层组定义 |
|
| [`tp-undefine-group`](#tp-undefine-layer--tp-undefine-group) | 移除属性层组定义 |
|
||||||
| [`tp-layer-reset`](#tp-layer-reset) | 清除所有属性层/属性层组定义 |
|
| [`tp-layer-reset`](#tp-layer-reset) | 清除所有属性层/属性层组定义 |
|
||||||
|
|
||||||
#### 属性层放置函数
|
#### 属性层放置函数
|
||||||
@ -1133,11 +1133,11 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
#### `tp-layer-undefine` / `tp-group-undefine`
|
#### `tp-undefine-layer` / `tp-undefine-group`
|
||||||
|
|
||||||
```elisp
|
```elisp
|
||||||
(tp-layer-undefine NAME)
|
(tp-undefine-layer NAME)
|
||||||
(tp-group-undefine NAME)
|
(tp-undefine-group NAME)
|
||||||
```
|
```
|
||||||
|
|
||||||
移除属性层或属性层组定义。
|
移除属性层或属性层组定义。
|
||||||
@ -1149,7 +1149,7 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
|||||||
(progn
|
(progn
|
||||||
(setq tp-layer-alist nil)
|
(setq tp-layer-alist nil)
|
||||||
(tp-define-layer temp-layer (face bold))
|
(tp-define-layer temp-layer (face bold))
|
||||||
(tp-layer-undefine 'temp-layer)
|
(tp-undefine-layer 'temp-layer)
|
||||||
(tp-layer-props 'temp-layer))
|
(tp-layer-props 'temp-layer))
|
||||||
;; => nil
|
;; => nil
|
||||||
|
|
||||||
@ -1159,7 +1159,7 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
|||||||
(setq tp-layer-groups nil)
|
(setq tp-layer-groups nil)
|
||||||
(tp-define-layer l1 (face bold))
|
(tp-define-layer l1 (face bold))
|
||||||
(tp-define-layer my-group l1)
|
(tp-define-layer my-group l1)
|
||||||
(tp-group-undefine 'my-group)
|
(tp-undefine-group 'my-group)
|
||||||
(assoc 'my-group tp-layer-groups))
|
(assoc 'my-group tp-layer-groups))
|
||||||
;; => nil
|
;; => nil
|
||||||
```
|
```
|
||||||
@ -1790,18 +1790,6 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 别名
|
|
||||||
|
|
||||||
为方便使用,tp.el 提供以下别名:
|
|
||||||
|
|
||||||
| 别名 | 原函数 |
|
|
||||||
|------|--------|
|
|
||||||
| `tp-layer-properties` | `tp-layer-props` |
|
|
||||||
| `tp-layer-group-properties` | `tp-group-props` |
|
|
||||||
| `tp-layer-group-undefine` | `tp-group-undefine` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
GNU 通用公共许可证 v2 或更高版本。
|
GNU 通用公共许可证 v2 或更高版本。
|
||||||
|
|||||||
45
tp-tests.el
45
tp-tests.el
@ -249,12 +249,12 @@
|
|||||||
(should (null (tp-layer-props 'undefined-layer)))))
|
(should (null (tp-layer-props 'undefined-layer)))))
|
||||||
|
|
||||||
(ert-deftest tp-test-layer-undefine ()
|
(ert-deftest tp-test-layer-undefine ()
|
||||||
"Test tp-layer-undefine removes layer definition."
|
"Test tp-undefine-layer removes layer definition."
|
||||||
(tp-test-with-temp-buffer
|
(tp-test-with-temp-buffer
|
||||||
(tp-define-layer test-layer (face bold))
|
(tp-define-layer test-layer (face bold))
|
||||||
(should (assoc 'test-layer tp-layer-alist))
|
(should (assoc 'test-layer tp-layer-alist))
|
||||||
(tp-layer-undefine 'test-layer)
|
(tp-undefine-layer 'test-layer)
|
||||||
(should-not (assoc 'test-layer tp-layer-alist))))
|
(should-not (assoc 'test-layer tp-layer-alist))))
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;; Layer Group Tests (using tp-define-layer with multiple layers)
|
;;; Layer Group Tests (using tp-define-layer with multiple layers)
|
||||||
@ -288,13 +288,13 @@
|
|||||||
(should (memq 'italic faces))))))
|
(should (memq 'italic faces))))))
|
||||||
|
|
||||||
(ert-deftest tp-test-group-undefine ()
|
(ert-deftest tp-test-group-undefine ()
|
||||||
"Test tp-group-undefine removes group definition."
|
"Test tp-undefine-group removes group definition."
|
||||||
(tp-test-with-temp-buffer
|
(tp-test-with-temp-buffer
|
||||||
(tp-define-layer layer1 (face bold))
|
(tp-define-layer layer1 (face bold))
|
||||||
(tp-define-layer my-group layer1)
|
(tp-define-layer my-group layer1)
|
||||||
(should (assoc 'my-group tp-layer-groups))
|
(should (assoc 'my-group tp-layer-groups))
|
||||||
(tp-group-undefine 'my-group)
|
(tp-undefine-group 'my-group)
|
||||||
(should-not (assoc 'my-group tp-layer-groups))))
|
(should-not (assoc 'my-group tp-layer-groups))))
|
||||||
|
|
||||||
(ert-deftest tp-test-layer-reset ()
|
(ert-deftest tp-test-layer-reset ()
|
||||||
"Test tp-layer-reset clears all definitions."
|
"Test tp-layer-reset clears all definitions."
|
||||||
@ -860,25 +860,6 @@
|
|||||||
|
|
||||||
;; Tests for tp-search are in Search and Navigation Tests section above
|
;; Tests for tp-search are in Search and Navigation Tests section above
|
||||||
|
|
||||||
;;; ============================================================
|
|
||||||
;;; Alias Tests
|
|
||||||
;;; ============================================================
|
|
||||||
|
|
||||||
(ert-deftest tp-test-aliases-exist ()
|
|
||||||
"Test that all aliases are properly defined."
|
|
||||||
(should (fboundp 'tp-set))
|
|
||||||
(should (fboundp 'tp-layer-properties))
|
|
||||||
(should (fboundp 'tp-layer-group-properties))
|
|
||||||
(should (fboundp 'tp-layer-group-undefine)))
|
|
||||||
|
|
||||||
(ert-deftest tp-test-aliases-work ()
|
|
||||||
"Test that aliases work correctly."
|
|
||||||
(tp-test-with-temp-buffer
|
|
||||||
;; Test tp-set alias
|
|
||||||
(insert "Hello")
|
|
||||||
(tp-set 1 6 '(face bold))
|
|
||||||
(should (eq (tp-at 1 'face) 'bold))))
|
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;; Edge Case Tests
|
;;; Edge Case Tests
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
@ -886,8 +867,8 @@
|
|||||||
(ert-deftest tp-test-empty-region ()
|
(ert-deftest tp-test-empty-region ()
|
||||||
"Test operations on empty buffer."
|
"Test operations on empty buffer."
|
||||||
(tp-test-with-temp-buffer
|
(tp-test-with-temp-buffer
|
||||||
(should (null (tp-at 1)))
|
(should (null (tp-at 1)))
|
||||||
(should (tp-empty-p))))
|
(should (tp-empty-p))))
|
||||||
|
|
||||||
(ert-deftest tp-test-overlapping-regions ()
|
(ert-deftest tp-test-overlapping-regions ()
|
||||||
"Test overlapping property regions."
|
"Test overlapping property regions."
|
||||||
|
|||||||
13
tp.el
13
tp.el
@ -1515,9 +1515,6 @@ Appends 'tp-name property to identify the layer."
|
|||||||
(when-let ((plist (cdr (assoc layer-name tp-layer-alist))))
|
(when-let ((plist (cdr (assoc layer-name tp-layer-alist))))
|
||||||
(append plist (list 'tp-name layer-name))))
|
(append plist (list 'tp-name layer-name))))
|
||||||
|
|
||||||
(defalias 'tp-layer-properties 'tp-layer-props
|
|
||||||
"Alias for `tp-layer-props'.")
|
|
||||||
|
|
||||||
(defun tp-group-props (group-name)
|
(defun tp-group-props (group-name)
|
||||||
"Return list of properties for all layers in GROUP-NAME."
|
"Return list of properties for all layers in GROUP-NAME."
|
||||||
(when-let ((layers (cdr (assoc group-name tp-layer-groups))))
|
(when-let ((layers (cdr (assoc group-name tp-layer-groups))))
|
||||||
@ -1525,9 +1522,6 @@ Appends 'tp-name property to identify the layer."
|
|||||||
(tp-layer-props layer))
|
(tp-layer-props layer))
|
||||||
layers)))
|
layers)))
|
||||||
|
|
||||||
(defalias 'tp-layer-group-properties 'tp-group-props
|
|
||||||
"Alias for `tp-group-props'.")
|
|
||||||
|
|
||||||
(defun tp-layer-reset ()
|
(defun tp-layer-reset ()
|
||||||
"Reset all layer definitions.
|
"Reset all layer definitions.
|
||||||
Clears both `tp-layer-alist' and `tp-layer-groups'."
|
Clears both `tp-layer-alist' and `tp-layer-groups'."
|
||||||
@ -1535,17 +1529,14 @@ Clears both `tp-layer-alist' and `tp-layer-groups'."
|
|||||||
(setq tp-layer-alist nil)
|
(setq tp-layer-alist nil)
|
||||||
(setq tp-layer-groups nil))
|
(setq tp-layer-groups nil))
|
||||||
|
|
||||||
(defun tp-layer-undefine (name)
|
(defun tp-undefine-layer (name)
|
||||||
"Remove layer NAME from `tp-layer-alist'."
|
"Remove layer NAME from `tp-layer-alist'."
|
||||||
(setq tp-layer-alist (assq-delete-all name tp-layer-alist)))
|
(setq tp-layer-alist (assq-delete-all name tp-layer-alist)))
|
||||||
|
|
||||||
(defun tp-group-undefine (name)
|
(defun tp-undefine-group (name)
|
||||||
"Remove layer group NAME from `tp-layer-groups'."
|
"Remove layer group NAME from `tp-layer-groups'."
|
||||||
(setq tp-layer-groups (assq-delete-all name tp-layer-groups)))
|
(setq tp-layer-groups (assq-delete-all name tp-layer-groups)))
|
||||||
|
|
||||||
(defalias 'tp-layer-group-undefine 'tp-group-undefine
|
|
||||||
"Alias for `tp-group-undefine'.")
|
|
||||||
|
|
||||||
(defun tp-intervals-map (function start end &optional object)
|
(defun tp-intervals-map (function start end &optional object)
|
||||||
"Apply FUNCTION to all intervals between START and END in OBJECT.
|
"Apply FUNCTION to all intervals between START and END in OBJECT.
|
||||||
FUNCTION receives four arguments: interval-start, interval-end,
|
FUNCTION receives four arguments: interval-start, interval-end,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user