all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How can I automatically determine the best frame-height?
@ 2021-04-20 21:45 David Karr
  2021-04-20 21:50 ` Joost Kremers
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Karr @ 2021-04-20 21:45 UTC (permalink / raw)
  To: help-gnu-emacs

In my .emacs file, I have code like the following at the top:
-------------
(set-frame-position (selected-frame) 0 0)
(set-frame-height (selected-frame) 68)
--------------

I typically run on a Windows 10 laptop, connecting to an external monitor.
The frame height of 68 works out to put the status line just above the
Windows status bar, when connecting to my usual monitor.

Sometimes, I run the laptop without an external monitor. In that case, that
startup code is a little annoying, as I then have to shrink and move the
window a few times until I get it in the right position.

Is there a better way to do this, so it will just automatically size itself
so that the top is at the top of the screen, and the bottom is snug against
the status bar?

I normally run this on Cygwin, but I run the same .emacs file on my Ubuntu
VM running on the same laptop.


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

* Re: How can I automatically determine the best frame-height?
  2021-04-20 21:45 How can I automatically determine the best frame-height? David Karr
@ 2021-04-20 21:50 ` Joost Kremers
  2021-04-20 22:40 ` [External] : " Drew Adams
  2021-04-21 15:06 ` Wayne Harris via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 10+ messages in thread
From: Joost Kremers @ 2021-04-20 21:50 UTC (permalink / raw)
  To: David Karr; +Cc: help-gnu-emacs


On Tue, Apr 20 2021, David Karr wrote:
> Is there a better way to do this, so it will just automatically size itself
> so that the top is at the top of the screen, and the bottom is snug against
> the status bar?

Can't you simply maximise the frame? You can achieve this automatically by
putting the following in your init file:

    (add-to-list 'default-frame-alist '(fullscreen . maximized))

If you're running Emacs 27, it's even better to put it in `early-init.el`.

> I normally run this on Cygwin, but I run the same .emacs file on my Ubuntu
> VM running on the same laptop.

It should work for both. TBH, though, I do not know (and cannot test) whether
this will cause the Emacs frame to cover the OS's status bar/panel/dock
(whatever it's called).

HTH

-- 
Joost Kremers
Life has its moments



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

* RE: [External] : How can I automatically determine the best frame-height?
  2021-04-20 21:45 How can I automatically determine the best frame-height? David Karr
  2021-04-20 21:50 ` Joost Kremers
@ 2021-04-20 22:40 ` Drew Adams
  2021-04-21 15:06 ` Wayne Harris via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2021-04-20 22:40 UTC (permalink / raw)
  To: David Karr, help-gnu-emacs@gnu.org

Library `fit-frame.el' (and perhaps library
`autofit-frame.el) might help you.

It fits a frame to the textual content.
It doesn't bother trying to do pixel-level
fitting.  You can set max height and width.

There are also some related features in
library `frame-cmds.el' - e.g. option
`available-screen-pixel-bounds'.

All of these libraries are in the Emacs Wiki
Elisp Area:

https://www.emacswiki.org/emacs?action=elisp-area

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

* Re: How can I automatically determine the best frame-height?
  2021-04-20 21:45 How can I automatically determine the best frame-height? David Karr
  2021-04-20 21:50 ` Joost Kremers
  2021-04-20 22:40 ` [External] : " Drew Adams
@ 2021-04-21 15:06 ` Wayne Harris via Users list for the GNU Emacs text editor
  2021-04-21 15:19   ` Jean Louis
  2 siblings, 1 reply; 10+ messages in thread
From: Wayne Harris via Users list for the GNU Emacs text editor @ 2021-04-21 15:06 UTC (permalink / raw)
  To: help-gnu-emacs

David Karr <davidmichaelkarr@gmail.com> writes:

> In my .emacs file, I have code like the following at the top:
> -------------
> (set-frame-position (selected-frame) 0 0)
> (set-frame-height (selected-frame) 68)
> --------------
>
> I typically run on a Windows 10 laptop, connecting to an external monitor.
> The frame height of 68 works out to put the status line just above the
> Windows status bar, when connecting to my usual monitor.
>
> Sometimes, I run the laptop without an external monitor. In that case, that
> startup code is a little annoying, as I then have to shrink and move the
> window a few times until I get it in the right position.
>
> Is there a better way to do this, so it will just automatically size itself
> so that the top is at the top of the screen, and the bottom is snug against
> the status bar?

That is annoying.  I use --fullheight on the command line.  This could
be useful to you.  At least on Windows it start up with the perfect
height for me.

However, when I open a new frame, the new frame is taller than its
parent.  I don't get why.  All I wish was for the frame to keep the same
dimensions as the frame from which I issued the command.




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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 15:06 ` Wayne Harris via Users list for the GNU Emacs text editor
@ 2021-04-21 15:19   ` Jean Louis
  2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2021-04-21 15:19 UTC (permalink / raw)
  To: Wayne Harris; +Cc: help-gnu-emacs

* Wayne Harris via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-04-21 18:07]:
> David Karr <davidmichaelkarr@gmail.com> writes:
> 
> > In my .emacs file, I have code like the following at the top:
> > -------------
> > (set-frame-position (selected-frame) 0 0)
> > (set-frame-height (selected-frame) 68)
> > --------------
> >
> > I typically run on a Windows 10 laptop, connecting to an external monitor.
> > The frame height of 68 works out to put the status line just above the
> > Windows status bar, when connecting to my usual monitor.
> >
> > Sometimes, I run the laptop without an external monitor. In that case, that
> > startup code is a little annoying, as I then have to shrink and move the
> > window a few times until I get it in the right position.
> >
> > Is there a better way to do this, so it will just automatically size itself
> > so that the top is at the top of the screen, and the bottom is snug against
> > the status bar?
> 
> That is annoying.  I use --fullheight on the command line.  This could
> be useful to you.  At least on Windows it start up with the perfect
> height for me.
> 
> However, when I open a new frame, the new frame is taller than its
> parent.  I don't get why.  All I wish was for the frame to keep the same
> dimensions as the frame from which I issued the command.

You can put this in your ~/.emacs.d/early-init.el

(add-to-list 'default-frame-alist '(fullscreen . maximized))




-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/




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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 15:19   ` Jean Louis
@ 2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
  2021-04-21 20:48       ` Jean Louis
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Wayne Harris via Users list for the GNU Emacs text editor @ 2021-04-21 19:42 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> * Wayne Harris via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> [2021-04-21 18:07]:
>> David Karr <davidmichaelkarr@gmail.com> writes:
>> 
>> > In my .emacs file, I have code like the following at the top:
>> > -------------
>> > (set-frame-position (selected-frame) 0 0)
>> > (set-frame-height (selected-frame) 68)
>> > --------------
>> >
>> > I typically run on a Windows 10 laptop, connecting to an external monitor.
>> > The frame height of 68 works out to put the status line just above the
>> > Windows status bar, when connecting to my usual monitor.
>> >
>> > Sometimes, I run the laptop without an external monitor. In that case, that
>> > startup code is a little annoying, as I then have to shrink and move the
>> > window a few times until I get it in the right position.
>> >
>> > Is there a better way to do this, so it will just automatically size itself
>> > so that the top is at the top of the screen, and the bottom is snug against
>> > the status bar?
>> 
>> That is annoying.  I use --fullheight on the command line.  This could
>> be useful to you.  At least on Windows it start up with the perfect
>> height for me.
>> 
>> However, when I open a new frame, the new frame is taller than its
>> parent.  I don't get why.  All I wish was for the frame to keep the same
>> dimensions as the frame from which I issued the command.
>
> You can put this in your ~/.emacs.d/early-init.el

Can that be site-start.el?

> (add-to-list 'default-frame-alist '(fullscreen . maximized))

I added it to site-start.el.  It takes effect.  I don't like it
maximized, though.  I just wish it'd stick to the height of the initial
frame, which I set with -fh on the command line.

I looked up the manual and came up with

  (add-to-list 'default-frame-alist '(height . 0.90))

where 90% is about right for me, but this has the side-effect that the
initial-frame is not full-height any longer, that is, this undoes the
order given by -fh on the command line.




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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
@ 2021-04-21 20:48       ` Jean Louis
  2021-04-21 20:56       ` Jean Louis
  2021-04-22  9:24       ` Robert Pluim
  2 siblings, 0 replies; 10+ messages in thread
From: Jean Louis @ 2021-04-21 20:48 UTC (permalink / raw)
  To: Wayne Harris; +Cc: help-gnu-emacs

* Wayne Harris via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-04-21 22:44]:
> I added it to site-start.el.  It takes effect.  I don't like it
> maximized, though.  I just wish it'd stick to the height of the initial
> frame, which I set with -fh on the command line.

You are right, as my screen is for sure smaller than yours. The point
is that you may do any settings before init.el


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/




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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
  2021-04-21 20:48       ` Jean Louis
@ 2021-04-21 20:56       ` Jean Louis
  2021-04-22 12:39         ` Wayne Harris via Users list for the GNU Emacs text editor
  2021-04-22  9:24       ` Robert Pluim
  2 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2021-04-21 20:56 UTC (permalink / raw)
  To: Wayne Harris; +Cc: help-gnu-emacs

* Wayne Harris via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-04-21 22:44]:
> where 90% is about right for me, but this has the side-effect that the
> initial-frame is not full-height any longer, that is, this undoes the
> order given by -fh on the command line.

Also to mention, I am using GNU/Linux and can direct Emacs frame size
and position by using my window manager. For example I do not use
window borders on Emacs or XTerm, and I can say what size it will be.

~/.Xdefaults settings could maybe do also the same.

With bigger screen I always like to open up specific programs at
specific place of the screen.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/




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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
  2021-04-21 20:48       ` Jean Louis
  2021-04-21 20:56       ` Jean Louis
@ 2021-04-22  9:24       ` Robert Pluim
  2 siblings, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2021-04-22  9:24 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Wayne Harris

>>>>> On Wed, 21 Apr 2021 16:42:55 -0300, Wayne Harris via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> said:
    >> (add-to-list 'default-frame-alist '(fullscreen . maximized))

    Wayne> I added it to site-start.el.  It takes effect.  I don't like it
    Wayne> maximized, though.  I just wish it'd stick to the height of the initial
    Wayne> frame, which I set with -fh on the command line.

    Wayne> I looked up the manual and came up with

    Wayne>   (add-to-list 'default-frame-alist '(height . 0.90))

    Wayne> where 90% is about right for me, but this has the side-effect that the
    Wayne> initial-frame is not full-height any longer, that is, this undoes the
    Wayne> order given by -fh on the command line.

You can specify parameters that apply only to the first frame using
'initial-frame-alist' (and then not specify -fh on the command line).

Robert
-- 



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

* Re: How can I automatically determine the best frame-height?
  2021-04-21 20:56       ` Jean Louis
@ 2021-04-22 12:39         ` Wayne Harris via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 10+ messages in thread
From: Wayne Harris via Users list for the GNU Emacs text editor @ 2021-04-22 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> * Wayne Harris via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> [2021-04-21 22:44]:
>> where 90% is about right for me, but this has the side-effect that the
>> initial-frame is not full-height any longer, that is, this undoes the
>> order given by -fh on the command line.
>
> Also to mention, I am using GNU/Linux and can direct Emacs frame size
> and position by using my window manager.

That's what I wish Windows could do for me.  How I miss WindowMaker.
The closest thing I've found is the program ``Window Manager''

  http://www.desksoft.com/WindowManager.htm

It works, but it's a bit ugly --- you can see the window moving because
it is not able to keep the GNU Emacs initial frame hidden while it moves
it, so the end result is flickering.  But it's helping for sure.

FWIW, I think that what ``Window Manager'' should be doing is somehow
tapping into the lower level of the Windows window manager and
positioning and moving the desired windows before they show up on the
screen.  I'd think that Windows allows for such things.  If knew how to
do it, maybe I would because I don't see anybody providing such
solution.  ``Window Manager'' is the closest thing I've found.

> For example I do not use window borders on Emacs or XTerm, and I can
> say what size it will be.

That's smart.  How I wish I had such control on Windows land.

[...]

> With bigger screen I always like to open up specific programs at
> specific place of the screen.

My screen is small and I like that anyway, but, yes, with a larger
screen that becomes even more vital.




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

end of thread, other threads:[~2021-04-22 12:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-20 21:45 How can I automatically determine the best frame-height? David Karr
2021-04-20 21:50 ` Joost Kremers
2021-04-20 22:40 ` [External] : " Drew Adams
2021-04-21 15:06 ` Wayne Harris via Users list for the GNU Emacs text editor
2021-04-21 15:19   ` Jean Louis
2021-04-21 19:42     ` Wayne Harris via Users list for the GNU Emacs text editor
2021-04-21 20:48       ` Jean Louis
2021-04-21 20:56       ` Jean Louis
2021-04-22 12:39         ` Wayne Harris via Users list for the GNU Emacs text editor
2021-04-22  9:24       ` Robert Pluim

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.