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)))
(if is-hidden
(widget-create 'push-button
:notify `(lambda (widget &rest _ignore)
:notify (lambda (&rest _ignore)
(setq notmuch-hello-hidden-sections
(delete ,title notmuch-hello-hidden-sections))
(delete title notmuch-hello-hidden-sections))
(notmuch-hello-update))
"show")
(widget-create 'push-button
:notify `(lambda (widget &rest _ignore)
:notify (lambda (&rest _ignore)
(add-to-list 'notmuch-hello-hidden-sections
,title)
title)
(notmuch-hello-update))
"hide"))
(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
(cond
((eq (plist-get saved-search :search-type) 'tree)
`(lambda () (notmuch-tree ',query)))
(lambda () (notmuch-tree query)))
((eq (plist-get saved-search :search-type) 'unthreaded)
`(lambda () (notmuch-unthreaded ',query)))
(lambda () (notmuch-unthreaded query)))
(t
`(lambda () (notmuch-search ',query ',oldest-first)))))
(lambda () (notmuch-search query oldest-first)))))
action-map)))))
(setq action-map (nreverse action-map))
(if action-map
@ -168,8 +168,9 @@ buffer."
(pcase-dolist (`(,key ,_name ,fn) action-map)
(when (= (length key) 1)
(define-key map key
`(lambda () (interactive)
(setq notmuch-jump--action ',fn)
(lambda ()
(interactive)
(setq notmuch-jump--action fn)
(exit-minibuffer)))))
;; By doing this in two passes (and checking if we already have a
;; binding) we avoid problems if the user specifies a binding which
@ -191,9 +192,10 @@ buffer."
action-submap)
(setq action-submap (nreverse action-submap))
(define-key map keystr
`(lambda () (interactive)
(lambda ()
(interactive)
(setq notmuch-jump--action
',(apply-partially #'notmuch-jump
(apply-partially #'notmuch-jump
action-submap
new-prompt))
(exit-minibuffer)))))))

View file

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