aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Zawada <i@tn-home.de>2017-12-25 20:42:17 +0100
committerSean Allred <code@seanallred.com>2017-12-25 13:59:51 -0600
commit9488c03726464e4bd0ed0b448d203c5c7f8c212f (patch)
tree29326355e38f56e52266cb0123cbbae4fe1af3a9
parent8f1e3346286cfa5a5299ef192cc5aca3f37a7745 (diff)
Add sx-question-mode-after-print-hook for special formatting after print-out.
-rw-r--r--sx-question-print.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index 4ab6cfd..0d694c6 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -212,6 +212,13 @@ type is not available, images won't work."
:type 'integer
:group 'sx-question-mode)
+(defvar sx-question-mode-after-print-hook nil
+ "Hook run after the question has been printed.
+The hook functions are called without arguments with
+the `sx-question-mode' buffer current.
+The special variable `inhibit-read-only' is t while the hook functions run.
+This hook can be used for special formatting of parts of the question buffer.")
+
;;; Functions
;;;; Printing the general structure
@@ -240,6 +247,7 @@ QUESTION must be a data structure returned by `json-read'."
(cl-sort .answers sx-question-mode-answer-sort-function))))
(insert "\n\n ")
(insert-text-button "Write an Answer" :type 'sx-button-answer)
+ (run-hooks 'sx-question-mode-after-print-hook)
;; Go up
(goto-char (point-min))
(sx-question-mode-next-section))