-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtkb-links.el
61 lines (55 loc) · 2.09 KB
/
tkb-links.el
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; tkb-links.el -- functions for managing my links files
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; $ProjectHeader$
;;; $Id$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun tkb-start-categorizing-links ()
(interactive)
(let ((tkb-links-file "new-links.data"))
(forms-find-file "~/comp/tkblinks/new-links.el"))
(call-process "make" nil nil nil "new")
(find-file-read-only-other-window "~/comp/tkblinks/n-links-to-cat.list")
(let ((fb (get-buffer "new-links.el"))
(lb (get-buffer "n-links-to-cat.list")))
(unless fb (error "Must have a `new-links.el' buffer"))
(unless lb (error "Must have an `n-links-to-cat.list' buffer"))
(switch-to-buffer-other-window fb)))
(defun tkb-categorize-next-link ()
(interactive)
(let ((fb (get-buffer "new-links.el"))
(lb (get-buffer "n-links-to-cat.list")))
(unless fb (error "Must have a `new-links.el' buffer"))
(unless lb (error "Must have an `n-links-to-cat.list' buffer"))
(let (next)
(save-excursion
(set-buffer lb)
(unless (local-variable-p 'list-pos)
(make-local-variable 'list-pos)
(goto-char (point-max))
(while (and (bolp) (eolp))
1
(forward-line -1))
(setq list-pos (point)))
(when list-pos
(goto-char list-pos))
(unless (looking-at "^line # \\([0-9]+\\)")
(error "Not a valid n-links-to-cat.list file?"))
(setq next (string-to-number (match-string 1)))
(let ((s (point))
(e (progn (end-of-line) (point)))
(buffer-read-only nil))
(add-text-properties s e '(face doc-face)))
(previous-line 1)
(beginning-of-line)
(setq list-pos (point)))
(set-buffer fb)
(forms-jump-record next))
(forms-next-field 1)))
(defun tkb-links-browse-url ()
(interactive)
(when forms-file
(let ((u (nth (1- url) forms--the-record-list)))
(browse-url u))))
(global-set-key [f10] 'tkb-links-browse-url)
;;; end of tkb-links.el