* [PATCH 1/5] emacs: use closures instead of backquoted lambdas
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
@ 2021-07-19 11:31 ` Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 2/5] emacs: add some function declarations Jonas Bernoulli
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonas Bernoulli @ 2021-07-19 11:31 UTC (permalink / raw)
To: notmuch
---
emacs/notmuch-hello.el | 16 ++++++++--------
emacs/notmuch-jump.el | 26 ++++++++++++++------------
emacs/notmuch-tag.el | 2 +-
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1e66555b..c1b67e22 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -869,16 +869,16 @@ (defun notmuch-hello-insert-searches (title query-list &rest options)
(start (point)))
(if is-hidden
(widget-create 'push-button
- :notify `(lambda (widget &rest _ignore)
- (setq notmuch-hello-hidden-sections
- (delete ,title notmuch-hello-hidden-sections))
- (notmuch-hello-update))
+ :notify (lambda (&rest _ignore)
+ (setq notmuch-hello-hidden-sections
+ (delete title notmuch-hello-hidden-sections))
+ (notmuch-hello-update))
"show")
(widget-create 'push-button
- :notify `(lambda (widget &rest _ignore)
- (add-to-list 'notmuch-hello-hidden-sections
- ,title)
- (notmuch-hello-update))
+ :notify (lambda (&rest _ignore)
+ (add-to-list 'notmuch-hello-hidden-sections
+ title)
+ (notmuch-hello-update))
"hide"))
(widget-insert "\n")
(unless is-hidden
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index e228c8a2..c0760638 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,11 +50,11 @@ (defun notmuch-jump-search ()
(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,9 +168,10 @@ (defun notmuch-jump--make-keymap (action-map prompt)
(pcase-dolist (`(,key ,_name ,fn) action-map)
(when (= (length key) 1)
(define-key map key
- `(lambda () (interactive)
- (setq notmuch-jump--action ',fn)
- (exit-minibuffer)))))
+ (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
;; is a prefix of another binding.
@@ -191,12 +192,13 @@ (defun notmuch-jump--make-keymap (action-map prompt)
action-submap)
(setq action-submap (nreverse action-submap))
(define-key map keystr
- `(lambda () (interactive)
- (setq notmuch-jump--action
- ',(apply-partially #'notmuch-jump
- action-submap
- new-prompt))
- (exit-minibuffer)))))))
+ (lambda ()
+ (interactive)
+ (setq notmuch-jump--action
+ (apply-partially #'notmuch-jump
+ action-submap
+ new-prompt))
+ (exit-minibuffer)))))))
map))
(provide 'notmuch-jump)
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index ebccb5a0..e3a60441 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -553,7 +553,7 @@ (defun notmuch-tag-jump (reverse)
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
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] emacs: add some function declarations
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 1/5] emacs: use closures instead of backquoted lambdas Jonas Bernoulli
@ 2021-07-19 11:31 ` Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 3/5] emacs: fix some option type declarations Jonas Bernoulli
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonas Bernoulli @ 2021-07-19 11:31 UTC (permalink / raw)
To: notmuch
---
emacs/notmuch-jump.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index c0760638..555ecd1f 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -25,6 +25,10 @@
(require 'notmuch-lib)
(require 'notmuch-hello)
+(declare-function notmuch-search "notmuch")
+(declare-function notmuch-tree "notmuch-tree")
+(declare-function notmuch-unthreaded "notmuch-tree")
+
;;;###autoload
(defun notmuch-jump-search ()
"Jump to a saved search by shortcut key.
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] emacs: fix some option type declarations
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 1/5] emacs: use closures instead of backquoted lambdas Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 2/5] emacs: add some function declarations Jonas Bernoulli
@ 2021-07-19 11:31 ` Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 4/5] emacs: notmuch-show-pipe-message: cosmetics Jonas Bernoulli
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonas Bernoulli @ 2021-07-19 11:31 UTC (permalink / raw)
To: notmuch
Also improve their doc-strings.
---
emacs/notmuch-tree.el | 66 +++++++++++++++++++++++++------------------
emacs/notmuch.el | 13 +++++----
2 files changed, 47 insertions(+), 32 deletions(-)
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index b288c05d..d11ef38c 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -77,21 +77,28 @@ (defun notmuch-tree-show-out ()
(defcustom notmuch-tree-result-format
`(("date" . "%12s ")
("authors" . "%-20s")
- ((("tree" . "%s")("subject" . "%s")) ." %-54s ")
+ ((("tree" . "%s")
+ ("subject" . "%s"))
+ . " %-54s ")
("tags" . "(%s)"))
- "Result formatting for tree view. Supported fields are: date,
-authors, subject, tree, tags. Tree means the thread tree
-box graphics. The field may also be a list in which case
-the formatting rules are applied recursively and then the
-output of all the fields in the list is inserted
-according to format-string.
-
-Note the author string should not contain
-whitespace (put it in the neighbouring fields instead).
-For example:
- (setq notmuch-tree-result-format \(\(\"authors\" . \"%-40s\"\)
- \(\"subject\" . \"%s\"\)\)\)"
- :type '(alist :key-type (string) :value-type (string))
+ "Result formatting for tree view.
+
+Supported fields are: date, authors, subject, tree, tags.
+
+Tree means the thread tree box graphics. The field may
+also be a list in which case the formatting rules are
+applied recursively and then the output of all the fields
+in the list is inserted according to format-string.
+
+Note that the author string should not contain whitespace
+\(put it in the neighbouring fields instead). For example:
+ (setq notmuch-tree-result-format
+ '((\"authors\" . \"%-40s\")
+ (\"subject\" . \"%s\")))"
+ :type '(alist :key-type (choice string
+ (alist :key-type string
+ :value-type string))
+ :value-type string)
:group 'notmuch-tree)
(defcustom notmuch-unthreaded-result-format
@@ -99,19 +106,24 @@ (defcustom notmuch-unthreaded-result-format
("authors" . "%-20s")
((("subject" . "%s")) ." %-54s ")
("tags" . "(%s)"))
- "Result formatting for unthreaded tree view. Supported fields are: date,
-authors, subject, tree, tags. Tree means the thread tree
-box graphics. The field may also be a list in which case
-the formatting rules are applied recursively and then the
-output of all the fields in the list is inserted
-according to format-string.
-
-Note the author string should not contain
-whitespace (put it in the neighbouring fields instead).
-For example:
- (setq notmuch-tree-result-format \(\(\"authors\" . \"%-40s\"\)
- \(\"subject\" . \"%s\"\)\)\)"
- :type '(alist :key-type (string) :value-type (string))
+ "Result formatting for unthreaded tree view.
+
+Supported fields are: date, authors, subject, tree, tags.
+
+Tree means the thread tree box graphics. The field may
+also be a list in which case the formatting rules are
+applied recursively and then the output of all the fields
+in the list is inserted according to format-string.
+
+Note that the author string should not contain whitespace
+\(put it in the neighbouring fields instead). For example:
+ (setq notmuch-unthreaded-result-format
+ '((\"authors\" . \"%-40s\")
+ (\"subject\" . \"%s\")))"
+ :type '(alist :key-type (choice string
+ (alist :key-type string
+ :value-type string))
+ :value-type string)
:group 'notmuch-tree)
(defun notmuch-tree-result-format ()
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 351334aa..7f10c509 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -88,18 +88,21 @@ (defcustom notmuch-search-result-format
("authors" . "%-20s ")
("subject" . "%s ")
("tags" . "(%s)"))
- "Search result formatting. Supported fields are:
- date, count, authors, subject, tags
+ "Search result formatting.
+
+Supported fields are: date, count, authors, subject, tags.
For example:
- (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
- \(\"subject\" . \"%s\"\)\)\)
+ (setq notmuch-search-result-format
+ '((\"authors\" . \"%-40s\")
+ (\"subject\" . \"%s\")))
+
Line breaks are permitted in format strings (though this is
currently experimental). Note that a line break at the end of an
\"authors\" field will get elided if the authors list is long;
place it instead at the beginning of the following field. To
enter a line break when setting this variable with setq, use \\n.
To enter a line break in customize, press \\[quoted-insert] C-j."
- :type '(alist :key-type (string) :value-type (string))
+ :type '(alist :key-type string :value-type string)
:group 'notmuch-search)
;; The name of this variable `notmuch-init-file' is consistent with the
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] emacs: notmuch-show-pipe-message: cosmetics
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
` (2 preceding siblings ...)
2021-07-19 11:31 ` [PATCH 3/5] emacs: fix some option type declarations Jonas Bernoulli
@ 2021-07-19 11:31 ` Jonas Bernoulli
2021-07-19 11:31 ` [PATCH 5/5] emacs: shorten lines in two doc-strings Jonas Bernoulli
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jonas Bernoulli @ 2021-07-19 11:31 UTC (permalink / raw)
To: notmuch
---
emacs/notmuch-show.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9a95eb34..b14db1dd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -2076,19 +2076,19 @@ (defun notmuch-show-pipe-message (entire-thread command)
(let ((cwd default-directory)
(buf (get-buffer-create (concat "*notmuch-pipe*"))))
(with-current-buffer buf
- (setq buffer-read-only nil)
- (erase-buffer)
- ;; Use the originating buffer's working directory instead of
- ;; that of the pipe buffer.
- (cd cwd)
- (let ((exit-code (call-process-shell-command shell-command nil buf)))
- (goto-char (point-max))
- (set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (unless (zerop exit-code)
- (pop-to-buffer buf)
- (message (format "Command '%s' exited abnormally with code %d"
- shell-command exit-code))))))))
+ (setq buffer-read-only t)
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ ;; Use the originating buffer's working directory instead of
+ ;; that of the pipe buffer.
+ (cd cwd)
+ (let ((exit-code (call-process-shell-command shell-command nil buf)))
+ (goto-char (point-max))
+ (set-buffer-modified-p nil)
+ (unless (zerop exit-code)
+ (pop-to-buffer buf)
+ (message (format "Command '%s' exited abnormally with code %d"
+ shell-command exit-code)))))))))
(defun notmuch-show-tag-message (&rest tag-changes)
"Change tags for the current message.
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/5] emacs: shorten lines in two doc-strings
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
` (3 preceding siblings ...)
2021-07-19 11:31 ` [PATCH 4/5] emacs: notmuch-show-pipe-message: cosmetics Jonas Bernoulli
@ 2021-07-19 11:31 ` Jonas Bernoulli
2021-07-23 20:18 ` [PATCH 0/5] Use closures and other emacs cleanup Tomi Ollila
2021-08-30 1:04 ` David Bremner
6 siblings, 0 replies; 8+ messages in thread
From: Jonas Bernoulli @ 2021-07-19 11:31 UTC (permalink / raw)
To: notmuch
The byte-compiler wasn't happy about those.
---
emacs/notmuch-draft.el | 2 +-
emacs/notmuch-hello.el | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
index a68b7d8d..aeb6c588 100644
--- a/emacs/notmuch-draft.el
+++ b/emacs/notmuch-draft.el
@@ -42,7 +42,7 @@ (defgroup notmuch-draft nil
:group 'notmuch)
(defcustom notmuch-draft-tags '("+draft")
- "List of tags changes to apply to a draft message when it is saved in the database.
+ "List of tag changes to apply when saving a draft message in the database.
Tags starting with \"+\" (or not starting with either \"+\" or
\"-\") in the list will be added, and tags starting with \"-\"
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index c1b67e22..21855b70 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -144,9 +144,11 @@ (defcustom notmuch-saved-searches
Possible values are `oldest-first', `newest-first'
or nil. Nil means use the default sort order.
:search-type Specify whether to run the search in search-mode,
- tree mode or unthreaded mode. Set to 'tree to specify tree
- mode, 'unthreaded to specify unthreaded mode, and set to nil
- (or anything except tree and unthreaded) to specify search mode.
+ tree mode or unthreaded mode. Set to `tree' to
+ specify tree mode, 'unthreaded to specify
+ unthreaded mode, and set to nil (or anything
+ except tree and unthreaded) to specify search
+ mode.
Other accepted forms are a cons cell of the form (NAME . QUERY)
or a list of the form (NAME QUERY COUNT-QUERY)."
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] Use closures and other emacs cleanup
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
` (4 preceding siblings ...)
2021-07-19 11:31 ` [PATCH 5/5] emacs: shorten lines in two doc-strings Jonas Bernoulli
@ 2021-07-23 20:18 ` Tomi Ollila
2021-08-30 1:04 ` David Bremner
6 siblings, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2021-07-23 20:18 UTC (permalink / raw)
To: Jonas Bernoulli, notmuch
On Mon, Jul 19 2021, Jonas Bernoulli wrote:
> Some assorted emacs cleanup and fixes. The big one is the switch to
> using closures instead of backquoted lambdas. The other commits for
> the most part just deal with things the compiler complained about.
>
> Jonas Bernoulli (5):
> emacs: use closures instead of backquoted lambdas
> emacs: add some function declarations
> emacs: fix some option type declarations
> emacs: notmuch-show-pipe-message: cosmetics
> emacs: shorten lines in two doc-strings
This series *looks* good to me (especially the 1st change -- I hope it
works >;D). I don't understand why byte compiler would complain
about too long lines but perhaps the changed docstrings are better
(2 weeks in island w/o exposion to english language so can say notmuch
about the content (if i could otherwise >;)))
Tomi
>
> emacs/notmuch-draft.el | 2 +-
> emacs/notmuch-hello.el | 24 ++++++++-------
> emacs/notmuch-jump.el | 30 +++++++++++--------
> emacs/notmuch-show.el | 26 ++++++++---------
> emacs/notmuch-tag.el | 2 +-
> emacs/notmuch-tree.el | 66 +++++++++++++++++++++++++-----------------
> emacs/notmuch.el | 13 +++++----
> 7 files changed, 93 insertions(+), 70 deletions(-)
>
> --
> 2.31.1
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] Use closures and other emacs cleanup
2021-07-19 11:31 [PATCH 0/5] Use closures and other emacs cleanup Jonas Bernoulli
` (5 preceding siblings ...)
2021-07-23 20:18 ` [PATCH 0/5] Use closures and other emacs cleanup Tomi Ollila
@ 2021-08-30 1:04 ` David Bremner
6 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2021-08-30 1:04 UTC (permalink / raw)
To: Jonas Bernoulli
Jonas Bernoulli <jonas@bernoul.li> writes:
> Some assorted emacs cleanup and fixes. The big one is the switch to
> using closures instead of backquoted lambdas. The other commits for
> the most part just deal with things the compiler complained about.
>
series applied to master
d
^ permalink raw reply [flat|nested] 8+ messages in thread