Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hello, Bastien b...@gnu.org writes: Yes. But I know see your point about the default title being useless most of the times. So I'm fine with the proposed change in master. Applied. Regards, -- Nicolas Goaziou
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Goaziou m...@nicolasgoaziou.fr writes: The benefit is that it becomes less clumsy to get rid of the title, when you don't want any. You often want a title, you more rarely want no title. AFAIU, using an empty #+TITLE: is the way to go right now, which seems good enough to me. What do you think? -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Bastien b...@gnu.org writes: Hi Nicolas, Nicolas Goaziou m...@nicolasgoaziou.fr writes: The benefit is that it becomes less clumsy to get rid of the title, when you don't want any. You often want a title, you more rarely want no title. I disagree. If I want a title I'll be sure to type it out and the file name is almost surely uninformative of this desired title. AFAIU, using an empty #+TITLE: is the way to go right now, which seems good enough to me. I prefer the original ox.el behavior where no title in .org meant no title in the exported document. Together with good booktabs support, it was one of my favorite features moving from the old exporter to ox. —Rasmus -- I feel emotional landscapes they puzzle me
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hello, Bastien b...@gnu.org writes: Nicolas Goaziou m...@nicolasgoaziou.fr writes: The benefit is that it becomes less clumsy to get rid of the title, when you don't want any. You often want a title, you more rarely want no title. That's true in my case. However, the title I want is never the file or buffer name, although I sometimes want no title. AFAIU, using an empty #+TITLE: is the way to go right now, which seems good enough to me. What do you think? It is good enough, but the default value (without TITLE) is still dubious. Anyway, this is a minor issue, if at all. Regards, -- Nicolas Goaziou0x80A93738
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Goaziou m...@nicolasgoaziou.fr writes: It is good enough, but the default value (without TITLE) is still dubious. Anyway, this is a minor issue, if at all. Yes. But I know see your point about the default title being useless most of the times. So I'm fine with the proposed change in master. -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Goaziou m...@nicolasgoaziou.fr writes: Automatically set document's title to file name or buffer name when no TITLE keyword is provided. I think that's the right thing to do and I don't see the benefits of doing otherwise. In some cases, it even forced me to use better file names. -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hello, Bastien b...@gnu.org writes: Nicolas Goaziou m...@nicolasgoaziou.fr writes: Automatically set document's title to file name or buffer name when no TITLE keyword is provided. I think that's the right thing to do and I don't see the benefits of doing otherwise. In some cases, it even forced me to use better file names. The benefit is that it becomes less clumsy to get rid of the title, when you don't want any. Regards, -- Nicolas Goaziou
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Bastien b...@gnu.org writes: Okay, but what is the benefit of not using a default title? It removes a hack. But there are other reasons at http://permalink.gmane.org/gmane.emacs.orgmode/86442 (e.g., a default title hardly makes sense anyway). Regards, -- Nicolas Goaziou
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Completing myself, Nicolas Goaziou m...@nicolasgoaziou.fr writes: Automatically set document's title to file name or buffer name when no TITLE keyword is provided. Implemented in the following patch. WDYT? -- Nicolas Goaziou From 7e917e97f99bf9e9266b64f5066bfaa5f8ca98ee Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou m...@nicolasgoaziou.fr Date: Sun, 15 Jun 2014 22:39:29 +0200 Subject: [PATCH] ox: Title fallbacks to nil instead of file name * lisp/ox.el (org-export--get-inbuffer-options): (org-export-as): Remove title default value handling. (org-export--get-buffer-attributes): Remove unnecessary property. * doc/org.texi (Document title): (Export settings): * doc/orgguide.texi (Export options): Update documentation. * testing/lisp/test-ox.el (test-org-export/set-title): Update tests according to new specifications. --- doc/org.texi| 7 + doc/orgguide.texi | 2 +- lisp/ox.el | 24 ++-- testing/lisp/test-ox.el | 76 +++-- 4 files changed, 47 insertions(+), 62 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 441b08c..dcb5a9c 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -9595,10 +9595,6 @@ The title of the exported document is taken from the special line #+TITLE: This is the title of the document @end example -@noindent -If this line does not exist, the title will be the name of the file -associated with the buffer, without extension, or the buffer name. - @cindex property, EXPORT_TITLE If you are exporting only a subtree, its heading will become the title of the document. If the subtree has a property @code{EXPORT_TITLE}, that will take @@ -10580,8 +10576,7 @@ be executed during export even though the subtree is not exported. @item TITLE @cindex #+TITLE -The title to be shown (otherwise derived from buffer's name). You can use -several such keywords for long titles. +The title to be shown. You can use several such keywords for long titles. @end table The @code{#+OPTIONS} keyword is a compact@footnote{If you want to configure diff --git a/doc/orgguide.texi b/doc/orgguide.texi index ab856e9..6842592 100644 --- a/doc/orgguide.texi +++ b/doc/orgguide.texi @@ -2324,7 +2324,7 @@ Insert template with export options, see example below. @end table @smallexample -#+TITLE: the title to be shown (default is the buffer name) +#+TITLE: the title to be shown #+AUTHOR: the author (default taken from @code{user-full-name}) #+DATE:a date, fixed, or an Org timestamp #+EMAIL: his/her email address (default from @code{user-mail-address}) diff --git a/lisp/ox.el b/lisp/ox.el index 4bfef52..605c5a4 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1343,10 +1343,6 @@ The back-end could then be called with, for example: ;; - category :: tree ;; - type :: list of elements and objects ;; -;; + `:input-buffer' :: Original buffer name. -;; - category :: option -;; - type :: string -;; ;; + `:input-file' :: Full path to input file, if any. ;; - category :: option ;; - type :: string or nil @@ -1794,19 +1790,13 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored. (when (stringp value) (setq plist (plist-put plist property - (or (org-element-parse-secondary-string - value (org-element-restriction 'keyword)) - ;; When TITLE keyword sets an empty - ;; string, make sure it doesn't - ;; appear as nil in the plist. - (and (eq property :title) )) + (org-element-parse-secondary-string + value (org-element-restriction 'keyword)) (defun org-export--get-buffer-attributes () Return properties related to buffer attributes, as a plist. ;; Store full path of input file name, or nil. For internal use. - (let ((visited-file (buffer-file-name (buffer-base-buffer -(list :input-file visited-file - :input-buffer (buffer-name (buffer-base-buffer) + (list :input-file (buffer-file-name (buffer-base-buffer (defun org-export--get-global-options (optional backend) Return global export options as a plist. @@ -3098,14 +3088,6 @@ Return code as a string. (org-export-install-filters (org-combine-plists info (org-export-get-environment backend subtreep ext-plist - ;; Special case: provide original file name or buffer name as - ;; default value for :title property. - (unless (plist-get info :title) - (plist-put - info :title - (let ((file (plist-get info :input-file))) - (if file (file-name-sans-extension (file-name-nondirectory file)) - (plist-get info :input-buffer) ;; Expand export-specific set of macros: {{{author}}}, ;; {{{date}}}, {{{email}}} and {{{title}}}. It must be done ;; once regular macros have been expanded, since document diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 234032e..664891e 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -270,58 +270,66 @@
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Goaziou m...@nicolasgoaziou.fr writes: Implemented in the following patch. WDYT? Okay, but what is the benefit of not using a default title? -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hello, Bastien b...@gnu.org writes: Nicolas Goaziou n.goaz...@gmail.com writes: Anyway, this bug is due to a cheesy workaround in order to get original file name or buffer name if no title is provided. It should work in maint now, but I suggest to get rid of that behaviour in master, as suggested in a recent thread. sorry I lost track -- what is the behavior you want to get rid on exactly? Automatically set document's title to file name or buffer name when no TITLE keyword is provided. Regards, -- Nicolas Goaziou
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Goaziou n.goaz...@gmail.com writes: Anyway, this bug is due to a cheesy workaround in order to get original file name or buffer name if no title is provided. It should work in maint now, but I suggest to get rid of that behaviour in master, as suggested in a recent thread. sorry I lost track -- what is the behavior you want to get rid on exactly? -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hi Nicolas, Nicolas Richard theonewiththeevill...@yahoo.fr writes: I'm trying to play with the exporter but I'd like my back-end to have no toc by default. I tried (org-export-define-derived-backend 'mytest 'html :translate-alist ;; don't use the template, concentrate on the toc. (list (cons 'template (lambda (a _) a))) :options-alist '((:with-toc nil toc nil))) IIUC, the last nil up there should be the default value for :with-toc. I used this in contrib/lisp/ox-rss.el :options-alist '((:with-toc nil nil nil) ;; Never include HTML's toc with `nil' instead of toc. Perhaps some hint lies down here (like toc indicating the exporter should rely on the buffer-local value of `org-export-with-toc'?) but I'm not really sure, I hope Nicolas can clarify. -- Bastien
Re: [O] how to use :options-alist in org-export-define-derived-backend ?
Hello, Nicolas Richard theonewiththeevill...@yahoo.fr writes: I'm trying to play with the exporter but I'd like my back-end to have no toc by default. I tried (org-export-define-derived-backend 'mytest 'html :translate-alist ;; don't use the template, concentrate on the toc. (list (cons 'template (lambda (a _) a))) :options-alist '((:with-toc nil toc nil))) IIUC, the last nil up there should be the default value for :with-toc. Unfortunately, exporting like this: (with-temp-buffer (insert * foo\n** bar\nsome content) (org-export-to-buffer 'mytest *test*) (pop-to-buffer *test*)) will show a table of contents. FWIW, I cannot reproduce it. Regards, -- Nicolas Goaziou
[O] how to use :options-alist in org-export-define-derived-backend ?
Hello, I'm trying to play with the exporter but I'd like my back-end to have no toc by default. I tried (org-export-define-derived-backend 'mytest 'html :translate-alist ;; don't use the template, concentrate on the toc. (list (cons 'template (lambda (a _) a))) :options-alist '((:with-toc nil toc nil))) IIUC, the last nil up there should be the default value for :with-toc. Unfortunately, exporting like this: (with-temp-buffer (insert * foo\n** bar\nsome content) (org-export-to-buffer 'mytest *test*) (pop-to-buffer *test*)) will show a table of contents. Setting org-export-with-toc to nil works as expected though : (let ((org-export-with-toc)) (with-temp-buffer (insert * foo\n** bar\nsome content) (org-export-to-buffer 'mytest *test*) (pop-to-buffer *test*))) What am I doing wrong ? Thanks -- Nico.