Mercurial > hg > xemacs
comparison jde-hax.el @ 31:129123962e51
trying to merge lib/emacs and xemacs
author | Henry S Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Sat, 07 Oct 2023 12:43:14 +0100 |
parents | 5f3a215f12eb |
children |
comparison
equal
deleted
inserted
replaced
5:8e0e16f4763c | 31:129123962e51 |
---|---|
1 (defun jde-cursor-posn-as-event(&optional forceText) | |
2 "Returns the text cursor position as an EVENT on Emacs and the mouse | |
3 cursor position on XEmacs." | |
4 (if (and jde-xemacsp (not forceText)) | |
5 (let* ((mouse-pos (mouse-pixel-position)) | |
6 (x (car (cdr mouse-pos))) | |
7 (y (cdr (cdr mouse-pos)))) | |
8 (if x | |
9 (make-event 'button-press `(button 1 modifiers nil x ,x y ,y)) | |
10 (let ((fake (jde-cursor-posn-as-event t))) | |
11 (make-event 'button-press `(button 1 modifiers nil | |
12 x ,(caar fake) | |
13 y ,(cadar fake)))))) | |
14 (let ((x (* (if jde-xemacsp (/(window-pixel-width)(window-width)) | |
15 (frame-char-width)) | |
16 (if (and | |
17 (boundp 'hscroll-mode) | |
18 (fboundp 'hscroll-window-column)) | |
19 (hscroll-window-column) | |
20 (mod (current-column) (window-width))))) | |
21 (y (* (if jde-xemacsp (/ (window-pixel-height) | |
22 (window-height)) | |
23 (frame-char-height)) | |
24 (- (count-lines (point-min) (point)) | |
25 (count-lines (point-min) (window-start))))) | |
26 (window (get-buffer-window (current-buffer)))) | |
27 (list (list x y) window)))) |