3

Whenever I open an info entry in emacs (C-h i) an additional frame pops up. On my system, it is too small and I'd love to have it in the top left corner, being wider and longer as it was created by default. The new frame is labeled "*info".

The same applies to the frame, that rises, whenever I use emacs various help functions (C-h k, C-h v, C-h f, ...). Those new frames are labaled "Help". This frame has a similar position and size, as the "info" frames.

I have defined a default-frame-alist as well as an initial-frame-alist in my ~.emacs file.

(setq initial-frame-alist
      '((top . 35)
        (right . 5)
        (width . 200)
        (height . 55) ))

(setq default-frame-alist
      '(
        ;(scroll-bar-foreground-color . "yellow")
        (vertical-scroll-bar . right)
        (scroll-bar-width . 17)
    (internal-border-width . 2) 
        (top . 20)
        (left . 10)
        (width . 120)
        (mouse-color . "yellow")
        (cursor-color . "red")
    ))

Those new frames are obviously not the initial frame. Therefore, it is okay to me, that the don't use the dimensions given in the 'initial-frame-alist'.

EDIT

This image shows the location of the two frames, after having pressed C-h i. AS you can see, a new frame "* info *" was opened on top of the initial frame (which is now in the background). Please notice also, the width of the new frame is not sufficient, to view the text, without breaking some longer lines. Furthermore, I'd love to have the new frame on the left screen side.

Additional frame on top of initial frame

But I'd like to define the dimensions as well. That would save me to use the mouse, to correct their size and location. Something like this is desired:

Desired Size and location of the new frame

(Obviously, I picked the frame with the mouse, moved it to its desired location and resized it with the mouse. I'd love to avoid using the mouse, instead I want to add some lisp code to my ~/.emacs to do this changes for me!

If I press than C-h k TAB I get another frame as shown here. This should also open on the left screen side (and not on the right side, as shown here).

Next additional frame *Help*

What do I have to add, to my '~.emacs' file, in order to define the size ('width' x 'height') and location ('left' and 'top') of this kind of frames.

Something like this (pseudocode)

(setq info-frame-alist
      '((top . 5)
        (left . 5)
        (width . 100)
        (height . 25) ))
(setq help-frame-alist
      '((top . 7)
        (left . 7)
        (width . 75)
        (height . 20) ))

Any suggestions?


EDIT

When I eval some functions in the new frames, I do get this kind of information:

(frame-root-window) ; => #<window 7 on *info*>

the number ("7" in this case) depends on how many buffers I have opened in the actual running emacs. But the text "info" is exact the title of the frame in question.

Valeriy
  • 377
  • 4
  • 16
Jan
  • 373
  • 2
  • 12
  • 1
    Do you see the same thing when you start Emacs using `emacs -Q` (no init file)? Otherwise, some of what you write seems unclear. E.g. `C-i` versus `C-h i`, and what do you mean by *"a new frame"*? If you use `C-i` multiple times do you end up with multiple Info frames? Seems like the recipe is not complete, or some of its description is not clear. – Drew Dec 23 '19 at 19:03
  • Here is a link to an example of how to set frame *location* (top / left) and size (height / width), including to a precise pixel setting if so desired: https://emacs.stackexchange.com/a/17354/2287 The frame parameters used in the linked example function `my-example-make-frame` can be used in both the `initial-frame-alist` and `default-frame-alist` if so desired; or, you can use `make-frame` with the desired specs and create frames programmatically at will. – lawlist Dec 23 '19 at 19:16
  • @Drew sorry, I had a mistake, that I corrected in my edit. `C-i` should have read `C-h i`. Yes, it doesn't matter, if you start emacs reading its init files or not. When I type 'C-h i' for the first time, I do get an new frame, presenting the content of the info directory. After having read the info, I press 'q' and the frame is icnoized (on MacOS/Aquamcs). When I type 'C-h i' again, the icon is reopend again and placed in at the former location on the screen. I wish to define the location and width of the frame in my init file, to avoid correcting it by hand/mouse. – Jan Dec 23 '19 at 22:02
  • @lawlist thanks, I have read that link. But this seems not to apply on the frames, that pop up, when opening the info pages or asking for emacs help. I am looking for some lisp code to put into my init files, that say somehting like 'setq help-frame-alist '((top . 2) (right . 2) (width . enough) (height . sufficient)))', so that the frame has autmatically the correct size (width x height) and location an the computer screen. – Jan Dec 23 '19 at 22:11
  • 1
    Are you referring to "frames" or "windows"? – Dan Dec 23 '19 at 22:40
  • Here is a link to a thread that depicts the differences between "frames" and "windows" in the context of the Emacs jargon that forum participants are accustomed to reading: https://emacs.stackexchange.com/questions/13583/whats-the-difference-between-a-buffer-a-file-a-window-and-a-frame The "frame" parameters are *not* used to control "window" size / position. – lawlist Dec 23 '19 at 23:04
  • Thanks for the edits. From your comment it sounds like the question text that says that you get a new frame etc. is incorrect. It sounds like the usual behavior: the existing `*info*` buffer, in its existing frame, is simply "mapped", that is, deiconified. If so, please edit the question, as it gives the impression you get multiple Info buffers and frames (unclear). Thx. – Drew Dec 23 '19 at 23:33
  • @Dan I am referring to "frames" in Emacs parlance, which are "windows" as in X-Windows-system. – Jan Dec 24 '19 at 08:58
  • @lawlist I I know the difference between "frame" and "window" in Emacs parlance. I added some screenshots to clarify the situation on my computer. – Jan Dec 24 '19 at 09:13
  • @Drew please see my screenshots. I do get an additional frame, as soon as I open the first time an info page (by typing e.g. `C-h i`), the focus changes into that newly frame. When I press `q` in that frame, the frame is mapped/iconized, the focus is back in the initial frame again. Pressing `C-h i` again, it is reopened, ... I do only get **one** frame for the info pages. But it is at the wrong location and has the wrong geometry, which is what I want to change! – Jan Dec 24 '19 at 09:18
  • *Please edit your question* to make such things clear. Comments can be deleted at any time. This is confusing: *"Whenever I open an info entry in emacs (C-h i) an additional frame pops up."* and *"The same applies to... Those new frames"*. You give the impression that you are getting multiple Info and Help frames. – Drew Dec 24 '19 at 16:18

1 Answers1

3

My suggestion would be to specify that *Help* and *info* buffers be special-display buffers.

You can customize option special-display-buffer-names, to specify that these buffers should be shown in their own frames at specific screen locations. You can also use option special-display-regexps, to handle multiple buffers *info*, *info<2>*,...

Simple example (but it's better to use M-x customize-option to set option values - that goes for default-frame-alist too):

(setq special-display-frame-alist '((left . 100) (top . 50)))

(add-to-list 'special-display-buffer-names "*Help*")
(add-to-list 'special-display-regexps "[*]info[*]\\(<[0-9]+>\\)?")

You can do more-complicated things, of course, such as putting the Help and Info frames at different locations or giving them other properties that are different.


[Be aware that the Emacs docs tell you that special-display-* things are considered deprecated, since you can do more, in much more complicated ways, using display-buffer-alist. When that was added to Emacs it was touted as a replacement for special-display-*, because it's more general. I don't consider special-display-* deprecated, personally. It's simple to use, to do a relatively simple job.]

Drew
  • 75,699
  • 9
  • 109
  • 225