 (setq view-default-weight 0.5)
 (setq view-atoms nil)
 (setq view-current-line 1)
+(setq tn-view-mode nil)
 
 (defun current-line ()
     (interactive)


;; BUFFERS / VARIABLES ;;;;;;;;;;;;;;;;;

;; Buffer-local variables. Given them initial, global bindings so they're defined before there are actual view buffers.
(setq view-depth 3)
(setq view-root nil)

    
(defun refresh-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-view-new (url mode)
    (url-retrieve url (receive-view mode)))

(defun to-edit-view ()
    (interactive)
    (if (and (in-view) (equal tn-view-mode readonly-view-mode))
        (request-view readwrite-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun to-readonly-view ()
    (interactive)
    (if (and (in-view) (equal tn-view-mode readwrite-view-mode))
        (request-view readonly-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun decrease-depth ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root (- view-depth 1) view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun increase-depth ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root (+ view-depth 1) view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-to-forward-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth (to-forward-style view-style) view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-to-backward-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth (to-backward-style view-style) view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-to-hybrid-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth (to-hybrid-style view-style) view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-to-links-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth (to-links-style view-style) view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun refresh-to-targets-view ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth (to-targets-style view-style) view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun decrease-default-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight (- view-default-weight 0.25))))

(defun increase-default-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight view-max-weight (+ view-default-weight 0.25))))

(defun decrease-min-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability (- view-min-weight 0.25) view-max-weight view-default-weight)))

(defun increase-min-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability (+ view-min-weight 0.25) view-max-weight view-default-weight)))

(defun decrease-max-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight (- view-max-weight 0.25) view-default-weight)))

(defun increase-max-weight ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability view-default-sharability view-min-weight (+ view-max-weight 0.25) view-default-weight)))

(defun decrease-default-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability (- view-default-sharability 0.25) view-min-weight view-max-weight view-default-weight)))

(defun increase-default-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability view-max-sharability (+ view-default-sharability 0.25) view-min-weight view-max-weight view-default-weight)))

(defun decrease-min-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style (- view-min-sharability 0.25) view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun increase-min-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style (+ view-min-sharability 0.25) view-max-sharability view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun decrease-max-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability (- view-max-sharability 0.25) view-default-sharability view-min-weight view-max-weight view-default-weight)))

(defun increase-max-sharability ()
    (interactive)
    (if (in-view)
        (request-view tn-view-mode view-root view-depth view-style view-min-sharability (+ view-max-sharability 0.25) view-default-sharability view-min-weight view-max-weight view-default-weight)))


;; UPDATES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun push-view ()
    (interactive)
    (if (in-edit-view)
    (let (
        (entity (buffer-string)))
        ;; The received view may very well differ from the pushed view in terms of line numbering,
