Open gusbrs opened 5 years ago
Thanks for the nice words! :-)
Because of my lack of time, I generally avoid making significant changes to my packages nowadays, so I'll refrain from adding this change to the package. Still it's always nice to see people using and hacking around packages I publish, so thanks for the comment!
I've been trying to sort this for quite some time and I could finally spare some time for it. I'm a happy user of
smart-mode-line
, but there was one thing that was still bothering me. I occasionally have to work with very long file names and, when this happens, all the worksmart-mode-line
makes to shorten the path within the buffer-identification is not enough, and the mode list is blown out of the window width.As far as I grasped, I could really only intervene in
sml/generate-buffer-identification
, for this is the central function for the purpose and is hooked here and there in the code. Furthermore, it's output is already propertized, so it's hard to mess with it after the fact. Anyway, the result I reached was (changes are marked by comments):The logic here is that, if after all the work
smart-mode-line
does to shorten the buffer-identification, it still exceedsname-width
, I truncatebufname
in a way that the buffer-identification will be the size ofname-width
.The result looks like:
I haven't thoroughly tested it yet, but it looks straightforward enough. But I will add it to my regular use in this form.
I'm also not sure if this would be desired behaviour for everyone (or to anyone else at all!), though it is for me. I bring it here in the hope it might be useful.
Thank you very much for the great package!