Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- navi2ch-board.el 2012-03-31 22:16:19.000000000 +0900
- +++ navi2ch-board.el 2012-05-15 00:38:56.331688741 +0900
- @@ -281,12 +281,34 @@
- (when (looking-at regexp)
- (throw 'loop regexp))))))
- +(defsubst navi2ch-board-generate-article-info (article seen current-time)
- + (let ((res (cdr (assq 'response article)))
- + (artid (cdr (assq 'artid article)))
- + (hash (make-hash-table :test 'eq))
- + last read)
- + (puthash 'res res hash)
- + (puthash 'artid artid hash)
- + (puthash 'elapsed (- current-time (string-to-number artid)) hash)
- + (when navi2ch-board-insert-subject-with-diff
- + (setq last (or seen
- + (cdr (assoc artid navi2ch-board-last-seen-alist))
- + (catch 'break
- + (string-to-number
- + (or (cdr (assoc artid navi2ch-board-old-subject-alist))
- + (throw 'break nil))))))
- + (puthash 'diff (if last (- (string-to-number res) last) nil) hash))
- + (when navi2ch-board-insert-subject-with-unread
- + (setq read (navi2ch-article-get-last-read-number
- + navi2ch-board-current-board article))
- + (puthash 'unread (if read (max 0 (- (string-to-number res) read)) nil) hash))
- + hash))
- (defun navi2ch-board-insert-subjects (list)
- (let ((bookmark (cdr (assq 'bookmark navi2ch-board-current-board)))
- (hide (cdr (assq 'hide navi2ch-board-current-board)))
- (summary (navi2ch-article-load-article-summary
- navi2ch-board-current-board))
- + (ct (current-time))
- (i 1))
- (dolist (article list)
- (let* ((artid (cdr (assq 'artid article)))
- @@ -307,39 +329,8 @@
- (navi2ch-bm-insert-subject
- article i
- (cdr (assq 'subject article))
- - (let ((res (cdr (assq 'response article)))
- - (last (and navi2ch-board-insert-subject-with-diff
- - (or seen
- - (cdr (assoc artid navi2ch-board-last-seen-alist))
- - (catch 'break
- - (string-to-number
- - (or (cdr (assoc artid navi2ch-board-old-subject-alist))
- - (throw 'break nil)))))))
- - (read (and navi2ch-board-insert-subject-with-unread
- - (navi2ch-article-get-last-read-number
- - navi2ch-board-current-board
- - article))))
- - (concat "("
- - (format "%4s" res)
- - (and navi2ch-board-insert-subject-with-diff
- - (concat
- - "/"
- - (if last
- - (format "%5s"
- - (format "+%d"
- - (- (string-to-number res) last)))
- - " -")))
- - (and navi2ch-board-insert-subject-with-unread
- - (concat
- - "/"
- - (if read
- - (substring
- - (format " Δ%d"
- - (max 0
- - (- (string-to-number res) read)))
- - -5)
- - " -")))
- - ")"))
- + (navi2ch-board-generate-article-info
- + article seen (+ (* (car ct) 65536) (nth 1 ct)))
- (cond ((and navi2ch-board-check-updated-article-p
- (setq updated
- (navi2ch-board-updated-article-p article seen)))
- @@ -357,6 +348,7 @@
- (eq old-mode major-mode))
- (navi2ch-board-sync force)
- (setq navi2ch-board-current-board (navi2ch-board-load-info board))
- + (navi2ch-bm-set-subject-format-info (cdr (assq 'id board)))
- (run-hooks 'navi2ch-board-select-board-hook)
- (navi2ch-board-sync force 'first)))))
- --- navi2ch-board-misc.el 2012-03-31 22:16:19.000000000 +0900
- +++ navi2ch-board-misc.el 2012-05-15 06:50:57.398940227 +0900
- @@ -125,6 +125,16 @@
- (nil . ? ))
- :test 'eq))
- +;; 現在の板のスレタイ一覧の書式情報
- +(defvar navi2ch-bm-subject-current-format-info
- + (navi2ch-alist-to-hash
- + '((format)
- + (number-pos)
- + (updated-pos)
- + (state-pos)
- + (mark-pos)
- + (subject-pos))
- + :test 'eq))
- (eval-and-compile
- (let ((state-list '(view cache update down nil))
- @@ -254,29 +264,148 @@
- (t
- (navi2ch-article-check-cached board article))))
- +(defun navi2ch-bm-set-subject-format-info (&optional board-id)
- + "渡された板IDに対応する書式を選択し、各列の開始位置を求める"
- + (puthash
- + 'format (if (or (functionp navi2ch-bm-subject-format) (stringp navi2ch-bm-subject-format))
- + navi2ch-bm-subject-format
- + (catch 'found
- + (let (kv v (fmts navi2ch-bm-subject-format))
- + (while (setq kv (car fmts))
- + (if (setq v (cdr kv)) (if (member board-id v) (throw 'found (car kv))))
- + (setq fmts (cdr fmts))))
- + (car (car navi2ch-bm-subject-format))))
- + navi2ch-bm-subject-current-format-info)
- + (let ((dummy-line (navi2ch-bm-format-subject
- + 999 ?\r ?\v "\f"
- + (navi2ch-alist-to-hash
- + '((res . "1") (diff) (unread) (artid . "1") (elapsed . 1) (mark . ?\a)))))
- + kv pos)
- + (if (setq pos (string-match "999" dummy-line))
- + (puthash 'number-pos (- pos 3) navi2ch-bm-subject-current-format-info))
- + (dolist (kv '((updated-pos . "\r") (state-pos . "\v") (mark-pos . "\a") (subject-pos . "\f")))
- + (puthash (car kv)
- + (string-match (cdr kv) dummy-line)
- + navi2ch-bm-subject-current-format-info))))
- +
- (defun navi2ch-bm-format-subject
- (number updated-char state-char subject other)
- - (format (concat "%" (number-to-string navi2ch-bm-number-width)
- - "d %c%c %s%s%s\n")
- - number updated-char state-char subject
- - (make-string (max (- navi2ch-bm-subject-width
- - (string-width subject))
- - 1)
- - ? )
- - other))
- + "other が文字列のときは navi2ch-bm-subject-current-format-info を適用後、後ろに連結する"
- + (let* ((format (gethash 'format navi2ch-bm-subject-current-format-info))
- + (info (if (hash-table-p other)
- + (copy-hash-table other) (make-hash-table :test 'eq)))
- + (res (string-to-number (gethash 'res info "")))
- + (diff (gethash 'diff info 'NIL))
- + (unread (gethash 'unread info 'NIL))
- + (id (gethash 'artid info ""))
- + (elapsed (gethash 'elapsed info 9999999999)))
- + (unless format
- + (navi2ch-bm-set-subject-format-info)
- + (setq format (gethash 'format navi2ch-bm-subject-current-format-info)))
- + (concat
- + (if (functionp format)
- + (funcall format
- + number updated-char state-char subject res diff unread id
- + (/ res (/ elapsed 60.0))
- + (min (/ res (/ elapsed 3600.0)) (* res 4.0))
- + (min (/ res (/ elapsed 86400.0)) res)
- + (gethash 'mark info))
- + (let ((line format))
- + (if (string-match "<number>" line)
- + (setq line (replace-match
- + (format (concat "%" (number-to-string navi2ch-bm-number-width) "d")
- + number)
- + nil nil line)))
- + (if (string-match "<updated>" line)
- + (setq line (replace-match (format "%c" updated-char) nil nil line)))
- + (if (string-match "<state>" line)
- + (setq line (replace-match (format "%c" state-char) nil nil line)))
- + (if (string-match "<mark>" line)
- + (setq line (replace-match
- + (format "%c" (or (cdr (and (listp other) (assoc 'mark other))) ? ))
- + nil nil line)))
- + (if (string-match "<res\\(:\\([0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (format (concat "%" (or (match-string 2 line) "4") "d") res)
- + nil nil line)))
- + (if (string-match "<diff\\(:\\([0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (if (eq diff 'NIL)
- + ""
- + (format (if (match-string 1 line)
- + (concat "%" (match-string 2 line) "s") "/%5s")
- + (if diff (format "+%d" diff) "-")))
- + nil nil line)))
- + (if (string-match "<unread\\(:\\([0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (if (eq unread 'NIL)
- + ""
- + (if unread
- + (if (match-string 1 line)
- + (substring (format " Δ%d" unread)
- + (- (string-to-number (match-string 2 line))))
- + (concat "/" (substring (format " Δ%d" unread) -5)))
- + (format (concat "%" (or (match-string 2 line) "5") "s") "-")))
- + nil nil line)))
- + (if (string-match "<id\\(:\\([0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (if (match-string 1 line)
- + (format (concat "%" (match-string 2 line) "s") id)
- + id)
- + nil nil line)))
- + (if (string-match "<momentum_m\\(:\\([.0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (format (concat "%" (or (match-string 2 line) "4.1") "f")
- + (if (<= elapsed 0) 0 (/ res (/ elapsed 60.0))))
- + nil nil line)))
- + (if (string-match "<momentum_h\\(:\\([.0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (format (concat "%" (or (match-string 2 line) "6.1") "f")
- + (if (<= elapsed 0) 0 (min (/ res (/ elapsed 3600.0)) (* res 4.0))))
- + nil nil line)))
- + (if (string-match "<momentum_d\\(:\\([.0-9]+\\)\\)?>" line)
- + (setq line (replace-match
- + (format (concat "%" (or (match-string 2 line) "5.1") "f")
- + (if (<= elapsed 0) 0 (min (/ res (/ elapsed 86400.0)) res)))
- + nil nil line)))
- + (if (string-match "<subject>" line)
- + (setq line (replace-match
- + (concat subject
- + (make-string (max (- navi2ch-bm-subject-width
- + (string-width subject)) 1) ? ))
- + nil t line)))))
- + (if (stringp other) other)
- + "\n")))
- +;; navi2ch-articles.el, navi2ch-board.el, navi2ch-bookmark.el
- +;; navi2ch-directory.el, navi2ch-history.el, navi2ch-search.el
- (defun navi2ch-bm-insert-subject (item number subject other
- &optional updated)
- (let* ((article (navi2ch-bm-get-article-internal item))
- (board (navi2ch-bm-get-board-internal item))
- (point (point))
- (state (navi2ch-bm-get-state-from-article board article))
- + (info (if (hash-table-p other)
- + (copy-hash-table other)
- + (let ((hash (make-hash-table :test 'eq))
- + (res (assoc 'response article))
- + (id (assoc 'artid article))
- + (ct (current-time)))
- + (if (and (not res) (not id))
- + other
- + (setq subject (concat subject other))
- + (puthash 'res (cdr res) hash)
- + (when (setq id (cdr id))
- + (puthash 'artid id hash)
- + (puthash 'elapsed (- (+ (* (car ct) 65536) (nth 1 ct))
- + (string-to-number id)) hash))
- + hash))))
- (string (navi2ch-bm-format-subject
- number
- (gethash updated navi2ch-bm-updated-mark-table)
- (gethash state navi2ch-bm-state-char-table)
- (or subject navi2ch-bm-empty-subject)
- - other)))
- + info)))
- ;; for contrib/izonmoji-mode.el
- (navi2ch-ifxemacs
- (insert string)
- @@ -311,42 +440,51 @@
- (navi2ch-list)))))
- ;;; goto-*-column
- -(defsubst navi2ch-bm-goto-updated-mark-column ()
- - (beginning-of-line)
- - (when (looking-at " *[0-9]+ ")
- - (goto-char (match-end 0))))
- -
- -(defsubst navi2ch-bm-goto-state-column ()
- - (when (navi2ch-bm-goto-updated-mark-column)
- - (forward-char 1)))
- -
- -(defsubst navi2ch-bm-goto-mark-column ()
- - (when (navi2ch-bm-goto-updated-mark-column)
- - (forward-char 2)))
- -
- -(defun navi2ch-bm-goto-other-column ()
- - (let ((sbj (cdr
- - (assq 'subject
- - (navi2ch-bm-get-article-internal
- - (navi2ch-bm-get-property-internal (point)))))))
- - (navi2ch-bm-goto-mark-column)
- - (forward-char 1)
- - (unless sbj (setq sbj navi2ch-bm-empty-subject))
- - (when (and (not (string= sbj ""))
- - (search-forward sbj nil t))
- - (goto-char (match-end 0)))
- - (skip-chars-forward " ")))
- +;; バッファの文字列から直接探索するのやめて、内部変数もしくは text-property から
- +;; 取得するようにしたのでこれらをコメントアウト
- +;;
- +;; (defsubst navi2ch-bm-goto-updated-mark-column ()
- +;; (beginning-of-line)
- +;; (when (looking-at " *[0-9]+ ")
- +;; (goto-char (match-end 0))))
- +;;
- +;; (defsubst navi2ch-bm-goto-state-column ()
- +;; (when (navi2ch-bm-goto-updated-mark-column)
- +;; (forward-char 1)))
- +;;
- +;; (defsubst navi2ch-bm-goto-mark-column ()
- +;; (when (navi2ch-bm-goto-updated-mark-column)
- +;; (forward-char 2)))
- +;;
- +;; (defun navi2ch-bm-goto-other-column ()
- +;; (let ((sbj (cdr
- +;; (assq 'subject
- +;; (navi2ch-bm-get-article-internal
- +;; (navi2ch-bm-get-property-internal (point)))))))
- +;; (navi2ch-bm-goto-mark-column)
- +;; (forward-char 1)
- +;; (unless sbj (setq sbj navi2ch-bm-empty-subject))
- +;; (when (and (not (string= sbj ""))
- +;; (search-forward sbj nil t))
- +;; (goto-char (match-end 0)))
- +;; (skip-chars-forward " ")))
- (defun navi2ch-bm-insert-state (item state &optional updated)
- - ;; (setq article (navi2ch-put-alist 'cache 'view article))
- - (let ((buffer-read-only nil))
- + (let ((buffer-read-only nil)
- + (updated-pos (gethash 'updated-pos navi2ch-bm-subject-current-format-info))
- + (state-pos (gethash 'state-pos navi2ch-bm-subject-current-format-info)))
- (save-excursion
- - (navi2ch-bm-goto-state-column)
- - (backward-char 1)
- - (delete-char 2)
- - (insert (gethash updated navi2ch-bm-updated-mark-table)
- - (gethash state navi2ch-bm-state-char-table))
- + (when updated-pos
- + (beginning-of-line)
- + (forward-char updated-pos)
- + (delete-char 1)
- + (insert (gethash updated navi2ch-bm-updated-mark-table)))
- + (when state-pos
- + (beginning-of-line)
- + (forward-char state-pos)
- + (delete-char 1)
- + (insert (gethash state navi2ch-bm-state-char-table)))
- (navi2ch-bm-set-property (navi2ch-line-beginning-position)
- (navi2ch-line-end-position)
- item state updated))))
- @@ -569,24 +707,23 @@
- (defun navi2ch-bm-renumber ()
- (interactive)
- - (save-excursion
- - (goto-char (point-min))
- - (let ((buffer-read-only nil)
- - (i 1))
- - (while (not (eobp))
- - (let ((props (text-properties-at (point)))
- - (num-string (format
- - (concat "%" (number-to-string navi2ch-bm-number-width) "d")
- - i)))
- - (delete-region (point)
- - (save-excursion
- - (navi2ch-bm-goto-state-column)
- - (- (point) 2)))
- - (insert num-string)
- - (set-text-properties (- (point) (length num-string))
- - (point) props)
- - (forward-line 1)
- - (setq i (1+ i)))))))
- + (let ((number-pos (gethash 'number-pos navi2ch-bm-subject-current-format-info))
- + (number-format (concat "%" (number-to-string navi2ch-bm-number-width) "d")))
- + (if number-pos
- + (save-excursion
- + (goto-char (point-min))
- + (let ((buffer-read-only nil) (i 1))
- + (while (not (eobp))
- + (let ((props (text-properties-at (point)))
- + (number-string (format number-format i)))
- + (delete-region (+ (point) number-pos)
- + (save-excursion
- + (re-search-forward "[0-9]+" nil t 1)))
- + (insert number-string)
- + (set-text-properties (- (point) (length number-string))
- + (point) props)
- + (forward-line 1)
- + (setq i (1+ i)))))))))
- (defun navi2ch-bm-view-logo ()
- "その板のロゴを見る。"
- @@ -656,17 +793,19 @@
- ARG が non-nil なら移動方向を逆にする。"
- (let ((item (navi2ch-bm-get-property-internal (point)))
- (state (navi2ch-bm-get-state (point)))
- - (table (and mark navi2ch-bm-state-mark-face-table)))
- - (when item
- - (let ((buffer-read-only nil)
- - (pos (point)))
- - (navi2ch-bm-goto-mark-column)
- - (delete-char 1)
- - (insert (if mark ?* ? ))
- - (navi2ch-bm-set-property (navi2ch-line-beginning-position)
- - (navi2ch-line-end-position)
- - item state nil table)
- - (goto-char pos)))
- + (table (and mark navi2ch-bm-state-mark-face-table))
- + (mark-pos (gethash 'mark-pos navi2ch-bm-subject-current-format-info))
- + (buffer-read-only nil))
- + (save-excursion
- + (if mark-pos
- + (when item
- + (beginning-of-line)
- + (forward-char mark-pos)
- + (delete-char 1)
- + (insert (if mark ?* ? ))))
- + (navi2ch-bm-set-property (navi2ch-line-beginning-position)
- + (navi2ch-line-end-position)
- + item state nil table))
- (when (and navi2ch-bm-mark-and-move interactive)
- (let (downward)
- (cond ((eq navi2ch-bm-mark-and-move 'follow)
- @@ -690,17 +829,15 @@
- (save-excursion
- (goto-char (point-min))
- (while (not (eobp))
- - (navi2ch-bm-goto-mark-column)
- - (if (looking-at "\\*")
- - (progn
- - (condition-case nil
- - (save-excursion
- - (navi2ch-bm-unmark)
- - (apply func args))
- - (navi2ch-update-failed nil))
- - (sit-for 0)
- - (discard-input))
- - (forward-line)))))
- + (when (get-text-property (point) 'navi2ch-bm-mark)
- + (condition-case nil
- + (save-excursion
- + (navi2ch-bm-unmark)
- + (apply func args))
- + (navi2ch-update-failed nil))
- + (sit-for 0)
- + (discard-input))
- + (forward-line))))
- (defsubst navi2ch-bm-display-mark-article ()
- (interactive)
- @@ -754,7 +891,7 @@
- "更新されている可能性のあるスレを fetch する。"
- (interactive)
- (unless navi2ch-offline
- - (navi2ch-bm-mark-states "[^=]")
- + (navi2ch-bm-mark-states '(updated new updated nil)) ; 元の引数は[^=]
- (sit-for 0)
- (navi2ch-bookmark-fetch-mark-article)))
- @@ -764,18 +901,31 @@
- (defun navi2ch-bm-mark-marks (mark &optional arg)
- (interactive "cInput mark: \nP")
- - (navi2ch-bm-mark-states
- - (format ".%c" (upcase mark))
- - arg))
- -
- -(defun navi2ch-bm-mark-states (regexp &optional arg)
- - (save-excursion
- - (goto-char (point-min))
- - (while (not (eobp))
- - (navi2ch-bm-goto-updated-mark-column)
- - (when (looking-at regexp)
- - (navi2ch-bm-mark-subr (not arg)))
- - (forward-line))))
- + (let* ((m (upcase mark))
- + (target (cond
- + ((eq m ?%) '(updated new))
- + ((eq m ?+) '(updated updated))
- + ((eq m ?=) '(updated seen))
- + ((eq m ? ) '(updated))
- + ((eq m ?V) '(state view))
- + ((eq m ?C) '(state cache))
- + ((eq m ?U) '(state update))
- + ((eq m ?D) '(state down))
- + ((eq m ? ) '(state)))))
- + (if target (navi2ch-bm-mark-states target arg))))
- +
- +;; 指定した状態のスレ全てをマークする (引数を正規表現からリストに変更)
- +(defun navi2ch-bm-mark-states (target &optional arg)
- + (let ((bm-get (if (eq (car target) 'updated) 'navi2ch-bm-get-updated-mark
- + (if (eq (car target) 'state) 'navi2ch-bm-get-state)))
- + (target-states (cdr target)))
- + (if bm-get
- + (save-excursion
- + (goto-char (point-min))
- + (while (not (eobp))
- + (if (member (funcall bm-get) target-states)
- + (navi2ch-bm-mark-subr (not arg)))
- + (forward-line))))))
- ;; mark by regexp query
- (defun navi2ch-bm-mark-by-query (query &optional arg)
- @@ -795,29 +945,31 @@
- (defun navi2ch-bm-sort-by-number (&optional rev)
- (interactive "P")
- - (navi2ch-bm-sort-subr
- - rev
- - (lambda ()
- - (beginning-of-line)
- - (save-match-data
- - (if (looking-at "^ *\\([0-9]+\\)")
- - (string-to-number
- - (buffer-substring (match-beginning 1) (match-end 1)))
- - ;; not a number
- - -1)))
- - nil))
- + (let* ((i 0)
- + (table (mapcar (lambda (item)
- + (setq i (+ i 1)) (cons (cdr (assoc 'artid item)) i))
- + navi2ch-board-subject-list)))
- + (navi2ch-bm-sort-subr
- + rev
- + (lambda ()
- + (cdr (assoc (cdr (assq 'artid
- + (navi2ch-bm-get-article-internal
- + (navi2ch-bm-get-property-internal (point)))))
- + table)))
- + nil)))
- (defun navi2ch-bm-sort-by-state (&optional rev)
- (interactive "P")
- (navi2ch-bm-sort-subr
- rev
- (lambda ()
- - (navi2ch-bm-goto-state-column)
- - (backward-char)
- - (or (cdr (assoc (buffer-substring (point) (+ (point) 2))
- - navi2ch-bm-sort-by-state-order))
- - ;; 未知の状態。
- - 1000))
- + (let ((state (navi2ch-bm-get-state)))
- + (cond
- + ((eq state 'view) 1)
- + ((eq state 'cache) 2)
- + ((eq state 'update) 3)
- + ((eq state 'down) 4)
- + (t 1000))))
- nil))
- (defun navi2ch-bm-sort-by-subject (&optional rev)
- @@ -825,18 +977,36 @@
- (navi2ch-bm-sort-subr
- rev
- (lambda ()
- - (navi2ch-bm-goto-mark-column)
- - (forward-char 1))
- - 'navi2ch-bm-goto-other-column))
- + (cdr (assq 'subject
- + (navi2ch-bm-get-article-internal
- + (navi2ch-bm-get-property-internal (point))))))
- + nil))
- -(defun navi2ch-bm-sort-by-other (&optional rev)
- +(defun navi2ch-bm-sort-by-res (&optional rev)
- (interactive "P")
- (navi2ch-bm-sort-subr
- rev
- (lambda ()
- - (navi2ch-bm-goto-other-column)
- - nil) ; end-key-fun を呼ばせるには nil が欲しいらしい。はまった(泣)。
- - 'end-of-line))
- + (string-to-number
- + (cdr (assq 'response
- + (navi2ch-bm-get-article-internal
- + (navi2ch-bm-get-property-internal (point)))))))
- + nil))
- +
- +(defun navi2ch-bm-sort-by-other (&optional rev)
- + (interactive "P")
- + (let ((subject-pos (gethash 'subject-pos navi2ch-bm-subject-current-format-info))
- + len)
- + (navi2ch-bm-sort-subr
- + rev
- + (lambda ()
- + (setq len (length (cdr (assq 'subject
- + (navi2ch-bm-get-article-internal
- + (navi2ch-bm-get-property-internal (point)))))))
- + (forward-char (+ subject-pos len))
- + (re-search-forward " *")
- + nil) ; end-key-fun を呼ばせるには nil が欲しいらしい。はまった(泣)。
- + 'end-of-line)))
- (defun navi2ch-bm-sort-by-date (&optional rev)
- (interactive "P")
- @@ -851,17 +1021,19 @@
- (defun navi2ch-bm-sort (&optional arg)
- (interactive "P")
- - (let ((ch (navi2ch-read-char-with-retry
- - "Sort by n)umber s)tate t)itle o)ther d)ate? "
- - nil '(?n ?s ?t ?o ?d))))
- + (let* ((ch (navi2ch-read-char-with-retry
- + "Sort by n)umber s)tate t)itle r)es o)ther d)ate? (If input upper case, in reverse) "
- + nil '(?n ?s ?t ?r ?o ?d ?N ?S ?T ?R ?O ?D)))
- + (uch (upcase ch)))
- (message "Sorting...")
- (funcall
- - (cond ((eq ch ?n) 'navi2ch-bm-sort-by-number)
- - ((eq ch ?s) 'navi2ch-bm-sort-by-state)
- - ((eq ch ?t) 'navi2ch-bm-sort-by-subject)
- - ((eq ch ?o) 'navi2ch-bm-sort-by-other)
- - ((eq ch ?d) 'navi2ch-bm-sort-by-date))
- - arg)
- + (cond ((eq uch ?N) 'navi2ch-bm-sort-by-number)
- + ((eq uch ?S) 'navi2ch-bm-sort-by-state)
- + ((eq uch ?T) 'navi2ch-bm-sort-by-subject)
- + ((eq uch ?R) 'navi2ch-bm-sort-by-res)
- + ((eq uch ?O) 'navi2ch-bm-sort-by-other)
- + ((eq uch ?D) 'navi2ch-bm-sort-by-date))
- + (if (eq uch ch) (not arg) arg))
- (message "Sorting...done")))
- ;;; search
- --- navi2ch-bookmark.el 2012-03-31 22:16:19.000000000 +0900
- +++ navi2ch-bookmark.el 2012-05-13 19:31:10.674202203 +0900
- @@ -430,8 +430,7 @@
- (let ((board-data-cache (navi2ch-make-cache nil 'equal)))
- (goto-char (point-min))
- (while (not (eobp))
- - (navi2ch-bm-goto-mark-column)
- - (when (looking-at "\\*")
- + (when (get-text-property (point) 'navi2ch-bm-mark)
- (let* ((item (navi2ch-bm-get-property-internal (point)))
- (board (navi2ch-bm-get-board-internal item))
- (article (navi2ch-bm-get-article-internal item))
- --- navi2ch-vars.el 2012-03-31 22:16:19.000000000 +0900
- +++ navi2ch-vars.el 2012-05-15 06:04:08.081118868 +0900
- @@ -376,6 +376,68 @@
- :type 'boolean
- :group 'navi2ch-board)
- +(defcustom navi2ch-bm-subject-format
- + "<number> <updated><state><mark><subject> (<res><diff><unread>)"
- + "*スレッド一覧の書式を定義する。
- +
- +レス数を左に表示する例:
- +\(setq navi2ch-bm-subject-format
- + \"<number> <updated><state><mark><res><diff><unread> <subject>\")
- +
- +文字列で指定した場合の置き換え文字列一覧
- +<number> スレッド番号 (幅は navi2ch-bm-number-width で指定)
- +<updated> updated-mark (幅は1文字固定)
- +<state> state (幅は1文字固定)
- +<mark> マーク表示の文字位置 (幅は1文字固定)
- +<subject> スレタイ
- +<res> レス数
- +<diff> 増加数(navi2ch-board-insert-subject-with-diff が nil なら空文字になる)
- +<unread> 未読数(navi2ch-board-insert-subject-with-unread が nil なら空文字になる)
- +<id> スレッドID
- +<momentum_m> 1分あたりの勢い
- +<momentum_h> 1時間あたりの勢い
- +<momentum_d> 1日あたりの勢い
- +
- +res,diff,unread,id は列幅を '<NAME:X>' のように指定可能。 (printfの%d)
- +momentum_* は列幅を '<NAME:X.Y>' のように指定可能。(printfの%f)
- +例えば <momentum_h:6.2> とすると ' 10.22' のように展開される。
- +
- +板別の指定方法として書式をキー,板IDを値としたリストで指定することも可能。
- +その場合はデフォルト値として板IDが空のものを定義しておくこと。
- +例:
- +\(setq navi2ch-bm-subject-format
- + '((\"<number> <updated><state><mark><res> <momentum_h>/h <subject>\")
- + (\"<number> <updated><state><mark><res> <momentum_d>/d <subject>\" . (\"unix\" \"linux\"))))
- +
- +関数で指定することでより細かく制御することもできる。
- +その場合は引数として、上記の置き換え文字列に相当する値が順に渡される。
- +条件によって各値は nil もしくは \"\" となることもあるので注意。
- +また、navi2ch-bm-number-width も正しく設定すること。
- +例:
- +\(defun my-subject-format
- + (number updated state subject res diff unread id momentum_m momentum_h momentum_d mark)
- + (format \"%5d %c%c%c%4d\%4s\%4s %5.2f/d %s\"
- + number updated state (or mark ? ) res
- + (if (symbolp diff) (if diff \"\" \"-\") diff)
- + (if (symbolp unread) (if unread \"\" \"-\") unread)
- + (max 0 momentum_d) subject))
- +\(setq navi2ch-bm-number-width 5)
- +\(setq navi2ch-bm-subject-format
- + '((\"<number> <updated><state><mark><res> <momentum_h>/h <subject>\")
- + (my-subject-format . (\"unix\" \"linux\"))))
- +"
- + :type '(choice (string :tag "定義文字列")
- + (function :tag "定義関数")
- + (repeat :tag "適用条件"
- + (cons :tag "定義"
- + (choice :tag "文字列か関数か"
- + (string :tag "文字列")
- + (function :tag "関数"))
- + (choice :tag "適用する板"
- + (const :tag "デフォルト" nil)
- + (repeat :tag "板別" (string :tag "ID"))))))
- + :group 'navi2ch-board)
- +
- (defcustom navi2ch-bm-subject-width 50
- "*各スレの題名の幅。"
- :type 'integer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement