Mercurial > hg > xemacs
view jde-hax.el @ 26:5d2492e352cc laptop
define ht-custom-size
author | ht |
---|---|
date | Wed, 22 Nov 2017 15:25:19 +0000 |
parents | 5f3a215f12eb |
children |
line wrap: on
line source
(defun jde-cursor-posn-as-event(&optional forceText) "Returns the text cursor position as an EVENT on Emacs and the mouse cursor position on XEmacs." (if (and jde-xemacsp (not forceText)) (let* ((mouse-pos (mouse-pixel-position)) (x (car (cdr mouse-pos))) (y (cdr (cdr mouse-pos)))) (if x (make-event 'button-press `(button 1 modifiers nil x ,x y ,y)) (let ((fake (jde-cursor-posn-as-event t))) (make-event 'button-press `(button 1 modifiers nil x ,(caar fake) y ,(cadar fake)))))) (let ((x (* (if jde-xemacsp (/(window-pixel-width)(window-width)) (frame-char-width)) (if (and (boundp 'hscroll-mode) (fboundp 'hscroll-window-column)) (hscroll-window-column) (mod (current-column) (window-width))))) (y (* (if jde-xemacsp (/ (window-pixel-height) (window-height)) (frame-char-height)) (- (count-lines (point-min) (point)) (count-lines (point-min) (window-start))))) (window (get-buffer-window (current-buffer)))) (list (list x y) window))))