Re: [O] [patch] more Beamer properties

2016-09-22 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Nicolas Goaziou  writes:

>> Per above, would the following be cleaner?
>>
>>   #+attr_beamer: :short shortdate
>>
>>   #+date: longdate
>>
>> Ditto for title, institute, author...

> Looks good, but how do I get the element representation of a parsed
> keyword in the :options-alist?
>
> In the buffer, I can do
>
>(org-export-read-attribute :attr_beamer (org-element-at-point))
>
> But this does not work with what is stored in the info list.

Good point. Let's forget about this suggestion. 

Feel free to push the last iteration of the patch. Please also add
documentation and an entry in ORG-NEWS.

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [patch] more Beamer properties

2016-09-22 Thread Rasmus
Nicolas Goaziou  writes:

>>> I think
>>>
>>>   #+TITLEGRAPHICS: [[file:link.pdf]]
>>>
>>> would be cleaner.
>>
>> I dropped this.  One might need to add attributes to the graphic.  The
>> #+titlegraphics approach wouldn’t allow it.
>
> Well, wouldn't the following work?
>
>   #+attr_beamer: :attribute1 value1 :attribute2 value2
>
>   #+TITLEGRAPHICS: [[file:link.pdf]]
>
>> +(:beamer-short-title "SHORT_TITLE" nil nil parse)
>> +(:beamer-short-subtitle "SHORT_SUBTITLE" nil nil parse)
>> +(:beamer-short-author "SHORT_AUTHOR" nil nil parse)
>> +(:beamer-short-date "SHORT_DATE" nil nil parse)
>> +(:beamer-institute "INSTITUTE" nil nil parse)
>> +(:beamer-short-institute "SHORT_INSTITUTE" nil nil parse)
>
> Per above, would the following be cleaner?
>
>   #+attr_beamer: :short shortdate
>
>   #+date: longdate
>
> Ditto for title, institute, author...

Looks good, but how do I get the element representation of a parsed
keyword in the :options-alist?

In the buffer, I can do

   (org-export-read-attribute :attr_beamer (org-element-at-point))

But this does not work with what is stored in the info list.

I’m probably missing something obvious here...

Thanks,
Rasmus

-- 
History is what should never happen again




Re: [O] [patch] more Beamer properties

2016-09-21 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

>> I think
>>
>>   #+TITLEGRAPHICS: [[file:link.pdf]]
>>
>> would be cleaner.
>
> I dropped this.  One might need to add attributes to the graphic.  The
> #+titlegraphics approach wouldn’t allow it.

Well, wouldn't the following work?

  #+attr_beamer: :attribute1 value1 :attribute2 value2
  #+TITLEGRAPHICS: [[file:link.pdf]]

> +(:beamer-short-title "SHORT_TITLE" nil nil parse)
> +(:beamer-short-subtitle "SHORT_SUBTITLE" nil nil parse)
> +(:beamer-short-author "SHORT_AUTHOR" nil nil parse)
> +(:beamer-short-date "SHORT_DATE" nil nil parse)
> +(:beamer-institute "INSTITUTE" nil nil parse)
> +(:beamer-short-institute "SHORT_INSTITUTE" nil nil parse)

Per above, would the following be cleaner?

  #+attr_beamer: :short shortdate
  #+date: longdate

Ditto for title, institute, author...

Regards,

-- 
Nicolas Goaziou



Re: [O] [patch] more Beamer properties

2016-09-21 Thread Rasmus
Hi,

Thanks for the suggestions.

Sorry about the slow reply...  I'm lacking time ATM.

I simplified the patch to only add the short version of properties and not
include the titlegraphics.

> I didn't test your patch. However, here are some late comments about
> this suggestion.
>
>> Maybe we can have a titlegraphics like,
>>
>> #+attr_beamer: :titlegraphics t
>> [[file:link.pdf]]
>
> I think
>
>   #+TITLEGRAPHICS: [[file:link.pdf]]
>
> would be cleaner.

I dropped this.  One might need to add attributes to the graphic.  The
#+titlegraphics approach wouldn’t allow it.  I think it’s a problem that
can be pushed down the line.

>>   Plain List
>> @@ -855,21 +866,65 @@ holding export options."
>> (when (integerp sec-num)
>>   (format "\\setcounter{secnumdepth}{%d}\n" sec-num)))
>>   ;; Author.
>> - (let ((author (and (plist-get info :with-author)
>> -(let ((auth (plist-get info :author)))
>> -  (and auth (org-export-data auth info)
>> -   (email (and (plist-get info :with-email)
>> -   (org-export-data (plist-get info :email) info
>> + (let* ((author (and (plist-get info :with-author)
>> + (let ((auth (plist-get info :author)))
>> +   (and auth (org-export-data auth info)
>> +(short-author (and author (plist-get info :short-author)))
>
> Since "short-author" is `parsed', this should be wrapped within
> `org-export-data' somehow. You do it below, but it introduces some code
> duplication.
>
>> +(email (and (plist-get info :with-email)
>> +(org-export-data (plist-get info :email) info)))
>> +)
>
> You left a dangling parenthesis.
>
>> (cond ((and author email (not (string= "" email)))
>> -  (format "\\author{%s\\thanks{%s}}\n" author email))
>> - ((or author email) (format "\\author{%s}\n" (or author email)
>> +  (format "\\author%s{%s\\thanks{%s}}\n"
>> +  (if short-author
>> +  (format "[%s]" (org-export-data short-author info)) 
>> "")
>> +  author email))
>> + ((or author email) (format "\\author%s{%s}\n"
>> +(if short-author
>> +(format "[%s]" (org-export-data 
>> short-author info)) "")
>> +(or author email)
>
> See above. Also, I would move the (format ...) below (or author email)
>
>>   ;; Date.
>> - (let ((date (and (plist-get info :with-date) (org-export-get-date 
>> info
>> -   (format "\\date{%s}\n" (org-export-data date info)))
>> - ;; Title
>> - (format "\\title{%s}\n" title)
>> + (let* ((date (and (plist-get info :with-date) (org-export-get-date 
>> info)))
>> +;; TODO: add optional argument of ‘org-export-get-date’.
>> +(short-date (and date (org-export-data
>> +   (org-export-get-date
>> +(plist-put info :date
>> +   (plist-get info 
>> :beamer-short-date)))
>> +   info
>> +   (format "\\date%s{%s}\n" (if (org-string-nw-p short-date)
>> +(format "[%s]" short-date) "")
>
> I would put the "" below (format "[%s]" short-date): it doesn't make
> clear there is an else branch otherwise.
>
>> +   (org-export-data date info)))
>> + ;; Title.
>> + (let ((short-title (and title
>> + (plist-get info :beamer-short-title
>> +   (format "\\title%s{%s}\n"
>> +   (if short-title (format "[%s]" (org-export-data short-title 
>> info)) "")
>> +   title))
>
> See above.
>
>> + ;; Titlegraphics.
>> + (let ((titlegraphic-link
>> +(org-element-map (plist-get info :parse-tree) 'link
>> +  (lambda (link)
>> +(when (and (org-export-inline-image-p link)
>> +   (plist-get (org-export-read-attribute
>> +   :attr_beamer 
>> (org-export-get-parent-element link))
>> +  :titlegraphic))
>> +  link))
>> +  info t)))

Should all be fixed.

Thanks,
Rasmus

-- 
Human: An animal that complicates things more than strictly necessary
>From 56737ea87fd523d2e88b732af110008b993c7310 Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Thu, 2 Jun 2016 11:44:56 +0200
Subject: [PATCH 1/2] ox-beamer: Remove customizable subtitle

* lisp/ox-beamer.el (org-beamer-subtitle-format): Remove.
  (:options-alist): Remove :beamer-subtitle-format.
---
 doc/org.texi  |  4 +---
 lisp/ox-beamer.el | 11 ---
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 56779e8..2c9cb64 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11077,9 +11077,7 @@ can use several @code{#+KEYWORDS} if the