File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,32 @@ string base on the `search-string` information. Then this is the result.
100100
101101## Before/After Insertion
102102
103- You can customize document before you actually insert anything.
103+ You can customize document before or after the document string insertion.
104+ There are total two hooks you can customize.
105+
106+ * ` docstr-before-insert-hook `
107+ * ` docstr-after-insert-hook `
108+
109+ The usage of this is to customize the document string with set up. For instance,
110+ some programming languages would add ` @desc ` before an actual description. Do
111+ the following can implement this.
112+
113+ ``` el
114+ (add-hook 'docstr-before-insert-hook (lambda (search-string) (insert "@desc ")))
115+ ```
116+
117+ Of course, I would recommend you add it locally so it is language specific
118+ document style. Let's try apply to language ` TypeScript ` only within
119+ ` typescript-mode ` .
120+
121+ ``` el
122+ (defun my-typescript-mode-hook ()
123+ (add-hook 'docstr-before-insert-hook
124+ (lambda (search-string) (insert "@desc "))
125+ nil t))
126+
127+ (add-hook 'typescript-mode-hook #'my-typescript-mode-hook)
128+ ```
104129
105130## Configure Faces
106131
You can’t perform that action at this time.
0 commit comments