emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: suvayu ali <fatkasuvayu+linux@gmail.com>
To: Bastien <bzg@altern.org>
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: Wed, 2 Nov 2011 00:31:12 +0100	[thread overview]
Message-ID: <CAMXnza3bBubLrKkwjpsk+zuoyCG8mwgZqoGgLOzhWo=sJN7pkA@mail.gmail.com> (raw)
In-Reply-To: <87ipn6zwzd.fsf@gnu.org>

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

Hi Bastien and all,

On Sun, 30 Oct 2011 09:48:06 +0100
Bastien <bzg@altern.org> wrote:

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

That seems to work only when the EXPORT_OPTIONS property is set for the
subtree. Without the property, it doesn't pick up the tags:nil option
from the file header. Actually, the property list doesn't even have
the tags: property in it.

However I did find a solution along those lines and the final patch is
attached. :)

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: 0001-Respect-export-options-for-subtree-export-title.patch --]
[-- Type: text/x-patch, Size: 1577 bytes --]

From dac022f103f8498de96fa5d0e40e0b840ae9c7fb Mon Sep 17 00:00:00 2001
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Date: Wed, 2 Nov 2011 00:26:07 +0100
Subject: [PATCH] Respect export options for subtree export title

* org-exp.el (org-solidify-link-text): Respect org-export-with-tags
  when forming the export title during subtree export.

TINY CHANGE
---
 lisp/org-exp.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index fa54242..e8ad0b9 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2160,15 +2160,21 @@ (defun org-export-grab-title-from-buffer ()
 (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-infile-export-plist) :tags))
+	title)
     (save-excursion
       (goto-char rbeg)
       (when (and (org-at-heading-p)
 		 (>= (org-end-of-subtree t t) rend))
+	(when (plist-member org-export-opt-plist :tags)
+	  (setq tags (or (plist-get org-export-opt-plist :tags) tags)))
 	;; 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)))
-- 
1.7.7


  reply	other threads:[~2011-11-01 23:31 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
2011-11-01 23:31                     ` suvayu ali [this message]
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='CAMXnza3bBubLrKkwjpsk+zuoyCG8mwgZqoGgLOzhWo=sJN7pkA@mail.gmail.com' \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --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).