From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Tags included in subtree export title despite tags:nil in header Date: Sun, 30 Oct 2011 09:48:06 +0100 Message-ID: <87ipn6zwzd.fsf@gnu.org> References: <83vcra2493.fsf@yahoo.it> <20111027134220.510ec38b@kuru.homelinux.net> <20111027140516.2f6d5508@kuru.homelinux.net> <87fwic6j37.fsf@gnu.org> <20111029164832.1c83474b@kuru.homelinux.net> <871utvu66a.fsf@gnu.org> <20111030011058.2e53a791@kuru.homelinux.net> <10900.1319936847@alphaville.dokosmarshall.org> <20111030085722.3a4d81d5@kuru.homelinux.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKR2y-0008Rr-DY for emacs-orgmode@gnu.org; Sun, 30 Oct 2011 04:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKR2w-0001kt-OO for emacs-orgmode@gnu.org; Sun, 30 Oct 2011 04:47:16 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:58268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKR2w-0001ko-I3 for emacs-orgmode@gnu.org; Sun, 30 Oct 2011 04:47:14 -0400 Received: by wyg34 with SMTP id 34so6156767wyg.0 for ; Sun, 30 Oct 2011 01:47:13 -0700 (PDT) In-Reply-To: <20111030085722.3a4d81d5@kuru.homelinux.net> (Suvayu Ali's message of "Sun, 30 Oct 2011 08:57:22 +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: Suvayu Ali Cc: nicholas.dokos@hp.com, org-mode mailing list --=-=-= Content-Type: text/plain Hi Suvayu, Suvayu Ali writes: > That said, the problem I am facing is org-export-with-tags evaluates to > not-in-toc irrespective of what is set by the tags: option (see for > example the test file earlier in the thread). So effectively the test > is not checking what it is supposed to check. So I was wondering > whether I missed something I should be doing. The problem is that `org-export-with-tags' is a global option, storing the default value for any buffer (and _a fortiori_ any subtree) -- while you want to check local options, which may be different at export time. Local options are stored in a `org-export-opt-plist'. You get the value of the "tags:" option by checking the property list like this: (plist-get org-export-opt-plist :tags)) Hence the patch below, which you can try to make sure it does what you want. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=correct_title_with_no_tags.patch diff --git a/lisp/org-exp.el b/lisp/org-exp.el index fa54242..b4f6338 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2160,20 +2160,24 @@ can work correctly." (defun org-export-get-title-from-subtree () "Return subtree title and exclude it from export." (let ((rbeg (region-beginning)) (rend (region-end)) - (inhibit-read-only t) title) + (inhibit-read-only t) + (tags (plist-get org-export-opt-plist :tags)) + title) (save-excursion (goto-char rbeg) (when (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) - (setq title (or (org-entry-get nil "EXPORT_TITLE") title)))) - title)) + (setq title (or (org-entry-get nil "EXPORT_TITLE") title)) + title)))) (defun org-solidify-link-text (s &optional alist) "Take link text and make a safe target out of it." --=-=-= Content-Type: text/plain -- Bastien --=-=-=--