Emacsist RSS --- If never, make it ever: C-h C-h

It's Not A Bug


这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist

There’s more than just the splash screen to disable for a minimalistic looking Emacs setup. The menu, scroll and tool bar are a close second. While taking a look how one would customize the buttons of the latter, I’ve found a rather curious code snippet:

(if (featurep 'move-toolbar)
    (defcustom tool-bar-position 'top
      "Specify on which side the tool bar shall be.
Possible values are `top' (tool bar on top), `bottom' (tool bar at bottom),
`left' (tool bar on left) and `right' (tool bar on right).
Customize `tool-bar-mode' if you want to show or hide the tool bar."
      :version "24.1"
      :type '(choice (const top)
                     (const bottom)
                     (const left)
                     (const right))
      :group 'frames
      :initialize 'custom-initialize-default
      :set (lambda (sym val)
             (set-default sym val)
              (list (cons 'tool-bar-position val))))))

Emacs comes with rather rudimentary library support. You can use provide at the end of a library to inform the current Emacs session of it and require to load the library from load-path if it hasn’t been loaded before. If you’ve spotted usage of a library you wish to inspect,M-x find-library is your friend. Now, what’s unusual about the code snippet above is thatmove-toolbar is most definitely not a library and even weirder, it doesn’t seem to be unconditionally provided. Just what the hell is going on there?

#ifdef USE_GTK
  /* Provide x-toolkit also for GTK.  Internally GTK does not use Xt so it
     is not an X toolkit in that sense (USE_X_TOOLKIT is not defined).
     But for a user it is a toolkit for X, and indeed, configure
     accepts --with-x-toolkit=gtk.  */
  Fprovide (intern_c_string ("x-toolkit"), Qnil);
  Fprovide (intern_c_string ("gtk"), Qnil);
  Fprovide (intern_c_string ("move-toolbar"), Qnil);

  DEFVAR_LISP ("gtk-version-string", Vgtk_version_string,
               doc: /* Version info for GTK+.  */);
    char gtk_version[sizeof ".." + 3 * INT_STRLEN_BOUND (int)];
    int len = sprintf (gtk_version, "%d.%d.%d",
    Vgtk_version_string = make_pure_string (gtk_version, len, len, false);
#endif /* USE_GTK */

So, this is basically an #ifdef that’s been exported to the Lisp level. I can’t help but wonder why this couldn’t have just been made a variable…

原文出处: Vasilij Schneidermann
原文地址: http://emacshorrors.com/posts/its-not-a-bug.html
原文时间: 2016-01-08 04:19
本文地址: http://emacsist.com/10656
整理时间: 2016-01-08 13:17

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .