Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 22A81429E30 for ; Mon, 16 Jan 2012 01:04:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z+mMWhKe37qs for ; Mon, 16 Jan 2012 01:04:23 -0800 (PST) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 3609A431FC0 for ; Mon, 16 Jan 2012 01:04:23 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id 03E8E68056; Mon, 16 Jan 2012 11:04:27 +0200 (EET) From: Tomi Ollila To: Subject: [PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files Date: Mon, 16 Jan 2012 11:04:15 +0200 Message-Id: <1326704656-26102-2-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <1326704656-26102-1-git-send-email-tomi.ollila@iki.fi> References: <1326704656-26102-1-git-send-email-tomi.ollila@iki.fi> Cc: Tomi Ollila X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 09:04:27 -0000 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 ' 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 ' 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 "") 'widget-backward) - (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) - (define-key map (kbd "") '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 "") 'widget-backward) + (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) + (define-key map (kbd "") '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 "") '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 "") '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