aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-question-list.el1
-rw-r--r--sx-question-mode.el4
-rw-r--r--sx.el17
3 files changed, 16 insertions, 6 deletions
diff --git a/sx-question-list.el b/sx-question-list.el
index b220097..72eabd3 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -323,6 +323,7 @@ focus the relevant window."
(defun list-questions (no-update)
"Display a list of StackExchange questions."
(interactive "P")
+ (sx-initialize)
(unless (buffer-live-p sx-question-list--buffer)
(setq sx-question-list--buffer
(generate-new-buffer "*question-list*")))
diff --git a/sx-question-mode.el b/sx-question-mode.el
index 9653485..aa15f85 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -346,11 +346,11 @@ HEADER is given `sx-question-mode-header' face, and value is given FACE.
(when sx-question-mode-bullet-appearance
(font-lock-add-keywords ;; Bullet items.
nil
- `(((rx line-start (0+ blank) (group-n 1 (any "*+-")) blank)
+ `((,(rx line-start (0+ blank) (group-n 1 (any "*+-")) blank)
1 '(face nil display ,sx-question-mode-bullet-appearance) prepend))))
(font-lock-add-keywords ;; Highlight usernames.
nil
- `(((rx (or blank line-start)
+ `((,(rx (or blank line-start)
(group-n 1 (and "@" (1+ (or (syntax word) (syntax symbol)))))
symbol-end)
1 font-lock-builtin-face)))
diff --git a/sx.el b/sx.el
index 53aae84..64c555c 100644
--- a/sx.el
+++ b/sx.el
@@ -143,10 +143,19 @@ SETTER should be a function of two arguments. If SETTER is nil,
(,(or setter #'setq) ,variable ,value))))
nil)
-(defun stack-initialize ()
- (run-hooks
- 'sx-init--internal-hook
- 'sx-init-hook))
+(defvar sx-initialized nil
+ "Nil if sx hasn't been initialized yet.
+If it has, holds the time at which initialization happened.")
+
+(defun sx-initialize (&optional force)
+ "Run initialization hooks if they haven't been run yet.
+These are `sx-init--internal-hook' and `sx-init-hook'.
+If FORCE is non-nil, run them even if they've already been run."
+ (when (or force (not sx-initialized))
+ (prog1
+ (run-hooks 'sx-init--internal-hook
+ 'sx-init-hook)
+ (setq sx-initialized (current-time)))))
(provide 'sx)
;;; sx.el ends here