aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-tab.el15
1 files changed, 15 insertions, 0 deletions
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