all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anders Lindgren <andlind@gmail.com>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: NSTRACE: Create message indicating window and/or buffer.
Date: Thu, 7 Sep 2017 10:23:26 +0200	[thread overview]
Message-ID: <CABr8ebZ3pWQDZxbNc2S9mhQD2no4j=KbNiCQZ3xMBR7Mx54EAw@mail.gmail.com> (raw)
In-Reply-To: <m24lsf2j12.wl%esq@lawlist.com>

[-- Attachment #1: Type: text/plain, Size: 1591 bytes --]

Hi!

Disclaimer: I really don't know that much about the internals of Emacs, so
maybe there are better ways to do this...

Anyway, after looking at the `window' structure I see no "name" field.
However, it contains a pointer to the frame, which has a name. Also, it
contains a linked list of pointers to next and previous windows. By
following the link to the previous windows until you have reached the
beginning, you can count which position number it has. Using this you can
print something like:

    window 5 on frame XXXX

Of course, you can package the argument string and the code to retrieve the
values (which may be done inline or using support functions) in macros so
that you can write something like:

    NSTRACE_MSG ("bla bla " NSTRACE_FMT_WIN, NSTRACE_ARG_WIN(w));

Or even:

    NSTRACE_WIN ("bla bla", w)

See the rest of the NSTRACE macros for inspiration.

    -- Anders

Ps. Have you seen the https://github.com/Lindydancer/nstrace package? It,
among else, contains a major mode with font-lock support that makes is
easier to read the output of NSTRACE.

On Thu, Sep 7, 2017 at 7:07 AM, Keith David Bershatsky <esq@lawlist.com>
wrote:

> I would like to insert a NSTRACE message to let me know the window and/or
> buffer at issue.
>
> For example, ns_update_window_end contains a first argument of `w`.  I
> would like to see the pretty human readable name for that window, just like
> what we see when running `M-x trace-redisplay`.  The `%s` format argument
> requires a `char`, and rejects a Lisp_Object.
>
> How can I achieve this feature?
>
> Thanks,
>
> Keith
>
>

[-- Attachment #2: Type: text/html, Size: 2247 bytes --]

  reply	other threads:[~2017-09-07  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07  5:07 NSTRACE: Create message indicating window and/or buffer Keith David Bershatsky
2017-09-07  8:23 ` Anders Lindgren [this message]
2017-09-07 14:56 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2017-09-07 16:34 Keith David Bershatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABr8ebZ3pWQDZxbNc2S9mhQD2no4j=KbNiCQZ3xMBR7Mx54EAw@mail.gmail.com' \
    --to=andlind@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.