[Top][All Lists]

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

Re: Better ways to inspect text properties?

From: Eduardo Ochs
Subject: Re: Better ways to inspect text properties?
Date: Thu, 27 Oct 2022 11:03:29 -0300

On Thu, 27 Oct 2022 at 02:48, Eli Zaretskii <> wrote:
> Please tell which part(s) is/are not very human-friendly in the above.
> Otherwise it's hard to suggest improvements, because to me the above
> is quite friendly and easy to read and understand.

Hi Eli,

...problem solved. The main function that I am using is this one,

  (defun ee-string-intervals (str)
    "This is similar to `object-intervals', but uses another output format."
    (let ((pair< (lambda (pair1 pair2)
                   (string< (symbol-name (car pair1))
                            (symbol-name (car pair2))))))
      (cl-loop for (b e props) in (object-intervals str)
               for s = (substring-no-properties str b e)
               for pairs = (cl-loop for (x y) on props by 'cddr
                                    collect (list x y))
               collect (list s (sort pairs pair<)))))

and it can be tested with:

  (setq mystr (concat (propertize "a" 'p1 'v1 'p2 'v2)
      (propertize "b" 'p3 'v3 'p4 'v4)))

  (ee-string-intervals mystr)

I am experimenting with functions that extract the region with
buffer-substring, use `ee-string-intervals' to convert that
string with properties to something that I find better to work
with, and then deletes the uninteresting properties and
pretty-prints the result. I'll see if that helps me to understand
dired and org and then make a blog-ish post about that - now
without much fear that I am reinventing the wheel and making it

  Cheers =),
    Eduardo Ochs

reply via email to

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