Advertisement
Guest User

Untitled

a guest
May 3rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.25 KB | None | 0 0
  1. ; What I want to write:
  2. ; (the-general-keybinds "h" "Help"
  3. ;   (
  4. ;    ("h" helpful-at-point "at point")
  5. ;   )
  6. ; )
  7.  
  8. ; What I want to generate:
  9. ; (mmap
  10. ;  :prefix "SPC"
  11. ;  "h" '(:ignore t :which-key "Help")
  12. ;  "hh" '(helpful-at-point :which-key "at point"))
  13.  
  14. ; Given a list l like ("h" helpful-at-point "at point")
  15. ; I want to write (the--general-binding-form "h" "h" 'helpful-at-point "at point)
  16. ; via (apply 'the--general-binding-form (cons "h" l)) and have it generate
  17. ; "hh" '(helpful-at-point :which-key "at point")
  18.  
  19. ; This doesn't work
  20.  
  21. (defun the--general-binding-form (prefix key fn desc)
  22.      `(,(s-concat prefix) '(,fn :which-key ,desc)))
  23.  
  24. ; it generates ("hh" '(helpful-at-point :which-key "at point"))
  25. ; Is there a sensible way to omit the extra parens around the output?
  26.  
  27. ; For the whole expression, I have this:
  28.  (defun the--general-bindings-form (prefix category bindings)
  29.       `(mmap
  30.         :prefix "SPC"
  31.         ,prefix '(:ignore t :which-key ,category)
  32.         ; something goes here, but I can't seem to get it right
  33. ))
  34.  
  35. ; I'm not sure what I can put in the blank spot to iterate through the list of bindings and
  36. ; apply the--general-binding-form. I tried dolist, but no dice (and it's quite possible I
  37. ; was just using it wrong
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement