GNU bug report logs - #48257
[kisara.moe] 28.0.50; Align to right doesn't account for window separator in terminal frames

Previous Next

Package: emacs;

Reported by: mohkale <at> kisara.moe

Date: Thu, 6 May 2021 15:40:02 UTC

Severity: normal

Tags: notabug

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mohsin Kaleem <mohkale <at> kisara.moe>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48257 <at> debbugs.gnu.org
Subject: bug#48257: [kisara.moe] Re: [kisara.moe] Re: [kisara.moe] Re: [kisara.moe] Re: bug#48257: [kisara.moe] 28.0.50; Align to right doesn't account for window separator in terminal frames
Date: Tue, 11 May 2021 18:40:19 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> [Please use Reply All to keep the bug address on the CC list.]
>

Oooh, sorry, I recently started managing email from within emacs (good
excuse to report to the developer mailing list) and I'm still kind of
rusty with all the stuff I used to rely on a dedicated program for.

>
> We have the window-at-side-p function; is that what you want?
>

Oh, yep, that should work. Not the nicest solution because you're
mode-line will be inconsistent if you open the same window in both a
terminal and then a GUI frame but for most use-cases it should be fine.

I believe I tried this back when I first raised the issue with
doom-modeline and ran into some performance issues but it seems to be
working fine now (might've been some other problem in this case).

```lisp
(defun +mode-line-align (left right)
  "Return a string of `window-width' length containing LEFT and RIGHT, aligned respectively."
  (list left
        (propertize " "
                    'display `((space
                                :align-to
                                (- (+ right right-fringe right-margin)
                                   ,(if (and (not (display-graphic-p))
                                             (window-at-side-p nil 'right))
                                        0
                                      1)
                                   ;; WARN: Requires double evaluation of RHS forms for spacing.
                                   ,(string-width (format-mode-line (cons "" right)))))))
        right))

(setq-default mode-line-format `((:eval (+mode-line-align '("foo") '("bar")))))
(setq mode-line-format (default-value 'mode-line-format))
```

Thank you for the suggestion. :-)

>
> It is controlled by the current display-table.
>
>
> If someone wants to work on providing patches to support any of your
> suggestions, I'm sure it will be welcome, at least as an optional
> feature.  TIA.

Nice. I'm not experienced enough to delve into this yet, but I will when I
get a chance.

Thank you for your time and patience :-).

Yours sincerely,
Mohsin K.




This bug report was last modified 4 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.