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-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index bccb658..ccd9433 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -1,4 +1,4 @@ -;;; sx-question-mode.el --- Creating the buffer that displays questions +;;; sx-question-mode.el --- Major-mode for displaying a question. -*- lexical-binding: t; -*- ;; Copyright (C) 2014 Artur Malabarba -- cgit v1.2.3 From b21052b4bd537f1e61fe8efb3badee1043a0af54 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 9 Dec 2014 15:45:32 +0000 Subject: Define up and down keys in question-mode. --- sx-question-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index ccd9433..19d7d16 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -193,7 +193,10 @@ Letters do not insert themselves; instead, they are commands. (mapc (lambda (x) (define-key sx-question-mode-map (car x) (cadr x))) - `(("n" sx-question-mode-next-section) + `( + ([down] sx-question-mode-next-section) + ([up] sx-question-mode-previous-section) + ("n" sx-question-mode-next-section) ("p" sx-question-mode-previous-section) ("g" sx-question-mode-refresh) ("c" sx-comment) -- cgit v1.2.3 From 302b5a0cf2222973b901c7856da3920705ebe24e Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 13 Dec 2014 00:18:12 +0000 Subject: HOTFIX: Mark question as read when displaying it. This is a pretty big bug because it was leading SX to think the question wasn't read, even though it was open. This, in turn, prevented the user from being able to do anything (vote, comment) on the question, since we prevent interaction with unread questions. --- sx-question-mode.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 19d7d16..5735f47 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -62,7 +62,9 @@ Returns the question buffer." (sx-question-mode--erase-and-print-question data))) (defun sx-question-mode--erase-and-print-question (data) - "Erase contents of buffer and print question given by DATA." + "Erase contents of buffer and print question given by DATA. +Also marks the question as read with `sx-question--mark-read'." + (sx-question--mark-read data) (let ((inhibit-read-only t)) (erase-buffer) (sx-question-mode) -- cgit v1.2.3 From 8adc0ac710469949ac28aa664eef965ef179c290 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 13:42:29 +0000 Subject: Use the header-line as a UI guide on the question buffer. --- sx-question-mode.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 5735f47..c45ef9f 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -175,12 +175,31 @@ property." ;;; Major-mode +(defvar sx-question-mode--header-line + '(" " + (:propertize "n p TAB" face mode-line-buffer-id) + ": Navigate" + " " + (:propertize "u d" face mode-line-buffer-id) + ": Up/Down Vote" + " " + (:propertize "c" face mode-line-buffer-id) + ": Comment" + " " + (:propertize "a" face mode-line-buffer-id) + ": Answer" + " " + (:propertize "e" face mode-line-buffer-id) + ": Edit") + "Header-line used on the question list.") + (define-derived-mode sx-question-mode special-mode "Question" "Major mode to display and navigate a question and its answers. Letters do not insert themselves; instead, they are commands. \\ \\{sx-question-mode}" + (setq header-line-format sx-question-mode--header-line) ;; Determine how to close this window. (unless (window-parameter nil 'quit-restore) (set-window-parameter -- cgit v1.2.3 From 4bcdd311b590156998ebf51a14fce31b6d0569ec Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 14 Dec 2014 11:49:56 -0200 Subject: Also mention q --- sx-question-list.el | 5 ++++- sx-question-mode.el | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-list.el b/sx-question-list.el index 69fb435..f23310c 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -205,7 +205,10 @@ This is ignored if `sx-question-list--refresh-function' is set.") ": View question" " " (:propertize "v" face mode-line-buffer-id) - ": Visit externally") + ": Visit externally" + " " + (:propertize "q" face mode-line-buffer-id) + ": Quit") "Header-line used on the question list.") diff --git a/sx-question-mode.el b/sx-question-mode.el index c45ef9f..68618bb 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -190,7 +190,10 @@ property." ": Answer" " " (:propertize "e" face mode-line-buffer-id) - ": Edit") + ": Edit" + " " + (:propertize "q" face mode-line-buffer-id) + ": Quit") "Header-line used on the question list.") (define-derived-mode sx-question-mode special-mode "Question" -- 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-mode.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 486b950836a99b8eff847cecadd861426467284b Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 18 Dec 2014 22:37:42 -0200 Subject: Properly skip invisible sections. --- sx-question-mode.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index b376616..8fe6dfb 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -120,10 +120,8 @@ Prefix argument N moves N sections down or up." ;; If all we did was move out the current one, then move again ;; and we're guaranteed to reach the next section. (sx-question-mode--goto-property-change 'section n)) - (let ((ov (car-safe (sx-question-mode--section-overlays-at (point))))) - (unless (and (overlayp ov) - (overlay-get ov 'invisible)) - (cl-decf count))))) + (unless (get-char-property (point) 'invisible) + (cl-decf count)))) (when (equal (selected-window) (get-buffer-window)) (when sx-question-mode-recenter-line (let ((ov (sx-question-mode--section-overlays-at (line-end-position)))) -- cgit v1.2.3 From 139c4d81545cd8428de7864294c754fbe8f3267e Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 20 Dec 2014 15:29:30 -0200 Subject: Displaying questions uses pop-to-buffer instead of switch by default Fixes #153 See variable `sx-question-mode-display-buffer-function' --- sx-question-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 8fe6dfb..8d06078 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -30,11 +30,13 @@ ;;; Displaying a question -(defcustom sx-question-mode-display-buffer-function #'switch-to-buffer +(defcustom sx-question-mode-display-buffer-function #'pop-to-buffer "Function used to display the question buffer. Called, for instance, when hitting \\`\\[sx-question-list-display-question]' on an entry in the question list. -This is not used when navigating the question list with `\\[sx-question-list-view-next]." +This is not used when navigating the question list with `\\[sx-question-list-view-next]. + +Common values for this variable are `pop-to-buffer' and `switch-to-buffer'." :type 'function :group 'sx-question-mode) -- cgit v1.2.3 From abaad8b3c57355be672e13a2f5cdff3d651e91d0 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 20 Dec 2014 16:59:09 -0200 Subject: Refactor sx-visit to sx-visit-externally --- sx-interaction.el | 2 +- sx-question-list.el | 2 +- sx-question-mode.el | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-interaction.el b/sx-interaction.el index 38efe5d..ed8891b 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -106,7 +106,7 @@ Only fields contained in TO are copied." ;;; Visiting -(defun sx-visit (data &optional copy-as-kill) +(defun sx-visit-externally (data &optional copy-as-kill) "Visit DATA in a web browser. DATA can be a question, answer, or comment. Interactively, it is derived from point position. diff --git a/sx-question-list.el b/sx-question-list.el index 94b5be4..f6a82e2 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -317,7 +317,7 @@ into consideration. (":" sx-question-list-switch-site) ("t" sx-question-list-switch-tab) ("a" sx-ask) - ("v" sx-visit) + ("v" sx-visit-externally) ("u" sx-toggle-upvote) ("d" sx-toggle-downvote) ("h" sx-question-list-hide) diff --git a/sx-question-mode.el b/sx-question-mode.el index b376616..807eeea 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -224,7 +224,7 @@ Letters do not insert themselves; instead, they are commands. ("p" sx-question-mode-previous-section) ("g" sx-question-mode-refresh) ("c" sx-comment) - ("v" sx-visit) + ("v" sx-visit-externally) ("u" sx-toggle-upvote) ("d" sx-toggle-downvote) ("q" quit-window) -- cgit v1.2.3