(and (fboundp 'cl-find-class) (cl-find-class s) "t")))
(defun help--symbol-completion-table-affixation (completions)
- (mapcar (lambda (c)
- (let* ((s (intern c))
- (doc (condition-case nil (documentation s) (error nil)))
- (doc (and doc (substring doc 0 (string-search "\n" doc)))))
- (list c (propertize
- (format "%-4s" (help--symbol-class s))
- 'face 'completions-annotations)
- (if doc (propertize (format " -- %s" doc)
- 'face 'completions-annotations)
- ""))))
- completions))
+ (let ((max (+ (seq-max (mapcar #'string-width completions)) 5)))
+ (mapcar (lambda (c)
+ (let* ((s (intern c))
+ (doc (or (condition-case nil (documentation s) (error nil))
+ (and (boundp s) (not (keywordp s))
+ (documentation-property s 'variable-documentation))
+ (and (facep s) (documentation-property s 'face-documentation))
+ (when-let ((class (cl-find-class s)))
+ (cl--class-docstring class))))
+ (doc (and doc (substring doc 0 (string-search "\n" doc)))))
+ (list c (propertize
+ (format "%-4s" (help--symbol-class s))
+ 'face 'completions-annotations)
+ (if doc (concat
+ (make-string (- max (string-width c)) ?\s)
+ (propertize doc 'face 'completions-annotations))
+ ""))))
+ completions)))
(defun help--symbol-narrow-by-property ()
"Restrict symbol completions list to symbols with a given property."