@@ -180,29 +180,40 @@ and GREEDY."
180180
181181(defun docstr-util-start-comment-symbol (&optional pt )
182182 " Return the starting comment symbol form the given PT."
183- (let (start-pt)
184- (save-excursion
185- (when pt (goto-char pt))
186- (docstr-util--goto-start-comment)
187- (setq start-pt (point ))
188- (re-search-forward " [ \t\r\n ]" (1+ (line-end-position )) t )
189- (if (= start-pt (point )) nil
190- (string-trim (buffer-substring start-pt (point )))))))
183+ (when (docstr-util-comment-block-p)
184+ (let (start-pt)
185+ (save-excursion
186+ (when pt (goto-char pt))
187+ (docstr-util--goto-start-comment)
188+ (progn ; Make sure to go outside of symbol
189+ (re-search-backward " [ \t\r\n ]" nil t )
190+ (forward-char 1 ))
191+ (setq start-pt (point ))
192+ (re-search-forward " [ \t\r\n ]" (1+ (line-end-position )) t )
193+ (if (= start-pt (point )) nil
194+ (string-trim (buffer-substring start-pt (point ))))))))
191195
192196(defun docstr-util-end-comment-symbol (&optional pt )
193197 " Return the ending comment symbol form the given PT."
194- (let (end-pt)
195- (save-excursion
196- (when pt (goto-char pt))
197- (docstr-util--goto-end-comment)
198- (setq end-pt (point ))
199- (re-search-backward " [ \t\r\n ]" (1- (line-beginning-position )) t )
200- (if (= end-pt (point )) nil
201- (string-trim (buffer-substring (point ) end-pt))))))
198+ (when (docstr-util-comment-block-p)
199+ (let (end-pt)
200+ (save-excursion
201+ (when pt (goto-char pt))
202+ (docstr-util--goto-end-comment)
203+ (setq end-pt (point ))
204+ (re-search-backward " [ \t\r\n ]" (1- (line-beginning-position )) t )
205+ (if (= end-pt (point )) nil
206+ (string-trim (buffer-substring (point ) end-pt)))))))
202207
203208(defun docstr-util-multiline-comment-p ()
204209 " Return non-nil, if current point inside multi-line comment block."
205- (string-match-p " /[*]" (docstr-util-start-comment-symbol)))
210+ (ignore-errors (string-match-p " /[*]" (docstr-util-start-comment-symbol))))
211+
212+ (defun docstr-util-comment-line-symbol (&optional n )
213+ " Forward N line and return starting comment symbol."
214+ (save-excursion
215+ (when n (forward-line n)) (end-of-line )
216+ (docstr-util-start-comment-symbol)))
206217
207218; ;
208219; ; (@* "Key" )
0 commit comments