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

5
.gitignore vendored
View File

@ -31,4 +31,7 @@
/.sx/
# 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)
(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. Its 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 (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 ()
"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)