diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-23 15:13:36 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-23 15:14:09 -0200 |
commit | b4bd8dd1b1c94a880372872560f32839807c56a0 (patch) | |
tree | 1a0568231147ea9ae9150de0f3760b16774ee3ce | |
parent | fd0cc3edd58cc4fec045628ee2a73902571621cc (diff) |
Implement sx-tab-meta-or-main command
-rw-r--r-- | sx-tab.el | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |