emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The display margin


From: Nick Roberts
Subject: Re: The display margin
Date: Tue, 27 May 2003 00:42:21 +0100

 > You might try something like:
 > 
 >      (defun gud-break (&optional event)
 >        "Set break point."
 >        (interactive (list last-input-event))
 >        ;; Go to wherever the event happened.
 >        (if event (ignore-errors (mouse-set-point event)))
 >        ...)
 > 
 > I haven't tried it, tho.  Also you might need to use separate functions
 > for gud-break-from-toolbar than gud-break-from-margin.

If you mean:

(defun gud-break (&optional event)
  "Set break point."
  (interactive (list last-input-event))
  ;; Go to wherever the event happened.
  (if event (ignore-errors (mouse-set-point event)))
  (gud-call "break %f:%l" nil))

This works fine in the text area but I don't want to redefine any mouse clicks
there. And it doesn't work in the margin presumably because the point can't
be set there.

Clicking on the text area gives positions like:

(#<window 9 on myprog.c> 132 (19 . 163) 114022256)

whereas the on the left margin gives:

(#<window 9 on myprog.c> left-margin (4 . 164) 114018986)

I don't know enough about emacs internals to know if the line number can be
easily inferred from the X-Y co-ordinates. However, since the width and height
of the margin are also expressible in characters could the postion not be
expressed as something like:

(#<window 9 on myprog.c> (left-margin . 32) (4 . 164) 114018986)

where 32, say, gives the character position in the margin (from which the line
number can easily be calculated)?

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]