unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* completing-read strips text properties from completion candidate strings
@ 2005-11-14 16:37 Kevin Rodgers
  0 siblings, 0 replies; only message in thread
From: Kevin Rodgers @ 2005-11-14 16:37 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-14 16:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-14 16:37 completing-read strips text properties from completion candidate strings Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).