Skip to content

Commit

Permalink
Merge pull request #38 from sf/master
Browse files Browse the repository at this point in the history
Make events immediately clickable
  • Loading branch information
djcb committed Jan 27, 2015
2 parents a0acc5a + d8db287 commit b80f1e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sauron.el
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ PROPS is a backend-specific plist.")
(let ((map (make-sparse-keymap)))
(define-key map "c" 'sauron-clear)
(define-key map (kbd "RET") 'sauron-activate-event)
(define-key map (kbd "<mouse-2>") 'sauron-activate-event)
(define-key map (kbd "<mouse-2>") 'sauron-activate-mouse-event)
(define-key map (kbd "<M-up>") 'sauron-activate-event-prev)
(define-key map (kbd "<M-down>") 'sauron-activate-event-next)
(define-key map "n" 'next-line)
Expand Down Expand Up @@ -469,6 +469,15 @@ PROPS an origin-specific property list that will be passed to the hook funcs."
(run-hook-with-args
'sauron-event-added-functions origin prio msg props)))))

(defun sauron-activate-mouse-event (event)
"Helper function to position point on the beginning of the
clicked line before calling sauron-activate-event."
(interactive "e")
(let ((pos (posn-point (event-end event))))
(goto-char pos)
(beginning-of-line)
(sauron-activate-event)))

(defun sauron-activate-event ()
"Activate the callback for the current sauron line, and remove
any special faces from the line."
Expand Down

0 comments on commit b80f1e7

Please sign in to comment.