Skip to content

Commit 365b121

Browse files
committed
Enure all module load
1 parent c5dadc8 commit 365b121

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

docstr.el

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,35 @@ variable. Argument DESC is the description of VAR."
156156
new (s-replace docstr-key-desc desc new))
157157
new))
158158

159+
;;
160+
;; (@* "Modules" )
161+
;;
162+
163+
(defvar docstr-support-langs
164+
(append '(actionscript)
165+
'(c c++ csharp)
166+
'(go groovy)
167+
'(java js)
168+
'(lua)
169+
'(objc)
170+
'(php python)
171+
'(ruby rust)
172+
'(scala swift)
173+
'(typescript))
174+
"List of supported languages.")
175+
176+
(defun docstr-load (name)
177+
"Load docstr module by NAME."
178+
(let ((mode-name (intern (format "docstr-%s" name))))
179+
(require mode-name)))
180+
181+
(defun docstr-load-all ()
182+
"Load all supported language modules.
183+
184+
Please do not call this at the start up; this will slow down user's
185+
configuration."
186+
(dolist (name docstr-support-langs) (docstr-load name)))
187+
159188
;;
160189
;; (@* "Entry" )
161190
;;
@@ -187,6 +216,7 @@ You should customize this variable to add your own triggeration methods."
187216

188217
(defun docstr--enable ()
189218
"Enable `docstr' in current buffer."
219+
(docstr-load-all)
190220
(docstr-key-enable) ; Be infront, in order to take effect
191221
(docstr-util-key-advice-add "RET" :after #'docstr--trigger-return)
192222
(docstr--enable-trigger t)
@@ -214,35 +244,6 @@ You should customize this variable to add your own triggeration methods."
214244
docstr-mode docstr--turn-on-docstr-mode
215245
:require 'docstr)
216246

217-
;;
218-
;; (@* "Modules" )
219-
;;
220-
221-
(defvar docstr-support-langs
222-
(append '(actionscript)
223-
'(c c++ csharp)
224-
'(go groovy)
225-
'(java js)
226-
'(lua)
227-
'(objc)
228-
'(php python)
229-
'(ruby rust)
230-
'(scala swift)
231-
'(typescript))
232-
"List of supported languages.")
233-
234-
(defun docstr-load (name)
235-
"Load docstr module by NAME."
236-
(let ((mode-name (intern (format "docstr-%s" name))))
237-
(require mode-name)))
238-
239-
(defun docstr-load-all ()
240-
"Load all supported language modules.
241-
242-
Please do not call this at the start up; this will slow down user's
243-
configuration."
244-
(dolist (name docstr-support-langs) (docstr-load name)))
245-
246247
;;
247248
;; (@* "Core" )
248249
;;
@@ -358,7 +359,6 @@ See function `docstr--get-search-string' description for argument TYPE."
358359

359360
(defun docstr-get-prefix ()
360361
"Return prefix from the corresponding mode."
361-
(docstr-load-all)
362362
(let* ((prefix-cons (assoc major-mode docstr-prefix-alist))
363363
(prefix (cdr prefix-cons)))
364364
(cond ((functionp prefix) (funcall prefix))

0 commit comments

Comments
 (0)