Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun jump-to-cursor ()
- "Jump to the position under the mouse cursor if possible."
- (interactive)
- (when-let ((cursor-pos (mouse-position))
- (line (cddr cursor-pos))
- (col (cadr cursor-pos))
- (p (save-excursion
- (goto-char (window-start))
- (forward-line line)
- (if (> (- (line-end-position) (line-beginning-position)) col)
- (progn (move-to-column col) (1- (point)))
- nil))))
- (goto-char p)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement