emacs-devel
[Top][All Lists]
Advanced

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

Re: Reading major-mode name via completion?


From: Stephen Leake
Subject: Re: Reading major-mode name via completion?
Date: Sun, 29 May 2016 13:47:05 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

address@hidden writes:

> Is there a completion table that already exists in emacs that one
> could pass to completing-read for reading in a major-mode name?

I use this:

   (completing-read
    "mode: "
    (apply-partially
     #'completion-table-with-predicate
     obarray
     (lambda (sym) ;; predicate
       (or (get sym 'derived-mode-parent) ;; most modes
           (get sym 'custom-mode-group) ;; ada-mode
           ;; FIXME: leaves out fundamental-mode, maybe others
           ))
     'strict)
    nil ;; predicate
    t ;; require-match
    (symbol-name major-mode) ;; initial
    history)

as the FIXME: says, it leaves out some.

-- 
-- Stephe



reply via email to

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