lokedhs / gnus-outlook-style

Outlook style quoting for Gnus and mu4e
18 stars 3 forks source link

Error while sending non-reply message #6

Closed mgalgs closed 9 years ago

mgalgs commented 9 years ago

When I compose a new message in gnus (using m from the *Group* buffer (which is bound to gnus-group-mail)) I'm unable to send the message (using C-c C-c (which is bound to message-send-and-exit)). The send process errors out with let: Symbol's value as variable is void: outlook-style-local-yank.

Here's the full backtrace:

Debugger entered--Lisp error: (void-variable outlook-style-local-yank)
  (let ((ref outlook-style-local-yank)) (let ((G94746 (make-temp-file "email-new"))) (let ((new-message G94746)) (unwind-protect (let ((G94747 (make-temp-file "email-old"))) (let ((old-message G94747)) (unwind-protect (progn ... ... ...) (delete-file G94747)))) (delete-file G94746)))))
  (let ((processed-results (outlook-style--remove-and-get-inline-mail-content new-content))) (let ((ref outlook-style-local-yank)) (let ((G94746 (make-temp-file "email-new"))) (let ((new-message G94746)) (unwind-protect (let ((G94747 ...)) (let (...) (unwind-protect ... ...))) (delete-file G94746))))))
  outlook-style--generate-quoted-html(#("Just testing some stuff.\n\n\n" 0 24 (fontified nil) 24 25 (fontified nil) 25 26 (fontified nil) 26 27 (fontified nil)))
  (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content))
  (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results))
  (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))
  (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)))
  (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))))
  (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old ... ...))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)))))
  (if (search-forward-regexp (concat "^" (regexp-quote outlook-style-conf-start) "$") nil t) (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results ...)) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))))))
  (save-excursion (message-goto-body) (if (search-forward-regexp (concat "^" (regexp-quote outlook-style-conf-start) "$") nil t) (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test ...)) (include-old (find "quote_history" options :test ...)) (new-content (buffer-substring ... start-of-settings)) (old-content (buffer-substring end-of-settings ...))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let (...) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)))))))
  outlook-style--call-muse-for-message()
  run-hooks(message-send-hook)
  message-send(nil)
  message-send-and-exit(nil)
  call-interactively(message-send-and-exit nil nil)
  command-execute(message-send-and-exit)

BTW, thank you very much for writing this package. Replies work great!

lokedhs commented 9 years ago

That's strange. This works well for me. When looking at the code flow, the only way this could have happened is if the "quote_history" option is set in the parameter block of the message you send.

However, when writing a new message, that option should never even be there. Can you show me the content of the parameter block when writing a new message? It should look like this:

============ Outlook style settings ============ This mail buffer is configured to use the outlook-style package. Lines below beginning with ## indicates enabled options. The name of the option follows immediately after the option prefix. Any words after the option names are ignored. Any line in this block that does not start with ## is also ignored.

format_muse Format the email content using Muse markup

============ End of settings ============

On 22 May 2015 at 03:14, Mitchel Humpherys notifications@github.com wrote:

When I compose a new message in gnus (using m from the Group buffer (which is bound to gnus-group-mail)) I'm unable to send the message (using C-c C-c (which is bound to message-send-and-exit)). The send process errors out with let: Symbol's value as variable is void: outlook-style-local-yank.

Here's the full backtrace:

Debugger entered--Lisp error: (void-variable outlook-style-local-yank) (let ((ref outlook-style-local-yank)) (let ((G94746 (make-temp-file "email-new"))) (let ((new-message G94746)) (unwind-protect (let ((G94747 (make-temp-file "email-old"))) (let ((old-message G94747)) (unwind-protect (progn ... ... ...) (delete-file G94747)))) (delete-file G94746))))) (let ((processed-results (outlook-style--remove-and-get-inline-mail-content new-content))) (let ((ref outlook-style-local-yank)) (let ((G94746 (make-temp-file "email-new"))) (let ((new-message G94746)) (unwind-protect (let ((G94747 ...)) (let (...) (unwind-protect ... ...))) (delete-file G94746)))))) outlook-style--generate-quoted-html(#("Just testing some stuff.\n\n\n" 0 24 (fontified nil) 24 25 (fontified nil) 25 26 (fontified nil) 26 27 (fontified nil))) (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)) (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old (outlook-style--generate-quoted-html new-content) (outlook-style--simple-muse-message new-content)))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)))) (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results (if include-old ... ...))) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))))) (if (search-forward-regexp (concat "^" (regexp-quote outlook-style-conf-start) "$") nil t) (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test (function equal))) (include-old (find "quote_history" options :test (function equal))) (new-content (buffer-substring (outlook-style--mail-body-start-point) start-of-settings)) (old-content (buffer-substring end-of-settings (point-max)))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let ((processed-results ...)) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings)))))) (save-excursion (message-goto-body) (if (search-forward-regexp (concat "^" (regexp-quote outlook-style-conf-start) "$") nil t) (progn (forward-line 0) (let ((start-of-settings (point)) (end-of-settings (outlook-style--find-end-of-settings))) (forward-line 1) (let* ((options (outlook-style--find-all-options-from-config end-of-settings)) (format-muse (find "format_muse" options :test ...)) (include-old (find "quote_history" options :test ...)) (new-content (buffer-substring ... start-of-settings)) (old-content (buffer-substring end-of-settings ...))) (if (and (not format-muse) include-old) (progn (error "The old email chain can only be included when 'format_muse' is enabled."))) (if format-muse (let (...) (outlook-style--prepare-buffer-for-submit new-content old-content processed-results)) (delete-region start-of-settings end-of-settings))))))) outlook-style--call-muse-for-message() run-hooks(message-send-hook) message-send(nil) message-send-and-exit(nil) call-interactively(message-send-and-exit nil nil) command-execute(message-send-and-exit)

BTW, thank you very much for writing this package. Replies work great!

— Reply to this email directly or view it on GitHub https://github.com/lokedhs/gnus-outlook-style/issues/6.

mgalgs commented 9 years ago

So it turns out that this is caused by having a signature. This reproduces the issue:

(setq gnus-posting-styles                                                                                                 
      '((".*"                                                                                                             
         (signature "Mitch"))))

Removing that makes things happy.

I started trying to think about a better way of detecting replyp in outlook-style--gnus-prepare but realized that more work would need to be done to support signatures anyways since the signature ends up below the settings block, so it seems to get stripped from the message. So for now I'm just living with not having a sig :)

lokedhs commented 9 years ago

I have a signature, but I add it like this:

(defun em-outlook-style-init ()
  (save-excursion
    (message-goto-body)
    (insert "\n\nMy signature here")))

(add-hook 'outlook-style-init-hook 'em-outlook-style-init)
mgalgs commented 9 years ago

Ah and I presume it's registered as an outlook-style-init-hook?

lokedhs commented 9 years ago

Yes, as you can see in my updated message. :-)

mgalgs commented 9 years ago

Works for me, thanks!