emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding packages to enable by default


From: Dmitry Gutov
Subject: Re: Finding packages to enable by default
Date: Wed, 11 Dec 2013 05:50:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>> Indeed, we could definitely make it so the cursor stays put while we
>>> highlight the other end.
>> Good idea.
>
> Patch welcome.

Comments?

=== modified file 'lisp/simple.el'
--- lisp/simple.el      2013-12-03 01:19:24 +0000
+++ lisp/simple.el      2013-12-11 03:40:09 +0000
@@ -6308,8 +6308,15 @@
 START can be nil, if it was not found.
 The function should return non-nil if the two tokens do not match.")
 
+(defvar blink-matching--overlay
+  (let ((ol (make-overlay (point) (point) nil t)))
+    (overlay-put ol 'face 'show-paren-match)
+    (delete-overlay ol)
+    ol)
+  "Overlay used to highlight the matching paren.")
+
 (defun blink-matching-open ()
-  "Move cursor momentarily to the beginning of the sexp before point."
+  "Momentarily highlight the beginning of the sexp before point."
   (interactive)
   (when (and (not (bobp))
             blink-matching-paren)
@@ -6351,13 +6358,18 @@
             (message "No matching parenthesis found"))))
        ((not blinkpos) nil)
        ((pos-visible-in-window-p blinkpos)
-        ;; Matching open within window, temporarily move to blinkpos but only
-        ;; if `blink-matching-paren-on-screen' is non-nil.
+        ;; Matching open within window, temporarily highlight char
+        ;; after blinkpos but only if `blink-matching-paren-on-screen'
+        ;; is non-nil.
         (and blink-matching-paren-on-screen
              (not show-paren-mode)
              (save-excursion
-               (goto-char blinkpos)
-               (sit-for blink-matching-delay))))
+               (move-overlay blink-matching--overlay blinkpos (1+ blinkpos)
+                             (current-buffer))
+               (overlay-put blink-matching--overlay
+                            'priority show-paren-priority)
+               (sit-for blink-matching-delay)
+               (delete-overlay blink-matching--overlay))))
        (t
         (save-excursion
           (goto-char blinkpos)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]