help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Better ways to inspect text properties?


From: Samuel Wales
Subject: Re: Better ways to inspect text properties?
Date: Sat, 29 Oct 2022 21:51:24 -0700

more below.

On 10/29/22, Eduardo Ochs <eduardoochs@gmail.com> wrote:
> On Sat, 29 Oct 2022 at 20:46, Samuel Wales <samologist@gmail.com> wrote:
>>
>> a good question imo!  tangentially, by coincidence i was wanting some
>> similar things to understand better.
>>
>> showing the output prettily would be great.  c-u c-x = is just a bit
>> limited.  some kind of inspector?
>>
>> what if we could show all text properties in a buffer kind of like
>> visible-mode?
>>
>> is it possible to diff two buffers completely?  i.e. not only the text
>> as shown [or folded] but the properties too?
>>
>> that would allow regression testing of changes that affect only text
>> properties.  i don't mean displaying colors or so as a bespoke
>> non-traditional diff but rather the text property differnces as text.
>>
>> can a buffer with text properties be saved to a file and reloaded
>> preserving properties?
>>
>> what about visibility and folding?  could they be preserved like that
>> also?  my regression testing could be improved.
>>
>> i also still struggle with visibility and folding and the fucntios for
>> getting visible-only parts of a buffer, or copying and inserting in
>> buffers, or looping only visible lines etc.  i keep getting results i
>> do not expect.  [cannot debug now.]  e.g. i am in magit and it is
>> partly folded and i want to do various programmatic copy or operate
>> type operations on visible.
>>
>> i have not even yet found a good protocol for pp and frineds yet to
>> insert nicely into buffer at point, when called after a pp expression
>> with c-x c-=.  even for a paren-containing sexp, not only a string
>> with text properties.
>>
>> so idk it is probably just me and not finding documentation that suits
>> me well for it, but it seems a ripe area.
>
> Hi Samuel!
> By "an inspector" do you mean like what this package does?
>
>   https://github.com/mmontone/emacs-inspector

i can't tell.  white-background images are very hard on me so i can't
look a them.  i occasionally used symbolics and  commercial unix cl
inspectors, but i also meant inspector in a more generic and vague
"let user explore" sense.

the idea being to help the user understand all that behind hte scenes
stuff in emacs buffers and strings, namely text properties, more
richly than c-u c-x =.  [never mind overlays for the time being.]
great an inspector package exists though.

... and diff buffers by text properties and pp and serialize and have
a full set of functions to do only visible stuff in various operations
like in magit or org buffers and all the rest of the things one might
want to do with text properties and folding.

idk about anybody else but i often put comments above lisp code with
some expression and then eval it in the .el buffer to show what the
function does or so.  and pp of some type should be useful for that.

eev, i'm afraid, i have heard about and skimmed for many many years,
but it has its terminology and sensibilities and never caught on for
me for whatever reason and atm i can't investigate it.

perhaps someday i will.  [i have burning need for specific link and
anchor functionality, specifically id markers, that are partly, but
not completely, roughly in, but not covered by, embark, eev,
hyperbole.  and that would be the hook for me.]

>
> I have just tried this
>
>   (defun inspector-inspect-region (b e)
>     (interactive "r")
>     (inspector-inspect-expression (buffer-substring b e)))
>
> in a grep buffer, and it seems that the current version of inspector
> doesn't have support for treating strings with text properties as
> trees... and then I tried this on the same grep buffer,
>
>   (defun inspector-inspect-region (b e)
>     (interactive "r")
>     (inspector-inspect-expression
>      '(ee-string-intervals
>        (buffer-substring b e))))
>
> where ee-string-intervals is the function defined here,
>
>   (find-eev "eev-blinks.el" "find-eregionpp")
>   http://angg.twu.net/eev-current/eev-blinks.el.html#find-eregionpp
>
> and it worked very well - it was even able to show that certain
> #s(...) objects are structs of the kind "compilation--message", and it
> showed its slots.

sounds ineresting.

>
> I have added inspector's author - Mariano Montone - to the list of
> recipients of this message, let's see what happens... =)

hehe.  :)

>
>   Cheers,
>     Eduardo Ochs
>     http://angg.twu.net/eepitch.html
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



reply via email to

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