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-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-layer-undefine`](#tp-layer-undefine--tp-group-undefine) | Remove layer definition |
|
||||
| [`tp-group-undefine`](#tp-layer-undefine--tp-group-undefine) | Remove group definition |
|
||||
| [`tp-undefine-layer`](#tp-undefine-layer--tp-undefine-group) | Remove layer definition |
|
||||
| [`tp-undefine-group`](#tp-undefine-layer--tp-undefine-group) | Remove group definition |
|
||||
| [`tp-layer-reset`](#tp-layer-reset) | Clear all layer/group definitions |
|
||||
|
||||
#### 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
|
||||
(tp-layer-undefine NAME)
|
||||
(tp-group-undefine NAME)
|
||||
(tp-undefine-layer NAME)
|
||||
(tp-undefine-group NAME)
|
||||
```
|
||||
|
||||
Remove layer or group definition.
|
||||
@ -1155,7 +1155,7 @@ Remove layer or group definition.
|
||||
(progn
|
||||
(setq tp-layer-alist nil)
|
||||
(tp-define-layer temp-layer (face bold))
|
||||
(tp-layer-undefine 'temp-layer)
|
||||
(tp-undefine-layer 'temp-layer)
|
||||
(tp-layer-props 'temp-layer))
|
||||
;; => nil
|
||||
|
||||
@ -1165,7 +1165,7 @@ Remove layer or group definition.
|
||||
(setq tp-layer-groups nil)
|
||||
(tp-define-layer l1 (face bold))
|
||||
(tp-define-layer my-group l1)
|
||||
(tp-group-undefine 'my-group)
|
||||
(tp-undefine-group 'my-group)
|
||||
(assoc 'my-group tp-layer-groups))
|
||||
;; => 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
|
||||
|
||||
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-layer-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-group-undefine`](#tp-layer-undefine--tp-group-undefine) | 移除属性层组定义 |
|
||||
| [`tp-undefine-layer`](#tp-undefine-layer--tp-undefine-group) | 移除属性层定义 |
|
||||
| [`tp-undefine-group`](#tp-undefine-layer--tp-undefine-group) | 移除属性层组定义 |
|
||||
| [`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
|
||||
(tp-layer-undefine NAME)
|
||||
(tp-group-undefine NAME)
|
||||
(tp-undefine-layer NAME)
|
||||
(tp-undefine-group NAME)
|
||||
```
|
||||
|
||||
移除属性层或属性层组定义。
|
||||
@ -1149,7 +1149,7 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
||||
(progn
|
||||
(setq tp-layer-alist nil)
|
||||
(tp-define-layer temp-layer (face bold))
|
||||
(tp-layer-undefine 'temp-layer)
|
||||
(tp-undefine-layer 'temp-layer)
|
||||
(tp-layer-props 'temp-layer))
|
||||
;; => nil
|
||||
|
||||
@ -1159,7 +1159,7 @@ Emacs 的 `text-property-search-forward` 和 `text-property-search-backward` 的
|
||||
(setq tp-layer-groups nil)
|
||||
(tp-define-layer l1 (face bold))
|
||||
(tp-define-layer my-group l1)
|
||||
(tp-group-undefine 'my-group)
|
||||
(tp-undefine-group 'my-group)
|
||||
(assoc 'my-group tp-layer-groups))
|
||||
;; => 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 或更高版本。
|
||||
|
||||
45
tp-tests.el
45
tp-tests.el
@ -249,12 +249,12 @@
|
||||
(should (null (tp-layer-props 'undefined-layer)))))
|
||||
|
||||
(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-define-layer test-layer (face bold))
|
||||
(should (assoc 'test-layer tp-layer-alist))
|
||||
(tp-layer-undefine 'test-layer)
|
||||
(should-not (assoc 'test-layer tp-layer-alist))))
|
||||
(tp-define-layer test-layer (face bold))
|
||||
(should (assoc 'test-layer tp-layer-alist))
|
||||
(tp-undefine-layer 'test-layer)
|
||||
(should-not (assoc 'test-layer tp-layer-alist))))
|
||||
|
||||
;;; ============================================================
|
||||
;;; Layer Group Tests (using tp-define-layer with multiple layers)
|
||||
@ -288,13 +288,13 @@
|
||||
(should (memq 'italic faces))))))
|
||||
|
||||
(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-define-layer layer1 (face bold))
|
||||
(tp-define-layer my-group layer1)
|
||||
(should (assoc 'my-group tp-layer-groups))
|
||||
(tp-group-undefine 'my-group)
|
||||
(should-not (assoc 'my-group tp-layer-groups))))
|
||||
(tp-define-layer layer1 (face bold))
|
||||
(tp-define-layer my-group layer1)
|
||||
(should (assoc 'my-group tp-layer-groups))
|
||||
(tp-undefine-group 'my-group)
|
||||
(should-not (assoc 'my-group tp-layer-groups))))
|
||||
|
||||
(ert-deftest tp-test-layer-reset ()
|
||||
"Test tp-layer-reset clears all definitions."
|
||||
@ -860,25 +860,6 @@
|
||||
|
||||
;; 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
|
||||
;;; ============================================================
|
||||
@ -886,8 +867,8 @@
|
||||
(ert-deftest tp-test-empty-region ()
|
||||
"Test operations on empty buffer."
|
||||
(tp-test-with-temp-buffer
|
||||
(should (null (tp-at 1)))
|
||||
(should (tp-empty-p))))
|
||||
(should (null (tp-at 1)))
|
||||
(should (tp-empty-p))))
|
||||
|
||||
(ert-deftest tp-test-overlapping-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))))
|
||||
(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)
|
||||
"Return list of properties for all layers in GROUP-NAME."
|
||||
(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))
|
||||
layers)))
|
||||
|
||||
(defalias 'tp-layer-group-properties 'tp-group-props
|
||||
"Alias for `tp-group-props'.")
|
||||
|
||||
(defun tp-layer-reset ()
|
||||
"Reset all layer definitions.
|
||||
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-groups nil))
|
||||
|
||||
(defun tp-layer-undefine (name)
|
||||
(defun tp-undefine-layer (name)
|
||||
"Remove layer NAME from `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'."
|
||||
(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)
|
||||
"Apply FUNCTION to all intervals between START and END in OBJECT.
|
||||
FUNCTION receives four arguments: interval-start, interval-end,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user