Skip to content

Instantly share code, notes, and snippets.

@quasilyte
Created July 27, 2017 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quasilyte/822e160cb80ef1adada07ccb53f99eeb to your computer and use it in GitHub Desktop.
Save quasilyte/822e160cb80ef1adada07ccb53f99eeb to your computer and use it in GitHub Desktop.
dot emacs dot el -- summer 2017
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; File name: ` ~/.emacs '
;;; ---------------------
;;;
;;; If you need your own personal ~/.emacs
;;; please make a copy of this file
;;; an placein your changes and/or extension.
;;;
;;; Copyright (c) 1997-2002 SuSE Gmbh Nuernberg, Germany.
;;;
;;; Author: Werner Fink, <feedback@suse.de> 1997,98,99,2002
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Test of Emacs derivates
;;; -----------------------
;; 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.
(package-initialize)
(if (string-match "XEmacs\\|Lucid" emacs-version)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; XEmacs
;;; ------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(progn
(if (file-readable-p "~/.xemacs/init.el")
(load "~/.xemacs/init.el" nil t))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU-Emacs
;;; ---------
;;; load ~/.gnu-emacs or, if not exists /etc/skel/.gnu-emacs
;;; For a description and the settings see /etc/skel/.gnu-emacs
;;; ... for your private ~/.gnu-emacs your are on your one.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (file-readable-p "~/.gnu-emacs")
(load "~/.gnu-emacs" nil t)
(if (file-readable-p "/etc/skel/.gnu-emacs")
(load "/etc/skel/.gnu-emacs" nil t)))
;; Custom Settings
;; ===============
;; To avoid any trouble with the customization system of GNU emacs
;; we set the default file ~/.gnu-emacs-custom
(setq custom-file "~/.gnu-emacs-custom")
(load "~/.gnu-emacs-custom" t t)
;;;
)
;;;
(setq scroll-step 1)
(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)
;; New installation?
(unless (require 'dash nil 'noerror)
(require 'package)
(package-initialize)
(add-to-list
'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(package-refresh-contents)
;; Install missing packages
(dolist (pkg '(company
smex
smartparens
dash
s
flycheck
flycheck-package))
(package-install pkg)))
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-x C-f") 'ido-find-file)
(global-set-key (kbd "C-x g") 'Go-translate-by-name)
(setq backup-inhibited t)
(setq make-backup-files nil)
(setq auto-save-list-file-name nil)
(setq auto-save-default nil)
(menu-bar-mode -1)
(tool-bar-mode -1)
(require 'ido)
(ido-mode t)
(setq show-paren-style 'expression)
(show-paren-mode 2)
(set-face-background 'show-paren-match "#000")
(set-default-font "Droid Sans Mono")
(set-face-attribute 'default nil :height 120)
(setq-default indent-tabs-mode nil)
(defun @elisp ()
(interactive)
(company-mode)
(smartparens-mode)
(require 'smartparens-config)
(setq sp-highlight-pair-overlay nil))
(add-hook 'java-mode-hook (lambda ()
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close 0)))
(add-hook 'c++-mode-hook (lambda ()
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close 0)))
(add-hook 'c-mode-hook (lambda ()
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close 0)))
(add-hook 'python-mode-hook 'auto-complete-mode)
(defun @org ()
(interactive)
(find-file "~/org.org"))
(defun @todo ()
(interactive)
(find-file "~/todo.org"))
(defmacro dis-lambda (params &rest body)
(declare (indent defun))
`(let ((lexical-binding t))
(disassemble
(byte-compile
(lambda ,params
,@body)))))
(defun move-line-up ()
(interactive)
(transpose-lines 1)
(forward-line -2))
(defun move-line-down ()
(interactive)
(forward-line 1)
(transpose-lines 1)
(forward-line -1))
(global-set-key (kbd "M-<up>") 'move-line-up)
(global-set-key (kbd "M-<down>") 'move-line-down)
(defmacro bench-best (n &rest forms)
(declare (indent defun))
`(let ((best-time 999999)
(best-allocs 999999)
(lexical-binding t))
(dotimes (i 10)
(let* ((res (benchmark-run-compiled ,n ,@forms))
(time (nth 0 res))
(allocs (nth 1 res)))
(setq best-time (min best-time time))
(setq best-allocs (min best-allocs allocs))))
(list best-time best-allocs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment