From f41748337adc0d1b8b733544adc381ab6fe26ec9 Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 8 Dec 2008 18:04:03 +0900 Subject: [PATCH] Auto commit by The Sugar System. --- IGNORE | 3 + dot-files/_mew | 64 +++ dot-files/_navi2ch/elisp/navi2ch-async_el | 414 ++++++++++++++++++ .../_navi2ch/elisp/navi2ch-board-custom_el | 39 ++ .../_navi2ch/elisp/navi2ch-idle-parse_el | 23 + dot-files/_navi2ch/elisp/navi2ch-migemo_el | 54 +++ dot-files/_navi2ch/elisp/sinsure_el | 126 ++++++ dot-files/_navi2ch/etc_txt | 12 + 8 files changed, 735 insertions(+) create mode 100644 dot-files/_mew create mode 100644 dot-files/_navi2ch/elisp/navi2ch-async_el create mode 100644 dot-files/_navi2ch/elisp/navi2ch-board-custom_el create mode 100644 dot-files/_navi2ch/elisp/navi2ch-idle-parse_el create mode 100644 dot-files/_navi2ch/elisp/navi2ch-migemo_el create mode 100644 dot-files/_navi2ch/elisp/sinsure_el create mode 100644 dot-files/_navi2ch/etc_txt diff --git a/IGNORE b/IGNORE index 0de194e..ff04f83 100644 --- a/IGNORE +++ b/IGNORE @@ -55,13 +55,16 @@ .mpd .mplayer/DVDKeys .mplayer/config +.mplayer/gui.* .mplayer/skins +.mplayer/subfont.ttf .nautilus .navi2ch/*.net .navi2ch/*.com .navi2ch/*.jp .navi2ch/board.txt .navi2ch/cookie.info +.navi2ch/elisp/*.elc .navi2ch/fetched.txt .navi2ch/list.info .navi2ch/tmp diff --git a/dot-files/_mew b/dot-files/_mew new file mode 100644 index 0000000..342332c --- /dev/null +++ b/dot-files/_mew @@ -0,0 +1,64 @@ +;; -*- emacs-lisp -*- + +(autoload 'mew-send "mew" nil t) +(setq mew-name "PHO") +(setq mew-user "pho") +(setq mew-mail-domain "cielonegro.org") + +(setq mew-pop-user "mail.cielonegro.org:pho") +(setq mew-pop-server "localhost") +(setq mew-pop-port "110") +(setq mew-pop-auth 'pass) + +(setq mew-smtp-server "mail.cielonegro.org") +(setq mew-smtp-port "587") +(setq mew-smtp-auth-list '("PLAIN")) +(setq mew-smtp-user "pho") +(setq mew-smtp-auth-plain-authorize-id t) + +(setq mew-use-biff t) +(setq mew-pop-biff-interval 15) +(setq mew-pop-size 0) ;; no restriction +(setq mew-prog-pgp "gpg") +(setq mew-prog-gpg "gpg") +(setq mew-pgp-pks-servers + '(("wwwkeys.de.pgp.net" t) + ("pgp.nic.ad.jp" nil))) + +(setq mew-nntp-server "localhost") +(setq mew-nntp-port "1119") + +(add-hook 'mew-summary-mode-hook + (lambda () + (local-set-key "@" 'mew-summary-review))) + +(if (boundp 'read-mail-command) + (setq read-mail-command 'mew)) + +(setq mew-use-cached-passwd t) + + +;; popfile/auto mark +;; mew-scan-fieldsに "X-Text-Classification:" が入っている必要有り。 +(defun mew-action-popfile (val) + (let ((case-fold-search t)) + (cond + ((string-match "spam" val) ?D) + ))) + +(setq mew-inbox-action-alist + '(("X-Text-Classification:" mew-action-popfile))) + +(defun mew-summary-form-x-classification () + (MEW-SPAM)) + +(defun mew-message-open-popfile-link () + (interactive) + (let ((case-fold-search t)) + (if (string-match "^X-POPFile-Link: \\(.+\\)$" (buffer-string)) + (browse-url (match-string 1 (buffer-string))) + (message "No POPFile-Link found...")))) +(add-hook 'mew-message-mode-hook + (lambda () + (local-set-key "\C-c\C-p" 'mew-message-open-popfile-link) + (local-set-key "\r" 'browse-url-at-point))) diff --git a/dot-files/_navi2ch/elisp/navi2ch-async_el b/dot-files/_navi2ch/elisp/navi2ch-async_el new file mode 100644 index 0000000..f51e29d --- /dev/null +++ b/dot-files/_navi2ch/elisp/navi2ch-async_el @@ -0,0 +1,414 @@ +;; ¿·µ¬¼èÆÀ¤Î¤ß async¡£ + +(require 'navi2ch) + +;; get async or not +(defvar navi2ch-async-get t) + + +(defvar navi2ch-async-process-buffer " *navi2ch async process*") + +;; buffer-local ¤Ê vector¤Ë¤Ç¤â¤¹¤ë¡© +(defvar navi2ch-async-process nil) +(defvar navi2ch-async-output-buffer nil) +(defvar navi2ch-async-status nil) ;navi2ch-net-status? +(defvar navi2ch-async-header nil) ;navi2ch-net-header? +(defvar navi2ch-async-first nil) +(defvar navi2ch-async-number nil) +(defvar navi2ch-async-filter-position nil) +(defvar navi2ch-async-gzip-p nil) + +(defmacro navi2ch-async-net-ignore-errors (&rest body) + "BODY ¤òɾ²Á¤·¡¢¤½¤ÎÃͤòÊÖ¤¹¡£ +BODY ¤Îɾ²ÁÃæ¤Ë¥¨¥é¡¼¤¬µ¯¤³¤ë¤È nil ¤òÊÖ¤¹¡£" + `(condition-case err + ,(cons 'progn body) + (error + (condition-case nil + (navi2ch-async-net-cleanup-process) + (error nil)) + (ding) + (if err + (message "Error: %s" (error-message-string err)) + (message "Error")) + (sleep-for 1) + nil) + (quit + (condition-case nil + (navi2ch-async-net-cleanup-process) + (error nil)) + (signal (car err) (cdr err))))) + +;;for debug +;; (defmacro navi2ch-async-net-ignore-errors (&rest body) +;; "BODY ¤òɾ²Á¤·¡¢¤½¤ÎÃͤòÊÖ¤¹¡£ +;; BODY ¤Îɾ²ÁÃæ¤Ë¥¨¥é¡¼¤¬µ¯¤³¤ë¤È nil ¤òÊÖ¤¹¡£" +;; `,(cons 'progn body)) + +(defun navi2ch-async-net-cleanup () + (navi2ch-async-net-cleanup-process) + (navi2ch-async-net-cleanup-vars)) + +(defun navi2ch-async-net-cleanup-process () + (let ((proc navi2ch-async-process)) + (when (processp proc) + (set-process-filter proc 'ignore) + (set-process-sentinel proc 'ignore) + (when (eq (process-status proc) 'open) + (delete-process proc)) + (setq navi2ch-async-process nil)))) + +(defun navi2ch-async-net-cleanup-vars () + (setq navi2ch-async-status nil + navi2ch-async-header nil + navi2ch-async-first nil + navi2ch-async-number nil + navi2ch-async-filter-position nil + navi2ch-async-gzip-p nil)) + +;; mew-filter +(defmacro navi2ch-async-filter (&rest body) + `(let ((pbuf (process-buffer process)) ;; MUST use 'process' + (obuf (buffer-name))) + (if (and (bufferp pbuf) + (buffer-name pbuf)) ;; check a killed buffer + ;; must use buffer-name instead of current-buffer + ;; so that get-buffer can detect killed buffer. + (unwind-protect + (progn + ;; buffer surely exists. + (set-buffer (process-buffer process)) ;; necessary + (navi2ch-async-net-ignore-errors ,@body)) + (if (get-buffer obuf) + ;; the body sometimes kills obuf. + (set-buffer obuf)))))) + +(defun navi2ch-async-article-filter (process string) + (navi2ch-async-filter + (goto-char (point-max)) + (insert string) + (if (null navi2ch-async-status) + (navi2ch-async-get-header) + (when (string= navi2ch-async-status "200") + (navi2ch-async-article-insert-lines 10) ;xxx + (when (and navi2ch-async-number + (buffer-live-p navi2ch-async-output-buffer)) + (with-current-buffer navi2ch-async-output-buffer + (when (and (listp navi2ch-article-message-list) + (assq navi2ch-async-number navi2ch-article-message-list)) + (navi2ch-article-goto-number navi2ch-async-number) + (setq navi2ch-async-number nil)))))))) + + +(defun navi2ch-async-article-sentinel (process event) + (cond + ((and navi2ch-async-status + (string= navi2ch-async-status "200")) + (let (cont) + (navi2ch-async-filter + (navi2ch-async-article-insert-lines) + (setq cont (navi2ch-string-as-multibyte + (buffer-substring-no-properties + (progn + (goto-char (point-min)) + (re-search-forward "\r\n\r?\n" nil t)) + (point-max))))) + (when (buffer-live-p navi2ch-async-output-buffer) + (with-current-buffer navi2ch-async-output-buffer + (let* ((article navi2ch-article-current-article) + (board navi2ch-article-current-board) + (file (navi2ch-article-get-file-name board article)) + (dir (file-name-directory file))) + (unless (file-exists-p dir) + (make-directory dir t)) + (let ((coding-system-for-write 'binary) + (coding-system-for-read 'binary)) + (with-temp-file file + ;;xxx + (when (file-exists-p file) + (insert-file-contents file) + (goto-char (point-max))) + (insert cont))) + (navi2ch-article-save-info board article navi2ch-async-first) + (run-hooks 'navi2ch-article-after-sync-hook) + (when navi2ch-async-number + (navi2ch-article-goto-number navi2ch-async-number)) + (navi2ch-article-set-summary-element board article nil))))) + (message "inserting current messages...done")) + (t + (message "Async ¤Îµ¡Ç½ÉÔ­¤Ç¤¹¡£Ž½ŽÏŽ¿") + (let ((navi2ch-async-get nil)) + (when (buffer-live-p navi2ch-async-output-buffer) + (with-current-buffer navi2ch-async-output-buffer + (unless (listp navi2ch-article-message-list) + (setq navi2ch-article-message-list nil)) + (navi2ch-article-sync)))))) + (navi2ch-async-net-cleanup)) + +(defun navi2ch-async-article-sync (&optional force first number) + "¥¹¥ì¤ò¹¹¿·¤¹¤ë¡£force ¤Ê¤é¶¯À©¡£ +first ¤¬ nil ¤Ê¤é¤Ð¡¢¥Õ¥¡¥¤¥ë¤¬¹¹¿·¤µ¤ì¤Æ¤Ê¤±¤ì¤Ð²¿¤â¤·¤Ê¤¤" + (interactive "P") + (when (not (navi2ch-board-from-file-p navi2ch-article-current-board)) + (run-hooks 'navi2ch-article-before-sync-hook) + (let* ((article navi2ch-article-current-article) + (board navi2ch-article-current-board) + (navi2ch-net-force-update (or navi2ch-net-force-update + force)) + (file (navi2ch-article-get-file-name board article)) + header) + (when first + (setq article (navi2ch-article-load-info) + navi2ch-article-message-list + (navi2ch-article-get-message-list file))) + (navi2ch-article-set-mode-line) + (if (and (cdr (assq 'kako article)) + (file-exists-p file) + (not (and force ; force ¤¬»ØÄꤵ¤ì¤Ê¤¤¸Â¤êsync¤·¤Ê¤¤ + (y-or-n-p "re-sync kako article?")))) + (setq navi2ch-article-current-article article) + (setq navi2ch-async-output-buffer (current-buffer) + navi2ch-async-number (or number (cdr (assq 'number article))) + navi2ch-async-first first + ;; navi2ch-async-output-buffer ¤¬¾Ã¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¡£ + ;; see navi2ch-article-view-article() + navi2ch-article-message-list 'async) + (navi2ch-async-article-update-file board article force)) + (setq navi2ch-article-hide-mode nil + navi2ch-article-important-mode nil)) + t ;for board-mode state + )) + +(defun navi2ch-async-article-update-file (board article force) + (if navi2ch-offline + (unless (listp navi2ch-article-message-list) + (setq navi2ch-article-message-list nil)) + (if navi2ch-async-process + (message "Another process is running.") + (message "inserting current messages...") + (setq navi2ch-article-view-range nil) ;display all in async + (let* ((article navi2ch-article-current-article) + (board navi2ch-article-current-board) + (process-connection-type nil) + (inherit-process-coding-system + navi2ch-net-inherit-process-coding-system) + (url (navi2ch-article-get-url board article)) + (list (navi2ch-net-split-url url navi2ch-net-http-proxy)) + (host (cdr (assq 'host list))) + (file (cdr (assq 'file list))) + (port (cdr (assq 'port list))) + (host2ch (cdr (assq 'host2ch list))) + (pbuf (get-buffer-create navi2ch-async-process-buffer)) + proc) + (save-excursion + (set-buffer pbuf) + (erase-buffer) + (setq navi2ch-async-status nil + navi2ch-async-header nil) + (navi2ch-set-buffer-multibyte nil)) + (message "now connecting...") + (setq proc (open-network-stream "navi2ch-async-test" pbuf host port)) + (message "%sdone" (current-message)) + (process-kill-without-query proc) + (set-process-coding-system proc 'binary 'binary) + (set-process-filter proc 'navi2ch-async-article-filter) + (set-process-sentinel proc 'navi2ch-async-article-sentinel) + (message "sending request...") + (process-send-string proc + (format (concat + "%s %s %s\r\n" + "MIME-Version: 1.0\r\n" + "Host: %s\r\n" + "Pragma: no-cache\r\n" + "User-Agent: " navi2ch-net-user-agent + "\r\n" + "\r\n") + "GET" file "HTTP/1.0" host2ch)) + (message "%sdone" (current-message)) + (setq navi2ch-async-process proc))))) + +(define-key navi2ch-global-map "\C-c\C-k" 'navi2ch-async-process-stop) +(defun navi2ch-async-process-stop () + (interactive) + (if (not (processp navi2ch-async-process)) + (message "No process is running.") + (navi2ch-async-net-cleanup) + (message "Process is stopped."))) + +;; ¿·µ¬¼èÆÀ¤Î¤ß async¡£ +(defadvice navi2ch-article-sync (around async-sync activate) + (if (or (not navi2ch-async-get) + force ;C-u s in article-mode + (cdr (assq 'kako navi2ch-article-current-article)) ;kako + (not (eq (cdr (assq 'bbstype navi2ch-article-current-board)) + 'unknown)) ;2ch + (file-exists-p (navi2ch-article-get-file-name + navi2ch-article-current-board + navi2ch-article-current-article))) + ad-do-it + (setq ad-return-value + (navi2ch-async-article-sync force first number)))) + +;; If navi2ch-article-view-article's arg NUMBER is specified, +;; (setq navi2ch-article-message-list 'async) causes error +;; in navi2ch-article-goto-number. +(defadvice navi2ch-article-goto-number (around async-hack activate) + "Bind `navi2ch-article-message-list' to nil when async." + (let ((navi2ch-article-message-list (and (listp navi2ch-article-message-list) + navi2ch-article-message-list))) + ad-do-it)) + +;; ¤Á¤ç¤³¤Ã¤ÈÊѹ¹¡£ +(defun navi2ch-async-get-header () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\r\n\r?\n" nil t) + (let ((end (match-end 0)) + list) + (goto-char (point-min)) + ;; get-status + (when (looking-at "HTTP/1\\.[01] \\([0-9]+\\)") + (setq navi2ch-async-status (match-string 1))) + (while (re-search-forward "^\\([^\r\n:]+\\): \\(.+\\)\r\n" end t) + (setq list (cons (cons (match-string 1) (match-string 2)) + list))) + (let ((date (assoc-ignore-case "Date" list))) + (when (and date (stringp (cdr date))) + (setq navi2ch-net-last-date (cdr date)))) + (when (buffer-live-p navi2ch-async-output-buffer) + (with-current-buffer navi2ch-async-output-buffer + (setq navi2ch-article-current-article + (navi2ch-put-alist 'time + (or (cdr (assoc "Last-Modified" list)) + (cdr (assoc "Date" list))) + navi2ch-article-current-article)))) + (setq navi2ch-async-header (nreverse list)) + (setq navi2ch-async-filter-position end))))) + + +;; navi2ch-article-get-message-list +(defun navi2ch-async-article-get-message-list-buffer (dat) + (let ((board navi2ch-article-current-board) + (sep navi2ch-article-separator) + (i (1+ (if (listp navi2ch-article-message-list) + (length navi2ch-article-message-list) + 0))) + message-list) + (with-temp-buffer + (insert dat) + (decode-coding-region (point-min) (point-max) navi2ch-coding-system) + (goto-char (point-min)) + (unless sep + (setq sep (navi2ch-article-get-separator))) + (goto-char (point-min)) + (while (not (eobp)) + (setq message-list + (cons (cons i + (let ((str (buffer-substring-no-properties + (point) + (progn (forward-line 1) + (1- (point)))))) + (unless (string= str "") str))) + message-list)) + (setq i (1+ i)))) + (unless navi2ch-article-separator + (setq navi2ch-article-separator sep)) ; it's a buffer local variable... + (nreverse message-list))) + +(defun navi2ch-async-article-insert-lines (&optional num) + (when (buffer-live-p navi2ch-async-output-buffer) + (save-excursion + (goto-char navi2ch-async-filter-position) + (when (> (- (buffer-size) (forward-line (buffer-size))) (or num 0)) + (beginning-of-line) + (let ((dat (navi2ch-string-as-multibyte + (buffer-substring-no-properties + navi2ch-async-filter-position (point)))) + mlist) + (setq navi2ch-async-filter-position (point)) + (set-buffer navi2ch-async-output-buffer) + (save-excursion + (setq mlist (navi2ch-async-article-get-message-list-buffer dat) + navi2ch-article-message-list + (append (and (listp navi2ch-article-message-list) + navi2ch-article-message-list) + mlist)) + (when (listp navi2ch-article-message-list) + ;; navi2ch-article-current-article ¤Ï subject ¤ò»ý¤Ã¤Æ¤Ê¤¤¤«¤â¡£ + (unless (cdr (assq 'subject navi2ch-article-current-article)) + (let ((msg (cdr (car navi2ch-article-message-list)))) + (setq navi2ch-article-current-article + (navi2ch-put-alist + 'subject + (cdr (assq 'subject + (if (stringp msg) + (navi2ch-article-parse-message msg) + msg))) + navi2ch-article-current-article)))) + (let ((buffer-read-only nil)) + (goto-char (point-max)) + (navi2ch-async-article-insert-messages mlist nil)) + (navi2ch-article-set-mode-line)))))))) + +;; message ½Ð¤µ¤Ê¤¤¤è¤¦¤Ë¤·¤¿¤À¤±¡£ +(defun navi2ch-async-article-insert-messages (list range) + "LIST ¤òÀ°·Á¤·¤ÆÁÞÆþ¤¹¤ë" +;; (message "inserting current messages...") + (let ((len (length list)) + (hide (cdr (assq 'hide navi2ch-article-current-article))) + (imp (cdr (assq 'important navi2ch-article-current-article)))) + (dolist (x list) + (let ((num (car x)) + (alist (cdr x))) + (when (and alist + (cond (navi2ch-article-hide-mode + (memq num hide)) + (navi2ch-article-important-mode + (memq num imp)) + (t + (and (navi2ch-article-inside-range-p num range len) + (not (memq num hide)))))) + (when (stringp alist) + (setq alist (navi2ch-article-parse-message alist))) + (let (filter-result) + (setq filter-result + (let ((filtered (navi2ch-article-apply-message-filters alist))) + (when filtered + (cond ((stringp filtered) + (navi2ch-put-alist 'name filtered alist) + (navi2ch-put-alist 'data filtered alist) + (navi2ch-put-alist 'mail + (if (string-match "sage" + (cdr (assq 'mail alist))) + "sage" + "") + alist)) + ((eq filtered 'hide) + 'hide) + ((eq filtered 'important) + 'important))))) + (if (and (eq filter-result 'hide) + (not navi2ch-article-hide-mode)) + (progn + (setq hide (cons num hide)) + (setq navi2ch-article-current-article + (navi2ch-put-alist 'hide + hide + navi2ch-article-current-article))) + (when (and (eq filter-result 'important) + (not navi2ch-article-important-mode)) + (setq imp (cons num imp)) + (setq navi2ch-article-current-article + (navi2ch-put-alist 'important + imp + navi2ch-article-current-article))) + (setcdr x (navi2ch-put-alist 'point (point-marker) alist)) + ;; (setcdr x (navi2ch-put-alist 'point (point) alist)) + (navi2ch-article-insert-message num alist)))))) +;; (garbage-collect) ; navi2ch-parse-message ¤ÏÂçÎ̤˥´¥ß¤ò»Ä¤¹ +;; (message "inserting current messages...done"))) + )) + +(provide 'navi2ch-async) + +;;; navi2ch-async.el ends here diff --git a/dot-files/_navi2ch/elisp/navi2ch-board-custom_el b/dot-files/_navi2ch/elisp/navi2ch-board-custom_el new file mode 100644 index 0000000..cf8380e --- /dev/null +++ b/dot-files/_navi2ch/elisp/navi2ch-board-custom_el @@ -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 diff --git a/dot-files/_navi2ch/elisp/navi2ch-idle-parse_el b/dot-files/_navi2ch/elisp/navi2ch-idle-parse_el new file mode 100644 index 0000000..fedfeb5 --- /dev/null +++ b/dot-files/_navi2ch/elisp/navi2ch-idle-parse_el @@ -0,0 +1,23 @@ +(require 'navi2ch) + +(defvar navi2ch-article-parse-timer-id nil) +(defvar navi2ch-article-parse-timer-interval 3) +(defun navi2ch-article-parse-timer-setup () + (when navi2ch-article-parse-timer-id + (cancel-timer navi2ch-article-parse-timer-id)) + (setq navi2ch-article-parse-timer-id + (run-with-idle-timer navi2ch-article-parse-timer-interval + t 'navi2ch-article-parse-messages-list))) +(defun navi2ch-article-parse-messages-list () + (with-current-buffer (navi2ch-article-current-buffer) + (catch 'loop + (dolist (x navi2ch-article-message-list) + (when (stringp (cdr x)) + (setcdr x (cons (cons 'point nil) + (navi2ch-article-parse-message (cdr x))))) + (when (input-pending-p) (throw 'loop nil))) + (cancel-timer navi2ch-article-parse-timer-id) + (setq navi2ch-article-parse-timer-id nil)))) +(add-hook 'navi2ch-article-mode-hook 'navi2ch-article-parse-timer-setup) + +(provide 'navi2ch-idle-parse) \ No newline at end of file diff --git a/dot-files/_navi2ch/elisp/navi2ch-migemo_el b/dot-files/_navi2ch/elisp/navi2ch-migemo_el new file mode 100644 index 0000000..61c7b69 --- /dev/null +++ b/dot-files/_navi2ch/elisp/navi2ch-migemo_el @@ -0,0 +1,54 @@ +;;; navi2ch-migemo.el --- migemo support for Navi2ch + +;; Copyright (C) 2002 by Navi2ch Project + +;; Author: Nanashi San +;; Keywords: 2ch, network, matching + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; To use this module, put following code into your `~/.navi2ch/init.el': +;; (require 'navi2ch-migemo) + +;;; Code: +(provide 'navi2ch-migemo) + +;; migemo $B$,$J$/$F$b%3%s%Q%$%k$G$-$k$h$&$K!#(B +(eval '(require 'migemo)) + +(require 'navi2ch-search) + +(defvar navi2ch-migemo-enable t + "*$B8!:w%Q%?!<%s$K(Bmigemo$B$rE,MQ$9$k$+$I$&$+!#(B") + +(defadvice navi2ch-search-board-subject-regexp + (before navi2ch-migemo-search-board-subject-regexp activate) + "$B8!:w%Q%?!<%s$K(Bmigemo$B$rE,MQ$9$k!#(B" + (if navi2ch-migemo-enable + (ad-set-arg 1 (migemo-get-pattern (ad-get-arg 1))))) + +(defadvice navi2ch-search-article-regexp + (before navi2ch-migemo-search-article-regexp activate) + "$B8!:w%Q%?!<%s$K(Bmigemo$B$rE,MQ$9$k!#(B" + (if navi2ch-migemo-enable + (ad-set-arg 1 (migemo-get-pattern (ad-get-arg 1))))) + +(defun navi2ch-migemo-toggle-enable () + (setq navi2ch-migemo-enable (not navi2ch-migemo-enable))) + +;;; navi2ch-migemo.el ends here diff --git a/dot-files/_navi2ch/elisp/sinsure_el b/dot-files/_navi2ch/elisp/sinsure_el new file mode 100644 index 0000000..aaa5b05 --- /dev/null +++ b/dot-files/_navi2ch/elisp/sinsure_el @@ -0,0 +1,126 @@ +(require 'navi2ch) + +(defun navi2ch-new-thread-check (new old) + (let* ((article (navi2ch-article-url-to-article new)) + (board (navi2ch-board-url-to-board new)) + (file (navi2ch-article-get-file-name board article)) + (regex (regexp-quote (navi2ch-replace-string + ;; »ª°Üž¤â¤¢¤ë¤Î¤Ç¡¢»ªÌ¾¤Þ¤Çºï¤ë + "^http://[^.]+\\|/$" + "" old 'all)))) + (unless (file-exists-p file) + (when (navi2ch-article-fetch-article board article) + (navi2ch-bm-remember-fetched-article board article))) + (when (file-exists-p file) + (with-temp-buffer + (navi2ch-insert-file-contents file) + ;; µì¥¹¥ì¥Ã¥É¤ÎURL¤¬½ñ¤¤¤Æ¤¢¤ë¤«¥Á¥§¥Ã¥¯ + (if (re-search-forward regex + ;; 1-5¤ò¥Á¥§¥Ã¥¯ + (navi2ch-line-beginning-position 6) + t) + t + ;; (navi2ch-bm-remove-article-subr board article) + nil))))) + +(defun navi2ch-subject-seriese-format (subject) + ;; Á´³Ñ/Ⱦ³Ñ¤ò¶èÊ̤·¤Ê¤¤ + (setq subject (japanese-zenkaku subject)) + (setq subject (japanese-hankaku subject 'ascii-only)) + ;; Âçʸ»ú/¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤ + (setq subject (upcase subject)) + ;; ¤Ò¤é¤¬¤Ê/¥«¥¿¥«¥Ê¤ò¶èÊ̤·¤Ê¤¤ + (setq subject (japanese-hiragana subject)) + ;; ¶õÇò¡¦¿ô»ú¤ò̵»ë + (setq subject (navi2ch-replace-string "[ \t0-9]" "" subject 'all))) + +(defun navi2ch-subject-seriese-p (subject1 subject2) + ;; ¥¹¥ì¥¿¥¤¤ÎÈæ³Ó¤Ã¤Æ¤É¤¦¤ä¤ì¤Ð¤¤¤¤¤Î¤«Ê¬¤«¤é¤ó¡£ + ;; ¤È¤ê¤¢¤¨¤º¡¢Á´³Ñ/Ⱦ³Ñ¡¦¤Ò¤é¤¬¤Ê/¥«¥¿¥«¥Ê¤ò·¤¨¤¿¸å¤Ç + ;; û¤¤¤Û¤¦¤ÎÁ°¸å10%¤Å¤Ä¤òÀÚ¤ê¼Î¤Æ¤Æ + ;; (string-match "û¤¤Êý" "Ť¤Êý") ¤È¤·¤Æ¤ë¡£ + (unless (string= subject1 subject2) + (let* ((subj1 (navi2ch-subject-seriese-format subject1)) + (subj2 (navi2ch-subject-seriese-format subject2)) + (ratio 0.1) + from to) + (when (> (length subj1) (length subj2)) + (let ((tmp subj1)) + (setq subj1 subj2 + subj2 tmp))) + (setq from (round (* (length subj1) ratio))) + (unless (= from 0) + (setq to (- from))) + (string-match (regexp-quote (substring subj1 from to)) + subj2)))) + +(defun navi2ch-article-search-new-thread-with-subject () + ;; Îà»÷¥µ¥Ö¥¸¥§¥¯¥È¤Î¥¹¥ì¤ò¥Á¥§¥Ã¥¯ + (let* ((article navi2ch-article-current-article) + (board navi2ch-article-current-board) + (subject (cdr (assoc 'subject article))) + (curl (navi2ch-article-to-url board article)) + (file (navi2ch-board-get-file-name board)) + list nurl found) + (unless navi2ch-offline + (navi2ch-board-save-old-subject-file board) + (navi2ch-board-update-file board)) + (setq list (navi2ch-board-get-subject-list file)) + (catch 'find + (while list + (let* ((atcl (car list)) + (sbj (cdr (assoc 'subject atcl)))) + (setq nurl (navi2ch-article-to-url board atcl) + list (cdr list)) + (when (and (navi2ch-subject-seriese-p subject sbj) + (navi2ch-new-thread-check nurl curl)) + (throw 'find (setq found t)))))) + (if found nurl))) + +(defun navi2ch-article-search-new-thread-with-lead () + ;; ¿·¥¹¥ì¤Ø¤ÎͶƳ¤ò¥Á¥§¥Ã¥¯ + (let ((cboard (cdr (assoc 'name navi2ch-article-current-board))) + (curl (navi2ch-article-to-url navi2ch-article-current-board + navi2ch-article-current-article)) + (msg-list (reverse navi2ch-article-message-list)) + (num 850) ;¿·¥¹¥ì°Ü¹Ô¤Ï850°Ê¹ß¤«¤Ê¡£ + nboard url body start found) + (catch 'find + (while (> (length msg-list) num) + (setq body (if (listp (cdar msg-list)) + (cdr (assoc 'data (cdar msg-list))) + (cdar msg-list)) + msg-list (cdr msg-list)) + (setq start 0) + (while (string-match navi2ch-article-url-regexp body start) + (setq url (match-string 0 body) + start (match-end 0)) + (setq nboard (cdr (assoc 'name (navi2ch-board-url-to-board url)))) + ;; Ʊ¤¸ÈĤÀ¤Ã¤¿¤é¥Á¥§¥Ã¥¯ + (when (and nboard + ;; °Üž¤·¤Æ¤Æ¤âÇ°¤Î¤¿¤á¥Á¥§¥Ã¥¯ + (or (string= nboard "No Name") (string= nboard cboard)) + (navi2ch-new-thread-check url curl)) + (throw 'find (setq found t)))) + (setq num (1+ num)))) + (if found url))) + +(defun navi2ch-article-new-thread () + "¿·¥¹¥ì¤Ë°ÜÆ°¤¹¤ë¡£" + (interactive) + (let ((url (or (navi2ch-article-search-new-thread-with-lead) + (navi2ch-article-search-new-thread-with-subject)))) + (if url + (let* ((article (navi2ch-article-url-to-article url)) + (board (navi2ch-board-url-to-board url)) + (subj (navi2ch-article-cached-subject board article))) + (when (navi2ch-y-or-n-p (concat "¡Ö" subj "¡×¤Ë°ÜÆ°¤¹¤ë¡©")) + (navi2ch-goto-url url))) + (message (concat "¿·¥¹¥ì¤òȯ¸«¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£" + (substitute-command-keys + "`\\[navi2ch-article-goto-current-board]'") + " ¤·¤Æ¼êÆ°¤Çõ¤·¤Æ¤Í¡£"))))) + +(define-key navi2ch-article-mode-map "\C-c\C-n" 'navi2ch-article-new-thread) + +(provide 'sinsure) \ No newline at end of file diff --git a/dot-files/_navi2ch/etc_txt b/dot-files/_navi2ch/etc_txt new file mode 100644 index 0000000..7394740 --- /dev/null +++ b/dot-files/_navi2ch/etc_txt @@ -0,0 +1,12 @@ +Freenet +http://jbbs.shitaraba.com/computer/5098/ +5098 +[¤Õ¤¿¤Ð]¥é¥¦¥ó¥¸ +http://www.2chan.net/entrance/ +futaba_entrance +[¤Õ¤¿¤Ð]Ⱦ³Ñ¡¦¤¢¤×Ï¢Íí +http://www.2chan.net/ascii/ +futaba_ascii +[JBBS]AMI-nineteen +http://jbbs.livedoor.jp/news/648/ +ami_nineteen -- 2.40.0