Hi all,

NEWS.28 contains:

  ** New 'declare' forms to control completion of commands in 'M-x'.
  '(declare (completion PREDICATE))' can be used as a general predicate
  to say whether the command should be considered a completion candidate
  when completing with 'M-x TAB'.

  '(declare (modes MODE...))' can be used as a short-hand way of saying
  that the command should be considered a completion candidate when
  completing on commands from buffers in major modes derived from
  MODE..., or, if it's a minor mode, when that minor mode is enabled in
  the current buffer.

  Note that these forms will only have their effect for 'M-x' if the
  'read-extended-command-predicate' user option is customized to call
  'command-completion-default-include-p' or a similar function.  The
  default value of 'read-extended-command-predicate' is nil, which means
  no commands that match what you have typed are excluded from being
  completion candidates.  The forms will, however, be used by 'M-S-x' by
  default.

latex.el provides 26 commands.  We can add this one form to them:

  (declare (modes LaTeX-mode))

and they will be available in LaTeX-mode and docTeX-mode (and other
derived modes), given that the user has set
`read-extended-command-predicate' accordingly.

What do people think?  Is this worth the effort?

Best, Arash

Reply via email to