emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* publishing: no default publishing function, or symbol is not defined
@ 2021-06-18 22:15 Christopher W. Ryan via General discussions about Org-mode.
  2021-06-19 11:59 ` Christian Moe
  2021-06-19 12:48 ` Juan Manuel Macías
  0 siblings, 2 replies; 10+ messages in thread
From: Christopher W. Ryan via General discussions about Org-mode. @ 2021-06-18 22:15 UTC (permalink / raw)
  To: emacs-orgmode

I'm making my first foray into publishing a project. I'm running GNU
Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13, on Windows 10.

I've defined a single project, just to try it out and learn.  Here is
the relevant portion of my .emacs file


;; Projects and publishing
;;
(setq org-publish-project-alist
      '(("CaseInvestigationTrainingAndReferenceManual"
         :base-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/"
         :publishing-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea")))


There is one org file in ......../Sandbox,  called
WorkAreaForIndexingTrainingAndReferenceManual-7-June.org

(as the filename suggests, I'm mostly interested in learning how to make
an index).

If I execute C-c C-e P a  whilie in the org file I am trying to publish,
I get an error message that there is "No publishing function chosen".  I
thought org-publish-org-to-html was the default, as described here:

https://www.gnu.org/software/emacs/manual/html_node/org/Publishing-action.html

But if I modify the relevant section of my .emacs file like this,
specifying a publishing action:

;; Projects and publishing
;;
(setq org-publish-project-alist
      '(("CaseInvestigationTrainingAndReferenceManual"
         :base-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/"
         :publishing-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea"
         :publishing-function org-publish-org-to-html)))

and try again, I get an error message that I can't figure out: "Symbol’s
function definition is void: org-publish-org-to-html"

Grateful for any guidance.

Thanks.

--Chris Ryan


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-18 22:15 publishing: no default publishing function, or symbol is not defined Christopher W. Ryan via General discussions about Org-mode.
@ 2021-06-19 11:59 ` Christian Moe
  2021-06-19 12:48 ` Juan Manuel Macías
  1 sibling, 0 replies; 10+ messages in thread
From: Christian Moe @ 2021-06-19 11:59 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: emacs-orgmode


Hi, Chris,

"Symbol's function definition is void" means there is no such function
defined.

Try org-html-publish-to-html instead.

Yours,
Christian

Christopher W. Ryan via General discussions about Org-mode. writes:

> I'm making my first foray into publishing a project. I'm running GNU
> Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13, on Windows 10.
>
> I've defined a single project, just to try it out and learn.  Here is
> the relevant portion of my .emacs file
>
>
> ;; Projects and publishing
> ;;
> (setq org-publish-project-alist
>       '(("CaseInvestigationTrainingAndReferenceManual"
>          :base-directory
> "E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/"
>          :publishing-directory
> "E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea")))
>
>
> There is one org file in ......../Sandbox,  called
> WorkAreaForIndexingTrainingAndReferenceManual-7-June.org
>
> (as the filename suggests, I'm mostly interested in learning how to make
> an index).
>
> If I execute C-c C-e P a  whilie in the org file I am trying to publish,
> I get an error message that there is "No publishing function chosen".  I
> thought org-publish-org-to-html was the default, as described here:
>
> https://www.gnu.org/software/emacs/manual/html_node/org/Publishing-action.html
>
> But if I modify the relevant section of my .emacs file like this,
> specifying a publishing action:
>
> ;; Projects and publishing
> ;;
> (setq org-publish-project-alist
>       '(("CaseInvestigationTrainingAndReferenceManual"
>          :base-directory
> "E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/"
>          :publishing-directory
> "E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea"
>          :publishing-function org-publish-org-to-html)))
>
> and try again, I get an error message that I can't figure out: "Symbol’s
> function definition is void: org-publish-org-to-html"
>
> Grateful for any guidance.
>
> Thanks.
>
> --Chris Ryan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-18 22:15 publishing: no default publishing function, or symbol is not defined Christopher W. Ryan via General discussions about Org-mode.
  2021-06-19 11:59 ` Christian Moe
@ 2021-06-19 12:48 ` Juan Manuel Macías
  2021-06-19 18:23   ` Christopher W. Ryan via General discussions about Org-mode.
  2021-06-19 18:28   ` [External Email] " Christopher W. Ryan via General discussions about Org-mode.
  1 sibling, 2 replies; 10+ messages in thread
