* replace letf with cl-letf in org-mime
@ 2015-03-22 13:56 Eric Abrahamsen
2015-03-22 14:16 ` Nicolas Goaziou
0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2015-03-22 13:56 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 64 bytes --]
It's amazing what an effect barky compiler errors can have.
E
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-cl-flet-rather-than-plain-flet.patch --]
[-- Type: text/x-diff, Size: 1975 bytes --]
From 0bba16a7419d32ecc25ccdf422c9d0e129d0b547 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Sun, 22 Mar 2015 21:39:57 +0800
Subject: [PATCH] Use `cl-flet' rather than plain `flet'
* contrib/lisp/org-mime.el (org-mime-send-subtree, org-mime-compose):
The compiler complains otherwise.
---
contrib/lisp/org-mime.el | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index f341474..9f18dc6 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -252,7 +252,7 @@ export that region, otherwise export the entire body."
(save-restriction
(org-narrow-to-subtree)
(run-hooks 'org-mime-send-subtree-hook)
- (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
+ (cl-flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
(let* ((file (buffer-file-name (current-buffer)))
(subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
(to (mp "MAIL_TO"))
@@ -287,17 +287,17 @@ export that region, otherwise export the entire body."
(require 'message)
(message-mail to subject headers nil)
(message-goto-body)
- (flet ((bhook (body fmt)
- (let ((hook (intern (concat "org-mime-pre-"
- (symbol-name fmt)
- "-hook"))))
- (if (> (eval `(length ,hook)) 0)
- (with-temp-buffer
- (insert body)
- (goto-char (point-min))
- (eval `(run-hooks ',hook))
- (buffer-string))
- body))))
+ (cl-flet ((bhook (body fmt)
+ (let ((hook (intern (concat "org-mime-pre-"
+ (symbol-name fmt)
+ "-hook"))))
+ (if (> (eval `(length ,hook)) 0)
+ (with-temp-buffer
+ (insert body)
+ (goto-char (point-min))
+ (eval `(run-hooks ',hook))
+ (buffer-string))
+ body))))
(let ((fmt (if (symbolp fmt) fmt (intern fmt))))
(cond
((eq fmt 'org)
--
2.3.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-03-22 13:56 replace letf with cl-letf in org-mime Eric Abrahamsen
@ 2015-03-22 14:16 ` Nicolas Goaziou
2015-03-22 14:30 ` Eric Abrahamsen
2015-03-30 8:34 ` Eric Abrahamsen
0 siblings, 2 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2015-03-22 14:16 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hello,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> It's amazing what an effect barky compiler errors can have.
Thanks. However, `cl-flet' is not supported in Emacs 23 so it's not an
option for Org 8.3.
OTOH, most uses of `flet' can be replaced with a plain `lambda' and
funcalls.
> - (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
> + (cl-flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
> (let* ((file (buffer-file-name (current-buffer)))
> (subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
> (to (mp "MAIL_TO"))
(let* ((mp (lambda (p) (org-entry-get nil p org-mime-use-property-inheritance))))
(file (buffer-file-name (current-buffer)))
(subject (or (funcall mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
(to (funcall mp "MAIL_TO"))
...)
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-03-22 14:16 ` Nicolas Goaziou
@ 2015-03-22 14:30 ` Eric Abrahamsen
2015-03-30 8:34 ` Eric Abrahamsen
1 sibling, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2015-03-22 14:30 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> It's amazing what an effect barky compiler errors can have.
>
> Thanks. However, `cl-flet' is not supported in Emacs 23 so it's not an
> option for Org 8.3.
Oh, okay -- I guess I'd never really been aware of what Emacs version we
were maintaining compatibility with. That's good to know. I'll do
another version of this in the morning.
> OTOH, most uses of `flet' can be replaced with a plain `lambda' and
> funcalls.
>
>> - (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
>> + (cl-flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
>> (let* ((file (buffer-file-name (current-buffer)))
>> (subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
>> (to (mp "MAIL_TO"))
>
> (let* ((mp (lambda (p) (org-entry-get nil p org-mime-use-property-inheritance))))
> (file (buffer-file-name (current-buffer)))
> (subject (or (funcall mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
> (to (funcall mp "MAIL_TO"))
> ...)
>
>
> Regards,
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-03-22 14:16 ` Nicolas Goaziou
2015-03-22 14:30 ` Eric Abrahamsen
@ 2015-03-30 8:34 ` Eric Abrahamsen
2015-03-31 10:42 ` Nicolas Goaziou
1 sibling, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2015-03-30 8:34 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> It's amazing what an effect barky compiler errors can have.
>
> Thanks. However, `cl-flet' is not supported in Emacs 23 so it's not an
> option for Org 8.3.
>
> OTOH, most uses of `flet' can be replaced with a plain `lambda' and
> funcalls.
>
>> - (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
>> + (cl-flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
>> (let* ((file (buffer-file-name (current-buffer)))
>> (subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
>> (to (mp "MAIL_TO"))
>
> (let* ((mp (lambda (p) (org-entry-get nil p org-mime-use-property-inheritance))))
> (file (buffer-file-name (current-buffer)))
> (subject (or (funcall mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
> (to (funcall mp "MAIL_TO"))
> ...)
That took longer than I expected...
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mime.el-Avoid-use-of-letf-cl-letf.patch --]
[-- Type: text/x-diff, Size: 5312 bytes --]
From 796667bc0afe3031c9e81e359809af9fceb3839f Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Mon, 30 Mar 2015 16:32:14 +0800
Subject: [PATCH] org-mime.el: Avoid use of letf/cl-letf
* contrib/lisp/org-mime.el (org-mime-send-subtree, org-mime-compose):
`letf' is deprecated in future emacs, but `cl-letf' is unavailable
in past emacs. Replace with plain old lambdas and funcalls.
---
contrib/lisp/org-mime.el | 111 ++++++++++++++++++++++++-----------------------
1 file changed, 56 insertions(+), 55 deletions(-)
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index f341474..bf2ad06 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -252,22 +252,22 @@ export that region, otherwise export the entire body."
(save-restriction
(org-narrow-to-subtree)
(run-hooks 'org-mime-send-subtree-hook)
- (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
- (let* ((file (buffer-file-name (current-buffer)))
- (subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
- (to (mp "MAIL_TO"))
- (cc (mp "MAIL_CC"))
- (bcc (mp "MAIL_BCC"))
- (body (buffer-substring
- (save-excursion (goto-char (point-min))
- (forward-line 1)
- (when (looking-at "[ \t]*:PROPERTIES:")
- (re-search-forward ":END:" nil)
- (forward-char))
- (point))
- (point-max))))
- (org-mime-compose body (or fmt 'org) file to subject
- `((cc . ,cc) (bcc . ,bcc)))))))
+ (let* ((mp (lambda (p)) (org-entry-get nil p org-mime-use-property-inheritance))
+ (file (buffer-file-name (current-buffer)))
+ (subject (or (funcall mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
+ (to (funcall mp "MAIL_TO"))
+ (cc (funcall mp "MAIL_CC"))
+ (bcc (funcall mp "MAIL_BCC"))
+ (body (buffer-substring
+ (save-excursion (goto-char (point-min))
+ (forward-line 1)
+ (when (looking-at "[ \t]*:PROPERTIES:")
+ (re-search-forward ":END:" nil)
+ (forward-char))
+ (point))
+ (point-max))))
+ (org-mime-compose body (or fmt 'org) file to subject
+ `((cc . ,cc) (bcc . ,bcc))))))
(defun org-mime-send-buffer (&optional fmt)
(run-hooks 'org-mime-send-buffer-hook)
@@ -287,45 +287,46 @@ export that region, otherwise export the entire body."
(require 'message)
(message-mail to subject headers nil)
(message-goto-body)
- (flet ((bhook (body fmt)
- (let ((hook (intern (concat "org-mime-pre-"
- (symbol-name fmt)
- "-hook"))))
- (if (> (eval `(length ,hook)) 0)
- (with-temp-buffer
- (insert body)
- (goto-char (point-min))
- (eval `(run-hooks ',hook))
- (buffer-string))
- body))))
- (let ((fmt (if (symbolp fmt) fmt (intern fmt))))
- (cond
- ((eq fmt 'org)
- (require 'ox-org)
- (insert (org-export-string-as
- (org-babel-trim (bhook body 'org)) 'org t)))
- ((eq fmt 'ascii)
- (require 'ox-ascii)
- (insert (org-export-string-as
- (concat "#+Title:\n" (bhook body 'ascii)) 'ascii t)))
- ((or (eq fmt 'html) (eq fmt 'html-ascii))
- (require 'ox-ascii)
- (require 'ox-org)
- (let* ((org-link-file-path-type 'absolute)
- ;; we probably don't want to export a huge style file
- (org-export-htmlize-output-type 'inline-css)
- (html-and-images
- (org-mime-replace-images
- (org-export-string-as (bhook body 'html) 'html t) file))
- (images (cdr html-and-images))
- (html (org-mime-apply-html-hook (car html-and-images))))
- (insert (org-mime-multipart
- (org-export-string-as
- (org-babel-trim
- (bhook body (if (eq fmt 'html) 'org 'ascii)))
- (if (eq fmt 'html) 'org 'ascii) t)
- html)
- (mapconcat 'identity images "\n"))))))))
+ (let ((bhook
+ (lambda (body fmt)
+ (let ((hook (intern (concat "org-mime-pre-"
+ (symbol-name fmt)
+ "-hook"))))
+ (if (> (eval `(length ,hook)) 0)
+ (with-temp-buffer
+ (insert body)
+ (goto-char (point-min))
+ (eval `(run-hooks ',hook))
+ (buffer-string))
+ body))))
+ (fmt (if (symbolp fmt) fmt (intern fmt))))
+ (cond
+ ((eq fmt 'org)
+ (require 'ox-org)
+ (insert (org-export-string-as
+ (org-babel-trim (funcall bhook body 'org)) 'org t)))
+ ((eq fmt 'ascii)
+ (require 'ox-ascii)
+ (insert (org-export-string-as
+ (concat "#+Title:\n" (funcall bhook body 'ascii)) 'ascii t)))
+ ((or (eq fmt 'html) (eq fmt 'html-ascii))
+ (require 'ox-ascii)
+ (require 'ox-org)
+ (let* ((org-link-file-path-type 'absolute)
+ ;; we probably don't want to export a huge style file
+ (org-export-htmlize-output-type 'inline-css)
+ (html-and-images
+ (org-mime-replace-images
+ (org-export-string-as (funcall bhook body 'html) 'html t) file))
+ (images (cdr html-and-images))
+ (html (org-mime-apply-html-hook (car html-and-images))))
+ (insert (org-mime-multipart
+ (org-export-string-as
+ (org-babel-trim
+ (funcall bhook body (if (eq fmt 'html) 'org 'ascii)))
+ (if (eq fmt 'html) 'org 'ascii) t)
+ html)
+ (mapconcat 'identity images "\n")))))))
(defun org-mime-org-buffer-htmlize ()
"Create an email buffer containing the current org-mode file
--
2.3.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-03-30 8:34 ` Eric Abrahamsen
@ 2015-03-31 10:42 ` Nicolas Goaziou
2015-04-01 2:17 ` Eric Abrahamsen
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-03-31 10:42 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hello,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Subject: [PATCH] org-mime.el: Avoid use of letf/cl-letf
Thank you. Some comments follow.
> + (let* ((mp (lambda (p)) (org-entry-get nil p org-mime-use-property-inheritance))
It should be
(mp (lambda (p) (org-entry-get ....)))
> + (let ((bhook
> + (lambda (body fmt)
> + (let ((hook (intern (concat "org-mime-pre-"
> + (symbol-name fmt)
> + "-hook"))))
> + (if (> (eval `(length ,hook)) 0)
> + (with-temp-buffer
> + (insert body)
> + (goto-char (point-min))
> + (eval `(run-hooks ',hook))
> + (buffer-string))
> + body))))
Not really related to the patch but the `eval' in the definition above
looks wrong. Shouldn't it be
(> (length hook) 0)
and
(run-hooks hook)
?
Regards,
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-03-31 10:42 ` Nicolas Goaziou
@ 2015-04-01 2:17 ` Eric Abrahamsen
2015-04-01 19:46 ` Nicolas Goaziou
0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2015-04-01 2:17 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Subject: [PATCH] org-mime.el: Avoid use of letf/cl-letf
>
> Thank you. Some comments follow.
>
>> + (let* ((mp (lambda (p)) (org-entry-get nil p org-mime-use-property-inheritance))
>
> It should be
>
> (mp (lambda (p) (org-entry-get ....)))
Whoops, dammit, I made the same mistake in both places, but somehow only
fixed the second.
>> + (let ((bhook
>> + (lambda (body fmt)
>> + (let ((hook (intern (concat "org-mime-pre-"
>> + (symbol-name fmt)
>> + "-hook"))))
>> + (if (> (eval `(length ,hook)) 0)
>> + (with-temp-buffer
>> + (insert body)
>> + (goto-char (point-min))
>> + (eval `(run-hooks ',hook))
>> + (buffer-string))
>> + body))))
>
> Not really related to the patch but the `eval' in the definition above
> looks wrong. Shouldn't it be
>
> (> (length hook) 0)
>
> and
>
> (run-hooks hook)
That is weird. What's even weirder is the above doesn't work. I set up a
test like this:
(defun my-org-mime-hook ()
(message "hook!"))
(add-hook 'org-mime-pre-org-hook 'my-org-mime-hook)
If I remove the two `eval's and treat "hook" like a normal variable, the
call to `length' fails with:
Wrong type argument: sequencep, org-mime-pre-org-hook
So apparently `length' is seeing the symbol name, and not the symbol
value.
I tried changing the `let' to look like:
(let ((hook (symbol-value (intern (....
Now the value of "hook" is '(my-org-mime-hook). That works with the
`length', and also with the `run-hooks', so long "hook" is quoted as in
the original `eval' version:
(run-hooks 'hook)
Unfortunately, that means there are still some fundamental things I
don't understand about how symbols work.
Here's a fixed version of the previous patch. I suppose I could also
alter the "bhook" thing to use `symbol-value' instead of `eval', but
that doesn't seem to be a net gain.
Thanks,
Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mime.el-Don-t-use-letf-or-cl-letf.patch --]
[-- Type: text/x-diff, Size: 5300 bytes --]
From 5901c2c696d3857f5f7a3c70b6de93f4f5974200 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Wed, 1 Apr 2015 10:08:34 +0800
Subject: [PATCH] org-mime.el: Don't use letf or cl-letf
* contrib/lisp/org-mime.el (org-mime-send-subtree, org-mime-compose):
`cl-letf' doesn't exist in Emacs <= 23, but `letf' won't exist in
future Emacs. Replace with `lambda' and `funcall'.
---
contrib/lisp/org-mime.el | 111 ++++++++++++++++++++++++-----------------------
1 file changed, 56 insertions(+), 55 deletions(-)
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index f341474..1e7a3b8 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -252,22 +252,22 @@ export that region, otherwise export the entire body."
(save-restriction
(org-narrow-to-subtree)
(run-hooks 'org-mime-send-subtree-hook)
- (flet ((mp (p) (org-entry-get nil p org-mime-use-property-inheritance)))
- (let* ((file (buffer-file-name (current-buffer)))
- (subject (or (mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
- (to (mp "MAIL_TO"))
- (cc (mp "MAIL_CC"))
- (bcc (mp "MAIL_BCC"))
- (body (buffer-substring
- (save-excursion (goto-char (point-min))
- (forward-line 1)
- (when (looking-at "[ \t]*:PROPERTIES:")
- (re-search-forward ":END:" nil)
- (forward-char))
- (point))
- (point-max))))
- (org-mime-compose body (or fmt 'org) file to subject
- `((cc . ,cc) (bcc . ,bcc)))))))
+ (let* ((mp (lambda (p) (org-entry-get nil p org-mime-use-property-inheritance)))
+ (file (buffer-file-name (current-buffer)))
+ (subject (or (funcall mp "MAIL_SUBJECT") (nth 4 (org-heading-components))))
+ (to (funcall mp "MAIL_TO"))
+ (cc (funcall mp "MAIL_CC"))
+ (bcc (funcall mp "MAIL_BCC"))
+ (body (buffer-substring
+ (save-excursion (goto-char (point-min))
+ (forward-line 1)
+ (when (looking-at "[ \t]*:PROPERTIES:")
+ (re-search-forward ":END:" nil)
+ (forward-char))
+ (point))
+ (point-max))))
+ (org-mime-compose body (or fmt 'org) file to subject
+ `((cc . ,cc) (bcc . ,bcc))))))
(defun org-mime-send-buffer (&optional fmt)
(run-hooks 'org-mime-send-buffer-hook)
@@ -287,45 +287,46 @@ export that region, otherwise export the entire body."
(require 'message)
(message-mail to subject headers nil)
(message-goto-body)
- (flet ((bhook (body fmt)
- (let ((hook (intern (concat "org-mime-pre-"
- (symbol-name fmt)
- "-hook"))))
- (if (> (eval `(length ,hook)) 0)
- (with-temp-buffer
- (insert body)
- (goto-char (point-min))
- (eval `(run-hooks ',hook))
- (buffer-string))
- body))))
- (let ((fmt (if (symbolp fmt) fmt (intern fmt))))
- (cond
- ((eq fmt 'org)
- (require 'ox-org)
- (insert (org-export-string-as
- (org-babel-trim (bhook body 'org)) 'org t)))
- ((eq fmt 'ascii)
- (require 'ox-ascii)
- (insert (org-export-string-as
- (concat "#+Title:\n" (bhook body 'ascii)) 'ascii t)))
- ((or (eq fmt 'html) (eq fmt 'html-ascii))
- (require 'ox-ascii)
- (require 'ox-org)
- (let* ((org-link-file-path-type 'absolute)
- ;; we probably don't want to export a huge style file
- (org-export-htmlize-output-type 'inline-css)
- (html-and-images
- (org-mime-replace-images
- (org-export-string-as (bhook body 'html) 'html t) file))
- (images (cdr html-and-images))
- (html (org-mime-apply-html-hook (car html-and-images))))
- (insert (org-mime-multipart
- (org-export-string-as
- (org-babel-trim
- (bhook body (if (eq fmt 'html) 'org 'ascii)))
- (if (eq fmt 'html) 'org 'ascii) t)
- html)
- (mapconcat 'identity images "\n"))))))))
+ (let ((bhook
+ (lambda (body fmt)
+ (let ((hook (intern (concat "org-mime-pre-"
+ (symbol-name fmt)
+ "-hook"))))
+ (if (> (eval `(length ,hook)) 0)
+ (with-temp-buffer
+ (insert body)
+ (goto-char (point-min))
+ (eval `(run-hooks ',hook))
+ (buffer-string))
+ body))))
+ (fmt (if (symbolp fmt) fmt (intern fmt))))
+ (cond
+ ((eq fmt 'org)
+ (require 'ox-org)
+ (insert (org-export-string-as
+ (org-babel-trim (funcall bhook body 'org)) 'org t)))
+ ((eq fmt 'ascii)
+ (require 'ox-ascii)
+ (insert (org-export-string-as
+ (concat "#+Title:\n" (funcall bhook body 'ascii)) 'ascii t)))
+ ((or (eq fmt 'html) (eq fmt 'html-ascii))
+ (require 'ox-ascii)
+ (require 'ox-org)
+ (let* ((org-link-file-path-type 'absolute)
+ ;; we probably don't want to export a huge style file
+ (org-export-htmlize-output-type 'inline-css)
+ (html-and-images
+ (org-mime-replace-images
+ (org-export-string-as (funcall bhook body 'html) 'html t) file))
+ (images (cdr html-and-images))
+ (html (org-mime-apply-html-hook (car html-and-images))))
+ (insert (org-mime-multipart
+ (org-export-string-as
+ (org-babel-trim
+ (funcall bhook body (if (eq fmt 'html) 'org 'ascii)))
+ (if (eq fmt 'html) 'org 'ascii) t)
+ html)
+ (mapconcat 'identity images "\n")))))))
(defun org-mime-org-buffer-htmlize ()
"Create an email buffer containing the current org-mode file
--
2.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-04-01 2:17 ` Eric Abrahamsen
@ 2015-04-01 19:46 ` Nicolas Goaziou
2015-04-02 1:33 ` Eric Abrahamsen
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-04-01 19:46 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> If I remove the two `eval's and treat "hook" like a normal variable, the
> call to `length' fails with:
>
> Wrong type argument: sequencep, org-mime-pre-org-hook
>
> So apparently `length' is seeing the symbol name, and not the symbol
> value.
Indeed.
> I tried changing the `let' to look like:
>
> (let ((hook (symbol-value (intern (....
What about (length (symbol-value hook)) instead?
> Here's a fixed version of the previous patch.
Thank you. Applied.
> I suppose I could also alter the "bhook" thing to use `symbol-value'
> instead of `eval', but that doesn't seem to be a net gain.
IMO, anything is a net gain compared to using `eval'.
Regards,
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: replace letf with cl-letf in org-mime
2015-04-01 19:46 ` Nicolas Goaziou
@ 2015-04-02 1:33 ` Eric Abrahamsen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2015-04-02 1:33 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> If I remove the two `eval's and treat "hook" like a normal variable, the
>> call to `length' fails with:
>>
>> Wrong type argument: sequencep, org-mime-pre-org-hook
>>
>> So apparently `length' is seeing the symbol name, and not the symbol
>> value.
>
> Indeed.
>
>> I tried changing the `let' to look like:
>>
>> (let ((hook (symbol-value (intern (....
>
> What about (length (symbol-value hook)) instead?
>
>> Here's a fixed version of the previous patch.
>
> Thank you. Applied.
>
>> I suppose I could also alter the "bhook" thing to use `symbol-value'
>> instead of `eval', but that doesn't seem to be a net gain.
>
> IMO, anything is a net gain compared to using `eval'.
Makes sense -- here's a fix for that.
Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-mime.el-Avoid-use-of-eval.patch --]
[-- Type: text/x-diff, Size: 1064 bytes --]
From fc2c492b0e511d157664bf79ce0ba44031f3223b Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Thu, 2 Apr 2015 09:29:29 +0800
Subject: [PATCH] org-mime.el: Avoid use of eval
* contrib/lisp/org-mime.el (org-mime-compose): Use a different
workaround for operating on the symbol vs symbol value.
---
contrib/lisp/org-mime.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 1e7a3b8..3414876 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -292,11 +292,11 @@ export that region, otherwise export the entire body."
(let ((hook (intern (concat "org-mime-pre-"
(symbol-name fmt)
"-hook"))))
- (if (> (eval `(length ,hook)) 0)
+ (if (> (length (symbol-value hook)) 0)
(with-temp-buffer
(insert body)
(goto-char (point-min))
- (eval `(run-hooks ',hook))
+ (run-hooks hook)
(buffer-string))
body))))
(fmt (if (symbolp fmt) fmt (intern fmt))))
--
2.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-04-02 1:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 13:56 replace letf with cl-letf in org-mime Eric Abrahamsen
2015-03-22 14:16 ` Nicolas Goaziou
2015-03-22 14:30 ` Eric Abrahamsen
2015-03-30 8:34 ` Eric Abrahamsen
2015-03-31 10:42 ` Nicolas Goaziou
2015-04-01 2:17 ` Eric Abrahamsen
2015-04-01 19:46 ` Nicolas Goaziou
2015-04-02 1:33 ` Eric Abrahamsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).