如何在启动时在Windows上最大化Emacs? [英] How to maximize Emacs on Windows at startup?

查看:254
本文介绍了如何在启动时在Windows上最大化Emacs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我疯狂:我只是希望Emacs能够最大限度地发挥启动时的任何屏幕分辨率。理想情况下,我喜欢可以在任何屏幕分辨率下工作的跨平台(Windows& Linux)解决方案,但是即使是硬编码的尺寸,我甚至无法使用Window XP。



这是我试过的:


  1. 设置初始框架适当的高度/宽度

  2. 设置default-frame-alist

  3. (Windows特定的东西)发送消息到emacs窗口,告诉它最大化通过(w32-send-sys-command 61488)

  4. 尝试我在某处找到的这个功能:

     (defun toggle-fullscreen()
    切换当前所选帧是否消耗整个显示
    或装饰有窗口边框
    (interactive)
    (let((f(selected-frame)))
    (modify-frame-parameters
    f
    `((全屏),(if(eq nil(frame-parameter f'fullscreen))
    'fullboth
    nil))))))
    / pre>

  5. 尝试在init文件的开头和结尾的上述方法,以尝试消除其他init的东西。

不幸的是,上述都没有!对于上面的一些,我可以看到我的emacs窗口正确调整大小一秒钟,然后还原到较小的默认大小。如果我在初始化后运行上面的方法,emacs窗口DOES会正确调整大小。在这个世界上呢?



[p.s。还有其他SO问题,但没有一个答案可行]






更新: em>



答案让我想起我的init文件中的其他内容导致问题。确实是!经过一些尝试和错误,我发现了罪魁祸首。如果我注释了以下一行,一切都可以完美地运行:

 (tool-bar-mode  - 1)

工具栏与世界最大化窗口有什么关系?



所以现在的问题是:如何禁用工具栏(毕竟,emacs的工具栏是丑陋的,占用了宝贵的屏幕不动产),并在我的init文件?这可能是工具栏干扰窗口大小的错误?



澄清:(工具栏模式-1)关闭工具栏,但这条线会干扰最大化Emacs窗口。所以如果我尝试放置功能来最大化窗口并关闭工具栏,则最大化部分将失败;如果工具栏部分被注释掉,那么最大化部分就可以正常工作了。我甚至没有使用什么解决方案(在我列出的4项中)。






解决方案: (或至少为我工作现在)



这可能是Emacs中的一个错误。解决方法是通过注册表禁用工具栏,而不是.emacs。将以下内容保存为.reg文件,并在Windows资源管理器中执行该文件:

  Windows注册表编辑器版本5.00 

[HKEY_CURRENT_USER\Software\GNU\Emacs]
Emacs.Toolbar= - 1
pre>

(此解决方案是OtherMichael建议的工作版本)。

解决方案>

我发现一年或一年的答案,这解释了你必须操作注册表做正确的事情:


要启动Emacs最大化,将这行
放在〜/ .emacs的末尾文件:




 (w32-send-sys-command 61488)




如果您不想要Emacs工具栏
,您可以添加行(工具栏模式-1) [注意:原始页面上的值为0]
到您的〜/ .em acs文件,但Emacs不会
在这种情况下完全最大化 - 工具栏占用的真实
属性是
丢失。您必须在注册表中禁用工具栏
才能恢复:




  [HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs\Emacs.Toolbar] 
@ =0

如果您在 W32SendSys命令代码下查看EmacsWiki,会发现 61488 最大化当前框架


This is driving me crazy: I simply want Emacs to maximize to whatever screen resolution I have at startup. Ideally I like a cross-platform (Windows & Linux) solution that works on any screen resolution, but I can't even get it to work on just Window XP with even hard-coded sizes.

Here are what I tried:

  1. Setting the initial-frame-alist with appropriate height/width
  2. Setting the default-frame-alist
  3. (Windows specific stuff) Sending message to the emacs windows telling it to maximize via (w32-send-sys-command 61488)
  4. Tried this function which I found somewhere:

    (defun toggle-fullscreen ()
      "toggles whether the currently selected frame consumes the entire display
    or is decorated with a window border"
      (interactive)
      (let ((f (selected-frame)))
        (modify-frame-parameters 
         f
         `((fullscreen . ,(if (eq nil (frame-parameter f 'fullscreen)) 
                              'fullboth
                            nil))))))
    

  5. Tried the above methods in both beginning and end of my init file to try to eliminate interference from other init things.

Unfortunately, none of the above works!! For some of the above, I can see my emacs windows resizes correctly for a split second before reverting back to the smallish default size. And if I run the methods above after the initialization, the emacs windows DOES resize correctly. What in the world is going on here?

[p.s. there are other SO questions on this but none of the answers work]


Update:

The answers make me think that something else in my init file is causing the problem. And indeed it is! After some try-and-error, I found the culprit. If I commented out the following line, everything works perfectly:

(tool-bar-mode -1)

What in the world does the toolbar have to do with maximizing windows?

So the question now is: how can I disable toolbar (after all, emacs's toolbar is ugly and takes up precious screen real-estate) AND maximize the windows both in my init file? It is possibly a bug that toolbar interferes with the windows size?

Clarification: (tool-bar-mode -1) turns the toolbar off, but this line interferes with maximizing the Emacs windows. So if I try put functions to maximize windows and turn off the toolbar, the maximize part will fail; if the toolbar part is commented out, then the maximize part will work ok. It does not even matter what solutions I use (among the 4 that I listed).


Solution: (or at least what work for me now)

This is probably a bug in Emacs. The workaround is to disable the toolbar through the Registry, not in .emacs. Save the following as a .reg file, and execute that file in Windows Explorer:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\GNU\Emacs]
"Emacs.Toolbar"="-1"

(This solution is a working version of what OtherMichael suggested).

解决方案

I found an answer a year-or-so back that explains you have to manipulate the registry to do things right:

To start Emacs maximized put this line at the end of your ~/.emacs file:

(w32-send-sys-command 61488)

If you don't want the Emacs tool bar you can add the line (tool-bar-mode -1) [NOTE: value is 0 on original page] to your ~/.emacs file but Emacs won't fully maximize in this case - the real estate occupied by the tool bar is lost. You have to disable the tool bar in the registry to get it back:

[HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs\Emacs.Toolbar]
@="0"

If you look in the EmacsWiki under W32SendSys command-codes you'll find that 61488 is maximize current frame

这篇关于如何在启动时在Windows上最大化Emacs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