emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Oleg Sivokon <olegsivokon@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: org-babel-ref-parse needs to set current buffer to the buffer of the marker [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)]
Date: Tue, 05 May 2015 18:50:28 +0300	[thread overview]
Message-ID: <8761873tx7.fsf@gmail.com> (raw)


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

Hello,

I've been having this problem for a while, and now I think I found its
culprit: The org-babel-ref-parse function will try to move the point in
a wrong buffer (a temporary buffer with the contents of the buffer being
exported), while doing so, it will not switch to this temporary buffer.
Below is what I did to deal with it:

(defun org-babel-ref-parse (assignment)
  "Parse a variable ASSIGNMENT in a header argument.
If the right hand side of the assignment has a literal value
return that value, otherwise interpret as a reference to an
external resource and find its value using
`org-babel-ref-resolve'.  Return a list with two elements.  The
first element of the list will be the name of the variable, and
the second will be an emacs-lisp representation of the value of
the variable."
  (when (string-match org-babel-ref-split-regexp assignment)
    (let ((var (match-string 1 assignment))
	  (ref (match-string 2 assignment)))
      (cons (intern var)
	    (let ((out (save-excursion
			 (when org-babel-current-src-block-location
               ;; Added this line, to avoid
               ;; "Marker points into wrong buffer" error
			   (set-buffer (marker-buffer org-babel-current-src-block-location))
			   (goto-char org-babel-current-src-block-location))
			 (org-babel-read ref))))
	      (if (equal out ref)
		  (if (string-match "^\".*\"$" ref)
		      (read ref)
		    (org-babel-ref-resolve ref))
		out))))))

Best,

Oleg

Emacs  : GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.12)
 of 2015-05-03 on wvxvvw-laptop
Package: Org-mode version 8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)

current state:
==============
(setq
 org-export-backends '(ascii html icalendar latex man texinfo)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe
                      org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-latex-classes '(("djcb-org-article"
                      "\\documentclass[11pt,a4paper]{article}\n\\usepackage[T1]{fontenc}\n\\usepackage{fontspec}\n\\usepackage{graphicx}\n\\usepackage{hyperref}\n\\usepackage[normalem]{ulem}\n\\defaultfontfeatures{Mapping=tex-text}\n\\setromanfont{Gentium}\n\\setromanfont [BoldFont={Gentium Basic Bold},\n                ItalicFont={Gentium Basic Italic}]{Gentium Basic}\n\\setsansfont{Charis SIL Compact}\n\\setmonofont[Scale=0.8]{DejaVuSansMono}\n\\usepackage{geometry}\n\\geometry{a4paper, textwidth=6.5in, textheight=10in,\n            marginparsep=7pt, marginparwidth=.6in}\n\\pagestyle{empty}\n\\title{}\n      [NO-DEFAULT-PACKAGES]\n      [NO-PACKAGES]"
                      ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("koma-article" "\\documentclass{scrartcl}" ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("org-article"
                      "\\documentclass{org-article}\n             [NO-DEFAULT-PACKAGES]\n             [PACKAGES]\n             [EXTRA]"
                      ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
                      ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}")
                      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("memoir"
                      "\\documentclass[oneside]{memoir}\n             [DEFAULT-PACKAGES]\n             [PACKAGES]\n             [EXTRA]"
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     )
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-latex-pdf-process '("latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode' -pdf -f %f")
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-default-notes-file "~/org/notes.org"
 org-babel-latex-htlatex "htlatex"
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\<Oleg Sivokon\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-hide-inline-tasks
                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-plantuml-jar-path "/home/wvxvw/Projects/org-mode/contrib/scripts/plantuml.jar"
 org-latex-packages-alist '(("AUTO" "inputenc" t))
 org-babel-tangle-lang-exts '(("latex" . "tex") ("maxima" . "max") ("python" . "py") ("lisp" . "lisp")
                              ("haxe" . "hx") ("prolog" . "pl") ("emacs-lisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-latex-listings t
 org-babel-load-languages '((haxe . t) (emacs-lisp . t) (plantuml . t) (lisp . t) (prolog . t) (python . t)
                            (dot . t) (maxima . t) (latex . t) (R . t) (sql . t) (sqlite . t) (sh . t))
 org-agenda-files '("~/.org/tasks.org" "~/Projects/walla/README.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-src-fontify-natively t
 org-publish-project-alist '(("example" :base-directory "~/org/example" :base-extension "org" :publishing-directory
                              "~/org/out/example" :publishing-function org-html-publish-to-html :setupfile
                              "~/org/setupfile.org")
                             )
 )

             reply	other threads:[~2015-05-05 15:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 15:50 Oleg Sivokon [this message]
2015-05-07 20:04 ` Bug: org-babel-ref-parse needs to set current buffer to the buffer of the marker [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)] Nicolas Goaziou
2015-05-07 21:22   ` Oleg Sivokon
2015-05-08  8:24     ` Nicolas Goaziou
2015-05-08 13:18       ` Oleg Sivokon
2015-05-08 22:08         ` Nicolas Goaziou
2015-05-08 23:01           ` Oleg Sivokon
2015-05-09  9:04             ` 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=8761873tx7.fsf@gmail.com \
    --to=olegsivokon@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).