From b4bd8dd1b1c94a880372872560f32839807c56a0 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 23 Dec 2014 15:13:36 -0200 Subject: Implement sx-tab-meta-or-main command --- sx-tab.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sx-tab.el') diff --git a/sx-tab.el b/sx-tab.el index 6c5e21e..d2e278f 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -189,5 +189,20 @@ If SITE is nil, use `sx-default-site'." (file-name-directory load-file-name))) nil t) + +;;; Inter-modes navigation +(defun sx-tab-meta-or-main () + "Switch to the meta version of a main site, or vice-versa. +Inside a question, go to the frontpage of the site this question +belongs to." + (interactive) + (if (and (derived-mode-p 'sx-question-list-mode) + sx-question-list--site) + (sx-question-list-switch-site + (if (string-match "\\`meta\\." sx-question-list--site) + (replace-match "" :fixedcase nil sx-question-list--site) + (concat "meta." sx-question-list--site))) + (sx-tab-frontpage nil (sx--site (sx--data-here 'question))))) + (provide 'sx-tab) ;;; sx-tab.el ends here -- cgit v1.2.3 From 635c863b0c0d19db45d44ce0f25f41f0be650c92 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 23 Dec 2014 23:33:37 -0200 Subject: 3 more tabs: unanswered, unanswered my tags, featured --- sx-tab.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'sx-tab.el') diff --git a/sx-tab.el b/sx-tab.el index d2e278f..4b9d50b 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -189,6 +189,48 @@ If SITE is nil, use `sx-default-site'." (file-name-directory load-file-name))) nil t) + +;;; Unanswered +(sx-tab--define "Unanswered" + (lambda (page) + (sx-question-get-questions + sx-question-list--site page nil 'unanswered))) +;;;###autoload +(autoload 'sx-tab-unanswered + (expand-file-name + "sx-tab" + (when load-file-name + (file-name-directory load-file-name))) + nil t) + + +;;; Unanswered My-tags +(sx-tab--define "Unanswered-my-tags" + (lambda (page) + (sx-question-get-questions + sx-question-list--site page nil 'unanswered/my-tags))) +;;;###autoload +(autoload 'sx-tab-unanswered + (expand-file-name + "sx-tab" + (when load-file-name + (file-name-directory load-file-name))) + nil t) + + +;;; Featured +(sx-tab--define "Featured" + (lambda (page) + (sx-question-get-questions + sx-question-list--site page nil 'featured))) +;;;###autoload +(autoload 'sx-tab-featured + (expand-file-name + "sx-tab" + (when load-file-name + (file-name-directory load-file-name))) + nil t) + ;;; Inter-modes navigation (defun sx-tab-meta-or-main () -- cgit v1.2.3