]> gitweb @ CieloNegro.org - sugar.git/blob - dot-files/_navi2ch/elisp/navi2ch-board-custom_el
Auto commit by The Sugar System.
[sugar.git] / dot-files / _navi2ch / elisp / navi2ch-board-custom_el
1 (require 'navi2ch)
2
3 (defvar navi2ch-bm-board-updated-line-regexp "[%+= ]U\\|[%+ ][CV]")
4 (defvar navi2ch-bm-other-updated-line-regexp " U")
5
6 (defun navi2ch-bm-forward-updated-line (&optional n)
7   (interactive "p")
8   (unless n
9     (setq n 1))
10   (let ((case-fold-search nil)
11         (regexp (concat "^ *[0-9]+ \\("
12                         (if (eq major-mode 'navi2ch-board-mode)
13                             navi2ch-bm-board-updated-line-regexp
14                           navi2ch-bm-other-updated-line-regexp)
15                         "\\)"))
16         (unit (if (> n 0) 1 -1)))
17     (if (> n 0)
18         (end-of-line)
19       (beginning-of-line))
20     (while (and (/= n 0)
21                 (re-search-forward regexp nil t unit))
22       (setq n (- n unit)))
23     (beginning-of-line)
24     n))
25
26 (defun navi2ch-bm-next-updated-line (&optional num)
27   (interactive "p")
28   (when (/= (navi2ch-bm-forward-updated-line num) 0)
29     (message "No more updated articles")))
30
31 (defun navi2ch-bm-previous-updated-line (&optional num)
32   (interactive "p")
33   (when (/= (navi2ch-bm-forward-updated-line (- (or num 1))) 0)
34     (message "No more updated articles")))
35
36 (define-key navi2ch-bm-mode-map "N" 'navi2ch-bm-next-updated-line)
37 (define-key navi2ch-bm-mode-map "P" 'navi2ch-bm-previous-updated-line)
38
39 (provide 'navi2ch-board-custom)