From c16ff8cbc09d78d793d8535a348060ef3a9acd8f Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 29 Jul 2018 18:38:44 +0200 Subject: [PATCH] Start moving to an Org-based config --- .gitignore | 5 ++- configuration.org | 103 ++++++++++++++++++++++++++++++++++++++++++++++ init.el | 46 +-------------------- 3 files changed, 109 insertions(+), 45 deletions(-) create mode 100644 configuration.org diff --git a/.gitignore b/.gitignore index 629a8a0..8807745 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,7 @@ /.sx/ # Newsticker -/newsticker \ No newline at end of file +/newsticker + +# The “compiled” version of the Org configuration +/configuration.el diff --git a/configuration.org b/configuration.org new file mode 100644 index 0000000..093ecb1 --- /dev/null +++ b/configuration.org @@ -0,0 +1,103 @@ +* Emacs configuration + +** Configure ~use-package~ + +#+BEGIN_SRC emacs-lisp + (unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + + (setq use-package-always-ensure t + use-package-verbose t) + + (require 'use-package) +#+END_SRC + +** Set up my personal keymap + +I set it up early so I can use it in ~use-package~ calls immediately. + +#+BEGIN_SRC emacs-lisp +(defvar gpolonkai/pers-map (make-sparse-keymap) + "My own, personal, keymap!") +(define-prefix-command 'gpolonkai/pers-map) +(define-key ctl-x-map "t" 'gpolonkai/pers-map) +#+END_SRC + +** I really don’t want to type more than I really must… + +#+BEGIN_SRC emacs-lisp +(defalias 'yes-or-no-p 'y-or-n-p) +#+END_SRC +* Set personal information + +** Who am I? Where am I? + +#+BEGIN_SRC emacs-lisp +(setq user-full-name "Gergely Polonkai" + user-mail-address "gergely@polonkai.eu" + calendar-latitude 47.4 + calendar-longitude 19.0 + calendar-location-name "Budapest, Hungary") +#+END_SRC + +* Add ~lisp/~ to ~load-path~ + +#+BEGIN_SRC emacs-lisp +(add-to-list 'load-path (expand-file-name + (convert-standard-filename "lisp/") + user-emacs-directory)) +#+END_SRC + +* UI preferences + +** Tweak window chrome + +Turn off the scroll bar (that’s why Nyan-cat is here), the toolbar (I don’t really use it), and +the menu bar (I rarely use it, and in those rare occasions I can simply turn it on.) + +Also, maximise the frame. + +#+BEGIN_SRC emacs-lisp +(tool-bar-mode 0) +(menu-bar-mode 0) +(when window-system + (scroll-bar-mode -1)) + +(set-frame-parameter nil 'fullscreen 'maximized) +#+END_SRC + +** Set the default font and configure font resizing + +#+BEGIN_SRC emacs-lisp +(set-face-attribute 'default t :font "Hack-10") +(set-frame-font "Hack-10" nil t) +#+END_SRC + +* Set up global minor modes provided by Emacs + +** Pretty lambdas + +Because we can. + +#+BEGIN_SRC emacs-lisp +(global-prettify-symbols-mode t) +#+END_SRC + +* ~use-package~ packages + +** Highlight the current line + +#+BEGIN_SRC emacs-lisp +(use-package hl-line + :config + (when window-system + (global-hl-line-mode))) +#+END_SRC + +** Hide certain modes from the mode line + +#+BEGIN_SRC emacs-lisp +(use-package diminish + :defer t) +#+END_SRC diff --git a/init.el b/init.el index eee0eb5..14ab945 100644 --- a/init.el +++ b/init.el @@ -22,25 +22,8 @@ '("org" . "http://orgmode.org/elpa/") t) (package-initialize) -(setq-default use-package-always-ensure t) - -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - -(use-package use-package) - -;; Set up my personal keymap early so I can use it in use-package -;; calls -(defvar gpolonkai/pers-map (make-sparse-keymap) - "My own, personal, keymap!") -(define-prefix-command 'gpolonkai/pers-map) -(define-key ctl-x-map "t" 'gpolonkai/pers-map) - -;; Add path to my custom lisp functions -(add-to-list 'load-path (concat - user-emacs-directory - (convert-standard-filename "lisp/"))) +;; I started moving my configuration to this Org file. It’s easier to document this way. +(org-babel-load-file (expand-file-name "configuration.org" user-emacs-directory)) ;; Load my own functions (load "gnu-c-header") @@ -55,21 +38,6 @@ (load "xdg-paths") (load "utils") -;; Define aliases -(defalias 'yes-or-no-p 'y-or-n-p) - -(set-face-attribute 'default t :font "Hack-10") -(set-frame-font "Hack-10" nil t) - -;; UI hacks: turn off the scroll bar (that’s why Nyan-cat is here), -;; the toolbar (I don’t really use it), and the menu bar (I rarely use -;; it, and in those rare occasions I can simply turn it on) -(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) -(if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) -;; Maximize the frame -(set-frame-parameter nil 'fullscreen 'maximized) - (defun termux-p () "Check if Emacs is running under Termux." (string-match-p @@ -505,9 +473,6 @@ ("M-g w" . avy-goto-word-1) ("M-g e" . avy-goto-word-0))) -(use-package diminish - :defer t) - (use-package focus :bind (([f8] . focus-mode))) @@ -736,10 +701,6 @@ :config (global-hungry-delete-mode)) -(use-package hl-line - :config - (global-hl-line-mode)) - (use-package eww :config (setq eww-search-prefix "https://www.google.com/?q=")) @@ -1240,9 +1201,6 @@ INFO plist." (push-mark isearch-other-end) (activate-mark)) -;; Set up some global minor modes -(global-prettify-symbols-mode t) - ;; Enable some functions (put 'downcase-region 'disabled nil) (put 'upcase-region 'disabled nil)