unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* columns displayed on one line in frame / window
@ 2009-06-04 22:01 Mickey Ferguson
  2009-06-05 15:40 ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Mickey Ferguson @ 2009-06-04 22:01 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

I have emacs 21.3.1 running on XP SP3.  When I evaluate the expression
using M-: (Meta-colon),
 
    (frame-width)
 
it returns 72.  However, if I look at the number of columns I can
display before the line wraps, it's actually 80.  Isn't frame-width
supposed to be the same as the number of columns that can fit on one
line?  (I'm using a fixed-width font, specifically
 
  (set-default-font
"-raster-Terminal-bold-r-normal-normal-12-90-96-96-c-*-ms-oemlatin")
 
Likewise, if I set the frame width with
 
    (set-frame-width (selected-frame) 72)
 
it sets up the window so that 80 columns fit on one line.  What gives?
Or is there another function I should use to obtain the number of
columns that fit on one line, and likewise, another function to set how
many fit on one line?

[-- Attachment #2: Type: text/html, Size: 8148 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: columns displayed on one line in frame / window
  2009-06-04 22:01 columns displayed on one line in frame / window Mickey Ferguson
@ 2009-06-05 15:40 ` Drew Adams
  2009-06-05 17:28   ` Mickey Ferguson
  2009-06-05 20:34   ` Mickey Ferguson
  0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2009-06-05 15:40 UTC (permalink / raw)
  To: 'Mickey Ferguson', help-gnu-emacs

> I have emacs 21.3.1 running on XP SP3.  When I evaluate the
> expression using M-: (Meta-colon), (frame-width) 
> it returns 72.  However, if I look at the number of columns I
> can display before the line wraps, it's actually 80.

Are you sure? Go to the character that you think is in column 80 and hit `C-x
='. Does it say that the char is at column 80?

If so, and assuming that the characters in question are of the default size for
the frame, then please report a bug. However, bugs are no longer being fixed in
Emacs 21, so you might want to upgrade to Emacs 22.3 and check that the same
problem exists. Most helpful of all would be to install the Emacs 23 pretest and
check that.

> Isn't frame-width supposed to be the same as the number of
> columns that can fit on one line?  (I'm using a fixed-width font

Yes. But the actual displayed width of a frame can include such things as the
fringe, a scroll bar, and frame borders. The available area for text display
should, though, be `frame-width' characters wide. If it is not, something is
wrong.

Which characters? Characters of fixed width and of the `default' face for the
frame in question.
	 
> Likewise, if I set the frame width with
> (set-frame-width (selected-frame) 72)
> it sets up the window so that 80 columns fit on one line.  What gives?

Sounds like a bug. When you report it, be sure to give a clear recipe that
starts with `emacs -q --no-site-file'. That is, do not test only using your
.emacs.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: columns displayed on one line in frame / window
  2009-06-05 15:40 ` Drew Adams
@ 2009-06-05 17:28   ` Mickey Ferguson
  2009-06-05 17:48     ` Drew Adams
  2009-06-05 20:34   ` Mickey Ferguson
  1 sibling, 1 reply; 6+ messages in thread
From: Mickey Ferguson @ 2009-06-05 17:28 UTC (permalink / raw)
  To: Drew Adams, help-gnu-emacs

>Are you sure? Go to the character that you think is in column 80
>and hit `C-x='. Does it say that the char is at column 80?

Yes.  The status bar at the bottom says 'C80', and the information text
below also says column 80.

>If so, and assuming that the characters in question are of the default
>size for the frame, then please report a bug. However, bugs are no
longer
>being fixed in Emacs 21, so you might want to upgrade to Emacs 22.3 and
>check that the same problem exists. Most helpful of all would be to
install
>the Emacs 23 pretest and check that.

I'll look into upgrading.  I hope the precompiled version for Windows is
available, because if it isn't, I'm out of luck right now.

Thanks for the tips.  I'll see where it goes from here...




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: columns displayed on one line in frame / window
  2009-06-05 17:28   ` Mickey Ferguson
@ 2009-06-05 17:48     ` Drew Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-06-05 17:48 UTC (permalink / raw)
  To: 'Mickey Ferguson', help-gnu-emacs

> I'll look into upgrading.  I hope the precompiled version for 
> Windows is available, because if it isn't, I'm out of luck right now.

Yes, MS Windows binaries are available, for both Emacs 22 and 23.
http://www.emacswiki.org/emacs-en?CategoryWThirtyTwo





^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: columns displayed on one line in frame / window
  2009-06-05 15:40 ` Drew Adams
  2009-06-05 17:28   ` Mickey Ferguson
@ 2009-06-05 20:34   ` Mickey Ferguson
  2009-06-05 21:28     ` Drew Adams
  1 sibling, 1 reply; 6+ messages in thread
From: Mickey Ferguson @ 2009-06-05 20:34 UTC (permalink / raw)
  To: Drew Adams, help-gnu-emacs

I've done some more experiments (still with 21.3) and observed the
following.  First, here are three relevant functions I had defined in my
site-init.el:

(defun max-lines ()
  "Calculate maximum number of lines supported on current display."
  (interactive "P")
  (/ (x-display-pixel-height) (frame-char-height)))

(defun fit-max-lines (fudge)
  "Resize window to fix maximum number of lines vertically"
  (interactive)
  (set-frame-height (selected-frame)
                    ;;; we subtract fudge, an estimated number, to allow
for
                    ;;; window title bar, mode line and minibuffer.
                    (-(max-lines)
                      (if (equal (getenv "emacs_alignment") "bottom")
                          11 fudge)))
  (set-frame-width (selected-frame)
                   (if (equal (getenv "emacs_alignment") "right") 80
81))
  (set-frame-position (selected-frame)
                      (if (equal (getenv "emacs_alignment") "right") -1
0)
                      (if (equal (getenv "emacs_alignment") "bottom") -1
0))
  ;;; do a set-frame-width twice - once before set-frame-position and
once
  ;;; after it.  This allows for true right-alignment.
  (set-frame-width (selected-frame) 81)
  )

(defun big-font-mode ()
  "Use larger font"
  (interactive)
  (set-default-font
   "-raster-Terminal-bold-r-normal-normal-12-90-96-96-c-*-ms-oemlatin")
  (set-frame-height (selected-frame) (-(max-lines) 6))
  (fit-max-lines 6)
  )

First, I started emacs with -q --no-site-file, and the display was fine.
It was using a decent fixed-width font.  I then visited (not loaded) my
site-init.el file.  I did an eval-region on the max-lines and
fit-max-lines function.  Everything is the same.  I then did an
eval-region on the last two lines from big-font-mode (set-frame-height
and fit-max-lines).  The window resized, and it still had exactly the
right number of columns visible (in this case, 81).  I then did an
eval-region on the two lines from big-font-mode that change the font,
and it was at exactly that point that the window frame no longer limited
itself to 81 columns, but instead showed 91 columns.  (Oh, I should add
that my emacs_alignment environment variable is set to right, and if it
matters, my windows screen resolution is 1280x1024.)

Does this provide any clue at all?  I know emacs 21.3 is no longer being
supported, but you might be able to see what's wrong just from the very
small amount of code here.  I eliminated everything else from the
picture.  Maybe it can even be reproduced on 22.x or 23.x.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: columns displayed on one line in frame / window
  2009-06-05 20:34   ` Mickey Ferguson
@ 2009-06-05 21:28     ` Drew Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-06-05 21:28 UTC (permalink / raw)
  To: 'Mickey Ferguson', help-gnu-emacs

> (defun big-font-mode ()
>   "Use larger font"
>   (interactive)
>   (set-default-font
> "-raster-Terminal-bold-r-normal-normal-12-90-96-96-c-*-ms-oemlatin")
>   (set-frame-height (selected-frame) (-(max-lines) 6))
>   (fit-max-lines 6))
> 
> I then did an eval-region on the two lines from big-font-mode
> that change the font, and it was at exactly that point that
> the window frame no longer limited itself to 81 columns, but
> instead showed 91 columns.

I don't have a lot of time, myself, to look at this.
But in Emacs 22.3 (-Q), if I enter these 80 columns of text:
01234567890123456789012345678901234567890123456789012345678901234567890123456789

And then I do this:
(set-default-font
"-raster-Terminal-bold-r-normal-normal-12-90-96-96-c-*-ms-oemlatin")

I too see extra space to the right of the existing text. And I can enter 10 more
chars on the same line, just as you described. 

Worse, if I move the cursor over the characters, from the right, one or more of
them disappear. `C-l' brings them back, of course; it's just a display problem.
Similarly, even *Help* displays (e.g. `C-h f') have characters that are jammed
together or missing altogether. Likewise, minibuffer prompts.

Seems like a bug, to me. I don't see this with other fonts. Maybe it has
something to do with raster fonts (which I don't normally use). If I were you, I
would report it using `M-x send-emacs-bug-report'.

However, the bug seems to be fixed in Emacs 23 - I don't see it there. And FWIW,
the font in question looks pretty normal in Emacs 23, whereas in Emacs 22 it is
very wide and super heavy (bold) - extremely ugly. I'm on MS Windows, which
could make a difference wrt fonts. But (frame-parameter nil 'font) shows
"-raster-Terminal-bold-r-normal-normal-12-90-96-96-c-*-ms-oemlatin".





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-05 21:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 22:01 columns displayed on one line in frame / window Mickey Ferguson
2009-06-05 15:40 ` Drew Adams
2009-06-05 17:28   ` Mickey Ferguson
2009-06-05 17:48     ` Drew Adams
2009-06-05 20:34   ` Mickey Ferguson
2009-06-05 21:28     ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).