【问题标题】:in GNU Emacs OSX, how to hide title bar?在 GNU Emacs OSX 中,如何隐藏标题栏?
【发布时间】:2014-06-03 17:40:36
【问题描述】:

在 OSX Mavericks 上的 GNU Emacs 中,即使我不在 Mavericks 全屏模式下,如何隐藏标题栏?我宁愿让我的 Emacs 填满整个框架。

【问题讨论】:

  • 我认为这是不可能的——这是 OSX 内置的。
  • 为了减轻缓冲区顶部浪费空间的感觉,也许可以考虑在标题栏中放置一些有用的东西——例如,框架的标题,或者当前缓冲区的标题——框架标题栏在显示的消息方面是相当可定制的,并且可以根据需要进行更新。
  • @lawlist,可以隐藏菜单栏,也可以将框架标题放在屏幕上方,看我的回答。

标签: macos emacs fullscreen


【解决方案1】:

您可以将变量ns-auto-hide-menu-bar设置为非零值以隐藏菜单栏。

此外,如果您以编程方式执行此操作,您可以将窗口标题置于屏幕顶部上方。 (不过,OS X 不允许您将框架拖到屏幕顶部上方。)

例如:下面将可编辑区域定位在显示的顶部。

(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.

注意:这可能需要 Emacs 24.4(仍处于预测试阶段)。

或者,您可以使用包 Multicolumn 来定位和调整框架大小(它不是 OS X 特定的,但它知道自动隐藏菜单栏等功能。)

【讨论】:

  • 是的,它似乎不适用于当前版本的 GNU Emacs for OSX。
  • 即GNU Emacs 24.3.1
  • 我安装了 Multicolumn,现在怎么办?
  • @PeterSalazar,一个很好的起点是M-x multicolumn-resize-and-split-frame RET。此外,它知道ns-auto-hide-menu-bar,因此如果将其设置为t,它会(默认情况下)将标题放在屏幕顶部上方以最大化可编辑区域。
  • 嗯。当我运行multicolumn-reside-and-split-frame 时,我得到了这个:pastebin.com/hjrKj4BT
【解决方案2】:

编辑:我以--with-no-titlebarthe homebrew formula "emacs-plus" 贡献了这个补丁。


以下是 Jay McCarthy 对 an old patch 的更新。以下补丁与 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.

很多人称之为“无边界”,有时根本没有提到标题栏。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多