Permalink
Browse files

add navi2ch-directory.el.

clean up split window.
ikki ni kaesugita kibun...
  • Loading branch information...
1 parent d0af0d9 commit 256da78b6b1e8b17174e1b13c5f5e52a26ed62eb taiki committed Jun 27, 2002
Showing with 337 additions and 209 deletions.
  1. +54 −0 ChangeLog
  2. +1 −1 Makefile.am
  3. +39 −73 navi2ch-article.el
  4. +19 −21 navi2ch-board-misc.el
  5. +10 −36 navi2ch-board.el
  6. +3 −11 navi2ch-bookmark.el
  7. +145 −0 navi2ch-directory.el
  8. +1 −29 navi2ch-list.el
  9. +8 −12 navi2ch-search.el
  10. +3 −0 navi2ch-util.el
  11. +1 −1 navi2ch-vars.el
  12. +53 −25 navi2ch.el
View
@@ -1,3 +1,57 @@
+2002-06-28 Taiki SUGAWARA <taiki.s@cityfujisawa.ne.jp>
+
+ * navi2ch-directory.el: $B?7%U%!%$%k!#%G%#%l%/%H%j$K$"$k%9%l$rA4$FI=(B
+ $B<($9$k%b!<%I!#(B
+
+ * navi2ch.el (toplevel): navi2ch-directory $B$r(B require $B$9$k$h$&$K!#(B
+ (navi2ch-split-window): $B?74X?t!#(B
+ (navi2ch-goto-url): navi2ch-split-window $B$r;H$&$h$&$K!#(B
+ (navi2ch-find-file): navi2ch-article-find-file $B$+$i%j%M!<%`!#%G%#(B
+ $B%l%/%H%j$r;XDj$7$?>l9g$O(B navi2ch-directory $B$r8F$V$h$&$K!#(B
+ navi2ch-split-window $B$r;H$&$h$&$K!#(B
+
+ * navi2ch-vars.el (navi2ch-global-map): C-cC-f $B$r(B
+ navi2ch-find-file $B$KJQ99!#(B
+
+ * navi2ch-util.el (navi2ch-filename-to-url): $B?74X?t!#(B
+
+ * navi2ch-search.el (navi2ch-search-article-regexp):
+ navi2ch-article-get-first-message $B$r;H$&$h$&$K!#(B
+
+ * navi2ch-list.el (navi2ch-list-select-board):
+ navi2ch-split-window $B$r;H$&$h$&$K!#(B
+ (navi2ch-list-two-pane): $B:o=|!#(B
+
+ * navi2ch-bookmark.el (navi2ch-bookmark-fetch-article):
+ navi2ch-article-get-first-message $B$r;H$&$h$&$K!#(B
+
+ * navi2ch-board.el (navi2ch-board-get-file-name): file:// $B$G$O$8$^$C(B
+ $B$F$$$?$i!"$=$N%U%!%$%kL>$rJV$9$h$&$K!#(B
+ (navi2ch-board-two-pane) $B:o=|!#(B
+
+ * navi2ch-board-misc.el (navi2ch-bm-insert-subject): $B%U%!%$%k$+$i(B
+ $B<hF@$N>l9g$K!"%U%!%$%kL>(B
+ $B$r(B item $B$G$O$J$/(B navi2ch-article-get-file-name() $B$GF@$k$h$&$K!#(B
+ (navi2ch-bm-select-article): navi2ch-split-window $B$r;H$&$h$&$K!#(B
+ $B%U%!%$%k$+$i<hF@$N>l9g$K(B navi2ch-article-view-article-from-file $B$r(B
+ $B;H$&$h$&$K!#(B
+
+ * navi2ch-article.el (navi2ch-article-get-url): $B0z?t$K(B no-kako $B$r(B
+ $B<h$k$h$&$K!#(B
+ (navi2ch-article-get-buffer-name): url $B$r(B buffer $BL>$K$9$k$h$&$K!#(B
+ (navi2ch-article-get-first-message): $B?74X?t!#(Bcurrent-buffer $B$N(B
+ article $B$N:G=i$N(B message $B$rJV$9!#(B
+ (navi2ch-article-get-first-message-from-file): $B?74X?t!#(BFILE $B$G;XDj(B
+ $B$5$l$?(B article $B$N:G=i$N(B message $B$rJV$9!#(B
+ (navi2ch-article-view-article-from-file): $B@8@.$9$k(B board, article
+ $B$N$rIaDL$N$b$N$HF1$8$h$&$J46$8$KJQ99!#(Bsync $B$7$?7k2L$,JV$jCM$K$J$k(B
+ $B$h$&$K!#(B
+ (navi2ch-article-sync-from-file): navi2ch-article-message-list $B$O(B
+ $B$3$3$G:n$k$h$&$K$9$k!#@hF,$K0\F0$9$k$h$&$K!#(B
+ (navi2ch-article-find-file): navi2ch-find-file $B$K%j%M!<%`!#(B
+ navi2ch.el $B$K0\F0!#(B
+ (navi2ch-article-two-pane): $B:o=|(B
+
2002-06-27 Nanashi San <nanashi@users.sourceforge.net>
* navi2ch-bookmark.el (navi2ch-bookmark-get-buffer): $B?74X?t!#(B
View
@@ -6,7 +6,7 @@ lisp_LISP = navi2ch-version.el \
navi2ch-history.el navi2ch-search.el navi2ch-message.el \
navi2ch.el \
navi2ch-head.el navi2ch-mona.el navi2ch-e21.el \
- navi2ch-splash.el
+ navi2ch-splash.el navi2ch-directory
EXTRA_DIST = Makefile.old bcomp.el $(lisp_LISP) \
bcomp.el.in navi2ch-version.el.in
View
@@ -75,7 +75,6 @@
(define-key map "a" 'navi2ch-article-add-important-message)
(define-key map "h" 'navi2ch-article-toggle-hide)
(define-key map "$" 'navi2ch-article-toggle-important)
- ;; (define-key map "2" 'navi2ch-article-two-pane)
(define-key map "A" 'navi2ch-article-add-global-bookmark)
(define-key map "\C-c\C-m" 'navi2ch-message-pop-message-buffer)
(setq navi2ch-article-mode-map map)))
@@ -155,10 +154,11 @@ last $B$,:G8e$+$i$$$/$DI=<($9$k$+!#(B
(navi2ch-article-expunge-buffers 0)))
;;; navi2ch-article functions
-(defun navi2ch-article-get-url (board article)
+(defun navi2ch-article-get-url (board article &optional no-kako)
(let ((artid (cdr (assq 'artid article)))
(url (navi2ch-board-get-uri board)))
- (if (cdr (assq 'kako article))
+ (if (and (not no-kako)
+ (cdr (assq 'kako article)))
(navi2ch-article-get-kako-url board article)
(concat url "dat/" artid ".dat"))))
@@ -188,9 +188,7 @@ LEN $B$O(B RANGE $B$GHO0O$r;XDj$5$l$k(B list $B$ND9$5(B"
(defsubst navi2ch-article-get-buffer-name (board article)
(concat navi2ch-article-buffer-name-prefix
- (cdr (assq 'id board))
- "/"
- (cdr (assq 'artid article))))
+ (navi2ch-article-get-url board article 'no-kako)))
(defsubst navi2ch-article-check-cached (board article)
"BOARD $B$H(B ARTICLE $B$G;XDj$5$l$k%9%l%C%I$,%-%c%C%7%e$5$l$F$k$+!#(B"
@@ -313,6 +311,21 @@ START, END, NOFIRST $B$GHO0O$r;XDj$9$k(B"
" *<> *"
" *, *")))
+(defsubst navi2ch-article-get-first-message ()
+ "current-buffer $B$N(B article $B$N:G=i$N(B message $B$rJV$9!#(B"
+ (goto-char (point-min))
+ (navi2ch-article-parse-message
+ (buffer-substring-no-properties (point)
+ (progn (forward-line 1)
+ (1- (point))))
+ (navi2ch-article-get-separator)))
+
+(defsubst navi2ch-article-get-first-message-from-file (file)
+ "FILE $B$G;XDj$5$l$?(B article $B$N:G=i$N(B message $B$rJV$9!#(B"
+ (with-temp-buffer
+ (navi2ch-insert-file-contents file)
+ (navi2ch-article-get-first-message)))
+
(defun navi2ch-article-apply-filters (board)
(dolist (filter navi2ch-article-filter-list)
(if (stringp (car-safe filter))
@@ -531,14 +544,18 @@ DONT-DISPLAY $B$,(B non-nil $B$N$H$-$O%9%l%P%C%U%!$rI=<($;$:$K<B9T!#(B"
(defun navi2ch-article-view-article-from-file (file)
"FILE $B$+$i%9%l$r8+$k!#(B"
+ (setq file (expand-file-name file))
(let* ((board (list (cons 'id "navi2ch")
- (cons 'name navi2ch-bm-board-name-from-file)))
- (article (list (cons 'artid file)))
+ (cons 'uri (navi2ch-filename-to-url
+ (file-name-directory file)))
+ (cons 'name navi2ch-bm-board-name-from-file)))
+ (article (list (cons 'artid (file-name-sans-extension
+ (file-name-nondirectory file)))))
(buf-name (navi2ch-article-get-buffer-name board article)))
(if (get-buffer buf-name)
(progn
(switch-to-buffer buf-name)
- (navi2ch-article-sync))
+ nil)
(if (and navi2ch-article-auto-expunge
(> navi2ch-article-max-buffers 0))
(navi2ch-article-expunge-buffers (1- navi2ch-article-max-buffers)))
@@ -549,11 +566,10 @@ DONT-DISPLAY $B$,(B non-nil $B$N$H$-$O%9%l%P%C%U%!$rI=<($;$:$K<B9T!#(B"
(when navi2ch-article-auto-range
(setq navi2ch-article-view-range
navi2ch-article-new-message-range))
- (save-excursion
- (setq navi2ch-article-message-list
- (navi2ch-article-sync-from-file file))
- (navi2ch-article-set-mode-line))
- (navi2ch-article-mode))))
+ (prog1
+ (navi2ch-article-sync-from-file file)
+ (navi2ch-article-set-mode-line)
+ (navi2ch-article-mode)))))
(defun navi2ch-article-setup-menu ()
(easy-menu-define navi2ch-article-mode-menu
@@ -761,13 +777,16 @@ state $B$O$"$\!<$s$5$l$F$l$P(B aborn $B$H$$$&%7%s%\%k!#(B
(defun navi2ch-article-sync-from-file (file)
"$B%9%l$r(B FILE $B$+$i99?7$9$k!#(B"
- (when navi2ch-article-from-file-p
+ (when (and navi2ch-article-from-file-p
+ (file-exists-p file))
(let ((list (navi2ch-article-get-message-list file))
- (range navi2ch-article-view-range))
- (let ((buffer-read-only nil))
- (erase-buffer)
- (navi2ch-article-insert-messages list range))
- list)))
+ (range navi2ch-article-view-range)
+ (buffer-read-only nil))
+ (erase-buffer)
+ (navi2ch-article-insert-messages list range)
+ (prog1
+ (setq navi2ch-article-message-list list)
+ (navi2ch-article-goto-number 1)))))
(defun navi2ch-article-set-mode-line ()
(let ((article navi2ch-article-current-article)
@@ -838,29 +857,6 @@ state $B$O$"$\!<$s$5$l$F$l$P(B aborn $B$H$$$&%7%s%\%k!#(B
(navi2ch-article-select-view-range-subr))
(navi2ch-article-redraw))
-(defun navi2ch-article-find-file (file)
- "FILE $B$+$i%9%l$rA*$V(B"
- (interactive "fArtilce File: ")
- (let ((list-win (get-buffer-window navi2ch-list-buffer-name))
- (board-win (get-buffer-window navi2ch-board-buffer-name))
- (art-win (and (navi2ch-article-current-buffer)
- (get-buffer-window (navi2ch-article-current-buffer)))))
- (cond (art-win (select-window art-win))
- (board-win
- (select-window board-win)
- (when navi2ch-bm-stay-board-window
- (condition-case nil
- (enlarge-window (frame-height))
- (error nil))
- (split-window-vertically navi2ch-board-window-height)
- (other-window 1)))
- (list-win
- (select-window list-win)
- (when navi2ch-list-stay-list-window
- (split-window-horizontally navi2ch-list-window-width)
- (other-window 1))))
- (navi2ch-article-view-article-from-file file)))
-
(defun navi2ch-article-save-number ()
(unless (or navi2ch-article-hide-mode
navi2ch-article-important-mode)
@@ -1226,35 +1222,6 @@ NUM $B$,(B 1 $B$N$H$-$O<!!"(B-1 $B$N$H$-$OA0$N%9%l$K0\F0!#(B
(interactive)
(navi2ch-article-through-subr (interactive-p) -1))
-(defun navi2ch-article-two-pane ()
- (interactive)
- (let* ((list-buf (get-buffer navi2ch-list-buffer-name))
- (board-buf (get-buffer navi2ch-board-buffer-name))
- (art-buf (navi2ch-article-current-buffer))
- (list-win (get-buffer-window (or list-buf "")))
- (board-win (get-buffer-window (or board-buf "")))
- buf)
- (when art-buf
- (delete-other-windows)
- (switch-to-buffer art-buf)
- (setq buf
- (cond ((and list-buf board-buf)
- (cond ((and list-win board-win) board-buf)
- (list-win board-buf)
- (board-win list-buf)
- (t board-buf)))
- (list-buf list-buf)
- (board-buf board-buf)))
- (when buf
- (if (eq buf list-buf)
- (split-window-horizontally navi2ch-list-window-width)
- (condition-case nil
- (enlarge-window (frame-height))
- (error nil))
- (split-window-vertically navi2ch-board-window-height))
- (switch-to-buffer buf))
- (other-window 1))))
-
(defun navi2ch-article-get-message (num)
"NUM $BHVL\$N%l%9$rF@$k(B"
(cdr (assq num navi2ch-article-message-list)))
@@ -1684,7 +1651,6 @@ gunzip $B$KDL$7$F$+$iJ8;z%3!<%I$N?dB,$r;n$_$k!#(B"
(point-max))))))
(message msg))
-
;;; hide mode
(navi2ch-set-minor-mode 'navi2ch-article-hide-mode
" Hide"
View
@@ -192,9 +192,12 @@
(state (cond ((string= (cdr (assq 'name board))
navi2ch-bm-board-name-from-file)
; navi2ch-article-check-cached $B$G=hM}$9$Y$-$+!#(B
- (cond ((get-buffer (navi2ch-article-get-buffer-name board article))
+ (cond ((get-buffer (navi2ch-article-get-buffer-name
+ board article))
'view)
- ((and item (file-exists-p item))
+ ((file-exists-p
+ (navi2ch-article-get-file-name
+ board article))
'cache)
(t
nil)))
@@ -263,25 +266,20 @@
(board (navi2ch-bm-get-board-internal item))
(buf (current-buffer)))
(if article
- (if (string= (cdr (assq 'name board))
- navi2ch-bm-board-name-from-file)
- (navi2ch-article-find-file item)
- (dolist (x (navi2ch-article-buffer-list))
- (when x
- (delete-windows-on x)))
- (when navi2ch-bm-stay-board-window
- (condition-case nil
- (enlarge-window (frame-height))
- (error nil))
- (split-window-vertically navi2ch-board-window-height)
- (other-window 1))
- (let (state)
- (setq state (navi2ch-article-view-article
- board article nil nil max-line))
- (save-excursion
- (set-buffer buf)
- (let ((buffer-read-only nil))
- (when (or state
+ (progn
+ (navi2ch-split-window 'article)
+ (let (state)
+ (setq state
+ (if (string= (cdr (assq 'name board))
+ navi2ch-bm-board-name-from-file)
+ (navi2ch-article-view-article-from-file
+ (navi2ch-article-get-file-name board article))
+ (navi2ch-article-view-article
+ board article nil nil max-line)))
+ (save-excursion
+ (set-buffer buf)
+ (let ((buffer-read-only nil))
+ (when (or state
(navi2ch-bm-fetched-article-p board article)
(eq (navi2ch-bm-get-state) 'view))
(navi2ch-bm-remove-fetched-article board article)
View
@@ -40,7 +40,6 @@
(define-key map "+" 'navi2ch-board-toggle-updated)
(define-key map "b" 'navi2ch-board-toggle-bookmark)
(define-key map "w" 'navi2ch-board-write-message)
- ;; (define-key map "2" 'navi2ch-board-two-pane)
(define-key map "\M-e" 'navi2ch-board-expire)
(define-key map "md" 'navi2ch-board-hide-mark-article)
(setq navi2ch-board-mode-map map)))
@@ -169,10 +168,16 @@
(defun navi2ch-board-get-file-name (board &optional file-name)
(let ((uri (navi2ch-board-get-uri board)))
- (when (and uri (string-match "http://\\(.+\\)" uri))
- (setq uri (match-string 1 uri))
- (navi2ch-expand-file-name
- (concat uri (or file-name navi2ch-board-subject-file-name))))))
+ (when uri
+ (cond ((string-match "http://\\(.+\\)" uri)
+ (navi2ch-expand-file-name
+ (concat (match-string 1 uri)
+ (or file-name navi2ch-board-subject-file-name))))
+ ((string-match "file://\\(.+\\)" uri)
+ (expand-file-name (or file-name
+ navi2ch-board-subject-file-name)
+ (match-string 1 uri)))))))
+
(defsubst navi2ch-board-get-matched-article ()
"match $B$7$?7k2L$+$i(B article $B$rF@$k(B"
@@ -436,37 +441,6 @@
(interactive)
(navi2ch-message-write-message navi2ch-board-current-board nil t))
-(defun navi2ch-board-two-pane ()
- (interactive)
- (let* ((list-buf (get-buffer navi2ch-list-buffer-name))
- (board-buf (get-buffer navi2ch-board-buffer-name))
- (art-buf (navi2ch-article-current-buffer))
- (list-win (get-buffer-window (or list-buf "")))
- (art-win (get-buffer-window (or art-buf "")))
- buf)
- (when board-buf
- (delete-other-windows)
- (switch-to-buffer board-buf)
- (setq buf
- (cond ((and list-buf art-buf)
- (cond ((and list-win art-win) art-buf)
- (list-win art-buf)
- (art-win list-buf)
- (t art-buf)))
- (list-buf list-buf)
- (art-buf art-buf)))
- (when buf
- (if (eq buf list-buf)
- (split-window-horizontally navi2ch-list-window-width)
- (condition-case nil
- (enlarge-window (frame-height))
- (error nil))
- (split-window-vertically navi2ch-board-window-height)
- (other-window 1))
- (switch-to-buffer buf))
- (other-window 1))))
-
-
(defun navi2ch-board-save-info (&optional board)
(or board (setq board navi2ch-board-current-board))
(when board
Oops, something went wrong.

0 comments on commit 256da78

Please sign in to comment.