emacs-everywhere icon indicating copy to clipboard operation
emacs-everywhere copied to clipboard

Specify Frame Options

Open theherk opened this issue 1 year ago • 1 comments

I'd like to control how the everywhere frame opens. It seems the eval statement actually launches the frame which means running with /opt/homebrew/bin/emacsclient --eval "(progn (emacs-everywhere) (toggle-frame-maximized))" doesn't work as hoped.

On my macos machine the popup launches mostly off the window every time, and I can't sort how to configure this without access to frame options.

Any help is appreciated.

theherk avatar Jul 28 '22 13:07 theherk

It seems I can affect size changes this way:

(setq emacs-everywhere-frame-parameters '((name . "emacs-everywhere") (height . 18) (width . 80)))

But positioning directives don't work, and this window is all over the place.

theherk avatar Jul 28 '22 14:07 theherk

The position is set in "emacs-everywhere-set-frame-position". The current behavior is relative to the cursor, the frame is barely visible when the cursor is at the bottom edge of the display. Maybe just put the frame at the bottom of the current display.

QiangF avatar Aug 17 '22 07:08 QiangF

I am settled with this:

 (require 'frame-cmds)
 (defun emacs-everywhere-set-frame-position ()
   "Set the size and position of the emacs-everywhere frame."
   (sleep-for 0.02)
   (move-frame-to-screen-bottom 0))

QiangF avatar Aug 18 '22 06:08 QiangF

 (defun emacs-everywhere-set-frame-position ()
   "Set the size and position of the emacs-everywhere frame."
   (sleep-for 0.02)
   (move-frame-to-screen-bottom 0))

Overriding an existing function like this is quite bad practice. Just remove emacs-everywhere-set-frame-position from emacs-everywhere-init-hooks and add your own function. This sort of difference in personal taste is exactly why that's customisable.

tecosaur avatar Aug 31 '22 16:08 tecosaur

Thanks for the response, @tecosaur. Unfortunately, the contents of this function you mention are precisely what I seek. I'm not sure why this is an invalid question. I'm sure there is a good reason the frame launches out of view every time, but I'm looking for how to resolve that.

theherk avatar Aug 31 '22 16:08 theherk

This is invalid in the sense that it's trying to use emacs-everywhere in a way it's not designed to handle.

Re: the behaviour you're trying to seek:

  • The behaviour you're seeing is from emacs-everywhere-set-frame-position
  • emacs-everywhere-set-frame-position is only run because it is in emacs-everywhere-init-hooks
  • you can remove emacs-everywhere-set-frame-position from emacs-everywhere-init-hooks and add your own function implementing whatever behaviour you want

tecosaur avatar Aug 31 '22 16:08 tecosaur

I suspect I am out of my depth here. I am not directly making any calls to emacs-everywhere-set-frame-position, so I presume it is happening in the doom module somewhere. I'm not sure how to get the behavior where it is on the screen, but that is a shortcoming of mine. Thanks for your time.

theherk avatar Aug 31 '22 16:08 theherk

  • emacs-everywhere-set-frame-position is only run because it is in emacs-everywhere-init-hooks

tecosaur avatar Aug 31 '22 17:08 tecosaur

Just to clarify, when you say "This is invalid in the sense that it's trying to use emacs-everywhere in a way it's not designed to handle," I assume that doesn't mean this is not designed to handle being on screen, but that is actually the only thing I mean to learn. I genuinely not clear on what I've done wrong here.

theherk avatar Aug 31 '22 17:08 theherk

"invalid" because tweaking the created frame properties via --eval is not the way emacs-everywhere has been designed to work.

tecosaur avatar Aug 31 '22 17:08 tecosaur

Cool. Am I barking up the wrong tree then by asking, what is the designed method for having this be on screen?

theherk avatar Aug 31 '22 17:08 theherk

IDK what you mean by "on screen", but:

you can remove emacs-everywhere-set-frame-position from emacs-everywhere-init-hooks and add your own function implementing whatever behaviour you want

tecosaur avatar Aug 31 '22 17:08 tecosaur

By on screen, I simply mean not off the screen as shown here.

Screenshot 2022-08-31 at 19 27 41

Nevertheless, it seems clear that the option is to learn how to write the function you reference. Thank you.

theherk avatar Aug 31 '22 17:08 theherk

Yep, so I'd use that function as a reference and tweak it so it works better for you. If there's a heuristic that you think generally improves the positioning logic, feel free to open a PR :slightly_smiling_face:.

tecosaur avatar Aug 31 '22 17:08 tecosaur