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
276 stars 57 forks source link

"wrong-number-of-arguments (2 . 2) 4" on creating an email #138

Open husainaloos opened 2 years ago

husainaloos commented 2 years ago

I use mu4e. Whenever I press "c" to create an email, I get the following error message:

Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 4)
  #f(compiled-function (var val) "Set variable VAR to value VAL in current buffer." #<bytecode 0x1a5eb7>)(kill-buffer-hook (quote org-msg-kill-buffer) org-link-file-path-type (quote absolute))
  (setq-local kill-buffer-hook (quote org-msg-kill-buffer) org-link-file-path-type (quote absolute))
  (let ((delay-mode-hooks t)) (org-mode) (setq major-mode (quote org-msg-edit-mode)) (setq mode-name "OrgMsg") (progn (if (get (quote org-mode) (quote mode-class)) (put (quote org-msg-edit-mode) (quote mode-class) (get (quote org-mode) (quote mode-class)))) (unless (keymap-parent org-msg-edit-mode-map) (set-keymap-parent org-msg-edit-mode-map (current-local-map))) (let ((parent (char-table-parent org-msg-edit-mode-syntax-table))) (unless (and parent (not (eq parent (standard-syntax-table)))) (set-char-table-parent org-msg-edit-mode-syntax-table (syntax-table)))) (unless (or (abbrev-table-get org-msg-edit-mode-abbrev-table :parents) (eq org-msg-edit-mode-abbrev-table local-abbrev-table)) (abbrev-table-put org-msg-edit-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map org-msg-edit-mode-map) (set-syntax-table org-msg-edit-mode-syntax-table) (setq local-abbrev-table org-msg-edit-mode-abbrev-table) (setq-local message-sent-message-via nil) (add-hook (quote message-send-hook) (quote org-msg-prepare-to-send) nil t) (add-hook (quote message-sent-hook) (quote undo) t t) (add-hook (quote completion-at-point-functions) (quote message-completion-function) nil t) (cond ((message-mail-alias-type-p (quote abbrev)) (mail-abbrevs-setup)) ((message-mail-alias-type-p (quote ecomplete)) (ecomplete-setup))) (setq org-font-lock-keywords (append message-font-lock-keywords org-font-lock-keywords gnus-message-citation-keywords org-msg-font-lock-keywords)) (toggle-truncate-lines) (org-msg-mua-call (quote edit-mode)) (setq-local kill-buffer-hook (quote org-msg-kill-buffer) org-link-file-path-type (quote absolute)) (when (featurep (quote dnd)) (setq-local dnd-protocol-alist (append org-msg-dnd-protocol-alist dnd-protocol-alist))) (unless (= (org-msg-end) (point-max)) (add-text-properties (1- (org-msg-end)) (point-max) (quote (read-only t)))))
  (progn (make-local-variable (quote delay-mode-hooks)) (let ((delay-mode-hooks t)) (org-mode) (setq major-mode (quote org-msg-edit-mode)) (setq mode-name "OrgMsg") (progn (if (get (quote org-mode) (quote mode-class)) (put (quote org-msg-edit-mode) (quote mode-class) (get (quote org-mode) (quote mode-class)))) (unless (keymap-parent org-msg-edit-mode-map) (set-keymap-parent org-msg-edit-mode-map (current-local-map))) (let ((parent (char-table-parent org-msg-edit-mode-syntax-table))) (unless (and parent (not (eq parent ...))) (set-char-table-parent org-msg-edit-mode-syntax-table (syntax-table)))) (unless (or (abbrev-table-get org-msg-edit-mode-abbrev-table :parents) (eq org-msg-edit-mode-abbrev-table local-abbrev-table)) (abbrev-table-put org-msg-edit-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map org-msg-edit-mode-map) (set-syntax-table org-msg-edit-mode-syntax-table) (setq local-abbrev-table org-msg-edit-mode-abbrev-table) (setq-local message-sent-message-via nil) (add-hook (quote message-send-hook) (quote org-msg-prepare-to-send) nil t) (add-hook (quote message-sent-hook) (quote undo) t t) (add-hook (quote completion-at-point-functions) (quote message-completion-function) nil t) (cond ((message-mail-alias-type-p (quote abbrev)) (mail-abbrevs-setup)) ((message-mail-alias-type-p (quote ecomplete)) (ecomplete-setup))) (setq org-font-lock-keywords (append message-font-lock-keywords org-font-lock-keywords gnus-message-citation-keywords org-msg-font-lock-keywords)) (toggle-truncate-lines) (org-msg-mua-call (quote edit-mode)) (setq-local kill-buffer-hook (quote org-msg-kill-buffer) org-link-file-path-type (quote absolute)) (when (featurep (quote dnd)) (setq-local dnd-protocol-alist (append org-msg-dnd-protocol-alist dnd-protocol-alist))) (unless (= (org-msg-end) (point-max)) (add-text-properties (1- (org-msg-end)) (point-max) (quote (read-only t))))))
  (delay-mode-hooks (org-mode) (setq major-mode (quote org-msg-edit-mode)) (setq mode-name "OrgMsg") (progn (if (get (quote org-mode) (quote mode-class)) (put (quote org-msg-edit-mode) (quote mode-class) (get (quote org-mode) (quote mode-class)))) (unless (keymap-parent org-msg-edit-mode-map) (set-keymap-parent org-msg-edit-mode-map (current-local-map))) (let ((parent (char-table-parent org-msg-edit-mode-syntax-table))) (unless (and parent (not (eq parent (standard-syntax-table)))) (set-char-table-parent org-msg-edit-mode-syntax-table (syntax-table)))) (unless (or (abbrev-table-get org-msg-edit-mode-abbrev-table :parents) (eq org-msg-edit-mode-abbrev-table local-abbrev-table)) (abbrev-table-put org-msg-edit-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map org-msg-edit-mode-map) (set-syntax-table org-msg-edit-mode-syntax-table) (setq local-abbrev-table org-msg-edit-mode-abbrev-table) (setq-local message-sent-message-via nil) (add-hook (quote message-send-hook) (quote org-msg-prepare-to-send) nil t) (add-hook (quote message-sent-hook) (quote undo) t t) (add-hook (quote completion-at-point-functions) (quote message-completion-function) nil t) (cond ((message-mail-alias-type-p (quote abbrev)) (mail-abbrevs-setup)) ((message-mail-alias-type-p (quote ecomplete)) (ecomplete-setup))) (setq org-font-lock-keywords (append message-font-lock-keywords org-font-lock-keywords gnus-message-citation-keywords org-msg-font-lock-keywords)) (toggle-truncate-lines) (org-msg-mua-call (quote edit-mode)) (setq-local kill-buffer-hook (quote org-msg-kill-buffer) org-link-file-path-type (quote absolute)) (when (featurep (quote dnd)) (setq-local dnd-protocol-alist (append org-msg-dnd-protocol-alist dnd-protocol-alist))) (unless (= (org-msg-end) (point-max)) (add-text-properties (1- (org-msg-end)) (point-max) (quote (read-only t)))))
  org-msg-edit-mode()
  (let ((\.style (cdr (assq (quote style) alist))) (\.greeting-fmt (cdr (assq (quote greeting-fmt) alist))) (\.signature (cdr (assq (quote signature) alist)))) (insert (org-msg-header (if (eq \.style (quote top-posting)) (progn (org-msg-mua-call (quote save-article-for-reply)))) alternatives)) (if \.greeting-fmt (progn (insert (format \.greeting-fmt (if (eq type (quote new)) "" (concat " " (org-msg-get-to-name))))))) (if (eq \.style (quote top-posting)) (progn (save-excursion (insert "\n\n" org-msg-separator "\n") (delete-region (line-beginning-position) (1+ (line-end-position))) (let ((--dolist-tail-- (quote ...))) (while --dolist-tail-- (let (...) (save-excursion ...) (setq --dolist-tail-- ...)))) (org-escape-code-in-region (point) (point-max))))) (if \.signature (progn (if (eq \.style (quote top-posting)) nil (goto-char (point-max))) (insert \.signature))) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode))
  (let ((alist (org-msg-composition-parameters type alternatives))) (let ((\.style (cdr (assq (quote style) alist))) (\.greeting-fmt (cdr (assq (quote greeting-fmt) alist))) (\.signature (cdr (assq (quote signature) alist)))) (insert (org-msg-header (if (eq \.style (quote top-posting)) (progn (org-msg-mua-call (quote save-article-for-reply)))) alternatives)) (if \.greeting-fmt (progn (insert (format \.greeting-fmt (if (eq type ...) "" (concat " " ...)))))) (if (eq \.style (quote top-posting)) (progn (save-excursion (insert "\n\n" org-msg-separator "\n") (delete-region (line-beginning-position) (1+ (line-end-position))) (let ((--dolist-tail-- ...)) (while --dolist-tail-- (let ... ... ...))) (org-escape-code-in-region (point) (point-max))))) (if \.signature (progn (if (eq \.style (quote top-posting)) nil (goto-char (point-max))) (insert \.signature))) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode)))
  (progn (let ((alist (org-msg-composition-parameters type alternatives))) (let ((\.style (cdr (assq (quote style) alist))) (\.greeting-fmt (cdr (assq (quote greeting-fmt) alist))) (\.signature (cdr (assq (quote signature) alist)))) (insert (org-msg-header (if (eq \.style (quote top-posting)) (progn (org-msg-mua-call ...))) alternatives)) (if \.greeting-fmt (progn (insert (format \.greeting-fmt (if ... "" ...))))) (if (eq \.style (quote top-posting)) (progn (save-excursion (insert "\n\n" org-msg-separator "\n") (delete-region (line-beginning-position) (1+ ...)) (let (...) (while --dolist-tail-- ...)) (org-escape-code-in-region (point) (point-max))))) (if \.signature (progn (if (eq \.style (quote top-posting)) nil (goto-char (point-max))) (insert \.signature))) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode))) (set-buffer-modified-p nil))
  (if alternatives (progn (let ((alist (org-msg-composition-parameters type alternatives))) (let ((\.style (cdr (assq ... alist))) (\.greeting-fmt (cdr (assq ... alist))) (\.signature (cdr (assq ... alist)))) (insert (org-msg-header (if (eq \.style ...) (progn ...)) alternatives)) (if \.greeting-fmt (progn (insert (format \.greeting-fmt ...)))) (if (eq \.style (quote top-posting)) (progn (save-excursion (insert "\n\n" org-msg-separator "\n") (delete-region ... ...) (let ... ...) (org-escape-code-in-region ... ...)))) (if \.signature (progn (if (eq \.style ...) nil (goto-char ...)) (insert \.signature))) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode))) (set-buffer-modified-p nil)))
  (let* ((type (cond ((not (org-msg-message-fetch-field "subject")) (quote new)) ((org-msg-mua-call (quote article-htmlp)) (quote reply-to-html)) ((quote reply-to-text)))) (alternatives (org-msg-get-alternatives type))) (if alternatives (progn (let ((alist (org-msg-composition-parameters type alternatives))) (let ((\.style (cdr ...)) (\.greeting-fmt (cdr ...)) (\.signature (cdr ...))) (insert (org-msg-header (if ... ...) alternatives)) (if \.greeting-fmt (progn (insert ...))) (if (eq \.style (quote top-posting)) (progn (save-excursion ... ... ... ...))) (if \.signature (progn (if ... nil ...) (insert \.signature))) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode))) (set-buffer-modified-p nil))))
  (if (eq major-mode (quote org-msg-edit-mode)) nil (message-goto-body) (let* ((type (cond ((not (org-msg-message-fetch-field "subject")) (quote new)) ((org-msg-mua-call (quote article-htmlp)) (quote reply-to-html)) ((quote reply-to-text)))) (alternatives (org-msg-get-alternatives type))) (if alternatives (progn (let ((alist (org-msg-composition-parameters type alternatives))) (let ((\.style ...) (\.greeting-fmt ...) (\.signature ...)) (insert (org-msg-header ... alternatives)) (if \.greeting-fmt (progn ...)) (if (eq \.style ...) (progn ...)) (if \.signature (progn ... ...)) (if (org-msg-message-fetch-field "to") (org-msg-goto-body) (message-goto-to)) (org-msg-edit-mode))) (set-buffer-modified-p nil)))))
  org-msg-post-setup()
  run-hooks(change-major-mode-after-body-hook text-mode-hook message-mode-hook mu4e-compose-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook text-mode-hook message-mode-hook mu4e-compose-mode-hook))
  run-mode-hooks(mu4e-compose-mode-hook)
  mu4e-compose-mode()
  mu4e~compose-handler(new)
  mu4e-compose(new)
  mu4e-compose-new()
  funcall-interactively(mu4e-compose-new)
  call-interactively(mu4e-compose-new nil nil)
  command-execute(mu4e-compose-new)

I am not familiar with elisp enough to be able to debug it easily, but it seems that it is pointing to the line (add-hook 'completion-at-point-functions 'message-completion-function nil t) in define-derived-mode org-msg-edit-mode org-mode... line.

I use org-msg-20210916.1114 with emacs 26.3

husainaloos commented 2 years ago

I am noticing a similar issue when I installed org-msg.

Warning (bytecomp): Unused lexical variable ‘notmuch-show-only-matching-messages’
Warning (bytecomp): reference to free variable ‘mu4e-compose-parent-message’
Warning (bytecomp): Unused lexical variable ‘notmuch-show-only-matching-messages’
Warning (bytecomp): reference to free variable ‘mu4e-compose-complete-addresses’
Warning (bytecomp): reference to free variable ‘mu4e-compose-type’
Warning (bytecomp): assignment to free variable ‘mu4e-sent-func’
Error (bytecomp): Wrong number of arguments: (2 . 2), 4

I have mu4e v 1.6.6

jeremy-compostella commented 2 years ago

I believe this issue is caused by the use of Emacs 26.3 where setq-local is limited to one variable at a time. You have two options:

  1. you update to Emacs >= 27.1
  2. you change the unique setq-local instruction which set both kill-buffer-hook and org-link-file-path-type variable with two setq-local instructions