unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: whitespace-cleanup for emacs/*.el files
@ 2012-01-11 15:13 Tomi Ollila
  2012-01-12 22:07 ` Xavier Maillard
  0 siblings, 1 reply; 16+ messages in thread
From: Tomi Ollila @ 2012-01-11 15:13 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

Executed
    for f in emacs/*.el
    do emacs -q --batch --eval \
        "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
    done

which
    removed trailing whitespace and empty lines at the end of file
    removed spaces before tab (if any)
    converted 8 spaces to tabs in the beginning of line
---
 emacs/coolj.el               |   16 ++++++------
 emacs/notmuch-lib.el         |    3 +-
 emacs/notmuch-maildir-fcc.el |    7 ++---
 emacs/notmuch-show.el        |   52 +++++++++++++++++++++---------------------
 emacs/notmuch.el             |   42 +++++++++++++++++-----------------
 5 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/emacs/coolj.el b/emacs/coolj.el
index 60af60a..173eb2f 100644
--- a/emacs/coolj.el
+++ b/emacs/coolj.el
@@ -108,11 +108,11 @@ If the line should not be broken, return nil; point remains on the
 line."
   (move-to-column fill-column)
   (if (and (re-search-forward "[^ ]" (line-end-position) 1)
-           (> (current-column) fill-column))
+	   (> (current-column) fill-column))
       ;; This line is too long.  Can we break it?
       (or (coolj-find-break-backward prefix)
-          (progn (move-to-column fill-column)
-                 (coolj-find-break-forward)))))
+	  (progn (move-to-column fill-column)
+		 (coolj-find-break-forward)))))
 
 (defun coolj-find-break-backward (prefix)
   "Move point backward to the first available breakpoint and return t.
@@ -135,11 +135,11 @@ If no breakpoint is found, return nil."
 If no break point is found, return nil."
   (and (search-forward " " (line-end-position) 1)
        (progn (skip-chars-forward " " (line-end-position))
-              (null (eolp)))
+	      (null (eolp)))
        (if (and fill-nobreak-predicate
-                (run-hook-with-args-until-success
-                 'fill-nobreak-predicate))
-           (coolj-find-break-forward)
-         t)))
+		(run-hook-with-args-until-success
+		 'fill-nobreak-predicate))
+	   (coolj-find-break-forward)
+	 t)))
 
 (provide 'coolj)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 0f856bf..4a4505c 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -110,7 +110,7 @@ the user hasn't set this variable with the old or new value."
   (let (out)
     (while list
       (when (funcall predicate (car list))
-        (push (car list) out))
+	(push (car list) out))
       (setq list (cdr list)))
     (nreverse out)))
 
@@ -156,4 +156,3 @@ was called."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 
 (provide 'notmuch-lib)
-
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 6fbf82d..06a6486 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -65,7 +65,7 @@ yet when sending a mail."
     ;; Set up the message-fcc-handler to move mails to the maildir in Fcc
     ;; The parameter is set to mark messages as "seen"
     (setq message-fcc-handler-function
-          (lambda (destdir)
+	  (lambda (destdir)
 	    (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
     ;; add a hook to actually insert the Fcc header when sending
     (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))
@@ -116,7 +116,7 @@ will NOT be removed or replaced."
 		(if (= (elt subdir 0) ?/)
 		    subdir
 		  (concat (notmuch-database-path) "/" subdir)))))
-      
+
       ;; finally test if fcc points to a valid maildir
       (let ((fcc-header (message-field-value "Fcc")))
 	(unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
@@ -128,7 +128,7 @@ will NOT be removed or replaced."
 		 (notmuch-maildir-fcc-create-maildir fcc-header))
 		(t
 		 (error "Message not sent"))))))))
- 
+
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
 			    (lambda (s)
@@ -216,4 +216,3 @@ return t if successful, and nil otherwise."
 
 (notmuch-fcc-initialization)
 (provide 'notmuch-maildir-fcc)
-
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5502efd..1ff871f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -115,9 +115,9 @@ indentation."
   `(save-excursion
      (let ((id (notmuch-show-get-message-id)))
        (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
-         (with-current-buffer buf
+	 (with-current-buffer buf
 	    (call-process notmuch-command nil t nil "show" "--format=raw" id)
-           ,@body)
+	   ,@body)
 	 (kill-buffer buf)))))
 
 (defun notmuch-show-view-all-mime-parts ()
@@ -143,23 +143,23 @@ indentation."
 
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
-         (dolist (part (cdr mm-handle))
-           (notmuch-foreach-mime-part function part)))
-        ((bufferp (car mm-handle))
-         (funcall function mm-handle))
-        (t (dolist (part mm-handle)
-             (notmuch-foreach-mime-part function part)))))
+	 (dolist (part (cdr mm-handle))
+	   (notmuch-foreach-mime-part function part)))
+	((bufferp (car mm-handle))
+	 (funcall function mm-handle))
+	(t (dolist (part mm-handle)
+	     (notmuch-foreach-mime-part function part)))))
 
 (defun notmuch-count-attachments (mm-handle)
   (let ((count 0))
     (notmuch-foreach-mime-part
      (lambda (p)
        (let ((disposition (mm-handle-disposition p)))
-         (and (listp disposition)
-              (or (equal (car disposition) "attachment")
-                  (and (equal (car disposition) "inline")
-                       (assq 'filename disposition)))
-              (incf count))))
+	 (and (listp disposition)
+	      (or (equal (car disposition) "attachment")
+		  (and (equal (car disposition) "inline")
+		       (assq 'filename disposition)))
+	      (incf count))))
      mm-handle)
     count))
 
@@ -168,13 +168,13 @@ indentation."
    (lambda (p)
      (let ((disposition (mm-handle-disposition p)))
        (and (listp disposition)
-            (or (equal (car disposition) "attachment")
-                (and (equal (car disposition) "inline")
-                     (assq 'filename disposition)))
-            (or (not queryp)
-                (y-or-n-p
-                 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
-            (mm-save-part p))))
+	    (or (equal (car disposition) "attachment")
+		(and (equal (car disposition) "inline")
+		     (assq 'filename disposition)))
+	    (or (not queryp)
+		(y-or-n-p
+		 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
+	    (mm-save-part p))))
    mm-handle))
 
 (defun notmuch-show-save-attachments ()
@@ -236,15 +236,15 @@ unchanged ADDRESS if parsing fails."
       ;; Remove double quotes. They might be required during transport,
       ;; but we don't need to see them.
       (when name
-        (setq name (replace-regexp-in-string "\"" "" name)))
+	(setq name (replace-regexp-in-string "\"" "" name)))
       ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
       ;; 'foo@bar.com'.
       (when (string= name address)
-        (setq name nil))
+	(setq name nil))
 
       (if (not name)
-        address
-        (concat name " <" address ">")))
+	address
+	(concat name " <" address ">")))
     (error address)))
 
 (defun notmuch-show-insert-headerline (headers date tags depth)
@@ -755,7 +755,7 @@ current buffer, if possible."
     (put-text-property message-start message-end :notmuch-message-extent (cons message-start message-end))
 
     (let ((headers-overlay (make-overlay headers-start headers-end))
-          (invis-specs (list headers-invis-spec message-invis-spec)))
+	  (invis-specs (list headers-invis-spec message-invis-spec)))
       (overlay-put headers-overlay 'invisible invis-specs)
       (overlay-put headers-overlay 'priority 10))
     (overlay-put (make-overlay body-start body-end) 'invisible message-invis-spec)
@@ -1307,7 +1307,7 @@ than only the current message."
   (interactive "P\nsPipe message to command: ")
   (let (shell-command)
     (if entire-thread
-	(setq shell-command 
+	(setq shell-command
 	      (concat notmuch-command " show --format=mbox "
 		      (shell-quote-argument
 		       (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR "))
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 1e61775..aab26c5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -84,23 +84,23 @@ For example:
 
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
-         (dolist (part (cdr mm-handle))
-           (notmuch-foreach-mime-part function part)))
-        ((bufferp (car mm-handle))
-         (funcall function mm-handle))
-        (t (dolist (part mm-handle)
-             (notmuch-foreach-mime-part function part)))))
+	 (dolist (part (cdr mm-handle))
+	   (notmuch-foreach-mime-part function part)))
+	((bufferp (car mm-handle))
+	 (funcall function mm-handle))
+	(t (dolist (part mm-handle)
+	     (notmuch-foreach-mime-part function part)))))
 
 (defun notmuch-count-attachments (mm-handle)
   (let ((count 0))
     (notmuch-foreach-mime-part
      (lambda (p)
        (let ((disposition (mm-handle-disposition p)))
-         (and (listp disposition)
-              (or (equal (car disposition) "attachment")
-                  (and (equal (car disposition) "inline")
-                       (assq 'filename disposition)))
-              (incf count))))
+	 (and (listp disposition)
+	      (or (equal (car disposition) "attachment")
+		  (and (equal (car disposition) "inline")
+		       (assq 'filename disposition)))
+	      (incf count))))
      mm-handle)
     count))
 
@@ -109,13 +109,13 @@ For example:
    (lambda (p)
      (let ((disposition (mm-handle-disposition p)))
        (and (listp disposition)
-            (or (equal (car disposition) "attachment")
-                (and (equal (car disposition) "inline")
-                     (assq 'filename disposition)))
-            (or (not queryp)
-                (y-or-n-p
-                 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
-            (mm-save-part p))))
+	    (or (equal (car disposition) "attachment")
+		(and (equal (car disposition) "inline")
+		     (assq 'filename disposition)))
+	    (or (not queryp)
+		(y-or-n-p
+		 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
+	    (mm-save-part p))))
    mm-handle))
 
 (defun notmuch-documentation-first-line (symbol)
@@ -655,7 +655,7 @@ Here is an example of how to color search results based on tags.
 
  (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
 						  :background \"blue\"))
-                                   (\"unread\" . (:foreground \"green\"))))
+				   (\"unread\" . (:foreground \"green\"))))
 
 The attributes defined for matching tags are merged, with later
 attributes overriding earlier. A message having both \"delete\"
@@ -920,9 +920,9 @@ The optional parameters are used as follows:
 
   oldest-first: A Boolean controlling the sort order of returned threads
   target-thread: A thread ID (with the thread: prefix) that will be made
-                 current if it appears in the search results.
+		 current if it appears in the search results.
   target-line: The line number to move to if the target thread does not
-               appear in the search results."
+	       appear in the search results."
   (interactive (list (notmuch-read-query "Notmuch search: ")))
   (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
     (switch-to-buffer buffer)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-11 15:13 [PATCH] emacs: whitespace-cleanup for emacs/*.el files Tomi Ollila
@ 2012-01-12 22:07 ` Xavier Maillard
  2012-01-13  8:22   ` David Edmondson
  0 siblings, 1 reply; 16+ messages in thread
From: Xavier Maillard @ 2012-01-12 22:07 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: Tomi Ollila

On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> Executed
>     for f in emacs/*.el
>     do emacs -q --batch --eval \
>         "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
>     done
> 
> which
>     removed trailing whitespace and empty lines at the end of file
>     removed spaces before tab (if any)
>     converted 8 spaces to tabs in the beginning of line

+1

Maybe we should note something about this as a /coding style/ rule ?

/Xavier

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-12 22:07 ` Xavier Maillard
@ 2012-01-13  8:22   ` David Edmondson
  2012-01-13  9:50     ` Tomi Ollila
  0 siblings, 1 reply; 16+ messages in thread
From: David Edmondson @ 2012-01-13  8:22 UTC (permalink / raw)
  To: Xavier Maillard, Tomi Ollila, notmuch; +Cc: Tomi Ollila

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard <xavier@maillard.im> wrote:
> On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > Executed
> >     for f in emacs/*.el
> >     do emacs -q --batch --eval \
> >         "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> >     done
> > 
> > which
> >     removed trailing whitespace and empty lines at the end of file
> >     removed spaces before tab (if any)
> >     converted 8 spaces to tabs in the beginning of line
> 
> +1
> 
> Maybe we should note something about this as a /coding style/ rule ?

How about "Running `indent-region' over the file should produce no
changes" as well?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-13  8:22   ` David Edmondson
@ 2012-01-13  9:50     ` Tomi Ollila
  2012-01-13 16:22       ` David Edmondson
  2012-01-13 22:27       ` [PATCH] emacs: whitespace-cleanup for emacs/*.el files Xavier Maillard
  0 siblings, 2 replies; 16+ messages in thread
From: Tomi Ollila @ 2012-01-13  9:50 UTC (permalink / raw)
  To: David Edmondson, Xavier Maillard, notmuch; +Cc: Tomi Ollila

On Fri, 13 Jan 2012 08:22:49 +0000, David Edmondson <dme@dme.org> wrote:
> On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard <xavier@maillard.im> wrote:
> > On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > > Executed
> > >     for f in emacs/*.el
> > >     do emacs -q --batch --eval \
> > >         "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> > >     done
> > > 
> > > which
> > >     removed trailing whitespace and empty lines at the end of file
> > >     removed spaces before tab (if any)
> > >     converted 8 spaces to tabs in the beginning of line
> > 
> > +1
> > 
> > Maybe we should note something about this as a /coding style/ rule ?
> 
> How about "Running `indent-region' over the file should produce no
> changes" as well?

So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

(defun reformat-elisp-buffer ()
  (interactice)
  (emacs-lisp-mode)
  (whitespace-cleanup)
  (indent-region (point-min) (point-max)))

And this located in same directory as 'uncrustify.cfg', wherever
that ends up.

Tomi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-13  9:50     ` Tomi Ollila
@ 2012-01-13 16:22       ` David Edmondson
  2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
  2012-01-13 22:27       ` [PATCH] emacs: whitespace-cleanup for emacs/*.el files Xavier Maillard
  1 sibling, 1 reply; 16+ messages in thread
From: David Edmondson @ 2012-01-13 16:22 UTC (permalink / raw)
  To: Tomi Ollila, Xavier Maillard, notmuch; +Cc: Tomi Ollila

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:
> 
> (defun reformat-elisp-buffer ()
>   (interactice)
>   (emacs-lisp-mode)
>   (whitespace-cleanup)
>   (indent-region (point-min) (point-max)))
> 
> And this located in same directory as 'uncrustify.cfg', wherever
> that ends up.

I'd be happy with that. Note that doing it initially will require a
bunch of fixes - using a single ';' as a comment leader doesn't produce
the desired result, and notmuch.el is full of it...

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-13  9:50     ` Tomi Ollila
  2012-01-13 16:22       ` David Edmondson
@ 2012-01-13 22:27       ` Xavier Maillard
  2012-01-14  1:26         ` David Bremner
  1 sibling, 1 reply; 16+ messages in thread
From: Xavier Maillard @ 2012-01-13 22:27 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

On Fri, 13 Jan 2012 11:50:52 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Fri, 13 Jan 2012 08:22:49 +0000, David Edmondson <dme@dme.org> wrote:
> > On Thu, 12 Jan 2012 23:07:03 +0100, Xavier Maillard <xavier@maillard.im> wrote:
> > > On Wed, 11 Jan 2012 17:13:35 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > > > Executed
> > > >     for f in emacs/*.el
> > > >     do emacs -q --batch --eval \
> > > >         "(progn (find-file \"$f\") (whitespace-cleanup) (save-buffer))"
> > > >     done
> > > > 
> > > > which
> > > >     removed trailing whitespace and empty lines at the end of file
> > > >     removed spaces before tab (if any)
> > > >     converted 8 spaces to tabs in the beginning of line
> > > 
> > > +1
> > > 
> > > Maybe we should note something about this as a /coding style/ rule ?
> > 
> > How about "Running `indent-region' over the file should produce no
> > changes" as well?
> 
> So, In addition to 'uncrustify.cfg' we need emacs reformatter along lines:

What about doing all of this directly in .dir-locals.el (could be
considered unsafe though to add an EVAL block).

/Xavier

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: whitespace-cleanup for emacs/*.el files
  2012-01-13 22:27       ` [PATCH] emacs: whitespace-cleanup for emacs/*.el files Xavier Maillard
@ 2012-01-14  1:26         ` David Bremner
  0 siblings, 0 replies; 16+ messages in thread
From: David Bremner @ 2012-01-14  1:26 UTC (permalink / raw)
  To: Xavier Maillard, Tomi Ollila; +Cc: notmuch

On Fri, 13 Jan 2012 23:27:11 +0100, Xavier Maillard <xma@gnu.org> wrote:
> 
> What about doing all of this directly in .dir-locals.el (could be
> considered unsafe though to add an EVAL block).
> 

I'm not crazy about this ideas, it sounds like it has the potential to
mix whitespace changes in with out changes in a commit. It also seems a
bit rude to do that to people, but maybe the latter is just conservatism.

d

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;'
  2012-01-13 16:22       ` David Edmondson
@ 2012-01-16  9:04         ` Tomi Ollila
  2012-01-16  9:04           ` [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Tomi Ollila
                             ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Tomi Ollila @ 2012-01-16  9:04 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

In order for emacs (indent-region) to (re)indent emacs lisp
properly there needs to be at least 2 comment characters (;;).
---

$ perl -ne 's/;;.*//; print $_ if /(^|[^;]);([^;]|$)/' *.el | less

shows that there is (only) need to change comments in the beginning
of line...

$ perl -pi -e 's/^(\s*);([^;]|$)/$1;;$2/' *.el

did that change.

 emacs/notmuch-hello.el |    4 +-
 emacs/notmuch-lib.el   |   16 +++---
 emacs/notmuch-show.el  |   16 +++---
 emacs/notmuch.el       |  118 ++++++++++++++++++++++++------------------------
 4 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 02017ce..93e5032 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -399,8 +399,8 @@ Complete list of currently available key bindings:
   "Run notmuch and display saved searches, known tags, etc."
   (interactive)
 
-  ; Jump through a hoop to get this value from the deprecated variable
-  ; name (`notmuch-folders') or from the default value.
+  ;; Jump through a hoop to get this value from the deprecated variable
+  ;; name (`notmuch-folders') or from the default value.
   (if (not notmuch-saved-searches)
     (setq notmuch-saved-searches (notmuch-saved-searches)))
 
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 0f856bf..00ed589 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -114,14 +114,14 @@ the user hasn't set this variable with the old or new value."
       (setq list (cdr list)))
     (nreverse out)))
 
-; This lets us avoid compiling these replacement functions when emacs
-; is sufficiently new enough to supply them alone. We do the macro
-; treatment rather than just wrapping our defun calls in a when form
-; specifically so that the compiler never sees the code on new emacs,
-; (since the code is triggering warnings that we don't know how to get
-; rid of.
-;
-; A more clever macro here would accept a condition and a list of forms.
+;; This lets us avoid compiling these replacement functions when emacs
+;; is sufficiently new enough to supply them alone. We do the macro
+;; treatment rather than just wrapping our defun calls in a when form
+;; specifically so that the compiler never sees the code on new emacs,
+;; (since the code is triggering warnings that we don't know how to get
+;; rid of.
+;;
+;; A more clever macro here would accept a condition and a list of forms.
 (defmacro compile-on-emacs-prior-to-23 (form)
   "Conditionally evaluate form only on emacs < emacs-23."
   (list 'when (< emacs-major-version 23)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1a250a3..ef3c076 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -124,14 +124,14 @@ indentation."
   "Use external viewers to view all attachments from the current message."
   (interactive)
   (with-current-notmuch-show-message
-   ; We override the mm-inline-media-tests to indicate which message
-   ; parts are already sufficiently handled by the original
-   ; presentation of the message in notmuch-show mode. These parts
-   ; will be inserted directly into the temporary buffer of
-   ; with-current-notmuch-show-message and silently discarded.
-   ;
-   ; Any MIME part not explicitly mentioned here will be handled by an
-   ; external viewer as configured in the various mailcap files.
+   ;; We override the mm-inline-media-tests to indicate which message
+   ;; parts are already sufficiently handled by the original
+   ;; presentation of the message in notmuch-show mode. These parts
+   ;; will be inserted directly into the temporary buffer of
+   ;; with-current-notmuch-show-message and silently discarded.
+   ;;
+   ;; Any MIME part not explicitly mentioned here will be handled by an
+   ;; external viewer as configured in the various mailcap files.
    (let ((mm-inline-media-tests '(
 				  ("text/.*" ignore identity)
 				  ("application/pgp-signature" ignore identity)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index ef4dcc7..8957de5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1,51 +1,51 @@
-; notmuch.el --- run notmuch within emacs
-;
-; Copyright © Carl Worth
-;
-; This file is part of Notmuch.
-;
-; Notmuch is free software: you can redistribute it and/or modify it
-; under the terms of the GNU General Public License as published by
-; the Free Software Foundation, either version 3 of the License, or
-; (at your option) any later version.
-;
-; Notmuch is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-; General Public License for more details.
-;
-; You should have received a copy of the GNU General Public License
-; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
-;
-; Authors: Carl Worth <cworth@cworth.org>
-
-; This is an emacs-based interface to the notmuch mail system.
-;
-; You will first need to have the notmuch program installed and have a
-; notmuch database built in order to use this. See
-; http://notmuchmail.org for details.
-;
-; To install this software, copy it to a directory that is on the
-; `load-path' variable within emacs (a good candidate is
-; /usr/local/share/emacs/site-lisp). If you are viewing this from the
-; notmuch source distribution then you can simply run:
-;
-;	sudo make install-emacs
-;
-; to install it.
-;
-; Then, to actually run it, add:
-;
-;	(require 'notmuch)
-;
-; to your ~/.emacs file, and then run "M-x notmuch" from within emacs,
-; or run:
-;
-;	emacs -f notmuch
-;
-; Have fun, and let us know if you have any comment, questions, or
-; kudos: Notmuch list <notmuch@notmuchmail.org> (subscription is not
-; required, but is available from http://notmuchmail.org).
+;; notmuch.el --- run notmuch within emacs
+;;
+;; Copyright © Carl Worth
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: Carl Worth <cworth@cworth.org>
+
+;; This is an emacs-based interface to the notmuch mail system.
+;;
+;; You will first need to have the notmuch program installed and have a
+;; notmuch database built in order to use this. See
+;; http://notmuchmail.org for details.
+;;
+;; To install this software, copy it to a directory that is on the
+;; `load-path' variable within emacs (a good candidate is
+;; /usr/local/share/emacs/site-lisp). If you are viewing this from the
+;; notmuch source distribution then you can simply run:
+;;
+;;	sudo make install-emacs
+;;
+;; to install it.
+;;
+;; Then, to actually run it, add:
+;;
+;;	(require 'notmuch)
+;;
+;; to your ~/.emacs file, and then run "M-x notmuch" from within emacs,
+;; or run:
+;;
+;;	emacs -f notmuch
+;;
+;; Have fun, and let us know if you have any comment, questions, or
+;; kudos: Notmuch list <notmuch@notmuchmail.org> (subscription is not
+;; required, but is available from http://notmuchmail.org).
 
 (eval-when-compile (require 'cl))
 (require 'mm-view)
@@ -139,10 +139,10 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."
 	"M-"
       (concat desc " "))))
 
-; I would think that emacs would have code handy for walking a keymap
-; and generating strings for each key, and I would prefer to just call
-; that. But I couldn't find any (could be all implemented in C I
-; suppose), so I wrote my own here.
+;; I would think that emacs would have code handy for walking a keymap
+;; and generating strings for each key, and I would prefer to just call
+;; that. But I couldn't find any (could be all implemented in C I
+;; suppose), so I wrote my own here.
 (defun notmuch-substitute-one-command-key-with-prefix (prefix binding)
   "For a key binding, return a string showing a human-readable
 representation of the prefixed key as well as the first line of
@@ -270,14 +270,14 @@ For a mouse binding, return nil."
 (defun notmuch-search-scroll-down ()
   "Move backward through the search results by one window's worth."
   (interactive)
-  ; I don't know why scroll-down doesn't signal beginning-of-buffer
-  ; the way that scroll-up signals end-of-buffer, but c'est la vie.
-  ;
-  ; So instead of trapping a signal we instead check whether the
-  ; window begins on the first line of the buffer and if so, move
-  ; directly to that position. (We have to count lines since the
-  ; window-start position is not the same as point-min due to the
-  ; invisible thread-ID characters on the first line.
+  ;; I don't know why scroll-down doesn't signal beginning-of-buffer
+  ;; the way that scroll-up signals end-of-buffer, but c'est la vie.
+  ;;
+  ;; So instead of trapping a signal we instead check whether the
+  ;; window begins on the first line of the buffer and if so, move
+  ;; directly to that position. (We have to count lines since the
+  ;; window-start position is not the same as point-min due to the
+  ;; invisible thread-ID characters on the first line.
   (if (equal (count-lines (point-min) (window-start)) 0)
       (goto-char (point-min))
     (scroll-down nil)))
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files
  2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
@ 2012-01-16  9:04           ` Tomi Ollila
  2012-01-17  4:32             ` Austin Clements
  2012-01-16  9:04           ` [PATCH 3/3] RFC: batch-tools.el Tomi Ollila
                             ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Tomi Ollila @ 2012-01-16  9:04 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

Run (whitespace-cleanup) and (indent-region (point-min) (point-max))
to all elisp files in emacs/ which:

  removed trailing whitespace and empty lines at the end of file
  removed spaces before tab (if any)
  converted 8 spaces to tabs in the beginning of line
  changed amount of whitespace in the beginning of lines
---
 emacs/coolj.el               |   16 ++--
 emacs/notmuch-address.el     |    2 +-
 emacs/notmuch-hello.el       |   40 +++++-----
 emacs/notmuch-lib.el         |    7 +-
 emacs/notmuch-maildir-fcc.el |   57 ++++++++--------
 emacs/notmuch-mua.el         |    2 +-
 emacs/notmuch-query.el       |    6 +-
 emacs/notmuch-show.el        |  158 +++++++++++++++++++++---------------------
 emacs/notmuch-wash.el        |    2 +-
 emacs/notmuch.el             |  110 +++++++++++++++---------------
 10 files changed, 199 insertions(+), 201 deletions(-)

diff --git a/emacs/coolj.el b/emacs/coolj.el
index 60af60a..173eb2f 100644
--- a/emacs/coolj.el
+++ b/emacs/coolj.el
@@ -108,11 +108,11 @@ If the line should not be broken, return nil; point remains on the
 line."
   (move-to-column fill-column)
   (if (and (re-search-forward "[^ ]" (line-end-position) 1)
-           (> (current-column) fill-column))
+	   (> (current-column) fill-column))
       ;; This line is too long.  Can we break it?
       (or (coolj-find-break-backward prefix)
-          (progn (move-to-column fill-column)
-                 (coolj-find-break-forward)))))
+	  (progn (move-to-column fill-column)
+		 (coolj-find-break-forward)))))
 
 (defun coolj-find-break-backward (prefix)
   "Move point backward to the first available breakpoint and return t.
@@ -135,11 +135,11 @@ If no breakpoint is found, return nil."
 If no break point is found, return nil."
   (and (search-forward " " (line-end-position) 1)
        (progn (skip-chars-forward " " (line-end-position))
-              (null (eolp)))
+	      (null (eolp)))
        (if (and fill-nobreak-predicate
-                (run-hook-with-args-until-success
-                 'fill-nobreak-predicate))
-           (coolj-find-break-forward)
-         t)))
+		(run-hook-with-args-until-success
+		 'fill-nobreak-predicate))
+	   (coolj-find-break-forward)
+	 t)))
 
 (provide 'coolj)
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 8eba7a0..d702d65 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -32,7 +32,7 @@ line."
 
 (defvar notmuch-address-message-alist-member
   '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
-	      . notmuch-address-expand-name))
+    . notmuch-address-expand-name))
 
 (defvar notmuch-address-history nil)
 
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 93e5032..31287a7 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -171,10 +171,10 @@ International Bureau of Weights and Measures."
       (setq n (/ n 1000)))
     (setq result (or result '(0)))
     (apply #'concat
-     (number-to-string (car result))
-     (mapcar (lambda (elem)
-	      (format "%s%03d" notmuch-hello-thousands-separator elem))
-	     (cdr result)))))
+	   (number-to-string (car result))
+	   (mapcar (lambda (elem)
+		     (format "%s%03d" notmuch-hello-thousands-separator elem))
+		   (cdr result)))))
 
 (defun notmuch-hello-trim (search)
   "Trim whitespace."
@@ -361,19 +361,19 @@ should be. Returns a cons cell `(tags-per-line width)'."
 (fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
 
 (defun notmuch-hello-mode ()
- "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
+  "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
 
 Complete list of currently available key bindings:
 
 \\{notmuch-hello-mode-map}"
- (interactive)
- (kill-all-local-variables)
- (use-local-map notmuch-hello-mode-map)
- (setq major-mode 'notmuch-hello-mode
-       mode-name "notmuch-hello")
- (run-mode-hooks 'notmuch-hello-mode-hook)
- ;;(setq buffer-read-only t)
-)
+  (interactive)
+  (kill-all-local-variables)
+  (use-local-map notmuch-hello-mode-map)
+  (setq major-mode 'notmuch-hello-mode
+	mode-name "notmuch-hello")
+  (run-mode-hooks 'notmuch-hello-mode-hook)
+  ;;(setq buffer-read-only t)
+  )
 
 (defun notmuch-hello-generate-tag-alist ()
   "Return an alist from tags to queries to display in the all-tags section."
@@ -402,19 +402,19 @@ Complete list of currently available key bindings:
   ;; Jump through a hoop to get this value from the deprecated variable
   ;; name (`notmuch-folders') or from the default value.
   (if (not notmuch-saved-searches)
-    (setq notmuch-saved-searches (notmuch-saved-searches)))
+      (setq notmuch-saved-searches (notmuch-saved-searches)))
 
   (if no-display
       (set-buffer "*notmuch-hello*")
     (switch-to-buffer "*notmuch-hello*"))
 
   (let ((target (if (widget-at)
-		   (widget-value (widget-at))
-		 (condition-case nil
-		     (progn
-		       (widget-forward 1)
-		       (widget-value (widget-at)))
-		   (error nil))))
+		    (widget-value (widget-at))
+		  (condition-case nil
+		      (progn
+			(widget-forward 1)
+			(widget-value (widget-at)))
+		    (error nil))))
 	(inhibit-read-only t))
 
     ;; Delete all editable widget fields.  Editable widget fields are
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 00ed589..7b63348 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -73,7 +73,7 @@ the user hasn't set this variable with the old or new value."
   ;; Trim off the trailing newline
   (substring (shell-command-to-string
 	      (concat notmuch-command " config get " item))
-	      0 -1))
+	     0 -1))
 
 (defun notmuch-database-path ()
   "Return the database.path value from the notmuch configuration."
@@ -110,7 +110,7 @@ the user hasn't set this variable with the old or new value."
   (let (out)
     (while list
       (when (funcall predicate (car list))
-        (push (car list) out))
+	(push (car list) out))
       (setq list (cdr list)))
     (nreverse out)))
 
@@ -143,7 +143,7 @@ The result is a new function which does the same as FUN, except that
 the first N arguments are fixed at the values with which this function
 was called."
    (lexical-let ((fun fun) (args1 args))
-     (lambda (&rest args2) (apply fun (append args1 args2))))))
+		(lambda (&rest args2) (apply fun (append args1 args2))))))
 
 (compile-on-emacs-prior-to-23
  (defun mouse-event-p (object)
@@ -156,4 +156,3 @@ was called."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 
 (provide 'notmuch-lib)
-
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 6fbf82d..707e5a2 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -24,7 +24,7 @@
 (defvar notmuch-maildir-fcc-count 0)
 
 (defcustom notmuch-fcc-dirs "sent"
- "Determines the maildir directory in which to save outgoing mail.
+  "Determines the maildir directory in which to save outgoing mail.
 
 Three types of values are permitted:
 
@@ -51,24 +51,24 @@ the database.path option in the notmuch configuration file).
 You will be prompted to create the directory if it does not exist
 yet when sending a mail."
 
- :require 'notmuch-fcc-initialization
- :group 'notmuch
- :type '(choice
-	 (const :tag "No FCC header" nil)
-	 (string :tag "A single folder")
-	 (repeat :tag "A folder based on the From header"
-		 (cons regexp (string :tag "Folder")))))
+  :require 'notmuch-fcc-initialization
+  :group 'notmuch
+  :type '(choice
+	  (const :tag "No FCC header" nil)
+	  (string :tag "A single folder")
+	  (repeat :tag "A folder based on the From header"
+		  (cons regexp (string :tag "Folder")))))
 
 (defun notmuch-fcc-initialization ()
   "If notmuch-fcc-directories is set,
    hook them into the message-fcc-handler-function"
-    ;; Set up the message-fcc-handler to move mails to the maildir in Fcc
-    ;; The parameter is set to mark messages as "seen"
-    (setq message-fcc-handler-function
-          (lambda (destdir)
-	    (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
-    ;; add a hook to actually insert the Fcc header when sending
-    (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))
+  ;; Set up the message-fcc-handler to move mails to the maildir in Fcc
+  ;; The parameter is set to mark messages as "seen"
+  (setq message-fcc-handler-function
+	(lambda (destdir)
+	  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
+  ;; add a hook to actually insert the Fcc header when sending
+  (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))
 
 (defun notmuch-fcc-header-setup ()
   "Add an Fcc header to the current message buffer.
@@ -116,7 +116,7 @@ will NOT be removed or replaced."
 		(if (= (elt subdir 0) ?/)
 		    subdir
 		  (concat (notmuch-database-path) "/" subdir)))))
-      
+
       ;; finally test if fcc points to a valid maildir
       (let ((fcc-header (message-field-value "Fcc")))
 	(unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
@@ -128,7 +128,7 @@ will NOT be removed or replaced."
 		 (notmuch-maildir-fcc-create-maildir fcc-header))
 		(t
 		 (error "Message not sent"))))))))
- 
+
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
 			    (lambda (s)
@@ -140,17 +140,17 @@ will NOT be removed or replaced."
 			    t))
 
 (defun notmuch-maildir-fcc-make-uniq-maildir-id ()
-   (let* ((ct (current-time))
-	  (timeid (+ (* (car ct) 65536) (cadr ct)))
-	  (microseconds (car (cdr (cdr ct))))
-	  (hostname (notmuch-maildir-fcc-host-fixer system-name)))
-     (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
-     (format "%d.%d_%d_%d.%s"
-	     timeid
-	     (emacs-pid)
-	     microseconds
-	     notmuch-maildir-fcc-count
-	     hostname)))
+  (let* ((ct (current-time))
+	 (timeid (+ (* (car ct) 65536) (cadr ct)))
+	 (microseconds (car (cdr (cdr ct))))
+	 (hostname (notmuch-maildir-fcc-host-fixer system-name)))
+    (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
+    (format "%d.%d_%d_%d.%s"
+	    timeid
+	    (emacs-pid)
+	    microseconds
+	    notmuch-maildir-fcc-count
+	    hostname)))
 
 (defun notmuch-maildir-fcc-dir-is-maildir-p (dir)
   (and (file-exists-p (concat dir "/cur/"))
@@ -216,4 +216,3 @@ return t if successful, and nil otherwise."
 
 (notmuch-fcc-initialization)
 (provide 'notmuch-maildir-fcc)
-
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index d8ab822..922fed1 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -109,7 +109,7 @@ list."
     ;; if one is present
     (goto-char (point-max))
     (if (re-search-backward message-signature-separator nil t)
-	  (forward-line -1)
+	(forward-line -1)
       (goto-char (point-max)))
     (insert body)
     (push-mark))
diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el
index d66baea..b5254a2 100644
--- a/emacs/notmuch-query.el
+++ b/emacs/notmuch-query.el
@@ -49,9 +49,9 @@ is a possibly empty forest of replies.
   "private function to do the actual mapping and flattening"
   (apply 'append
 	 (mapcar
-	   (lambda (tree)
-	     (funcall mapper function tree))
-	   seq)))
+	  (lambda (tree)
+	    (funcall mapper function tree))
+	  seq)))
 
 (defun notmuch-query-map-threads (fn threads)
   "apply FN to every thread in  THREADS. Flatten results to a list.
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ef3c076..8ea8df8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -115,9 +115,9 @@ indentation."
   `(save-excursion
      (let ((id (notmuch-show-get-message-id)))
        (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
-         (with-current-buffer buf
-	    (call-process notmuch-command nil t nil "show" "--format=raw" id)
-           ,@body)
+	 (with-current-buffer buf
+	   (call-process notmuch-command nil t nil "show" "--format=raw" id)
+	   ,@body)
 	 (kill-buffer buf)))))
 
 (defun notmuch-show-view-all-mime-parts ()
@@ -138,28 +138,28 @@ indentation."
 				  ("multipart/alternative" ignore identity)
 				  ("multipart/mixed" ignore identity)
 				  ("multipart/related" ignore identity)
-				 )))
+				  )))
      (mm-display-parts (mm-dissect-buffer)))))
 
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
-         (dolist (part (cdr mm-handle))
-           (notmuch-foreach-mime-part function part)))
-        ((bufferp (car mm-handle))
-         (funcall function mm-handle))
-        (t (dolist (part mm-handle)
-             (notmuch-foreach-mime-part function part)))))
+	 (dolist (part (cdr mm-handle))
+	   (notmuch-foreach-mime-part function part)))
+	((bufferp (car mm-handle))
+	 (funcall function mm-handle))
+	(t (dolist (part mm-handle)
+	     (notmuch-foreach-mime-part function part)))))
 
 (defun notmuch-count-attachments (mm-handle)
   (let ((count 0))
     (notmuch-foreach-mime-part
      (lambda (p)
        (let ((disposition (mm-handle-disposition p)))
-         (and (listp disposition)
-              (or (equal (car disposition) "attachment")
-                  (and (equal (car disposition) "inline")
-                       (assq 'filename disposition)))
-              (incf count))))
+	 (and (listp disposition)
+	      (or (equal (car disposition) "attachment")
+		  (and (equal (car disposition) "inline")
+		       (assq 'filename disposition)))
+	      (incf count))))
      mm-handle)
     count))
 
@@ -168,13 +168,13 @@ indentation."
    (lambda (p)
      (let ((disposition (mm-handle-disposition p)))
        (and (listp disposition)
-            (or (equal (car disposition) "attachment")
-                (and (equal (car disposition) "inline")
-                     (assq 'filename disposition)))
-            (or (not queryp)
-                (y-or-n-p
-                 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
-            (mm-save-part p))))
+	    (or (equal (car disposition) "attachment")
+		(and (equal (car disposition) "inline")
+		     (assq 'filename disposition)))
+	    (or (not queryp)
+		(y-or-n-p
+		 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
+	    (mm-save-part p))))
    mm-handle))
 
 (defun notmuch-show-save-attachments ()
@@ -227,21 +227,21 @@ indentation."
   "Try to clean a single email ADDRESS for display.  Return
 unchanged ADDRESS if parsing fails."
   (condition-case nil
-    (let* ((parsed (mail-header-parse-address address))
-	   (address (car parsed))
-	   (name (cdr parsed)))
-      ;; Remove double quotes. They might be required during transport,
-      ;; but we don't need to see them.
-      (when name
-        (setq name (replace-regexp-in-string "\"" "" name)))
-      ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
-      ;; 'foo@bar.com'.
-      (when (string= name address)
-        (setq name nil))
-
-      (if (not name)
-        address
-        (concat name " <" address ">")))
+      (let* ((parsed (mail-header-parse-address address))
+	     (address (car parsed))
+	     (name (cdr parsed)))
+	;; Remove double quotes. They might be required during transport,
+	;; but we don't need to see them.
+	(when name
+	  (setq name (replace-regexp-in-string "\"" "" name)))
+	;; If the address is 'foo@bar.com <foo@bar.com>' then show just
+	;; 'foo@bar.com'.
+	(when (string= name address)
+	  (setq name nil))
+
+	(if (not name)
+	    address
+	  (concat name " <" address ">")))
     (error address)))
 
 (defun notmuch-show-insert-headerline (headers date tags depth)
@@ -380,9 +380,9 @@ current buffer, if possible."
   "Instruct w3m how to retrieve content from a \"related\" part of a message."
   (interactive)
   (if (boundp 'w3m-cid-retrieve-function-alist)
-    (unless (assq 'notmuch-show-mode w3m-cid-retrieve-function-alist)
-      (push (cons 'notmuch-show-mode 'notmuch-show-w3m-cid-retrieve)
-	    w3m-cid-retrieve-function-alist)))
+      (unless (assq 'notmuch-show-mode w3m-cid-retrieve-function-alist)
+	(push (cons 'notmuch-show-mode 'notmuch-show-w3m-cid-retrieve)
+	      w3m-cid-retrieve-function-alist)))
   (setq mm-inline-text-html-with-images t))
 
 (defvar w3m-current-buffer) ;; From `w3m.el'.
@@ -752,7 +752,7 @@ current buffer, if possible."
     (put-text-property message-start message-end :notmuch-message-extent (cons message-start message-end))
 
     (let ((headers-overlay (make-overlay headers-start headers-end))
-          (invis-specs (list headers-invis-spec message-invis-spec)))
+	  (invis-specs (list headers-invis-spec message-invis-spec)))
       (overlay-put headers-overlay 'invisible invis-specs)
       (overlay-put headers-overlay 'priority 10))
     (overlay-put (make-overlay body-start body-end) 'invisible message-invis-spec)
@@ -919,39 +919,39 @@ thread id.  If a prefix is given, crypto processing is toggled."
 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
 
 (defvar notmuch-show-mode-map
-      (let ((map (make-sparse-keymap)))
-	(define-key map "?" 'notmuch-help)
-	(define-key map "q" 'notmuch-kill-this-buffer)
-	(define-key map (kbd "<C-tab>") 'widget-backward)
-	(define-key map (kbd "M-TAB") 'notmuch-show-previous-button)
-	(define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
-	(define-key map (kbd "TAB") 'notmuch-show-next-button)
-	(define-key map "s" 'notmuch-search)
-	(define-key map "m" 'notmuch-mua-new-mail)
-	(define-key map "f" 'notmuch-show-forward-message)
-	(define-key map "r" 'notmuch-show-reply-sender)
-	(define-key map "R" 'notmuch-show-reply)
-	(define-key map "|" 'notmuch-show-pipe-message)
-	(define-key map "w" 'notmuch-show-save-attachments)
-	(define-key map "V" 'notmuch-show-view-raw-message)
-	(define-key map "v" 'notmuch-show-view-all-mime-parts)
-	(define-key map "c" 'notmuch-show-stash-map)
-	(define-key map "=" 'notmuch-show-refresh-view)
-	(define-key map "h" 'notmuch-show-toggle-headers)
-	(define-key map "-" 'notmuch-show-remove-tag)
-	(define-key map "+" 'notmuch-show-add-tag)
-	(define-key map "x" 'notmuch-show-archive-thread-then-exit)
-	(define-key map "a" 'notmuch-show-archive-thread)
-	(define-key map "N" 'notmuch-show-next-message)
-	(define-key map "P" 'notmuch-show-previous-message)
-	(define-key map "n" 'notmuch-show-next-open-message)
-	(define-key map "p" 'notmuch-show-previous-open-message)
-	(define-key map (kbd "DEL") 'notmuch-show-rewind)
-	(define-key map " " 'notmuch-show-advance-and-archive)
-	(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
-	(define-key map (kbd "RET") 'notmuch-show-toggle-message)
-	map)
-      "Keymap for \"notmuch show\" buffers.")
+  (let ((map (make-sparse-keymap)))
+    (define-key map "?" 'notmuch-help)
+    (define-key map "q" 'notmuch-kill-this-buffer)
+    (define-key map (kbd "<C-tab>") 'widget-backward)
+    (define-key map (kbd "M-TAB") 'notmuch-show-previous-button)
+    (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
+    (define-key map (kbd "TAB") 'notmuch-show-next-button)
+    (define-key map "s" 'notmuch-search)
+    (define-key map "m" 'notmuch-mua-new-mail)
+    (define-key map "f" 'notmuch-show-forward-message)
+    (define-key map "r" 'notmuch-show-reply-sender)
+    (define-key map "R" 'notmuch-show-reply)
+    (define-key map "|" 'notmuch-show-pipe-message)
+    (define-key map "w" 'notmuch-show-save-attachments)
+    (define-key map "V" 'notmuch-show-view-raw-message)
+    (define-key map "v" 'notmuch-show-view-all-mime-parts)
+    (define-key map "c" 'notmuch-show-stash-map)
+    (define-key map "=" 'notmuch-show-refresh-view)
+    (define-key map "h" 'notmuch-show-toggle-headers)
+    (define-key map "-" 'notmuch-show-remove-tag)
+    (define-key map "+" 'notmuch-show-add-tag)
+    (define-key map "x" 'notmuch-show-archive-thread-then-exit)
+    (define-key map "a" 'notmuch-show-archive-thread)
+    (define-key map "N" 'notmuch-show-next-message)
+    (define-key map "P" 'notmuch-show-previous-message)
+    (define-key map "n" 'notmuch-show-next-open-message)
+    (define-key map "p" 'notmuch-show-previous-open-message)
+    (define-key map (kbd "DEL") 'notmuch-show-rewind)
+    (define-key map " " 'notmuch-show-advance-and-archive)
+    (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
+    (define-key map (kbd "RET") 'notmuch-show-toggle-message)
+    map)
+  "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
 
 (defun notmuch-show-mode ()
@@ -1214,9 +1214,9 @@ any effects from previous calls to
   (let ((start-of-message (notmuch-show-message-top))
 	(start-of-window (window-start)))
     (cond
-      ;; Either this message is properly aligned with the start of the
-      ;; window or the start of this message is not visible on the
-      ;; screen - scroll.
+     ;; Either this message is properly aligned with the start of the
+     ;; window or the start of this message is not visible on the
+     ;; screen - scroll.
      ((or (= start-of-message start-of-window)
 	  (< start-of-message start-of-window))
       (scroll-down)
@@ -1310,7 +1310,7 @@ than only the current message."
   (interactive "P\nsPipe message to command: ")
   (let (shell-command)
     (if entire-thread
-	(setq shell-command 
+	(setq shell-command
 	      (concat notmuch-command " show --format=mbox "
 		      (shell-quote-argument
 		       (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR "))
@@ -1338,7 +1338,7 @@ currently present and return the result."
     (mapc (lambda (add-tag)
 	    (unless (member add-tag current-tags)
 	      (setq result-tags (push add-tag result-tags))))
-	    add-tags)
+	  add-tags)
     (sort result-tags 'string<)))
 
 (defun notmuch-show-del-tags-worker (current-tags del-tags)
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 5c1e830..63172df 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -315,7 +315,7 @@ style prefix in SUBJECT, or nil if such a prefix can't be found."
   (when (string-match
 	 "^ *\\(\\[[^]]*\\] *\\)*\\[[^]]*?\\([0-9]+\\)/[0-9]+[^]]*\\].*"
 	 subject)
-      (string-to-number (substring subject (match-beginning 2) (match-end 2)))))
+    (string-to-number (substring subject (match-beginning 2) (match-end 2)))))
 
 (defun notmuch-wash-subject-to-patch-filename (subject)
   "Convert a patch mail SUBJECT into a filename.
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 8957de5..c94f522 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -84,23 +84,23 @@ For example:
 
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
-         (dolist (part (cdr mm-handle))
-           (notmuch-foreach-mime-part function part)))
-        ((bufferp (car mm-handle))
-         (funcall function mm-handle))
-        (t (dolist (part mm-handle)
-             (notmuch-foreach-mime-part function part)))))
+	 (dolist (part (cdr mm-handle))
+	   (notmuch-foreach-mime-part function part)))
+	((bufferp (car mm-handle))
+	 (funcall function mm-handle))
+	(t (dolist (part mm-handle)
+	     (notmuch-foreach-mime-part function part)))))
 
 (defun notmuch-count-attachments (mm-handle)
   (let ((count 0))
     (notmuch-foreach-mime-part
      (lambda (p)
        (let ((disposition (mm-handle-disposition p)))
-         (and (listp disposition)
-              (or (equal (car disposition) "attachment")
-                  (and (equal (car disposition) "inline")
-                       (assq 'filename disposition)))
-              (incf count))))
+	 (and (listp disposition)
+	      (or (equal (car disposition) "attachment")
+		  (and (equal (car disposition) "inline")
+		       (assq 'filename disposition)))
+	      (incf count))))
      mm-handle)
     count))
 
@@ -109,13 +109,13 @@ For example:
    (lambda (p)
      (let ((disposition (mm-handle-disposition p)))
        (and (listp disposition)
-            (or (equal (car disposition) "attachment")
-                (and (equal (car disposition) "inline")
-                     (assq 'filename disposition)))
-            (or (not queryp)
-                (y-or-n-p
-                 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
-            (mm-save-part p))))
+	    (or (equal (car disposition) "attachment")
+		(and (equal (car disposition) "inline")
+		     (assq 'filename disposition)))
+	    (or (not queryp)
+		(y-or-n-p
+		 (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
+	    (mm-save-part p))))
    mm-handle))
 
 (defun notmuch-documentation-first-line (symbol)
@@ -304,10 +304,10 @@ For a mouse binding, return nil."
   (goto-char (point-min)))
 
 (defface notmuch-message-summary-face
- '((((class color) (background light)) (:background "#f0f0f0"))
-   (((class color) (background dark)) (:background "#303030")))
- "Face for the single-line message summary in notmuch-show-mode."
- :group 'notmuch)
+  '((((class color) (background light)) (:background "#f0f0f0"))
+    (((class color) (background dark)) (:background "#303030")))
+  "Face for the single-line message summary in notmuch-show-mode."
+  :group 'notmuch)
 
 (defface notmuch-search-date
   '((t :inherit default))
@@ -467,7 +467,7 @@ Output from the process will be presented to the user as an error
 and will also appear in a buffer named \"*Notmuch errors*\"."
   (let ((error-buffer (get-buffer-create "*Notmuch errors*")))
     (with-current-buffer error-buffer
-	(erase-buffer))
+      (erase-buffer))
     (if (eq (apply 'call-process notmuch-command nil error-buffer nil args) 0)
 	(point)
       (progn
@@ -650,9 +650,9 @@ This function advances the next thread when finished."
 				 (not (string= notmuch-search-target-thread "found")))
 			    (set 'never-found-target-thread t))))))
 	      (when (and never-found-target-thread
-		       notmuch-search-target-line)
-		  (goto-char (point-min))
-		  (forward-line (1- notmuch-search-target-line))))))))
+			 notmuch-search-target-line)
+		(goto-char (point-min))
+		(forward-line (1- notmuch-search-target-line))))))))
 
 (defcustom notmuch-search-line-faces nil
   "Tag/face mapping for line highlighting in notmuch-search.
@@ -662,7 +662,7 @@ Here is an example of how to color search results based on tags.
 
  (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
 						  :background \"blue\"))
-                                   (\"unread\" . (:foreground \"green\"))))
+				   (\"unread\" . (:foreground \"green\"))))
 
 The attributes defined for matching tags are merged, with later
 attributes overriding earlier. A message having both \"delete\"
@@ -894,30 +894,30 @@ characters as well as `_.+-'.
 
 PROMPT is the string to prompt with."
   (lexical-let
-      ((completions
-	(append (list "folder:" "thread:" "id:" "date:" "from:" "to:"
-		      "subject:" "attachment:")
-		(mapcar (lambda (tag)
-			  (concat "tag:" tag))
-			(process-lines notmuch-command "search" "--output=tags" "*")))))
-    (let ((keymap (copy-keymap minibuffer-local-map))
-	  (minibuffer-completion-table
-	   (completion-table-dynamic
-	    (lambda (string)
-	      ;; generate a list of possible completions for the current input
-	      (cond
-	       ;; this ugly regexp is used to get the last word of the input
-	       ;; possibly preceded by a '('
-	       ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)
-		(mapcar (lambda (compl)
-			  (concat (match-string-no-properties 1 string) compl))
-			(all-completions (match-string-no-properties 2 string)
-					 completions)))
-	       (t (list string)))))))
-      ;; this was simpler than convincing completing-read to accept spaces:
-      (define-key keymap (kbd "<tab>") 'minibuffer-complete)
-      (read-from-minibuffer prompt nil keymap nil
-			    'notmuch-query-history nil nil))))
+   ((completions
+     (append (list "folder:" "thread:" "id:" "date:" "from:" "to:"
+		   "subject:" "attachment:")
+	     (mapcar (lambda (tag)
+		       (concat "tag:" tag))
+		     (process-lines notmuch-command "search" "--output=tags" "*")))))
+   (let ((keymap (copy-keymap minibuffer-local-map))
+	 (minibuffer-completion-table
+	  (completion-table-dynamic
+	   (lambda (string)
+	     ;; generate a list of possible completions for the current input
+	     (cond
+	      ;; this ugly regexp is used to get the last word of the input
+	      ;; possibly preceded by a '('
+	      ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)
+	       (mapcar (lambda (compl)
+			 (concat (match-string-no-properties 1 string) compl))
+		       (all-completions (match-string-no-properties 2 string)
+					completions)))
+	      (t (list string)))))))
+     ;; this was simpler than convincing completing-read to accept spaces:
+     (define-key keymap (kbd "<tab>") 'minibuffer-complete)
+     (read-from-minibuffer prompt nil keymap nil
+			   'notmuch-query-history nil nil))))
 
 ;;;###autoload
 (defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
@@ -927,9 +927,9 @@ The optional parameters are used as follows:
 
   oldest-first: A Boolean controlling the sort order of returned threads
   target-thread: A thread ID (with the thread: prefix) that will be made
-                 current if it appears in the search results.
+		 current if it appears in the search results.
   target-line: The line number to move to if the target thread does not
-               appear in the search results."
+	       appear in the search results."
   (interactive (list (notmuch-read-query "Notmuch search: ")))
   (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
     (switch-to-buffer buffer)
@@ -1094,8 +1094,8 @@ notmuch buffers exist, run `notmuch'."
 
     ;; Find the first notmuch buffer.
     (setq first (loop for buffer in (buffer-list)
-		     if (notmuch-interesting-buffer buffer)
-		     return buffer))
+		      if (notmuch-interesting-buffer buffer)
+		      return buffer))
 
     (if first
 	;; If the first one we found is any other than the starting
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] RFC: batch-tools.el
  2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
  2012-01-16  9:04           ` [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Tomi Ollila
@ 2012-01-16  9:04           ` Tomi Ollila
  2012-01-16  9:24           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix '; ' to two: '; ; ' David Edmondson
  2012-01-17  4:19           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Austin Clements
  3 siblings, 0 replies; 16+ messages in thread
From: Tomi Ollila @ 2012-01-16  9:04 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

---

emacs -q -batch -l ../contrib/batch-tools.el -f batch-whitespace-cleanup \
	with-indent *.el

was used to produce previous patch

 emacs/batch-tools.el |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 emacs/batch-tools.el

diff --git a/emacs/batch-tools.el b/emacs/batch-tools.el
new file mode 100644
index 0000000..e83f825
--- /dev/null
+++ b/contrib/batch-tools.el
@@ -0,0 +1,37 @@
+;;
+;; Use this code to clean whitespace in (and optionally reindent) files
+;;
+;; Usage: emacs -q -batch -l batch-tools.el \
+;;	-f batch-whitespace-cleanup [with-indent] files...
+
+;; Borrows code fron batch-byte-compile. License: GPL3+
+
+(defun batch-whitespace-cleanup ()
+  "Run 'whitespace-cleanup' on the files remaining on the command line.
+If first arg is 'with-indent' do indent-region over the whole file too.
+Use this from the command line, with `-batch';
+it won't work in an interactive Emacs."
+  ;; command-line-args-left is what is left of the command line (from startup.el)
+  ;;  (defvar command-line-args-left)       ;Avoid 'free variable' warning
+  (if (not noninteractive)
+      (error "'batch-whitespace-cleanup' is to be used only with -batch"))
+  (let (filename do-indent)
+    (if (string= (car command-line-args-left) "with-indent")
+	(setq do-indent t
+	      command-line-args-left (cdr command-line-args-left)))
+    (while command-line-args-left
+      (setq filename (expand-file-name (car command-line-args-left))
+	    command-line-args-left (cdr command-line-args-left))
+      (if (file-directory-p filename)
+	  ;; Directory as argument.
+	  (message (concat "Skipping directory '" filename "'"))
+	;; Specific file argument
+	(if (file-exists-p filename)
+	    (with-temp-buffer
+	      (message (concat "Loading file " filename "..."))
+	      (find-file filename)
+	      (whitespace-cleanup)
+	      (if do-indent
+		  (indent-region (point-min) (point-max)))
+	      (save-buffer))
+	  (message (concat "Skipping nonexisteng file '" filename "'")))))))
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] emacs/*.el: changed one-char comment prefix '; ' to two: '; ; '
  2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
  2012-01-16  9:04           ` [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Tomi Ollila
  2012-01-16  9:04           ` [PATCH 3/3] RFC: batch-tools.el Tomi Ollila
@ 2012-01-16  9:24           ` David Edmondson
  2012-01-17  4:19           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Austin Clements
  3 siblings, 0 replies; 16+ messages in thread
From: David Edmondson @ 2012-01-16  9:24 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: Tomi Ollila

[-- Attachment #1: Type: text/plain, Size: 25 bytes --]

+2 for the whole set :-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;'
  2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
                             ` (2 preceding siblings ...)
  2012-01-16  9:24           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix '; ' to two: '; ; ' David Edmondson
@ 2012-01-17  4:19           ` Austin Clements
  3 siblings, 0 replies; 16+ messages in thread
From: Austin Clements @ 2012-01-17  4:19 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

Quoth Tomi Ollila on Jan 16 at 11:04 am:
> In order for emacs (indent-region) to (re)indent emacs lisp
> properly there needs to be at least 2 comment characters (;;).
> ---
> 
> $ perl -ne 's/;;.*//; print $_ if /(^|[^;]);([^;]|$)/' *.el | less
> 
> shows that there is (only) need to change comments in the beginning
> of line...
> 
> $ perl -pi -e 's/^(\s*);([^;]|$)/$1;;$2/' *.el
> 
> did that change.

1/3 definitely LGTM.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files
  2012-01-16  9:04           ` [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Tomi Ollila
@ 2012-01-17  4:32             ` Austin Clements
  2012-01-17  6:17               ` Jameson Graef Rollins
  2012-01-17 10:46               ` Tomi Ollila
  0 siblings, 2 replies; 16+ messages in thread
From: Austin Clements @ 2012-01-17  4:32 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

Cleanup is the type of pain that should only be suffered once, so I'd
be much happier with this if there was an accompanying git hook that
prevented more mis-formatted code from slipping in.

Quoth Tomi Ollila on Jan 16 at 11:04 am:
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 00ed589..7b63348 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -143,7 +143,7 @@ The result is a new function which does the same as FUN, except that
>  the first N arguments are fixed at the values with which this function
>  was called."
>     (lexical-let ((fun fun) (args1 args))
> -     (lambda (&rest args2) (apply fun (append args1 args2))))))
> +		(lambda (&rest args2) (apply fun (append args1 args2))))))

Ack.  What happened here?  This shows up in at least one other place,
too.  I'm betting you need to load cl in some form to get the
indentation rule for lexical-let.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files
  2012-01-17  4:32             ` Austin Clements
@ 2012-01-17  6:17               ` Jameson Graef Rollins
  2012-01-17 10:46               ` Tomi Ollila
  1 sibling, 0 replies; 16+ messages in thread
From: Jameson Graef Rollins @ 2012-01-17  6:17 UTC (permalink / raw)
  To: Austin Clements, Tomi Ollila; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

On Mon, 16 Jan 2012 23:32:00 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> Cleanup is the type of pain that should only be suffered once, so I'd
> be much happier with this if there was an accompanying git hook that
> prevented more mis-formatted code from slipping in.

Agreed.  However, if we're really going to go down this pedantic route,
we need to make sure it is very easy for new contributors to know,
apply, and develop with these new rules.  Otherwise we're asking for a
lot more review churn on the list, and more frustration on the part of
potential contributors.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files
  2012-01-17  4:32             ` Austin Clements
  2012-01-17  6:17               ` Jameson Graef Rollins
@ 2012-01-17 10:46               ` Tomi Ollila
  2012-01-17 17:38                 ` Austin Clements
  1 sibling, 1 reply; 16+ messages in thread
From: Tomi Ollila @ 2012-01-17 10:46 UTC (permalink / raw)
  To: Austin Clements; +Cc: notmuch

On Mon, 16 Jan 2012 23:32:00 -0500, Austin Clements <amdragon@mit.edu> wrote:
> Cleanup is the type of pain that should only be suffered once, so I'd
> be much happier with this if there was an accompanying git hook that
> prevented more mis-formatted code from slipping in.

We'd need a script to be called from .git/hooks/pre-commit to do
extra checking; developer needs first activate this pre-commit
and then add call to our checking routine. Imagine the amount
of false positives this hook starts to generate...

... but. developer can run 'git commit --no-verify' ...aargh no;
I guess if pre-commit hook fails, commit-msg hook is not run
and this is bypassed; maybe NO_FORMATCHECK_HOOK=1 git commit ...
is the answer.

But what we at least need is Guidelines document that states 
these formatting issues clearly and precicely. Surely 
self-respecting programmers understands to follow there (and soon 
adjusts their workflow -- i.e. activate/run these checkers
after list response).

> Quoth Tomi Ollila on Jan 16 at 11:04 am:
> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> > index 00ed589..7b63348 100644
> > --- a/emacs/notmuch-lib.el
> > +++ b/emacs/notmuch-lib.el
> > @@ -143,7 +143,7 @@ The result is a new function which does the same as FUN, except that
> >  the first N arguments are fixed at the values with which this function
> >  was called."
> >     (lexical-let ((fun fun) (args1 args))
> > -     (lambda (&rest args2) (apply fun (append args1 args2))))))
> > +		(lambda (&rest args2) (apply fun (append args1 args2))))))
> 
> Ack.  What happened here?  This shows up in at least one other place,
> too.  I'm betting you need to load cl in some form to get the
> indentation rule for lexical-let.

Yes, thanks. (require 'cl) fixes that. I'll mark this and the RFC patch
(of batch-tools.el) obsolete. 

Tomi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files
  2012-01-17 10:46               ` Tomi Ollila
@ 2012-01-17 17:38                 ` Austin Clements
  0 siblings, 0 replies; 16+ messages in thread
From: Austin Clements @ 2012-01-17 17:38 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

Quoth Tomi Ollila on Jan 17 at 12:46 pm:
> On Mon, 16 Jan 2012 23:32:00 -0500, Austin Clements <amdragon@mit.edu> wrote:
> > Cleanup is the type of pain that should only be suffered once, so I'd
> > be much happier with this if there was an accompanying git hook that
> > prevented more mis-formatted code from slipping in.
> 
> We'd need a script to be called from .git/hooks/pre-commit to do
> extra checking; developer needs first activate this pre-commit
> and then add call to our checking routine. Imagine the amount
> of false positives this hook starts to generate...

It's unfortunate (but sensible) that git doesn't provide an automatic
way to set up verify scripts like this, but that doesn't mean we can't
make it easy.  Put a script in devel (or whatever it winds up being
called) that can be sourced from the pre-commit hook and then mention
this in HACKING.

Why it would generate false positives, assuming the cleanup goes in at
the same time the hook goes in (or the script is somehow clever enough
to only check changed lines)?

> ... but. developer can run 'git commit --no-verify' ...aargh no;
> I guess if pre-commit hook fails, commit-msg hook is not run
> and this is bypassed; maybe NO_FORMATCHECK_HOOK=1 git commit ...
> is the answer.

Maybe the script could generate a warning/prompt, rather than
preventing the commit altogether?

> But what we at least need is Guidelines document that states 
> these formatting issues clearly and precicely. Surely 
> self-respecting programmers understands to follow there (and soon 
> adjusts their workflow -- i.e. activate/run these checkers
> after list response).

I think the guidelines for elisp are pretty well known.  I agree that
we need such a document for the C/C++ code.  I started writing one a
while ago, but other things took over before I got very far.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-01-17 17:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11 15:13 [PATCH] emacs: whitespace-cleanup for emacs/*.el files Tomi Ollila
2012-01-12 22:07 ` Xavier Maillard
2012-01-13  8:22   ` David Edmondson
2012-01-13  9:50     ` Tomi Ollila
2012-01-13 16:22       ` David Edmondson
2012-01-16  9:04         ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Tomi Ollila
2012-01-16  9:04           ` [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Tomi Ollila
2012-01-17  4:32             ` Austin Clements
2012-01-17  6:17               ` Jameson Graef Rollins
2012-01-17 10:46               ` Tomi Ollila
2012-01-17 17:38                 ` Austin Clements
2012-01-16  9:04           ` [PATCH 3/3] RFC: batch-tools.el Tomi Ollila
2012-01-16  9:24           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix '; ' to two: '; ; ' David Edmondson
2012-01-17  4:19           ` [PATCH 1/3] emacs/*.el: changed one-char comment prefix ';' to two: ';;' Austin Clements
2012-01-13 22:27       ` [PATCH] emacs: whitespace-cleanup for emacs/*.el files Xavier Maillard
2012-01-14  1:26         ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).