Re: [PATCH v2 00/36] [emacs] Add outline headings and switch to lexical scope
David Bremner writes: > I pushed applied the first 22 patches to master. Thanks! > "[PATCH v2 23/36] emacs: various cosmetic improvements" leads to some > test failures. FWIW, I'm using Emacs 27.1 on Debian testing. Sorry about, it seems I did not rerun the tests after making the responsible change. It was a silly one character (well two) bug: - (pcase-lambda (`(,regexp ,folder)) + (pcase-lambda (`(,regexp . ,folder)) I have send v3 of just that one commit (23). Jonas ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH v3 23/36] emacs: various cosmetic improvements
--- emacs/notmuch-address.el | 22 -- emacs/notmuch-hello.el | 24 --- emacs/notmuch-jump.el| 4 +- emacs/notmuch-lib.el | 26 +-- emacs/notmuch-maildir-fcc.el | 61 +++--- emacs/notmuch-mua.el | 28 ++-- emacs/notmuch-query.el | 11 +++-- emacs/notmuch-tag.el | 14 +++--- emacs/notmuch.el | 83 ++-- 9 files changed, 125 insertions(+), 148 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 1017c3ce..2f0ec9b3 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -21,6 +21,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (require 'message) (require 'notmuch-parser) (require 'notmuch-lib) @@ -160,15 +162,12 @@ (defun notmuch-address-message-insinuate () (message "calling notmuch-address-message-insinuate is no longer needed")) (defun notmuch-address-setup () - (let* ((setup-company (and notmuch-address-use-company -(require 'company nil t))) -(pair (cons notmuch-address-completion-headers-regexp -#'notmuch-address-expand-name))) -(when setup-company - (notmuch-company-setup)) -(unless (member pair message-completion-alist) - (setq message-completion-alist - (push pair message-completion-alist) + (when (and notmuch-address-use-company +(require 'company nil t)) +(notmuch-company-setup)) + (cl-pushnew (cons notmuch-address-completion-headers-regexp + #'notmuch-address-expand-name) + message-completion-alist :test #'equal)) (defun notmuch-address-toggle-internal-completion () "Toggle use of internal completion for current buffer. @@ -264,9 +263,6 @@ (defun notmuch-address-harvest-addr (result) (let ((name-addr (plist-get result :name-addr))) (puthash name-addr t notmuch-address-completions))) -(defun notmuch-address-harvest-handle-result (obj) - (notmuch-address-harvest-addr obj)) - (defun notmuch-address-harvest-filter (proc string) (when (buffer-live-p (process-buffer proc)) (with-current-buffer (process-buffer proc) @@ -274,7 +270,7 @@ (defun notmuch-address-harvest-filter (proc string) (goto-char (point-max)) (insert string)) (notmuch-sexp-parse-partial-list - 'notmuch-address-harvest-handle-result (process-buffer proc) + 'notmuch-address-harvest-addr (process-buffer proc) (defvar notmuch-address-harvest-procs '(nil . nil) "The currently running harvests. diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index a134eb07..ffd3d799 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -432,8 +432,7 @@ (defun notmuch-hello-add-saved-search (widget _event) ;; If an existing saved search with this name exists, remove it. (setq notmuch-saved-searches (cl-loop for elem in notmuch-saved-searches - if (not (equal name - (notmuch-saved-search-get elem :name))) + unless (equal name (notmuch-saved-search-get elem :name)) collect elem)) ;; Add the new one. (customize-save-variable 'notmuch-saved-searches @@ -481,18 +480,14 @@ (defun notmuch-hello-reflect (list ncols) append (notmuch-hello-reflect-generate-row ncols nrows row list (defun notmuch-hello-widget-search (widget _ignore) - (cond - ((eq (widget-get widget :notmuch-search-type) 'tree) -(notmuch-tree (widget-get widget - :notmuch-search-terms))) - ((eq (widget-get widget :notmuch-search-type) 'unthreaded) -(notmuch-unthreaded (widget-get widget - :notmuch-search-terms))) + (cl-case (widget-get widget :notmuch-search-type) + (tree +(notmuch-tree (widget-get widget :notmuch-search-terms))) + (unthreaded +(notmuch-unthreaded (widget-get widget :notmuch-search-terms))) (t -(notmuch-search (widget-get widget - :notmuch-search-terms) - (widget-get widget - :notmuch-search-oldest-first) +(notmuch-search (widget-get widget :notmuch-search-terms) + (widget-get widget :notmuch-search-oldest-first) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -823,8 +818,7 @@ (defun notmuch-hello-insert-search () ;; instead of a space to make `show-trailing-whitespace' ;; happy, i.e. avoid it marking the whole line as trailing ;; spaces. - (widget-insert ".") - (put-text-property (1- (point)) (point) 'invisible t) + (widget-insert (propertize "." 'invisible t)) (widget-insert "\n")) (defun notmuch-hello-insert-recent-searches () diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 51bc4e31..34d6c796 100644 ---
Re: [PATCH v2 00/36] [emacs] Add outline headings and switch to lexical scope
On Wed, Jan 13 2021, David Bremner wrote: > Jonas Bernoulli writes: > >> This fixes a minor whitespace bug that Tomi notices in (1). >> >> This also adds for commits, two of them in response to a concern >> raised by Tomi, who didn't "see enough point for requiring subr-x >> just [for string-empty-p]", which I agree with: >> >> 2) Changes how `cl-lib' and `pcase' are required. I did that first >>because I want to do it the same way as for `subr-x'. >> >> 3) Require `subr-x', so that we can use it without having to worry >>whether we have now reached the threshold where it becomes >>justified to require an additional library. > > I pushed applied the first 22 patches to master. > > "[PATCH v2 23/36] emacs: various cosmetic improvements" leads to some > test failures. FWIW, I'm using Emacs 27.1 on Debian testing. I got the same. After some trial and error w/ "educated guesses", reverting this change in notmuch-maildir-fcc.el (git diff from my tree after revert), test passed. in emacs/notmuch-maildir-fcc.el @@ -107,13 +107,16 @@ (defun notmuch-fcc-header-setup () ;; Old style - no longer works. (error "Invalid `notmuch-fcc-dirs' setting (old style)")) ((listp notmuch-fcc-dirs) - (or (seq-some (let ((from (message-field-value "From"))) - (pcase-lambda (`(,regexp ,folder)) -(and (string-match-p regexp from) - folder))) -notmuch-fcc-dirs) - (progn (message "No Fcc header added.") - nil))) + (let* ((from (message-field-value "From")) + (match + (catch 'first-match +(dolist (re-folder notmuch-fcc-dirs) + (when (string-match-p (car re-folder) from) +(throw 'first-match re-folder)) +(if match +(cdr match) + (message "No Fcc header added.") + nil))) > > T310-emacs: Testing emacs interface > FAIL notmuch-fcc-dirs set to a list (with match) > --- T310-emacs.28.EXPECTED 2021-01-13 12:00:57.901428602 + > +++ T310-emacs.28.OUTPUT2021-01-13 12:00:57.905428701 + > @@ -1,5 +0,0 @@ > -From: Notmuch Test Suite > -To: > -Subject: > -Fcc: > /home/bremner/software/upstream/notmuch/test/tmp.T310-emacs/mail/sent-list-match > ---text follows this line-- > *ERROR*: Wrong type argument: listp, "sent-list-match" > FAIL notmuch-fcc-dirs set to a list (catch-all) > --- T310-emacs.29.EXPECTED 2021-01-13 12:00:57.933429400 + > +++ T310-emacs.29.OUTPUT2021-01-13 12:00:57.933429400 + > @@ -1,5 +0,0 @@ > -From: Notmuch Test Suite > -To: > -Subject: > -Fcc: > /home/bremner/software/upstream/notmuch/test/tmp.T310-emacs/mail/sent-list-catch-all > ---text follows this line-- > *ERROR*: Wrong type argument: listp, "failure" > FAIL notmuch-fcc-dirs set to a list (no match) > --- T310-emacs.30.EXPECTED 2021-01-13 12:00:57.953429900 + > +++ T310-emacs.30.OUTPUT2021-01-13 12:00:57.95743 + > @@ -1,4 +0,0 @@ > -From: Notmuch Test Suite > -To: > -Subject: > ---text follows this line-- > *ERROR*: Wrong type argument: listp, "failure" > ___ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-le...@notmuchmail.org ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v2 00/36] [emacs] Add outline headings and switch to lexical scope
Jonas Bernoulli writes: > This fixes a minor whitespace bug that Tomi notices in (1). > > This also adds for commits, two of them in response to a concern > raised by Tomi, who didn't "see enough point for requiring subr-x > just [for string-empty-p]", which I agree with: > > 2) Changes how `cl-lib' and `pcase' are required. I did that first >because I want to do it the same way as for `subr-x'. > > 3) Require `subr-x', so that we can use it without having to worry >whether we have now reached the threshold where it becomes >justified to require an additional library. I pushed applied the first 22 patches to master. "[PATCH v2 23/36] emacs: various cosmetic improvements" leads to some test failures. FWIW, I'm using Emacs 27.1 on Debian testing. T310-emacs: Testing emacs interface FAIL notmuch-fcc-dirs set to a list (with match) --- T310-emacs.28.EXPECTED 2021-01-13 12:00:57.901428602 + +++ T310-emacs.28.OUTPUT2021-01-13 12:00:57.905428701 + @@ -1,5 +0,0 @@ -From: Notmuch Test Suite -To: -Subject: -Fcc: /home/bremner/software/upstream/notmuch/test/tmp.T310-emacs/mail/sent-list-match ---text follows this line-- *ERROR*: Wrong type argument: listp, "sent-list-match" FAIL notmuch-fcc-dirs set to a list (catch-all) --- T310-emacs.29.EXPECTED 2021-01-13 12:00:57.933429400 + +++ T310-emacs.29.OUTPUT2021-01-13 12:00:57.933429400 + @@ -1,5 +0,0 @@ -From: Notmuch Test Suite -To: -Subject: -Fcc: /home/bremner/software/upstream/notmuch/test/tmp.T310-emacs/mail/sent-list-catch-all ---text follows this line-- *ERROR*: Wrong type argument: listp, "failure" FAIL notmuch-fcc-dirs set to a list (no match) --- T310-emacs.30.EXPECTED 2021-01-13 12:00:57.953429900 + +++ T310-emacs.30.OUTPUT2021-01-13 12:00:57.95743 + @@ -1,4 +0,0 @@ -From: Notmuch Test Suite -To: -Subject: ---text follows this line-- *ERROR*: Wrong type argument: listp, "failure" ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v2 00/36] [emacs] Add outline headings and switch to lexical scope
On Sun, Jan 10 2021, Jonas Bernoulli wrote: > This fixes a minor whitespace bug that Tomi notices in (1). > > This also adds for commits, two of them in response to a concern > raised by Tomi, who didn't "see enough point for requiring subr-x > just [for string-empty-p]", which I agree with: > > 2) Changes how `cl-lib' and `pcase' are required. I did that first >because I want to do it the same way as for `subr-x'. > > 3) Require `subr-x', so that we can use it without having to worry >whether we have now reached the threshold where it becomes >justified to require an additional library. > >Personally I consider this library to be part of core elisp >libraries, and wish it were autoloaded like, say `subr'. I am >not the only one with that opinion and some other package is >bound to load this very small library anyways, so we might as >well benefit from the goodies that it provides too. > > The remaining two new commits (4,5) I have already submitted earlier > in a separate thread. Unfortunately they did not get merged or even > just discussed so far, so I am including them here again. Series looks good (also patch 35/36 (*)). It was easy to review, although took time to browse through all small changes. Marked ready using *-notmuch::needs-review in notmuch show buffer. I have been using the series for couple of days now (and sending this email having the changes in use) -- it feels like this starts faster than previously but that must be just a feeling. Tomi (*) I would even suggest "the best thing", but then it would need more discussion... > > Cheers, > Jonas > > Jonas Bernoulli (36): > emacs: use setq instead of set > emacs: sanitize dedicated widget action/notify functions > emacs: define new notmuch-search-item widget type > emacs: notmuch-start-notmuch: remove backward compatibility code > emacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive > emacs: notmuch-start-notmuch-sentinel: assert buffer is alive > emacs: notmuch-start-notmuch: avoid storing process buffer twice > emacs: avoid passing around some redundant information > emacs: avoid killing process buffer when process is still alive > emacs: make headings outline-minor-mode compatible > emacs: use lexical-bindings in all libraries > emacs: deal with unused lexical arguments and variables > emacs: notmuch-tag--get-formats: silence byte-compiler > emacs: inline notmuch-sexp-eof into only caller > emacs: notmuch-wash-region-to-button: remove unused MSG argument > emacs: silence compiler wrt notmuch-show-insert-part-text/plain > emacs: define notmuch-message-queued-tag-changes as buffer-local > emacs: notmuch-message-apply-queued-tag-changes: cosmetics > emacs: notmuch-wash.el: require diff-mode at beginning of code > emacs: notmuch-mua-prompt-for-sender: don't force Ido on users > emacs: notmuch-mua.el: move all options into "Options" section > emacs: notmuch-crypto-status-button-type: fix potential bug > 1 emacs: various cosmetic improvements > emacs: various comment improvements > emacs: various doc-string improvements > emacs: remove variable notmuch-search-disjunctive-regexp > emacs: define a few variables as automatically buffer-local > emacs: notmuch-search-stash-thread-id: use notmuch-search-query-string > emacs: reorder notmuch.el a bit > emacs: avoid unnecessary let-bindings > 2 emacs: improve how cl-lib and pcase are required > 3 emacs: make subr-x available in all libraries > emacs: use string-empty-p > emacs: notmuch-tree-get-match: No longer define as command > 4 emacs: allow opting out of notmuch's address completion > 5 emacs: notmuch-address-expand-name: use the actual initial-input > > emacs/coolj.el | 14 +- > emacs/make-deps.el | 2 +- > emacs/notmuch-address.el | 103 +++--- > emacs/notmuch-company.el | 3 - > emacs/notmuch-compat.el | 4 +- > emacs/notmuch-crypto.el | 14 +- > emacs/notmuch-draft.el | 27 +++- > emacs/notmuch-hello.el | 229 +++--- > emacs/notmuch-jump.el| 18 +-- > emacs/notmuch-lib.el | 199 +- > emacs/notmuch-maildir-fcc.el | 114 +++ > emacs/notmuch-message.el | 25 ++-- > emacs/notmuch-mua.el | 124 + > emacs/notmuch-parser.el | 22 ++- > emacs/notmuch-print.el | 16 ++- > emacs/notmuch-query.el | 21 ++- > emacs/notmuch-show.el| 130 ++--- > emacs/notmuch-tag.el | 103 -- > emacs/notmuch-tree.el| 61 > emacs/notmuch-wash.el| 54 > emacs/notmuch.el | 261 ++- > emacs/rstdoc.el | 2 +- > test/test-lib.el | 4 +- > 23 files changed, 813 insertions(+), 737 deletions(-) > > -- > 2.29.1 > ___ >