all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to get a window Lisp_Object from struct window *w?
@ 2018-09-18  0:57 Keith David Bershatsky
  2018-09-18  2:19 ` Stefan Monnier
  2018-09-18  8:24 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Keith David Bershatsky @ 2018-09-18  0:57 UTC (permalink / raw)
  To: Emacs Devel

I am chiseling away at feature requests #17684 (crosshairs) and #22873 (multiple fake cursors).

In this particular example, redisplay gives us the w (struct window *w) as it goes through each window.  I am recording the window Lisp_Object in a cache (also a Lisp_Object) and am later checking that cache to see if w == XWINDOW (window).  There is no guarantee that the window that I am interested in is the selected_window, and the functions giving me the w do not provide the window as an incoming argument.  I see that I can use:

Lisp_Object window = window_from_coordinates (f, opoint_x, opoint_y, &part, true);

get-buffer-window/w->contents is not helpful because there may be more than one window on the frame displaying the same buffer.

I was wondering if there is a more efficient way to derive window from a struct window *w?

Thanks,

Keith



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

* Re: How to get a window Lisp_Object from struct window *w?
  2018-09-18  0:57 How to get a window Lisp_Object from struct window *w? Keith David Bershatsky
@ 2018-09-18  2:19 ` Stefan Monnier
  2018-09-18  8:24 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2018-09-18  2:19 UTC (permalink / raw)
  To: emacs-devel

> I was wondering if there is a more efficient way to derive window from
> a struct window *w?

I'm not sure I understand but if you want the inverse of `XWINDOW`, then
`make_lisp_ptr` will do the trick.

The difference between a `Lisp_Object window` and a `struct window *w`
is just the tag bits which are very cheap&easy to add/remove.


        Stefan




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

* Re: How to get a window Lisp_Object from struct window *w?
  2018-09-18  0:57 How to get a window Lisp_Object from struct window *w? Keith David Bershatsky
  2018-09-18  2:19 ` Stefan Monnier
@ 2018-09-18  8:24 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2018-09-18  8:24 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

> Date: Mon, 17 Sep 2018 17:57:45 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> 
> I was wondering if there is a more efficient way to derive window from a struct window *w?

Like this:

  struct window *w;
  Lisp_Object window;
  XSETWINDOW (window, w);



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

* Re: How to get a window Lisp_Object from struct window *w?
@ 2018-09-18 16:29 Keith David Bershatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Keith David Bershatsky @ 2018-09-18 16:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thank you, Eli.  Greatly appreciated!

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [09-18-2018 01:24:14] <18 Sep 2018 11:24:14 +0300>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> CC: emacs-devel@gnu.org
> Subject: Re: How to get a window Lisp_Object from struct window *w?
> 
> > Date: Mon, 17 Sep 2018 17:57:45 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> >
> > I was wondering if there is a more efficient way to derive window from a struct window *w?
> 
> Like this:
> 
>   struct window *w;
>   Lisp_Object window;
>   XSETWINDOW (window, w);



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

end of thread, other threads:[~2018-09-18 16:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-18  0:57 How to get a window Lisp_Object from struct window *w? Keith David Bershatsky
2018-09-18  2:19 ` Stefan Monnier
2018-09-18  8:24 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2018-09-18 16:29 Keith David Bershatsky

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.