From 73b8f0b8d71af395667022395b6d6bb692c3aaf2 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sat, 8 Aug 2020 13:49:53 +0200 Subject: [PATCH 1/1] emacs: Various cosmetic changes --- emacs/make-deps.el | 3 ++- emacs/notmuch-lib.el | 8 +++----- emacs/notmuch-parser.el | 9 +++------ emacs/notmuch-show.el | 18 +++++++----------- emacs/rstdoc.el | 9 ++++----- test/test-lib.el | 31 +++++++++++++++---------------- 6 files changed, 34 insertions(+), 44 deletions(-) diff --git a/emacs/make-deps.el b/emacs/make-deps.el index dcac319c..91f4ef3d 100644 --- a/emacs/make-deps.el +++ b/emacs/make-deps.el @@ -36,7 +36,8 @@ This prints make dependencies to `standard-output' based on the top-level `require' expressions in the current buffer. Paths in rules will be given relative to DIR, or `default-directory'." - (setq dir (or dir default-directory)) + (unless dir + (setq dir default-directory)) (save-excursion (goto-char (point-min)) (condition-case nil diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index b86c44ed..05d86ea1 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -53,9 +53,8 @@ (defgroup notmuch-send nil "Sending messages from Notmuch." - :group 'notmuch) - -(custom-add-to-group 'notmuch-send 'message 'custom-group) + :group 'notmuch + :group 'message) (defgroup notmuch-tag nil "Tags and tagging in Notmuch." @@ -782,8 +781,7 @@ signaled error. This function does not return." (insert extra) (unless (bolp) (newline))))) - (error "%s" - (concat msg (and extra " (see *Notmuch errors* for more details)")))) + (error "%s%s" msg (if extra " (see *Notmuch errors* for more details)" ""))) (defun notmuch-check-async-exit-status (proc msg &optional command err) "If PROC exited abnormally, pop up an error buffer and signal an error. diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el index fbcfc2ef..3aa5bd8f 100644 --- a/emacs/notmuch-parser.el +++ b/emacs/notmuch-parser.el @@ -39,12 +39,9 @@ The parser always consumes input from point in the current buffer. Hence, the caller is allowed to delete any data before point and may resynchronize after an error by moving point." (vector 'notmuch-sexp-parser - ;; List depth - 0 - ;; Partial parse position marker - nil - ;; Partial parse state - nil)) + 0 ; List depth + nil ; Partial parse position marker + nil)) ; Partial parse state (defmacro notmuch-sexp--depth (sp) `(aref ,sp 1)) (defmacro notmuch-sexp--partial-pos (sp) `(aref ,sp 2)) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index a210898b..eb07e450 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -505,21 +505,17 @@ message at DEPTH in the current thread." (defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment) - (let ((button) - (base-label (concat (and name (concat name ": ")) + (let ((base-label (concat (and name (concat name ": ")) declared-type (and (not (string-equal declared-type content-type)) (concat " (as " content-type ")")) comment))) - (setq button - (insert-button - (concat "[ " base-label " ]") - :base-label base-label - :type 'notmuch-show-part-button-type - :notmuch-part-hidden nil)) - (insert "\n") - ;; return button - button)) + (prog1 (insert-button + (concat "[ " base-label " ]") + :base-label base-label + :type 'notmuch-show-part-button-type + :notmuch-part-hidden nil) + (insert "\n")))) (defun notmuch-show-toggle-part-invisibility (&optional button) (interactive) diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el index 92a337c8..41390bbe 100644 --- a/emacs/rstdoc.el +++ b/emacs/rstdoc.el @@ -24,7 +24,6 @@ ;; ;;; Commentary: -;; ;; Rstdoc provides a facility to extract all of the docstrings defined in ;; an elisp source file. Usage: @@ -68,10 +67,10 @@ (insert "\n")) (defvar rst--escape-alist - '( ("\\\\='" . "\\\\'") - ("\\([^\\]\\)'" . "\\1`") - ("^[[:space:]\t]*$" . "|br|") - ("^[[:space:]\t]" . "|indent| ")) + '(("\\\\='" . "\\\\'") + ("\\([^\\]\\)'" . "\\1`") + ("^[[:space:]\t]*$" . "|br|") + ("^[[:space:]\t]" . "|indent| ")) "List of (regex . replacement) pairs.") (defun rstdoc--rst-quote-string (str) diff --git a/test/test-lib.el b/test/test-lib.el index 6a39bbe2..e9e7c379 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -154,22 +154,21 @@ running, quit if it terminated." (defun notmuch-test-expect-equal (output expected) "Compare OUTPUT with EXPECTED. Report any discrepencies." - (if (equal output expected) - t - (cond - ((and (listp output) - (listp expected)) - ;; Reporting the difference between two lists is done by - ;; reporting differing elements of OUTPUT and EXPECTED - ;; pairwise. This is expected to make analysis of failures - ;; simpler. - (apply #'concat (cl-loop for o in output - for e in expected - if (not (equal o e)) - collect (notmuch-test-report-unexpected o e)))) - - (t - (notmuch-test-report-unexpected output expected))))) + (cond + ((equal output expected) + t) + ((and (listp output) + (listp expected)) + ;; Reporting the difference between two lists is done by + ;; reporting differing elements of OUTPUT and EXPECTED + ;; pairwise. This is expected to make analysis of failures + ;; simpler. + (apply #'concat (cl-loop for o in output + for e in expected + if (not (equal o e)) + collect (notmuch-test-report-unexpected o e)))) + (t + (notmuch-test-report-unexpected output expected)))) (defun notmuch-post-command () (run-hooks 'post-command-hook)) -- 2.43.0