From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.devel Subject: Re: NSTRACE: Create message indicating window and/or buffer. Date: Thu, 7 Sep 2017 10:23:26 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11495162bf2f780558952cc1" X-Trace: blaine.gmane.org 1504772657 15668 195.159.176.226 (7 Sep 2017 08:24:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Sep 2017 08:24:17 +0000 (UTC) Cc: Emacs Devel To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 07 10:24:03 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dps6D-0002Yw-Sp for ged-emacs-devel@m.gmane.org; Thu, 07 Sep 2017 10:23:46 +0200 Original-Received: from localhost ([::1]:39266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dps6J-0004Bd-83 for ged-emacs-devel@m.gmane.org; Thu, 07 Sep 2017 04:23:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dps63-00048p-EG for emacs-devel@gnu.org; Thu, 07 Sep 2017 04:23:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dps5y-0006kr-2V for emacs-devel@gnu.org; Thu, 07 Sep 2017 04:23:35 -0400 Original-Received: from mail-ua0-x229.google.com ([2607:f8b0:400c:c08::229]:37096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dps5x-0006hq-U3 for emacs-devel@gnu.org; Thu, 07 Sep 2017 04:23:29 -0400 Original-Received: by mail-ua0-x229.google.com with SMTP id k23so17839266uaf.4 for ; Thu, 07 Sep 2017 01:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=krFXaVX/ZTP983kWFwDF5+JIqJ/TPCnGK98HrYyKiJI=; b=JND6yTf+wbtqxi41NLqV3rd0g1h0CcPq+uyuIGTWzIw4OglN0Fr6dpgPZaPyxOsRkc h5Mc5fyzqJ0vrMFupSJP+PERPV46KZPbzAEQJY8Mhtt9Uq4k8gCId3DHBSNY9J9FAwYY j2i+onHd63aQdekzGY+m3vF/VO5QqqqM+gO53wPS+QkkPt50vOzydv8Dll2nmUxOIp4d YVh0JejBVPPqJJ2O9pYdAo6jU48xzok5zLy2lUyRg8D3S43zqyVqUcxLy8h7KcLtkzX0 YM7qI+ScUdM9p7B/jbeoCkgINw8UEgNI2MxOjo2ZZuUUWV6mk3kZcgCWT+mxORCKTWvT GYlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=krFXaVX/ZTP983kWFwDF5+JIqJ/TPCnGK98HrYyKiJI=; b=gMJEcEAk8JsF6sluILKUDPkbS9MNjalIVhNvvURtWon402F3SbXDqiBy7YcyMfvMeN 4mp6YRg0ClA3OhxHu8HJxtFwT1adbsWsJo7pvWG8HGGbvx7oz/XemyvZJjRSuNQBb6m1 2dz1/cnmz7VpQoC4dcYku57bC3fi/Kpitm0BEVC29ZWWlg3z1ry2Cji41BQJAsLGHEGe 0vJ6fn58H5Y0BlRsmFtN6gvVaiyhHBUQ+B99ZASoF7+IxRmm6ySkxmLU16CEbFAcQcmj /u2pfBoHRLWsMinnQ+hMd6sjmmE+sxlnGKG+mhsk4TEeWi3X16izdYAmgZ3UM14lCMrs BSkA== X-Gm-Message-State: AHPjjUjz+lFluBV1sv8YkbDTfzdEFwPsCSfdAnbWFdpeojo43iIP6AsQ RnhBeoisBghqG4nQPw1YN+GCS1ZtqAPO X-Google-Smtp-Source: ADKCNb7NpIbsKck1gL+1TImkGX+P/8DPH9JOdHnRYT/Pjv2cKh7+nd8XCFUmHCT4RatdI0LEaTEZnJUzJq6Ix04twbY= X-Received: by 10.176.72.227 with SMTP id y32mr1002997uac.121.1504772607650; Thu, 07 Sep 2017 01:23:27 -0700 (PDT) Original-Received: by 10.31.171.202 with HTTP; Thu, 7 Sep 2017 01:23:26 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c08::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217974 Archived-At: --001a11495162bf2f780558952cc1 Content-Type: text/plain; charset="UTF-8" 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 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 > > --001a11495162bf2f780558952cc1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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= 9; structure I see no "name" field. However, it contains a pointe= r to the frame, which has a name. Also, it contains a linked list of pointe= rs to next and previous windows. By following the link to the previous wind= ows until you have reached the beginning, you can count which position numb= er it has. Using this you can print something like:

=C2=A0 =C2=A0 window 5 on frame XXXX

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

=C2=A0 =C2=A0 NSTRACE_MSG = ("bla bla " NSTRACE_FMT_WIN, NSTRACE_ARG_WIN(w));

<= /div>
Or even:

=C2=A0 =C2=A0 NSTRACE_WIN (&quo= t;bla bla", w)

See the rest of the NSTRACE ma= cros for inspiration.

=C2=A0 =C2=A0 -- 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 easi= er to read the output of NSTRACE.
On Thu, Sep 7, 2017 at 7:07 AM, Keith David Ber= shatsky <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`.=C2=A0 I= would like to see the pretty human readable name for that window, just lik= e what we see when running `M-x trace-redisplay`.=C2=A0 The `%s` format arg= ument requires a `char`, and rejects a Lisp_Object.

How can I achieve this feature?

Thanks,

Keith


--001a11495162bf2f780558952cc1--