summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2008-10-25 19:44:06 +0000
committerTaylor R Campbell <campbell@mumble.net>2008-10-25 19:44:06 +0000
commit8ab1694f0f85914347e1c7873291bcc03adbb4e1 (patch)
tree926c8d735acd151a226e21dbb6692c0e53f93597 /paredit.el
parent2f3db5fb243c4c13b4340f21714ec2865ec7feb0 (diff)
Change `paredit-comment-on-line-p' to use `comment-search-forward'.
Since this requires the comment support to be initialized, use `funcall' on a symbol and document that `paredit-comment-on-line-p' may be called only from `paredit-comment-dwim'. darcs-hash:20081025194406-00fcc-5427d02b5bb86a84aa5b3fcf7448b782d321e529
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/paredit.el b/paredit.el
index 63a19d3..28c6b7b 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1039,18 +1039,20 @@ At the top level, where indentation is calculated to be at column 0,
(comment-normalize-vars))
(defun paredit-comment-on-line-p ()
+ "True if there is a comment on the line following point.
+This is expected to be called only in `paredit-comment-dwim'; do not
+ call it elsewhere."
(save-excursion
(beginning-of-line)
(let ((comment-p nil))
;; Search forward for a comment beginning. If there is one, set
;; COMMENT-P to true; if not, it will be nil.
- (while (progn (setq comment-p
- (search-forward ";" (point-at-eol)
- ;; t -> no error
- t))
- (and comment-p
- (or (paredit-in-string-p)
- (paredit-in-char-p (1- (point))))))
+ (while (progn
+ (setq comment-p ;t -> no error
+ (funcall 'comment-search-forward (point-at-eol) t))
+ (and comment-p
+ (or (paredit-in-string-p)
+ (paredit-in-char-p (1- (point))))))
(forward-char))
comment-p)))