Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Eric Abrahamsen <e...@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

>From fc2c492b0e511d157664bf79ce0ba44031f3223b Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <e...@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

Reply via email to