Verified Commit 6d6979da authored by Todor Kondic's avatar Todor Kondic
Browse files

Emacs and R work

parent ad55c0f6
# These are the options for the greeter session that can be set
# through GSettings. Any GSettings setting that is used by the
# greeter session can be set here.
# Note that you must configure the path used by dconf to store the
# configuration, not the GSettings path.
# Theming options
# ===============
# - Change the GTK+ theme
# gtk-theme='Adwaita'
# - Use another background
# picture-uri='file:///usr/share/themes/Adwaita/backgrounds/stripes.jpg'
# picture-options='zoom'
# - Or no background at all
# picture-options='none'
# primary-color='#000000'
# Login manager options
# =====================
# - Disable user list
# - Disable restart buttons
# - Show a login welcome message
banner-message-text="Welcome to Alien One, ISB401 students."
# Automatic suspend
# =================
# - Time inactive in seconds before suspending with AC power
# 1200=20 minutes, 0=never
# sleep-inactive-ac-timeout=1200
# - What to do after sleep-inactive-ac-timeout
# 'blank', 'suspend', 'shutdown', 'hibernate', 'interactive' or 'nothing'
# sleep-inactive-ac-type='suspend'
# - As above but when on battery
# sleep-inactive-battery-timeout=1200
# sleep-inactive-battery-type='suspend'
\ No newline at end of file
source "$HOME/.profile"
cd "$HOME"
mkdir .emacs.d
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"${HOME}/\")"
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://")))))
(require 'ob-tangle)
(defun my--tangle-byte-compile-org ()
"Tangles and byte compiles ~/.emacs.d/"
(when (equal (buffer-name)
(concat ""))
(byte-recompile-directory (expand-file-name user-emacs-directory) 0)))
(add-hook 'after-save-hook #'my--tangle-byte-compile-org)
(add-hook 'kill-emacs-hook #'my--tangle-byte-compile-org)
;; (add-hook 'org-export-before-processing-hook #'org-update-all-dblocks)
(defvar my-dotemacs "~/.emacs.d/")
(defvar my-custom "~/.emacs.d/custom.el")
(setq custom-file my-custom)
(if (file-exists-p my-dotemacs) (load my-dotemacs) nil)
(if (file-exists-p my-custom) (load my-custom) nil)
#+TITLE: Emacs settings
#+PROPERTY: header-args :tangle ~/.emacs.d/
# Emacs startup in Org
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "") t)
* Org Mode
** Babel
#+BEGIN_SRC emacs-lisp
;(load "~/.emacsincludes/org-ctags.el")
;(load "~/.emacsincludes/org.el")
'((maxima . t)
(R . t)
(python . t)))
** Dynamic Blocks
#+BEGIN_SRC emacs-lisp
(add-hook 'org-export-before-processing-hook (lambda (x) (org-update-all-dblocks)))
* Emacs Tweaks
#+BEGIN_SRC emacs-lisp
(savehist-mode 1)
(column-number-mode 1)
(scroll-bar-mode 0)
(tool-bar-mode 0)
;(menu-bar-mode 0)
(require 'use-package)
;; Save all tempfiles in $TMPDIR/emacs$UID/
(defconst emacs-tmp-dir (format "%s/%s/%s/%s" (getenv "HOME") "tmp" "emacs" (user-uid)))
(setq backup-directory-alist
`((".*" . ,emacs-tmp-dir)))
(setq auto-save-file-name-transforms
`((".*" ,emacs-tmp-dir t)))
(setq auto-save-list-file-prefix
(set-frame-font "Hack 12" nil t)
(show-paren-mode 1); Matches parentheses and such in every mode
(setq inhibit-splash-screen t); Disable splash screen
(setq calendar-week-start-day 1); Calender should start on Monday
(setq prettify-symbols-alist
("lambda" . 955) ; λ
("->" . 8594) ; →
("=>" . 8658) ; ⇒
("map" . 8614) ; ↦
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
(when (fboundp 'winner-mode)
(winner-mode 1))
(setq ring-bell-function 'ignore)
;; Status bar
(setq-default mode-line-format (list " " 'mode-line-modified ;; the "**" at the beginning
"--" 'mode-line-position ;; line, column, file %
"--" '(:eval (format-time-string "%c" (current-time)))
"--" 'mode-line-buffer-identification ;; buffer file name
"--" 'mode-line-modes ;; major and minor modes in effect
"-%-")) ;; dashes sufficient to fill rest of modeline.
(setq custom-file "~/.emacs.d/custom.el")
* Smartparens
#+BEGIN_SRC emacs-lisp
(require 'smartparens-config)
;; (add-hook 'ess-mode-hook 'turn-on-smartparens-strict-mode)
(add-hook 'ess-mode-hook 'turn-on-smartparens-mode)
(defmacro def-pairs (pairs)
"Define functions for pairing. PAIRS is an alist of (NAME . STRING)
conses, where NAME is the function name that will be created and
STRING is a single-character string that marks the opening character.
(def-pairs ((paren . \"(\")
(bracket . \"[\"))
defines the functions WRAP-WITH-PAREN and WRAP-WITH-BRACKET,
,@(cl-loop for (key . val) in pairs
`(defun ,(read (concat
(prin1-to-string key)
(&optional arg)
(interactive "p")
(sp-wrap-with-pair ,val)))))
(def-pairs ((paren . "(")
(bracket . "[")
(brace . "{")
;; (single-quote . "'")
(double-quote . "\"")
(back-quote . "`")))
:map smartparens-mode-map
("C-M-a" . sp-beginning-of-sexp)
("C-M-e" . sp-end-of-sexp)
("C-<down>" . sp-down-sexp)
("C-<up>" . sp-up-sexp)
("M-<down>" . sp-backward-down-sexp)
("M-<up>" . sp-backward-up-sexp)
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-n" . sp-next-sexp)
("C-M-p" . sp-previous-sexp)
("C-S-f" . sp-forward-symbol)
("C-S-b" . sp-backward-symbol)
("C-<right>" . sp-forward-slurp-sexp)
("M-<right>" . sp-forward-barf-sexp)
("C-<left>" . sp-backward-slurp-sexp)
("M-<left>" . sp-backward-barf-sexp)
("C-M-t" . sp-transpose-sexp)
("C-M-k" . sp-kill-sexp)
("C-k" . sp-kill-hybrid-sexp)
("M-k" . sp-backward-kill-sexp)
("C-M-w" . sp-copy-sexp)
("C-M-d" . delete-sexp)
("M-<backspace>" . backward-kill-word)
("C-<backspace>" . sp-backward-kill-word)
([remap sp-backward-kill-word] . backward-kill-word)
("M-[" . sp-backward-unwrap-sexp)
("M-]" . sp-unwrap-sexp)
("C-x C-t" . sp-transpose-hybrid-sexp)
("C-c (" . wrap-with-parens)
("C-c [" . wrap-with-brackets)
("C-c {" . wrap-with-braces)
("C-c '" . wrap-with-single-quotes)
("C-c \"" . wrap-with-double-quotes)
("C-c _" . wrap-with-underscores)
("C-c `" . wrap-with-back-quotes))
* Global Keys :keys:gkeys:
#+BEGIN_SRC emacs-lisp
;; (global-set-key (kbd "C-c m r") 'refill-mode)
(global-set-key (kbd "<escape>") 'god-local-mode)
(global-set-key (kbd "<f1> r") 'point-to-register)
(global-set-key (kbd "<f1> j") 'jump-to-register)
(global-set-key (kbd "<f9> a") 'auto-fill-mode)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "ESC ,") 'eshell)
(global-set-key (kbd "C-s") 'counsel-grep-or-swiper)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-c m") 'counsel-imenu)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-x j") 'counsel-file-jump)
(global-set-key (kbd "M--") 'dabbrev-expand)
;; (global-set-key (kbd "C--") 'undo)
(with-eval-after-load 'counsel-gtags
(define-key counsel-gtags-mode-map (kbd "M-t") 'counsel-gtags-find-definition)
(define-key counsel-gtags-mode-map (kbd "M-r") 'counsel-gtags-find-reference)
(define-key counsel-gtags-mode-map (kbd "M-s") 'counsel-gtags-find-symbol)
(define-key counsel-gtags-mode-map (kbd "M-,") 'counsel-gtags-go-backward))
(with-eval-after-load 'company-mode
(define-key company-active-map (kbd "M-n") nil)
(define-key company-active-map (kbd "M-p") nil)
(define-key company-active-map (kbd "M-,") 'company-select-next)
(define-key company-active-map (kbd "M-k") 'company-select-previous)
(define-key company-active-map [return] nil)
(define-key company-active-map [tab] 'company-complete-common)
(define-key company-active-map (kbd "TAB") 'company-complete-common)
(define-key company-active-map (kbd "M-TAB") 'company-complete-selection)
(setq company-dabbrev-downcase 0)
* Ivy
#+BEGIN_SRC emacs-lisp
(defun tk-default-completion ()
"Locally revert completion variables to their default values."
(setq-local completing-read-function #'completing-read-default)
(setq-local completion-in-region-function #'completion--in-region))
(setq ivy-use-selectable-prompt t)
(ivy-set-occur 'swiper 'swiper-occur)
(ivy-set-occur 'ivy-switch-buffer 'ivy-switch-buffer-occur)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(setq ivy-auto-select-single-candidate 1)
(global-set-key (kbd "C-s") 'counsel-grep-or-swiper)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-c m") 'counsel-imenu)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-x j") 'counsel-file-jump)
* Tramp
#+BEGIN_SRC emacs-lisp
(setq tramp-default-method "ssh")
* Company Mode
#+BEGIN_SRC emacs-lisp
(setq company-dabbrev-downcase nil)
(setq company-dabbrev-ingore-case 1)
(setq company-idle-delay 0.3)
(setq company-minimum-prefix-length 1)
* Eshell
#+BEGIN_SRC emacs-lisp
(require 'eshell)
(require 'em-smart)
(setq eshell-where-to-jump 'begin)
(setq eshell-review-quick-commands nil)
(setq eshell-smart-space-goes-to-end t)
* Scheme
** Guile
#+BEGIN_SRC emacs-lisp
;;; define* now works
(setq guile-imenu-generic-expression
"^(\\(define\\*\\)\\s-+(?\\(\\sw+\\)" 2))
(put 'define* 'scheme-ident-function 1)
** Paredit
#+BEGIN_SRC emacs-lisp
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook 'enable-paredit-mode)
** Company
#+BEGIN_SRC emacs-lisp
;;(add-hook 'scheme-mode-hook #'enable-mode)
** Geiser
#+BEGIN_SRC emacs-lisp
(setq geiser-guile-binary '("guile" "--no-auto-compile"))
(setq geiser-implementations-alist '("guile"
((regexp "\\.scm$")
(setq geiser-default-implementation 'guile)
(setq geiser-active-implementations '(guile))
(setq geiser-guile-manual-lookup-nodes '("Guile" "guile" "guile-2.0" "guile-2.2"))
(setq geiser-guile-load-path (mapcar (lambda (p) (concat (getenv "HOME") "/" p))
(add-hook 'scheme-mode-hook
(lambda ()
(defun guile--manual-look-up (id mod)
(let ((info-lookup-other-window-flag
(info-lookup-symbol (symbol-name id) 'geiser-guile-mode))
(when geiser-guile-manual-lookup-other-window-p
(switch-to-buffer-other-window "*info*"))
(search-forward (format "%s" id) nil t))))
* Python
#+BEGIN_SRC emacs-lisp
(setq python-shell-interpreter "python3")
#+BEGIN_SRC emacs-lisp
(add-hook 'ess-mode-hook 'company-mode)
(require 'ess)
(require 'ess-site)
(setq display-buffer-alist
`(("*R Dired"
(display-buffer-reuse-window display-buffer-in-side-window)
(side . right)
(slot . -1)
(window-width . 0.33)
(reusable-frames . nil))
(display-buffer-reuse-window display-buffer-at-bottom)
(window-width . 0.5)
(reusable-frames . nil))
(display-buffer-reuse-window display-buffer-in-side-window)
(side . right)
(slot . 1)
(window-width . 0.33)
(reusable-frames . nil))))
(setq ess-style 'RStudio)
;; (setq skeleton-pair t)
;; (define-key ess-mode-map (kbd "(") 'skeleton-pair-insert-maybe)
;; (define-key ess-mode-map (kbd "[") 'skeleton-pair-insert-maybe)
;; (define-key ess-mode-map (kbd "{") 'skeleton-pair-insert-maybe)
;; (define-key ess-mode-map (kbd "\"") 'skeleton-pair-insert-maybe)
;; (define-key ess-mode-map (kbd "\'") 'skeleton-pair-insert-maybe)
;; (define-key ess-mode-map (kbd "\`") 'skeleton-pair-insert-maybe)
......@@ -25,9 +25,10 @@ fi
if [ -d "$HOME/.local/bin" ] ; then
. "$GUIX_PROFILE/etc/profile"
export PATH="$HOME/.guix-profile/bin:$PATH"
export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
......@@ -4,4 +4,5 @@ alien-one ansible_host=
......@@ -27,8 +27,16 @@
- include: tasks/ufw.yml
- include: tasks/guix.yml
tags: guix
- include: tasks/visual-appeal.yml
tags: visual
- include: tasks/emacs.yml
tags: emacs
- name: Restart xinetd.
command: systemctl restart xinetd
- name: Update dconf.
command: dconf update
- name: Restart gdm.
command: systemctl restart gdm3
- name: Copy .emacs.
src: files/home/user/.emacs
dest: "/home/{{ item.login }}/.emacs"
become_user: "{{ item.login }}"
loop: "{{ users }}"
- name: Copy
src: files/home/user/
dest: "/home/{{ item.login }}/"
become_user: "{{ item.login }}"
loop: "{{ users }}"
- name: Copy config-emacs.
src: files/home/user/.config/config-emacs
dest: "/home/{{ item.login }}/.config/config-emacs"
mode: 0744
owner: "{{ item.login }}"
loop: "{{ users }}"
- name: Configure emacs.
command: /home/{{ item.login }}/.config/config-emacs
become_user: "{{ item.login }}"
loop: "{{ users }}"
- name: Copy the greeter config.
src: files/etc/gdm3/greeter.dconf-defaults
dest: /etc/gdm3/greeter.dconf-defaults
- Update dconf.
- Restart gdm.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment