From b45712de2629db8d7c18251d7cda4c981e88dc87 Mon Sep 17 00:00:00 2001 From: Grigory Shipunov Date: Mon, 1 May 2023 11:02:23 +0200 Subject: [PATCH] new fancy config --- .gitignore | 17 +- init.el | 523 ++++++-------------------------------- lisp/oxa/latex.el | 12 + lisp/oxa/misc.el | 16 ++ lisp/oxa/org.el | 67 +++++ lisp/oxa/sane-defaults.el | 56 ++++ lisp/oxa/utils.el | 20 ++ 7 files changed, 254 insertions(+), 457 deletions(-) create mode 100644 lisp/oxa/latex.el create mode 100644 lisp/oxa/misc.el create mode 100644 lisp/oxa/org.el create mode 100644 lisp/oxa/sane-defaults.el create mode 100644 lisp/oxa/utils.el diff --git a/.gitignore b/.gitignore index fdc606a..aef804d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,21 @@ +.org-id-locations +.tmp auto-save-list backups bookmarks +bookmarks custom.el +eln-cache +elpa +games games ido.last irony +org-latex-preview +org-roam.db projectile-bookmarks.eld +projects +racket-mode smex-items straight transient -games -bookmarks -org-roam.db -eln-cache -org-latex-preview -.org-id-locations -racket-mode diff --git a/init.el b/init.el index b84ea88..6eac734 100644 --- a/init.el +++ b/init.el @@ -1,249 +1,86 @@ -;;; init.el --- emacs configuration -*- lexical-binding: t; -*- -;;; Commentary: -;;; M-x 🦋 -;;; Code: -;; bug in emacs<26.3 -(if (version< emacs-version "26.3") - (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) +(add-to-list 'load-path "~/.emacs.d/lisp/") +;;; basic bits +(require 'oxa/sane-defaults) +(require 'oxa/utils) +(require 'oxa/misc) -(defconst oxa/using-native-comp (and (fboundp 'native-comp-available-p) - (native-comp-available-p))) +(require 'oxa/org) +(require 'oxa/latex) -(if oxa/using-native-comp - (setq native-comp-deferred-compilation t - native-comp-async-query-on-exit t - native-comp-async-jobs-number 6 - native-comp-async-report-warnings-errors nil)) +;;; theme +(oxa/insure 'gruber-darker-theme) +(load-theme 'gruber-darker t) +(set-face-italic 'font-lock-comment-face t) +(set-face-italic 'font-lock-comment-delimiter-face nil) +(global-display-line-numbers-mode) +(setq-default indicate-empty-lines t) +(setq-default show-trailing-whitespace t) +(add-hook 'prog-mode-hook '(lambda () (whitespace-mode t))) -;; Change some settings based on where we are -(defvar oxa-workplace "home") - -(if (string= oxa-workplace "work") - ;; here we have our work proxy - (message "we are at work")) - -;; package management with straight.el -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - -;; Use use-package for sugar, but use straight.el under the hood -(straight-use-package 'use-package) - -;; clean up the modeline -(straight-use-package 'diminish) -(diminish 'auto-revert-mode) - -(menu-bar-mode -1) -(when (display-graphic-p) - (toggle-scroll-bar -1) - (tool-bar-mode -1)) -(global-display-line-numbers-mode -1) -(column-number-mode 1) -(setq inhibit-startup-screen t) -(setq-default indicate-buffer-boundaries 'left) -(setq auto-save-default nil) -(setq visible-bell t) -;; (setq-default fill-column 80) - -;; I'm the only cowboy on this mainframe -;; (setq create-lockfiles nil) - -;; X is dead -(setq inhibit-x-resources t) - -(straight-use-package 'nyan-mode) -(nyan-mode 1) - -(straight-use-package 'which-key) -(which-key-mode) -(diminish 'which-key-mode) - -;; use ibuffer instead of standard buffer list -(global-set-key (kbd "C-x C-b") 'ibuffer) +;;; package management +(require 'package) +(package-initialize) +(setq package-native-compile t + native-comp-async-report-warnings-errors nil) +;;; soruces +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +;;; personal framework bits ;; my personal keymap (define-prefix-command 'oxamap) (global-set-key (kbd "C-z") 'oxamap) +;; bind compile +(define-key 'oxamap (kbd "c") 'compile) -(fset 'yes-or-no-p 'y-or-n-p) -(setq confirm-nonexistent-file-or-buffer nil) - -(defadvice term-handle-exit - (after term-kill-buffer-on-exit activate) - "Advice term to kill buffer after shell exits." - (kill-buffer)) - -(defun my-whitespace-hook () - "Hook to show trailing whitespace and empty lines." - (setq show-trailing-whitespace t - indicate-empty-lines t)) - -(add-hook 'prog-mode-hook #'my-whitespace-hook) -(add-hook 'text-mode-hook #'my-whitespace-hook) - -(defun oxa/graphical-setup () - "Setup bits for non-terminal frames." - (if (window-system) - (progn - (use-package modus-themes - :straight t - :init - (setq modus-themes-italic-constructs t - modus-themes-bold-constructs t - modus-themes-mixed-fonts nil - modus-themes-subtle-line-numbers 'nil) - (modus-themes-load-themes) - :config - (modus-themes-load-vivendi) - :bind (:map oxamap ("\\" . modus-themes-toggle))) - - ;; use modern pdf-tools - (straight-use-package 'pdf-tools) - (pdf-loader-install) - ;; theme pdf automagically - (add-hook 'pdf-tools-enabled-hook 'pdf-view-themed-minor-mode)))) - -(defun oxa/frame-functions (frame) - (with-selected-frame frame - (oxa/graphical-setup))) - -;; for stand-alone emacs -(oxa/graphical-setup) -;; for emacsclient -(add-hook 'after-make-frame-functions #'oxa/frame-functions) - - -;; let's delete a tab as a whole... -(setq backward-delete-char-untabify-method 'nil) - -;; smarttabs! -(straight-use-package 'smart-tabs-mode) -(smart-tabs-insinuate 'c 'c++) - -(setq-default indent-tabs-mode 'nil) +;;; tabs hooks (defun tabs-yay () "Function to enable tab indentation in buffer." (setq indent-tabs-mode t)) (add-hook 'c-mode-hook 'tabs-yay) -;; highlight the parens -(setq show-paren-delay 0) -(show-paren-mode 1) +;;; expand region +(oxa/insure 'expand-region) +(require 'expand-region) +(global-set-key (kbd "C-=") 'er/expand-region) -;; follow symlinks to version-controlled files -(setq vc-follow-symlinks t) +;;; move text +(oxa/insure 'move-text) +(global-set-key (kbd "M-n") 'move-text-down) +(global-set-key (kbd "M-p") 'move-text-up) -(setq read-extended-command-predicate - #'command-completion-default-include-p) -(setq enable-recursive-minibuffers t) +;;; ido/smex for completion +(oxa/insure 'smex) +(oxa/insure 'ido-completing-read+) +(require 'ido) +(require 'ido-completing-read+) +(setq ido-require-flex-matching t) +(setq ido-everywhere t) +(ido-mode 1) +(ido-ubiquitous-mode 1) -;; backup management -(setq backup-directory-alist `(("." . "~/.emacs.d/backups"))) -(setq delete-old-versions t - kept-new-versions 6 - kept-old-versions 2 - version-control t) +;; direnv +(oxa/insure 'direnv) +(direnv-mode 1) -;; completion framework -(use-package vertico - :straight t - :init - (vertico-mode)) +;; magit +(oxa/insure 'magit) +(require 'magit) +(global-set-key (kbd "C-x g") 'magit-status) +(global-set-key (kbd "C-x M-g") 'magit-dispatch) +(global-set-key (kbd "C-c M-g") 'magit-file-dispatch) +;;; Language support +(oxa/insure 'nix-mode) +(setq nix-nixfmt-bin "nixpkgs-fmt") +(oxa/insure 'markdown-mode) +(oxa/insure 'yaml-mode) -(use-package orderless - :straight t - :init - (setq completion-styles '(orderless basic) - completion-category-defaults nil - completion-category-overrides '((file (styles partial-completion))))) +(oxa/insure 'rust-mode) +(require 'rust-mode) +(oxa/hook rust-mode-hook + (setq-local fill-column 100)) -(use-package marginalia - :straight t - :bind (:map minibuffer-local-map - ("M-A" . marginalia-cycle)) - :init (marginalia-mode)) - -(use-package consult - :straight t - :bind ;; C-c bindings (mode-specific-map) - (("C-c h" . consult-history) - ("C-c m" . consult-mode-command) - ("C-c k" . consult-kmacro) - ;; C-x bindings (ctl-x-map) - ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command - ("C-x b" . consult-buffer) ;; orig. switch-to-buffer - ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window - ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame - ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump - ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer - ;; Custom M-# bindings for fast register access - ("M-#" . consult-register-load) - ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) - ("C-M-#" . consult-register) - ;; Other custom bindings - ("M-y" . consult-yank-pop) ;; orig. yank-pop - (" a" . consult-apropos) ;; orig. apropos-command - ;; M-g bindings (goto-map) - ("M-g e" . consult-compile-error) - ("M-g f" . consult-flycheck) ;; Alternative: consult-flycheck - ("M-g g" . consult-goto-line) ;; orig. goto-line - ("M-g M-g" . consult-goto-line) ;; orig. goto-line - ("M-g o" . consult-outline) ;; Alternative: consult-org-heading - ("M-g m" . consult-mark) - ("M-g k" . consult-global-mark) - ("M-g i" . consult-imenu) - ("M-g I" . consult-imenu-multi) - ;; M-s bindings (search-map) - ("M-s d" . consult-find) - ("M-s D" . consult-locate) - ("M-s g" . consult-grep) - ("M-s G" . consult-git-grep) - ("M-s r" . consult-ripgrep) - ("M-s l" . consult-line) - ("M-s L" . consult-line-multi) - ("M-s m" . consult-multi-occur) - ("M-s k" . consult-keep-lines) - ("M-s u" . consult-focus-lines) - ;; Isearch integration - ("M-s e" . consult-isearch-history) - :map isearch-mode-map - ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string - ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string - ("M-s l" . consult-line) ;; needed by consult-line to detect isearch - ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch - ;; Minibuffer history - :map minibuffer-local-map - ("M-s" . consult-history) ;; orig. next-matching-history-element - ("M-r" . consult-history)) ;; orig. previous-matching-history-element - - ;; Enable automatic preview at point in the *Completions* buffer. This is - ;; relevant when you use the default completion UI. - :hook (completion-list-mode . consult-preview-at-point-mode)) - - -;; autocompletion by default -(straight-use-package 'company) -(global-company-mode 1) -(diminish 'company-mode) - -;; better tree mode -(use-package neotree - :straight t - :bind (:map oxamap ("f" . 'neotree-toggle))) - -;; CC mode default styles (require 'cc-mode) (setq c-default-style '((java-mode . "java") (awk-mode . "awk") @@ -251,235 +88,21 @@ (c++-mode . "stroustrup") (other . "stroustrup"))) -(require 'calendar) -(setq calendar-week-start-day 1) +;; completion +(oxa/insure 'company) +(global-company-mode) -(use-package ace-window - :straight t - :defer t - :bind (:map oxamap ("o" . ace-window))) +(custom-set-variables + '(whitespace-style + (quote + (face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark)))) -(use-package tex-site - :defer t - :straight auctex - :init - ;; reftex - (require 'reftex) - - ;; basic config - (add-hook 'LaTeX-mode-hook 'TeX-PDF-mode) - (add-hook 'LaTeX-mode-hook 'reftex-mode) - (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) - (setq TeX-parse-self t) - (setq reftex-plug-into-AUCTeX t) - - ;; preview - (setq TeX-view-program-selection '((output-pdf "PDF Tools")) - TeX-source-correlate-mode t - TeX-source-correlate-start-server t) - - (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer) - - ;; completion for LaTeX - (use-package company-auctex - :straight t - :config - (company-auctex-init))) - -(use-package rainbow-delimiters - :straight t - :hook ((emacs-lisp-mode . rainbow-delimiters-mode) - (lisp-mode . rainbow-delimiters-mode) - (scheme-mode . rainbow-delimiters-mode) - (inferior-scheme-mode . rainbow-delimiters-mode) - (geiser-mode . rainbow-delimiters-mode) - (cc-mode . rainbow-delimiters-mode))) - -(use-package org - :straight t - :commands (org-agenda - org-capture) - :bind (("C-c a" . org-agenda) - ("C-c c" . org-capture) - ("C-c l" . org-store-link) - :map org-mode-map - ("C-c 1" . org-time-stamp-inactive)) - :init - ;; we need indentation - (setq org-startup-indented nil - org-indent-mode-turns-on-hiding-stars nil - org-hide-leading-stars nil - org-startup-folded 'content) - ;; default agenda files - (setq org-agenda-files '("~/org/" "~/Seafile/ORG/")) - - ;; default agenda view - (setq org-agenda-start-day "-3d" - org-agenda-span 13) - ;; templates - (setq org-capture-templates - '(("n" "note" entry - (file+headline "~/org/random.org" "Notes") - "** %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n") - ("t" "TODO" entry - (file+headline "~/org/random.org" "Tasks") - "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n") - ("w" "IFW Note" entry - (file+headline "~/Seafile/ORG/ifw.org" "ifw-notes") - "** %?\n%i\n%U\n:PROPERTIES:\n:CREATED: %U\n:END:\n") - ("j" "Journal" entry - (file+olp+datetree "~/org/log.org.gpg") - "**** %U %?\n") - ("b" "Bookmark" entry - (file+headline "~/org/bookmarks.org" "bookmarks-inbox") - "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n[[%x]]\n"))) - ;; autosave advises for agenda and org-capture - (advice-add 'org-agenda-quit :before 'org-save-all-org-buffers) - (advice-add 'org-capture-finalize :after 'org-save-all-org-buffers) - (advice-add 'org-capture-refile :after 'org-save-all-org-buffers) - - ;; latex preview settings - (setq org-preview-latex-image-directory "~/.emacs.d/org-latex-preview/") ; Hide all previews in one place - - ;; habits support - (require 'org-habit) - (add-to-list 'org-modules 'org-habit) - - ;; babel - (org-babel-do-load-languages - 'org-babel-load-languages - '((R . t))) - - ;; org-id - link by UUID - (require 'org-id) - (setq org-id-method 'uuid - org-id-link-to-org-use-id t) - ;; abbrev expansion in org-mode - (require 'org-tempo)) - -(use-package org-download - :straight t - :init (setq org-download-method 'directory - org-download-image-dir "./static/org-download" - org-download-heading-lvl 0)) - -(use-package magit - :straight t - :bind (("C-x G" . magit-dispatch) - ("C-x g" . magit-status))) - -;; I positively cannot spell :D -(setq-default ispell-program-name (if (string= oxa-workplace "work") - oxa-work-aspell - "hunspell")) -(use-package flyspell - :straight t - :defer t - :hook (('text-mode . (lambda () (flyspell-mode 1))) - ('change-log-mode . (lambda () (flyspell-mode -1))) - ('log-edit-mode . (lambda () (flyspell-mode -1))) - ('prog-mode . (lambda () (flyspell-mode -1))))) - -(use-package expand-region - :straight t - :bind ("C-=" . er/expand-region)) - -(use-package yaml-mode - :straight t) - -(if (not (string= system-type "windows-nt")) - (use-package vterm - :straight t - :bind (:map oxamap ("t" . vterm)) - :init - (setq vterm-kill-buffer-on-exit t))) - -;; checking -(straight-use-package 'flycheck) -(global-flycheck-mode) - -;; language support and settings -(straight-use-package 'nix-mode) -(straight-use-package 'markdown-mode) -(straight-use-package 'editorconfig) - -;; R stuff -(use-package ess - :straight t - :init - (setq ess-use-company t) - (setq ess-use-flymake nil)) - -(use-package poly-R - :straight t) - -;; Julia -(use-package julia-mode - :straight t) - -(use-package julia-snail - :straight t - :after vterm - :hook (julia-mode . julia-snail-mode)) - -;; scheming -(use-package geiser-racket - :straight t) - -(use-package scheme - :init (setq scheme-program-name "petite")) - -(use-package sly - :straight t - :config - (setq inferior-lisp-program "sbcl")) - -;; make lambda lambda :D -(add-hook 'scheme-mode-hook 'prettify-symbols-mode) -(add-hook 'inferior-scheme-mode-hook 'prettify-symbols-mode) -(add-hook 'lisp-mode-hook 'prettify-symbols-mode) -(add-hook 'geiser-mode-hook 'prettify-symbols-mode) -(add-hook 'emacs-lisp-mode-hook 'prettify-symbols-mode) - -;; python -(defun oxa/set-system-python () - "Set python interpreter to ipython if it's present." - (if (executable-find "ipython") - (progn (setq python-shell-interpreter "ipython" - python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True") - (setq flycheck-python-pycompile-executable "python")) - (progn - (setq python-shell-interpreter "python") - (setq flycheck-python-pycompile-executable "python")))) - -(oxa/set-system-python) - -;; working with python venvs -(use-package pyvenv - :straight t) - -(use-package lsp-mode - :straight t - :bind (:map oxamap ("L" . 'lsp)) - :init - (setq lsp-keymap-prefix "C-z l") - :hook ((lsp-mode . lsp-enable-which-key-integration)) - :commands lsp) - -(use-package lsp-ui - :straight t - :after lsp-mode - :commands lsp-ui-mode) - -;; snippets -(straight-use-package 'yasnippet) -(yas-global-mode t) -(diminish 'yas-minor-mode) +;; nya-nya-nya-nya-nya-nya +(oxa/insure 'nyan-mode) +(require 'nyan-mode) +(nyan-mode 1) ;; I use custom vars for local config, so let's put them to separate ;; file, where it's easier for git to ignore it (setq custom-file "~/.emacs.d/custom.el") (load custom-file 'noerror) - -(provide 'init) -;;; init.el ends here diff --git a/lisp/oxa/latex.el b/lisp/oxa/latex.el new file mode 100644 index 0000000..485c73f --- /dev/null +++ b/lisp/oxa/latex.el @@ -0,0 +1,12 @@ +(oxa/insure 'auctex) +(require 'tex-site) +(require 'reftex) + +(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode) +(add-hook 'LaTeX-mode-hook 'reftex-mode) +(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) + +(setq TeX-parse-self t) +(setq reftex-plug-into-AUCTeX t) + +(provide 'oxa/latex) diff --git a/lisp/oxa/misc.el b/lisp/oxa/misc.el new file mode 100644 index 0000000..718d006 --- /dev/null +++ b/lisp/oxa/misc.el @@ -0,0 +1,16 @@ +;; Stolen from https://github.com/rexim/dotfiles +(defun rc/duplicate-line () + "Duplicate current line" + (interactive) + (let ((column (- (point) (point-at-bol))) + (line (let ((s (thing-at-point 'line t))) + (if s (string-remove-suffix "\n" s) "")))) + (move-end-of-line 1) + (newline) + (insert line) + (move-beginning-of-line 1) + (forward-char column))) + +(global-set-key (kbd "C-,") 'rc/duplicate-line) + +(provide 'oxa/misc) diff --git a/lisp/oxa/org.el b/lisp/oxa/org.el new file mode 100644 index 0000000..370df3e --- /dev/null +++ b/lisp/oxa/org.el @@ -0,0 +1,67 @@ +;;; Monday is the fist day of the week +(require 'calendar) +(setq calendar-week-start-day 1) + +(require 'org) +(oxa/insure 'org-roam) +(require 'org-roam) + +;; expose org functions +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c l") 'org-store-link) +(define-key org-mode-map (kbd "C-c 1") 'org-time-stamp-inactive) + +;; autosave advises for agenda and org-capture +(advice-add 'org-agenda-quit :before 'org-save-all-org-buffers) +(advice-add 'org-capture-finalize :after 'org-save-all-org-buffers) +(advice-add 'org-capture-refile :after 'org-save-all-org-buffers) + +;; latex preview settings +(setq org-preview-latex-image-directory "~/.emacs.d/org-latex-preview/") ; Hide all previews in one place + +;; habits support +(require 'org-habit) +(add-to-list 'org-modules 'org-habit) + +;; babel +(org-babel-do-load-languages + 'org-babel-load-languages + '((R . t))) + +;; org-id - link by UUID +(require 'org-id) +(setq org-id-method 'uuid + org-id-link-to-org-use-id t) +;; abbrev expansion in org-mode +(require 'org-tempo) + +;; we need indentation +(setq org-startup-indented nil + org-indent-mode-turns-on-hiding-stars nil + org-hide-leading-stars nil + org-startup-folded 'content) +;; default agenda files +(setq org-agenda-files '("~/org/")) + +;; default agenda view +(setq org-agenda-start-day "-3d" + org-agenda-span 13) +;; templates +(setq org-capture-templates + '(("n" "note" entry + (file+headline "~/org/inbox.org" "Notes") + "** %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n") + ("t" "TODO" entry + (file+headline "~/org/inbox.org" "Tasks") + "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n") + ("j" "Journal" entry + (file+olp+datetree "~/org/log.org.gpg") + "**** %U %?\n") + ("b" "Bookmark" entry + (file+headline "~/org/bookmarks.org" "bookmarks-inbox") + "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n[[%x]]\n"))) + +;; TODO: roam config + +(provide 'oxa/org) diff --git a/lisp/oxa/sane-defaults.el b/lisp/oxa/sane-defaults.el new file mode 100644 index 0000000..26b6fef --- /dev/null +++ b/lisp/oxa/sane-defaults.el @@ -0,0 +1,56 @@ +;;; basic interface stuff +(menu-bar-mode 1) +(global-display-line-numbers-mode -1) +(column-number-mode 1) +(setq inhibit-startup-screen t) +(setq-default indicate-buffer-boundaries 'left) +(setq auto-save-default nil) +(setq visible-bell t) +;; (setq-default fill-column 80) + +;; TODO Proper graphical setup +(add-hook 'after-make-frame-functions + (lambda (frame) + (toggle-scroll-bar -1) + (tool-bar-mode -1))) + +;;; improvements to compilation buffer +(require 'compile) +(setq compilation-scroll-output t) +(require 'ansi-color) +(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter) + +;;; override default annoyances +;; I'm the only cowboy on this mainframe +;; (setq create-lockfiles nil) +;; X is dead +(setq inhibit-x-resources t) +;; use ibuffer instead of standard buffer list +(global-set-key (kbd "C-x C-b") 'ibuffer) +(fset 'yes-or-no-p 'y-or-n-p) +(setq confirm-nonexistent-file-or-buffer nil) + +;; let's delete a tab as a whole... +(setq backward-delete-char-untabify-method 'nil) +;;; identation holywar contribution +(setq-default indent-tabs-mode 'nil) + +;; highlight the parens +(setq show-paren-delay 0) +(show-paren-mode 1) + +;; follow symlinks to version-controlled files +(setq vc-follow-symlinks t) + +;; backup management +(setq backup-directory-alist `(("." . "~/.emacs.d/backups"))) +(setq delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t) + +;; default frame size +(add-to-list 'default-frame-alist '(height . 50)) +(add-to-list 'default-frame-alist '(width . 107)) + +(provide 'oxa/sane-defaults) diff --git a/lisp/oxa/utils.el b/lisp/oxa/utils.el new file mode 100644 index 0000000..49b2136 --- /dev/null +++ b/lisp/oxa/utils.el @@ -0,0 +1,20 @@ +;;; Package management +(require 'package) + +(defvar oxa/package-archive-refreshed nil) +(defun oxa/refresh-archive () + (when (not oxa/package-archive-refreshed) + (package-refresh-contents) + (setq oxa/package-archive-refreshed t))) + +;; ensure package +(defun oxa/insure (package) + (when (not (package-installed-p package)) + (oxa/refresh-archive) + (package-install package))) + +;; Macro to simplify setting mode-local vars +(defmacro oxa/hook (hook-name &rest body) + `(add-hook ',hook-name '(lambda nil ,@body))) + +(provide 'oxa/utils)