[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Can't email multipart/alternative anymore
From: |
Aaron Ecay |
Subject: |
Re: [O] Can't email multipart/alternative anymore |
Date: |
Fri, 23 Oct 2015 14:05:24 +0100 |
User-agent: |
Notmuch/0.20.2+65~gbd5504e (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-unknown-linux-gnu) |
Hi Peter,
2015ko urriak 23an, Peter Davis-ek idatzi zuen:
>
> Nick Dokos <address@hidden> writes:
>
>> Maybe set debug-on-error and try again - send the backtrace if
>> you get one. Or maybe try with -q, load a minimal .emacs with
>> org and org-mime and try that.
>
> Here's the output from toggling debug-on-error:
Based on the backtrace, I think that if you do M-x load-library RET
ox-org RET your error should disappear.
If that’s the cause, the attached (draft) patch should give a better
error message in cases like this.
>From 4c1b170e181982fb453b87921b39ace474482040 Mon Sep 17 00:00:00 2001
From: Aaron Ecay <address@hidden>
Date: Fri, 23 Oct 2015 13:48:31 +0100
Subject: [PATCH] Improve invalid export backend error messages.
* lisp/ox.el (org-export-get-backend): Add `strict' argument.
(org-export-derived-backend-p, org-export-get-all-transcoders):
(org-export-get-all-filters, org-export-data-with-backend):
(org-export-as, org-export-insert-default-template):
(org-export-with-backend): Use it.
(org-export-barf-if-invalid-backend): Remove function.
---
lisp/ox.el | 90 +++++++++++++++++++++++++++++---------------------------------
1 file changed, 42 insertions(+), 48 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 80cbc37..d68cc3c 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -947,13 +947,18 @@ mode."
(:copier nil))
name parent transcoders options filters blocks menu)
-(defun org-export-get-backend (name)
+(defun org-export-get-backend (name &optional strict)
"Return export back-end named after NAME.
-NAME is a symbol. Return nil if no such back-end is found."
+
+NAME is a symbol. Return nil if no such back-end is found, or
+signal an error if STRICT is non-nil."
(catch 'found
(dolist (b org-export-registered-backends)
(when (eq (org-export-backend-name b) name)
- (throw 'found b)))))
+ (throw 'found b)))
+ (when strict
+ (error "Could not locate export backend %s; try loading the library
`ox-%s'"
+ name name))))
(defun org-export-register-backend (backend)
"Register BACKEND as a known export back-end.
@@ -976,25 +981,19 @@ BACKEND is a structure with `org-export-backend' type."
(if old (setcar (memq old org-export-registered-backends) backend)
(push backend org-export-registered-backends))))
-(defun org-export-barf-if-invalid-backend (backend)
- "Signal an error if BACKEND isn't defined."
- (unless (org-export-backend-p backend)
- (error "Unknown \"%s\" back-end: Aborting export" backend)))
-
(defun org-export-derived-backend-p (backend &rest backends)
"Non-nil if BACKEND is derived from one of BACKENDS.
BACKEND is an export back-end, as returned by, e.g.,
`org-export-create-backend', or a symbol referring to
a registered back-end. BACKENDS is constituted of symbols."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (when backend
- (catch 'exit
- (while (org-export-backend-parent backend)
- (when (memq (org-export-backend-name backend) backends)
- (throw 'exit t))
- (setq backend
- (org-export-get-backend (org-export-backend-parent backend))))
- (memq (org-export-backend-name backend) backends))))
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
+ (catch 'exit
+ (while (org-export-backend-parent backend)
+ (when (memq (org-export-backend-name backend) backends)
+ (throw 'exit t))
+ (setq backend
+ (org-export-get-backend (org-export-backend-parent backend))))
+ (memq (org-export-backend-name backend) backends)))
(defun org-export-get-all-transcoders (backend)
"Return full translation table for BACKEND.
@@ -1007,15 +1006,14 @@ transcoders.
Unlike to `org-export-backend-transcoders', this function
also returns transcoders inherited from parent back-ends,
if any."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (when backend
- (let ((transcoders (org-export-backend-transcoders backend))
- parent)
- (while (setq parent (org-export-backend-parent backend))
- (setq backend (org-export-get-backend parent))
- (setq transcoders
- (append transcoders (org-export-backend-transcoders backend))))
- transcoders)))
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
+ (let ((transcoders (org-export-backend-transcoders backend))
+ parent)
+ (while (setq parent (org-export-backend-parent backend))
+ (setq backend (org-export-get-backend parent))
+ (setq transcoders
+ (append transcoders (org-export-backend-transcoders backend))))
+ transcoders))
(defun org-export-get-all-options (backend)
"Return export options for BACKEND.
@@ -1026,14 +1024,13 @@ for the shape of the return value.
Unlike to `org-export-backend-options', this function also
returns options inherited from parent back-ends, if any."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (when backend
- (let ((options (org-export-backend-options backend))
- parent)
- (while (setq parent (org-export-backend-parent backend))
- (setq backend (org-export-get-backend parent))
- (setq options (append options (org-export-backend-options backend))))
- options)))
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
+ (let ((options (org-export-backend-options backend))
+ parent)
+ (while (setq parent (org-export-backend-parent backend))
+ (setq backend (org-export-get-backend parent))
+ (setq options (append options (org-export-backend-options backend))))
+ options))
(defun org-export-get-all-filters (backend)
"Return complete list of filters for BACKEND.
@@ -1044,14 +1041,13 @@ keys are symbols and values lists of functions.
Unlike to `org-export-backend-filters', this function also
returns filters inherited from parent back-ends, if any."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (when backend
- (let ((filters (org-export-backend-filters backend))
- parent)
- (while (setq parent (org-export-backend-parent backend))
- (setq backend (org-export-get-backend parent))
- (setq filters (append filters (org-export-backend-filters backend))))
- filters)))
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
+ (let ((filters (org-export-backend-filters backend))
+ parent)
+ (while (setq parent (org-export-backend-parent backend))
+ (setq backend (org-export-get-backend parent))
+ (setq filters (append filters (org-export-backend-filters backend))))
+ filters))
(defun org-export-define-backend (backend transcoders &rest body)
"Define a new back-end BACKEND.
@@ -1983,7 +1979,7 @@ channel.
Unlike to `org-export-with-backend', this function will
recursively convert DATA using BACKEND translation table."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
(org-export-data
data
;; Set-up a new communication channel with translations defined in
@@ -2930,8 +2926,7 @@ with external parameters overriding Org default settings,
but
still inferior to file-local settings.
Return code as a string."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (org-export-barf-if-invalid-backend backend)
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
(save-excursion
(save-restriction
;; Narrow buffer to an appropriate region or subtree for
@@ -3130,7 +3125,7 @@ locally for the subtree through node properties."
((org-export-backend-p backend)
(org-export-backend-options backend))
(t (org-export-backend-options
- (org-export-get-backend backend)))))
+ (org-export-get-backend backend t)))))
(let ((keyword (nth 1 entry))
(option (nth 2 entry)))
(cond
@@ -3620,8 +3615,7 @@ a registered back-end. DATA is an Org element, object,
secondary
string or string. CONTENTS, when non-nil, is the transcoded
contents of DATA element, as a string. INFO, when non-nil, is
the communication channel used for export, as a plist."
- (when (symbolp backend) (setq backend (org-export-get-backend backend)))
- (org-export-barf-if-invalid-backend backend)
+ (when (symbolp backend) (setq backend (org-export-get-backend backend t)))
(let ((type (org-element-type data)))
(if (memq type '(nil org-data)) (error "No foreign transcoder available")
(let* ((all-transcoders (org-export-get-all-transcoders backend))
--
2.6.1
--
Aaron Ecay
- [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/22
- Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/23
- Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/23
- Re: [O] Can't email multipart/alternative anymore,
Aaron Ecay <=
- Re: [O] Can't email multipart/alternative anymore, Nicolas Goaziou, 2015/10/23
- Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/23
- Re: [O] Can't email multipart/alternative anymore, Nicolas Goaziou, 2015/10/24
- Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/24
- Re: [O] Can't email multipart/alternative anymore, Nicolas Goaziou, 2015/10/24
- Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/28
- Re: [O] Can't email multipart/alternative anymore, Aaron Ecay, 2015/10/27
Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/23
Re: [O] Can't email multipart/alternative anymore, Peter Davis, 2015/10/28