annotate lisp/help-at-pt.el @ 95962:59534766a799

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Sun, 15 Jun 2008 12:26:28 +0000
parents ee5932bf781d
children d42aff5ca541
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
1 ;;; help-at-pt.el --- local help through the keyboard
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
2
79721
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
4
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
5 ;; Author: Luc Teirlinck <teirllm@auburn.edu>
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
6 ;; Keywords: help
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
7
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
9
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
11 ;; 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
12 ;; 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
13 ;; (at your option) any later version.
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
14
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
19
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
20 ;; 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
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
22
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
23 ;;; Commentary:
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
24
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
25 ;; This file contains functionality to make the help provided by the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
26 ;; help-echo text or overlay property available to the keyboard user.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
27 ;; It also supports a more keyboard oriented alternative to
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
28 ;; `help-echo', namely a new text or overlay property `kbd-help'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
29 ;;
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
30 ;; It provides facilities to access the local help available at point
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
31 ;; either on demand, using the command `display-local-help', or
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
32 ;; automatically after a suitable idle time, through the customizable
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
33 ;; variable `help-at-pt-display-when-idle'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
34 ;;
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
35 ;; You can get a more global overview of the local help available in
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
36 ;; the buffer, using the commands `scan-buf-next-region' and
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
37 ;; `scan-buf-previous-region', which move to the start of the next or
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
38 ;; previous region with available local help and print the help found
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
39 ;; there.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
40 ;;
54524
d3e10b0b1a2e Move suggestions for key bindings to Commentary.
Juri Linkov <juri@jurta.org>
parents: 54283
diff changeset
41 ;; Suggested key bindings:
d3e10b0b1a2e Move suggestions for key bindings to Commentary.
Juri Linkov <juri@jurta.org>
parents: 54283
diff changeset
42 ;;
d3e10b0b1a2e Move suggestions for key bindings to Commentary.
Juri Linkov <juri@jurta.org>
parents: 54283
diff changeset
43 ;; (global-set-key [C-tab] 'scan-buf-next-region)
d3e10b0b1a2e Move suggestions for key bindings to Commentary.
Juri Linkov <juri@jurta.org>
parents: 54283
diff changeset
44 ;; (global-set-key [C-M-tab] 'scan-buf-previous-region)
d3e10b0b1a2e Move suggestions for key bindings to Commentary.
Juri Linkov <juri@jurta.org>
parents: 54283
diff changeset
45 ;;
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
46 ;; You do not have to do anything special to use the functionality
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
47 ;; provided by this file, because all important functions autoload.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
48
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
49 ;;; Code:
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
50
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
51 (defgroup help-at-pt nil
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
52 "Features for displaying local help."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
53 :group 'help
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59727
diff changeset
54 :version "22.1")
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
55
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
56 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
57 (defun help-at-pt-string (&optional kbd)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
58 "Return the help-echo string at point.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
59 Normally, the string produced by the `help-echo' text or overlay
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
60 property, or nil, is returned.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
61 If KBD is non-nil, `kbd-help' is used instead, and any
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
62 `help-echo' property is ignored. In this case, the return value
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
63 can also be t, if that is the value of the `kbd-help' property."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
64 (let* ((prop (if kbd 'kbd-help 'help-echo))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
65 (pair (get-char-property-and-overlay (point) prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
66 (val (car pair))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
67 (ov (cdr pair)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
68 (if (functionp val)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
69 (funcall val (selected-window) (if ov ov (current-buffer)) (point))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
70 (eval val))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
71
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
72 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
73 (defun help-at-pt-kbd-string ()
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
74 "Return the keyboard help string at point.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
75 If the `kbd-help' text or overlay property at point produces a
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
76 string, return it. Otherwise, use the `help-echo' property. If
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
77 this produces no string either, return nil."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
78 (let ((kbd (help-at-pt-string t))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
79 (echo (help-at-pt-string)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
80 (if (and kbd (not (eq kbd t))) kbd echo)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
81
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
82 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
83 (defun display-local-help (&optional arg)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
84 "Display local help in the echo area.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
85 This displays a short help message, namely the string produced by
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
86 the `kbd-help' property at point. If `kbd-help' does not produce
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
87 a string, but the `help-echo' property does, then that string is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
88 printed instead.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
89
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
90 A numeric argument ARG prevents display of a message in case
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
91 there is no help. While ARG can be used interactively, it is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
92 mainly meant for use from Lisp."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
93 (interactive "P")
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
94 (let ((help (help-at-pt-kbd-string)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
95 (if help
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
96 (message "%s" help)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
97 (if (not arg) (message "No local help at point")))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
98
57798
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
99 (defvar help-at-pt-timer nil
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
100 "Non-nil means that a timer is set that checks for local help.
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
101 If non-nil, this is the value returned by the call of
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
102 `run-with-idle-timer' that set that timer. This variable is used
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
103 internally to enable `help-at-pt-display-when-idle'. Do not set it
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
104 yourself.")
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
105
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
106 (defcustom help-at-pt-timer-delay 1
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
107 "*Delay before displaying local help.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
108 This is used if `help-at-pt-display-when-idle' is enabled.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
109 The value may be an integer or floating point number.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
110
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
111 If a timer is already active, there are two ways to make the new
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
112 value take effect immediately. After setting the value, you can
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
113 first call `help-at-pt-cancel-timer' and then set a new timer
54283
d0c3cadb7e21 (help-at-pt-timer-delay): Minor doc fix (remove stray space).
Luc Teirlinck <teirllm@auburn.edu>
parents: 53208
diff changeset
114 with `help-at-pt-set-timer'. Alternatively, you can set this
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
115 variable through Custom. This will not set a timer if none is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
116 active, but if one is already active, Custom will make it use the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
117 new value."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
118 :group 'help-at-pt
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
119 :type 'number
57798
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
120 :initialize 'custom-initialize-default
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
121 :set (lambda (variable value)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
122 (set-default variable value)
57798
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
123 (and (boundp 'help-at-pt-timer)
bb24af8f5452 (help-at-pt-timer): Move defvar up to avoid compiler warning.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57542
diff changeset
124 help-at-pt-timer
57802
edb9ccd02dbf (help-at-pt-timer-delay, help-at-pt-display-when-idle): Remove
Luc Teirlinck <teirllm@auburn.edu>
parents: 57798
diff changeset
125 (timer-set-idle-time help-at-pt-timer value t))))
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
126
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
127 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
128 (defun help-at-pt-cancel-timer ()
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
129 "Cancel any timer set by `help-at-pt-set-timer'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
130 This disables `help-at-pt-display-when-idle'."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
131 (interactive)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
132 (let ((inhibit-quit t))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
133 (when help-at-pt-timer
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
134 (cancel-timer help-at-pt-timer)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
135 (setq help-at-pt-timer nil))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
136
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
137 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
138 (defun help-at-pt-set-timer ()
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
139 "Enable `help-at-pt-display-when-idle'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
140 This is done by setting a timer, if none is currently active."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
141 (interactive)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
142 (unless help-at-pt-timer
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
143 (setq help-at-pt-timer
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
144 (run-with-idle-timer
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
145 help-at-pt-timer-delay t #'help-at-pt-maybe-display))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
146
59727
86b02098f260 (help-at-pt-display-when-idle): Add autoload cookie.
Luc Teirlinck <teirllm@auburn.edu>
parents: 57802
diff changeset
147 ;;;###autoload
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
148 (defcustom help-at-pt-display-when-idle 'never
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
149 "*Automatically show local help on point-over.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
150 If the value is t, the string obtained from any `kbd-help' or
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
151 `help-echo' property at point is automatically printed in the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
152 echo area, if nothing else is already displayed there, or after a
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
153 quit. If both `kbd-help' and `help-echo' produce help strings,
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
154 `kbd-help' is used. If the value is a list, the help only gets
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
155 printed if there is a text or overlay property at point that is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
156 included in this list. Suggested properties are `keymap',
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
157 `local-map', `button' and `kbd-help'. Any value other than t or
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
158 a non-empty list disables the feature.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
159
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
160 This variable only takes effect after a call to
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
161 `help-at-pt-set-timer'. The help gets printed after Emacs has
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
162 been idle for `help-at-pt-timer-delay' seconds. You can call
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
163 `help-at-pt-cancel-timer' to cancel the timer set by, and the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
164 effect of, `help-at-pt-set-timer'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
165
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
166 When this variable is set through Custom, `help-at-pt-set-timer'
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
167 is called automatically, unless the value is `never', in which
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
168 case `help-at-pt-cancel-timer' is called. Specifying an empty
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
169 list of properties through Custom will set the timer, thus
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
170 enabling buffer local values. It sets the actual value to nil.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
171 Thus, Custom distinguishes between a nil value and other values
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
172 that disable the feature, which Custom identifies with `never'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
173 The default is `never'."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
174 :group 'help-at-pt
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
175 :type '(choice (const :tag "Always"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
176 :format "%t\n%h"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
177 :doc
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
178 "This choice can get noisy.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
179 The text printed from the `help-echo' property is often only
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
180 relevant when using the mouse. If you mind about too many
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
181 messages getting printed in the echo area, use \"In certain
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
182 situations\". See the documentation there for more information."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
183 t)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
184 (repeat :tag "In certain situations"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
185 ;; unless we specify 0 offset the doc string
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
186 ;; for this choice gets indented very
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
187 ;; differently than for the other two
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
188 ;; choices, when "More" is selected.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
189 :offset 0
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
190 :format "%{%t%}:\n%v%i\n%h"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
191 :doc
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
192 "This choice lets you specify a list of \
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
193 text properties.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
194 Presence of any of these properties will trigger display of
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
195 available local help on point-over.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
196 If you use this alternative through Custom without listing any
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
197 properties, a timer will be set anyway. This will enable buffer
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
198 local values. Use \"Never\" if you do not want a timer to be set.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
199
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
200 Suggested properties:
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
201 The `keymap' and `local-map' properties change keybindings in
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
202 parts of the buffer. Some of these keymaps are mode independent
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
203 and are not mentioned in the mode documentation. Hence, the help
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
204 text is likely to be useful.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
205 Specifying `button' is relevant in Custom and similar buffers.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
206 In these buffers, most, but not all, of the text shown this way is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
207 available by default when using tab, but not on regular point-over.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
208 The presence of a `kbd-help' property guarantees that non mouse
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
209 specific help is available."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
210 :value (keymap local-map button kbd-help)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
211 symbol)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
212 (other :tag "Never"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
213 :format "%t\n%h"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
214 :doc
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
215 "This choice normally disables buffer local values.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
216 If you choose this value through Custom and a timer checking for
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
217 local help is currently active, it will be canceled. No new
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
218 timer will be set. Call `help-at-pt-set-timer' after choosing
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
219 this option, or use \"In certain situations\" and specify no text
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
220 properties, to enable buffer local values."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
221 never))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
222 :initialize 'custom-initialize-default
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
223 :set #'(lambda (variable value)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
224 (set-default variable value)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
225 (if (eq value 'never)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
226 (help-at-pt-cancel-timer)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
227 (help-at-pt-set-timer)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
228 :set-after '(help-at-pt-timer-delay)
57802
edb9ccd02dbf (help-at-pt-timer-delay, help-at-pt-display-when-idle): Remove
Luc Teirlinck <teirllm@auburn.edu>
parents: 57798
diff changeset
229 :require 'help-at-pt)
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
230
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
231 ;; Function for use in `help-at-pt-set-timer'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
232 (defun help-at-pt-maybe-display ()
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
233 (and (or (eq help-at-pt-display-when-idle t)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
234 (and (consp help-at-pt-display-when-idle)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
235 (catch 'found
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
236 (dolist (prop help-at-pt-display-when-idle)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
237 (if (get-char-property (point) prop)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
238 (throw 'found t))))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
239 (or (not (current-message))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
240 (string= (current-message) "Quit"))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
241 (display-local-help t)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
242
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
243 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
244 (defun scan-buf-move-to-region (prop &optional arg hook)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
245 "Go to the start of the next region with non-nil PROP property.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
246 Then run HOOK, which should be a quoted symbol that is a normal
73330
400487787181 * dnd.el (dnd-handle-one-url): Fix typo in doc-string.
Jan Djärv <jan.h.d@swipnet.se>
parents: 68651
diff changeset
247 hook variable, or an expression evaluating to such a symbol.
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
248 Adjacent areas with different non-nil PROP properties are
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
249 considered different regions.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
250
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
251 With numeric argument ARG, move to the start of the ARGth next
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
252 such region, then run HOOK. If ARG is negative, move backward.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
253 If point is already in a region, then that region does not count
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
254 toward ARG. If ARG is 0 and point is inside a region, move to
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
255 the start of that region. If ARG is 0 and point is not in a
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
256 region, print a message to that effect, but do not move point and
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
257 do not run HOOK. If there are not enough regions to move over,
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
258 an error results and the number of available regions is mentioned
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
259 in the error message. Point is not moved and HOOK is not run."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
260 (cond ((> arg 0)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
261 (if (= (point) (point-max))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
262 (error "No further `%s' regions" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
263 (let ((pos (point)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
264 (dotimes (x arg)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
265 (setq pos (next-single-char-property-change pos prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
266 (unless (get-char-property pos prop)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
267 (setq pos (next-single-char-property-change pos prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
268 (unless (get-char-property pos prop)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
269 (cond ((= x 0)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
270 (error "No further `%s' regions" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
271 ((= x 1)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
272 (error "There is only one further `%s' region" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
273 (t
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
274 (error
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
275 "There are only %d further `%s' regions"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
276 x prop))))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
277 (goto-char pos)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
278 (run-hooks hook)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
279 ((= arg 0)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
280 (let ((val (get-char-property (point) prop)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
281 (cond ((not val)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
282 (message "Point is not in a `%s' region" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
283 ((eq val (get-char-property (1- (point)) prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
284 (goto-char
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
285 (previous-single-char-property-change (point) prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
286 (run-hooks hook))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
287 (t (run-hooks hook)))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
288 ((< arg 0)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
289 (let ((pos (point)) (val (get-char-property (point) prop)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
290 (and val
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
291 (eq val (get-char-property (1- pos) prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
292 (setq pos
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
293 (previous-single-char-property-change pos prop)))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
294 (if (= pos (point-min))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
295 (error "No prior `%s' regions" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
296 (dotimes (x (- arg))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
297 (setq pos (previous-single-char-property-change pos prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
298 (unless (get-char-property pos prop)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
299 (setq pos (previous-single-char-property-change pos prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
300 (unless (get-char-property pos prop)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
301 (cond ((= x 0)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
302 (error "No prior `%s' regions" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
303 ((= x 1)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
304 (error "There is only one prior `%s' region" prop))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
305 (t
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
306 (error "There are only %d prior `%s' regions"
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
307 x prop))))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
308 (goto-char pos)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
309 (run-hooks hook)))))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
310
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
311 ;; To be moved to a different file and replaced by a defcustom in a
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
312 ;; future version.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
313 (defvar scan-buf-move-hook '(display-local-help)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
314 "Normal hook run by `scan-buf-next-region'.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
315 Also used by `scan-buf-previous-region'. The hook is run after
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
316 positioning point.")
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
317
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
318 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
319 (defun scan-buf-next-region (&optional arg)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
320 "Go to the start of the next region with non-nil help-echo.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
321 Print the help found there using `display-local-help'. Adjacent
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
322 areas with different non-nil help-echo properties are considered
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
323 different regions.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
324
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
325 With numeric argument ARG, move to the start of the ARGth next
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
326 help-echo region. If ARG is negative, move backward. If point
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
327 is already in a help-echo region, then that region does not count
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
328 toward ARG. If ARG is 0 and point is inside a help-echo region,
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
329 move to the start of that region. If ARG is 0 and point is not
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
330 in such a region, just print a message to that effect. If there
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
331 are not enough regions to move over, an error results and the
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
332 number of available regions is mentioned in the error message.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
333
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
334 A potentially confusing subtlety is that point can be in a
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
335 help-echo region without any local help being available. This is
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
336 because `help-echo' can be a function evaluating to nil. This
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
337 rarely happens in practice."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
338 (interactive "p")
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
339 (scan-buf-move-to-region 'help-echo arg 'scan-buf-move-hook))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
340
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
341 ;;;###autoload
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
342 (defun scan-buf-previous-region (&optional arg)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
343 "Go to the start of the previous region with non-nil help-echo.
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
344 Print the help found there using `display-local-help'. Adjacent
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
345 areas with different non-nil help-echo properties are considered
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
346 different regions. With numeric argument ARG, behaves like
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
347 `scan-buf-next-region' with argument -ARG.."
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
348 (interactive "p")
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
349 (scan-buf-move-to-region 'help-echo (- arg) 'scan-buf-move-hook))
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
350
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
351 (provide 'help-at-pt)
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
352
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
353 ;; arch-tag: d0b8b86d-d23f-45d0-a82d-208d6205a583
53203
14b91211c987 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
354 ;;; help-at-pt.el ends here