Understanding Unrated Frame Locations for emacs

Asked 1 years ago, Updated 1 years ago, 84 views

When using emacs, I see unrated frame positions (?) such as (left+-7).(For example, if you launch as emacs-q in your environment and evaluate (frame-parameters(window-frame(selected-window)) in *scratch*, you will see ...(top.96)(left+-10)... output.)

When you try to save these left values to a file in the form of an associative list, take the expression read-from-string at startup, and set it to set-frame-position, *Backtrace* displays the following error:

Debugger entered --Lisp error: (wrong-type-argument integerp(+-10))
  set-frame-position (#<frame emacs@xxx0xyyyyyyyyy;(+-10)14)
<Abbreviated>

I was able to resolve this error first by eval, but please let me know if there are any better ways (for example, best practices for saving configurations in Formula S, frame-parameters returned associative lists without evaluation).

emacs elisp

2022-09-30 14:58

1 Answers

The frame-parameter left is usually

 (frame-parameter nil'left)
= > 390

Returns as an integer, as shown in , but if frame is located to the left of the far left of the screen,

 (frame-parameter nil'left)
=>(+-10)

It seems to be returned in S expression as shown in .

In set-frame-position, if left is negative, it will be specified from the far right of the screen.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-and-Position.html#Size-and-Position

Function:set-frame-position frame left top
This function sets the position of the top left corner of frame to left and top. These arguments are measured in pixels, and normally count from the top left corner of the screen.

Negative parameter values position the bottom edge of the window up from the bottom edge of the screen, or the right window edge to the left of the right edge of the screen. It would probably be better if the values were always counted from the left and top, so that negative arguments would position the frame partly off the top or left edge of the screen, but it seems inadvisable to change that now.

In the current set-frame-position, it seems impossible to place the frame to the left rather than the far left, so in that case, it should be zero.


2022-09-30 14:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.