emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Julien Cubizolles <j.cubizolles@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: :completion function isn't run anymore?
Date: Sun, 29 Nov 2015 21:53:09 +0100	[thread overview]
Message-ID: <8737vomssq.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87zixwh780.fsf@free.fr> (Julien Cubizolles's message of "Sun, 29 Nov 2015 21:38:07 +0100")

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Thanks for looking into it. It seems the completion-function is now
> being accessed but unfortunately something is still wrong. The error
> message is
>
> org-publish-projects: Wrong type argument: sequencep,
> jc-org-publish-rename-beamer-pdf

I forgot that :preparation-function could also be a single function.
Attached is the updated patch to test.

> If I'm to bisect, is it possible to reload all org-mode files without
> restarting emacs ? Would M-x org-mode be enough ?

See `org-reload'.

Regards,

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-publish.el-Fix-preparation-function-and-completio.patch --]
[-- Type: text/x-diff, Size: 2009 bytes --]

From 1180a87c002c8efc0687a051bec536ee6c34eec0 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Sun, 29 Nov 2015 14:23:50 +0100
Subject: [PATCH] ox-publish.el: Fix :preparation-function and
 :completion-function

* lisp/ox-publish.el (org-publish-projects): Do not use `run-hooks' in
  a lexical binding environment.

Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
<http://permalink.gmane.org/gmane.emacs.orgmode/103124>
---
 lisp/ox-publish.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 90f307c..b49b9d3 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -667,9 +667,9 @@ If `:auto-sitemap' is set, publish the sitemap too.  If
 `:makeindex' is set, also produce a file \"theindex.org\"."
   (dolist (project (org-publish-expand-projects projects))
     (let ((project-plist (cdr project)))
-      (let ((preparation-function
-	     (plist-get project-plist :preparation-function)))
-	(when preparation-function (run-hooks 'preparation-function)))
+      (let ((f (plist-get project-plist :preparation-function)))
+	(cond ((consp f) (mapc #'funcall f))
+	      ((functionp f) (funcall f))))
       ;; Each project uses its own cache file.
       (org-publish-initialize-cache (car project))
       (when  (plist-get project-plist :auto-sitemap)
@@ -701,9 +701,9 @@ If `:auto-sitemap' is set, publish the sitemap too.  If
 	  (org-publish-index-generate-theindex
 	   project (plist-get project-plist :base-directory))
 	  (org-publish-file theindex project t)))
-      (let ((completion-function
-	     (plist-get project-plist :completion-function)))
-	(when completion-function (run-hooks 'completion-function)))
+      (let ((f (plist-get project-plist :completion-function)))
+	(cond ((consp f) (mapc #'funcall f))
+	      ((functionp f) (funcall f))))
       (org-publish-write-cache-file))))
 
 (defun org-publish-org-sitemap (project &optional sitemap-filename)
-- 
2.6.2


  reply	other threads:[~2015-11-29 20:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 23:01 :completion function isn't run anymore? Julien Cubizolles
2015-11-27 15:49 ` Julien Cubizolles
2015-11-29 13:20   ` Nicolas Goaziou
2015-11-29 20:38     ` Julien Cubizolles
2015-11-29 20:53       ` Nicolas Goaziou [this message]
2015-11-29 21:19         ` Julien Cubizolles
2015-11-29 21:39           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737vomssq.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=j.cubizolles@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).