From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [Exporter] Why fall-back to :title if :alt-title is nil? Date: Sat, 16 Nov 2013 13:38:08 +0100 Message-ID: <87habcldxr.fsf@gmail.com> References: <87li0olk4h.fsf@gmail.com> <877gc8k3v5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhf8w-0003zE-FC for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 07:38:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vhf8p-0000Wb-5I for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 07:38:30 -0500 Received: from plane.gmane.org ([80.91.229.3]:36883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhf8o-0000WW-Uk for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 07:38:23 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Vhf8l-0004hf-2T for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 13:38:19 +0100 Received: from e178061046.adsl.alicedsl.de ([85.178.61.46]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 16 Nov 2013 13:38:19 +0100 Received: from tjolitz by e178061046.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 16 Nov 2013 13:38:19 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nicolas Goaziou writes: Hello, > Thorsten Jolitz 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