jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
275 stars 58 forks source link

"Wrong number of arguments" error on sending a message #88

Closed DrMungo closed 3 years ago

DrMungo commented 3 years ago

Hello there, I've been using org-msg in conjunction with mu4e for a while, and am having a great time with it! Since approximately two months, I'm having problems though. Everytime I send a message, I get an exception (see the below debugger output for details). I've confirmed that this behaviour does not occur when using vanilla mu4e.

The result of this bug seems to be, that the raw org-mode message is always kept in the drafts folder, and not put into the sent folder. Also my drafts keep getting duplicated, but I'm not sure if this is related to org-msg as well, or an mbsync issue.

Thanks in advance for any insights!

Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (path maildir) "Add the message at PATH to the database.\nWith MAIL..." (mu4e~proc-send-command "cmd:sent path:%s maildir:%s" (mu4e~escape path) (mu4e~escape maildir))) 1)
  mu4e~proc-sent("/home/me/email/work/Drafts/cur/1615894599.503...")
  #f(compiled-function () #<bytecode 0xbd621c402602>)()
  run-hooks(message-sent-hook)
  message-send(nil)
  message-send-and-exit()
  apply(message-send-and-exit nil)
  org-msg-mua-call(send-and-exit message-send-and-exit)
  org-msg-ctrl-c-ctrl-c()
  run-hook-with-args-until-success(org-msg-ctrl-c-ctrl-c)
  (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful...")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively #'org-footnote-action)) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg ...) "[-]") ((and ... ...) "[ ]") ((or ... ...) nil) ((eq box ...) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg ...) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" ...)) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at ..." ...)))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc #'delete-overlay org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '...) (--markers\? 'use-markers) (--data (mapcar ... ...))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction ... ... ...))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond (... "[-]") (... ...) (... "[ ]") (t "[X]")))) (cond (arg (let (...) (while --dolist-tail-- ...))) ((and first-box (eq ... begin)) (org-list-set-checkbox begin struct new-box))) (if (equal (org-list-write-struct struct (org-list-parents-alist struct) old-struct) old-struct) (progn (message "Cannot update this checkbox"))) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively #'org-property-action)) ((eq type 'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type 'statistics-cookie) (call-interactively #'org-update-statistics-cookies)) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to ...")) (if (or (eq type 'table) (and (eq type ...) (= ... ...))) (save-excursion (if (org-at-TBLFM-p) (progn ... ...) (goto-char ...) (org-call-with-arg ... ...) (orgtbl-send-table ...))) (org-table-maybe-eval-formula) (cond (arg (call-interactively ...)) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful..."))))) ((null type) (cond ((org-at-heading-p) (call-interactively #'org-set-tags-command)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))
  (let* ((pcase-2 #'(lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) (pcase-1 #'(lambda nil)) (pcase-0 #'(lambda nil (org-timestamp-change 0 'day)))) (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively #'org-footnote-action)) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg ...) "[-]") ((and ... ...) "[ ]") ((or ... ...) nil) ((eq box ...) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg ...) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" ...)) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at line %..." ...)))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc #'delete-overlay org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '...) (--markers\? 'use-markers) (--data (mapcar ... ...))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction ... ... ...))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond (... "[-]") (... ...) (... "[ ]") (t "[X]")))) (cond (arg (let (...) (while --dolist-tail-- ...))) ((and first-box (eq ... begin)) (org-list-set-checkbox begin struct new-box))) (if (equal (org-list-write-struct struct (org-list-parents-alist struct) old-struct) old-struct) (progn (message "Cannot update this checkbox"))) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively #'org-property-action)) ((eq type 'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type 'statistics-cookie) (call-interactively #'org-update-statistics-cookies)) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit t...")) (if (or (eq type 'table) (and (eq type ...) (= ... ...))) (save-excursion (if (org-at-TBLFM-p) (progn ... ...) (goto-char ...) (org-call-with-arg ... ...) (orgtbl-send-table ...))) (org-table-maybe-eval-formula) (cond (arg (call-interactively ...)) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively #'org-set-tags-command)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2))))
  (let* ((context (org-element-lineage (org-element-context) '(babel-call clock dynamic-block footnote-definition footnote-reference inline-babel-call inline-src-block inlinetask item keyword node-property paragraph plain-list planning property-drawer radio-target src-block statistics-cookie table table-cell table-row timestamp) t)) (type (org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent (org-element-property :parent context))) (if (and (eq (org-element-type parent) 'item) (= (line-beginning-position) (org-element-property :begin parent))) (progn (setq context parent) (setq type 'item)))))) (let* ((pcase-2 #'(lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) (pcase-1 #'(lambda nil)) (pcase-0 #'(lambda nil (org-timestamp-change 0 'day)))) (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively #'org-footnote-action)) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil ...))) (org-list-set-checkbox (org-element-property :begin context) struct (cond (... "[-]") (... "[ ]") (... nil) (... "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item ...)) (if (and box ...) (if ... ... ...) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn ...))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc ... org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types ...) (--markers\? ...) (--data ...)) (unwind-protect (progn ...) (save-excursion ...)))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion ... ... ...)) (new-box (cond ... ... ... ...))) (cond (arg (let ... ...)) ((and first-box ...) (org-list-set-checkbox begin struct new-box))) (if (equal (org-list-write-struct struct ... old-struct) old-struct) (progn (message "Cannot update this checkbox"))) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively #'org-property-action)) ((eq type 'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type 'statistics-cookie) (call-interactively #'org-update-statistics-cookies)) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit t...")) (if (or (eq type ...) (and ... ...)) (save-excursion (if ... ... ... ... ...)) (org-table-maybe-eval-formula) (cond (arg ...) (...) (t ...))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively #'org-set-tags-command)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))))
  (cond ((or (and (boundp 'org-clock-overlays) org-clock-overlays) org-occur-highlights) (if (boundp 'org-clock-overlays) (progn (org-clock-remove-overlays))) (org-remove-occur-highlights) (message "Temporary highlights/overlays removed from current...")) ((and (local-variable-p 'org-finish-function) (fboundp org-finish-function)) (funcall org-finish-function)) ((org-babel-hash-at-point)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) (t (let* ((context (org-element-lineage (org-element-context) '(babel-call clock dynamic-block footnote-definition footnote-reference inline-babel-call inline-src-block inlinetask item keyword node-property paragraph plain-list planning property-drawer radio-target src-block statistics-cookie table table-cell table-row timestamp) t)) (type (org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent ...)) (if (and ... ...) (progn ... ...))))) (let* ((pcase-2 #'(lambda nil ...)) (pcase-1 #'(lambda nil)) (pcase-0 #'(lambda nil ...))) (cond ((memq type '...) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg ...))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success ...) (user-error ...))) ((memq type '...) (let (...) (if info ...))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char ...) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively #'org-footnote-action)) ((memq type '...) (save-excursion (goto-char ...) (call-interactively ...))) ((eq type 'item) (let* (... ... ... ... ... ...) (org-list-set-checkbox ... struct ...) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ... ... ...))) ((eq type 'keyword) (let (... ...) (if ... ...) (let* ... ...)) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* (... ... ... ... ...) (cond ... ...) (if ... ...) (org-update-checkbox-count-maybe))) ((memq type '...) (call-interactively #'org-property-action)) ((eq type 'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type 'statistics-cookie) (call-interactively #'org-update-statistics-cookies)) ((memq type '...) (if (eq ... ...) (message "%s" ...) (if ... ... ... ...))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond (... ...) (... nil) (t ...))) ((null type) (cond (... ...) (... ...) (t ...))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))))))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)
rajames commented 3 years ago

I was having the same issue and oddly enough manually creating the .attachments folder in my Maildir root (e.g. ~/Maildir/.attachments) solved the issue. I came to this because when I ran org-msg-preview it complained about not finding the .attachments directory.

DrMungo commented 3 years ago

Thanks for sharing @rajames! I tried your suggestion, but to no avail - the behaviour is still the same.

rajames commented 3 years ago

Hi @DrMungo another thing I did was upgrade mu. I'm on version 1.4.15. Then re-running:

mu init -m ~/Maildir --my-address=emai1@address.com --my-address=email2@address.com ..
mu index

The above assumes you have multiple email addresses. However mu init -m ~/Maildir could be just as sufficient.. Can you try that?

Another thing does org-msg-preview command work for you?

DrMungo commented 3 years ago

Hi @rajames, that seems to have done the trick! I compiled the 1.4.15 from source, reindexed and now the error is gone.

org-msg-preview strangely always worked for me, with and without the mentioned .attachments folder.

Thank you very much for your input!

rajames commented 3 years ago

I'm glad to have helped.

DrMungo commented 3 years ago

I'm closing the issue, because it has been resolved. Thanks again (: