This is a substantially reworked version of id:1369555061-21361-1-git-send-email-markwalters1009@gmail.com attempting to answer the (very constructive) criticism of Austin. The changes are: move the insert-part-header call from the insert-part-text/plain function to insert-bodypart in line with all the other part insertion functions. The other change in patch 2 is that we no longer need to pass declared-type down to the part insertion functions so we remove this argument. The actual invisibility code has been substantially reworked. There were two main aims: to remove the insertion of dummy text and to make sure that toggling a lazy-part which cannot be rendered automatically calls the default action for such a part (e.g. saving or viewing). I have split this code into 3 pieces: two pieces of simple code movement as preparation and then the new code to do the actual lazy part handling. All tests pass and everything I can think of to try works (viewing pdf, lazy rendered html, lazy rendered pdf, toggling all types, repeated toggling) but there are a lot of cases so testing is especially helpful. Best wishes Mark Mark Walters (5): emacs: show: fake wash parts are handled at insert-bodypart level emacs: show: move the insertion of the header button to the top level emacs: show: pass button to create-overlays emacs: show: modify the way hidden state is recorded. emacs: show: implement lazy hidden part handling emacs/notmuch-show.el | 183 +++++++++++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 76 deletions(-) -- 1.7.10.4