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(+) 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