;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/ide/elisp.el (require 'auto-version) (require 'close) (require 'draw) (require 'dwim) (require 'eldoc) (require 'elide-head) (require 'elisp-mode) (require 'fun-names) (require 'ide) (require 'lisp-mode) (require 'mode-line) (require 'package-style) (require 'revert-buffer) (require 'search-regexp-in-files) (require 'super) (defalias 'elisp-mode #'emacs-lisp-mode) (global-eldoc-mode 1) (setq eldoc-idle-delay 0) (setq emacs-lisp-docstring-fill-column t) ; same as fill-column (setq initial-major-mode 'emacs-lisp-mode) (defun new-elisp-file () (interactive) (this-file-comment) (lex t) (provide-file) ) (defun provide-file (&optional file) (interactive "fFile: ") (or file (setq file (buffer-file-name))) (goto-char (point-min)) (let*((name (file-name-base file)) (prov (concat "\n(provide '" name ")\n") )) (unless (re-search-forward prov nil t) (goto-char (point-max)) (insert prov) (save-buffer) ))) (defun provide-all () (dolist (f (files-as-list "~/.emacs.d/emacs-init/**/*.el")) (with-current-buffer (find-file-noselect f) (provide-file f) ))) (defun lex (&optional more) (interactive "P") (save-excursion (goto-char (point-min)) (insert ";;; -*- lexical-binding: t -*-\n") (when more (insert ";;\n") ) (save-buffer) )) (defun point-in-comment-p (&optional print) (interactive "p") (let*((cmt (nth 8 (syntax-ppss))) (msg (format "%s comment" (if cmt "Yes:" "No"))) ) (prog1 cmt (when print (message msg) )))) (defun fill-all-comments (&optional beg end) (interactive (use-region)) (or beg (setq beg (point-min))) (or end (setq end (point-max))) (goto-char beg) (while (search-forward-regexp "^;;" end t) (fill-comment-paragraph) )) (defun emacs-lisp-mode-hook-f () (abbrev-mode) (elide-head-mode)) (add-hook 'emacs-lisp-mode-hook #'emacs-lisp-mode-hook-f) ;; (remove-hook 'emacs-lisp-mode-hook #'emacs-lisp-mode-hook-f) (let ((kmap emacs-lisp-mode-map)) (disable-super-global-keys kmap) (keymap-set kmap "C-" #'draw-center-string) (keymap-set kmap "M-_" #'fun-names-short) (keymap-set kmap "C-_" #'fun-names-short) (keymap-set kmap "C-c C-c" #'compile) (keymap-set kmap "C-x C-s" #'save-buffer) (keymap-set kmap "M-n" #'eval-buffer) (keymap-set kmap "M-r" #'all-elint)) (let ((kmap emacs-lisp-compilation-mode-map)) (disable-super-global-keys kmap) (set-close-key kmap)) (provide 'elisp)