diff options
| author | Stefan Monnier | 2013-12-19 09:00:55 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-12-19 09:00:55 -0500 |
| commit | 2230a6e314980bd497fb9bbb3f235b2c5d82b786 (patch) | |
| tree | 97145b3e1a83eead07b2bc80bf0fbb81e2f6a33c | |
| parent | 1269a680862a9bc6cd65e3d26ef05f68c7521632 (diff) | |
| download | emacs-2230a6e314980bd497fb9bbb3f235b2c5d82b786.tar.gz emacs-2230a6e314980bd497fb9bbb3f235b2c5d82b786.zip | |
* lisp/hl-line.el (hl-line-make-overlay): New fun. Set priority.
(hl-line-highlight, global-hl-line-highlight): Use it.
(hl-line-overlay): Use defvar-local.
Fixes: debbugs:16192
| -rw-r--r-- | lisp/ChangeLog | 22 | ||||
| -rw-r--r-- | lisp/hl-line.el | 17 |
2 files changed, 24 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 336a7caa8ed..127ed1f2987 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,12 +1,18 @@ | |||
| 1 | 2013-12-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * hl-line.el (hl-line-make-overlay): New fun. Set priority (bug#16192). | ||
| 4 | (hl-line-highlight, global-hl-line-highlight): Use it. | ||
| 5 | (hl-line-overlay): Use defvar-local. | ||
| 6 | |||
| 1 | 2013-12-19 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2013-12-19 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * term/ns-win.el: Require dnd. | 9 | * term/ns-win.el: Require dnd. |
| 4 | (global-map): Remove drag items. | 10 | (global-map): Remove drag items. |
| 5 | (ns-insert-text, ns-set-foreground-at-mouse) | 11 | (ns-insert-text, ns-set-foreground-at-mouse) |
| 6 | (ns-set-background-at-mouse): Remove | 12 | (ns-set-background-at-mouse): |
| 7 | (ns-drag-n-drop, ns-drag-n-drop-other-frame) | 13 | Remove (ns-drag-n-drop, ns-drag-n-drop-other-frame) |
| 8 | (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): New | 14 | (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): |
| 9 | functions. | 15 | New functions. |
| 10 | 16 | ||
| 11 | 2013-12-19 Glenn Morris <rgm@gnu.org> | 17 | 2013-12-19 Glenn Morris <rgm@gnu.org> |
| 12 | 18 | ||
| @@ -79,8 +85,8 @@ | |||
| 79 | 85 | ||
| 80 | 2013-12-18 Tassilo Horn <tsdh@gnu.org> | 86 | 2013-12-18 Tassilo Horn <tsdh@gnu.org> |
| 81 | 87 | ||
| 82 | * textmodes/reftex-vars.el (reftex-label-alist-builtin): Reference | 88 | * textmodes/reftex-vars.el (reftex-label-alist-builtin): |
| 83 | tables with ~\ref{...} instead of only \ref{...}. | 89 | Reference tables with ~\ref{...} instead of only \ref{...}. |
| 84 | 90 | ||
| 85 | 2013-12-18 Chong Yidong <cyd@gnu.org> | 91 | 2013-12-18 Chong Yidong <cyd@gnu.org> |
| 86 | 92 | ||
| @@ -113,8 +119,8 @@ | |||
| 113 | 119 | ||
| 114 | 2013-12-18 Le Wang <l26wang@gmail.com> | 120 | 2013-12-18 Le Wang <l26wang@gmail.com> |
| 115 | 121 | ||
| 116 | * comint.el (comint-previous-matching-input-from-input): Retain | 122 | * comint.el (comint-previous-matching-input-from-input): |
| 117 | point (Bug#13404). | 123 | Retain point (Bug#13404). |
| 118 | 124 | ||
| 119 | 2013-12-18 Chong Yidong <cyd@gnu.org> | 125 | 2013-12-18 Chong Yidong <cyd@gnu.org> |
| 120 | 126 | ||
diff --git a/lisp/hl-line.el b/lisp/hl-line.el index e2171a27f5c..728f505d531 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; hl-line.el --- highlight the current line | 1 | ;;; hl-line.el --- highlight the current line -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -61,9 +61,8 @@ | |||
| 61 | 61 | ||
| 62 | ;;; Code: | 62 | ;;; Code: |
| 63 | 63 | ||
| 64 | (defvar hl-line-overlay nil | 64 | (defvar-local hl-line-overlay nil |
| 65 | "Overlay used by Hl-Line mode to highlight the current line.") | 65 | "Overlay used by Hl-Line mode to highlight the current line.") |
| 66 | (make-variable-buffer-local 'hl-line-overlay) | ||
| 67 | 66 | ||
| 68 | (defvar global-hl-line-overlay nil | 67 | (defvar global-hl-line-overlay nil |
| 69 | "Overlay used by Global-Hl-Line mode to highlight the current line.") | 68 | "Overlay used by Global-Hl-Line mode to highlight the current line.") |
| @@ -155,13 +154,18 @@ addition to `hl-line-highlight' on `post-command-hook'." | |||
| 155 | (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) | 154 | (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) |
| 156 | (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) | 155 | (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) |
| 157 | 156 | ||
| 157 | (defun hl-line-make-overlay () | ||
| 158 | (let ((ol (make-overlay (point) (point)))) | ||
| 159 | (overlay-put ol 'priority -50) ;(bug#16192) | ||
| 160 | (overlay-put ol 'face hl-line-face) | ||
| 161 | ol)) | ||
| 162 | |||
| 158 | (defun hl-line-highlight () | 163 | (defun hl-line-highlight () |
| 159 | "Activate the Hl-Line overlay on the current line." | 164 | "Activate the Hl-Line overlay on the current line." |
| 160 | (if hl-line-mode ; Might be changed outside the mode function. | 165 | (if hl-line-mode ; Might be changed outside the mode function. |
| 161 | (progn | 166 | (progn |
| 162 | (unless hl-line-overlay | 167 | (unless hl-line-overlay |
| 163 | (setq hl-line-overlay (make-overlay 1 1)) ; to be moved | 168 | (setq hl-line-overlay (hl-line-make-overlay))) ; To be moved. |
| 164 | (overlay-put hl-line-overlay 'face hl-line-face)) | ||
| 165 | (overlay-put hl-line-overlay | 169 | (overlay-put hl-line-overlay |
| 166 | 'window (unless hl-line-sticky-flag (selected-window))) | 170 | 'window (unless hl-line-sticky-flag (selected-window))) |
| 167 | (hl-line-move hl-line-overlay)) | 171 | (hl-line-move hl-line-overlay)) |
| @@ -200,8 +204,7 @@ Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and | |||
| 200 | (when global-hl-line-mode ; Might be changed outside the mode function. | 204 | (when global-hl-line-mode ; Might be changed outside the mode function. |
| 201 | (unless (window-minibuffer-p) | 205 | (unless (window-minibuffer-p) |
| 202 | (unless global-hl-line-overlay | 206 | (unless global-hl-line-overlay |
| 203 | (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved | 207 | (setq global-hl-line-overlay (hl-line-make-overlay))) ; To be moved. |
| 204 | (overlay-put global-hl-line-overlay 'face hl-line-face)) | ||
| 205 | (overlay-put global-hl-line-overlay 'window | 208 | (overlay-put global-hl-line-overlay 'window |
| 206 | (unless global-hl-line-sticky-flag | 209 | (unless global-hl-line-sticky-flag |
| 207 | (selected-window))) | 210 | (selected-window))) |