diff options
| author | Dmitry Gutov | 2015-08-18 23:31:52 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-08-18 23:31:52 +0300 |
| commit | 345284f5e9eebb07536d12c08c72f1bab02ea55e (patch) | |
| tree | 9838de6a8d6e6512f6d12711a2a9a3fc81ed8c74 | |
| parent | 9c1e7d5a2666cdf63abcc6623a8489d7bd47fe22 (diff) | |
| download | emacs-345284f5e9eebb07536d12c08c72f1bab02ea55e.tar.gz emacs-345284f5e9eebb07536d12c08c72f1bab02ea55e.zip | |
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).
| -rw-r--r-- | doc/emacs/programs.texi | 3 | ||||
| -rw-r--r-- | lisp/simple.el | 17 |
2 files changed, 14 insertions, 6 deletions
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 2eb999d2c28..8f78a1a54b6 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 | |||
| 814 | @code{blink-matching-paren} turns the feature on or off: @code{nil} | 814 | @code{blink-matching-paren} turns the feature on or off: @code{nil} |
| 815 | disables it, but the default is @code{t} to enable it. Set it to | 815 | disables it, but the default is @code{t} to enable it. Set it to |
| 816 | @code{jump} to make indication work by momentarily moving the cursor | 816 | @code{jump} to make indication work by momentarily moving the cursor |
| 817 | to the matching opening delimiter. | 817 | to the matching opening delimiter. Set it to @code{jump-offscreen} to |
| 818 | make the cursor jump, even if the opening delimiter is off screen. | ||
| 818 | 819 | ||
| 819 | @item | 820 | @item |
| 820 | @code{blink-matching-delay} says how many seconds to keep indicating | 821 | @code{blink-matching-delay} says how many seconds to keep indicating |
diff --git a/lisp/simple.el b/lisp/simple.el index 0d691eabdf2..ea439757858 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." | |||
| 6873 | 6873 | ||
| 6874 | (defcustom blink-matching-paren t | 6874 | (defcustom blink-matching-paren t |
| 6875 | "Non-nil means show matching open-paren when close-paren is inserted. | 6875 | "Non-nil means show matching open-paren when close-paren is inserted. |
| 6876 | If t, highlight the paren. If `jump', move cursor to its position." | 6876 | If t, highlight the paren. If `jump', briefly move cursor to its |
| 6877 | position. If `jump-offscreen', move cursor there even if the | ||
| 6878 | position is off screen. With any other non-nil value, the | ||
| 6879 | off-screen position of the opening paren will be shown in the | ||
| 6880 | echo area." | ||
| 6877 | :type '(choice | 6881 | :type '(choice |
| 6878 | (const :tag "Disable" nil) | 6882 | (const :tag "Disable" nil) |
| 6879 | (const :tag "Highlight" t) | 6883 | (const :tag "Highlight" t) |
| 6880 | (const :tag "Move cursor" jump)) | 6884 | (const :tag "Move cursor" jump) |
| 6885 | (const :tag "Move cursor, even if off screen" jump-offscreen)) | ||
| 6881 | :group 'paren-blinking) | 6886 | :group 'paren-blinking) |
| 6882 | 6887 | ||
| 6883 | (defcustom blink-matching-paren-on-screen t | 6888 | (defcustom blink-matching-paren-on-screen t |
| 6884 | "Non-nil means show matching open-paren when it is on screen. | 6889 | "Non-nil means show matching open-paren when it is on screen. |
| 6885 | If nil, don't show it (but the open-paren can still be shown | 6890 | If nil, don't show it (but the open-paren can still be shown |
| 6886 | when it is off screen). | 6891 | in the echo area when it is off screen). |
| 6887 | 6892 | ||
| 6888 | This variable has no effect if `blink-matching-paren' is nil. | 6893 | This variable has no effect if `blink-matching-paren' is nil. |
| 6889 | \(In that case, the open-paren is never shown.) | 6894 | \(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.") | |||
| 6987 | (minibuffer-message "No matching parenthesis found") | 6992 | (minibuffer-message "No matching parenthesis found") |
| 6988 | (message "No matching parenthesis found")))) | 6993 | (message "No matching parenthesis found")))) |
| 6989 | ((not blinkpos) nil) | 6994 | ((not blinkpos) nil) |
| 6990 | ((pos-visible-in-window-p blinkpos) | 6995 | ((or |
| 6996 | (eq blink-matching-paren 'jump-offscreen) | ||
| 6997 | (pos-visible-in-window-p blinkpos)) | ||
| 6991 | ;; Matching open within window, temporarily move to or highlight | 6998 | ;; Matching open within window, temporarily move to or highlight |
| 6992 | ;; char after blinkpos but only if `blink-matching-paren-on-screen' | 6999 | ;; char after blinkpos but only if `blink-matching-paren-on-screen' |
| 6993 | ;; is non-nil. | 7000 | ;; is non-nil. |
| 6994 | (and blink-matching-paren-on-screen | 7001 | (and blink-matching-paren-on-screen |
| 6995 | (not show-paren-mode) | 7002 | (not show-paren-mode) |
| 6996 | (if (eq blink-matching-paren 'jump) | 7003 | (if (memq blink-matching-paren '(jump jump-offscreen)) |
| 6997 | (save-excursion | 7004 | (save-excursion |
| 6998 | (goto-char blinkpos) | 7005 | (goto-char blinkpos) |
| 6999 | (sit-for blink-matching-delay)) | 7006 | (sit-for blink-matching-delay)) |