[PATCH v3 18/34] emacs: Various cosmetic changes

Subject: [PATCH v3 18/34] emacs: Various cosmetic changes

Date: Sat, 8 Aug 2020 13:49:53 +0200

To: notmuch@notmuchmail.org

Cc:

From: Jonas Bernoulli


---
 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 @@ (defun make-deps (&optional dir)
 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-show nil
 
 (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 @@ (defun notmuch-logged-error (msg &optional extra)
 	(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 @@ (defun notmuch-sexp-create-parser ()
 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 015edb0c..5640346f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -499,21 +499,17 @@ (define-button-type 'notmuch-show-part-button-type
 
 (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 @@ (defun rstdoc--insert-docstring (symbol docstring)
   (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 @@ (defun notmuch-test-report-unexpected (output expected)
 
 (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.28.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: