From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [Exporter] Why fall-back to :title if :alt-title is nil?
Date: Sat, 16 Nov 2013 13:38:08 +0100 [thread overview]
Message-ID: <87habcldxr.fsf@gmail.com> (raw)
In-Reply-To: 877gc8k3v5.fsf@gmail.com
Nicolas Goaziou <n.goaziou@gmail.com> writes:
Hello,
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List,
>>
>> in ox.el I find this function for getting the (optional) alternative
>> title of a headline:
>>
>> #+begin_src emacs-lisp
>> (defun org-export-get-alt-title (headline info)
>> "Return alternative title for HEADLINE, as a secondary string.
>> INFO is a plist used as a communication channel. If no optional
>> title is defined, fall-back to the regular title."
>> (or (org-element-property :alt-title headline)
>> (org-element-property :title headline)))
>> #+end_src
>>
>> I'm not so sure that it is a good idea to fallback to the regular
>> title in case :alt-title is nil, because when extracting both, title
>> and alt-title, from a headline, there is a almost always a
>> duplication (the regular title string is received two times, via the
>> get-title and get-alt-title functions) because :alt-title isn't
>> really set very often.
>>
>> Wouldn't it make more sense to just return nil when :alt-title is
>> nil? If the application code needs a title string anyway, it can
>> always fall-back to a call to the get-title function.
>
> There is no "get-title" function.
>
> When building a TOC, you are required to get a title for the current
> entry. This function prevent checking both sources.
>
> Anyway, I think this is nitpicking, because you can always check if its
> return value equals (org-element-property :title headline).
it is nitpicking and not really important, but a function name like
,------------------------------------------------
| (defun org-export-get-toc-title (headline info)
`------------------------------------------------
would probably better describe what the function really does.
--
cheers,
Thorsten
prev parent reply other threads:[~2013-11-16 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-16 10:24 [Exporter] Why fall-back to :title if :alt-title is nil? Thorsten Jolitz
2013-11-16 11:01 ` Nicolas Goaziou
2013-11-16 12:38 ` Thorsten Jolitz [this message]
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=87habcldxr.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).