bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

completing-read strips text properties from completion candidate strings


From: Kevin Rodgers
Subject: completing-read strips text properties from completion candidate strings
Date: Mon, 14 Nov 2005 09:37:57 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

The following fragment tries to associate a tooltip with each
completion, but it doesn't work (Emacs 21.4).  Using M-:
(text-properties-at (point)) in the *Completions* buffer shows
that the help-echo property is not present.

(let* ((major-modes
        (apropos-internal "-mode\\'"
                          (lambda (mode)
                            (and (commandp mode)
                                 (string-match "\\`Major mode\\>"
                                               (documentation mode))))))
       (completions
        (mapcar (lambda (mode)
                  (let* ((doc-string (documentation mode))
                         (tooltip (substring doc-string 0
(string-match "\n" doc-string)))
                         (mode-name (copy-sequence (symbol-name mode))))
                    (put-text-property 0 (1- (length mode-name)) 'help-echo
                                       mode-name)
                    (list mode-name)))
                major-modes)))
  (completing-read "Major mode (w/docstring): " completions))

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]