Mercurial > emacs
annotate lisp/hl-line.el @ 29775:31536c6cf2e3
* textmodes/reftex.el (reftex-find-citation-regexp-format):
Support for bibentry.
(reftex-compile-variables): Fixed problem with end of section-re.
* texmodes/reftex-dcr.el (reftex-view-crossref,
reftex-view-crossref-from-bibtex): Deal with changed
`reftex-find-citation-regexp-format'.
(reftex-view-regexp-match, reftex-view-crossref-from-bibtex):
Replaced `remprop' with `put'.
(reftex-view-crossref, reftex-view-crossref-when-idle): Support
for bibentry.
* textmodes/reftex-vars.el (reftex-cite-format-builtin): New entry for
bibentry package.
* textmodes/reftex-parse.el (reftex-locate-bibliography-files): Regexp also
matches "\nobibliography".
* textmodes/reftex-global.el (reftex-renumber-simple-labels): Call
`reftex-ensure-write-access' before doing anything.
(reftex-ensure-write-access): New function.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Tue, 20 Jun 2000 12:52:00 +0000 |
parents | a66af23236bf |
children | f0e0228afe6e |
rev | line source |
---|---|
24961 | 1 ;;; hl-line.el --- highlight the current line |
2 | |
27228 | 3 ;; Copyright (C) 1998, 2000 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 | |
28 ;; Provides a global minor mode (toggled by M-x hl-line-mode) to | |
27228 | 29 ;; highlight, on a suitable terminal, the line in the current window |
30 ;; on which point is (except in a minibuffer window). Done to satisfy | |
31 ;; a request for a feature of Lesser Editors. | |
24961 | 32 |
33 ;; You probably don't really want this; if the cursor is difficult to | |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
34 ;; spot, try changing its colour, relying on `blink-cursor-mode' or |
29610 | 35 ;; both. The hookery used might affect response noticeably on a slow |
27228 | 36 ;; machine. |
24961 | 37 |
38 ;; An overlay is used, active only on the selected window. Hooks are | |
39 ;; added to `pre-command-hook' and `post-command-hook' to activate and | |
40 ;; deactivate (by deleting) the overlay. `hl-line-unhighlight', on | |
41 ;; `pre-command-hook', deactivates it unconditionally in case the | |
42 ;; command changes the selected window. (It does so rather than | |
43 ;; keeping track of changes in the selected window). | |
44 ;; `hl-line-highlight', on `post-command-hook', activates it again | |
45 ;; across the window width. | |
46 | |
47 ;;; Code: | |
48 | |
49 (defgroup hl-line nil | |
50 "Highliight the current line." | |
25174 | 51 :version "21.1" |
24961 | 52 :group 'editing) |
53 | |
54 (defcustom hl-line-face 'highlight | |
55 "Face with which to highlight the current line." | |
56 :type 'face | |
57 :group 'hl-line) | |
58 | |
59 (defvar hl-line-overlay nil) | |
60 (make-variable-buffer-local 'hl-line-overlay) | |
61 | |
62 (defun hl-line-highlight () | |
63 "Active the Hl-Line overlay on the current line in the current window. | |
64 \(Unless it's a minibuffer window.)" | |
65 (unless (window-minibuffer-p (selected-window)) ; silly in minibuffer | |
66 (unless hl-line-overlay ; new overlay for this buffer | |
67 (setq hl-line-overlay (make-overlay 1 1)) ; to be moved | |
68 (overlay-put hl-line-overlay 'face hl-line-face)) | |
69 (overlay-put hl-line-overlay 'window (selected-window)) | |
70 (move-overlay hl-line-overlay | |
71 (line-beginning-position) (1+ (line-end-position))))) | |
72 | |
73 (defun hl-line-unhighlight () | |
74 "Deactivate the Hl-Line overlay on the current line in the current window." | |
75 (if hl-line-overlay | |
76 (delete-overlay hl-line-overlay))) | |
77 | |
25051
64e3159f0c7b
(hl-line-mode): Add autload cookies.
Dave Love <fx@gnu.org>
parents:
24961
diff
changeset
|
78 ;;;###autoload |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
79 (define-minor-mode hl-line-mode |
27228 | 80 "Global minor mode to highlight the line about point in the current window. |
24961 | 81 With ARG, turn Hl-Line mode on if ARG is positive, off otherwise. |
82 Uses functions `hl-line-unhighlight' and `hl-line-highlight' on | |
83 `pre-command-hook' and `post-command-hook'." | |
29425
846240c6fd38
* autoarg.el (autoarg-mode, autoarg-kp-mode):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29369
diff
changeset
|
84 nil nil nil :global t |
29369
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
85 |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
86 (if hl-line-mode |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
87 (progn |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
88 (add-hook 'pre-command-hook #'hl-line-unhighlight) |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
89 (add-hook 'post-command-hook #'hl-line-highlight)) |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
90 (hl-line-unhighlight) |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
91 (remove-hook 'pre-command-hook #'hl-line-unhighlight) |
48dc52f114f3
Rewritten using define-minor-mode.
Dave Love <fx@gnu.org>
parents:
29087
diff
changeset
|
92 (remove-hook 'post-command-hook #'hl-line-highlight))) |
24961 | 93 |
94 (provide 'hl-line) | |
95 | |
96 ;;; hl-line.el ends here |