94 lines
2.9 KiB
EmacsLisp
94 lines
2.9 KiB
EmacsLisp
;;; module-base.el -- configure emacs behavior and user interface
|
|
;;;
|
|
;;; Commentary:
|
|
;;; Exactly what it looks like.
|
|
;;;
|
|
;;; Code:
|
|
|
|
(require 'warnings)
|
|
(require 'tramp)
|
|
(require 'tramp-sh)
|
|
|
|
(defun copy-file-path-to-clipboard ()
|
|
"Copy the current buffer's file path to the clipboard."
|
|
(interactive)
|
|
(let ((filepath (buffer-file-name)))
|
|
(when filepath
|
|
(kill-new filepath)
|
|
(message "Copied file path: %s" filepath))))
|
|
|
|
(defun my-compile-init-file ()
|
|
"Compile the init file."
|
|
(let ((init-file (file-truename user-init-file)))
|
|
(when (string= (buffer-file-name) init-file)
|
|
(byte-compile-file init-file))))
|
|
|
|
(defun my/setup-elisp-formatting-key ()
|
|
"Set up the formatting key for Emacs Lisp buffers."
|
|
(local-set-key (kbd "C-c f") 'my/format-elisp-buffer))
|
|
(add-hook 'emacs-lisp-mode-hook #'my/setup-elisp-formatting-key)
|
|
|
|
(defun my/reload-init-file ()
|
|
"Reload the Emacs init file."
|
|
(interactive)
|
|
(load-file user-init-file))
|
|
|
|
(defun my/format-elisp-buffer ()
|
|
"Format the whole elisp buffer."
|
|
(interactive)
|
|
(save-excursion
|
|
(indent-region (point-min) (point-max))))
|
|
|
|
(tool-bar-mode -1)
|
|
(menu-bar-mode -1)
|
|
|
|
(setq backup-by-copying t
|
|
completion-cycle-threshold 3
|
|
create-lockfiles nil
|
|
delete-old-versions t
|
|
enable-recursive-minibuffers t
|
|
focus-follows-mouse t
|
|
indent-tabs-mode nil
|
|
inhibit-startup-screen t
|
|
kept-new-versions 20
|
|
kept-old-versions 2
|
|
minibuffer-prompt-properties '(read-only t cursor-intangible t
|
|
face minibuffer-prompt)
|
|
mouse-autoselect-window t
|
|
read-extended-command-predicate #'command-completion-default-include-p
|
|
read-process-output-max (* 1024 1024)
|
|
tab-always-indent 'complete
|
|
tab-width 4
|
|
use-short-answers t
|
|
version-control t
|
|
backup-directory-alist `((".*" . ,(concat user-emacs-directory "backup")))
|
|
read-extended-command-predicate #'command-completion-default-include-p
|
|
gc-cons-threshold 100000000
|
|
auth-sources '("~/.authinfo.gpg")
|
|
warning-minimum-level :emergency
|
|
tramp-persistency-file-name "~/.config/emacs/tramp"
|
|
tramp-inline-compress-start-size 1000)
|
|
|
|
;; load custom file
|
|
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
|
(when (file-exists-p custom-file)
|
|
(load custom-file))
|
|
|
|
;; compile init.el on save
|
|
(add-hook 'after-save-hook #'my-compile-init-file)
|
|
|
|
;; setup base key bindings
|
|
(global-set-key (kbd "M-/") 'dabbrev-expand)
|
|
(global-set-key (kbd "M-s r") 'replace-regexp)
|
|
(global-set-key (kbd "M-s M-r") 'replace-string)
|
|
(global-set-key (kbd "C-x E n p") #'narrow-to-page)
|
|
(global-set-key (kbd "C-x E n f") #'narrow-to-defun)
|
|
(global-set-key (kbd "C-x E n r") #'narrow-to-region)
|
|
(global-set-key (kbd "C-x E w") #'widen)
|
|
(global-set-key (kbd "C-x c r") #'my/reload-init-file)
|
|
(global-set-key (kbd "C-x y b p") 'copy-file-path-to-clipboard)
|
|
|
|
(provide 'module-base)
|
|
|
|
;;; module-base.el ends here.
|