Re: [PATCH 27/27] emacs: various cosmetic improvements
David Edmondson writes: > On Sunday, 2020-11-08 at 20:03:11 +01, Jonas Bernoulli wrote: > > There were some places here where you capitalised comments (more > generally, turned them into English prose) when they were moving for > $reasons, and others where you left them alone. Was there a rationale > for the different treatment? I kept amending to this commit over time. I suppose this difference came about because apparently on some days such fuzzy comments bother me more than others. By the way, I am fairly strict about not sneaking unrelated changes into and such comment cosmetic are about the only exception I make. Anyway, I've amended this commit to improve two more comments. jrb > > Reviewed-by: David Edmondson > >> --- >> emacs/notmuch-address.el | 31 ++ >> emacs/notmuch-hello.el | 28 + >> emacs/notmuch-lib.el | 38 + >> emacs/notmuch-mua.el | 10 ++--- >> emacs/notmuch-tag.el | 2 +- >> emacs/notmuch.el | 88 >> 6 files changed, 91 insertions(+), 106 deletions(-) >> >> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el >> index 21d1d82f..0dedd5d5 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) >> @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t >>:group 'notmuch-address) >> >> (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. >> @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () >> (t nil))) >> >> (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)) >> + (puthash (plist-get result :name-addr) >> + t notmuch-address-completions)) >> >> (defun notmuch-address-harvest-filter (proc string) >>(when (buffer-live-p (process-buffer proc)) >> @@ -264,7 +260,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. >> @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () >> (defun notmuch-address--save-address-hash () >>(when notmuch-address-save-filename >> (if (or (not (file-exists-p notmuch-address-save-filename)) >> -;; The file exists, check it is a file we saved >> +;; The file exists, check it is a file we saved. >> (notmuch-address--get-address-hash)) >> (with-temp-file notmuch-address-save-filename >>(let ((save-plist >> @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () >> nil nil >> (lambda (proc event) >> ;; If harvest fails, we want to try >> - ;; again when the trigger is next >> - ;; called >> + ;; again when the trigger is next called. >> (if (string= event "finished\n") >> (progn >> (notmuch-address--save-address-hash) >> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el >> index fa31694f..80af7544 100644 >> --- a/emacs/notmuch-hello.el >> +++ b/emacs/notmuch-hello.el >> @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) >> ;; 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 >> @@ -446,18 +44
Re: [PATCH 27/27] emacs: various cosmetic improvements
On Sunday, 2020-11-08 at 20:03:11 +01, Jonas Bernoulli wrote: There were some places here where you capitalised comments (more generally, turned them into English prose) when they were moving for $reasons, and others where you left them alone. Was there a rationale for the different treatment? Reviewed-by: David Edmondson > --- > emacs/notmuch-address.el | 31 ++ > emacs/notmuch-hello.el | 28 + > emacs/notmuch-lib.el | 38 + > emacs/notmuch-mua.el | 10 ++--- > emacs/notmuch-tag.el | 2 +- > emacs/notmuch.el | 88 > 6 files changed, 91 insertions(+), 106 deletions(-) > > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el > index 21d1d82f..0dedd5d5 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) > @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t >:group 'notmuch-address) > > (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. > @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () > (t nil))) > > (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)) > + (puthash (plist-get result :name-addr) > +t notmuch-address-completions)) > > (defun notmuch-address-harvest-filter (proc string) >(when (buffer-live-p (process-buffer proc)) > @@ -264,7 +260,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. > @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () > (defun notmuch-address--save-address-hash () >(when notmuch-address-save-filename > (if (or (not (file-exists-p notmuch-address-save-filename)) > - ;; The file exists, check it is a file we saved > + ;; The file exists, check it is a file we saved. > (notmuch-address--get-address-hash)) > (with-temp-file notmuch-address-save-filename > (let ((save-plist > @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () > nil nil > (lambda (proc event) >;; If harvest fails, we want to try > - ;; again when the trigger is next > - ;; called > + ;; again when the trigger is next called. >(if (string= event "finished\n") >(progn > (notmuch-address--save-address-hash) > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index fa31694f..80af7544 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) > ;; 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 > @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols) >append (notmuch-hello-reflect-generate-row ncols nrows row list > > (defun notmuch-hello-widget-search (widget &rest 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 > -
[PATCH 27/27] emacs: various cosmetic improvements
--- emacs/notmuch-address.el | 31 ++ emacs/notmuch-hello.el | 28 + emacs/notmuch-lib.el | 38 + emacs/notmuch-mua.el | 10 ++--- emacs/notmuch-tag.el | 2 +- emacs/notmuch.el | 88 6 files changed, 91 insertions(+), 106 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 21d1d82f..0dedd5d5 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) @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t :group 'notmuch-address) (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. @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () (t nil))) (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)) + (puthash (plist-get result :name-addr) + t notmuch-address-completions)) (defun notmuch-address-harvest-filter (proc string) (when (buffer-live-p (process-buffer proc)) @@ -264,7 +260,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. @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () (defun notmuch-address--save-address-hash () (when notmuch-address-save-filename (if (or (not (file-exists-p notmuch-address-save-filename)) - ;; The file exists, check it is a file we saved + ;; The file exists, check it is a file we saved. (notmuch-address--get-address-hash)) (with-temp-file notmuch-address-save-filename (let ((save-plist @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () nil nil (lambda (proc event) ;; If harvest fails, we want to try -;; again when the trigger is next -;; called +;; again when the trigger is next called. (if (string= event "finished\n") (progn (notmuch-address--save-address-hash) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index fa31694f..80af7544 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) ;; 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 @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols) append (notmuch-hello-reflect-generate-row ncols nrows row list (defun notmuch-hello-widget-search (widget &rest 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 (