* Problems positioning and sizing Emacs frames
@ 2022-12-19 18:29 Dr Rainer Woitok
2022-12-20 1:41 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Dr Rainer Woitok @ 2022-12-19 18:29 UTC (permalink / raw)
To: help-gnu-emacs
Greetings,
I fail to position my Emacs frames where I want them. The first frame
should be opened with its right edge flush with the right screen edge of
the monitor, as in
$ emacs --geometry 80x40-0+6 . &
According to "C-h v initial-frame-alist" I should set this variable so
it matches the Emacs specific entries in ".Xresources" plus the "--geo-
metry" specification from the command line, while variable "default-
frame-alist" should contain the relevant settings for frames opened la-
ter via "C-x 5 C-f".
Here is how I set variables "default-frame-alist" and "initial_frame-
alist" in file "init.el":
(let* ((g (split-string (getenv "_EMACS_SIZE_") "x"))
(l (* 3 (string-to-number (getenv "_WINDOW_OFFSET_"))))
(p (list (cons 'font-parameter (getenv "_EMACS_FONT_"))
(cons 'top (string-to-number (getenv "_WINDOW_TOP_")))
(cons 'height (string-to-number (cadr g)))
(cons 'width (string-to-number (car g)))
'(horizontal-scroll-bars . nil)
'(left-fringe . 0)
'(right-fringe . nil)
'(menu-bar-lines . 0)
'(tab-bar-lines . 0)
'(tool-bar-lines . 0)
'(vertical-scroll-bars . right)
)) )
(setq default-frame-alist (cons (cons 'left l) p)
initial-frame-alist (cons (list 'left '- 0) p)
) )
These are the definitions of the environment variables used above:
$ env | grep -E '^_(EMACS|WINDOW)_'
_EMACS_FONT_=-bitstream-bitstream vera sans mono-medium-r-*--21-*-*-*-m-*-*-*
_EMACS_SIZE_=80x40
_WINDOW_OFFSET_=50
_WINDOW_TOP_=6
$
And here are the relevant lines from file ".Xresources":
$ grep ^Emacs .Xresources
Emacs*font: -bitstream-bitstream vera sans mono-medium-r-*--21-*-*-*-m-*-*-*
Emacs.geometry: 80x40
Emacs.menuBar: 0
Emacs.tabBar: 0
Emacs.toolBar: 0
$
But, sadly, it doesn't work as I expect :-(
Problem 1:
The edge of the physical screen cuts off part of the right scrollbar and
the right window decoration of the initial frame opened by the "emacs"
command above, a vertical stripe of approximately 14 pixels width, and
the window manager reports the window geometry as "79x40" rather than
"80x40". However, the frame's top edge is placed correctly 6 pixels be-
low the physical screen's top edge.
Problem 2:
When I open another frame by entering "C-x 5 C-f", the new frame has the
correct geometry of "80x40", but is positioned at "+484+0" rather than
at "+150+6", and any further frame opened is placed 29 pixels to the
right rather than at the very same position as the previous frame.
What am I missing? Any help appreciated :-)
Sincerely,
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-19 18:29 Problems positioning and sizing Emacs frames Dr Rainer Woitok
@ 2022-12-20 1:41 ` Po Lu
2022-12-20 11:37 ` Dr Rainer Woitok
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2022-12-20 1:41 UTC (permalink / raw)
To: Dr Rainer Woitok; +Cc: help-gnu-emacs
Dr Rainer Woitok <rainer.woitok@gmail.com> writes:
> Greetings,
>
> I fail to position my Emacs frames where I want them. The first frame
> should be opened with its right edge flush with the right screen edge of
> the monitor, as in
>
> $ emacs --geometry 80x40-0+6 . &
>
> According to "C-h v initial-frame-alist" I should set this variable so
> it matches the Emacs specific entries in ".Xresources" plus the "--geo-
> metry" specification from the command line, while variable "default-
> frame-alist" should contain the relevant settings for frames opened la-
> ter via "C-x 5 C-f".
>
> Here is how I set variables "default-frame-alist" and "initial_frame-
> alist" in file "init.el":
>
> (let* ((g (split-string (getenv "_EMACS_SIZE_") "x"))
> (l (* 3 (string-to-number (getenv "_WINDOW_OFFSET_"))))
> (p (list (cons 'font-parameter (getenv "_EMACS_FONT_"))
> (cons 'top (string-to-number (getenv "_WINDOW_TOP_")))
> (cons 'height (string-to-number (cadr g)))
> (cons 'width (string-to-number (car g)))
>
> '(horizontal-scroll-bars . nil)
> '(left-fringe . 0)
> '(right-fringe . nil)
> '(menu-bar-lines . 0)
> '(tab-bar-lines . 0)
> '(tool-bar-lines . 0)
> '(vertical-scroll-bars . right)
> )) )
> (setq default-frame-alist (cons (cons 'left l) p)
> initial-frame-alist (cons (list 'left '- 0) p)
> ) )
>
> These are the definitions of the environment variables used above:
>
> $ env | grep -E '^_(EMACS|WINDOW)_'
> _EMACS_FONT_=-bitstream-bitstream vera sans mono-medium-r-*--21-*-*-*-m-*-*-*
> _EMACS_SIZE_=80x40
> _WINDOW_OFFSET_=50
> _WINDOW_TOP_=6
> $
>
> And here are the relevant lines from file ".Xresources":
>
> $ grep ^Emacs .Xresources
> Emacs*font: -bitstream-bitstream vera sans mono-medium-r-*--21-*-*-*-m-*-*-*
> Emacs.geometry: 80x40
> Emacs.menuBar: 0
> Emacs.tabBar: 0
> Emacs.toolBar: 0
> $
>
> But, sadly, it doesn't work as I expect :-(
>
> Problem 1:
>
> The edge of the physical screen cuts off part of the right scrollbar and
> the right window decoration of the initial frame opened by the "emacs"
> command above, a vertical stripe of approximately 14 pixels width, and
> the window manager reports the window geometry as "79x40" rather than
> "80x40". However, the frame's top edge is placed correctly 6 pixels be-
> low the physical screen's top edge.
>
> Problem 2:
>
> When I open another frame by entering "C-x 5 C-f", the new frame has the
> correct geometry of "80x40", but is positioned at "+484+0" rather than
> at "+150+6", and any further frame opened is placed 29 pixels to the
> right rather than at the very same position as the previous frame.
>
> What am I missing? Any help appreciated :-)
Your window manager decided to force some kind of sliding behavior on
Emacs. Unfortunately, that is outside of Emacs's control.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-20 1:41 ` Po Lu
@ 2022-12-20 11:37 ` Dr Rainer Woitok
2022-12-20 12:32 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Dr Rainer Woitok @ 2022-12-20 11:37 UTC (permalink / raw)
To: Po Lu; +Cc: help-gnu-emacs
Po Lu,
On Tuesday, 2022-12-20 09:41:35 +0800, you wrote:
> ...
> Your window manager decided to force some kind of sliding behavior on
> Emacs.
What is making you so sure? You don't even know what window manager I'm
using. And regardless of what kind of windows I ask my window manager
to open it makes them the size I want and places them where I want. In
particular I don't have this problem with XEmacs frames which at least
are somewhat akin to Emacs frames.
Sincerely,
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-20 11:37 ` Dr Rainer Woitok
@ 2022-12-20 12:32 ` Po Lu
2022-12-20 13:34 ` Dr Rainer Woitok
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2022-12-20 12:32 UTC (permalink / raw)
To: Dr Rainer Woitok; +Cc: help-gnu-emacs
Dr Rainer Woitok <rainer.woitok@gmail.com> writes:
>> Your window manager decided to force some kind of sliding behavior on
>> Emacs.
>
> What is making you so sure? You don't even know what window manager I'm
> using. And regardless of what kind of windows I ask my window manager
> to open it makes them the size I want and places them where I want.
The fact that any further frames created moved to the right. That is
not something any code in Emacs can do.
> In particular I don't have this problem with XEmacs frames which at
> least are somewhat akin to Emacs frames.
You can try building Emacs with the Lucid toolkit.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-20 12:32 ` Po Lu
@ 2022-12-20 13:34 ` Dr Rainer Woitok
2022-12-20 13:48 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Dr Rainer Woitok @ 2022-12-20 13:34 UTC (permalink / raw)
To: Po Lu; +Cc: help-gnu-emacs
Po Lu,
On Tuesday, 2022-12-20 20:32:54 +0800, you wrote:
> ...
> > What is making you so sure?
> > ...
>
> The fact that any further frames created moved to the right. That is
> not something any code in Emacs can do.
I fear Emacs could: by simply not providing coordinates to the window
manager, thus forcing the latter to make them up itself.
But this is a MINOR point anyway, I could even live with that. The main
point was that Emacs or my way of setting it up caused the window size
and position not to be dealt with the way I wanted. It could well be
that it's my set-up which forced Emacs to pass wrong information to the
window manager, but currently I don't see what's wrong and am therefore
asking the combined wisdom of this list.
Sincerely,
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-20 13:34 ` Dr Rainer Woitok
@ 2022-12-20 13:48 ` Po Lu
2022-12-20 17:50 ` Dr Rainer Woitok
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2022-12-20 13:48 UTC (permalink / raw)
To: Dr Rainer Woitok; +Cc: help-gnu-emacs
Dr Rainer Woitok <rainer.woitok@gmail.com> writes:
> I fear Emacs could: by simply not providing coordinates to the window
> manager, thus forcing the latter to make them up itself.
All windows have parent relative coordinates under X, and when you
specify the `top' or `left' parameters, the "user-specified position"
hint is set which politely asks the window manager to place the window
where Emacs asked it to be.
The window manager is always able to ignore those hints. Many window
managers do just that.
> But this is a MINOR point anyway, I could even live with that. The main
> point was that Emacs or my way of setting it up caused the window size
> and position not to be dealt with the way I wanted. It could well be
> that it's my set-up which forced Emacs to pass wrong information to the
> window manager, but currently I don't see what's wrong and am therefore
> asking the combined wisdom of this list.
Did you set `frame-resize-pixelwise' to t?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problems positioning and sizing Emacs frames
2022-12-20 13:48 ` Po Lu
@ 2022-12-20 17:50 ` Dr Rainer Woitok
0 siblings, 0 replies; 7+ messages in thread
From: Dr Rainer Woitok @ 2022-12-20 17:50 UTC (permalink / raw)
To: Po Lu; +Cc: help-gnu-emacs
Po Lu,
On Tuesday, 2022-12-20 21:48:35 +0800, you wrote:
> ...
> Did you set `frame-resize-pixelwise' to t?
I didn't up to now. However, setting it changed neither size nor posi-
tion of the initial frame, but it slightly changed the window manager's
geometry information for the frames created via "C-x 5 Cf": it returned
"1040x950+58+58" for the first frame and "1040x950+87+46" for the sec-
ond, where the "1040x950" part probably is the "80x40" window size in
pixels, the difference between 58 and 87 still is 29 pixels to the right
while the difference between 58 and 46 is 12 pixels up, which might not
have had any effect in my former tests because these frames were already
at "+xxx+0", and thus going farther up was just not possible.
I had set "frame-resize-pixelwise" in my "init.el" file, but according
to the documentation this file is only read AFTER the initial frame has
been created. Upon further reading the documentation I finally found
frame parameter "user-position", and setting this to "t" in both vari-
ables, "default-frame-alist" and "initial-frame-alist" at least solved
the positioning problems for the frames opened via "C-x 5 C-f". Uff :-)
Another observation regarding the initial frame: when I open a new file
in these frames and enter "C-u 90 O", the gap in the uppermost line be-
tween the rightmost "O" and the continuation symbol in the fringe area
is roughly twice as wide in the "79x40" frame as in the "80x40" frames.
Could this indicate some rounding effect eventually causing the initial
frame becoming too wide and being cut off?
Sincerely,
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-12-20 17:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 18:29 Problems positioning and sizing Emacs frames Dr Rainer Woitok
2022-12-20 1:41 ` Po Lu
2022-12-20 11:37 ` Dr Rainer Woitok
2022-12-20 12:32 ` Po Lu
2022-12-20 13:34 ` Dr Rainer Woitok
2022-12-20 13:48 ` Po Lu
2022-12-20 17:50 ` Dr Rainer Woitok
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.