scripts/emacs/data.el

53 lines
1.3 KiB
EmacsLisp

(defgroup agw nil
"Alison G. Watson's customizations."
:prefix "agw-"
:group 'convenience)
(defvar agw-mode-map (make-sparse-keymap)
"Global keymap for `agw-mode'.")
(define-minor-mode agw-key-map
"Minor mode for key bindings."
:global t
:keymap agw-mode-map)
(defun agw-set-key (key def)
"Binds a key into `agw-mode-map'."
(define-key agw-mode-map (kbd (concat "C-<tab> " key)) def))
(defun agw-touch (fname)
"Touches a file asynchronously."
(interactive "FFile to touch: ")
(start-process "agw-touch" nil "touch" (expand-file-name fname)))
(defun agw-prog-mode ()
"Sets up `prog-mode'."
(setq-local tab-always-indent nil
tab-width 3
standard-indent 3
indent-tabs-mode t))
(defun agw-fp-mode ()
"Sets up lisp and other functional language major modes."
(setq-local indent-tabs-mode nil
standard-indent 2
tab-width 2))
(defun agw-org-mode ()
"Sets up `org-mode'."
(setq-local indent-tabs-mode nil
standard-indent 2
tab-width 2))
(defun agw-remove-elc ()
"Removes an elc file if it exists."
(let ((elc (concat buffer-file-name "c")))
(if (file-exists-p elc)
(delete-file elc))))
(defun agw-el-mode ()
"Sets up `emacs-lisp-mode'."
(add-hook 'after-save-hook #'agw-remove-elc nil t))
;; EOF