Skip to content

Instantly share code, notes, and snippets.

@zeph1e
Created November 17, 2015 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeph1e/d03bf01ff8edeac1538c to your computer and use it in GitHub Desktop.
Save zeph1e/d03bf01ff8edeac1538c to your computer and use it in GitHub Desktop.
;; handle left click on left window margin & return text in position
(global-set-key (kbd "<left-margin> <mouse-1>") (lambda (p) (interactive "e")
(message "%S" (posn-string (car (cdr p))))))
;; unset key bind
(global-unset-key (kbd "<left-margin> <mouse-1>"))
;; make overlay on window start pos & insert propertized text
;; mouse-face doesn't work but help echo works..... weird....
(let ((str (propertize "hello" 'face '(:foreground "cyan") 'help-echo "mouse-1: say hello" 'mouse-face 'highlight)))
(setq ov (make-overlay (window-start) (window-start)))
(overlay-put ov 'before-string (propertize " " 'display `((margin left-margin) ,str))))
;; remove overlay
(delete-overlay ov)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment