Skip to content

add various commands to replace anonymous lambas in keymaps #93

Merged
merged 2 commits into from Dec 23, 2012

2 participants

@tarsius
tarsius commented Nov 11, 2012

I heavily customize keybindings using a tool based on org-mode tables (unreleased). When encountering a binding that is an anonymous lambda it shows that binding as #<lambda> but it is impossible to bind another key.

To work around this I replace the lambda bindings before doing the actual customization. For mu4e that just takes to much code as shown below.

Would you please consider merging this branch which replaces the lambdas with named commands.

Note that I replaced

(lambda () (interactive) (goto-char (point-min)))

with beginning-of-buffer which should do the same and that the new scroll commands have the mu4e- prefix not mu4e-view- prefix but are still defined in mu4e-views.el. They are only used there but could be used elsewhere, actually they are not even mu4e specific.

(when (require 'mu4e nil t)
  (let (def)
    (setq def (lookup-key mu4e-headers-mode-map (naked "C--")))
    (unless (symbolp def)
      (fset 'mu4e-headers-split-view-resize- def)
      (define-key mu4e-headers-mode-map (naked "C--")
        'mu4e-headers-split-view-resize-)
      (define-key mu4e-headers-mode-map (naked "C-kp-subtract")
        'mu4e-headers-split-view-resize-)
      (define-key mu4e-view-mode-map (naked "C--")
        'mu4e-headers-split-view-resize-)
      (define-key mu4e-view-mode-map (naked "C-kp-subtract")
        'mu4e-headers-split-view-resize-))
    (setq def (lookup-key mu4e-view-mode-map (naked "home")))
    (unless (symbolp def)
      (fset 'mu4e+goto-home def)
      (define-key mu4e-view-mode-map (naked "home") 'mu4e+goto-home))
    (setq def (lookup-key mu4e-view-mode-map (naked "end")))
    (unless (symbolp def)
      (fset 'mu4e+goto-end def)
      (define-key mu4e-view-mode-map (naked "end")  'mu4e+goto-end))
    (setq def (lookup-key mu4e-view-mode-map (naked "RET")))
    (unless (symbolp def)
      (fset 'mu4e+scroll-up+1 def)
      (define-key mu4e-view-mode-map (naked "RET")  'mu4e+scroll-up+1))
    (setq def (lookup-key mu4e-view-mode-map (naked "backspace")))
    (unless (symbolp def)
      (fset 'mu4e+scroll-up-1 def)
      (define-key mu4e-view-mode-map (naked "backspace"))
        'mu4e+scroll-up-1)))
@tarsius
tarsius commented Dec 23, 2012

Could you please comment on this.

@djcb djcb merged commit 15f765d into djcb:master Dec 23, 2012
@djcb
Owner
djcb commented Dec 23, 2012

Ok, merged, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.