diff options
| -rw-r--r-- | lisp/descr-text.el | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 5ef3a2990d8..aacec848756 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el | |||
| @@ -136,11 +136,9 @@ The `category' property is made into a widget button that call | |||
| 136 | (defun describe-text-category (category) | 136 | (defun describe-text-category (category) |
| 137 | "Describe a text property category." | 137 | "Describe a text property category." |
| 138 | (interactive "S") | 138 | (interactive "S") |
| 139 | (when (get-buffer "*Text Category*") | ||
| 140 | (kill-buffer "*Text Category*")) | ||
| 141 | (save-excursion | 139 | (save-excursion |
| 142 | (with-output-to-temp-buffer "*Text Category*" | 140 | (with-output-to-temp-buffer "*Help*" |
| 143 | (set-buffer "*Text Category*") | 141 | (set-buffer standard-output) |
| 144 | (widget-insert "Category " (format "%S" category) ":\n\n") | 142 | (widget-insert "Category " (format "%S" category) ":\n\n") |
| 145 | (describe-property-list (symbol-plist category)) | 143 | (describe-property-list (symbol-plist category)) |
| 146 | (describe-text-mode) | 144 | (describe-text-mode) |
| @@ -154,8 +152,6 @@ If optional second argument OUTPUT-BUFFER is non-nil, | |||
| 154 | insert the output into that buffer, and don't initialize or clear it | 152 | insert the output into that buffer, and don't initialize or clear it |
| 155 | otherwise." | 153 | otherwise." |
| 156 | (interactive "d") | 154 | (interactive "d") |
| 157 | (when (eq (current-buffer) (get-buffer "*Text Description*")) | ||
| 158 | (error "Can't do self inspection")) | ||
| 159 | (if (>= pos (point-max)) | 155 | (if (>= pos (point-max)) |
| 160 | (error "No character follows specified position")) | 156 | (error "No character follows specified position")) |
| 161 | (if output-buffer | 157 | (if output-buffer |
| @@ -163,9 +159,11 @@ otherwise." | |||
| 163 | (if (not (or (text-properties-at pos) (overlays-at pos))) | 159 | (if (not (or (text-properties-at pos) (overlays-at pos))) |
| 164 | (message "This is plain text.") | 160 | (message "This is plain text.") |
| 165 | (let ((buffer (current-buffer))) | 161 | (let ((buffer (current-buffer))) |
| 162 | (when (eq buffer (get-buffer "*Help*")) | ||
| 163 | (error "Can't do self inspection")) | ||
| 166 | (save-excursion | 164 | (save-excursion |
| 167 | (with-output-to-temp-buffer "*Text Description*" | 165 | (with-output-to-temp-buffer "*Help*" |
| 168 | (set-buffer "*Text Description*") | 166 | (set-buffer standard-output) |
| 169 | (setq output-buffer (current-buffer)) | 167 | (setq output-buffer (current-buffer)) |
| 170 | (widget-insert "Text content at position " (format "%d" pos) ":\n\n") | 168 | (widget-insert "Text content at position " (format "%d" pos) ":\n\n") |
| 171 | (with-current-buffer buffer | 169 | (with-current-buffer buffer |
| @@ -226,14 +224,12 @@ syntax, category, how the character is encoded in a file, | |||
| 226 | character composition information (if relevant), | 224 | character composition information (if relevant), |
| 227 | as well as widgets, buttons, overlays, and text properties." | 225 | as well as widgets, buttons, overlays, and text properties." |
| 228 | (interactive "d") | 226 | (interactive "d") |
| 229 | (when (eq (current-buffer) (get-buffer "*Text Description*")) | ||
| 230 | (error "Can't do self inspection")) | ||
| 231 | (if (>= pos (point-max)) | 227 | (if (>= pos (point-max)) |
| 232 | (error "No character follows specified position")) | 228 | (error "No character follows specified position")) |
| 233 | (let* ((char (char-after pos)) | 229 | (let* ((char (char-after pos)) |
| 234 | (charset (char-charset char)) | 230 | (charset (char-charset char)) |
| 235 | (buffer (current-buffer)) | 231 | (buffer (current-buffer)) |
| 236 | (composition (find-composition (point) nil nil t)) | 232 | (composition (find-composition pos nil nil t)) |
| 237 | (composed (if composition (buffer-substring (car composition) | 233 | (composed (if composition (buffer-substring (car composition) |
| 238 | (nth 1 composition)))) | 234 | (nth 1 composition)))) |
| 239 | (multibyte-p enable-multibyte-characters) | 235 | (multibyte-p enable-multibyte-characters) |
| @@ -261,11 +257,9 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 261 | (format "%d" (nth 1 split)) | 257 | (format "%d" (nth 1 split)) |
| 262 | (format "%d %d" (nth 1 split) (nth 2 split))))) | 258 | (format "%d %d" (nth 1 split) (nth 2 split))))) |
| 263 | ("syntax" | 259 | ("syntax" |
| 264 | ,(let ((syntax (get-char-property (point) 'syntax-table))) | 260 | ,(let ((syntax (syntax-after pos))) |
| 265 | (with-temp-buffer | 261 | (with-temp-buffer |
| 266 | (internal-describe-syntax-value | 262 | (internal-describe-syntax-value syntax) |
| 267 | (if (consp syntax) syntax | ||
| 268 | (aref (or syntax (syntax-table)) char))) | ||
| 269 | (buffer-string)))) | 263 | (buffer-string)))) |
| 270 | ("category" | 264 | ("category" |
| 271 | ,@(let ((category-set (char-category-set char))) | 265 | ,@(let ((category-set (char-category-set char))) |
| @@ -293,16 +287,15 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 293 | (list "not encodable by coding system" | 287 | (list "not encodable by coding system" |
| 294 | (symbol-name coding))))) | 288 | (symbol-name coding))))) |
| 295 | ,@(if (or (memq 'mule-utf-8 | 289 | ,@(if (or (memq 'mule-utf-8 |
| 296 | (find-coding-systems-region (point) (1+ (point)))) | 290 | (find-coding-systems-region pos (1+ pos))) |
| 297 | (get-char-property (point) 'untranslated-utf-8)) | 291 | (get-char-property pos 'untranslated-utf-8)) |
| 298 | (let ((uc (or (get-char-property (point) | 292 | (let ((uc (or (get-char-property pos 'untranslated-utf-8) |
| 299 | 'untranslated-utf-8) | 293 | (encode-char char 'ucs)))) |
| 300 | (encode-char (char-after) 'ucs)))) | ||
| 301 | (if uc | 294 | (if uc |
| 302 | (list (list "Unicode" | 295 | (list (list "Unicode" |
| 303 | (format "%04X" uc)))))) | 296 | (format "%04X" uc)))))) |
| 304 | ,(if (display-graphic-p (selected-frame)) | 297 | ,(if (display-graphic-p (selected-frame)) |
| 305 | (list "font" (or (internal-char-font (point)) | 298 | (list "font" (or (internal-char-font pos) |
| 306 | "-- none --")) | 299 | "-- none --")) |
| 307 | (list "terminal code" | 300 | (list "terminal code" |
| 308 | (let* ((coding (terminal-coding-system)) | 301 | (let* ((coding (terminal-coding-system)) |
| @@ -312,11 +305,10 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 312 | "not encodable"))))))) | 305 | "not encodable"))))))) |
| 313 | (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x))) | 306 | (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x))) |
| 314 | item-list))) | 307 | item-list))) |
| 315 | (when (get-buffer "*Help*") | 308 | (when (eq (current-buffer) (get-buffer "*Help*")) |
| 316 | (kill-buffer "*Help*")) | 309 | (error "Can't do self inspection")) |
| 317 | (with-output-to-temp-buffer "*Help*" | 310 | (with-output-to-temp-buffer "*Help*" |
| 318 | (save-excursion | 311 | (with-current-buffer standard-output |
| 319 | (set-buffer standard-output) | ||
| 320 | (set-buffer-multibyte multibyte-p) | 312 | (set-buffer-multibyte multibyte-p) |
| 321 | (let ((formatter (format "%%%ds:" max-width))) | 313 | (let ((formatter (format "%%%ds:" max-width))) |
| 322 | (dolist (elt item-list) | 314 | (dolist (elt item-list) |
| @@ -331,11 +323,20 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 331 | (insert " " clm)) | 323 | (insert " " clm)) |
| 332 | (insert "\n"))) | 324 | (insert "\n"))) |
| 333 | (when composition | 325 | (when composition |
| 334 | (insert "\nComposed with the following character(s) " | 326 | (insert "\nComposed with the " |
| 335 | (mapconcat (lambda (x) (format "`%c'" x)) | 327 | (cond |
| 336 | (substring composed 1) | 328 | ((eq pos (car composition)) "following ") |
| 337 | ", ") | 329 | ((eq (1+ pos) (cadr composition)) "preceding ") |
| 338 | " to form `" composed "'") | 330 | (t "")) |
| 331 | "character(s) `" | ||
| 332 | (cond | ||
| 333 | ((eq pos (car composition)) (substring composed 1)) | ||
| 334 | ((eq (1+ pos) (cadr composition)) (substring composed 0 -1)) | ||
| 335 | (t (concat (substring composed 0 (- pos (car composition))) | ||
| 336 | "' and `" | ||
| 337 | (substring composed (- (1+ pos) (car composition)))))) | ||
| 338 | |||
| 339 | "' to form `" composed "'") | ||
| 339 | (if (nth 3 composition) | 340 | (if (nth 3 composition) |
| 340 | (insert ".\n") | 341 | (insert ".\n") |
| 341 | (insert "\nby the rule (" | 342 | (insert "\nby the rule (" |