7

In GNU Emacs on OSX Mavericks, how can I hide the title bar even when I'm not in Mavericks full-screen mode? I'd rather have my Emacs fill the entire frame.

title bar

3
  • 3
    I don't think that's possible -- that is built-into OSX.
    – lawlist
    Commented Jun 3, 2014 at 18:10
  • To alleviate the perception about wasted space at the top of the buffer, perhaps consider putting something useful in the title bar -- e.g., the title of the frame, or the title of the current buffer -- the frame title bar is fairly customizable in terms of what message appears and can be updated as needed.
    – lawlist
    Commented Jun 3, 2014 at 21:11
  • 1
    @lawlist, it's possible to hide the menu bar, and it's possible to place the frame title above the top of the screen, see my answer. Commented Jun 3, 2014 at 21:22

3 Answers 3

8

In emacs-plus@29 put this line in your init.el:

(add-to-list 'default-frame-alist '(undecorated . t))
5

You can set the variable ns-auto-hide-menu-barto a non-nil value to hide the menu bar.

Also, you can position the window title above the top of the screen, if you do it programmatically. (OS X doesn't allow you to drag the frame above the top of the screen, though.)

For example: The following will position the editable area at the top of the display.

(setq ns-auto-hide-menu-bar t)
(set-frame-position nil 0 -24)
(tool-bar-mode 0)
(set-frame-size nil 150 80)     ;; Pick values matching your screen.

Note: This might require Emacs 24.4 (which is still in pretest).

Alternatively, you could use the package Multicolumn to position and resize the frame (it's not OS X specific, but it's aware of features like auto-hiding the menu bar.)

6
  • 2
    Yes, it doesn't seem to work in the current version of GNU Emacs for OSX. Commented Jun 4, 2014 at 4:50
  • 1
    i.e. GNU Emacs 24.3.1 Commented Jun 4, 2014 at 18:13
  • I installed Multicolumn, now what? Commented Jun 4, 2014 at 18:47
  • @PeterSalazar, a good starting point is M-x multicolumn-resize-and-split-frame RET. Also, it's aware of ns-auto-hide-menu-bar, so if you set it to t, it will (by default) place the title above the top of the screen to maximise the editable area. Commented Jun 4, 2014 at 19:00
  • 1
    Hmm. When I run multicolumn-reside-and-split-frame, I get this: pastebin.com/hjrKj4BT Commented Jun 5, 2014 at 19:49
4

EDIT: I've contributed this patch as --with-no-titlebar for the homebrew formula "emacs-plus".


Below is my update of an old patch by Jay McCarthy. The following patch is compatible with GNU Emacs 25.2:

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index d9ad0a5..9e52d0f 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -446,6 +446,7 @@ minibuffer-prompt-properties--setter
        (ns-use-native-fullscreen ns boolean "24.4")
              (ns-use-fullscreen-animation ns boolean "25.1")
              (ns-use-srgb-colorspace ns boolean "24.4")
+             (ns-use-titled-windows ns boolean "25.2")
        ;; process.c
        (delete-exited-processes processes-basics boolean)
        ;; syntax.c
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b44a73..d013101 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6775,11 +6775,13 @@ - (BOOL)isOpaque
    maximizing_resize = NO;
  #endif

-  win = [[EmacsWindow alloc]
+  win = [[EmacsFSWindow alloc]
              initWithContentRect: r
                        styleMask: (NSResizableWindowMask |
  #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
-                                  NSTitledWindowMask |
+                                  (ns_use_titled_windows ?
+                                   NSTitledWindowMask :
+                                   NSWindowStyleMaskBorderless) |
  #endif
                                    NSMiniaturizableWindowMask |
                                    NSClosableWindowMask)
@@ -6812,6 +6814,7 @@ - (BOOL)isOpaque
    [win setTitle: name];

    /* toolbar support */
+  if ( ns_use_titled_windows ) {
    toolbar = [[EmacsToolbar alloc] initForView: self withIdentifier:
                          [NSString stringWithFormat: @"Emacs Frame %d",
                                    ns_window_num]];
@@ -6833,6 +6836,7 @@ This avoids an extra clear and redraw (flicker) at frame creation.  */
    }
  #endif
    FRAME_TOOLBAR_HEIGHT (f) = 0;
+  }

    tem = f->icon_name;
    if (!NILP (tem))
@@ -8759,6 +8763,12 @@ Nil means use fullscreen the old (< 10.7) way.  The old way works better with
  This variable is ignored on OSX < 10.7 and GNUstep.  */);
    ns_use_srgb_colorspace = YES;

+  DEFVAR_BOOL ("ns-use-titled-windows", ns_use_titled_windows,
+     doc: /*Non-nil means to include a title on windows.  Nil means to
+omit the title on OSX >= 10.7.  This variable is ignored on OSX <
+10.7.  Default is nil.  */);
+  ns_use_titled_windows = NO;
+
    /* TODO: move to common code */
    DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
          doc: /* Which toolkit scroll bars Emacs uses, if any.

Many people call this "borderless", sometimes without referring to the title bar at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.