unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* posn-at-point returns nil after goto-char
@ 2010-04-11  7:30 D Chiesa
  2010-04-11 14:49 ` Jeff Clough
  2010-04-11 17:39 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: D Chiesa @ 2010-04-11  7:30 UTC (permalink / raw)
  To: help-gnu-emacs

I've got a function that looks something like this:

    (defun my-move-and-popup-menu ()
      "move the point, then pop up a menu."
        (goto-char xxxx)
        (setq p (posn-at-point))
        (my-popup-menu p ...)
    )

Basically, move the point, then retrieve the screen position at that point, 
and then popup a menu at that screen position.

But I am finding that `posn-at-point` returns non-nil, only if the xxxx 
character position (the *after* position) is visible in the window, *before* 
the call to `goto-char`.  It seems that the position is not actually updated 
until exit from the function.  If `goto-char` goes a long way, more than one 
screenful, then the retrieved position is always nil, and my code doesn't 
know where to popup the menu.

The reason I suggest that the position is not actually updated until exit 
from the function - when the menu successfully pops up (which happens when 
the xxxx position is visible, though not at point, before entering the 
function), the cursor is clearly visible in its previous location while the 
popup menu is being displayed.  When I dismiss the menu, the cursor moves to 
where I expected it to move, during the `goto-char` call.

How can I get the position to be *really* updated, between `goto-char` and 
`posn-at-point`, so that `posn-at-point` will not return nil?

Thanks for any hints y'all can provide.


D Chiesa






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-11 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-11  7:30 posn-at-point returns nil after goto-char D Chiesa
2010-04-11 14:49 ` Jeff Clough
2010-04-11 17:39 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).