[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/flymake.el,v
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/flymake.el,v |
Date: |
Sat, 25 Nov 2006 13:28:43 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Eli Zaretskii <eliz> 06/11/25 13:28:43
Index: flymake.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/flymake.el,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- flymake.el 15 Oct 2006 20:42:28 -0000 1.42
+++ flymake.el 25 Nov 2006 13:28:43 -0000 1.43
@@ -2,8 +2,8 @@
;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation
-;; Author: Pavel Kobiakov <address@hidden>
-;; Maintainer: Pavel Kobiakov <address@hidden>
+;; Author: Pavel Kobyakov <address@hidden>
+;; Maintainer: Pavel Kobyakov <address@hidden>
;; Version: 0.3
;; Keywords: c languages tools
@@ -117,6 +117,30 @@
'line-end-position
(lambda (&optional arg) (save-excursion (end-of-line arg) (point)))))
+(defun flymake-posn-at-point-as-event (&optional position window dx dy)
+ "Return pixel position of top left corner of glyph at POSITION,
+relative to top left corner of WINDOW, as a mouse-1 click
+event (identical to the event that would be triggered by clicking
+mouse button 1 at the top left corner of the glyph).
+
+POSITION and WINDOW default to the position of point in the
+selected window.
+
+DX and DY specify optional offsets from the top left of the glyph."
+ (unless window (setq window (selected-window)))
+ (unless position (setq position (window-point window)))
+ (unless dx (setq dx 0))
+ (unless dy (setq dy 0))
+
+ (let* ((pos (posn-at-point position window))
+ (x-y (posn-x-y pos))
+ (edges (window-inside-pixel-edges window))
+ (win-x-y (window-pixel-edges window)))
+ ;; adjust for window edges
+ (setcar (nthcdr 2 pos)
+ (cons (+ (car x-y) (car edges) (- (car win-x-y)) dx)
+ (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy)))
+ (list 'mouse-1 pos)))
(defun flymake-popup-menu (menu-data)
"Pop up the flymake menu at point, using the data MENU-DATA.
@@ -134,7 +158,7 @@
(popup-menu (flymake-make-xemacs-menu menu-data)
(make-event 'button-press fake-event-props)))
(x-popup-menu (if (eval-when-compile (fboundp 'posn-at-point))
- (posn-at-point)
+ (flymake-posn-at-point-as-event)
(list (flymake-get-point-pixel-pos) (selected-window)))
(flymake-make-emacs-menu menu-data))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/flymake.el,v,
Eli Zaretskii <=