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

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

bug#19395: 25.0.50; Setting left fringe to 0 messes up window-width


From: martin rudalics
Subject: bug#19395: 25.0.50; Setting left fringe to 0 messes up window-width
Date: Sat, 20 Dec 2014 19:58:05 +0100

>> If I want to right-adjust the last word of a buffer line I apparently
>> have to provide the buffer _and_ the frame in order to know how many
>> spaces to insert.
>
> Yes, and with-current-buffer achieves that, right?

Only if the current buffer appears on the selected frame.  My original
definition was

(defun window-char-width (&optional window)
  "Return default character width for WINDOW.
WINDOW must be a live window and defaults to the selected one."
  (setq window (window-normalize-window window t))
  (with-current-buffer (window-buffer window)
    (let* ((info (font-info (face-font 'default)))
       (width (aref info 11)))
      (if (> width 0)
      width
    (aref info 10)))))

and you can trust me that I would have written it as

(defun window-char-width (&optional window)
  "Return default character width for WINDOW.
WINDOW must be a live window and defaults to the selected one."
  (setq window (window-normalize-window window t))
  (with-selected-window window
    (let* ((info (font-info (face-font 'default)))
       (width (aref info 11)))
      (if (> width 0)
      width
    (aref info 10)))))

if I had known that

>>   > It replaces the original frame-specific face.

is not true.

>> IIUC this contradicts an earlier observation by Titus that
>>
>>     if the buffer in the specified window is displayed in two frames,
>>     the returned character width was always the one used in the current
>>     frame which is not necessarily the character width in the specified
>>     window (the window may be in the other frame).  This is a problem
>>     because character width can be different, if the two frames use
>>     different default fonts.
>
> I don't see any contradictions.  I said nothing about windows, only
> about frames and buffers.

His last sentence says that the outcome is dependent on the frame.  So
it does not "replace" the original frame-specific face but "merge" the
frame and buffer specific faces.

But maybe we are just miscommunicating again.

martin





reply via email to

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