annotate lisp/descr-text.el @ 45134:b3c10180263b

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 05 May 2002 03:06:58 +0000
parents 1344a9d40dc8
children 234b16d90545
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45057
1344a9d40dc8 Follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 45022
diff changeset
1 ;;; descr-text.el --- describe text mode
45022
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (c) 1994, 1995, 1996, 2001, 2002 Free Software Foundation, Inc.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Boris Goldowsky <boris@gnu.org>
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keywords: faces
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; any later version.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Describe-Text Mode.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; Code:
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 (defun describe-text-done ()
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 "Delete the current window or bury the current buffer."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 (interactive)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (if (> (count-windows) 1)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 (delete-window)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 (bury-buffer)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (defvar describe-text-mode-map
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (let ((map (make-sparse-keymap)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 (set-keymap-parent map widget-keymap)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 map)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 "Keymap for `describe-text-mode'.")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 (defcustom describe-text-mode-hook nil
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 "List of hook functions ran by `describe-text-mode'."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 :type 'hook)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 (defun describe-text-mode ()
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 "Major mode for buffers created by `describe-text-at'.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 \\{describe-text-mode-map}
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 Entry to this mode calls the value of `describe-text-mode-hook'
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 if that value is non-nil."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (kill-all-local-variables)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 (setq major-mode 'describe-text-mode
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 mode-name "Describe-Text")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (use-local-map describe-text-mode-map)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (widget-setup)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (run-hooks 'describe-text-mode-hook))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;;; Describe-Text Utilities.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (defun describe-text-widget (widget)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 "Insert text to describe WIDGET in the current buffer."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (widget-create 'link
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 :notify `(lambda (&rest ignore)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (widget-browse ',widget))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (format "%S" (if (symbolp widget)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 widget
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (car widget))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (widget-insert " ")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (widget-create 'info-link :tag "widget" "(widget)Top"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (defun describe-text-sexp (sexp)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 "Insert a short description of SEXP in the current buffer."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (let ((pp (condition-case signal
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (pp-to-string sexp)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (error (prin1-to-string signal)))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (when (string-match "\n\\'" pp)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (setq pp (substring pp 0 (1- (length pp)))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (if (cond ((string-match "\n" pp)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 nil)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ((> (length pp) (- (window-width) (current-column)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 nil)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (t t))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (widget-insert pp)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (widget-create 'push-button
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 :tag "show"
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 :action (lambda (widget &optional event)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (with-output-to-temp-buffer
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 "*Pp Eval Output*"
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (princ (widget-get widget :value))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 pp))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (defun describe-text-properties (properties)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 "Insert a description of PROPERTIES in the current buffer.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 PROPERTIES should be a list of overlay or text properties.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 The `category' property is made into a widget button that call
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 `describe-text-category' when pushed."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (while properties
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (widget-insert (format " %-20s " (car properties)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (let ((key (nth 0 properties))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (value (nth 1 properties)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (cond ((eq key 'category)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (widget-create 'link
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 :notify `(lambda (&rest ignore)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (describe-text-category ',value))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (format "%S" value)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ((widgetp value)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (describe-text-widget value))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (t
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (describe-text-sexp value))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (widget-insert "\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (setq properties (cdr (cdr properties)))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;;; Describe-Text Commands.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (defun describe-text-category (category)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 "Describe a text property category."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (interactive "S")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (when (get-buffer "*Text Category*")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (kill-buffer "*Text Category*"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (save-excursion
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (with-output-to-temp-buffer "*Text Category*"
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (set-buffer "*Text Category*")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (widget-insert "Category " (format "%S" category) ":\n\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (describe-text-properties (symbol-plist category))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (describe-text-mode)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (goto-char (point-min)))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;;;###autoload
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (defun describe-text-at (pos)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 "Describe widgets, buttons, overlays and text properties at POS."
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (interactive "d")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (when (eq (current-buffer) (get-buffer "*Text Description*"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (error "Can't do self inspection"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (let* ((properties (text-properties-at pos))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (overlays (overlays-at pos))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 overlay
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (wid-field (get-char-property pos 'field))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (wid-button (get-char-property pos 'button))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (wid-doc (get-char-property pos 'widget-doc))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;; If button.el is not loaded, we have no buttons in the text.
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (button (and (fboundp 'button-at) (button-at pos)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (button-type (and button (button-type button)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (button-label (and button (button-label button)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (widget (or wid-field wid-button wid-doc)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (if (not (or properties overlays))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (message "This is plain text.")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (when (get-buffer "*Text Description*")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (kill-buffer "*Text Description*"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (save-excursion
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (with-output-to-temp-buffer "*Text Description*"
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (set-buffer "*Text Description*")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (widget-insert "Text content at position " (format "%d" pos) ":\n\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 ;; Widgets
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (when (widgetp widget)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (widget-insert (cond (wid-field "This is an editable text area")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (wid-button "This is an active area")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (wid-doc "This is documentation text")))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (widget-insert " of a ")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (describe-text-widget widget)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (widget-insert ".\n\n"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;; Buttons
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (when (and button (not (widgetp wid-button)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (widget-insert "Here is a " (format "%S" button-type)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 " button labeled `" button-label "'.\n\n"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ;; Overlays
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (when overlays
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (if (eq (length overlays) 1)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (widget-insert "There is an overlay here:\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (widget-insert "There are " (format "%d" (length overlays))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 " overlays here:\n"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (dolist (overlay overlays)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (widget-insert " From " (format "%d" (overlay-start overlay))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 " to " (format "%d" (overlay-end overlay)) "\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (describe-text-properties (overlay-properties overlay)))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (widget-insert "\n"))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;; Text properties
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (when properties
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (widget-insert "There are text properties here:\n")
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (describe-text-properties properties))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (describe-text-mode)
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (goto-char (point-min)))))))
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
4359b383982c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;;; descr-text.el ends here