Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #38 from sf/master

Make events immediately clickable
  • Loading branch information...
commit b80f1e729f3644afc319d26d3c66fd901198bc0b 2 parents a0acc5a + d8db287
Dirk-Jan C. Binnema authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 sauron.el
11 sauron.el
View
@@ -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)
@@ -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."
Please sign in to comment.
Something went wrong with that request. Please try again.