From db477cd54fa51f7604a8cba815848c7ea1b7ba37 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 10:01:03 -0200 Subject: sx-question-list-order-by bound to O --- sx-question-list.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sx-question-list.el b/sx-question-list.el index 7757503..1240c0f 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -367,6 +367,9 @@ into consideration. The same holds for `sx-question-list--order'. ([?\r] sx-display) )) +(sx--define-conditional-key sx-question-list-mode-map "O" #'sx-question-list-order-by + (and (boundp 'sx-question-list--order) sx-question-list--order)) + (defun sx-question-list-hide (data) "Hide question under point. Non-interactively, DATA is a question alist." -- cgit v1.2.3 From 0ddc0693f364ed547291bda199728a2dc8495c5f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 10:07:18 -0200 Subject: Make sx-search-default-order a defcustom --- sx-search.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sx-search.el b/sx-search.el index 55964b9..235d5f7 100644 --- a/sx-search.el +++ b/sx-search.el @@ -68,9 +68,14 @@ KEYWORDS is passed to `sx-method-call'." (default-value 'sx-question-list--order-methods))) "Alist of possible values to be passed to the `sort' keyword.") -(defvar sx-search-default-order 'activity +(defcustom sx-search-default-order 'activity "Default ordering method used on new searches. -Possible values are the cdrs of `sx-search--order-methods'.") +Possible values are the cdrs of `sx-search--order-methods'." + :type (cons 'choice + (mapcar (lambda (c) `(const :tag ,(car c) ,(cdr c))) + (cl-remove-duplicates + sx-search--order-methods + :key #'cdr)))) ;;;###autoload -- cgit v1.2.3 From 67af840cb9a9eb18d5d7ddb16f75676ed47852fd Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 10:13:24 -0200 Subject: Define sx-question-list--descending for inverting the order --- sx-question-list.el | 20 ++++++++++++++++---- sx-search.el | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sx-question-list.el b/sx-question-list.el index 1240c0f..77281d7 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -446,7 +446,14 @@ Non-interactively, DATA is a question alist." (make-variable-buffer-local 'sx-question-list--site) (defvar sx-question-list--order nil - "Order being displayed in the *question-list* buffer.") + "Order being displayed in the *question-list* buffer. +This is also affected by `sx-question-list--descending'.") +(make-variable-buffer-local 'sx-question-list--order) + +(defvar sx-question-list--descending t + "In which direction should `sx-question-list--order' be sorted. +If non-nil (default), descending. +If nil, ascending.") (make-variable-buffer-local 'sx-question-list--order) (defun sx-question-list-refresh (&optional redisplay no-update) @@ -621,17 +628,22 @@ Sets `sx-question-list--site' and then call (setq sx-question-list--site site) (sx-question-list-refresh 'redisplay))) -(defun sx-question-list-order-by (sort) +(defun sx-question-list-order-by (sort &optional ascend) "Order questions in the current list by the method SORT. Sets `sx-question-list--order' and then calls -`sx-question-list-refresh' with `redisplay'." +`sx-question-list-refresh' with `redisplay'. + +With a prefix argument or a non-nil ASCEND, invert the sorting +order." (interactive (list (when sx-question-list--order - (sx-question-list--interactive-order-prompt)))) + (sx-question-list--interactive-order-prompt)) + current-prefix-arg)) (unless sx-question-list--order (sx-user-error "This list can't be reordered")) (when (and sort (symbolp sort)) (setq sx-question-list--order sort) + (setq sx-question-list--descending (not ascend)) (sx-question-list-refresh 'redisplay))) (provide 'sx-question-list) diff --git a/sx-search.el b/sx-search.el index 235d5f7..e6746a3 100644 --- a/sx-search.el +++ b/sx-search.el @@ -115,6 +115,7 @@ prefix argument, the user is asked for everything." (sx-search-get-questions sx-question-list--site page query tags excluded-tags + (cons 'order (if sx-question-list--descending 'desc 'asc)) (cons 'sort sx-question-list--order)))) (setq sx-question-list--site site) (setq sx-question-list--order sx-search-default-order) -- cgit v1.2.3 From 590b4c52574c7fcdeaf21b44ecea9cbb861ccfca Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 10:30:45 -0200 Subject: Imrpove sx-question-list--order-methods --- sx-question-list.el | 5 ++--- sx-search.el | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sx-question-list.el b/sx-question-list.el index 77281d7..c66c04b 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -230,12 +230,11 @@ This is ignored if `sx-question-list--refresh-function' is set.") ": Quit") "Header-line used on the question list.") -(defconst sx-question-list--order-methods +(defvar sx-question-list--order-methods '(("Recent Activity" . activity) ("Creation Date" . creation) ("Most Voted" . votes) - ("Score" . votes) - ("Hot" . hot)) + ("Score" . votes)) "Alist of possible values to be passed to the `sort' keyword.") (make-variable-buffer-local 'sx-question-list--order-methods) diff --git a/sx-search.el b/sx-search.el index e6746a3..febeeef 100644 --- a/sx-search.el +++ b/sx-search.el @@ -64,8 +64,7 @@ KEYWORDS is passed to `sx-method-call'." (defconst sx-search--order-methods (cons '("Relevance" . relevance) - (cl-remove-if (lambda (x) (eq (cdr x) 'hot)) - (default-value 'sx-question-list--order-methods))) + (default-value 'sx-question-list--order-methods)) "Alist of possible values to be passed to the `sort' keyword.") (defcustom sx-search-default-order 'activity -- cgit v1.2.3 From 7af796271661571791cb338c64769a3dd1f416e5 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 13:40:58 -0200 Subject: Define ordering variables for tabs --- sx-tab.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sx-tab.el b/sx-tab.el index 2d605a5..8cdcc94 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -53,6 +53,30 @@ t))) (funcall (intern (format "sx-tab-%s" (downcase tab))))) +(defconst sx-tab--order-methods + `(,@(default-value 'sx-question-list--order-methods) + ("Hottest Now" . hot) + ("Weekly Hottest" . week) + ("Monthly Hottest" . month)) + "Alist of possible values to be passed to the `sort' keyword.") + +(defcustom sx-tab-default-order 'activity + "Default ordering method used on `sx-tab-questions' and the likes. +Possible values are the cdrs of `sx-tab--order-methods'." + :type (cons 'choice + (mapcar (lambda (c) `(const :tag ,(car c) ,(cdr c))) + (cl-remove-duplicates + sx-tab--order-methods + :key #'cdr)))) + +(defconst sx-tab--docstring-format + "Display a list of %s questions for SITE. +The variable `sx-tab-default-order' can be used to customize the +sorting of the resulting list. + +NO-UPDATE (the prefix arg) is passed to `sx-question-list-refresh'. +If SITE is nil, use `sx-default-site'.") + ;;; The main macro (defmacro sx-tab--define (tab pager &optional printer refresher -- cgit v1.2.3 From b61a296ed58c0cb2fda1dd610ae739c82d872ed8 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 10:52:26 -0200 Subject: Define sx-question-list--make-pager helper function --- sx-question-list.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sx-question-list.el b/sx-question-list.el index c66c04b..5812ff2 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -247,6 +247,20 @@ is used." (mapcar #'car sx-question-list--order-methods)))) (cdr-safe (assoc-string order sx-question-list--order-methods)))) +(defun sx-question-list--make-pager (method &optional submethod) + "Return a function suitable for use as a question list pager. +Meant to be used as `sx-question-list--next-page-function'." + (lambda (page) + (sx-method-call method + :keywords `((page . ,page) + ,@(when sx-question-list--order + `((order . ,(if sx-question-list--descending 'desc 'asc)) + (sort . ,sx-question-list--order)))) + :site sx-question-list--site + :auth t + :submethod submethod + :filter sx-browse-filter))) + ;;; Mode Definition (define-derived-mode sx-question-list-mode -- cgit v1.2.3 From f413f02c27f464b37f18ffbd6ea416c76f6ed138 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 13:40:32 -0200 Subject: sx-tab--define takes an OBSOLETE argument --- sx-tab.el | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index 8cdcc94..8f67253 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -79,7 +79,7 @@ If SITE is nil, use `sx-default-site'.") ;;; The main macro -(defmacro sx-tab--define (tab pager &optional printer refresher +(defmacro sx-tab--define (tab pager &optional printer refresher obsolete &rest body) "Define a StackExchange tab called TAB. TAB is a capitalized string. @@ -94,23 +94,26 @@ respectively used to set the value of the variables `sx-question-list--next-page-function'. BODY is evaluated after activating the mode and setting these -variables, but before refreshing the display." +variables, but before refreshing the display. + +If OBSOLETE is non-nil, it should be a string indicating the tab +to use instead." (declare (indent 1) (debug t)) (let* ((name (downcase tab)) (buffer-variable - (intern (concat "sx-tab--" name "-buffer")))) + (intern (format "sx-tab--%s-buffer" + (if obsolete (downcase obsolete) + name)))) + (function-name + (intern (concat "sx-tab-" name))) + (use-instead + (when obsolete (intern (concat "sx-tab-" (downcase obsolete)))))) `(progn - (defvar ,buffer-variable nil - ,(format "Buffer where the %s questions are displayed." - tab)) - (defun - ,(intern (concat "sx-tab-" name)) - (&optional no-update site) - ,(format "Display a list of %s questions for SITE. - -NO-UPDATE (the prefix arg) is passed to `sx-question-list-refresh'. -If SITE is nil, use `sx-default-site'." - tab) + ,(unless obsolete + `(defvar ,buffer-variable nil + ,(format "Buffer where the %s questions are displayed." tab))) + (defun ,function-name (&optional no-update site) + ,(format sx-tab--docstring-format tab) (interactive (list current-prefix-arg (sx--interactive-site-prompt))) @@ -119,24 +122,26 @@ If SITE is nil, use `sx-default-site'." ;; Create the buffer (unless (buffer-live-p ,buffer-variable) (setq ,buffer-variable - (generate-new-buffer "*question-list*"))) + (generate-new-buffer + ,(format "*question-list: %s *" (or obsolete tab))))) ;; Fill the buffer with content. (with-current-buffer ,buffer-variable (sx-question-list-mode) - ,(when printer - `(setq sx-question-list--print-function ,printer)) - ,(when refresher - `(setq sx-question-list--refresh-function ,refresher)) - ,(when pager - `(setq sx-question-list--next-page-function ,pager)) + (when ,printer (setq sx-question-list--print-function ,printer)) + (when ,refresher (setq sx-question-list--refresh-function ,refresher)) + (setq sx-question-list--next-page-function ,pager) (setq sx-question-list--site site) - (setq sx-question-list--current-tab ,tab) + (setq sx-question-list--order 'activity) + (setq sx-question-list--current-tab ,(or obsolete tab)) ,@body (sx-question-list-refresh 'redisplay no-update)) (switch-to-buffer ,buffer-variable)) + ,(when obsolete + `(make-obsolete ',function-name ',use-instead nil)) ;; Add this tab to the list of existing tabs. So we can prompt ;; the user with completion and stuff. - (add-to-list 'sx-tab--list ,tab)))) + (unless ,obsolete + (add-to-list 'sx-tab--list ,tab))))) ;;; FrontPage -- cgit v1.2.3 From a7c70149cfbfc24791d7966b0bef8a3a691e45f4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 13:42:38 -0200 Subject: Define tabs with sx-question-list--make-pager and obsolete some old ones --- sx-tab.el | 212 +++++++++++++++++++++++++++----------------------------------- 1 file changed, 93 insertions(+), 119 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index 8f67253..40cead8 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -144,167 +144,141 @@ to use instead." (add-to-list 'sx-tab--list ,tab))))) -;;; FrontPage -(sx-tab--define "FrontPage" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . activity))))) +;;; Entry commands +(sx-tab--define "All-Questions" + (sx-question-list--make-pager 'questions) + nil nil nil + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-frontpage +(autoload 'sx-tab-all-questions (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) - -;;; Newest -(sx-tab--define "Newest" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . creation))))) +(sx-tab--define "Unanswered" + (sx-question-list--make-pager 'questions 'unanswered)) ;;;###autoload -(autoload 'sx-tab-newest +(autoload 'sx-tab-unanswered (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) - - -;;; TopVoted -(sx-tab--define "TopVoted" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . votes))))) +(sx-tab--define "Unanswered-My-Tags" + (sx-question-list--make-pager 'questions 'unanswered/my-tags)) ;;;###autoload -(autoload 'sx-tab-topvoted +(autoload 'sx-tab-unanswered-my-tags (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) - - -;;; Hot -(sx-tab--define "Hot" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . hot))))) +(sx-tab--define "Featured" + (sx-question-list--make-pager 'questions 'featured)) ;;;###autoload -(autoload 'sx-tab-hot +(autoload 'sx-tab-featured (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) - - -;;; Week -(sx-tab--define "Week" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . week))))) +(sx-tab--define "Starred" + (sx-question-list--make-pager 'me 'favorites)) ;;;###autoload -(autoload 'sx-tab-week +(autoload 'sx-tab-featured (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-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 () + "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-all-questions nil (sx--site (sx--data-here 'question))))) -;;; Month -(sx-tab--define "Month" - (lambda (page) - (sx-question-get-questions - sx-question-list--site page '((sort . month))))) +;;; Obsolete tabs +(defconst sx-tab--basic-question-pager + (sx-question-list--make-pager 'questions)) + +(sx-tab--define "FrontPage" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'activity) + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-month +(autoload 'sx-tab-frontpage (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (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))) +(sx-tab--define "Newest" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'creation) + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-unanswered +(autoload 'sx-tab-newest (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-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))) +(sx-tab--define "TopVoted" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'votes) + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-unanswered-my-tags +(autoload 'sx-tab-topvoted (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-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))) +(sx-tab--define "Hot" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'hot) + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-featured +(autoload 'sx-tab-hot (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-file-name))) + "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) - -;;; Starred -(sx-tab--define "Starred" - (lambda (page) - (sx-method-call 'me - :page page - :site sx-question-list--site - :auth t - :submethod 'favorites - :filter sx-browse-filter))) +(sx-tab--define "Week" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'week) + (setq sx-question-list--order-methods + sx-tab--order-methods)) ;;;###autoload -(autoload 'sx-tab-featured +(autoload 'sx-tab-week (expand-file-name - "sx-tab" - (when load-file-name - (file-name-directory load-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 () - "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))))) +(sx-tab--define "Month" + sx-tab--basic-question-pager + nil nil "All-Questions" + (setq sx-question-list--order 'month) + (setq sx-question-list--order-methods + sx-tab--order-methods)) +;;;###autoload +(autoload 'sx-tab-month + (expand-file-name + "sx-tab" (when load-file-name (file-name-directory load-file-name))) + nil t) (provide 'sx-tab) ;;; sx-tab.el ends here -- cgit v1.2.3 From a9509bb93d978fd35b0dc0ea07102c59b30de3a4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 14:18:01 -0200 Subject: compiler warnings --- sx-search.el | 3 ++- sx-tab.el | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sx-search.el b/sx-search.el index febeeef..4b0a0b2 100644 --- a/sx-search.el +++ b/sx-search.el @@ -74,7 +74,8 @@ Possible values are the cdrs of `sx-search--order-methods'." (mapcar (lambda (c) `(const :tag ,(car c) ,(cdr c))) (cl-remove-duplicates sx-search--order-methods - :key #'cdr)))) + :key #'cdr))) + :group 'sx-question-list) ;;;###autoload diff --git a/sx-tab.el b/sx-tab.el index 40cead8..a3c6107 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -67,7 +67,8 @@ Possible values are the cdrs of `sx-tab--order-methods'." (mapcar (lambda (c) `(const :tag ,(car c) ,(cdr c))) (cl-remove-duplicates sx-tab--order-methods - :key #'cdr)))) + :key #'cdr))) + :group 'sx-question-list) (defconst sx-tab--docstring-format "Display a list of %s questions for SITE. -- cgit v1.2.3 From 680741fbb56b09fc1ffb842bc22cafab92a01501 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 14:29:59 -0200 Subject: Fix tests --- test/test-printing.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test-printing.el b/test/test-printing.el index 7384829..e6f5c3a 100644 --- a/test/test-printing.el +++ b/test/test-printing.el @@ -37,10 +37,11 @@ after being run through `sx-question--tag-format'." (ert-deftest question-list-display () (cl-letf (((symbol-function #'sx-request-make) (lambda (&rest _) sx-test-data-questions))) - (sx-tab-frontpage nil "emacs") - (switch-to-buffer "*question-list*") + (sx-tab-all-questions nil "emacs") + (switch-to-buffer sx-tab--all-questions-buffer) (goto-char (point-min)) - (should (equal (buffer-name) "*question-list*")) + (should (equal (buffer-name) + (format "*question-list: %s *" sx-question-list--current-tab))) (line-should-match (question-list-regex "Focus-hook: attenuate colours when losing focus" @@ -51,9 +52,9 @@ after being run through `sx-question--tag-format'." "Babel doesn't wrap results in verbatim" 0 1 "org-mode" "org-export" "org-babel")) ;; ;; Use this when we have a real sx-question buffer. - ;; (call-interactively 'sx-question-list-display-question) - ;; (should (equal (buffer-name) "*sx-question*")) - (switch-to-buffer "*question-list*") + ;; (save-excursion + ;; (call-interactively 'sx-question-list-display-question) + ;; (should (equal (buffer-name) "*sx-question*"))) (sx-question-list-previous 4) (line-should-match (question-list-regex -- cgit v1.2.3 From e761666acec63655df35e3114f9184cf621a0f41 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 25 Mar 2015 12:31:53 +0000 Subject: Update doc --- sx-tab.el | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index a3c6107..702ff05 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -24,16 +24,11 @@ ;;; Tabs: -;; - FrontPage :: The standard front page -;; - Newest :: Newest questions -;; - TopVoted :: Top-voted questions -;; - Hot :: Hot questions recently -;; - Week :: Hot questions for the week -;; - Month :: Hot questions for the month -;; - Unanswered :: Unanswered questions -;; - Unanswered My-tags :: Unanswered questions (subscribed tags) -;; - Featured :: Featured questions -;; - Starred :: Favorite questions +;; - `sx-tab-all-questions' :: All questions. +;; - `sx-tab-unanswered' :: Unanswered questions. +;; - `sx-tab-unanswered-my-tags' :: Unanswered questions in your followed tags. +;; - `sx-tab-featured' :: Featured questions. +;; - `sx-tab-featured' :: Starred questions. ;;; Code: -- cgit v1.2.3 From c9bb828c546150380b38d71d89a24d130941a3ac Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 25 Mar 2015 12:32:09 +0000 Subject: Fix macro expansion --- sx-tab.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index 702ff05..4f72513 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -65,13 +65,15 @@ Possible values are the cdrs of `sx-tab--order-methods'." :key #'cdr))) :group 'sx-question-list) -(defconst sx-tab--docstring-format - "Display a list of %s questions for SITE. +(eval-and-compile + (defconst sx-tab--docstring-format + "Display a list of %s questions for SITE. The variable `sx-tab-default-order' can be used to customize the sorting of the resulting list. NO-UPDATE (the prefix arg) is passed to `sx-question-list-refresh'. -If SITE is nil, use `sx-default-site'.") +If SITE is nil, use `sx-default-site'." + "Format used on the docstring of `sx-tab-*' commands.")) ;;; The main macro -- cgit v1.2.3 From 7f02f9a0698cf5b2f3849ecf81804155d196542a Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 25 Mar 2015 12:32:15 +0000 Subject: Checkdoc --- sx-tab.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index 4f72513..399bc1b 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -40,7 +40,7 @@ "List of the names of all defined tabs.") (defun sx-tab-switch (tab) - "Switch to another question-list tab." + "Switch to another question-list TAB." (interactive (list (sx-completing-read "Switch to tab: " sx-tab--list @@ -91,11 +91,11 @@ respectively used to set the value of the variables `sx-question-list--refresh-function', and `sx-question-list--next-page-function'. -BODY is evaluated after activating the mode and setting these -variables, but before refreshing the display. - If OBSOLETE is non-nil, it should be a string indicating the tab -to use instead." +to use instead of this one. + +BODY is evaluated after activating the mode and setting these +variables, but before refreshing the display." (declare (indent 1) (debug t)) (let* ((name (downcase tab)) (buffer-variable -- cgit v1.2.3 From ffc1cd7ca9416b91f99dffd5646243780fedd4df Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 25 Mar 2015 12:45:13 +0000 Subject: Fix bad autoload --- sx-tab.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sx-tab.el b/sx-tab.el index 399bc1b..98b1b26 100644 --- a/sx-tab.el +++ b/sx-tab.el @@ -28,7 +28,7 @@ ;; - `sx-tab-unanswered' :: Unanswered questions. ;; - `sx-tab-unanswered-my-tags' :: Unanswered questions in your followed tags. ;; - `sx-tab-featured' :: Featured questions. -;; - `sx-tab-featured' :: Starred questions. +;; - `sx-tab-starred' :: Starred questions. ;;; Code: @@ -181,7 +181,7 @@ variables, but before refreshing the display." (sx-tab--define "Starred" (sx-question-list--make-pager 'me 'favorites)) ;;;###autoload -(autoload 'sx-tab-featured +(autoload 'sx-tab-starred (expand-file-name "sx-tab" (when load-file-name (file-name-directory load-file-name))) nil t) -- cgit v1.2.3 From e73dcda1ea1ed044f1ed83192e7e7dd7e1ce59e4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 25 Mar 2015 12:45:22 +0000 Subject: Update Readme.org --- README.org | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/README.org b/README.org index 4071561..9fec35b 100644 --- a/README.org +++ b/README.org @@ -17,35 +17,32 @@ Emacs itself. View questions with one of the ~sx-tab-~ commands. These translate to the different 'tabs' that you can view on the official site. Implemented tabs include: -- =frontpage= :: The default front page of questions. -- =newest= :: Newest questions first. -- =topvoted= :: Highest-voted questions first. -- =hot= :: Questions with the most views, answers, and votes over the last few - days. -- =week= :: Questions with the most views, answers, and votes this week. -- =month= :: Questions with the most views, answers, and votes this month. -The meaning of these tabs hopefully needs no explanation, but the official -behavior is given as a tooltip on any site in the StackExchange network. - -Each of these opens up a list of questions. Switch sites with =:=. Navigate -this list of questions with =jk= or =np=. =jk= will also view the question in a -separate buffer. =v= will visit the question in your browser where =w= will -simply copy a link. Upvote and downvote with =u= and =d=. =RET= will take you -to the question buffer, where =RET= on headlines will expand and collapse each -section. Add comments with =c=. + +- ~sx-tab-all-questions~ :: All questions. +- ~sx-tab-unanswered~ :: Unanswered questions. +- ~sx-tab-unanswered-my-tags~ :: Unanswered questions in your followed tags. +- ~sx-tab-featured~ :: Featured questions. +- ~sx-tab-starred~ :: Your starred questions. + +Each of these opens up a list of questions, and you can further customize the +ordering of the list with =O=. Other keys include: + +- =s s= :: Switch site. +- =n= and =p= :: Navigate the list. +- =j= and =k= :: Navigate while viewing the question in a separate buffer. +- =v= :: Visit the thing-at-point in your browser +- =w= :: Copy the thing-at-point (usually a link). +- =u= and =d= :: Upvote and downvote. +- =RET= :: Open the question buffer. As always, =C-h m= is the definitive resource for the functions of this mode. * Installation -SX is now available on MELPA! Install it via the usual method or run =M-x -package-install RET sx RET=. - -To install the development version, follow the usual steps: -- Clone this repository -- Add this directory to your ~load-path~ -- Issue ~(require 'sx-load)~ -This should give you access to the ~sx-tab-~ functions (the main entry points at -this time). +SX is now available on MELPA! Both the stable release and the development +version can be found there. Install it via the Package Menu or just run +#+BEGIN_SRC text +M-x package-install RET sx RET= +#+END_SRC If you are going to be doing any asking / answering / commenting / upvoting / downvoting / /etc./, you must use ~sx-authenticate~ to provide SX with an -- cgit v1.2.3