emacs-devel
[Top][All Lists]
Advanced

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

RE: use-package.el -> Emacs core


From: Drew Adams
Subject: RE: use-package.el -> Emacs core
Date: Tue, 10 Nov 2015 08:23:13 -0800 (PST)

> package configuration is the one place in Emacs where non-Lisp
> programmers (and people who don't want to become programmers)
> are forced to use Emacs Lisp to configure Emacs in
> ways not allowed by the customization interface.

Wrong, in two ways:

1. No one is required to use packages, AFAIK.

2. Binding keys requires Lisp.  The Customize UI is not
   sufficient.   (This is unfortunate - there should be
   a reasonable Customize UI for key bindings.)

   (Of course, no one is required to bind keys either.)


---- OT ----

FWIW, I use this to let users use Customize to bind keys.
I don't claim it is ideal.  Just one attempt to provide
something.

(define-widget 'icicle-key-definition 'lazy
  "Key definition type for Icicle mode keys.
A list of three components: KEY, COMMAND, CONDITION, that represents
an `icicle-mode-map' binding of COMMAND according to KEY, if CONDITION
evaluates to non-nil.

KEY is either a key sequence (string or vector) or a command.
COMMAND is a command.
CONDITION is a sexp.

If KEY is a command, then the binding represented is its remapping to
COMMAND."
  :indent 1 :offset 0 :tag ""
  :type
  '(list
    (choice
     (key-sequence :tag "Key" :value [ignore])
     ;; Use `symbolp' instead of `commandp', in case the
     ;; library defining the command is not loaded.
     (restricted-sexp :tag "Command to remap"
      :match-alternatives (symbolp) :value ignore))
     ;; Use `symbolp' instead of `commandp'...
    (restricted-sexp :tag "Command"
     :match-alternatives (symbolp) :value ignore)
    (sexp :tag "Condition")))

Example:

(defcustom foo
  `((,(kbd "C-x m")       alpha    t)
    (,(kbd "C-x C-m -")   beta     t)
    (,(kbd "C-x C-m +")   gamma    (require 'toto nil t))
    (,(kbd "C-x v -")     delta    t))
  "*List of key bindings for blah..."
  :type '(repeat icicle-key-definition) :group 'some-group)



reply via email to

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