emacs: globally replace non-branching "(if COND (progn ..." with "(when ..."

Less code, same results, without sacrificing readability.
This commit is contained in:
Pieter Praet 2012-02-01 14:50:00 +01:00 committed by David Bremner
parent 7cd907b69c
commit 2dcd1e7234
3 changed files with 40 additions and 44 deletions

View file

@ -1364,11 +1364,10 @@ any effects from previous calls to
;; If a small number of lines from the previous message are
;; visible, realign so that the top of the current message is at
;; the top of the screen.
(if (<= (count-screen-lines (window-start) start-of-message)
(when (<= (count-screen-lines (window-start) start-of-message)
next-screen-context-lines)
(progn
(goto-char (notmuch-show-message-top))
(notmuch-show-message-adjust)))
(notmuch-show-message-adjust))
;; Move to the top left of the window.
(goto-char (window-start)))
(t

View file

@ -336,8 +336,7 @@ patch and then guesses the extent of the patch, there is scope
for error."
(goto-char (point-min))
(if (re-search-forward diff-file-header-re nil t)
(progn
(when (re-search-forward diff-file-header-re nil t)
(beginning-of-line -1)
(let ((patch-start (point))
(patch-end (point-max))
@ -359,7 +358,7 @@ for error."
(plist-get
(plist-get msg :headers) :Subject))))
(delete-region (point-min) (point-max))
(notmuch-show-insert-bodypart nil part depth))))))
(notmuch-show-insert-bodypart nil part depth)))))
;;

View file

@ -673,8 +673,7 @@ This function advances the next thread when finished."
(goto-char (point-max))
(if (eq status 'signal)
(insert "Incomplete search results (search process was killed).\n"))
(if (eq status 'exit)
(progn
(when (eq status 'exit)
(if notmuch-search-process-filter-data
(insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
(insert "End of search results.")
@ -683,7 +682,7 @@ This function advances the next thread when finished."
(insert "\n")
(if (and atbob
(not (string= notmuch-search-target-thread "found")))
(set 'never-found-target-thread t))))))
(set 'never-found-target-thread t)))))
(when (and never-found-target-thread
notmuch-search-target-line)
(goto-char (point-min))
@ -861,10 +860,9 @@ non-authors is found, assume that all of the authors match."
(put-text-property beg (point) 'notmuch-search-thread-id thread-id)
(put-text-property beg (point) 'notmuch-search-authors authors)
(put-text-property beg (point) 'notmuch-search-subject subject)
(if (string= thread-id notmuch-search-target-thread)
(progn
(when (string= thread-id notmuch-search-target-thread)
(set 'found-target beg)
(set 'notmuch-search-target-thread "found"))))
(set 'notmuch-search-target-thread "found")))
(set 'line (match-end 0)))
(set 'more nil)
(while (and (< line (length string)) (= (elt string line) ?\n))