From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: ob-python initialize session failed. Date: Sat, 07 Apr 2018 21:45:34 +0800 Message-ID: <87d0zbb05d.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4oAO-0001PI-QO for emacs-orgmode@gnu.org; Sat, 07 Apr 2018 09:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4oAF-0000Xj-Sl for emacs-orgmode@gnu.org; Sat, 07 Apr 2018 09:46:04 -0400 Received: from [183.249.132.203] (port=9958 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4oAE-0000QJ-4E for emacs-orgmode@gnu.org; Sat, 07 Apr 2018 09:45:55 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: org-mode =2D----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 =3D HTMLSession() r =3D 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=E2=80=93is (anchors excluded): #+begin_src python r.html.links # {'//docs.python.org/3/tutorial/', '/about/apps/', 'https://github.com/pyt= hon/pythondotorg/issues', '/accounts/login/', '/dev/peps/', '/about/legal/'= , '//docs.python.org/3/tutorial/introduction.html#lists', '/download/altern= atives', 'http://feedproxy.google.com/~r/PythonInsider/~3/kihd2DW98YY/pytho= n-370a4-is-available-for-testing.html', '/download/other/', '/downloads/win= dows/', '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.op= enstack.org', '/about/gettingstarted/', 'http://feedproxy.google.com/~r/Pyt= honInsider/~3/AMoBel8b8Mc/python-3.html', '/success-stories/industrial-ligh= t-magic-runs-python/', 'http://docs.python.org/3/tutorial/introduction.html= #using-python-as-a-calculator', '/', 'http://pyfound.blogspot.com/', '/even= ts/python-events/past/', '/downloads/release/python-2714/', 'https://wiki.p= ython.org/moin/PythonBooks', 'http://plus.google.com/+Python', 'https://wik= i.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/donati= ons/', 'http://wiki.python.org/moin/Languages', '/dev/', '/events/python-us= er-group/', 'https://wiki.qt.io/PySide', '/community/sigs/', 'https://wiki.= gnome.org/Projects/PyGObject', 'http://www.ansible.com', 'http://www.saltst= ack.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.r= ss', '/downloads/source/', '/psf/sponsorship/sponsors/', 'http://bottlepy.o= rg', 'http://roundup.sourceforge.net/', 'http://pandas.pydata.org/', 'http:= //brochure.getpython.info/', 'https://bugs.python.org/', '/community/mercha= ndise/', '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://bl= og.python.org', '/events/python-events/604/', '/about/success/#government',= 'http://python.org/dev/peps/', 'https://docs.python.org', 'http://feedprox= y.google.com/~r/PythonInsider/~3/zVC80sq9s00/python-364-is-now-available.ht= ml', '/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-355= rc1-and-python-348rc1-are-now.html', '/privacy/', 'https://pypi.python.org/= ', 'http://www.riverbankcomputing.co.uk/software/pyqt/intro', 'http://www.s= cipy.org', '/community/forums/', '/about/success/#scientific', '/about/succ= ess/#software-development', '/shell/', '/accounts/signup/', 'http://www.fac= ebook.com/pythonlang?fref=3Dts', '/community/', 'https://kivy.org/', '/abou= t/quotes/', 'http://www.web2py.com/', '/community/logos/', '/community/dive= rsity/', '/events/calendars/', 'https://wiki.python.org/moin/BeginnersGuide= ', '/success-stories/', '/doc/essays/', '/dev/core-mentorship/', 'http://ip= ython.org', '/events/', '//docs.python.org/3/tutorial/controlflow.html', '/= about/success/#education', '/blogs/', '/community/irc/', 'http://pycon.blog= spot.com/', '//jobs.python.org', 'http://www.pylonsproject.org/', 'http://w= ww.djangoproject.com/', '/downloads/mac-osx/', '/about/success/#business', = 'http://feedproxy.google.com/~r/PythonInsider/~3/x_c9D0S-4C4/python-370b1-i= s-now-available-for.html', 'http://wiki.python.org/moin/TkInter', 'https://= docs.python.org/faq/', '//docs.python.org/3/tutorial/controlflow.html#defin= ing-functions'} #+end_src But when I execute the src block, it report error: Debugger entered--Lisp error: (error "Buffer *Python-requests-html* does no= t exist or has no process") signal(error ("Buffer *Python-requests-html* does not exist or has no pro= cess")) 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 no= t 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 ses= sion) (save-excursion (let ((comint-input-filter (function (lambda (_input)= nil)))) (let* ((string-buffer "") (comint-output-filter-functions (cons (f= unction (lambda (text) (setq string-buffer (concat string-buffer text)))) c= omint-output-filter-functions)) dangling-text) (goto-char (process-mark (ge= t-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max)= )) (setq dangling-text (buffer-substring start end)) (delete-region start e= nd)) (funcall input-body body) (funcall send-wait) (funcall send-wait) (ins= ert 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 comi= nt-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (cur= rent-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffe= r)))) (insert dangling-text) (if (and t body (string-match (replace-regexp-= in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buffer)) (pro= gn (setq string-buffer (substring string-buffer (match-end 0))))) (split-st= ring string-buffer comint-prompt-regexp)))))) (set-match-data save-match-da= ta-internal 'evaporate)))) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error "B= uffer %s does not exist or has no process" session)) (let ((save-match-data= -internal (match-data))) (unwind-protect (progn (save-current-buffer (set-b= uffer 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 t= ext)))) comint-output-filter-functions)) dangling-text) (goto-char (process= -mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (p= oint-max))) (setq dangling-text (buffer-substring start end)) (delete-regio= n start end)) (funcall input-body body) (funcall send-wait) (funcall send-w= ait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (while (pr= ogn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-= forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-for= ward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-pro= cess (current-buffer)))) (goto-char (process-mark (get-buffer-process (curr= ent-buffer)))) (insert dangling-text) (if (and t body (string-match (replac= e-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) string-buff= er)) (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-buff= er-livep session) nil (error "Buffer %s does not exist or has no process" s= ession)) (let ((save-match-data-internal (match-data))) (unwind-protect (pr= ogn (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)) dan= gling-text) (goto-char (process-mark (get-buffer-process (current-buffer)))= ) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-subs= tring start end)) (delete-region start end)) (funcall input-body body) (fun= call 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-i= ndicator) 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 (a= nd t body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (regexp-q= uote (or body ""))) string-buffer)) (progn (setq string-buffer (substring s= tring-buffer (match-end 0))))) (split-string string-buffer comint-prompt-re= gexp)))))) (set-match-data save-match-data-internal 'evaporate)))) 2) "\n") (let ((body (if (string-match-p ".\n+." body) (let ((tmp-src-file (org-ba= bel-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 o= rg-babel-python--exec-tmpfile tmp-src-file)) body))) (mapconcat (function o= rg-trim) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (e= rror "Buffer %s does not exist or has no process" session)) (let ((save-mat= ch-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-fu= nctions (cons (function (lambda (text) (setq string-buffer (concat string-b= uffer 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)) (delet= e-region start end)) (funcall input-body body) (funcall send-wait) (funcall= send-wait) (insert org-babel-python-eoe-indicator) (funcall send-wait) (wh= ile (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-= search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-sea= rch-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buf= fer-process (current-buffer)))) (goto-char (process-mark (get-buffer-proces= s (current-buffer)))) (insert dangling-text) (if (and t body (string-match = (replace-regexp-in-string "\n" "[\15\n]+" (regexp-quote (or body ""))) stri= ng-buffer)) (progn (setq string-buffer (substring string-buffer (match-end = 0))))) (split-string string-buffer comint-prompt-regexp)))))) (set-match-da= ta save-match-data-internal 'evaporate)))) 2) "\n")) (cond ((eq result-type 'output) (let ((body (if (string-match-p ".\n+." b= ody) (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 te= mp-buffer) (insert body)) (save-current-buffer (set-buffer temp-buffer) (wr= ite-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-com= int-buffer-livep session) nil (error "Buffer %s does not exist or has no pr= ocess" session)) (let ((save-match-data-internal (match-data))) (unwind-pro= tect (progn (save-current-buffer (set-buffer session) (save-excursion (let = ((comint-input-filter (function (lambda (_input) nil)))) (let* ((string-buf= fer "") (comint-output-filter-functions (cons (function (lambda (text) (set= q string-buffer (concat string-buffer text)))) comint-output-filter-functio= ns)) dangling-text) (goto-char (process-mark (get-buffer-process (current-b= uffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buf= fer-substring start end)) (delete-region start end)) (funcall input-body bo= dy) (funcall send-wait) (funcall send-wait) (insert org-babel-python-eoe-in= dicator) (funcall send-wait) (while (progn (goto-char comint-last-input-end= ) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-pyth= on-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 (sub= string string-buffer (match-end 0))))) (split-string string-buffer comint-p= rompt-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) = 2) "\n"))) ((eq result-type 'value) (let ((tmp-file (org-babel-temp-file "p= ython-"))) (progn (if (org-babel-comint-buffer-livep session) nil (error "B= uffer %s does not exist or has no process" session)) (let ((save-match-data= -internal (match-data))) (unwind-protect (progn (save-current-buffer (set-b= uffer 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 t= ext)))) comint-output-filter-functions)) dangling-text) (goto-char (process= -mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (p= oint-max))) (setq dangling-text (buffer-substring start end)) (delete-regio= n start end)) (let ((comint-process-echoes nil)) (funcall input-body body) = (funcall dump-last-value tmp-file (member "pp" result-params)) (funcall sen= d-wait) (funcall send-wait) (insert org-babel-python-eoe-indicator) (funcal= l send-wait)) (while (progn (goto-char comint-last-input-end) (not (save-ex= cursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicato= r) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-proces= s-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-ev= al-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 (functio= n (lambda (statement) (insert statement) (funcall send-wait))) (if pp (list= "import pprint" (format "open('%s', 'w').write(pprint.pformat(_))" (org-ba= bel-process-file-name tmp-file 'noquote))) (list (format "open('%s', 'w').w= rite(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-buffe= r-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-= buffer temp-buffer) (insert body)) (save-current-buffer (set-buffer temp-bu= ffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffe= r) (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))) (u= nwind-protect (progn (save-current-buffer (set-buffer session) (save-excurs= ion (let ((comint-input-filter (function (lambda (_input) nil)))) (let* ((s= tring-buffer "") (comint-output-filter-functions (cons (function (lambda (t= ext) (setq string-buffer (concat string-buffer text)))) comint-output-filte= r-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 inpu= t-body body) (funcall send-wait) (funcall send-wait) (insert org-babel-pyth= on-eoe-indicator) (funcall send-wait) (while (progn (goto-char comint-last-= input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-b= abel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp n= il t))))) (accept-process-output (get-buffer-process (current-buffer)))) (g= oto-char (process-mark (get-buffer-process (current-buffer)))) (insert dang= ling-text) (if (and t body (string-match (replace-regexp-in-string "\n" "[\= 15\n]+" (regexp-quote (or body ""))) string-buffer)) (progn (setq string-bu= ffer (substring string-buffer (match-end 0))))) (split-string string-buffer= comint-prompt-regexp)))))) (set-match-data save-match-data-internal 'evapo= rate)))) 2) "\n"))) ((eq result-type 'value) (let ((tmp-file (org-babel-tem= p-file "python-"))) (progn (if (org-babel-comint-buffer-livep session) nil = (error "Buffer %s does not exist or has no process" session)) (let ((save-m= atch-data-internal (match-data))) (unwind-protect (progn (save-current-buff= er (set-buffer session) (save-excursion (let ((comint-input-filter (functio= n (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)) (del= ete-region start end)) (let ((comint-process-echoes nil)) (funcall input-bo= dy body) (funcall dump-last-value tmp-file (member "pp" result-params)) (fu= ncall 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))))) (acce= pt-process-output (get-buffer-process (current-buffer)))) (goto-char (proce= ss-mark (get-buffer-process (current-buffer)))) (insert dangling-text) (if = (and nil body (string-match (replace-regexp-in-string "\n" "[\15\n]+" (rege= xp-quote (or body ""))) string-buffer)) (progn (setq string-buffer (substri= ng string-buffer (match-end 0))))) (split-string string-buffer comint-promp= t-regexp)))))) (set-match-data save-match-data-internal 'evaporate)))) (org= -babel-eval-read-file tmp-file))) (t nil)))) (if (string=3D (substring org-= babel-python-eoe-indicator 1 -1) results) nil (let ((--params result-params= )) (if (member "none" --params) nil (if (or (member "scalar" --params) (mem= ber "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 =3D HTMLSession()\n\nr =3D session.get('h= ttps://python.org/')" output ("replace" "output")) (if session (org-babel-python-evaluate-session session body result-type r= esult-params) (org-babel-python-evaluate-external-process body result-type = result-params preamble)) org-babel-python-evaluate("*Python-requests-html*" "from requests_html im= port HTMLSession\nsession =3D HTMLSession()\n\nr =3D session.get('https://p= ython.org/')" output ("replace" "output") nil) (let* ((org-babel-python-command (or (cdr (assq :python params)) org-babe= l-python-command)) (session (org-babel-python-initiate-session (cdr (assq := session params)))) (result-params (cdr (assq :result-params params))) (resu= lt-type (cdr (assq :result-type params))) (return-val (if (and (eq result-t= ype 'value) (not session)) (progn (cdr (assq :return params))))) (preamble = (cdr (assq :preamble params))) (full-body (org-babel-expand-body:generic (c= oncat body (if return-val (format "\nreturn %s" return-val) "")) params (or= g-babel-variable-assignments:python params))) (result (org-babel-python-eva= luate session full-body result-type result-params preamble))) (org-babel-re= assemble-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 = =3D HTMLSession()\n\nr =3D session.get('https://python.org/')" ((:colname-n= ames) (: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\n= session =3D HTMLSession()\n\nr =3D session.get('https://python.org/')" ((:c= olname-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" resul= t-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) (messa= ge "result silenced")) (setq result (let ((r (funcall cmd body params))) (i= f (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" re= sult-params) (member "table" result-params)) (not (listp r))) (list (list r= )) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((grap= hics\? (member "graphics" (cdr (assq :result-params params))))) (if (and re= sult (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buff= er-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (pro= g1 (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 tem= p-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post = (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) re= sult (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 param= s))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p para= ms :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-direc= tory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboun= dp 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) (pr= ogn (funcall cmd body params) (message "result silenced")) (setq result (le= t ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type para= ms)) 'value) (or (member "vector" result-params) (member "table" result-par= ams)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file pa= rams)))) (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :r= esult-params params))))) (if (and result (not graphics\?)) (progn (let ((te= mp-file file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *= temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer tem= p-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 (p= rogn (let ((*this* (if (not file) result (org-babel-result-to-file file (le= t ((desc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) = (setq result (org-babel-ref-resolve post)) (if file (progn (setq result-par= ams (remove "file" result-params)))))))) (org-babel-insert-result result re= sult-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-b= lock-result nil info)) (forward-line) (skip-chars-forward " \11") (let ((re= sult (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))) (bod= y (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) "" expan= d nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (and = dir (file-name-as-directory (expand-file-name dir))) default-directory)) (c= md (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) n= il (error "No org-babel-execute function for %s!" lang)) (message "executin= g %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name= (format " (%s)" name) ""))) (if (member "none" result-params) (progn (func= all cmd body params) (message "result silenced")) (setq result (let ((r (fu= ncall cmd body params))) (if (and (eq (cdr (assq :result-type params)) 'val= ue) (or (member "vector" result-params) (member "table" result-params)) (no= t (listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params)))) = (if file (progn (let ((graphics\? (member "graphics" (cdr (assq :result-par= ams params))))) (if (and result (not graphics\?)) (progn (let ((temp-file f= ile) (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 res= ult (org-babel-ref-resolve post)) (if file (progn (setq result-params (remo= ve "file" result-params)))))))) (org-babel-insert-result result result-para= ms 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=3D "yes" c)))) (new-hash (and cache (org-babel-sh= a1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (cur= rent-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-re= sult))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) = result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (re= sult-params (cdr (assq :result-params params))) (body (let ((coderef (nth 6= info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-nowe= b-references info) (nth 1 info)))) (if (not coderef) expand (replace-regexp= -in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir (c= dr (assq :dir params))) (default-directory (or (and dir (file-name-as-direc= tory (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) (m= essage "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 (li= st r)) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((= graphics\? (member "graphics" (cdr (assq :result-params params))))) (if (an= d 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-for= mat-result result (cdr (assq :sep params))))) (save-current-buffer (set-buf= fer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name= temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((p= ost (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-reso= lve 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 (c= ar c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache par= ams)))) (and (not arg) c (string=3D "yes" c)))) (new-hash (and cache (org-b= abel-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" res= ult))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 inf= o)) (result-params (cdr (assq :result-params params))) (body (let ((coderef= (nth 6 info)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expa= nd-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-a= s-directory (expand-file-name dir))) default-directory)) (cmd (intern (conc= at "org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No or= g-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 par= ams) (message "result silenced")) (setq result (let ((r (funcall cmd body p= arams))) (if (and (eq (cdr (assq :result-type params)) 'value) (or (member = "vector" result-params) (member "table" result-params)) (not (listp r))) (l= ist (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-buffe= r (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-p= rotect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-ba= bel-format-result result (cdr (assq :sep params))))) (save-current-buffer (= set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buff= er-name temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (= let ((post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (n= ot file) result (org-babel-result-to-file file (let ((desc (assq :file-desc= params))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-r= ef-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))) (s= etcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (= cache (let ((c (cdr (assq :cache params)))) (and (not arg) c (string=3D "ye= s" c)))) (new-hash (and cache (org-babel-sha1-hash info))) (old-hash (and c= ache (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-forwa= rd " \11") (let ((result (org-babel-read-result))) (message (replace-regexp= -in-string "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-ev= aluate info) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-p= arams params))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-n= oweb-p params :eval) (org-babel-expand-noweb-references info) (nth 1 info))= )) (if (not coderef) expand (replace-regexp-in-string (org-src-coderef-rege= xp coderef) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default= -directory (or (and dir (file-name-as-directory (expand-file-name dir))) de= fault-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 (nt= h 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 :resul= t-type params)) 'value) (or (member "vector" result-params) (member "table"= result-params)) (not (listp r))) (list (list r)) r))) (let ((file (cdr (as= sq :file params)))) (if file (progn (let ((graphics\? (member "graphics" (c= dr (assq :result-params params))))) (if (and result (not graphics\?)) (prog= n (let ((temp-file file) (temp-buffer (get-buffer-create (generate-new-buff= er-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set= -buffer temp-buffer) (insert (org-babel-format-result result (cdr (assq :se= p params))))) (save-current-buffer (set-buffer temp-buffer) (write-region n= il 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-fi= le file (let ((desc (assq :file-desc params))) (and desc (or (cdr desc) res= ult))))))) (setq result (org-babel-ref-resolve post)) (if file (progn (setq= result-params (remove "file" result-params)))))))) (org-babel-insert-resul= t result result-params info new-hash lang))) (run-hooks 'org-babel-after-ex= ecute-hook) result)))))) (let* ((org-babel-current-src-block-location (or org-babel-current-src-bl= ock-location (nth 5 info) (org-babel-where-is-src-block-head))) (info (if i= nfo (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-babe= l-process-params (car c)))) (let* ((params (nth 2 info)) (cache (let ((c (c= dr (assq :cache params)))) (and (not arg) c (string=3D "yes" c)))) (new-has= h (and cache (org-babel-sha1-hash info))) (old-hash (and cache (org-babel-c= urrent-result-hash))) (current-cache (and new-hash (equal new-hash old-hash= )))) (cond (current-cache (save-excursion (goto-char (org-babel-where-is-sr= c-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 :ev= al) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coder= ef) expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" ex= pand nil nil 1)))) (dir (cdr (assq :dir params))) (default-directory (or (a= nd 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 "execu= ting %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if n= ame (format " (%s)" name) ""))) (if (member "none" result-params) (progn (f= uncall 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-fil= e file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp f= ile*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buff= er) (insert (org-babel-format-result result (cdr (assq :sep params))))) (sa= ve-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file = nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (se= tq result file))) (let ((post (cdr (assq :post params)))) (if post (progn (= let ((*this* (if (not file) result (org-babel-result-to-file file (let ((de= sc (assq :file-desc params))) (and desc (or (cdr desc) result))))))) (setq = result (org-babel-ref-resolve post)) (if file (progn (setq result-params (r= emove "file" result-params)))))))) (org-babel-insert-result result result-p= arams info new-hash lang))) (run-hooks 'org-babel-after-execute-hook) resul= t))))))) (closure (*this* org-babel-confirm-evaluate-answer-no t) (&optional arg i= nfo params) "Execute the current source code block.\nInsert the results of = execution into the buffer. Source code\nexecution and the collection and f= ormatting of results can be\ncontrolled through a variety of header argumen= ts.\n\nWith prefix argument ARG, force re-execution even if an existing\nre= sult 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\nt= he header arguments specified at the front of the source code\nblock." (int= eractive) (let* ((org-babel-current-src-block-location (or org-babel-curren= t-src-block-location (nth 5 info) (org-babel-where-is-src-block-head))) (in= fo (if info (copy-tree info) (org-babel-get-src-block-info)))) (let* ((c (n= thcdr 2 info))) (setcar c (org-babel-merge-params (car c) params))) (if (or= g-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info))) (setcar c (= org-babel-process-params (car c)))) (let* ((params (nth 2 info)) (cache (le= t ((c (cdr (assq :cache params)))) (and (not arg) c (string=3D "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-whe= re-is-src-block-result nil info)) (forward-line) (skip-chars-forward " \11"= ) (let ((result (org-babel-read-result))) (message (replace-regexp-in-strin= g "%" "%%" (format "%S" result))) result))) ((org-babel-confirm-evaluate in= fo) (let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params par= ams))) (body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p pa= rams :eval) (org-babel-expand-noweb-references info) (nth 1 info)))) (if (n= ot coderef) expand (replace-regexp-in-string (org-src-coderef-regexp codere= f) "" expand nil nil 1)))) (dir (cdr (assq :dir params))) (default-director= y (or (and dir (file-name-as-directory (expand-file-name dir))) default-dir= ectory)) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fbo= undp cmd) nil (error "No org-babel-execute function for %s!" lang)) (messag= e "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 pa= rams)) 'value) (or (member "vector" result-params) (member "table" result-p= arams)) (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 t= emp-buffer) (insert (org-babel-format-result result (cdr (assq :sep params)= )))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil te= mp-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-p= arams (remove "file" result-params)))))))) (org-babel-insert-result result = result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hoo= k) result))))))))(nil ("python" "from requests_html import HTMLSession\nses= sion =3D HTMLSession()\n\nr =3D session.get('https://python.org/')" ((:coln= ame-names) (:rowname-names) (:result-params "output" "replace") (:result-ty= pe . output) (:results . "output replace") (:exports . "code") (:session . = "requests-html") (:eval . "yes") (:noweb . "yes") (:cache . "yes") (:commen= ts . "links") (:tangle . "no") (:hlines . "no")) "" nil 4645 "(ref:%s)") ni= l) ob-async-org-babel-execute-src-block((closure (*this* org-babel-confirm-e= valuate-answer-no t) (&optional arg info params) "Execute the current sourc= e code block.\nInsert the results of execution into the buffer. Source cod= e\nexecution and the collection and formatting of results can be\ncontrolle= d through a variety of header arguments.\n\nWith prefix argument ARG, force= re-execution even if an existing\nresult cached in the buffer would otherw= ise have been returned.\n\nOptionally supply a value for INFO in the form r= eturned by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value fo= r PARAMS which will be merged with\nthe header arguments specified at the f= ront of the source code\nblock." (interactive) (let* ((org-babel-current-sr= c-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-babe= l-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-babel-m= erge-params (car c) params))) (if (org-babel-check-evaluate info) (progn (l= et* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car c)))) (l= et* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params)))) (an= d (not arg) c (string=3D "yes" c)))) (new-hash (and cache (org-babel-sha1-h= ash info))) (old-hash (and cache (org-babel-current-result-hash))) (current= -cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache (sav= e-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (for= ward-line) (skip-chars-forward " \11") (let ((result (org-babel-read-result= ))) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) resu= lt))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result= -params (cdr (assq :result-params params))) (body (let ((coderef (nth 6 inf= o)) (expand (if (org-babel-noweb-p params :eval) (org-babel-expand-noweb-re= ferences 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-bab= el-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-babel-exe= cute function for %s!" lang)) (message "executing %s code block%s..." (capi= talize lang) (let ((name (nth 4 info))) (if name (format " (%s)" name) ""))= ) (if (member "none" result-params) (progn (funcall cmd body params) (messa= ge "result silenced")) (setq result (let ((r (funcall cmd body params))) (i= f (and (eq (cdr (assq :result-type params)) 'value) (or (member "vector" re= sult-params) (member "table" result-params)) (not (listp r))) (list (list r= )) r))) (let ((file (cdr (assq :file params)))) (if file (progn (let ((grap= hics\? (member "graphics" (cdr (assq :result-params params))))) (if (and re= sult (not graphics\?)) (progn (let ((temp-file file) (temp-buffer (get-buff= er-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (pro= g1 (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 tem= p-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let ((post = (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not file) re= sult (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))) (r= un-hooks 'org-babel-after-execute-hook) result)))))))) nil ("python" "from = requests_html import HTMLSession\nsession =3D HTMLSession()\n\nr =3D sessio= n.get('https://python.org/')" ((:colname-names) (:rowname-names) (:result-p= arams "output" "replace") (:result-type . output) (:results . "output repla= ce") (:exports . "code") (:session . "requests-html") (:eval . "yes") (:now= eb . "yes") (:cache . "yes") (:comments . "links") (:tangle . "no") (:hline= s . "no")) "" nil 4645 "(ref:%s)")) apply(ob-async-org-babel-execute-src-block (closure (*this* org-babel-con= firm-evaluate-answer-no t) (&optional arg info params) "Execute the current= source code block.\nInsert the results of execution into the buffer. Sour= ce code\nexecution and the collection and formatting of results can be\ncon= trolled 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 va= lue for PARAMS which will be merged with\nthe header arguments specified at= the front of the source code\nblock." (interactive) (let* ((org-babel-curr= ent-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) (or= g-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c (org-b= abel-merge-params (car c) params))) (if (org-babel-check-evaluate info) (pr= ogn (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=3D "yes" c)))) (new-hash (and cache (org-babel-= sha1-hash info))) (old-hash (and cache (org-babel-current-result-hash))) (c= urrent-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cach= e (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-no= web-references info) (nth 1 info)))) (if (not coderef) expand (replace-rege= xp-in-string (org-src-coderef-regexp coderef) "" expand nil nil 1)))) (dir = (cdr (assq :dir params))) (default-directory (or (and dir (file-name-as-dir= ectory (expand-file-name dir))) default-directory)) (cmd (intern (concat "o= rg-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No org-bab= el-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 "vect= or" 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 (ge= t-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protec= t (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (org-babel-f= ormat-result result (cdr (assq :sep params))))) (save-current-buffer (set-b= uffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-na= me temp-buffer) (kill-buffer temp-buffer))))))) (setq result file))) (let (= (post (cdr (assq :post params)))) (if post (progn (let ((*this* (if (not fi= le) result (org-babel-result-to-file file (let ((desc (assq :file-desc para= ms))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-re= solve post)) (if file (progn (setq result-params (remove "file" result-para= ms)))))))) (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 =3D HTMLSession()\n\nr =3D= session.get('https://python.org/')" ((:colname-names) (:rowname-names) (:r= esult-params "output" "replace") (:result-type . output) (:results . "outpu= t 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 HTML= Session\nsession =3D HTMLSession()\n\nr =3D 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 . "ye= s") (: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-buf= fer) (org-babel-execute-src-block current-prefix-arg (org-babel-get-src-blo= ck-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-sr= c-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-c= trl-c]' can do nothing useful here")))) ((memq type '(inline-babel-call bab= el-call)) (let ((info (org-babel-lob-get-info context))) (if info (progn (o= rg-babel-execute-src-block nil info))))) ((eq type 'clock) (org-clock-updat= e-time-maybe)) ((eq type 'dynamic-block) (save-excursion (goto-char (org-el= ement-property :post-affiliated context)) (org-update-dblock))) ((eq type '= footnote-definition) (goto-char (org-element-property :post-affiliated cont= ext)) (call-interactively 'org-footnote-action)) ((eq type 'footnote-refere= nce) (call-interactively (function org-footnote-action))) ((memq type '(inl= inetask 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-p= roperty :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)) "[-]") ((a= nd (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 pre= vs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-list-st= ruct-fix-box struct parents prevs orderedp))) (if (and box (equal struct ol= d-struct)) (if (equal arg '(16)) (message "Checkboxes already reset") (user= -error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subitems che= cked" "unchecked subitems"))) (org-list-struct-apply-struct struct old-stru= ct) (org-update-checkbox-count-maybe)) (if block-item (progn (message "Chec= kboxes were removed due to empty box at line %d" (org-current-line block-it= em))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-stuff t= ) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-ove= rlays) (progn (mapc (function delete-overlay) org-table-coordinate-overlays= ) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-types '(or= g-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (--data (= mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (overlay-en= d o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (memq typ= e --invisible-types) (list (if --markers\? (copy-marker beg) beg) (if --mar= kers\? (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 ((--doli= st-tail-- --invisible-types)) (while --dolist-tail-- (let ((type (car --dol= ist-tail--))) (remove-overlays (point-min) (point-max) 'invisible type) (se= tq --dolist-tail-- (cdr --dolist-tail--))))) (let ((--dolist-tail-- (delq n= il --data))) (while --dolist-tail-- (let ((x101 (car --dolist-tail--))) (le= t* ((x102 (car x101)) (x103 (cdr x101)) (x104 (car x103)) (x105 (cdr x103))= (x106 (car x105)) (x107 (cdr x105))) (let ((type x106) (end x104) (beg x10= 2)) (progn (org-flag-region beg end t type) (if --markers\? (progn (set-mar= ker beg nil) (set-marker end nil)))))) (setq --dolist-tail-- (cdr --dolist-= tail--)))))))))) (message "Local setup has been refreshed")) ((eq type 'pla= in-list) (let* ((begin (org-element-property :contents-begin context)) (str= uct (org-element-property :structure context)) (old-struct (copy-tree struc= t)) (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-i= tems 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 (poi= nt) begin)) (org-list-set-checkbox begin struct new-box))) (org-list-write-= struct struct (org-list-parents-alist struct) old-struct) (org-update-check= box-count-maybe))) ((memq type '(node-property property-drawer)) (call-inte= ractively (function org-property-action))) ((eq type 'radio-target) (call-i= nteractively (function org-update-radio-target-regexp))) ((eq type 'statist= ics-cookie) (call-interactively (function org-update-statistics-cookies))) = ((memq type '(table-row table-cell table)) (if (eq (org-element-property :t= ype context) 'table\.el) (message "%s" (substitute-command-keys "\\Use `\\[org-edit-special]' to edit table.el tables")) (if (or (eq typ= e 'table) (and (eq type 'table-row) (=3D (point) (org-element-property :end= context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'org-tabl= e) (org-table-calc-current-TBLFM)) (goto-char (org-element-property :conten= ts-begin context)) (org-call-with-arg 'org-table-recalculate (or arg t)) (o= rgtbl-send-table 'maybe))) (org-table-maybe-eval-formula) (cond (arg (call-= interactively (function org-table-recalculate))) ((org-table-maybe-recalcul= ate-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 nothin= g useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactiv= ely (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-key= s "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (pcase-1 (funct= ion (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-exe= cute-src-block current-prefix-arg (org-babel-get-src-block-info nil context= )))) ((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success 'or= g-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys "`\\[org-c= trl-c-ctrl-c]' can do nothing useful here")))) ((memq type '(inline-babel-c= all babel-call)) (let ((info (org-babel-lob-get-info context))) (if info (p= rogn (org-babel-execute-src-block nil info))))) ((eq type 'clock) (org-cloc= k-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-affiliat= ed context)) (call-interactively 'org-footnote-action)) ((eq type 'footnote= -reference) (call-interactively (function org-footnote-action))) ((memq typ= e '(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-el= ement-property :structure context)) (old-struct (copy-tree struct)) (parent= s (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (o= rderedp (org-not-nil (org-entry-get nil "ORDERED")))) (org-list-set-checkbo= x (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 pa= rents 2) (org-list-struct-fix-item-end struct) (org-list-struct-fix-bul str= uct prevs) (org-list-struct-fix-ind struct parents) (let ((block-item (org-= list-struct-fix-box struct parents prevs orderedp))) (if (and box (equal st= ruct old-struct)) (if (equal arg '(16)) (message "Checkboxes already reset"= ) (user-error "Cannot toggle this checkbox: %s" (if (eq box 'on) "all subit= ems checked" "unchecked subitems"))) (org-list-struct-apply-struct struct o= ld-struct) (org-update-checkbox-count-maybe)) (if block-item (progn (messag= e "Checkboxes were removed due to empty box at line %d" (org-current-line b= lock-item))))))) ((eq type 'keyword) (let ((org-inhibit-startup-visibility-= stuff t) (org-startup-align-all-tables nil)) (if (boundp 'org-table-coordin= ate-overlays) (progn (mapc (function delete-overlay) org-table-coordinate-o= verlays) (setq org-table-coordinate-overlays nil))) (let* ((--invisible-typ= es '(org-hide-block org-hide-drawer outline)) (--markers\? 'use-markers) (-= -data (mapcar (function (lambda (o) (let ((beg (overlay-start o)) (end (ove= rlay-end o)) (type (overlay-get o 'invisible))) (and beg end (> end beg) (m= emq type --invisible-types) (list (if --markers\? (copy-marker beg) beg) (i= f --markers\? (copy-marker end t) end) type))))) (save-excursion (save-rest= riction (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 (ca= r --dolist-tail--))) (remove-overlays (point-min) (point-max) 'invisible ty= pe) (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 ty= pe 'plain-list) (let* ((begin (org-element-property :contents-begin context= )) (struct (org-element-property :structure context)) (old-struct (copy-tre= e struct)) (first-box (save-excursion (goto-char begin) (looking-at org-lis= t-full-item-re) (match-string-no-properties 3))) (new-box (cond ((equal arg= '(16)) "[-]") ((equal arg '(4)) (if first-box nil "[ ]")) ((equal first-bo= x "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dolist-tail-- (org-list-ge= t-all-items begin struct (org-list-prevs-alist struct)))) (while --dolist-t= ail-- (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-updat= e-checkbox-count-maybe))) ((memq type '(node-property property-drawer)) (ca= ll-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-cook= ies))) ((memq type '(table-row table-cell table)) (if (eq (org-element-prop= erty :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) (=3D (point) (org-element-proper= ty :end context)))) (save-excursion (if (org-at-TBLFM-p) (progn (require 'o= rg-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-r= ecalculate-line)) (t (org-table-align)))))) ((eq type 'timestamp) (funcall = pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pc= ase-0)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) n= il) (t (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do= nothing useful here"))))) ((null type) (cond ((org-at-heading-p) (call-int= eractively (function org-set-tags))) ((run-hook-with-args-until-success 'or= g-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))) ((ru= n-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall pcas= e-1)) (t (funcall pcase-2)))) (let* ((context (org-element-lineage (org-element-context) '(babel-call c= lock dynamic-block footnote-definition footnote-reference inline-babel-call= inline-src-block inlinetask item keyword node-property paragraph plain-lis= t planning property-drawer radio-target src-block statistics-cookie table t= able-cell table-row timestamp) t)) (type (org-element-type context))) (if (= eq type 'paragraph) (progn (let ((parent (org-element-property :parent cont= ext))) (if (and (eq (org-element-type parent) 'item) (=3D (line-beginning-p= osition) (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 her= e"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambda nil (o= rg-timestamp-change 0 'day))))) (cond ((memq type '(src-block inline-src-bl= ock)) (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")))) ((mem= q 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) (sav= e-excursion (goto-char (org-element-property :post-affiliated context)) (or= g-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-element-= property :post-affiliated context)) (call-interactively 'org-footnote-actio= n)) ((eq type 'footnote-reference) (call-interactively (function org-footno= te-action))) ((memq type '(inlinetask headline)) (save-excursion (goto-char= (org-element-property :begin context)) (call-interactively (function org-s= et-tags)))) ((eq type 'item) (let* ((box (org-element-property :checkbox co= ntext)) (struct (org-element-property :structure context)) (old-struct (cop= y-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 (n= ot box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (org-list-s= truct-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 "Ch= eckboxes already reset") (user-error "Cannot toggle this checkbox: %s" (if = (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-list-struc= t-apply-struct struct old-struct) (org-update-checkbox-count-maybe)) (if bl= ock-item (progn (message "Checkboxes were removed due to empty box at line = %d" (org-current-line block-item))))))) ((eq type 'keyword) (let ((org-inhi= bit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (bo= undp '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)) (--mar= kers\? 'use-markers) (--data (mapcar (function (lambda (o) (let ((beg (over= lay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible))) (and= beg end (> end beg) (memq type --invisible-types) (list (if --markers\? (c= opy-marker beg) beg) (if --markers\? (copy-marker end t) end) type))))) (sa= ve-excursion (save-restriction (widen) (overlays-in (point-min) (point-max)= )))))) (unwind-protect (progn (org-mode-restart)) (save-excursion (save-res= triction (widen) (let ((--dolist-tail-- --invisible-types)) (while --dolist= -tail-- (let ((type (car --dolist-tail--))) (remove-overlays (point-min) (p= oint-max) 'invisible type) (setq --dolist-tail-- (cdr --dolist-tail--))))) = (let ((--dolist-tail-- (delq nil --data))) (while --dolist-tail-- (let ((x1= 01 (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 be= en 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 beg= in) (looking-at org-list-full-item-re) (match-string-no-properties 3))) (ne= w-box (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) (if first-box nil "= [ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let ((--dol= ist-tail-- (org-list-get-all-items begin struct (org-list-prevs-alist struc= t)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (org-list-s= et-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist-tail--)= ))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox begin stru= ct new-box))) (org-list-write-struct struct (org-list-parents-alist struct)= old-struct) (org-update-checkbox-count-maybe))) ((memq type '(node-propert= y property-drawer)) (call-interactively (function org-property-action))) ((= eq type 'radio-target) (call-interactively (function org-update-radio-targe= t-regexp))) ((eq type 'statistics-cookie) (call-interactively (function org= -update-statistics-cookies))) ((memq type '(table-row table-cell table)) (i= f (eq (org-element-property :type context) 'table\.el) (message "%s" (subst= itute-command-keys "\\Use `\\[org-edit-special]' to edit tabl= e.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (=3D (poi= nt) (org-element-property :end context)))) (save-excursion (if (org-at-TBLF= M-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (goto-char= (org-element-property :contents-begin context)) (org-call-with-arg 'org-ta= ble-recalculate (or arg t)) (orgtbl-send-table 'maybe))) (org-table-maybe-e= val-formula) (cond (arg (call-interactively (function org-table-recalculate= ))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq typ= e 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timest= amp-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 (f= uncall pcase-2)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-fi= nal-hook) (funcall pcase-1)) (t (funcall pcase-2))))) (cond ((or (and (boundp 'org-clock-overlays) org-clock-overlays) org-occu= r-highlights) (if (boundp 'org-clock-overlays) (progn (org-clock-remove-ove= rlays))) (org-remove-occur-highlights) (message "Temporary highlights/overl= ays removed from current buffer")) ((and (local-variable-p 'org-finish-func= tion) (fboundp org-finish-function)) (funcall org-finish-function)) ((org-b= abel-hash-at-point)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-= hook)) (t (let* ((context (org-element-lineage (org-element-context) '(babe= l-call clock dynamic-block footnote-definition footnote-reference inline-ba= bel-call inline-src-block inlinetask item keyword node-property paragraph p= lain-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 :par= ent context))) (if (and (eq (org-element-type parent) 'item) (=3D (line-beg= inning-position) (org-element-property :begin parent))) (progn (setq contex= t parent) (setq type 'item)))))) (let* ((pcase-2 (function (lambda nil (use= r-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing us= eful here"))))) (pcase-1 (function (lambda nil))) (pcase-0 (function (lambd= a nil (org-timestamp-change 0 'day))))) (cond ((memq type '(src-block inlin= e-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wi= pe-error-buffer) (org-babel-execute-src-block current-prefix-arg (org-babel= -get-src-block-info nil context)))) ((org-match-line "[ \11]*$") (or (run-h= ook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error (sub= stitute-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-blo= ck) (save-excursion (goto-char (org-element-property :post-affiliated conte= xt)) (org-update-dblock))) ((eq type 'footnote-definition) (goto-char (org-= element-property :post-affiliated context)) (call-interactively 'org-footno= te-action)) ((eq type 'footnote-reference) (call-interactively (function or= g-footnote-action))) ((memq type '(inlinetask headline)) (save-excursion (g= oto-char (org-element-property :begin context)) (call-interactively (functi= on org-set-tags)))) ((eq type 'item) (let* ((box (org-element-property :che= ckbox context)) (struct (org-element-property :structure context)) (old-str= uct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (o= rg-list-prevs-alist struct)) (orderedp (org-not-nil (org-entry-get nil "ORD= ERED")))) (org-list-set-checkbox (org-element-property :begin context) stru= ct (cond ((equal arg '(16)) "[-]") ((and (not box) (equal arg '(4))) "[ ]")= ((or (not box) (equal arg '(4))) nil) ((eq box 'on) "[ ]") (t "[X]"))) (or= g-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end struc= t) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct p= arents) (let ((block-item (org-list-struct-fix-box struct parents prevs ord= eredp))) (if (and box (equal struct old-struct)) (if (equal arg '(16)) (mes= sage "Checkboxes already reset") (user-error "Cannot toggle this checkbox: = %s" (if (eq box 'on) "all subitems checked" "unchecked subitems"))) (org-li= st-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 ((b= eg (overlay-start o)) (end (overlay-end o)) (type (overlay-get o 'invisible= ))) (and beg end (> end beg) (memq type --invisible-types) (list (if --mark= ers\? (copy-marker beg) beg) (if --markers\? (copy-marker end t) end) type)= )))) (save-excursion (save-restriction (widen) (overlays-in (point-min) (po= int-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 setu= p has been refreshed")) ((eq type 'plain-list) (let* ((begin (org-element-p= roperty :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-b= ox nil "[ ]")) ((equal first-box "[X]") "[ ]") (t "[X]")))) (cond (arg (let= ((--dolist-tail-- (org-list-get-all-items begin struct (org-list-prevs-ali= st struct)))) (while --dolist-tail-- (let ((pos (car --dolist-tail--))) (or= g-list-set-checkbox pos struct new-box) (setq --dolist-tail-- (cdr --dolist= -tail--)))))) ((and first-box (eq (point) begin)) (org-list-set-checkbox be= gin 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-acti= on))) ((eq type 'radio-target) (call-interactively (function org-update-rad= io-target-regexp))) ((eq type 'statistics-cookie) (call-interactively (func= tion org-update-statistics-cookies))) ((memq type '(table-row table-cell ta= ble)) (if (eq (org-element-property :type context) 'table\.el) (message "%s= " (substitute-command-keys "\\Use `\\[org-edit-special]' to e= dit table.el tables")) (if (or (eq type 'table) (and (eq type 'table-row) (= =3D (point) (org-element-property :end context)))) (save-excursion (if (org= -at-TBLFM-p) (progn (require 'org-table) (org-table-calc-current-TBLFM)) (g= oto-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-rec= alculate))) ((org-table-maybe-recalculate-line)) (t (org-table-align)))))) = ((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-a= t-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) (con= d ((org-at-heading-p) (call-interactively (function org-set-tags))) ((run-h= ook-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-c= trl-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. =2D -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 =2D----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrIy38ACgkQG13xyVro msOloQgAkNNvAfQRCnL4P4yVwACpFxmaCOCC77K/dVswW5b8C/KQzw1Ywn81uQ6K Gt9plwfWAxNyIfhe4e0ZfzV65hYRrLCMc1tZr0T850n3sjeXwjwgIupWhIvj7iOP zCAcw235nsRC1SIu5E1cq9SF1ef01wqugYDGqXtNIUlSgdeFQIyEvI8k4EPIEU2X EUlnDihEOXR/9mzECGHZFvEV73rIfmGv3uGc8d7AmE6uAQdmKVkTmXa45aTMuk/B SbRAAK2CRWsuSSB2sgHgLOiX3xfP9O76Rjm9Kd+jilAQSiCsQAg67mpewM++crOq bEgvdcKu9ftn2u9h4vDTShtYdtK8zQ=3D=3D =3D4LZj =2D----END PGP SIGNATURE-----