emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115504: Make blink-matching-paren perform blinking


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r115504: Make blink-matching-paren perform blinking without moving the cursor
Date: Fri, 13 Dec 2013 04:14:27 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115504
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Fri 2013-12-13 06:14:17 +0200
message:
  Make blink-matching-paren perform blinking without moving the cursor
  
  * lisp/faces.el (paren-showing-faces, show-paren-match)
  (show-paren-mismatch): Move from paren.el.
  
  * lisp/simple.el (blink-matching--overlay): New variable.
  (blink-matching-open): Instead of moving point, highlight the
  matching paren with an overlay
  (http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00333.html).
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/faces.el                  faces.el-20091113204419-o5vbwnq5f7feedwu-562
  lisp/paren.el                  paren.el-20091113204419-o5vbwnq5f7feedwu-601
  lisp/simple.el                 simple.el-20091113204419-o5vbwnq5f7feedwu-403
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-13 01:54:09 +0000
+++ b/lisp/ChangeLog    2013-12-13 04:14:17 +0000
@@ -1,3 +1,13 @@
+2013-12-13  Dmitry Gutov  <address@hidden>
+
+       * simple.el (blink-matching--overlay): New variable.
+       (blink-matching-open): Instead of moving point, highlight the
+       matching paren with an overlay
+       (http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00333.html).
+
+       * faces.el (paren-showing-faces, show-paren-match)
+       (show-paren-mismatch): Move from paren.el.
+
 2013-12-13  Leo Liu  <address@hidden>
 
        * indent.el (indent-region): Disable progress reporter in

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2013-11-08 17:26:03 +0000
+++ b/lisp/faces.el     2013-12-13 04:14:17 +0000
@@ -2573,6 +2573,30 @@
   "Face for displaying the currently selected item in TTY menus."
   :group 'basic-faces)
 
+(defgroup paren-showing-faces nil
+  "Faces used to highlight paren matches."
+  :group 'paren-showing
+  :group 'faces
+  :version "22.1")
+
+(defface show-paren-match
+  '((((class color) (background light))
+     :background "turquoise")          ; looks OK on tty (becomes cyan)
+    (((class color) (background dark))
+     :background "steelblue3")         ; looks OK on tty (becomes blue)
+    (((background dark))
+     :background "grey50")
+    (t
+     :background "gray"))
+  "Face used for a matching paren."
+  :group 'paren-showing-faces)
+
+(defface show-paren-mismatch
+  '((((class color)) (:foreground "white" :background "purple"))
+    (t (:inverse-video t)))
+  "Face used for a mismatching paren."
+  :group 'paren-showing-faces)
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Manipulating font names.

=== modified file 'lisp/paren.el'
--- a/lisp/paren.el     2013-05-30 15:44:54 +0000
+++ b/lisp/paren.el     2013-12-13 04:14:17 +0000
@@ -72,30 +72,8 @@
   :group 'paren-showing
   :version "20.3")
 
-(defgroup paren-showing-faces nil
-  "Group for faces of Show Paren mode."
-  :group 'paren-showing
-  :group 'faces
-  :version "22.1")
-
-(defface show-paren-match
-  '((((class color) (background light))
-     :background "turquoise")          ; looks OK on tty (becomes cyan)
-    (((class color) (background dark))
-     :background "steelblue3")         ; looks OK on tty (becomes blue)
-    (((background dark))
-     :background "grey50")
-    (t
-     :background "gray"))
-  "Show Paren mode face used for a matching paren."
-  :group 'paren-showing-faces)
 (define-obsolete-face-alias 'show-paren-match-face 'show-paren-match "22.1")
 
-(defface show-paren-mismatch
-  '((((class color)) (:foreground "white" :background "purple"))
-    (t (:inverse-video t)))
-  "Show Paren mode face used for a mismatching paren."
-  :group 'paren-showing-faces)
 (define-obsolete-face-alias 'show-paren-mismatch-face
   'show-paren-mismatch "22.1")
 

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2013-12-13 01:03:04 +0000
+++ b/lisp/simple.el    2013-12-13 04:14:17 +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,17 @@
             (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))))
+             (unwind-protect
+                 (progn
+                   (move-overlay blink-matching--overlay blinkpos (1+ blinkpos)
+                                 (current-buffer))
+                   (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]