From: Juan Manuel Macías @ 2021-06-19 12:48 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: orgmode

Hi Christopher,

Christopher W. Ryan" via "General discussions about Org-mode. writes:

> I'm making my first foray into publishing a project. I'm running GNU
> Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13, on Windows 10.
>
> I've defined a single project, just to try it out and learn.

As Christian Moe said, the function you need is
`org-html-publish-to-html'.

In case it helps, I keep this blog about typography and TeX (in spanish),
made with org-publish: https://lunotipia.juanmanuelmacias.com/index.html

The blog's public repository is at:
https://gitlab.com/maciaschain/lunotipia

And this is the org-publish configuration for the blog:

;; lunotipia
("lunotipia-notes"
 ;; Org files
 :base-directory "~/Git/lunotipia/org/"
 :base-extension "org"
 ;; HTML files
 :publishing-directory "~/Git/lunotipia/public/"
 :publishing-function org-html-publish-to-html
 :recursive t
 :auto-sitemap t
 :sitemap-title "Textos publicados"
 :sitemap-function my-sitemap-function-lunotipia
 :sitemap-filename "entradas.org"
 :sitemap-style list
 :sitemap-sort-files anti-chronologically
 :exclude "org-rss\\|theindex\\|acerca-de\.org"
 :makeindex t
 :html-postamble mi-postamble)

;; static files
("lunotipia-static"
 :base-directory "~/Git/lunotipia/org/images/"
 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
 :publishing-directory "~/Git/lunotipia/public/images/"
 :recursive t
 :publishing-function org-publish-attachment)

And my custom sitemap function:

(defun my-sitemap-function-lunotipia (title list)
  "Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
  (concat "#+TITLE: " title "\n\n"
	  "#+SETUPFILE:" "~/Git/lunotipia/html-lunotipia.setup"
	  "\n#+SETUPFILE:" "~/Git/gnutas/macros-gnutas.setup"
	  "\n#+AUTHOR:" "Juan Manuel Macías"
	  "\n#+LANGUAGE:" "es"
	  "\n#+begin_archive\n"
	  (mapconcat (lambda (li)
		       (format "@@html:<li>@@ %s @@html:</li>@@" (car li)))
		     (seq-filter #'car (cdr list))
		     "\n")
	  "\n#+end_archive\n"
	  "\n#+begin_export html"
	  "\n<div>"
	  "\n<hr />"
	  "\n<p>"
	  "\n<a href=\"acerca-de.html\">Acerca de...</a>"
	  "\n</p></div>"
	  "\n<p>"
	  "\n<a href=\"https://maciaschain.gitlab.io/lunotipia/rss.xml\">RSS</a>"
	  "\n</p></div>"
	  "\n#+end_export\n"))

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-19 12:48 ` Juan Manuel Macías
@ 2021-06-19 18:23   ` Christopher W. Ryan via General discussions about Org-mode.
  2021-09-19 10:10     ` Yasushi SHOJI
  2021-06-19 18:28   ` [External Email] " Christopher W. Ryan via General discussions about Org-mode.
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher W. Ryan via General discussions about Org-mode. @ 2021-06-19 18:23 UTC (permalink / raw)
  To: orgmode

Ah, I see I wrote the :publishing-function statement incorrectly. Thanks
to both of you.

But is there not a default publishing action, that requires no explicit
:publishing-function statement? This part of the documentation says
there is:

https://orgmode.org/manual/Publishing-action.html#Publishing-action


But I gave this a try:

(setq org-publish-project-alist
      '(("CaseInvestigationTrainingAndReferenceManual"
         :base-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/"
         :publishing-directory
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea"
	 :publishing-function org-html-publish-to-html)))

and I got the expected output in the expected place: a file called
"E:/DATA/BCHD/CD/ChinaCoronavirus2019/CommCare/Sandbox/StagingArea/WorkAreaForIndexingTrainingAndReferenceManual-7-June.html


However, when I add this line:
 :makeindex 1

so with a non-null value of :makeindex

The output consists *only* of the index: a file called theindex.html.
It looks like the expected index to the document, but the document
itself is not generated. How do I get both?

Thanks.

--Chris



Juan Manuel Macías wrote:
> Hi Christopher,
> 
> Christopher W. Ryan" via "General discussions about Org-mode. writes:
> 
>> I'm making my first foray into publishing a project. I'm running GNU
>> Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13, on Windows 10.
>>
>> I've defined a single project, just to try it out and learn.
> 
> As Christian Moe said, the function you need is
> `org-html-publish-to-html'.
> 
> In case it helps, I keep this blog about typography and TeX (in spanish),
> made with org-publish: https://lunotipia.juanmanuelmacias.com/index.html
> 
> The blog's public repository is at:
> https://gitlab.com/maciaschain/lunotipia
> 
> And this is the org-publish configuration for the blog:
> 
> ;; lunotipia
> ("lunotipia-notes"
>  ;; Org files
>  :base-directory "~/Git/lunotipia/org/"
>  :base-extension "org"
>  ;; HTML files
>  :publishing-directory "~/Git/lunotipia/public/"
>  :publishing-function org-html-publish-to-html
>  :recursive t
>  :auto-sitemap t
>  :sitemap-title "Textos publicados"
>  :sitemap-function my-sitemap-function-lunotipia
>  :sitemap-filename "entradas.org"
>  :sitemap-style list
>  :sitemap-sort-files anti-chronologically
>  :exclude "org-rss\\|theindex\\|acerca-de\.org"
>  :makeindex t
>  :html-postamble mi-postamble)
> 
> ;; static files
> ("lunotipia-static"
>  :base-directory "~/Git/lunotipia/org/images/"
>  :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
>  :publishing-directory "~/Git/lunotipia/public/images/"
>  :recursive t
>  :publishing-function org-publish-attachment)
> 
> And my custom sitemap function:
> 
> (defun my-sitemap-function-lunotipia (title list)
>   "Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
>   (concat "#+TITLE: " title "\n\n"
> 	  "#+SETUPFILE:" "~/Git/lunotipia/html-lunotipia.setup"
> 	  "\n#+SETUPFILE:" "~/Git/gnutas/macros-gnutas.setup"
> 	  "\n#+AUTHOR:" "Juan Manuel Macías"
> 	  "\n#+LANGUAGE:" "es"
> 	  "\n#+begin_archive\n"
> 	  (mapconcat (lambda (li)
> 		       (format "@@html:<li>@@ %s @@html:</li>@@" (car li)))
> 		     (seq-filter #'car (cdr list))
> 		     "\n")
> 	  "\n#+end_archive\n"
> 	  "\n#+begin_export html"
> 	  "\n<div>"
> 	  "\n<hr />"
> 	  "\n<p>"
> 	  "\n<a href=\"acerca-de.html\">Acerca de...</a>"
> 	  "\n</p></div>"
> 	  "\n<p>"
> 	  "\n<a href=\"https://maciaschain.gitlab.io/lunotipia/rss.xml\">RSS</a>"
> 	  "\n</p></div>"
> 	  "\n#+end_export\n"))
> 
> Best regards,
> 
> Juan Manuel 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External Email] Re: publishing: no default publishing function,  or symbol is not defined
  2021-06-19 12:48 ` Juan Manuel Macías
  2021-06-19 18:23   ` Christopher W. Ryan via General discussions about Org-mode.
@ 2021-06-19 18:28   ` Christopher W. Ryan via General discussions about Org-mode.
  2021-06-19 19:32     ` Juan Manuel Macías
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher W. Ryan via General discussions about Org-mode. @ 2021-06-19 18:28 UTC (permalink / raw)
  To: orgmode

Oops, spoke to soon about the structure of the index.  Here is a section
of theindex.html

I
    Incarceration
    Incarceration
    Interview
    Interview
    Interview
    Interview
    Interview
    Isolation
    Isolation
    Isolation

I would expect each named entry in an index to appear once, with, if
necessary, multiple links next to it for all the places that index tag
occurs in the main document. At least, that's how the indices in books
work.  Can the same be done in org mode?

Thanks.

--Chris


Juan Manuel Macías wrote:
> Hi Christopher,
> 
> Christopher W. Ryan" via "General discussions about Org-mode. writes:
> 
>> I'm making my first foray into publishing a project. I'm running GNU
>> Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13, on Windows 10.
>>
>> I've defined a single project, just to try it out and learn.
> 
> As Christian Moe said, the function you need is
> `org-html-publish-to-html'.
> 
> In case it helps, I keep this blog about typography and TeX (in spanish),
> made with org-publish: https://lunotipia.juanmanuelmacias.com/index.html
> 
> The blog's public repository is at:
> https://gitlab.com/maciaschain/lunotipia
> 
> And this is the org-publish configuration for the blog:
> 
> ;; lunotipia
> ("lunotipia-notes"
>  ;; Org files
>  :base-directory "~/Git/lunotipia/org/"
>  :base-extension "org"
>  ;; HTML files
>  :publishing-directory "~/Git/lunotipia/public/"
>  :publishing-function org-html-publish-to-html
>  :recursive t
>  :auto-sitemap t
>  :sitemap-title "Textos publicados"
>  :sitemap-function my-sitemap-function-lunotipia
>  :sitemap-filename "entradas.org"
>  :sitemap-style list
>  :sitemap-sort-files anti-chronologically
>  :exclude "org-rss\\|theindex\\|acerca-de\.org"
>  :makeindex t
>  :html-postamble mi-postamble)
> 
> ;; static files
> ("lunotipia-static"
>  :base-directory "~/Git/lunotipia/org/images/"
>  :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
>  :publishing-directory "~/Git/lunotipia/public/images/"
>  :recursive t
>  :publishing-function org-publish-attachment)
> 
> And my custom sitemap function:
> 
> (defun my-sitemap-function-lunotipia (title list)
>   "Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
>   (concat "#+TITLE: " title "\n\n"
> 	  "#+SETUPFILE:" "~/Git/lunotipia/html-lunotipia.setup"
> 	  "\n#+SETUPFILE:" "~/Git/gnutas/macros-gnutas.setup"
> 	  "\n#+AUTHOR:" "Juan Manuel Macías"
> 	  "\n#+LANGUAGE:" "es"
> 	  "\n#+begin_archive\n"
> 	  (mapconcat (lambda (li)
> 		       (format "@@html:<li>@@ %s @@html:</li>@@" (car li)))
> 		     (seq-filter #'car (cdr list))
> 		     "\n")
> 	  "\n#+end_archive\n"
> 	  "\n#+begin_export html"
> 	  "\n<div>"
> 	  "\n<hr />"
> 	  "\n<p>"
> 	  "\n<a href=\"acerca-de.html\">Acerca de...</a>"
> 	  "\n</p></div>"
> 	  "\n<p>"
> 	  "\n<a href=\"https://maciaschain.gitlab.io/lunotipia/rss.xml\">RSS</a>"
> 	  "\n</p></div>"
> 	  "\n#+end_export\n"))
> 
> Best regards,
> 
> Juan Manuel 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External Email] Re: publishing: no default publishing function,  or symbol is not defined
  2021-06-19 18:28   ` [External Email] " Christopher W. Ryan via General discussions about Org-mode.
@ 2021-06-19 19:32     ` Juan Manuel Macías
  2021-06-22 20:26       ` Christopher W. Ryan via General discussions about Org-mode.
  0 siblings, 1 reply; 10+ messages in thread
From: Juan Manuel Macías @ 2021-06-19 19:32 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: orgmode

Hi Christopher,

Christopher W. Ryan" via "General discussions about Org-mode. writes:

> I would expect each named entry in an index to appear once, with, if
> necessary, multiple links next to it for all the places that index tag
> occurs in the main document. At least, that's how the indices in books
> work.  Can the same be done in org mode?

I'm afraid that in HTML that is not possible. Page numbers are used in
books to refer to an index entry, but on a web site we don't have page
numbers: Where would we apply the links? What I usually do with my web
index is: use first-level entries for the general concept and second or
third level entries for concepts more concrete.

P.ej:

In document A:

#+INDEX: GNU Emacs!external packages!projectile

In document B:

#+INDEX: GNU Emacs!external packages!helm

Links to document A and B go to projectile and Helm

Anyway, I think in this scenario it's better to use tags, but
org-publish doesn't provide tags out of the box. You need to do some
elisp hacking to get something like blog tags in your web site.

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-19 19:32     ` Juan Manuel Macías
@ 2021-06-22 20:26       ` Christopher W. Ryan via General discussions about Org-mode.
  2021-06-25  8:38         ` Juan Manuel Macías
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher W. Ryan via General discussions about Org-mode. @ 2021-06-22 20:26 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Juan Manuel--

Thanks. I understand no pages in a web document; I thought (hoped?) that
section/subsection numbers, perhaps multiple, would appear next to the
entries in the index.  I will try to be more specific with the ! syntax

Any advice for how to get *both* theindex.html and my main document in
html? So far I can only get one or the other, depending on whether I
include a non-nil value for a :makeindex option.

Thanks.

--Chris

Juan Manuel Macías wrote:
> Hi Christopher,
> 
> Christopher W. Ryan" via "General discussions about Org-mode. writes:
> 
>> I would expect each named entry in an index to appear once, with, if
>> necessary, multiple links next to it for all the places that index tag
>> occurs in the main document. At least, that's how the indices in books
>> work.  Can the same be done in org mode?
> 
> I'm afraid that in HTML that is not possible. Page numbers are used in
> books to refer to an index entry, but on a web site we don't have page
> numbers: Where would we apply the links? What I usually do with my web
> index is: use first-level entries for the general concept and second or
> third level entries for concepts more concrete.
> 
> P.ej:
> 
> In document A:
> 
> #+INDEX: GNU Emacs!external packages!projectile
> 
> In document B:
> 
> #+INDEX: GNU Emacs!external packages!helm
> 
> Links to document A and B go to projectile and Helm
> 
> Anyway, I think in this scenario it's better to use tags, but
> org-publish doesn't provide tags out of the box. You need to do some
> elisp hacking to get something like blog tags in your web site.
> 
> Best regards,
> 
> Juan Manuel 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-22 20:26       ` Christopher W. Ryan via General discussions about Org-mode.
@ 2021-06-25  8:38         ` Juan Manuel Macías
  0 siblings, 0 replies; 10+ messages in thread
From: Juan Manuel Macías @ 2021-06-25  8:38 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: orgmode

Hi Christopher, sorry for the slow reply

Christopher W. Ryan writes:

> Any advice for how to get *both* theindex.html and my main document in
> html? So far I can only get one or the other, depending on whether I
> include a non-nil value for a :makeindex option.

I don't understand the question. With the option `:makeindex t' a
document `theindex.inc' is created/updated every time you call
`org-publish-project', and also a document `theindex.org', which
contains the directive `#+INCLUDE: theindex.inc'. This is the document
which is exported to html as an index, along with the rest of the org
documents that you have inside the folder specified in the
`:base-directory' option.

For more info, you can evaluate (info (org) Generating an index)

What is your org-publish configuration?

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-06-19 18:23   ` Christopher W. Ryan via General discussions about Org-mode.
@ 2021-09-19 10:10     ` Yasushi SHOJI
  2021-09-19 17:24       ` Yasushi SHOJI
  0 siblings, 1 reply; 10+ messages in thread
From: Yasushi SHOJI @ 2021-09-19 10:10 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: tec, orgmode, Nicolas Goaziou

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

Hi Chris,

On Sun, Jun 20, 2021 at 3:30 AM Christopher W. Ryan via General
discussions about Org-mode. <emacs-orgmode@gnu.org> wrote:
> But is there not a default publishing action, that requires no explicit
> :publishing-function statement? This part of the documentation says
> there is:
>
> https://orgmode.org/manual/Publishing-action.html#Publishing-action

I just encountered the exact problem.  The attached patch fixed it for
me.  Would you mind testing it?

ps. I've dug a bit in the commit history but I couldn't find any evidence that
we've ever supported this default behaviour at least with the current exporter.

Nicolas, if that's true, should we change the documentation instead?

Best,
-- 
               yashi

[-- Attachment #2: 0001-ox-publish-Set-default-transformation.patch --]
[-- Type: text/x-patch, Size: 1074 bytes --]

From 2fdf67b4ddfac97acb2b685957b6e4ca26474fb4 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yashi@spacecubics.com>
Date: Sun, 19 Sep 2021 18:56:19 +0900
Subject: [PATCH] ox-publish: Set default transformation

As documented in Org Manual, we should have the default transformation
function set to org-html-publish-to-html.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
---
 lisp/ox-publish.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index c25dd5473..99b1dca81 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -617,7 +617,8 @@ files, when entire projects are published (see
 			  (abbreviate-file-name filename))))
 	 (project-plist (cdr project))
 	 (publishing-function
-	  (pcase (org-publish-property :publishing-function project)
+	  (pcase (org-publish-property :publishing-function project
+                                       'org-html-publish-to-html)
 	    (`nil (user-error "No publishing function chosen"))
 	    ((and f (pred listp)) f)
 	    (f (list f))))
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: publishing: no default publishing function, or symbol is not defined
  2021-09-19 10:10     ` Yasushi SHOJI
@ 2021-09-19 17:24       ` Yasushi SHOJI
  0 siblings, 0 replies; 10+ messages in thread
From: Yasushi SHOJI @ 2021-09-19 17:24 UTC (permalink / raw)
  To: Christopher W. Ryan; +Cc: tec, orgmode, Nicolas Goaziou

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

Hi,

I've also added a test case for the default translation function.
I'm not sure it's justified to add a new func `org-plist-delete-all`
just for this.
We can move the function to the test file if we don't need it in org-marcs.
-- 
            yashi

[-- Attachment #2: 0001-ox-publish-Set-default-transformation.patch --]
[-- Type: text/x-patch, Size: 1078 bytes --]

From 2fdf67b4ddfac97acb2b685957b6e4ca26474fb4 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yashi@spacecubics.com>
Date: Sun, 19 Sep 2021 18:56:19 +0900
Subject: [PATCH 1/3] ox-publish: Set default transformation

As documented in Org Manual, we should have the default transformation
function set to org-html-publish-to-html.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
---
 lisp/ox-publish.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index c25dd5473..99b1dca81 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -617,7 +617,8 @@ files, when entire projects are published (see
 			  (abbreviate-file-name filename))))
 	 (project-plist (cdr project))
 	 (publishing-function
-	  (pcase (org-publish-property :publishing-function project)
+	  (pcase (org-publish-property :publishing-function project
+                                       'org-html-publish-to-html)
 	    (`nil (user-error "No publishing function chosen"))
 	    ((and f (pred listp)) f)
 	    (f (list f))))
-- 
2.33.0


[-- Attachment #3: 0002-org-macs-Introduce-org-plist-delete-all.patch --]
[-- Type: text/x-patch, Size: 992 bytes --]

From 4978f588443f0ac27c75676697c2cc1b8beae668 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yashi@spacecubics.com>
Date: Mon, 20 Sep 2021 02:09:29 +0900
Subject: [PATCH 2/3] org-macs: Introduce org-plist-delete-all

In some cases we want to remove multiple properties from a plist.
This function just for that.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
---
 lisp/org-macs.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 18ae642c7..bd4bb5066 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -538,6 +538,11 @@ that may remove elements by altering the list structure."
     (setq list (delete (pop elts) list)))
   list)
 
+(defun org-plist-delete-all (plist props)
+  "Delete all elements in PROPS from PLIST"
+  (dolist (e props plist)
+    (setq plist (org-plist-delete plist e))))
+
 (defun org-plist-delete (plist property)
   "Delete PROPERTY from PLIST.
 This is in contrast to merely setting it to 0."
-- 
2.33.0


[-- Attachment #4: 0003-testing-ox-publish-Add-a-test-case-for-default-trans.patch --]
[-- Type: text/x-patch, Size: 3672 bytes --]

From 83913a2b0becb8429e9cc4e5872a9c7557351d03 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yashi@spacecubics.com>
Date: Mon, 20 Sep 2021 02:10:26 +0900
Subject: [PATCH 3/3] testing: ox-publish: Add a test case for default trans
 func

We use `org-html-publish-to-html' as the default transformation
function.  This commit adds a test case to make sure that org-publish
produces exact same output when org-html-publish-to-html is given as
:publishing-function or without it.

Because `org-publish-property' checks the given property with
`plist-member', we can't pass nil with :publishing-function; This
causes ox-publish to error out with "No publishing function chosen".

Thus we are removing :publishing-function from the plist using
`org-plist-delete-all'.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
---
 testing/lisp/test-ox-publish.el | 36 ++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/testing/lisp/test-ox-publish.el b/testing/lisp/test-ox-publish.el
index 35031742f..3bfb985ab 100644
--- a/testing/lisp/test-ox-publish.el
+++ b/testing/lisp/test-ox-publish.el
@@ -22,12 +22,16 @@
 \f
 ;;; Helper functions
 
-(defun org-test-publish (properties handler)
+(defun org-test-publish (properties handler &optional remove-prop)
   "Publish a project defined by PROPERTIES.
 Call HANDLER with the publishing directory as its sole argument.
 Unless set otherwise in PROPERTIES, `:base-directory' is set to
 \"examples/pub/\" sub-directory from test directory and
-`:publishing-function' is set to `org-publish-attachment'."
+`:publishing-function' is set to `org-publish-attachment'.
+Because `org-publish-property' uses `plist-member' to check the
+existance of a property, a property with a value nil is different
+from non-existitance.  Properties in REMOVE-PROP will be remove
+from the final plist."
   (declare (indent 1))
   (let* ((org-publish-use-timestamps-flag nil)
 	 (org-publish-cache nil)
@@ -35,13 +39,15 @@ Unless set otherwise in PROPERTIES, `:base-directory' is set to
 	 (pub-dir (make-temp-file "org-test" t))
 	 (org-publish-timestamp-directory
 	  (expand-file-name ".org-timestamps/" pub-dir))
+         (props (org-plist-delete-all
+                 (org-combine-plists
+                  `(:base-directory ,base-dir
+                    :publishing-function org-publish-attachment)
+                  properties
+                  `(:publishing-directory ,pub-dir))
+                 remove-prop))
 	 (project
-	  `("test" ,@(org-combine-plists
-		      `(:base-directory
-			,base-dir
-			:publishing-function org-publish-attachment)
-		      properties
-		      `(:publishing-directory ,pub-dir)))))
+	  `("test" ,@props)))
     (unwind-protect
 	(progn
 	  (org-publish-projects (list project))
@@ -92,7 +98,19 @@ Unless set otherwise in PROPERTIES, `:base-directory' is set to
 	    (lambda (dir)
 	      (remove ".org-timestamps"
 		      (cl-remove-if #'file-directory-p
-				    (directory-files dir))))))))
+				    (directory-files dir)))))))
+
+  ;; Check the default trasformation function,
+  ;; org-html-publish-to-html. Because org-test-publish uses
+  ;; org-publish-attachment by default, we must not just override with
+  ;; nil but tell it to remove the :publishing-function from the list.
+  (should
+   (let ((func (lambda (dir)
+                 (with-temp-buffer
+                   (insert-file-contents (expand-file-name "a.html" dir))
+                   (buffer-string)))))
+    (equal (org-test-publish nil func '(:publishing-function))
+           (org-test-publish '(:publishing-function org-html-publish-to-html) func)))))
 
 \f
 ;;; Site-map
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-19 17:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-18 22:15 publishing: no default publishing function, or symbol is not defined Christopher W. Ryan via General discussions about Org-mode.
2021-06-19 11:59 ` Christian Moe
2021-06-19 12:48 ` Juan Manuel Macías
2021-06-19 18:23   ` Christopher W. Ryan via General discussions about Org-mode.
2021-09-19 10:10     ` Yasushi SHOJI
2021-09-19 17:24       ` Yasushi SHOJI
2021-06-19 18:28   ` [External Email] " Christopher W. Ryan via General discussions about Org-mode.
2021-06-19 19:32     ` Juan Manuel Macías
2021-06-22 20:26       ` Christopher W. Ryan via General discussions about Org-mode.
2021-06-25  8:38         ` Juan Manuel Macías

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).