Mercurial > emacs
annotate lisp/hl-line.el @ 52698:367c1b29dbee
(gdb-var-list, gdb-var-changed, gdb-update-flag)
(gdb-update-flag): New variables.
(gdb-var-update, gdb-var-update-handler,gdb-var-delete)
(gdb-speedbar-expand-node, gdb-var-evaluate-expression-handler)
(gud-watch, gdb-var-create-handler) : New functions.
(gdb-var-list-children, gdb-var-list-children-handler)
(gdb-var-create-regexp, gdb-var-update-regexp)
(gdb-var-list-children-regexp): New constants.
(gud-gdba-command-name): Don't specify -noasync so that GDB/MI
works.
(gdb-annotation-rules): Reduced annotation set (level 3).
(gdb-pre-prompt, gdb-prompt): Call handler in gdb-prompt.
(gdb-post-prompt): Don't update GDB buffers every time speedbar
updates.
(gdb-window-height, gdb-window-width, gdb-display-in-progress)
(gdb-expression-buffer-name, gdb-display-number, gdb-point)
(gdb-dive-display-number, gdb-nesting-level, gdb-expression)
(gdb-annotation-arg, gdb-dive-map, gdb-values, gdb-array-start)
(gdb-array-stop, gdb-array-slice-map, gdb-display-string)
(gdb-array-size, gdb-display-mode-map, gdb-expressions-mode-map):
(gdb-expressions-mode-menu, gdb-dive): Remove variables.
(gud-display, gud-display1)
(gdb-display-begin,gdb-display-number-end, gdb-delete-line)
(gdb-display-end, gdb-display-go-back, gdb-array-section-end)
(gdb-field-begin, gdb-field-end, gdb-elt,gdb-field-format-begin)
(gdb-field-format-end, gdb-dive, gdb-dive-new-frame)
(gdb-insert-field, gdb-array-format, gdb-mouse-array-slice)
(gdb-array-slice, gdb-array-format1, gdb-info-display-custom)
(gdb-delete-frames, gdb-display-mode, gdb-display-buffer-name)
(gdb-display-display-buffer, gdb-toggle-display)
(gdb-delete-display, gdb-expressions-popup-menu)
(gdb-expressions-mode, gdb-array-visualise): Remove functions.
(gdb-setup-windows, gdb-reset, gdb-source-info): Remove references
to display buffer.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Tue, 30 Sep 2003 17:56:24 +0000 |
parents | 3570fa254081 |
children | 575eb554f88e |
rev | line source |
---|---|
24961 | 1 ;;; hl-line.el --- highlight the current line |
2 | |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
3 ;; Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc. |
24961 | 4 |
5 ;; Author: Dave Love <fx@gnu.org> | |
6 ;; Created: 1998-09-13 | |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
7 ;; Keywords: faces, frames, emulation |
24961 | 8 |
29087 | 9 ;; This file is part of GNU Emacs. |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
24961 | 12 ;; it under the terms of the GNU General Public License as published by |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
29087 | 16 ;; GNU Emacs is distributed in the hope that it will be useful, |
24961 | 17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
52496
3570fa254081
Documentation (comments-only) fix.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
28 ;; Provides a local minor mode (toggled by M-x hl-line-mode) and |
3570fa254081
Documentation (comments-only) fix.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
29 ;; a global minor mode (toggled by M-x global-hl-line-mode) to |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
30 ;; highlight, on a suitable terminal, the line on which point is. The |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
31 ;; global mode highlights the current line in the selected window only |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
32 ;; (except when the minibuffer window is selected). This was |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
33 ;; implemented to satisfy a request for a feature of Lesser Editors. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
34 ;; The local mode is sticky: it highlights the line about the buffer's |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
35 ;; point even if the buffer's window is not selected. Caveat: the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
36 ;; buffer's point might be different from the point of a non-selected |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
37 ;; window. Set the variable `hl-line-sticky-flag' to nil to make the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
38 ;; local mode behave like the global mode. |
24961 | 39 |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
40 ;; You probably don't really want to use the global mode; if the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
41 ;; cursor is difficult to spot, try changing its colour, relying on |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
42 ;; `blink-cursor-mode' or both. The hookery used might affect |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
43 ;; response noticeably on a slow machine. The local mode may be |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
44 ;; useful in non-editing buffers such as Gnus or PCL-CVS though. |
24961 | 45 |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
46 ;; An overlay is used. In the non-sticky cases, this overlay is |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
47 ;; active only on the selected window. A hook is added to |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
48 ;; `post-command-hook' to activate the overlay and move it to the line |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
49 ;; about point. To get the non-sticky behavior, `hl-line-unhighlight' |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
50 ;; is added to `pre-command-hook' as well. This function deactivates |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
51 ;; the overlay unconditionally in case the command changes the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
52 ;; selected window. (It does so rather than keeping track of changes |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
53 ;; in the selected window). |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
54 |
24961 | 55 ;;; Code: |
56 | |
57 (defgroup hl-line nil | |
35031 | 58 "Highlight the current line." |
25174 | 59 :version "21.1" |
24961 | 60 :group 'editing) |
61 | |
62 (defcustom hl-line-face 'highlight | |
63 "Face with which to highlight the current line." | |
64 :type 'face | |
65 :group 'hl-line) | |
66 | |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
67 (defcustom hl-line-sticky-flag t |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
68 "*Non-nil means highlight the current line in all windows. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
69 Otherwise Hl-Line mode will highlight only in the selected |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
70 window. Setting this variable takes effect the next time you use |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
71 the command `hl-line-mode' to turn Hl-Line mode on." |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
72 :type 'boolean |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
73 :version "21.4" |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
74 :group 'hl-line) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
75 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
76 (defvar hl-line-overlay nil |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
77 "Overlay used by Hl-Line mode to highlight the current line.") |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
78 (make-variable-buffer-local 'hl-line-overlay) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
79 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
80 (defvar global-hl-line-overlay nil |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
81 "Overlay used by Global-Hl-Line mode to highlight the current line.") |
24961 | 82 |
25051
64e3159f0c7b
(hl-line-mode): Add autload cookies.
Dave Love <fx@gnu.org>
parents:
24961
diff
changeset
|
83 ;;;###autoload |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
84 (define-minor-mode hl-line-mode |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
85 "Buffer-local minor mode to highlight the line about point. |
24961 | 86 With ARG, turn Hl-Line mode on if ARG is positive, off otherwise. |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
87 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
88 If `hl-line-sticky-flag' is non-nil, Hl-Line mode highlights the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
89 line about the buffer's point in all windows. Caveat: the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
90 buffer's point might be different from the point of a |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
91 non-selected window. Hl-Line mode uses the function |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
92 `hl-line-highlight' on `post-command-hook' in this case. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
93 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
94 When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
95 line about point in the selected window only. In this case, it |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
96 uses the function `hl-line-unhighlight' on `pre-command-hook' in |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
97 addition to `hl-line-highlight' on `post-command-hook'." |
38955
9bdcb656d1cf
(hl-line-mode): Add args INIT-VALUE, LIGHTER, and
Gerd Moellmann <gerd@gnu.org>
parents:
38937
diff
changeset
|
98 nil nil nil |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
99 (if hl-line-mode |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
100 (progn |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
101 ;; In case `kill-all-local-variables' is called. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
102 (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
103 (if hl-line-sticky-flag |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
104 (remove-hook 'pre-command-hook #'hl-line-unhighlight t) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
105 (add-hook 'pre-command-hook #'hl-line-unhighlight nil t)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
106 (hl-line-highlight) |
50847
47453bc2423e
Removed an erroneous comment.
Lute Kamstra <lute@gnu.org>
parents:
44172
diff
changeset
|
107 (add-hook 'post-command-hook #'hl-line-highlight nil t)) |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
108 (remove-hook 'post-command-hook #'hl-line-highlight t) |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
109 (hl-line-unhighlight) |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
110 (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
111 (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) |
38937
ff93d7955c3d
(hl-line-mode): Don't be a global mode.
Gerd Moellmann <gerd@gnu.org>
parents:
35031
diff
changeset
|
112 |
43031
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
113 (defun hl-line-highlight () |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
114 "Active the Hl-Line overlay on the current line." |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
115 (if hl-line-mode ; Might be changed outside the mode function. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
116 (progn |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
117 (unless hl-line-overlay |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
118 (setq hl-line-overlay (make-overlay 1 1)) ; to be moved |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
119 (overlay-put hl-line-overlay 'face hl-line-face)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
120 (overlay-put hl-line-overlay |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
121 'window (unless hl-line-sticky-flag (selected-window))) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
122 (move-overlay hl-line-overlay |
51018
5edeb93ad9c0
(hl-line-highlight, global-hl-line-highlight): Use
Lute Kamstra <lute@gnu.org>
parents:
51010
diff
changeset
|
123 (line-beginning-position) (line-beginning-position 2))) |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
124 (hl-line-unhighlight))) |
43031
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
125 |
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
126 (defun hl-line-unhighlight () |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
127 "Deactivate the Hl-Line overlay on the current line." |
43031
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
128 (if hl-line-overlay |
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
129 (delete-overlay hl-line-overlay))) |
46823e7a2cae
(hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents:
42842
diff
changeset
|
130 |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
131 ;;;###autoload |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
132 (define-minor-mode global-hl-line-mode |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
133 "Global minor mode to highlight the line about point in the current window. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
134 With ARG, turn Global-Hl-Line mode on if ARG is positive, off otherwise. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
135 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
136 Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
137 `global-hl-line-highlight' on `pre-command-hook' and `post-command-hook'." |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
138 :global t |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
139 :group 'hl-line |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
140 (if global-hl-line-mode |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
141 (progn |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
142 (add-hook 'pre-command-hook #'global-hl-line-unhighlight) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
143 (add-hook 'post-command-hook #'global-hl-line-highlight)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
144 (global-hl-line-unhighlight) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
145 (remove-hook 'pre-command-hook #'global-hl-line-unhighlight) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
146 (remove-hook 'post-command-hook #'global-hl-line-highlight))) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
147 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
148 (defun global-hl-line-highlight () |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
149 "Active the Global-Hl-Line overlay on the current line in the current window." |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
150 (when global-hl-line-mode ; Might be changed outside the mode function. |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
151 (unless (window-minibuffer-p (selected-window)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
152 (unless global-hl-line-overlay |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
153 (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
154 (overlay-put global-hl-line-overlay 'face hl-line-face)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
155 (overlay-put global-hl-line-overlay 'window (selected-window)) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
156 (move-overlay global-hl-line-overlay |
51018
5edeb93ad9c0
(hl-line-highlight, global-hl-line-highlight): Use
Lute Kamstra <lute@gnu.org>
parents:
51010
diff
changeset
|
157 (line-beginning-position) (line-beginning-position 2))))) |
51010
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
158 |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
159 (defun global-hl-line-unhighlight () |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
160 "Deactivate the Global-Hl-Line overlay on the current line." |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
161 (if global-hl-line-overlay |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
162 (delete-overlay global-hl-line-overlay))) |
f79532778159
Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents:
50847
diff
changeset
|
163 |
24961 | 164 (provide 'hl-line) |
165 | |
52401 | 166 ;;; arch-tag: ac806940-0876-4959-8c89-947563ee2833 |
24961 | 167 ;;; hl-line.el ends here |