emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs on OS X development


From: Sudish Joseph
Subject: Re: Emacs on OS X development
Date: Sat, 14 Jul 2012 06:35:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (darwin)

chad <address@hidden> writes:
> Does this track the emacs 24.1 + mac 3.0 release (plus that small
> bugfix he posted to the list), or the development head + mac 3.0
> release? I'm more interested in following the dev tip than the mac
> port, and I'm having some trouble building a mac port branch that
> correctly understands macosx relocatable apps (it keeps trying to
> shove things into /usr/local).

https://github.com/railwaycat/emacs-mac-port contains a
build-emacs.app.sh script that builds the relocatable mac port app
you're looking for.  It doesn't track the dev tree, however.

It's been a couple months since I switched from tracking the bzr dev
tree and --with-ns to the mac port.  The big improvements for me are
font rendering, font scaling, fullscreen support and gesture support.
C-g seems to behave better in general.

It's the most native and smooth Emacs experience under OS X yet.  That
said, the ns port does have more integration in some places (open file
events are ignored by the mac port).

Emacs 24.1's ns port has ns-auto-hide-menu-bar and it's possible to
emulate fullscreen pretty reasonably using it.  See below for what I was
using for a good while.  The mac port provides native support for the
relevant frame parameters - it also supports Lion's new fullscreen mode.

-Sudish

(when (boundp 'ns-auto-hide-menu-bar)
  (define-key global-map [(super S-return)] 'sj/ns-toggle-menu-bar)
  (defun sj/ns-toggle-menu-bar ()
    "Toggle the auto-hide of the menu bar."
    (interactive)
    (setq ns-auto-hide-menu-bar (not ns-auto-hide-menu-bar)))
  (define-key global-map [(super return)] 'sj/ns-make-frame-fullscreen)
  (defun sj/ns-make-frame-fullscreen ()
    "Make the current frame fullscreen."
    (interactive)
    (setq ns-auto-hide-menu-bar t)
    (labels ((fp (p) (frame-parameter (selected-frame) p)))
      ;; Make this frame large enough to cover the whole screen.
      ;; set-frame-size takes character rows and columns, so convert
      ;; all the pixel-based values accordingly.
      (let* ((rows (/ (display-pixel-height) (frame-char-height)))
             (cols (/ (display-pixel-width)  (frame-char-width)))
             (fringe-pixels (+ (fp 'left-fringe) (fp 'right-fringe)))
             (fringe (/ fringe-pixels (frame-char-width)))
             (scrollbar (/ (fp 'scroll-bar-width) (frame-char-width)))
             (real-cols (- cols fringe scrollbar)))
        (set-frame-size (selected-frame) real-cols rows))
      ;; Move this frame's window decoration offscreen.
      ;; - The magic number here is the size of the decorator in pixels.
      ;; - vertical-gap is any leftover vertical space (pixels) after
      ;;   computing the number of rows above. We distribute this evenly
      ;;   at the top and bottom.
      ;; - vertical-offset must be negative to move the window decoration
      ;;   offscreen.
      (let* ((decorator-size 24)
             (vertical-gap (mod (display-pixel-height) (frame-char-height)))
             (vertical-offset (- (/ vertical-gap 2) decorator-size)))
        (set-frame-position (selected-frame) 0 vertical-offset)))))

(when (boundp 'mac-carbon-version-string)
  (defun sj/mac-carbon-toggle-frame-fullscreen ()
    "Make the current frame fullscreen."
    (interactive)
    (let* ((frame (selected-frame))
           (fs-param (if (eq (frame-parameter frame 'fullscreen) 'fullboth)
                         nil
                       'fullboth)))
      (set-frame-parameter frame 'fullscreen fs-param)))
  (define-key global-map [(super return)] 
'sj/mac-carbon-toggle-frame-fullscreen))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]