From b31ba3dd814c7dc962e570c8618d193474d4c1ca Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 3 Jul 2016 23:29:05 +0300 Subject: [PATCH] mu4e: seems the keymaps might not be defined (workaround) Users were seeing: ,---- | Debugger entered--Lisp error: (wrong-type-argument keymapp nil) | signal(wrong-type-argument (keymapp nil)) | define-key-after(nil [mu4e-hard-newlines] (menu-item "Format=flowed" | mu4e-toggle-use-hard-newlines :button (:toggle . use-hard-newlines) :help | "Toggle format=flowed" :visible (eq major-mode (quote mu4e-compose-mode)) | :enable mu4e-compose-format-flowed) sep) | mu4e-compose-mode() | byte-code("..." [original-msg mu4e-compose-parent-message | mu4e-compose-context-policy winconf includes att make-local-variable put | permanent-local t mu4e~context-autoswitch run-hooks mu4e-compose-pre-hook | current-window-configuration nil (mu4e-draft-open compose-type | original-msg) ((quit (byte-code "..." [winconf set-window-configuration | mu4e-message "Operation aborted" throw --cl-block-mu4e~compose-handler-- | nil] 3))) mu4e~draft-insert-mail-header-separator mml-attach-file plist-get | :file-name :mime-type mu4e~compose-set-friendly-buffer-name | set-buffer-modified-p (new forward) message-goto-to message-goto-body | mu4e~compose-type mu4e~compose-hide-headers mu4e-compose-mode delete-frame | --dolist-tail-- compose-type mu4e-compose-in-new-frame message-exit-actions | message-postpone-actions] 6) | mu4e~compose-handler(new) | mu4e-compose(new) | mu4e-compose-new() `---- --- mu4e/mu4e-compose.el | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index ddc70f97..2958208a 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -387,24 +387,26 @@ simply executes `fill-paragraph'." '(left-curly-arrow right-curly-arrow)) (visual-line-mode t)) - (define-key-after - (lookup-key message-mode-map [menu-bar text]) - [mu4e-hard-newlines] - '(menu-item "Format=flowed" mu4e-toggle-use-hard-newlines - :button (:toggle . use-hard-newlines) - :help "Toggle format=flowed" - :visible (eq major-mode 'mu4e-compose-mode) - :enable mu4e-compose-format-flowed) - 'sep) + (when (lookup-key message-mode-map [menu-bar text]) + (define-key-after + (lookup-key message-mode-map [menu-bar text]) + [mu4e-hard-newlines] + '(menu-item "Format=flowed" mu4e-toggle-use-hard-newlines + :button (:toggle . use-hard-newlines) + :help "Toggle format=flowed" + :visible (eq major-mode 'mu4e-compose-mode) + :enable mu4e-compose-format-flowed) + 'sep)) - (define-key-after - (lookup-key mml-mode-map [menu-bar Attachments]) - [mu4e-compose-attach-captured-message] - '(menu-item "Attach captured message" - mu4e-compose-attach-captured-message - :help "Attach message captured in Headers View (with 'a c')" - :visible (eq major-mode 'mu4e-compose-mode)) - (quote Attach\ External...)) + (when (lookup-key mml-mode-map [menu-bar Attachments]) + (define-key-after + (lookup-key mml-mode-map [menu-bar Attachments]) + [mu4e-compose-attach-captured-message] + '(menu-item "Attach captured message" + mu4e-compose-attach-captured-message + :help "Attach message captured in Headers View (with 'a c')" + :visible (eq major-mode 'mu4e-compose-mode)) + (quote Attach\ External...))) ;; setup the fcc-stuff, if needed (add-hook 'message-send-hook