From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: replace letf with cl-letf in org-mime Date: Thu, 02 Apr 2015 09:33:40 +0800 Message-ID: <87bnj71fgr.fsf@ericabrahamsen.net> References: <87wq29m8zm.fsf@ericabrahamsen.net> <87iodt2k3i.fsf@nicolasgoaziou.fr> <87619iopdj.fsf@ericabrahamsen.net> <87zj6txxbw.fsf@nicolasgoaziou.fr> <87384k619d.fsf@ericabrahamsen.net> <877ftvy6me.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdU1A-00055M-3W for emacs-orgmode@gnu.org; Wed, 01 Apr 2015 21:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdU16-00010e-8P for emacs-orgmode@gnu.org; Wed, 01 Apr 2015 21:34:00 -0400 Received: from plane.gmane.org ([80.91.229.3]:40565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdU16-00010Q-1z for emacs-orgmode@gnu.org; Wed, 01 Apr 2015 21:33:56 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YdU10-0000XG-QT for emacs-orgmode@gnu.org; Thu, 02 Apr 2015 03:33:51 +0200 Received: from 114.248.18.112 ([114.248.18.112]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Apr 2015 03:33:50 +0200 Received: from eric by 114.248.18.112 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Apr 2015 03:33:50 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > Eric Abrahamsen 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-mime.el-Avoid-use-of-eval.patch >From fc2c492b0e511d157664bf79ce0ba44031f3223b Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen 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 --=-=-=--