Start moving to an Org-based config

This commit is contained in:
Gergely Polonkai 2018-07-29 18:38:44 +02:00
parent a0df2bbc2b
commit c16ff8cbc0
3 changed files with 109 additions and 45 deletions

3
.gitignore vendored
View File

@ -32,3 +32,6 @@
# Newsticker # Newsticker
/newsticker /newsticker
# The “compiled” version of the Org configuration
/configuration.el

103
configuration.org Normal file
View File

@ -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 dont 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 (thats why Nyan-cat is here), the toolbar (I dont 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

46
init.el
View File

@ -22,25 +22,8 @@
'("org" . "http://orgmode.org/elpa/") t) '("org" . "http://orgmode.org/elpa/") t)
(package-initialize) (package-initialize)
(setq-default use-package-always-ensure t) ;; I started moving my configuration to this Org file. Its easier to document this way.
(org-babel-load-file (expand-file-name "configuration.org" user-emacs-directory))
(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/")))
;; Load my own functions ;; Load my own functions
(load "gnu-c-header") (load "gnu-c-header")
@ -55,21 +38,6 @@
(load "xdg-paths") (load "xdg-paths")
(load "utils") (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 (thats why Nyan-cat is here),
;; the toolbar (I dont 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 () (defun termux-p ()
"Check if Emacs is running under Termux." "Check if Emacs is running under Termux."
(string-match-p (string-match-p
@ -505,9 +473,6 @@
("M-g w" . avy-goto-word-1) ("M-g w" . avy-goto-word-1)
("M-g e" . avy-goto-word-0))) ("M-g e" . avy-goto-word-0)))
(use-package diminish
:defer t)
(use-package focus (use-package focus
:bind :bind
(([f8] . focus-mode))) (([f8] . focus-mode)))
@ -736,10 +701,6 @@
:config :config
(global-hungry-delete-mode)) (global-hungry-delete-mode))
(use-package hl-line
:config
(global-hl-line-mode))
(use-package eww (use-package eww
:config :config
(setq eww-search-prefix "https://www.google.com/?q=")) (setq eww-search-prefix "https://www.google.com/?q="))
@ -1240,9 +1201,6 @@ INFO plist."
(push-mark isearch-other-end) (push-mark isearch-other-end)
(activate-mark)) (activate-mark))
;; Set up some global minor modes
(global-prettify-symbols-mode t)
;; Enable some functions ;; Enable some functions
(put 'downcase-region 'disabled nil) (put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil) (put 'upcase-region 'disabled nil)