aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-06-05 22:35:17 -0400
committerStefan Monnier2014-06-05 22:35:17 -0400
commit631de55bc19931ca2d778e8399697921228902a8 (patch)
tree70d957dfc083c83272435459c80fb364094772f3
parent79b0d21638cce19216607a89b6470b1e72a028b8 (diff)
downloademacs-631de55bc19931ca2d778e8399697921228902a8.tar.gz
emacs-631de55bc19931ca2d778e8399697921228902a8.zip
* lisp/mouse.el (mouse-posn-property): Ignore buffer position info when the
even happened elsewhere. * src/keyboard.c (make_lispy_position): Don't include a buffer position in mode/header-line mouse events.
-rw-r--r--lisp/mouse.el9
-rw-r--r--src/ChangeLog3
-rw-r--r--src/keyboard.c16
3 files changed, 15 insertions, 13 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 10358c91636..ca9ea5dadca 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -684,10 +684,11 @@ its value is returned."
684 (str (posn-string pos))) 684 (str (posn-string pos)))
685 (or (and str 685 (or (and str
686 (get-text-property (cdr str) property (car str))) 686 (get-text-property (cdr str) property (car str)))
687 ;; FIXME: mouse clicks on the mode-line come with a position in 687 ;; Mouse clicks in the fringe come with a position in
688 ;; (nth 5). Maybe we should change the C code instead so that 688 ;; (nth 5). This is useful but is not exactly where we clicked, so
689 ;; mouse-clicks don't include a position there! 689 ;; don't look up that position's properties!
690 (and pt (not (memq (posn-area pos) '(mode-line header-line))) 690 (and pt (not (memq (posn-area pos) '(left-fringe right-fringe
691 left-margin right-margin)))
691 (get-char-property pt property w)))) 692 (get-char-property pt property w))))
692 (get-char-property pos property))) 693 (get-char-property pos property)))
693 694
diff --git a/src/ChangeLog b/src/ChangeLog
index a56a0a27d92..06847a72de3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12014-06-06 Stefan Monnier <monnier@iro.umontreal.ca> 12014-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * keyboard.c (make_lispy_position): Don't include a buffer position in
4 mode/header-line mouse events.
5
3 * keyboard.c (read_char): Handle (t . <event>) in the second use of 6 * keyboard.c (read_char): Handle (t . <event>) in the second use of
4 Vunread_command_events (bug#17650). 7 Vunread_command_events (bug#17650).
5 8
diff --git a/src/keyboard.c b/src/keyboard.c
index c9cd222b110..568c8203c7f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2465,7 +2465,7 @@ read_char (int commandflag, Lisp_Object map,
2465 inside universal-argument. */ 2465 inside universal-argument. */
2466 2466
2467 if (CONSP (c) && EQ (XCAR (c), Qt)) 2467 if (CONSP (c) && EQ (XCAR (c), Qt))
2468 c = XCDR (c); 2468 c = XCDR (c);
2469 else 2469 else
2470 reread = true; 2470 reread = true;
2471 2471
@@ -5228,7 +5228,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5228 /* It's a click in window WINDOW at frame coordinates (X,Y) */ 5228 /* It's a click in window WINDOW at frame coordinates (X,Y) */
5229 struct window *w = XWINDOW (window); 5229 struct window *w = XWINDOW (window);
5230 Lisp_Object string_info = Qnil; 5230 Lisp_Object string_info = Qnil;
5231 ptrdiff_t textpos = -1; 5231 ptrdiff_t textpos = 0;
5232 int col = -1, row = -1; 5232 int col = -1, row = -1;
5233 int dx = -1, dy = -1; 5233 int dx = -1, dy = -1;
5234 int width = -1, height = -1; 5234 int width = -1, height = -1;
@@ -5263,9 +5263,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5263 &object, &dx, &dy, &width, &height); 5263 &object, &dx, &dy, &width, &height);
5264 if (STRINGP (string)) 5264 if (STRINGP (string))
5265 string_info = Fcons (string, make_number (charpos)); 5265 string_info = Fcons (string, make_number (charpos));
5266 textpos = (w == XWINDOW (selected_window) 5266 textpos = -1;
5267 && current_buffer == XBUFFER (w->contents))
5268 ? PT : marker_position (w->pointm);
5269 5267
5270 xret = wx; 5268 xret = wx;
5271 yret = wy; 5269 yret = wy;
@@ -5333,7 +5331,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5333 /* For clicks in the text area, fringes, or margins, call 5331 /* For clicks in the text area, fringes, or margins, call
5334 buffer_posn_from_coords to extract TEXTPOS, the buffer 5332 buffer_posn_from_coords to extract TEXTPOS, the buffer
5335 position nearest to the click. */ 5333 position nearest to the click. */
5336 if (textpos < 0) 5334 if (!textpos)
5337 { 5335 {
5338 Lisp_Object string2, object2 = Qnil; 5336 Lisp_Object string2, object2 = Qnil;
5339 struct display_pos p; 5337 struct display_pos p;
@@ -5384,15 +5382,15 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5384 } 5382 }
5385#endif 5383#endif
5386 5384
5387 /* Object info */ 5385 /* Object info. */
5388 extra_info 5386 extra_info
5389 = list3 (object, 5387 = list3 (object,
5390 Fcons (make_number (dx), make_number (dy)), 5388 Fcons (make_number (dx), make_number (dy)),
5391 Fcons (make_number (width), make_number (height))); 5389 Fcons (make_number (width), make_number (height)));
5392 5390
5393 /* String info */ 5391 /* String info. */
5394 extra_info = Fcons (string_info, 5392 extra_info = Fcons (string_info,
5395 Fcons (make_number (textpos), 5393 Fcons (textpos < 0 ? Qnil : make_number (textpos),
5396 Fcons (Fcons (make_number (col), 5394 Fcons (Fcons (make_number (col),
5397 make_number (row)), 5395 make_number (row)),
5398 extra_info))); 5396 extra_info)));