Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.3 KiB

  1. ;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks.
  2. ;;
  3. ;; Copyright (c) 2011-2012 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
  6. ;; URL: http://batsov.com/emacs-prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; This file is not part of GNU Emacs.
  10. ;;; Commentary:
  11. ;; We dispense with most of the point and click UI, reduce the startup noise,
  12. ;; configure smooth scolling and a nice theme that's easy on the eyes (zenburn).
  13. ;;; License:
  14. ;; This program is free software; you can redistribute it and/or
  15. ;; modify it under the terms of the GNU General Public License
  16. ;; as published by the Free Software Foundation; either version 3
  17. ;; of the License, or (at your option) any later version.
  18. ;;
  19. ;; This program is distributed in the hope that it will be useful,
  20. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;; GNU General Public License for more details.
  23. ;;
  24. ;; You should have received a copy of the GNU General Public License
  25. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  26. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  27. ;; Boston, MA 02110-1301, USA.
  28. ;;; Code:
  29. ;; the toolbar is just a waste of valuable screen estate
  30. ;; in a tty tool-bar-mode does not properly auto-load, and is
  31. ;; already disabled anyway
  32. (when (fboundp 'tool-bar-mode)
  33. (tool-bar-mode -1))
  34. ;; the menu bar is mostly useless as well
  35. ;; but removing it under OS X doesn't make much sense
  36. ;; For daemon mode, with-selected-frame seems to be required. Normal
  37. ;; mode seems to require with-selected-frame to be absent.
  38. (require 'server) ;;for server-running-p
  39. (defun prelude-frame-config (frame)
  40. "Custom behaviours for new frames."
  41. (if (eq system-type 'darwin)
  42. (if (server-running-p)
  43. (with-selected-frame frame
  44. (if (display-graphic-p)
  45. (modify-frame-parameters frame '((menu-bar-lines . 1)))
  46. (modify-frame-parameters frame '((menu-bar-lines . 0)))))
  47. (if (display-graphic-p)
  48. (modify-frame-parameters frame '((menu-bar-lines . 1)))
  49. (modify-frame-parameters frame '((menu-bar-lines . 0)))))
  50. (menu-bar-mode -1)))
  51. ;; run now
  52. (prelude-frame-config (selected-frame))
  53. ;; and later
  54. (add-hook 'after-make-frame-functions 'prelude-frame-config)
  55. ;; the blinking cursor is nothing, but an annoyance
  56. (blink-cursor-mode -1)
  57. ;; disable startup screen
  58. (setq inhibit-startup-screen t)
  59. ;; nice scrolling
  60. (setq scroll-margin 0
  61. scroll-conservatively 100000
  62. scroll-preserve-screen-position 1)
  63. ;; mode line settings
  64. (line-number-mode t)
  65. (column-number-mode t)
  66. (size-indication-mode t)
  67. ;; make the fringe (gutter) smaller
  68. ;; the argument is a width in pixels (the default is 8)
  69. (if (fboundp 'fringe-mode)
  70. (fringe-mode 4))
  71. ;; enable y/n answers
  72. (fset 'yes-or-no-p 'y-or-n-p)
  73. ;; more useful frame title, that show either a file or a
  74. ;; buffer name (if the buffer isn't visiting a file)
  75. (setq frame-title-format
  76. '("" invocation-name " Prelude - " (:eval (if (buffer-file-name)
  77. (abbreviate-file-name (buffer-file-name))
  78. "%b"))))
  79. ;; use zenburn as the default theme
  80. (load-theme 'zenburn t)
  81. (provide 'prelude-ui)
  82. ;;; prelude-ui.el ends here