Skip to content

Commit 4ada90e

Browse files
committed
Add comment block.
1 parent d2c63a1 commit 4ada90e

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docstr-util.el

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ See function `forward-line' for argument N."
4848
(when run-it (setq pos run-it)))
4949
(if (= pos -1) nil pos)))
5050

51+
(defun docstr-util-comment-block-p (&optional pos)
52+
"Return non-nil if POS is inside a comment block."
53+
(unless pos (setq pos (point)))
54+
(save-excursion (goto-char pos) (nth 4 (syntax-ppss))))
55+
56+
;;
57+
;; (@* "List" )
58+
;;
59+
5160
(defun docstr-util-chop (string separator)
5261
"Split a STRING without consuming a SEPARATOR."
5362
(cl-loop with seplen = (length separator)
@@ -62,7 +71,24 @@ See function `forward-line' for argument N."
6271

6372
(defun docstr-util-is-contain-list-string (in-list in-str)
6473
"Check if IN-STR contain in any string in the IN-LIST."
65-
(cl-some (lambda (lb-sub-str) (string-match-p (regexp-quote lb-sub-str) in-str)) in-list))
74+
(cl-some (lambda (str) (string-match-p (regexp-quote str) in-str)) in-list))
75+
76+
;;
77+
;; (@* "Character" )
78+
;;
79+
80+
(defun docstr-util--get-current-char-string ()
81+
"Get the current character as the 'string'."
82+
(if (char-before) (string (char-before)) ""))
83+
84+
(defun docstr-util-current-char-equal-p (c)
85+
"Check the current character equal to C, C can be a list of character."
86+
(cond ((and (stringp c)
87+
(stringp (docstr-util--get-current-char-string)))
88+
(string= (docstr-util--get-current-char-string) c))
89+
((listp c)
90+
(docstr-util-is-contain-list-string c (docstr-util--get-current-char-string)))
91+
(t nil)))
6692

6793
(provide 'docstr-util)
6894
;;; docstr-util.el ends here

0 commit comments

Comments
 (0)