There was some discussion on irc about splitting the very large show.el file into a show part and a render part. I already had some code which did this so am posting for discussion. It needs some slight polishing (eg show-display.el should probably be called render.el)
Note it (probably) does not apply to current master: it is based on commit 2cbd68de92e032302a8fc65a6620adb1fc5ba1ae. The split is quite clear: there is essentially only one entry point into render from show which is notmuch-show-insert-forest. The only thing that render needs that is perhaps more natural in show are the visibility functions. As the patches are very large here is a list of the functions which move to render: (defun notmuch-show-fontify-header () (defun notmuch-show-colour-headers () (defun notmuch-show-spaces-n (n) (defun notmuch-clean-address (address) (defun notmuch-show-clean-address (address) (defun notmuch-show-insert-headerline (headers date tags depth) (defun notmuch-show-insert-header (header header-value) (defun notmuch-show-insert-headers (headers) (defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment) (defun notmuch-show-toggle-part-invisibility (&optional button) (defun notmuch-show-multipart/*-to-list (part) (defun notmuch-show-insert-part-multipart/alternative (msg part content-type nth depth declared-type) (defun notmuch-show-setup-w3m () (defun notmuch-show-w3m-cid-store-internal (content-id (defun notmuch-show-w3m-cid-store (msg part) (defun notmuch-show-w3m-cid-retrieve (url &rest args) (defun notmuch-show-insert-part-multipart/related (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-text/calendar (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth declared-type) (defun notmuch-show-get-mime-type-of-application/octet-stream (part) (defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-text/html (msg part content-type nth depth declared-type) (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type) (defun notmuch-show-handlers-for (content-type) (defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth declared-type) (defun notmuch-show-create-part-overlays (msg beg end hide) (defun notmuch-show-insert-bodypart (msg part depth &optional hide) (defun notmuch-show-insert-body (msg body depth) (defun notmuch-show-strip-re (string) (defun notmuch-show-insert-msg (msg depth) (defun notmuch-show-insert-tree (tree depth) (defun notmuch-show-insert-thread (thread depth) (defun notmuch-show-insert-forest (forest) (defun notmuch-show-message-visible (props visible-p) (defun notmuch-show-headers-visible (props visible-p) And here is the list of functions remaining in show (defun notmuch-show-turn-on-visual-line-mode () (defun notmuch-show-view-all-mime-parts () (defun notmuch-foreach-mime-part (function mm-handle) (defun notmuch-count-attachments (mm-handle) (defun notmuch-save-attachments (mm-handle &optional queryp) (defun notmuch-show-save-attachments () (defun notmuch-show-with-message-as-text (fn) (defun notmuch-show-print-message () (defun notmuch-show-update-tags (tags) (defun notmuch-show-save-part (message-id nth &optional filename content-type) (defun notmuch-show-view-part (message-id nth &optional filename content-type ) (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type) (defun notmuch-show-pipe-part (message-id nth &optional filename content-type) (defun notmuch-show-make-symbol (type) (defun notmuch-show-toggle-process-crypto () (defun notmuch-show-toggle-elide-non-matching () (defun notmuch-show-toggle-thread-indentation () (defun notmuch-show-buttonise-links (start end) (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name) (defun notmuch-show-build-buffer () (defun notmuch-show-capture-state () (defun notmuch-show-apply-state (state) (defun notmuch-show-refresh-view (&optional reset-state) (defun notmuch-show-mode () (defun notmuch-show-move-to-message-top () (defun notmuch-show-move-to-message-bottom () (defun notmuch-show-message-adjust () (defun notmuch-show-message-extent () (defun notmuch-show-message-top () (defun notmuch-show-message-bottom () (defun notmuch-show-goto-message-next () (defun notmuch-show-goto-message-previous () (defun notmuch-show-mapc (function) (defun notmuch-show-set-message-properties (props) (defun notmuch-show-get-message-properties () (defun notmuch-show-set-prop (prop val &optional props) (defun notmuch-show-get-prop (prop &optional props) (defun notmuch-show-get-message-id (&optional bare) (defun notmuch-show-get-messages-ids () (defun notmuch-show-get-messages-ids-search () (defun notmuch-show-get-filename () (defun notmuch-show-get-header (header &optional props) (defun notmuch-show-get-cc () (defun notmuch-show-get-date () (defun notmuch-show-get-from () (defun notmuch-show-get-subject () (defun notmuch-show-get-to () (defun notmuch-show-get-depth () (defun notmuch-show-set-tags (tags) (defun notmuch-show-get-tags () (defun notmuch-show-message-visible-p () (defun notmuch-show-headers-visible-p () (defun notmuch-show-mark-read (&optional unread) (defun notmuch-show-get-message-ids-for-open-messages () (defun notmuch-show-advance () (defun notmuch-show-advance-and-archive () (defun notmuch-show-rewind () (defun notmuch-show-reply (&optional prompt-for-sender) (defun notmuch-show-reply-sender (&optional prompt-for-sender) (defun notmuch-show-forward-message (&optional prompt-for-sender) (defun notmuch-show-next-message (&optional pop-at-end) (defun notmuch-show-previous-message () (defun notmuch-show-next-open-message (&optional pop-at-end) (defun notmuch-show-next-matching-message () (defun notmuch-show-open-if-matched () (defun notmuch-show-goto-first-wanted-message () (defun notmuch-show-previous-open-message () (defun notmuch-show-view-raw-message () (defun notmuch-show-pipe-message (entire-thread command) (defun notmuch-show-tag-message (&rest tag-changes) (defun notmuch-show-tag (&optional tag-changes) (defun notmuch-show-tag-all (&optional tag-changes) (defun notmuch-show-add-tag () (defun notmuch-show-remove-tag () (defun notmuch-show-toggle-visibility-headers () (defun notmuch-show-toggle-message () (defun notmuch-show-open-or-close-all () (defun notmuch-show-next-button () (defun notmuch-show-previous-button () (defun notmuch-show-next-thread (&optional show previous) (defun notmuch-show-next-thread-show () (defun notmuch-show-previous-thread-show () (defun notmuch-show-archive-thread (&optional unarchive) (defun notmuch-show-archive-thread-then-next () (defun notmuch-show-archive-thread-then-exit () (defun notmuch-show-archive-message (&optional unarchive) (defun notmuch-show-archive-message-then-next-or-exit () (defun notmuch-show-archive-message-then-next-or-next-thread () (defun notmuch-show-stash-cc () (defun notmuch-show-stash-date () (defun notmuch-show-stash-filename () (defun notmuch-show-stash-from () (defun notmuch-show-stash-message-id (&optional stash-thread-id) (defun notmuch-show-stash-message-id-stripped () (defun notmuch-show-stash-subject () (defun notmuch-show-stash-tags () (defun notmuch-show-stash-to () (defun notmuch-show-stash-mlarchive-link (&optional mla) (defun notmuch-show-stash-mlarchive-link-and-go (&optional mla) (defun notmuch-show-part-button-default (&optional button) (defun notmuch-show-part-button-save (&optional button) (defun notmuch-show-part-button-view (&optional button) (defun notmuch-show-part-button-interactively-view (&optional button) (defun notmuch-show-part-button-pipe (&optional button) (defun notmuch-show-part-button-internal (button handler) Best wishes Mark Mark Walters (2): initialnullsplit insert forest moved emacs/Makefile.local | 1 + emacs/notmuch-show-display.el | 727 +++++++++++++++++++++++++++++++++++++++++ emacs/notmuch-show-lib.el | 27 ++ emacs/notmuch-show.el | 693 +--------------------------------------- 4 files changed, 756 insertions(+), 692 deletions(-) create mode 100644 emacs/notmuch-show-display.el create mode 100644 emacs/notmuch-show-lib.el -- 1.7.9.1