emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-python initialize session failed.
@ 2018-04-07 13:45 stardiviner
  0 siblings, 0 replies; only message in thread
From: stardiviner @ 2018-04-07 13:45 UTC (permalink / raw)
  To: org-mode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


I have following org document:

* requests-html
:PROPERTIES:
:header-args: :session requests-html
:END:

Make a GET request to 'python.org', using Requests:

#+begin_src python
from requests_html import HTMLSession
session = HTMLSession()

r = session.get('https://python.org/')
#+end_src

#+RESULTS[<2018-04-07 21:38:24> a98f4a8134cee844ae0a04363d9fbd86be2d160b]:

Grab a list of all links on the page, as–is (anchors excluded):

#+begin_src python
r.html.links
# {'//docs.python.org/3/tutorial/', '/about/apps/', 'https://github.com/python/pythondotorg/issues', '/accounts/login/', '/dev/peps/', '/about/legal/', '//docs.python.org/3/tutorial/introduction.html#lists', '/download/alternatives', 'http://feedproxy.google.com/~r/PythonInsider/~3/kihd2DW98YY/python-370a4-is-available-for-testing.html', '/download/other/', '/downloads/windows/', 'https://mail.python.org/mailman/listinfo/python-dev', '/doc/av', 'https://devguide.python.org/', '/about/success/#engineering', 'https://wiki.python.org/moin/PythonEventsCalendar#Submitting_an_Event', 'https://www.openstack.org', '/about/gettingstarted/', 'http://feedproxy.google.com/~r/PythonInsider/~3/AMoBel8b8Mc/python-3.html', '/success-stories/industrial-light-magic-runs-python/', 'http://docs.python.org/3/tutorial/introduction.html#using-python-as-a-calculator', '/', 'http://pyfound.blogspot.com/', '/events/python-events/past/', '/downloads/release/python-2714/', 'https://wiki.python.org/moin/PythonBooks', 'http://plus.google.com/+Python', 'https://wiki.python.org/moin/', 'https://status.python.org/', '/community/workshops/', '/community/lists/', 'http://buildbot.net/', '/community/awards', 'http://twitter.com/ThePSF', 'https://docs.python.org/3/license.html', '/psf/donations/', 'http://wiki.python.org/moin/Languages', '/dev/', '/events/python-user-group/', 'https://wiki.qt.io/PySide', '/community/sigs/', 'https://wiki.gnome.org/Projects/PyGObject', 'http://www.ansible.com', 'http://www.saltstack.com', 'http://planetpython.org/', '/events/python-events', '/about/help/', '/events/python-user-group/past/', '/about/success/', '/psf-landing/', '/about/apps', '/about/', 'http://www.wxpython.org/', '/events/python-user-group/665/', 'https://www.python.org/psf/codeofconduct/', '/dev/peps/peps.rss', '/downloads/source/', '/psf/sponsorship/sponsors/', 'http://bottlepy.org', 'http://roundup.sourceforge.net/', 'http://pandas.pydata.org/', 'http://brochure.getpython.info/', 'https://bugs.python.org/', '/community/merchandise/', 'http://tornadoweb.org', '/events/python-user-group/650/', 'http://flask.pocoo.org/', '/downloads/release/python-364/', '/events/python-user-group/660/', '/events/python-user-group/638/', '/psf/', '/doc/', 'http://blog.python.org', '/events/python-events/604/', '/about/success/#government', 'http://python.org/dev/peps/', 'https://docs.python.org', 'http://feedproxy.google.com/~r/PythonInsider/~3/zVC80sq9s00/python-364-is-now-available.html', '/users/membership/', '/about/success/#arts', 'https://wiki.python.org/moin/Python2orPython3', '/downloads/', '/jobs/', 'http://trac.edgewall.org/', 'http://feedproxy.google.com/~r/PythonInsider/~3/wh73_1A-N7Q/python-355rc1-and-python-348rc1-are-now.html', '/privacy/', 'https://pypi.python.org/', 'http://www.riverbankcomputing.co.uk/software/pyqt/intro', 'http://www.scipy.org', '/community/forums/', '/about/success/#scientific', '/about/success/#software-development', '/shell/', '/accounts/signup/', 'http://www.facebook.com/pythonlang?fref=ts', '/community/', 'https://kivy.org/', '/about/quotes/', 'http://www.web2py.com/', '/community/logos/', '/community/diversity/', '/events/calendars/', 'https://wiki.python.org/moin/BeginnersGuide', '/success-stories/', '/doc/essays/', '/dev/core-mentorship/', 'http://ipython.org', '/events/', '//docs.python.org/3/tutorial/controlflow.html', '/about/success/#education', '/blogs/', '/community/irc/', 'http://pycon.blogspot.com/', '//jobs.python.org', 'http://www.pylonsproject.org/', 'http://www.djangoproject.com/', '/downloads/mac-osx/', '/about/success/#business', 'http://feedproxy.google.com/~r/PythonInsider/~3/x_c9D0S-4C4/python-370b1-is-now-available-for.html', 'http://wiki.python.org/moin/TkInter', 'https://docs.python.org/faq/', '//docs.python.org/3/tutorial/controlflow.html#defining-functions'}
#+end_src

But when I execute the src block, it report error:

Debugger entered--Lisp error: (error "Buffer *Python-requests-html* does not exist or has no process")
  signal(error ("Buffer *Python-requests-html* does not exist or has no process"))
  error("Buffer %s does not exist or has no process" "*Python-requests-html*")
  (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session))
  (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate))))
  (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2)
  (mapconcat (function org-trim) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2) "\n")
  (let ((body (if (string-match-p ".\n+." body) (let ((tmp-src-file (org-babel-temp-file "python-"))) (let ((temp-file tmp-src-file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert body)) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (format org-babel-python--exec-tmpfile tmp-src-file)) body))) (mapconcat (function org-trim) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2) "\n"))
  (cond ((eq result-type 'output) (let ((body (if (string-match-p ".\n+." body) (let ((tmp-src-file (org-babel-temp-file "python-"))) (let ((temp-file tmp-src-file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert body)) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (format org-babel-python--exec-tmpfile tmp-src-file)) body))) (mapconcat (function org-trim) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2) "\n"))) ((eq result-type 'value) (let ((tmp-file (org-babel-temp-file "python-"))) (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (let ((comint-process-echoes nil)) (funcall input-body body) (funcall dump-last-value tmp-file (member "pp" result-params)) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait)) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and nil body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) (org-babel-eval-read-file tmp-file))) (t nil))
  (let* ((send-wait (function (lambda nil (comint-send-input nil t) (sleep-for 0 5)))) (dump-last-value (function (lambda (tmp-file pp) (mapc (function (lambda (statement) (insert statement) (funcall send-wait))) (if pp (list "import pprint" (format "open('%s', 'w').write(pprint.pformat(_))" (org-babel-process-file-name tmp-file 'noquote))) (list (format "open('%s', 'w').write(str(_))" (org-babel-process-file-name tmp-file 'noquote)))))))) (input-body (function (lambda (body) (mapc (function (lambda (line) (insert line) (funcall send-wait))) (split-string body "[\15\n]")) (funcall send-wait)))) (results (cond ((eq result-type 'output) (let ((body (if (string-match-p ".\n+." body) (let ((tmp-src-file (org-babel-temp-file "python-"))) (let ((temp-file tmp-src-file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert body)) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (format org-babel-python--exec-tmpfile tmp-src-file)) body))) (mapconcat (function org-trim) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2) "\n"))) ((eq result-type 'value) (let ((tmp-file (org-babel-temp-file "python-"))) (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does not exist or has no process" session)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer session) (save-excursion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (function (lambda (text) (setq string-buffer (concat string-buffer text)))) comint-output-filter-functions)) dangling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (let ((comint-process-echoes nil)) (funcall input-body body) (funcall dump-last-value tmp-file (member "pp" result-params)) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait)) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if (and nil body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substring string-buffer (match-end 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) (org-babel-eval-read-file tmp-file))) (t nil)))) (if (string= (substring org-babel-python-eoe-indicator 1 -1) results) nil (let ((--params result-params)) (if (member "none" --params) nil (if (or (member "scalar" --params) (member "verbatim" --params) (member "html" --params) (member "code" --params) (member "pp" --params) (member "file" --params) (and (or (member "output" --params) (member "raw" --params) (member "org" --params) (member "drawer" --params)) (not (member "table" --params)))) results (org-babel-python-table-or-string results))))))
  org-babel-python-evaluate-session("*Python-requests-html*" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" output ("replace" "output"))
  (if session (org-babel-python-evaluate-session session body result-type result-params) (org-babel-python-evaluate-external-process body result-type result-params preamble))
  org-babel-python-evaluate("*Python-requests-html*" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" output ("replace" "output") nil)
  (let* ((org-babel-python-command (or (cdr (assq :python params)) org-babel-python-command)) (session (org-babel-python-initiate-session (cdr (assq :session params)))) (result-params (cdr (assq :result-params params))) (result-type (cdr (assq :result-type params))) (return-val (if (and (eq result-type 'value) (not session)) (progn (cdr (assq :return params))))) (preamble (cdr (assq :preamble params))) (full-body (org-babel-expand-body:generic (concat body (if return-val (format "\nreturn %s" return-val) "")) params (org-babel-variable-assignments:python params))) (result (org-babel-python-evaluate session full-body result-type result-params preamble))) (org-babel-reassemble-table result (org-babel-pick-name (cdr (assq :colname-names params)) (cdr (assq :colnames params))) (org-babel-pick-name (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))
  org-babel-execute:python("from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "code") (:hlines . "no") (:tangle . "no") (:comments . "links") (:cache . "yes") (:noweb . "yes") (:eval . "yes") (:session . "requests-html")))
  funcall(org-babel-execute:python "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "code") (:hlines . "no") (:tangle . "no") (:comments . "links") (:cache . "yes") (:noweb . "yes") (:eval . "yes") (:session . "requests-html")))
  (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))
  (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r)))
  (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang)))
  (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)
  (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)))
  (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result))))
  (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)))))
  (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result))))))
  (let* ((org-babel-current-src-block-location (or org-babel-current-src-block-location (nth 5 info) (org-babel-where-is-src-block-head))) (info (if info (copy-tree info) (org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)))))))
  (closure (*this* org-babel-confirm-evaluate-answer-no t) (&optional arg info params) "Execute the current source code block.\nInsert the results of execution into the buffer.  Source code\nexecution and the collection and formatting of results can be\ncontrolled through a variety of header arguments.\n\nWith prefix argument ARG, force re-execution even if an existing\nresult cached in the buffer would otherwise have been returned.\n\nOptionally supply a value for INFO in the form returned by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for PARAMS which will be merged with\nthe header arguments specified at the front of the source code\nblock." (interactive) (let* ((org-babel-current-src-block-location (or org-babel-current-src-block-location (nth 5 info) (org-babel-where-is-src-block-head))) (info (if info (copy-tree info) (org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result))))))))(nil ("python" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:results . "output replace") (:exports . "code") (:session . "requests-html") (:eval . "yes") (:noweb . "yes") (:cache . "yes") (:comments . "links") (:tangle . "no") (:hlines . "no")) "" nil 4645 "(ref:%s)") nil)
  ob-async-org-babel-execute-src-block((closure (*this* org-babel-confirm-evaluate-answer-no t) (&optional arg info params) "Execute the current source code block.\nInsert the results of execution into the buffer.  Source code\nexecution and the collection and formatting of results can be\ncontrolled through a variety of header arguments.\n\nWith prefix argument ARG, force re-execution even if an existing\nresult cached in the buffer would otherwise have been returned.\n\nOptionally supply a value for INFO in the form returned by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for PARAMS which will be merged with\nthe header arguments specified at the front of the source code\nblock." (interactive) (let* ((org-babel-current-src-block-location (or org-babel-current-src-block-location (nth 5 info) (org-babel-where-is-src-block-head))) (info (if info (copy-tree info) (org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)))))))) nil ("python" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:results . "output replace") (:exports . "code") (:session . "requests-html") (:eval . "yes") (:noweb . "yes") (:cache . "yes") (:comments . "links") (:tangle . "no") (:hlines . "no")) "" nil 4645 "(ref:%s)"))
  apply(ob-async-org-babel-execute-src-block (closure (*this* org-babel-confirm-evaluate-answer-no t) (&optional arg info params) "Execute the current source code block.\nInsert the results of execution into the buffer.  Source code\nexecution and the collection and formatting of results can be\ncontrolled through a variety of header arguments.\n\nWith prefix argument ARG, force re-execution even if an existing\nresult cached in the buffer would otherwise have been returned.\n\nOptionally supply a value for INFO in the form returned by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for PARAMS which will be merged with\nthe header arguments specified at the front of the source code\nblock." (interactive) (let* ((org-babel-current-src-block-location (or org-babel-current-src-block-location (nth 5 info) (org-babel-where-is-src-block-head))) (info (if info (copy-tree info) (org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-directory (expand-file-name dir))) default-directory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for %s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body params) (message "result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" result-params) (member "table" result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (and result (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params))))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-params (remove "file" result-params)))))))) (org-babel-insert-result result result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result)))))))) (nil ("python" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:results . "output replace") (:exports . "code") (:session . "requests-html") (:eval . "yes") (:noweb . "yes") (:cache . "yes") (:comments . "links") (:tangle . "no") (:hlines . "no")) "" nil 4645 "(ref:%s)")))
  org-babel-execute-src-block(nil ("python" "from requests_html import HTMLSession\nsession = HTMLSession()\n\nr = session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:results . "output replace") (:exports . "code") (:session . "requests-html") (:eval . "yes") (:noweb . "yes") (:cache . "yes") (:comments . "links") (:tangle . "no") (:hlines . "no")) "" nil 4645 "(ref:%s)"))
  (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))
  (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively (function org-footnote-action))) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively (function org-set-tags)))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at line %d" (org-current-line block-item))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function delete-overlay) org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '(org-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (--data (mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (memq type --invisible-types) (list (if --markers\? (copy-marker beg) beg) (if --markers\? (copy-marker end t) end) type))))) (save-excursion (save-restriction (widen) (overlays-in (point-min) (point-max))))))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction (widen) (let ((--dolist-tail-- --invisible-types)) (while --dolist-tail-- (let ((type (car --dolist-tail--))) (remove-overlays (point-min) (point-max) 'invisible type) (setq --dolist-tail-- (cdr --dolist-tail--))))) (let ((--dolist-tail-- (delq nil --data))) (while --dolist-tail-- (let ((x101 (car --dolist-tail--))) (let* ((x102 (car x101)) (x103 (cdr x101)) (x104 (car x103)) (x105 (cdr x103)) (x106 (car x105)) (x107 (cdr x105))) (let ((type x106) (end x104) (beg x102)) (progn (org-flag-region beg end t type) (if --markers\? (progn (set-marker beg nil) (set-marker end nil)))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dolist-tail-- (org-list-get-all-items begin struct (org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox begin struct new-box))) (org-list-write-struct struct (org-list-parents-alist struct) old-struct) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively (function org-property-action))) ((eq type 'radio-target) (call-interactively (function org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (call-interactively (function org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (= (point) (org-element-property :end context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (goto-char (org-element-property :contents-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) (cond (arg (call-interactively (function org-table-recalculate))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively (function org-set-tags))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))
  (let* ((pcase-2 (function (lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambda nil (org-timestamp-change 0 'day))))) (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively (function org-footnote-action))) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively (function org-set-tags)))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at line %d" (org-current-line block-item))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function delete-overlay) org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '(org-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (--data (mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (memq type --invisible-types) (list (if --markers\? (copy-marker beg) beg) (if --markers\? (copy-marker end t) end) type))))) (save-excursion (save-restriction (widen) (overlays-in (point-min) (point-max))))))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction (widen) (let ((--dolist-tail-- --invisible-types)) (while --dolist-tail-- (let ((type (car --dolist-tail--))) (remove-overlays (point-min) (point-max) 'invisible type) (setq --dolist-tail-- (cdr --dolist-tail--))))) (let ((--dolist-tail-- (delq nil --data))) (while --dolist-tail-- (let ((x101 (car --dolist-tail--))) (let* ((x102 (car x101)) (x103 (cdr x101)) (x104 (car x103)) (x105 (cdr x103)) (x106 (car x105)) (x107 (cdr x105))) (let ((type x106) (end x104) (beg x102)) (progn (org-flag-region beg end t type) (if --markers\? (progn (set-marker beg nil) (set-marker end nil)))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dolist-tail-- (org-list-get-all-items begin struct (org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox begin struct new-box))) (org-list-write-struct struct (org-list-parents-alist struct) old-struct) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively (function org-property-action))) ((eq type 'radio-target) (call-interactively (function org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (call-interactively (function org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (= (point) (org-element-property :end context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (goto-char (org-element-property :contents-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) (cond (arg (call-interactively (function org-table-recalculate))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively (function org-set-tags))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2))))
  (let* ((context (org-element-lineage (org-element-context) '(babel-call clock dynamic-block footnote-definition footnote-reference inline-babel-call inline-src-block inlinetask item keyword node-property paragraph plain-list planning property-drawer radio-target src-block statistics-cookie table table-cell table-row timestamp) t)) (type (org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent (org-element-property :parent context))) (if (and (eq (org-element-type parent) 'item) (= (line-beginning-position) (org-element-property :begin parent))) (progn (setq context parent) (setq type 'item)))))) (let* ((pcase-2 (function (lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambda nil (org-timestamp-change 0 'day))))) (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively (function org-footnote-action))) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively (function org-set-tags)))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at line %d" (org-current-line block-item))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function delete-overlay) org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '(org-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (--data (mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (memq type --invisible-types) (list (if --markers\? (copy-marker beg) beg) (if --markers\? (copy-marker end t) end) type))))) (save-excursion (save-restriction (widen) (overlays-in (point-min) (point-max))))))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction (widen) (let ((--dolist-tail-- --invisible-types)) (while --dolist-tail-- (let ((type (car --dolist-tail--))) (remove-overlays (point-min) (point-max) 'invisible type) (setq --dolist-tail-- (cdr --dolist-tail--))))) (let ((--dolist-tail-- (delq nil --data))) (while --dolist-tail-- (let ((x101 (car --dolist-tail--))) (let* ((x102 (car x101)) (x103 (cdr x101)) (x104 (car x103)) (x105 (cdr x103)) (x106 (car x105)) (x107 (cdr x105))) (let ((type x106) (end x104) (beg x102)) (progn (org-flag-region beg end t type) (if --markers\? (progn (set-marker beg nil) (set-marker end nil)))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dolist-tail-- (org-list-get-all-items begin struct (org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox begin struct new-box))) (org-list-write-struct struct (org-list-parents-alist struct) old-struct) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively (function org-property-action))) ((eq type 'radio-target) (call-interactively (function org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (call-interactively (function org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (= (point) (org-element-property :end context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (goto-char (org-element-property :contents-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) (cond (arg (call-interactively (function org-table-recalculate))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively (function org-set-tags))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))))
  (cond ((or (and (boundp 'org-clock-overlays) org-clock-overlays) org-occur-highlights) (if (boundp 'org-clock-overlays) (progn (org-clock-remove-overlays))) (org-remove-occur-highlights) (message "Temporary highlights/overlays removed from current buffer")) ((and (local-variable-p 'org-finish-function) (fboundp org-finish-function)) (funcall org-finish-function)) ((org-babel-hash-at-point)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) (t (let* ((context (org-element-lineage (org-element-context) '(babel-call clock dynamic-block footnote-definition footnote-reference inline-babel-call inline-src-block inlinetask item keyword node-property paragraph plain-list planning property-drawer radio-target src-block statistics-cookie table table-cell table-row timestamp) t)) (type (org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent (org-element-property :parent context))) (if (and (eq (org-element-type parent) 'item) (= (line-beginning-position) (org-element-property :begin parent))) (progn (setq context parent) (setq type 'item)))))) (let* ((pcase-2 (function (lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambda nil (org-timestamp-change 0 'day))))) (cond ((memq type '(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively (function org-footnote-action))) ((memq type '(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin context)) (call-interactively (function org-set-tags)))) ((eq type 'item) (let* ((box (org-element-property :checkbox context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbox (org-element-property :begin context) struct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal arg '(4))) "[ ]") ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal struct old-struct)) (if (equal arg '(16)) (message "Checkboxes already reset") (user-error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Checkboxes were removed due to empty box at line %d" (org-current-line block-item))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays) (progn (mapc (function delete-overlay) org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '(org-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (--data (mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (memq type --invisible-types) (list (if --markers\? (copy-marker beg) beg) (if --markers\? (copy-marker end t) end) type))))) (save-excursion (save-restriction (widen) (overlays-in (point-min) (point-max))))))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-restriction (widen) (let ((--dolist-tail-- --invisible-types)) (while --dolist-tail-- (let ((type (car --dolist-tail--))) (remove-overlays (point-min) (point-max) 'invisible type) (setq --dolist-tail-- (cdr --dolist-tail--))))) (let ((--dolist-tail-- (delq nil --data))) (while --dolist-tail-- (let ((x101 (car --dolist-tail--))) (let* ((x102 (car x101)) (x103 (cdr x101)) (x104 (car x103)) (x105 (cdr x103)) (x106 (car x105)) (x107 (cdr x105))) (let ((type x106) (end x104) (beg x102)) (progn (org-flag-region beg end t type) (if --markers\? (progn (set-marker beg nil) (set-marker end nil)))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))))))) (message "Local setup has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-property :contents-begin context)) (struct (org-element-property :structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion (goto-char begin) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (new-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if first-box nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dolist-tail-- (org-list-get-all-items begin struct (org-list-prevs-alist struct)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (org-list-set-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist-tail--)))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox begin struct new-box))) (org-list-write-struct struct (org-list-parents-alist struct) old-struct) (org-update-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (call-interactively (function org-property-action))) ((eq type 'radio-target) (call-interactively (function org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (call-interactively (function org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (if (eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit table.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (= (point) (org-element-property :end context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (goto-char (org-element-property :contents-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) (cond (arg (call-interactively (function org-table-recalculate))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively (function org-set-tags))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))))))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)


And even I explicitly switch to session REPL which is not launched yet
with [C-c C-v C-z]. The Python session buffer (*Python-request-html*) is
shown up, but the prompt never raise up. Seems Python REPL can be
initialized.

- --
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrIy38ACgkQG13xyVro
msOloQgAkNNvAfQRCnL4P4yVwACpFxmaCOCC77K/dVswW5b8C/KQzw1Ywn81uQ6K
Gt9plwfWAxNyIfhe4e0ZfzV65hYRrLCMc1tZr0T850n3sjeXwjwgIupWhIvj7iOP
zCAcw235nsRC1SIu5E1cq9SF1ef01wqugYDGqXtNIUlSgdeFQIyEvI8k4EPIEU2X
EUlnDihEOXR/9mzECGHZFvEV73rIfmGv3uGc8d7AmE6uAQdmKVkTmXa45aTMuk/B
SbRAAK2CRWsuSSB2sgHgLOiX3xfP9O76Rjm9Kd+jilAQSiCsQAg67mpewM++crOq
bEgvdcKu9ftn2u9h4vDTShtYdtK8zQ==
=4LZj
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-07 13:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 13:45 ob-python initialize session failed stardiviner

Code repositories for project(s) associated with this 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).