On 2013-01-17 22:58 +0800, Stefan Monnier wrote:
> But this leads to other bugs (try it with a comment like (* foo"bar *)
> for example).
>
> I think the only way to do it right begins by checking whether (1-
> (point)) is within a comment.
Syntax at pos (+ (point) +1/-1) still says not a comment.
How about something like this?
diff --git a/mic-paren.el b/mic-paren.el
index 25b72496..a3c202a4 100644
--- a/mic-paren.el
+++ b/mic-paren.el
@@ -1006,6 +1006,15 @@ (defun mic-paren-highlight ()
right-prio))
(not fcq)))))
+ ;; helper for find-other-paren
+ (comment-edge
+ (m)
+ (let ((pt (point)) res)
+ (save-excursion (when (forward-comment m)
+ (setq res (point))
+ (forward-comment (- m))
+ (and (eq pt (point)) res)))))
+
(find-other-paren
(forwardp)
(let ((mult (if forwardp 1 -1)))
@@ -1022,7 +1031,8 @@ (defun mic-paren-highlight ()
(min lim (point-max))
(point-max)))))
(condition-case ()
- (setq opos (scan-sexps (point) mult))
+ (setq opos (or (comment-edge mult)
+ (scan-sexps (point) mult)))
(error nil))))
;; We must call matching-paren because `scan-sexps' doesn't
;; care about the kind of paren (e.g., matches '( and '}).
_______________________________________________
gnu-emacs-sources mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources