Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
;; This file:
;;   http://anggtwu.net/elisp/weary-sessions.el.html
;;   http://anggtwu.net/elisp/weary-sessions.el
;;          (find-angg "elisp/weary-sessions.el")
;; Original author:   weary-traveler (from the #emacs IRC channel)
;; Original code:     https://paste.mozilla.org/zQhH7VDQ
;;  (find-wget-elisp "https://paste.mozilla.org/zQhH7VDQ/raw")
;; Small changes by:  Eduardo Ochs <eduardoochs@gmail.com>

(require 'ob-core)

;; See:
;;   (find-esetkey-links (kbd "C-c <f7>") 'my/ob/session-init)
;;   (find-esetkey-links (kbd     "<f7>") 'my/ob/session-sendit)
(define-key org-mode-map (kbd "C-c <f7>") 'my/ob/session-init)
(define-key org-mode-map (kbd     "<f7>") 'my/ob/session-sendit)

(defun my/ob/session-init (&optional arg info)
  "Open session of the current code block in other window.
ARG and INFO are passed to `org-babel-initiate-session'."
  (interactive "P")
  (when-let ((buf (current-buffer))
             (sesbuf (ignore-errors (org-babel-initiate-session arg info))))
    ;; ensure session buffer visibility
    (split-window-sensibly)
    (switch-to-buffer-other-window sesbuf)
    (goto-char (point-max))
    ;; ensure point in original buffer is on first line
    (pop-to-buffer buf)
    (org-end-of-line)
    (org-forward-sentence)
    (org-backward-sentence)))

(defun my/ob/session-sendit (&optional arg info)
  "Evaluate current line of code block in session.
ARG and INFO are passed to `org-babel-initiate-session'."
  (interactive "P")
  (beginning-of-line)
  (when-let ((buf (current-buffer))
             (sesbuf (ignore-errors (org-babel-initiate-session arg info)))
             (curline (string-trim-left
                       (substring-no-properties (org-current-line-string))))
             (nwline (org-string-nw-p curline)))
    (pop-to-buffer sesbuf)
    (goto-char (point-max))
    (insert nwline)
    (comint-send-input)
    (pop-to-buffer buf))
  (forward-line))



;; Local Variables:
;; coding:  utf-8-unix
;; End: