Mercurial > emacs
comparison lisp/net/newst-treeview.el @ 96153:04289a261fac
newsticker: window config fix, doc fixes
author | Ulf Jasper <ulf.jasper@web.de> |
---|---|
date | Sat, 21 Jun 2008 15:43:34 +0000 |
parents | 2dfe9a37940f |
children | 708c29dada1f |
comparison
equal
deleted
inserted
replaced
96152:a35eb0adf0b2 | 96153:04289a261fac |
---|---|
5 ;; Author: Ulf Jasper <ulf.jasper@web.de> | 5 ;; Author: Ulf Jasper <ulf.jasper@web.de> |
6 ;; Filename: newst-treeview.el | 6 ;; Filename: newst-treeview.el |
7 ;; URL: http://www.nongnu.org/newsticker | 7 ;; URL: http://www.nongnu.org/newsticker |
8 ;; Created: 2007 | 8 ;; Created: 2007 |
9 ;; Keywords: News, RSS, Atom | 9 ;; Keywords: News, RSS, Atom |
10 ;; Time-stamp: "20. Juni 2008, 18:13:52 (ulf)" | 10 ;; Time-stamp: "21. Juni 2008, 17:35:21 (ulf)" |
11 | 11 |
12 ;; ====================================================================== | 12 ;; ====================================================================== |
13 | 13 |
14 ;; This file is part of GNU Emacs. | 14 ;; This file is part of GNU Emacs. |
15 | 15 |
113 :group 'newsticker-treeview) | 113 :group 'newsticker-treeview) |
114 | 114 |
115 (defvar newsticker-groups | 115 (defvar newsticker-groups |
116 '("Feeds") | 116 '("Feeds") |
117 "List of feed groups, used in the treeview frontend. | 117 "List of feed groups, used in the treeview frontend. |
118 Each element must be a list consisting of strings. The first | 118 First element is a string giving the group name. Remaining |
119 element gives the title of the group, the following elements the | 119 elements are either strings giving a feed name or lists having |
120 names of feeds that belong to the group. | 120 the same structure as `newsticker-groups'. (newsticker-groups := |
121 FIXME") | 121 groupdefinition, groupdefinition := groupname groupcontent*, |
122 groupcontent := feedname | groupdefinition) | |
123 | |
124 Example: (\"Topmost group\" \"feed1\" (\"subgroup1\" \"feed 2\") | |
125 \"feed3\")") | |
122 | 126 |
123 (defcustom newsticker-groups-filename | 127 (defcustom newsticker-groups-filename |
124 "~/.newsticker-groups" | 128 "~/.newsticker-groups" |
125 "Name of the newsticker groups settings file." | 129 "Name of the newsticker groups settings file." |
126 :type 'string | 130 :type 'string |
133 (defvar newsticker--treeview-buffers nil) | 137 (defvar newsticker--treeview-buffers nil) |
134 (defvar newsticker--treeview-current-feed nil) | 138 (defvar newsticker--treeview-current-feed nil) |
135 (defvar newsticker--treeview-current-vfeed nil) | 139 (defvar newsticker--treeview-current-vfeed nil) |
136 (defvar newsticker--treeview-list-show-feed nil) | 140 (defvar newsticker--treeview-list-show-feed nil) |
137 (defvar newsticker--saved-window-config nil) | 141 (defvar newsticker--saved-window-config nil) |
138 (defvar newsticker--window-config nil) | |
139 ;; (makunbound 'newsticker--selection-overlay) ;; FIXME | |
140 (defvar newsticker--selection-overlay nil | 142 (defvar newsticker--selection-overlay nil |
141 "Highlight the selected tree node.") | 143 "Highlight the selected tree node.") |
142 ;;(makunbound 'newsticker--tree-selection-overlay) ;; FIXME | |
143 (defvar newsticker--tree-selection-overlay nil | 144 (defvar newsticker--tree-selection-overlay nil |
144 "Highlight the selected list item.") | 145 "Highlight the selected list item.") |
145 ;;(makunbound 'newsticker--frame);; FIXME | |
146 (defvar newsticker--frame nil "Special frame for newsticker windows.") | 146 (defvar newsticker--frame nil "Special frame for newsticker windows.") |
147 (defvar newsticker--treeview-list-sort-order 'sort-by-time) | 147 (defvar newsticker--treeview-list-sort-order 'sort-by-time) |
148 (defvar newsticker--treeview-current-node-id nil) | 148 (defvar newsticker--treeview-current-node-id nil) |
149 (defvar newsticker--treeview-current-tree nil) | 149 (defvar newsticker--treeview-current-tree nil) |
150 (defvar newsticker--treeview-feed-tree nil) | 150 (defvar newsticker--treeview-feed-tree nil) |
368 | 368 |
369 (defun newsticker--treeview-list-new-items (widget changed-widget | 369 (defun newsticker--treeview-list-new-items (widget changed-widget |
370 &optional event) | 370 &optional event) |
371 "Fill newsticker treeview list window with new items. | 371 "Fill newsticker treeview list window with new items. |
372 This is a callback function for the treeview nodes. | 372 This is a callback function for the treeview nodes. |
373 Argument WIDGET FIXME. | 373 Argument WIDGET is the calling treeview widget. |
374 Argument CHANGED-WIDGET FIXME. | 374 Argument CHANGED-WIDGET is the widget that actually has changed. |
375 Optional argument EVENT FIXME." | 375 Optional argument EVENT is the mouse event that triggered this action." |
376 (newsticker--treeview-list-items-with-age-callback widget changed-widget | 376 (newsticker--treeview-list-items-with-age-callback widget changed-widget |
377 'new) | 377 'new) |
378 (newsticker--treeview-item-show-text | 378 (newsticker--treeview-item-show-text |
379 "New items" | 379 "New items" |
380 "This is a virtual feed containing all new items")) | 380 "This is a virtual feed containing all new items")) |
381 | 381 |
382 (defun newsticker--treeview-list-immortal-items (widget changed-widget | 382 (defun newsticker--treeview-list-immortal-items (widget changed-widget |
383 &optional event) | 383 &optional event) |
384 "Fill newsticker treeview list window with immortal items. | 384 "Fill newsticker treeview list window with immortal items. |
385 This is a callback function for the treeview nodes. | 385 This is a callback function for the treeview nodes. |
386 Argument WIDGET FIXME. | 386 Argument WIDGET is the calling treeview widget. |
387 Argument CHANGED-WIDGET FIXME. | 387 Argument CHANGED-WIDGET is the widget that actually has changed. |
388 Optional argument EVENT FIXME." | 388 Optional argument EVENT is the mouse event that triggered this action." |
389 (newsticker--treeview-list-items-with-age-callback widget changed-widget | 389 (newsticker--treeview-list-items-with-age-callback widget changed-widget |
390 'immortal) | 390 'immortal) |
391 (newsticker--treeview-item-show-text | 391 (newsticker--treeview-item-show-text |
392 "Immortal items" | 392 "Immortal items" |
393 "This is a virtual feed containing all immortal items.")) | 393 "This is a virtual feed containing all immortal items.")) |
394 | 394 |
395 (defun newsticker--treeview-list-obsolete-items (widget changed-widget | 395 (defun newsticker--treeview-list-obsolete-items (widget changed-widget |
396 &optional event) | 396 &optional event) |
397 "Fill newsticker treeview list window with obsolete items. | 397 "Fill newsticker treeview list window with obsolete items. |
398 This is a callback function for the treeview nodes. | 398 This is a callback function for the treeview nodes. |
399 Argument WIDGET FIXME. | 399 Argument WIDGET is the calling treeview widget. |
400 Argument CHANGED-WIDGET FIXME. | 400 Argument CHANGED-WIDGET is the widget that actually has changed. |
401 Optional argument EVENT FIXME." | 401 Optional argument EVENT is the mouse event that triggered this action." |
402 (newsticker--treeview-list-items-with-age-callback widget changed-widget | 402 (newsticker--treeview-list-items-with-age-callback widget changed-widget |
403 'obsolete) | 403 'obsolete) |
404 (newsticker--treeview-item-show-text | 404 (newsticker--treeview-item-show-text |
405 "Obsolete items" | 405 "Obsolete items" |
406 "This is a virtual feed containing all obsolete items.")) | 406 "This is a virtual feed containing all obsolete items.")) |
407 | 407 |
408 (defun newsticker--treeview-list-all-items (widget changed-widget | 408 (defun newsticker--treeview-list-all-items (widget changed-widget |
409 &optional event) | 409 &optional event) |
410 "Fill newsticker treeview list window with all items. | 410 "Fill newsticker treeview list window with all items. |
411 This is a callback function for the treeview nodes. | 411 This is a callback function for the treeview nodes. |
412 Argument WIDGET FIXME. | 412 Argument WIDGET is the calling treeview widget. |
413 Argument CHANGED-WIDGET FIXME. | 413 Argument CHANGED-WIDGET is the widget that actually has changed. |
414 Optional argument EVENT FIXME." | 414 Optional argument EVENT is the mouse event that triggered this action." |
415 (newsticker--treeview-list-items-with-age-callback widget changed-widget | 415 (newsticker--treeview-list-items-with-age-callback widget changed-widget |
416 event 'new 'old | 416 event 'new 'old |
417 'obsolete 'immortal) | 417 'obsolete 'immortal) |
418 (newsticker--treeview-item-show-text | 418 (newsticker--treeview-item-show-text |
419 "All items" | 419 "All items" |
446 (newsticker--treeview-list-update nil)))) | 446 (newsticker--treeview-list-update nil)))) |
447 | 447 |
448 (defun newsticker--treeview-list-feed-items (widget changed-widget | 448 (defun newsticker--treeview-list-feed-items (widget changed-widget |
449 &optional event) | 449 &optional event) |
450 "Callback function for listing feed items. | 450 "Callback function for listing feed items. |
451 Argument WIDGET FIXME. | 451 Argument WIDGET is the calling treeview widget. |
452 Argument CHANGED-WIDGET FIXME. | 452 Argument CHANGED-WIDGET is the widget that actually has changed. |
453 Optional argument EVENT FIXME." | 453 Optional argument EVENT is the mouse event that triggered this action." |
454 (newsticker--treeview-list-clear) | 454 (newsticker--treeview-list-clear) |
455 (widget-put widget :nt-selected t) | 455 (widget-put widget :nt-selected t) |
456 (let ((feed-name (widget-get widget :nt-feed)) | 456 (let ((feed-name (widget-get widget :nt-feed)) |
457 (vfeed-name (widget-get widget :nt-vfeed))) | 457 (vfeed-name (widget-get widget :nt-vfeed))) |
458 (if feed-name | 458 (if feed-name |
601 (erase-buffer))) | 601 (erase-buffer))) |
602 (newsticker-treeview-list-mode) | 602 (newsticker-treeview-list-mode) |
603 (newsticker--treeview-list-update-faces) | 603 (newsticker--treeview-list-update-faces) |
604 (goto-char (point-min)))) | 604 (goto-char (point-min)))) |
605 | 605 |
606 ;;(makunbound 'newsticker-treeview-list-sort-button-map);; FIXME | |
607 (defvar newsticker-treeview-list-sort-button-map | 606 (defvar newsticker-treeview-list-sort-button-map |
608 (let ((map (make-sparse-keymap))) | 607 (let ((map (make-sparse-keymap))) |
609 (define-key map [header-line mouse-1] | 608 (define-key map [header-line mouse-1] |
610 'newsticker--treeview-list-sort-by-column) | 609 'newsticker--treeview-list-sort-by-column) |
611 (define-key map [header-line mouse-2] | 610 (define-key map [header-line mouse-2] |
612 'newsticker--treeview-list-sort-by-column) | 611 'newsticker--treeview-list-sort-by-column) |
613 map) | 612 map) |
614 "Local keymap for newsticker treeview list window sort buttons.") | 613 "Local keymap for newsticker treeview list window sort buttons.") |
615 | 614 |
616 (defun newsticker--treeview-list-sort-by-column (&optional e) | 615 (defun newsticker--treeview-list-sort-by-column (&optional event) |
617 "Sort the newsticker list window buffer by the column clicked on. | 616 "Sort the newsticker list window buffer by the column clicked on. |
618 Optional argument E FIXME." | 617 Optional argument EVENT is the mouse event that triggered this action." |
619 (interactive (list last-input-event)) | 618 (interactive (list last-input-event)) |
620 (if e (mouse-select-window e)) | 619 (if e (mouse-select-window e)) |
621 (let* ((pos (event-start e)) | 620 (let* ((pos (event-start e)) |
622 (obj (posn-object pos)) | 621 (obj (posn-object pos)) |
623 (sort-order (if obj | 622 (sort-order (if obj |
1202 (defun newsticker-treeview-quit () | 1201 (defun newsticker-treeview-quit () |
1203 "Quit newsticker treeview." | 1202 "Quit newsticker treeview." |
1204 (interactive) | 1203 (interactive) |
1205 (newsticker-treeview-save) | 1204 (newsticker-treeview-save) |
1206 (setq newsticker--sentinel-callback nil) | 1205 (setq newsticker--sentinel-callback nil) |
1207 (setq newsticker--window-config (current-window-configuration)) | |
1208 (bury-buffer "*Newsticker Tree*") | 1206 (bury-buffer "*Newsticker Tree*") |
1209 (bury-buffer "*Newsticker List*") | 1207 (bury-buffer "*Newsticker List*") |
1210 (bury-buffer "*Newsticker Item*") | 1208 (bury-buffer "*Newsticker Item*") |
1211 (set-window-configuration newsticker--saved-window-config) | 1209 (set-window-configuration newsticker--saved-window-config) |
1212 (when newsticker--frame | 1210 (when newsticker--frame |
1797 (newsticker--treeview-create-groups-menu | 1795 (newsticker--treeview-create-groups-menu |
1798 newsticker-groups | 1796 newsticker-groups |
1799 (newsticker--group-get-group feed-name)))) | 1797 (newsticker--group-get-group feed-name)))) |
1800 menu)) | 1798 menu)) |
1801 | 1799 |
1802 ;;(makunbound 'newsticker-treeview-list-menu) ;FIXME | |
1803 (defvar newsticker-treeview-list-menu | 1800 (defvar newsticker-treeview-list-menu |
1804 (let ((menu (make-sparse-keymap "Newsticker List"))) | 1801 (let ((menu (make-sparse-keymap "Newsticker List"))) |
1805 (define-key menu [newsticker-treeview-mark-list-items-old] | 1802 (define-key menu [newsticker-treeview-mark-list-items-old] |
1806 (list 'menu-item "Mark all items old" | 1803 (list 'menu-item "Mark all items old" |
1807 'newsticker-treeview-mark-list-items-old)) | 1804 'newsticker-treeview-mark-list-items-old)) |
1808 menu) | 1805 menu) |
1809 "Map for newsticker tree menu.") | 1806 "Map for newsticker tree menu.") |
1810 | 1807 |
1811 ;;(makunbound 'newsticker-treeview-mode-map) ;FIXME | |
1812 (defvar newsticker-treeview-mode-map | 1808 (defvar newsticker-treeview-mode-map |
1813 (let ((map (make-sparse-keymap 'newsticker-treeview-mode-map))) | 1809 (let ((map (make-sparse-keymap 'newsticker-treeview-mode-map))) |
1814 (define-key map " " 'newsticker-treeview-next-page) | 1810 (define-key map " " 'newsticker-treeview-next-page) |
1815 (define-key map "a" 'newsticker-add-url) | 1811 (define-key map "a" 'newsticker-add-url) |
1816 (define-key map "F" 'newsticker-treeview-prev-feed) | 1812 (define-key map "F" 'newsticker-treeview-prev-feed) |
1848 (set (make-local-variable 'tool-bar-map) | 1844 (set (make-local-variable 'tool-bar-map) |
1849 newsticker-treeview-tool-bar-map)) | 1845 newsticker-treeview-tool-bar-map)) |
1850 (setq buffer-read-only t | 1846 (setq buffer-read-only t |
1851 truncate-lines t)) | 1847 truncate-lines t)) |
1852 | 1848 |
1853 ;;(makunbound 'newsticker-treeview-list-mode-map);FIXME | |
1854 (define-derived-mode newsticker-treeview-list-mode newsticker-treeview-mode | 1849 (define-derived-mode newsticker-treeview-list-mode newsticker-treeview-mode |
1855 "Item List" | 1850 "Item List" |
1856 (let ((header (concat | 1851 (let ((header (concat |
1857 (propertize " " 'display '(space :align-to 0)) | 1852 (propertize " " 'display '(space :align-to 0)) |
1858 (newsticker-treeview-list-make-sort-button "*" 'sort-by-age) | 1853 (newsticker-treeview-list-make-sort-button "*" 'sort-by-age) |
1945 (setq newsticker--sentinel-callback 'newsticker-treeview-update) | 1940 (setq newsticker--sentinel-callback 'newsticker-treeview-update) |
1946 (newsticker--treeview-frame-init) | 1941 (newsticker--treeview-frame-init) |
1947 (newsticker--treeview-window-init) | 1942 (newsticker--treeview-window-init) |
1948 (newsticker--treeview-buffer-init) | 1943 (newsticker--treeview-buffer-init) |
1949 (newsticker--group-manage-orphan-feeds) | 1944 (newsticker--group-manage-orphan-feeds) |
1950 (if newsticker--window-config | |
1951 (set-window-configuration newsticker--window-config)) | |
1952 (newsticker--treeview-set-current-node newsticker--treeview-feed-tree) | 1945 (newsticker--treeview-set-current-node newsticker--treeview-feed-tree) |
1953 (newsticker-start t) ;; will start only if not running | 1946 (newsticker-start t) ;; will start only if not running |
1954 (newsticker-treeview-update) | 1947 (newsticker-treeview-update) |
1955 (newsticker--treeview-item-show-text | 1948 (newsticker--treeview-item-show-text |
1956 "Newsticker" | 1949 "Newsticker" |