3
我正在使用Carbon Emacs 23,并试图在切换出全屏框架(由函数设置)之后将框架宽度设置为某个值。其实,奇怪的是,不仅宽度没有设置,而且如果您重复切换出全屏,帧变得越来越小,就像一个消失的窗口。欣赏任何想法,我尝试了几个不同的想法。这里是代码:在Emacs中设置框架大小开启全屏
(defun set-frame-size-according-to-resolution()
(interactive)
(if window-system
(progn
;; use 120 char wide window for largeish displays
;; and smaller 80 column windows for smaller displays
;; pick whatever numbers make sense for you
(if (> (x-display-pixel-width) 1280)
(add-to-list 'default-frame-alist (cons 'width 140))
(add-to-list 'default-frame-alist (cons 'width 100)))
;; for the height, subtract a couple hundred pixels
;; from the screen height (for panels, menubars and
;; whatnot), then divide by the height of a char to
;; get the height we want
(add-to-list 'default-frame-alist
(cons 'height (/ (- (x-display-pixel-height) 200) (frame-char-height)))))))
;;; This used to be in Carbon Emacs, puttin' it back in with my own twist
(defun mac-toggle-max-window()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen)
(progn
(scroll-bar-mode 1) ;; turn on scrollbars when not in fullscreen mode
(set-frame-size-according-to-resolution)
nil)
(progn
(scroll-bar-mode -1) ;; turn off scrollbars when in fullscreen mode
'fullboth))))
;;; Toggle full screen via CMD-Return (my meta key is mapped to command on OS X
(define-key global-map [(meta return)]
'mac-toggle-max-window)