emacs: use closures instead of backquoted lambdas

This commit is contained in:
Jonas Bernoulli 2021-07-19 13:31:05 +02:00 committed by David Bremner
parent d25dafb4c2
commit 27c8e377e4
3 changed files with 23 additions and 21 deletions

View file

@ -869,15 +869,15 @@ Supports the following entries in OPTIONS as a plist:
(start (point))) (start (point)))
(if is-hidden (if is-hidden
(widget-create 'push-button (widget-create 'push-button
:notify `(lambda (widget &rest _ignore) :notify (lambda (&rest _ignore)
(setq notmuch-hello-hidden-sections (setq notmuch-hello-hidden-sections
(delete ,title notmuch-hello-hidden-sections)) (delete title notmuch-hello-hidden-sections))
(notmuch-hello-update)) (notmuch-hello-update))
"show") "show")
(widget-create 'push-button (widget-create 'push-button
:notify `(lambda (widget &rest _ignore) :notify (lambda (&rest _ignore)
(add-to-list 'notmuch-hello-hidden-sections (add-to-list 'notmuch-hello-hidden-sections
,title) title)
(notmuch-hello-update)) (notmuch-hello-update))
"hide")) "hide"))
(widget-insert "\n") (widget-insert "\n")

View file

@ -50,11 +50,11 @@ fast way to jump to a saved search from anywhere in Notmuch."
(push (list key name (push (list key name
(cond (cond
((eq (plist-get saved-search :search-type) 'tree) ((eq (plist-get saved-search :search-type) 'tree)
`(lambda () (notmuch-tree ',query))) (lambda () (notmuch-tree query)))
((eq (plist-get saved-search :search-type) 'unthreaded) ((eq (plist-get saved-search :search-type) 'unthreaded)
`(lambda () (notmuch-unthreaded ',query))) (lambda () (notmuch-unthreaded query)))
(t (t
`(lambda () (notmuch-search ',query ',oldest-first))))) (lambda () (notmuch-search query oldest-first)))))
action-map))))) action-map)))))
(setq action-map (nreverse action-map)) (setq action-map (nreverse action-map))
(if action-map (if action-map
@ -168,8 +168,9 @@ buffer."
(pcase-dolist (`(,key ,_name ,fn) action-map) (pcase-dolist (`(,key ,_name ,fn) action-map)
(when (= (length key) 1) (when (= (length key) 1)
(define-key map key (define-key map key
`(lambda () (interactive) (lambda ()
(setq notmuch-jump--action ',fn) (interactive)
(setq notmuch-jump--action fn)
(exit-minibuffer))))) (exit-minibuffer)))))
;; By doing this in two passes (and checking if we already have a ;; By doing this in two passes (and checking if we already have a
;; binding) we avoid problems if the user specifies a binding which ;; binding) we avoid problems if the user specifies a binding which
@ -191,9 +192,10 @@ buffer."
action-submap) action-submap)
(setq action-submap (nreverse action-submap)) (setq action-submap (nreverse action-submap))
(define-key map keystr (define-key map keystr
`(lambda () (interactive) (lambda ()
(interactive)
(setq notmuch-jump--action (setq notmuch-jump--action
',(apply-partially #'notmuch-jump (apply-partially #'notmuch-jump
action-submap action-submap
new-prompt)) new-prompt))
(exit-minibuffer))))))) (exit-minibuffer)))))))

View file

@ -553,7 +553,7 @@ and vice versa."
name) name)
(mapconcat #'identity tag-change " ")))) (mapconcat #'identity tag-change " "))))
(push (list key name-string (push (list key name-string
`(lambda () (,tag-function ',tag-change))) (lambda () (funcall tag-function tag-change)))
action-map))) action-map)))
(push (list notmuch-tag-jump-reverse-key (push (list notmuch-tag-jump-reverse-key
(if reverse (if reverse