我使用http://emacsformacosx.com/的mac emacs,當我啓動我的emacs時,我需要單擊最大化的圖標。如何使用Emacs作爲默認切換全屏?
如何將默認最大化的emacs窗口設置爲默認值?
我使用http://emacsformacosx.com/的mac emacs,當我啓動我的emacs時,我需要單擊最大化的圖標。如何使用Emacs作爲默認切換全屏?
如何將默認最大化的emacs窗口設置爲默認值?
Ryan McGeary的maxframe.el
對Aquamacs和Emacs.app都適合我。我通過EmacsWiki發現它:http://www.emacswiki.org/emacs/FullScreen。該頁面討論了現在是404頁面的修補版本,但原來的https://github.com/rmm5t/maxframe.el似乎工作正常。
您是否真的獲得了**完全**最大化的覆蓋範圍,就像您爲非emacs窗口所做的一樣。我只能將窗口擴展爲默認單聲道空間字體的全角字符寬度和高度的倍數。在我的(Ubuntu/GNU Emacs 23.1.1)系統上,這會在RHS和底部留下大約半個字符寬的邊界。我可以完全擴展窗口的唯一方法是通過窗口管理器的系統菜單的最大化選項左上角) – 2012-02-13 04:10:56
PS:我發現了另一個SO答案,它有一個適用於我的Linux X-Windows系統的方法:[在啓動時最大化emacs?(不是全屏)](http://stackoverflow.com/a/ 7763907/313821).... **取消那個!! **,它不起作用..它最大化垂直太多... *但是*,這兩種方法一起**做功**(奇怪的...也許有一天我會解決爲什麼?......但它現在可以工作(在我的月份之後,它會給我帶來麻煩!)感謝您的最大幀建議Jon O. – 2012-02-13 04:45:01
您可以通過emacs軟件包管理器並且Melpa也是如此。 – 2012-10-26 17:32:23
啓動Emacs這樣
emacs -mm
這裏是我寫的和使用的功能。當你succesivelly按F11,emacs的4種模式開關:
(defun switch-fullscreen nil
(interactive)
(let* ((modes '(nil fullboth fullwidth fullheight))
(cm (cdr (assoc 'fullscreen (frame-parameters))))
(next (cadr (member cm modes))))
(modify-frame-parameters
(selected-frame)
(list (cons 'fullscreen next)))))
(define-key global-map [f11] 'switch-fullscreen)
這對我來說很好,除了一個煩惱。當我達到'fullboth'模式時,框架會超越屏幕上的所有內容;也就是說,WM窗口標題欄消失,並且我的XFCE面板也消失在窗口後面(我正在使用Xubuntu)。 fullheight模式正常工作:幀只使用XFCE面板留下的垂直空間。我想'fullboth'模式的工作方式就好像我通過在標題欄中按下「+」按鈕來最大化WM窗口。任何想法如何實現? – 2012-10-16 09:24:17
這是gtk中的錯誤,而不是emacs中的錯誤。請報告給gtk開發者。 – alinsoar 2012-10-18 14:43:16
'fullboth'是一個用詞不當的人。它使Emacs以普通的Mac語言全屏顯示。 '最大化'使它充滿 - 兩個! – trss 2013-05-01 14:48:15
在https://stackoverflow.com/a/1029065/351716作品給我(與GNU Emacs的v24.2.1)的答案。出演,在.emacs
文件中定義瞭如下功能:
(defun x11-maximize-frame()
"Maximize the current frame (to full screen)"
(interactive)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
爲了方便,你可以在命令綁定到一個關鍵。我用的是C-z
關鍵,否則將減少幀,這是我已經沒有必要,但總是發現惱人的,當我打它小心:
(global-set-key (kbd "C-z") 'x11-maximize-frame)
正如我在我加入到這個問題的答案的評論指出,使用該命令在正常幀狀態和最大化狀態之間重複循環,但有一點煩惱:在這兩者之間,存在一個奇怪的狀態,其中幀幾乎不是垂直最大化。但這是一個小問題。
簡短的回答是以下內容添加到您的custom-set-variables
: -
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
...
'(initial-frame-alist (quote ((fullscreen . maximized))))
...
)
下面給出的是什麼我想作爲解決同樣的問題。 TL; DR。
我面臨同樣的問題,但在所有應用程序中,而不僅僅是在Emacs中。爲此,我將Mac上的快捷鍵cmd-m全局綁定到「縮放」菜單選項,該選項通常是綠色最大化按鈕的菜單選項。但Emacs不提供通常在Window菜單項下的Zoom菜單選項。所以我結束了以下。
我剛剛昨天晚上編碼了以下內容。
;; This defines cmd-m to do the same as clicking the green titlebar button
;; usually meant for the "Window -> Zoom" menu option in Mac apps
(defun zoom() "zoom, same as clicking the green titlebar button in Mac app windows"
(interactive)
(set-frame-parameter
nil 'fullscreen
(pcase (frame-parameter nil 'fullscreen)
(`nil 'fullheight)
(`fullheight 'maximized)
(`fullboth (ding) 'fullboth)
(`fullscreen (ding) 'fullscreen)
(_ nil))))
(global-set-key (kbd "s-m") 'zoom)
這在代碼的最後一行鍵盤快捷鍵與我的世界到Mac CMD + M鍵綁定,我最初描述順利。你可以定製它適合你。我習慣於按cmd-m啓動大多數應用程序,直到它適合屏幕,Emacs就是其中之一。所以我不打擾initial-frame-alist
設置。
我繼續通過今晚添加以下代碼來完成我想要的功能集。
;; This defines ctrl-cmd-f to do the same as clicking the toggle-fullscreen titlebar
;; icon usually meant for the "View -> Enter/Exit Full Screen" menu option in
;; Mac apps
(defun toggle-fullscreen() "toggle-fullscreen, same as clicking the
corresponding titlebar icon in the right hand corner of Mac app windows"
(interactive)
(set-frame-parameter
nil 'fullscreen
(pcase (frame-parameter nil 'fullscreen)
(`fullboth nil)
(`fullscreen nil)
(_ 'fullscreen))))
(global-set-key (kbd "C-s-f") 'toggle-fullscreen)
; For some weird reason C-s-f only means right cmd key!
(global-set-key (kbd "<C-s-268632070>") 'toggle-fullscreen)
有兩點要注意: -
pcase
從這個代碼,注意不要犯同樣的錯誤,像我一樣被誤讀反引號作爲報價在文檔中。fullscreen
是一個別名fullboth
,是不是名不副實像後者是作爲一個術語,這意味着什麼,因此我不僅處理這種情況下,作爲一種價值爲(frame-parameter nil 'fullscreen)
,但使用的是每當我想set-frame-parameter
到fullboth
HTH
您是否嘗試過在Emacs Wiki上尋找例如http://www.emacswiki.org/emacs/FullScreen#toc18和http://www.emacswiki.org/emacs/EmacsForMacOS#toc27?他們可能會或可能不會過時,我沒有Mac,所以我無法測試這個。 – 2012-02-12 13:39:16
我從emacsforosx.com獲得的Emacs發行版本遇到了相當大的麻煩;今天我從[這個已經徹底修補OS X的版本](https://github.com/railwaycat/emacs-mac-port)構建了一個新的Emacs,並且發現了更好的結果,包括適當的OS X全屏支持。希望這可以幫助! – 2013-08-09 20:06:09
@Eric失敗 - 添加OSX標記的問題在於,那些對Emacs一無所知並且傾向於投票並投票結束的人,因爲他們是錯誤的目標受衆。 – lawlist 2014-08-22 07:02:23