annotate lisp/hl-line.el @ 110523:a5ad4f188e19

Synch Semantic to CEDET 1.0. Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog. * semantic.el (semantic-version): Update to 2.0. (semantic-mode-map): Add "," and "m" bindings. (navigate-menu): Update. * semantic/symref.el (semantic-symref-calculate-rootdir): New function. (semantic-symref-detect-symref-tool): Use it. * semantic/symref/grep.el (semantic-symref-grep-shell): New var. (semantic-symref-perform-search): Use it. Calculate root dir with semantic-symref-calculate-rootdir. (semantic-symref-derive-find-filepatterns): Improve error message. * semantic/symref/list.el (semantic-symref-results-mode-map): New bindings. (semantic-symref-auto-expand-results): New option. (semantic-symref-results-dump): Obey auto-expand. (semantic-symref-list-expand-all, semantic-symref-regexp) (semantic-symref-list-contract-all) (semantic-symref-list-map-open-hits) (semantic-symref-list-update-open-hits) (semantic-symref-list-create-macro-on-open-hit) (semantic-symref-list-call-macro-on-open-hits): New functions. (semantic-symref-list-menu-entries) (semantic-symref-list-menu): New vars. (semantic-symref-list-map-open-hits): Move cursor to beginning of match before calling the mapped function. * semantic/doc.el (semantic-documentation-comment-preceeding-tag): Do nothing if the mode doesn't provide comment-start-skip. * semantic/scope.el (semantic-analyze-scope-nested-tags-default): Strip duplicates. (semantic-analyze-scoped-inherited-tag-map): Take the tag we are looking for as part of the scoped tags list. * semantic/html.el (semantic-default-html-setup): Add senator-step-at-tag-classes. * semantic/decorate/include.el (semantic-decoration-on-unknown-includes): Change light bgcolor. (semantic-decoration-on-includes-highlight-default): Check that the include tag has a postion. * semantic/complete.el (semantic-collector-local-members): (semantic-complete-read-tag-local-members) (semantic-complete-jump-local-members): New class and functions. (semantic-complete-self-insert): Save excursion before completing. * semantic/analyze/complete.el (semantic-analyze-possible-completions-default): If no completions are found, return the raw by-name-only completion list. Add FLAGS arguments. Add support for 'no-tc (type constraint) and 'no-unique, or no stripping duplicates. (semantic-analyze-possible-completions-default): Add FLAGS arg. * semantic/util-modes.el (semantic-stickyfunc-show-only-functions-p): New option. (semantic-stickyfunc-fetch-stickyline): Don't show stickytext for the very first line in a buffer. * semantic/util.el (semantic-hack-search) (semantic-recursive-find-nonterminal-by-name) (semantic-current-tag-interactive): Deleted. (semantic-describe-buffer): Fix expand-nonterminal. Add lex-syntax-mods, type relation separator char, and command separation char. (semantic-sanity-check): Only message if called interactively. * semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the :filename property and the tag position. * semantic/lex-spp.el (semantic-lex-spp-lex-text-string): Add recursion limit. * semantic/imenu.el (semantic-imenu-bucketize-type-members): Make this buffer local, not the obsoleted variable. * semantic/idle.el: Add breadcrumbs support. (semantic-idle-summary-current-symbol-info-default) (semantic-idle-tag-highlight) (semantic-idle-completion-list-default): Use semanticdb-without-unloaded-file-searches for speed, and to conform to the controls that specify if the idle timer is supposed to be parsing unparsed includes. (semantic-idle-symbol-highlight-face) (semantic-idle-symbol-maybe-highlight): Rename from *-summary-*. Callers changed. (semantic-idle-work-parse-neighboring-files-flag): Default to nil. (semantic-idle-work-update-headers-flag): New var. (semantic-idle-work-for-one-buffer): Use it. (semantic-idle-local-symbol-highlight): Rename from semantic-idle-tag-highlight. (semantic-idle-truncate-long-summaries): New option. * semantic/ia.el (semantic-ia-cache) (semantic-ia-get-completions): Deleted. Callers changed. (semantic-ia-show-variants): New command. (semantic-ia-show-doc): If doc is empty, don't make a temp buffer. (semantic-ia-show-summary): If there isn't anything to show, say so. * semantic/grammar.el (semantic-grammar-create-package): Save the buffer even in batch mode. * semantic/fw.el (semanticdb-without-unloaded-file-searches): New macro. * semantic/dep.el (semantic-dependency-find-file-on-path): Fix case dereferencing ede-object when it is a list. * semantic/db-typecache.el (semanticdb-expand-nested-tag) (semanticdb-typecache-faux-namespace): New functions. (semanticdb-typecache-file-tags) (semanticdb-typecache-merge-streams): Use them. (semanticdb-typecache-file-tags): When deriving tags from a file, give the mode a chance to monkey with the tag copy. (semanticdb-typecache-find-default): Wrap find in save-excursion. (semanticdb-typecache-find-by-name-helper): Merge found names down. * semantic/db-global.el (semanticdb-enable-gnu-global-in-buffer): Don't show messages if GNU Global is not available and we don't want to throw an error. * semantic/db-find.el (semanticdb-find-result-nth-in-buffer): When trying to normalize the tag to a buffer, don't error if set-buffer method doesn't exist. * semantic/db-file.el (semanticdb-save-db): Simplify msg. * semantic/db.el (semanticdb-refresh-table): If forcing a refresh on a file not in a buffer, use semantic-find-file-noselect and delete the buffer after use. (semanticdb-current-database-list): When calculating root via hooks, force it through true-filename and skip the list of possible roots. * semantic/ctxt.el (semantic-ctxt-imported-packages): New. * semantic/analyze/debug.el (semantic-analyzer-debug-insert-tag): Reset standard output to current buffer. (semantic-analyzer-debug-global-symbol) (semantic-analyzer-debug-missing-innertype): Change "prefix" to "symbol" in messages. * semantic/analyze/refs.el: (semantic-analyze-refs-impl) (semantic-analyze-refs-proto): When calculating value, make sure the found tag is 'similar' to the originating tag. (semantic--analyze-refs-find-tags-with-parent): Attempt to identify matches via imported symbols of parents. (semantic--analyze-refs-full-lookup-with-parents): Do a deep search during the brute search. * semantic/analyze.el (semantic-analyze-find-tag-sequence-default): Be robust to calculated scopes being nil. * semantic/bovine/c.el (semantic-c-describe-environment): Add project macro symbol array. (semantic-c-parse-lexical-token): Add recursion limit. (semantic-ctxt-imported-packages, semanticdb-expand-nested-tag): New overrides. (semantic-expand-c-tag-namelist): Split a full type from a typedef out to its own tag. (semantic-expand-c-tag-namelist): Do not split out a typedef'd inline type if it is an anonymous type. (semantic-c-reconstitute-token): Use the optional initializers as a clue that some function is probably a constructor. When defining the type of these constructors, split the parent name, and use only the class part, if applicable. * semantic/bovine/c-by.el: * semantic/wisent/python-wy.el: Regenerate.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 18 Sep 2010 22:49:54 -0400
parents cc75fd2ab734
children 60516122d066 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
1 ;;; hl-line.el --- highlight the current line
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
2
109280
cc75fd2ab734 Fix typos in some Keywords comments.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
3 ;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
cc75fd2ab734 Fix typos in some Keywords comments.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc.
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
5
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
6 ;; Author: Dave Love <fx@gnu.org>
52777
575eb554f88e Change maintainer.
Dave Love <fx@gnu.org>
parents: 52496
diff changeset
7 ;; Maintainer: FSF
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
8 ;; Created: 1998-09-13
109280
cc75fd2ab734 Fix typos in some Keywords comments.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
9 ;; Keywords: faces, frames, emulations
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
10
29087
d6e90113152f Fix boilerplate comments.
Dave Love <fx@gnu.org>
parents: 27228
diff changeset
11 ;; This file is part of GNU Emacs.
d6e90113152f Fix boilerplate comments.
Dave Love <fx@gnu.org>
parents: 27228
diff changeset
12
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
17
29087
d6e90113152f Fix boilerplate comments.
Dave Love <fx@gnu.org>
parents: 27228
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
22
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
25
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
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
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
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
96363
f9d35151b907 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
41 ;; cursor is difficult to spot, try changing its color, relying on
51010
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
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
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
52834
7d40f75d6c53 Revert part of 2003-09-13 change.
Lute Kamstra <lute@gnu.org>
parents: 52777
diff changeset
55 ;; You could make variable `global-hl-line-mode' buffer-local and set
7d40f75d6c53 Revert part of 2003-09-13 change.
Lute Kamstra <lute@gnu.org>
parents: 52777
diff changeset
56 ;; it to nil to avoid highlighting specific buffers, when the global
7d40f75d6c53 Revert part of 2003-09-13 change.
Lute Kamstra <lute@gnu.org>
parents: 52777
diff changeset
57 ;; mode is used.
7d40f75d6c53 Revert part of 2003-09-13 change.
Lute Kamstra <lute@gnu.org>
parents: 52777
diff changeset
58
68328
ea3b2a2d848c (hl-line-highlight, hl-line-move): Doc fixes.
John Paul Wallington <jpw@pobox.com>
parents: 64762
diff changeset
59 ;; By default the whole line is highlighted. The range of highlighting
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
60 ;; can be changed by defining an appropriate function as the
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
61 ;; buffer-local value of `hl-line-range-function'.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
62
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
63 ;;; Code:
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
64
72572
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
65 (defvar hl-line-overlay nil
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
66 "Overlay used by Hl-Line mode to highlight the current line.")
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
67 (make-variable-buffer-local 'hl-line-overlay)
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
68
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
69 (defvar global-hl-line-overlay nil
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
70 "Overlay used by Global-Hl-Line mode to highlight the current line.")
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
71
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
72 (defgroup hl-line nil
35031
c42fc96648de (hl-line): Doc fix.
Dave Love <fx@gnu.org>
parents: 33187
diff changeset
73 "Highlight the current line."
25174
caaa177b2390 (hl-line): Fix :version.
Dave Love <fx@gnu.org>
parents: 25051
diff changeset
74 :version "21.1"
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
75 :group 'editing)
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
76
72572
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
77 (defface hl-line
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
78 '((t :inherit highlight))
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
79 "Default face for highlighting the current line in Hl-Line mode."
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
80 :version "22.1"
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
81 :group 'hl-line)
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
82
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
83 (defcustom hl-line-face 'hl-line
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
84 "Face with which to highlight the current line in Hl-Line mode."
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
85 :type 'face
72572
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
86 :group 'hl-line
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
87 :set (lambda (symbol value)
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
88 (set symbol value)
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
89 (dolist (buffer (buffer-list))
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
90 (with-current-buffer buffer
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
91 (when hl-line-overlay
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
92 (overlay-put hl-line-overlay 'face hl-line-face))))
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
93 (when global-hl-line-overlay
daa3868065ff * hl-line.el (hl-line): New face.
Chong Yidong <cyd@stupidchicken.com>
parents: 68328
diff changeset
94 (overlay-put global-hl-line-overlay 'face hl-line-face))))
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
95
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
96 (defcustom hl-line-sticky-flag t
98718
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
97 "Non-nil means highlight the current line in all windows.
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
98 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
99 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
100 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
101 :type 'boolean
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
102 :version "22.1"
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
103 :group 'hl-line)
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
104
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
105 (defvar hl-line-range-function nil
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
106 "If non-nil, function to call to return highlight range.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
107 The function of no args should return a cons cell; its car value
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
108 is the beginning position of highlight and its cdr value is the
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
109 end position of highlight in the buffer.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
110 It should return nil if there's no region to be highlighted.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
111
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
112 This variable is expected to be made buffer-local by modes.")
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
113
25051
64e3159f0c7b (hl-line-mode): Add autload cookies.
Dave Love <fx@gnu.org>
parents: 24961
diff changeset
114 ;;;###autoload
29369
48dc52f114f3 Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents: 29087
diff changeset
115 (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
116 "Buffer-local minor mode to highlight the line about point.
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
117 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
118
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
119 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
120 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
121 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
122 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
123 `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
124
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
125 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
126 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
127 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
128 addition to `hl-line-highlight' on `post-command-hook'."
61271
1d02878293f3 (hl-line-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents: 59996
diff changeset
129 :group 'hl-line
29369
48dc52f114f3 Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents: 29087
diff changeset
130 (if hl-line-mode
48dc52f114f3 Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents: 29087
diff changeset
131 (progn
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
132 ;; 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
133 (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
134 (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
135 (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
136 (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
137 (hl-line-highlight)
50847
47453bc2423e Removed an erroneous comment.
Lute Kamstra <lute@gnu.org>
parents: 44172
diff changeset
138 (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
139 (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
140 (hl-line-unhighlight)
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
141 (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
142 (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
143
43031
46823e7a2cae (hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents: 42842
diff changeset
144 (defun hl-line-highlight ()
68328
ea3b2a2d848c (hl-line-highlight, hl-line-move): Doc fixes.
John Paul Wallington <jpw@pobox.com>
parents: 64762
diff changeset
145 "Activate the Hl-Line overlay on the current line."
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
146 (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
147 (progn
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
148 (unless hl-line-overlay
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
149 (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
150 (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
151 (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
152 'window (unless hl-line-sticky-flag (selected-window)))
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
153 (hl-line-move hl-line-overlay))
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
154 (hl-line-unhighlight)))
43031
46823e7a2cae (hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents: 42842
diff changeset
155
46823e7a2cae (hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents: 42842
diff changeset
156 (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
157 "Deactivate the Hl-Line overlay on the current line."
98718
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
158 (when hl-line-overlay
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
159 (delete-overlay hl-line-overlay)))
43031
46823e7a2cae (hl-line-highlight, hl-line-unhighlight):
Richard M. Stallman <rms@gnu.org>
parents: 42842
diff changeset
160
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
161 ;;;###autoload
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
162 (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
163 "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
164 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
165
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
166 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
167 `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
168 :global t
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
169 :group 'hl-line
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
170 (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
171 (progn
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
172 (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
173 (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
174 (global-hl-line-unhighlight)
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
175 (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
176 (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
177
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
178 (defun global-hl-line-highlight ()
106438
889300e08b30 * hl-line.el (global-hl-line-highlight): Minor doc fix (Bug#4925).
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
179 "Highlight the current line in the current window."
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
180 (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
181 (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
182 (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
183 (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
184 (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
185 (overlay-put global-hl-line-overlay 'window (selected-window))
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
186 (hl-line-move global-hl-line-overlay))))
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
187
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
188 (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
189 "Deactivate the Global-Hl-Line overlay on the current line."
98718
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
190 (when global-hl-line-overlay
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
191 (delete-overlay global-hl-line-overlay)))
51010
f79532778159 Rewrote the local minor mode so that it can be
Lute Kamstra <lute@gnu.org>
parents: 50847
diff changeset
192
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
193 (defun hl-line-move (overlay)
68328
ea3b2a2d848c (hl-line-highlight, hl-line-move): Doc fixes.
John Paul Wallington <jpw@pobox.com>
parents: 64762
diff changeset
194 "Move the Hl-Line overlay.
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
195 If `hl-line-range-function' is non-nil, move the OVERLAY to the position
68328
ea3b2a2d848c (hl-line-highlight, hl-line-move): Doc fixes.
John Paul Wallington <jpw@pobox.com>
parents: 64762
diff changeset
196 where the function returns. If `hl-line-range-function' is nil, fill
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
197 the line including the point by OVERLAY."
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
198 (let (tmp b e)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
199 (if hl-line-range-function
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
200 (setq tmp (funcall hl-line-range-function)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
201 b (car tmp)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
202 e (cdr tmp))
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
203 (setq tmp t
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
204 b (line-beginning-position)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
205 e (line-beginning-position 2)))
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
206 (if tmp
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
207 (move-overlay overlay b e)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
208 (move-overlay overlay 1 1))))
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 52834
diff changeset
209
98718
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
210 (defun hl-line-unload-function ()
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
211 "Unload the Hl-Line library."
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
212 (global-hl-line-mode -1)
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
213 (save-current-buffer
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
214 (dolist (buffer (buffer-list))
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
215 (set-buffer buffer)
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
216 (when hl-line-mode (hl-line-mode -1))))
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
217 ;; continue standard unloading
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
218 nil)
878c169a1844 * hl-line.el (hl-line-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents: 96363
diff changeset
219
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
220 (provide 'hl-line)
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
221
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79721
diff changeset
222 ;; arch-tag: ac806940-0876-4959-8c89-947563ee2833
24961
4d9ce81656da Initial revision
Dave Love <fx@gnu.org>
parents:
diff changeset
223 ;;; hl-line.el ends here