aboutsummaryrefslogtreecommitdiffstats
path: root/w3m-session-backup.el
blob: edd93f0d14dd36a5dc5a687d9db83f2957f6c5f0 (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
(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)
                 (first (last page))))
       (my-w3m-session-backup))
      "\n\n"))))

(save-backup)