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

Re: 24.5; w3m.el using lambda function in keybinding definition



In [emacs-w3m : No.12575]
	On Mon, 25 Jul 2016 01:49:10 -0400, Boruch Baum wrote:
> That's the point I'm trying to make, and the problem that I'm
> reporting - when the w3m.el source defines a key to a lambda function,
> there is no way to remap **the_function** to another keybinding
> because 'FUNCTION doesn't have a name - its a lambda function. So, a
> user would have to copy the lambda funtion in its entirety.

Oh, I only see it.  What you want to do is this, don't you?

(define-key w3m-mode-map [remap oldfun] 'newfun)

Even if `oldfun' is not a symbol, you can do it as follows:

(dolist (key (where-is-internal
	      (lookup-key w3m-mode-map "K")
	      w3m-mode-map))
  (define-key w3m-mode-map key 'your-favorite-command))

This will replace the command, that the "K" key is bound to, with
`your-favorite-command' for all the keys in `w3m-mode-map'.

> It should not be a lambda function.

grep -r '(define-key.*(lambda'

reports that many ELisp modules use it in the Emacs source. ;-)

Regards,