emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Cc: nicholas.dokos@hp.com, org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Tags included in subtree export title despite tags:nil in header
Date: Sun, 30 Oct 2011 09:48:06 +0100	[thread overview]
Message-ID: <87ipn6zwzd.fsf@gnu.org> (raw)
In-Reply-To: <20111030085722.3a4d81d5@kuru.homelinux.net> (Suvayu Ali's message of "Sun, 30 Oct 2011 08:57:22 +0100")

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

Hi Suvayu,

Suvayu Ali <fatkasuvayu+linux@gmail.com> 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!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: correct_title_with_no_tags.patch --]
[-- Type: text/x-patch, Size: 1233 bytes --]

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."

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2011-10-30  8:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 18:20 Tags included in subtree export title despite tags:nil in header suvayu ali
2011-10-27  9:06 ` Giovanni Ridolfi
2011-10-27 11:42   ` Suvayu Ali
2011-10-27 12:05     ` Suvayu Ali
2011-10-29 13:08       ` Bastien
2011-10-29 14:48         ` Suvayu Ali
2011-10-29 16:13           ` Bastien
2011-10-29 23:10             ` Suvayu Ali
2011-10-30  1:07               ` Nick Dokos
2011-10-30  7:57                 ` Suvayu Ali
2011-10-30  8:48                   ` Bastien [this message]
2011-11-01 23:31                     ` suvayu ali
2011-11-02 10:17                       ` Bastien

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=87ipn6zwzd.fsf@gnu.org \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=fatkasuvayu+linux@gmail.com \
    --cc=nicholas.dokos@hp.com \
    /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).