emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 345284f: Allow blink-matching-paren to jump off scr


From: Dmitry Gutov
Subject: [Emacs-diffs] master 345284f: Allow blink-matching-paren to jump off screen
Date: Tue, 18 Aug 2015 20:32:07 +0000

branch: master
commit 345284f5e9eebb07536d12c08c72f1bab02ea55e
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Allow blink-matching-paren to jump off screen
    
    * doc/emacs/programs.texi (Matching): Mention the
    `blink-matching-paren' value `jump-offscreen'.
    
    * lisp/simple.el (blink-matching-paren): New possible value.
    (blink-matching-paren-on-screen): Clarify the docstring.
    (blink-matching-open): Handle `jump-offscreen' (bug#21286).
---
 doc/emacs/programs.texi |    3 ++-
 lisp/simple.el          |   17 ++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 2eb999d..8f78a1a 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -814,7 +814,8 @@ opening delimiter and closing delimiter are 
mismatched---such as in
 @code{blink-matching-paren} turns the feature on or off: @code{nil}
 disables it, but the default is @code{t} to enable it.  Set it to
 @code{jump} to make indication work by momentarily moving the cursor
-to the matching opening delimiter.
+to the matching opening delimiter.  Set it to @code{jump-offscreen} to
+make the cursor jump, even if the opening delimiter is off screen.
 
 @item
 @code{blink-matching-delay} says how many seconds to keep indicating
diff --git a/lisp/simple.el b/lisp/simple.el
index 0d691ea..ea43975 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6873,17 +6873,22 @@ If called from Lisp, enable the mode if ARG is omitted 
or nil."
 
 (defcustom blink-matching-paren t
   "Non-nil means show matching open-paren when close-paren is inserted.
-If t, highlight the paren.  If `jump', move cursor to its position."
+If t, highlight the paren.  If `jump', briefly move cursor to its
+position.  If `jump-offscreen', move cursor there even if the
+position is off screen.  With any other non-nil value, the
+off-screen position of the opening paren will be shown in the
+echo area."
   :type '(choice
           (const :tag "Disable" nil)
           (const :tag "Highlight" t)
-          (const :tag "Move cursor" jump))
+          (const :tag "Move cursor" jump)
+          (const :tag "Move cursor, even if off screen" jump-offscreen))
   :group 'paren-blinking)
 
 (defcustom blink-matching-paren-on-screen t
   "Non-nil means show matching open-paren when it is on screen.
 If nil, don't show it (but the open-paren can still be shown
-when it is off screen).
+in the echo area when it is off screen).
 
 This variable has no effect if `blink-matching-paren' is nil.
 \(In that case, the open-paren is never shown.)
@@ -6987,13 +6992,15 @@ The function should return non-nil if the two tokens do 
not match.")
               (minibuffer-message "No matching parenthesis found")
             (message "No matching parenthesis found"))))
        ((not blinkpos) nil)
-       ((pos-visible-in-window-p blinkpos)
+       ((or
+         (eq blink-matching-paren 'jump-offscreen)
+         (pos-visible-in-window-p blinkpos))
         ;; Matching open within window, temporarily move to or 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)
-             (if (eq blink-matching-paren 'jump)
+             (if (memq blink-matching-paren '(jump jump-offscreen))
                  (save-excursion
                    (goto-char blinkpos)
                    (sit-for blink-matching-delay))



reply via email to

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