emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>,
	Nicolas Goaziou <mail@nicolasgoaziou.fr>,
	Eric S Fraga <e.fraga@ucl.ac.uk>
Subject: Re: Buffer local value lost when exporting? (was Evaluate all org tables in file before exporting)
Date: Fri, 13 May 2016 16:33:05 +0000	[thread overview]
Message-ID: <CAFyQvY3vMk2mogmmwiohx9A13MW6HaB5SzvryEZ6jFjea7cbmA@mail.gmail.com> (raw)
In-Reply-To: <87lh3e7wn8.fsf@saiph.selenimh>

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

On Fri, May 13, 2016 at 12:25 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> For completeness, export process actually inherits some buffer local
> values. See `org-export--generate-copy-script', in particular
>
>   ;; Copy specific buffer local variables and variables set
>   ;; through BIND keywords.
>   ,@(let ((bound-variables (org-export--list-bound-variables))
>           vars)
>       (dolist (entry (buffer-local-variables (buffer-base-buffer)) vars)
>         (when (consp entry)
>           (let ((var (car entry))
>                 (val (cdr entry)))
>             (and (not (memq var org-export-ignored-local-variables))
>                  (or (memq var
>                            '(default-directory
>                               buffer-file-name
>                               buffer-file-coding-system))
>                      (assq var bound-variables)
>                      (string-match "^\\(org-\\|orgtbl-\\)"
>                                    (symbol-name var)))
>                  ;; Skip unreadable values, as they cannot be
>                  ;; sent to external process.
>                  (or (not val) (ignore-errors (read (format "%S" val))))
>                  (push `(set (make-local-variable (quote ,var))
>                              (quote ,val))
>                        vars))))))
>
> So basically, it copies all Org related variables, default directory,
> buffer-file-name buffer-file-coding-system and any variable defined as
> a BIND keyword, provided their value is `read'-able (e.g., not a hash
> table).
>

Thanks for that info guys!

It got it working after setting org-export-allow-bind-keywords to t BUT now
I need to set the buffer local value twice: (1) Using the Local Variables
footer style so that that local value is effective when before-save-hook is
run (2) Using #+BIND so that that value is effective when
 org-export-before-processing-hook is run.

Below is the MWE now:

=====
| N |
|---|
|   |
|   |
|   |
|   |
#+TBLFM: $1=@#-1

#+BIND: modi/org-table-enable-buffer-wide-recalculation nil
# Local Variables:
# modi/org-table-enable-buffer-wide-recalculation: nil
# End:
=====

-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3033 bytes --]

  reply	other threads:[~2016-05-13 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 14:58 Evaluate all org tables in file before exporting? Kaushal Modi
2016-05-12 15:54 ` Buffer local value lost when exporting? (was Evaluate all org tables in file before exporting) Kaushal Modi
2016-05-12 16:58   ` Kaushal Modi
     [not found] ` <1ce7789874d84d4d861eabf587693621@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-05-13  7:04   ` Eric S Fraga
2016-05-13 16:22     ` Kaushal Modi
2016-05-13 16:25     ` Nicolas Goaziou
2016-05-13 16:33       ` Kaushal Modi [this message]
2016-05-14  8:25         ` Nicolas Goaziou

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=CAFyQvY3vMk2mogmmwiohx9A13MW6HaB5SzvryEZ6jFjea7cbmA@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).