;;; -*- mode: emacs-lisp; lexical-binding: t; -*-

(use-package hyperbole

  :init
  (progn
    ;; Initialize the global Hyperbole minor mode to one of these values:
    ;;   1 - enabled on startup so the Action and Assist Smart Keys are active
    ;;   0 - off until you toggle it on
    ;; If you left hywiki-mode enabled above, that enables hyperbole-mode too.
    (unless (and (fboundp 'hywiki-mode)
                 (bound-and-true-p hywiki-mode))
      (hyperbole-mode 1)))

    ;; Older Hyperbole releases do not have HyWiki
    (when (bound-and-true-p hywiki-mode)
      ;; Initialize the global HyWiki minor mode to one of these values:
      ;;   :all   - highlights and makes HyWikiWord links active in
      ;;            all text and programming buffer comments
      ;;   :pages - highlights and makes HyWikiWord links active in
      ;;            only within HyWiki page buffers
      ;;   nil    - leaves HyWiki mode disabled.
      (hywiki-mode :all))

  :bind
  ;; Bind Smart Keys: {M-RET} is the Action Key; {C-u M-RET} is the
  ;; Assist Key
  (("M-RET" . hkey-either)
   ;; Uncomment the next binding if you want to emulate Hyperbole mouse drag
   ;; events from your keyboard.
   ;; See "https://www.gnu.org/s/hyperbole/man/hyperbole.html#Keyboard-Drags".
   ;; ("M-o"   . hkey-operate)
   )

  ;; Customize how Hyperbole and Org mode share the M-RET key:
  ;;   t        - With hyperbole-mode enabled, Hyperbole controls the key
  ;;   'buttons - With hyperbole-mode enabled, Hyperbole controls the key
  ;;              only when on a button or link; otherwise, Org controls it
  ;;   nil      - In Org mode, Org controls the key
  :custom
  (hsys-org-enable-smart-keys t)
  )
