aboutsummaryrefslogtreecommitdiffstats
path: root/w3m-session-backup.el
blob: f98bb8c942869663c9b0fae629d12b22e18dbc34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(defun buffers ()
  "TODO"
  (nth 2
       (first
        (w3m-load-list w3m-session-file))))

(defun my-w3m-session-backup ()
  "TODO"
  (mapcar
   (lambda (buffer)
     (cons
      ;; URL
      (first buffer)

      ;; Page title
      (last buffer)))
   (buffers)))

;; (first (nth 2
;;     (first
;;      (w3m-load-list w3m-session-file))))

(my-w3m-session-backup)

;; Write to file
  ;; https://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file#2322164
;; Format some YAML text to write to the file
;; Configurable dynamic filename based on date-time

(defun save-backup ()
  "TODO"
  (with-temp-file "~/tmp-w3m-session.txt"
    (insert
     (string-join
      (mapcar
       (lambda (page)
         (format "%s\n%s"
                 (first page)
                 (last page 1)))
       (my-w3m-session-backup))
      "\n\n"))))
    ; (format
    ;  "%s\n%s\n\n"
    ;  )))

(save-backup)