diff options
author | Sean Allred <code@seanallred.com> | 2014-12-03 17:59:02 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-03 17:59:02 -0500 |
commit | 6b2ecadd89e31feb994883987c38f6988a140b8c (patch) | |
tree | c77890b4800813287f5d2fdf38effd389c219164 /sx-button.el | |
parent | 114ca09da984738df2510bc72753a3443d16857c (diff) | |
parent | 67b60ea558f0386a1ea3dadcf3a9c4d22d398620 (diff) |
Merge branch 'master' into issue-130
Conflicts:
sx-request.el
Conflict was trivial.
Diffstat (limited to 'sx-button.el')
-rw-r--r-- | sx-button.el | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/sx-button.el b/sx-button.el index 8f0b6b9..dbadc2e 100644 --- a/sx-button.el +++ b/sx-button.el @@ -1,4 +1,4 @@ -;;; sx-button.el --- Defining buttons used throughout SX. +;;; sx-button.el --- Defining buttons used throughout SX. -*- lexical-binding: t; -*- ;; Copyright (C) 2014 Artur Malabarba @@ -18,6 +18,25 @@ ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: +;; +;; This file defines all buttons used by SX. For information on +;; buttons, see: +;; http://www.gnu.org/software/emacs/manual/html_node/elisp/Buttons.html +;; +;; Most interactible parts of the SX buffers are buttons. Wherever you +;; are, you can always cycle through all buttons by hitting `TAB', +;; that should help identify what's a button in each buffer. +;; +;; To define a new type of button follow the examples below using +;; `define-button-type' with :supertype `sx-button'. Required +;; properties are `action' and `help-echo'. You'll probably want to +;; give it a `face' as well, unless you want it to look like a link. +;; +;; Buttons can then be inserted in their respective files using +;; `insert-text-button'. Give it the string, the `:type' you defined, +;; and any aditional properties that can only be determined at +;; creation. Existing text can be transformed into a button with +;; `make-text-button' instead. ;;; Code: @@ -27,6 +46,14 @@ (require 'sx-question) +;;; Face +(defface sx-custom-button + '((((type x w32 ns) (class color)) ; Like default mode line + :box (:line-width 2 :style released-button) + :background "lightgrey" :foreground "black")) + "Face used on buttons such as \"Write an Answer\".") + + ;;; Command definitions ;; This extends `button-map', which already defines RET and mouse-1. (defvar sx-button-map @@ -118,7 +145,7 @@ code-block." 'help-echo (concat "mouse-1, RET" (propertize ": write a comment" 'face 'minibuffer-prompt)) - 'face 'custom-button + 'face 'sx-custom-button 'action #'sx-comment :supertype 'sx-button) @@ -126,13 +153,9 @@ code-block." 'help-echo (concat "mouse-1, RET" (propertize ": write an answer" 'face 'minibuffer-prompt)) - 'face 'custom-button + 'face 'sx-custom-button 'action #'sx-answer :supertype 'sx-button) (provide 'sx-button) ;;; sx-button.el ends here - -;; Local Variables: -;; lexical-binding: t -;; End: |