Commit 84c73ba0 authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

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).
parent 11dde529
2013-12-13 Dmitry Gutov <dgutov@yandex.ru>
* 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 <sdl.web@gmail.com>
* indent.el (indent-region): Disable progress reporter in
......
......@@ -2573,6 +2573,30 @@ It is used for characters of no fonts too."
"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.
......
......@@ -72,30 +72,8 @@ active, you must toggle the mode off and on again for this to take effect."
: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")
......
......@@ -6308,8 +6308,15 @@ position just before the opening token and END is the position right after.
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 @@ The function should return non-nil if the two tokens do not match.")
(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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment