From d06afce72182573c7ec1834c866fc39213c151cc Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 6 Dec 2014 18:04:56 +0000 Subject: Improve some header comments. --- sx-question.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-question.el') diff --git a/sx-question.el b/sx-question.el index c4b2445..fea8978 100644 --- a/sx-question.el +++ b/sx-question.el @@ -1,4 +1,4 @@ -;;; sx-question.el --- question logic +;;; sx-question.el --- Base question logic. -*- lexical-binding: t; -*- ;; Copyright (C) 2014 Sean Allred -- cgit v1.2.3 From a0d2e0d1572f09890e1c91a8230867fb019b3f10 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 15:07:10 -0200 Subject: Fix lexical bindings. --- sx-question-mode.el | 4 ---- sx-question.el | 1 - sx.el | 4 +--- 3 files changed, 1 insertion(+), 8 deletions(-) (limited to 'sx-question.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 68618bb..b376616 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -268,7 +268,3 @@ query the api." (provide 'sx-question-mode) ;;; sx-question-mode.el ends here - -;; Local Variables: -;; lexical-binding: t -;; End: diff --git a/sx-question.el b/sx-question.el index fea8978..0f6d17f 100644 --- a/sx-question.el +++ b/sx-question.el @@ -175,5 +175,4 @@ If no cache exists for it, initialize one with SITE." ;; Local Variables: ;; indent-tabs-mode: nil -;; lexical-binding: t ;; End: diff --git a/sx.el b/sx.el index fd39419..c1f91d1 100644 --- a/sx.el +++ b/sx.el @@ -1,4 +1,4 @@ -;;; sx.el --- StackExchange client +;;; sx.el --- StackExchange client. Ask and answer questions on Stack Overflow, Super User, and the likes. -*- lexical-binding: t; -*- ;; Copyright (C) 2014 Sean Allred @@ -36,7 +36,6 @@ :tag "SX" :group 'applications) - ;;; User commands (defun sx-version () @@ -360,5 +359,4 @@ If FORCE is non-nil, run them even if they've already been run." ;; Local Variables: ;; indent-tabs-mode: nil -;; lexical-binding: t ;; End: -- cgit v1.2.3 From e33d4bca3d610a77ef33f3c5dcaab7f7b4119900 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 15 Dec 2014 18:18:02 -0200 Subject: Unused variable --- sx-question.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sx-question.el') diff --git a/sx-question.el b/sx-question.el index 0f6d17f..9fb31fc 100644 --- a/sx-question.el +++ b/sx-question.el @@ -142,8 +142,7 @@ If no cache exists for it, initialize one with SITE." (defun sx-question--mark-hidden (question) "Mark QUESTION as being hidden." (sx-assoc-let question - (let ((site-cell (assoc .site sx-question--user-hidden-list)) - cell) + (let ((site-cell (assoc .site sx-question--user-hidden-list))) ;; If question already hidden, do nothing. (unless (memq .question_id site-cell) ;; First question from this site. -- cgit v1.2.3 From 925b4ef8b503b22481e624905fa6e3af8d6d4077 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 17 Dec 2014 15:35:26 -0200 Subject: Implent getting question given answer id --- sx-question.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sx-question.el') diff --git a/sx-question.el b/sx-question.el index 9fb31fc..801384a 100644 --- a/sx-question.el +++ b/sx-question.el @@ -54,6 +54,20 @@ If QUESTION-ID doesn't exist on SITE, raise an error." (error "Couldn't find question %S in %S" question-id site)))) +(defun sx-question-get-from-answer (site answer-id) + "Get question from SITE to which ANSWER-ID belongs. +If ANSWER-ID doesn't exist on SITE, raise an error." + (let ((res (sx-method-call 'answers + :id answer-id + :site site + :submethod 'questions + :auth t + :filter sx-browse-filter))) + (if (vectorp res) + (elt res 0) + (error "Couldn't find answer %S in %S" + answer-id site)))) + ;;; Question Properties -- cgit v1.2.3 From 1ab0df0975e67a626c95d89120ae0c0e2fdcf9ff Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 27 Dec 2014 19:33:26 -0200 Subject: Fix `sx-question--mark-hidden', which was just plain wrong. --- sx-question.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sx-question.el') diff --git a/sx-question.el b/sx-question.el index 801384a..03ebb4b 100644 --- a/sx-question.el +++ b/sx-question.el @@ -159,14 +159,13 @@ If no cache exists for it, initialize one with SITE." (let ((site-cell (assoc .site sx-question--user-hidden-list))) ;; If question already hidden, do nothing. (unless (memq .question_id site-cell) - ;; First question from this site. - (push (list .site .question_id) sx-question--user-hidden-list) - ;; Question wasn't present. - ;; Add it in, but make sure it's sorted (just in case we need - ;; it later). - (sx-sorted-insert-skip-first .question_id site-cell >) - ;; This causes a small lag on `j' and `k' as the list gets large. - ;; Should we do this on a timer? + (if (null site-cell) + ;; First question from this site. + (push (list .site .question_id) sx-question--user-hidden-list) + ;; Not first question and question wasn't present. + ;; Add it in, but make sure it's sorted (just in case we + ;; decide to rely on it later). + (sx-sorted-insert-skip-first .question_id site-cell >)) ;; Save the results. (sx-cache-set 'hidden-questions sx-question--user-hidden-list))))) -- cgit v1.2.3