[Top][All Lists]

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

Re: [ELPA] New package proposal: visual-path-abbrev.el

From: Stefan Monnier
Subject: Re: [ELPA] New package proposal: visual-path-abbrev.el
Date: Sun, 03 Mar 2019 08:48:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> (defun visual-file-name-abbrev--display-p (buffer pos path abbrev)
>   (seq-every-p (lambda (pred)
>                (funcall pred buffer pos path abbrev))
>              visual-file-name-abbrev-display-predicates))

I think this can be rewritten

    (defun visual-file-name-abbrev--display-p (buffer pos path abbrev)
       buffer pos filename abbrev))

which adds the ability to combine buffer-local and global parts.
I'd rename the var to use "-functions" as a suffix, to follow the usual
naming conventions.

BTW, why not pass the overlay as argument instead?

>       (overlay-put
>        ol 'display `(when (visual-file-name-abbrev--display-p
>                          object buffer-position ,path ,abbrev)
>                     . ,abbrev)))))

I understand you want the overlay to "auto-reveal" the text when point
enters it, but visual-file-name-abbrev--display-p seems "too dynamic" in
the sense that it recomputes a lot of things that could be computed
right here when building the overlay
(e.g. visual-file-name-abbrev--abbrev-shorter-p will always recompute
the same string-widths since the args it receives are always the same).


reply via email to

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