annotate jde-hax.el @ 67:a9b2a2335782 default tip

make setting advert whiten as well if needed, handle naked div in replying to html
author Henry S Thompson <ht@inf.ed.ac.uk>
date Sat, 21 Dec 2024 20:00:43 +0000
parents 5f3a215f12eb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
1 (defun jde-cursor-posn-as-event(&optional forceText)
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
2 "Returns the text cursor position as an EVENT on Emacs and the mouse
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
3 cursor position on XEmacs."
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
4 (if (and jde-xemacsp (not forceText))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
5 (let* ((mouse-pos (mouse-pixel-position))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
6 (x (car (cdr mouse-pos)))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
7 (y (cdr (cdr mouse-pos))))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
8 (if x
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
9 (make-event 'button-press `(button 1 modifiers nil x ,x y ,y))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
10 (let ((fake (jde-cursor-posn-as-event t)))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
11 (make-event 'button-press `(button 1 modifiers nil
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
12 x ,(caar fake)
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
13 y ,(cadar fake))))))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
14 (let ((x (* (if jde-xemacsp (/(window-pixel-width)(window-width))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
15 (frame-char-width))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
16 (if (and
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
17 (boundp 'hscroll-mode)
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
18 (fboundp 'hscroll-window-column))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
19 (hscroll-window-column)
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
20 (mod (current-column) (window-width)))))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
21 (y (* (if jde-xemacsp (/ (window-pixel-height)
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
22 (window-height))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
23 (frame-char-height))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
24 (- (count-lines (point-min) (point))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
25 (count-lines (point-min) (window-start)))))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
26 (window (get-buffer-window (current-buffer))))
5f3a215f12eb *** empty log message ***
ht
parents:
diff changeset
27 (list (list x y) window))))