]> gitweb @ CieloNegro.org - sugar.git/blobdiff - dot-files/_navi2ch/elisp/navi2ch-board-custom_el
Auto commit by The Sugar System.
[sugar.git] / dot-files / _navi2ch / elisp / navi2ch-board-custom_el
diff --git a/dot-files/_navi2ch/elisp/navi2ch-board-custom_el b/dot-files/_navi2ch/elisp/navi2ch-board-custom_el
new file mode 100644 (file)
index 0000000..cf8380e
--- /dev/null
@@ -0,0 +1,39 @@
+(require 'navi2ch)
+
+(defvar navi2ch-bm-board-updated-line-regexp "[%+= ]U\\|[%+ ][CV]")
+(defvar navi2ch-bm-other-updated-line-regexp " U")
+
+(defun navi2ch-bm-forward-updated-line (&optional n)
+  (interactive "p")
+  (unless n
+    (setq n 1))
+  (let ((case-fold-search nil)
+        (regexp (concat "^ *[0-9]+ \\("
+                        (if (eq major-mode 'navi2ch-board-mode)
+                            navi2ch-bm-board-updated-line-regexp
+                          navi2ch-bm-other-updated-line-regexp)
+                        "\\)"))
+        (unit (if (> n 0) 1 -1)))
+    (if (> n 0)
+        (end-of-line)
+      (beginning-of-line))
+    (while (and (/= n 0)
+                (re-search-forward regexp nil t unit))
+      (setq n (- n unit)))
+    (beginning-of-line)
+    n))
+
+(defun navi2ch-bm-next-updated-line (&optional num)
+  (interactive "p")
+  (when (/= (navi2ch-bm-forward-updated-line num) 0)
+    (message "No more updated articles")))
+
+(defun navi2ch-bm-previous-updated-line (&optional num)
+  (interactive "p")
+  (when (/= (navi2ch-bm-forward-updated-line (- (or num 1))) 0)
+    (message "No more updated articles")))
+
+(define-key navi2ch-bm-mode-map "N" 'navi2ch-bm-next-updated-line)
+(define-key navi2ch-bm-mode-map "P" 'navi2ch-bm-previous-updated-line)
+
+(provide 'navi2ch-board-custom)
\ No newline at end of file