summaryrefslogtreecommitdiff
path: root/lisp/descr-text.el
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2009-01-19 15:48:15 +0000
committerJuanma Barranquero <lekktu@gmail.com>2009-01-19 15:48:15 +0000
commitd703f9385eae35e0f6179cd7a58017688f950bc0 (patch)
treee23c2715d81c5fcb76fce705d06023b64cb0b988 /lisp/descr-text.el
parent803ee7b9b1e33ef920245b8daaf3d9601716cf65 (diff)
downloademacs-d703f9385eae35e0f6179cd7a58017688f950bc0.tar.gz
* descr-text.el (describe-char-categories): New defsubst.
(describe-char): Use it.
Diffstat (limited to 'lisp/descr-text.el')
-rw-r--r--lisp/descr-text.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 53a8cd298e2..022acd67b9e 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -353,6 +353,21 @@ This function is semi-obsolete. Use `get-char-code-property'."
(defsubst describe-char-padded-string (ch)
(compose-string (string ch) 0 1 (format "\t%c\t" ch)))
+;; Return a nicely formated list of categories; extended category
+;; description is added to the category name as a tooltip
+(defsubst describe-char-categories (category-set)
+ (let ((mnemonics (category-set-mnemonics category-set)))
+ (unless (eq mnemonics "")
+ (list (mapconcat
+ #'(lambda (x)
+ (let* ((c (category-docstring x))
+ (doc (if (string-match "\\`\\(.*?\\)\n\\(.*\\)\\'" c)
+ (propertize (match-string 1 c)
+ 'help-echo (match-string 2 c))
+ c)))
+ (format "%c:%s" x doc)))
+ mnemonics ", ")))))
+
;;;###autoload
(defun describe-char (pos)
"Describe the character after POS (interactively, the character after point).
@@ -430,11 +445,9 @@ as well as widgets, buttons, overlays, and text properties."
(buffer-string))))
("category"
,@(let ((category-set (char-category-set char)))
- (if (not category-set)
- '("-- none --")
- (mapcar #'(lambda (x) (format "%c:%s"
- x (category-docstring x)))
- (category-set-mnemonics category-set)))))
+ (if category-set
+ (describe-char-categories category-set)
+ '("-- none --"))))
("to input"
,@(let ((key-list (and (eq input-method-function
'quail-input-method)