diff options
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/Cask | 1 | ||||
-rw-r--r-- | tag-emacs/emacs.d/elisp/ap-functions.el | 47 | ||||
-rw-r--r-- | tag-emacs/emacs.d/init.org | 237 |
3 files changed, 86 insertions, 199 deletions
diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ead4a52..096b802 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -34,6 +34,7 @@ (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") +(depends-on "dockerfile-mode") (depends-on "dtrt-indent") (depends-on "editorconfig") (depends-on "elisp-slime-nav") diff --git a/tag-emacs/emacs.d/elisp/ap-functions.el b/tag-emacs/emacs.d/elisp/ap-functions.el deleted file mode 100644 index bdc7fae..0000000 --- a/tag-emacs/emacs.d/elisp/ap-functions.el +++ /dev/null @@ -1,47 +0,0 @@ -;;;###autoload -(defun ap/remove-extra-cr () - "Remove extraneous CR codes from a file" - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward " -" nil t) - (replace-match "")))) - -;;;###autoload -(defun copy-rectangle (start end) - "Copy the region-rectangle." - (interactive "r") - (setq killed-rectangle (extract-rectangle start end))) - -;;;###autoload -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -;;;###autoload -(defun shell-execute (to-current-buffer) - (interactive "P") - (let ((file-buffer (if (buffer-file-name) - (file-name-nondirectory (buffer-file-name)) - "")) - (command (read-shell-command "Shell command: " nil nil nil))) - (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) - -;;;###autoload -(defun narrow-to-region-indirect (start end) - "Restrict editing in this buffer to the current region, indirectly." - (interactive "r") - (deactivate-mark) - (let ((buf (clone-indirect-buffer nil nil))) - (with-current-buffer buf - (narrow-to-region start end)) - (switch-to-buffer buf))) - -(provide 'ap-functions) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 793a454..ee6bd9b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -29,14 +29,6 @@ the buffer to be empty. * Packaging -I still use a couple of [[file:elisp/][elisp files]] that don’t appear to be in any package -archives. -#+BEGIN_SRC emacs-lisp -(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -#+END_SRC - -** TODO Move [[file:elisp/ap-functions.el][=ap-functions=]] into this file and delete above - ** Cask For most packages, I use [[https://github.com/cask/cask][cask]] @@ -72,12 +64,24 @@ cask update ** Req-package #+BEGIN_SRC emacs-lisp + (let ((trustfile + (replace-regexp-in-string + "\\\\" "/" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string "python -m certifi"))))) + (setq tls-checktrust t + tls-program + (list + (format "gnutls-cli%s --x509cafile %s -p %%p %%h" + (if (eq window-system 'w32) ".exe" "") trustfile))) + (setq gnutls-verify-error t) + (setq gnutls-trustfiles (list trustfile))) (eval-and-compile - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.org/packages/") - ("melpa-stable" . "http://stable.melpa.org/packages/") - ("org" . "http://orgmode.org/elpa/"))) + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("marmalade" . "https://marmalade-repo.org/packages/") + ("melpa" . "https://melpa.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/"))) (package-initialize) (unless (package-installed-p 'req-package) (package-refresh-contents) @@ -172,17 +176,6 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC -** projector - -Project-based shell buffers sounds like a good idea, but for some -reason I haven’t found a use for it. - -#+BEGIN_SRC emacs-lisp -(req-package projector - :require projectile - :bind (("s-z" . projector-open-project-shell))) -#+END_SRC - ** perspective This package makes buffer-switching inside of projects make sense, by @@ -338,7 +331,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Input Mono Narrow" "Input Sans Condensed" 12)))) + (ap/set-fonts "Input Mono" "Input Sans Condensed" 13)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if @@ -493,19 +486,6 @@ for similar things any more. :bind ("M-SPC" . shrink-whitespace)) #+END_SRC -** fasd - -Fasd is a nice shell plugin that remembers file and folder arguments, -making it easy to re-visit them later. This package hooks into that. -I don’t seem to use it much though. - -#+BEGIN_SRC emacs-lisp -(req-package fasd - :bind ("C-x C-/" . fasd-find-file) - :init (progn - (global-fasd-mode 1))) -#+END_SRC - ** recentf I only use this occasionally, but it’s nice for files outside of projects. @@ -534,7 +514,7 @@ it off to see if I notice it. #+BEGIN_SRC emacs-lisp (req-package saveplace - :config (progn (setq-default save-place t) + :config (progn (setq-default save-place nil) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) #+END_SRC @@ -736,19 +716,6 @@ Enable it without prompting (put 'narrow-to-region 'disabled nil) #+END_SRC -** Fancy Narrow - -Sometimes I like to be able to focus on one block of code at a time. -Normally narrowing hides everything else completely, which I don’t -like. This package just makes everything else lower-contrast. -#+BEGIN_SRC emacs-lisp - (req-package fancy-narrow - :defer 15 - :diminish fancy-narrow-mode - :config (fancy-narrow-mode 1)) -#+END_SRC - - ** ace-window I don’t often have many windows open at once, but when I do, @@ -804,20 +771,6 @@ A dedicated window always keeps the same buffer in view. "normal"))) #+END_SRC -** popwin - -This works really nicely wiht helm. I should think about whether it -might be useful elsewhere - -#+BEGIN_SRC emacs-lisp -(req-package popwin - :if (and (>= emacs-major-version 24) - (> emacs-minor-version 3)) - :config (progn - (popwin-mode 1) - (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) -#+END_SRC - ** winner Undo, for window-based commands. @@ -882,7 +835,7 @@ seems to work perfectly well for me. :bind (("C-<tab>" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) company-oddmuse company-files company-dabbrev) company-idle-delay .3 company-begin-commands '(self-insert-command) @@ -1147,25 +1100,40 @@ Option/alt, then Control. "Where the emacs init file really is, passing through symlinks.") (set-register ?e `(file . ,*init-file*)) - (req-package whitespace - :defer t - :config (setq whitespace-style - '(face - space - tabs - trailing - newline - empty - tab-mark - space-before-tab - indentation - indentation::space - indentation::tabs))) + (defun ap/remove-extra-cr () + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " + " nil t) + (replace-match "")))) + + (req-package rect + :init (defun copy-rectangle (start end) + "Copy the region-rectangle." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end)))) + + (defun shell-execute (to-current-buffer) + (interactive "P") + (let ((file-buffer (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "")) + (command (read-shell-command "Shell command: " nil nil nil))) + (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) + + (defun narrow-to-region-indirect (start end) + "Restrict editing in this buffer to the current region, indirectly." + (interactive "r") + (deactivate-mark) + (let ((buf (clone-indirect-buffer nil nil))) + (with-current-buffer buf + (narrow-to-region start end)) + (switch-to-buffer buf))) - (req-package ap-functions - :commands (ap/remove-extra-cr) - :bind (("C-x r M-w" . copy-rectangle) - ("M-!" . shell-execute))) + (bind-key* "M-!" #'shell-execute) + (bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC #+END_SRC @@ -1194,22 +1162,6 @@ Occasionally, I exit emacs. I should probably reduce the frequency of this. (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC -** helm - -I like to use =helm= for some completions, especially when there are -lots of candidates. - -#+BEGIN_SRC emacs-lisp - (req-package helm-config - :demand t - :ensure helm - :config (progn - (setq helm-idle-delay .1 - helm-input-idle-delay 0) - (when (fboundp #'helm-adaptive-mode) - (helm-adaptive-mode 1)))) -#+END_SRC - ** swiper/ivy Ivy is the new kid on the completion block. I wonder if it can @@ -1437,6 +1389,9 @@ configuration files. (req-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) + (req-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) + (req-package nix-mode :mode (("\\.nix\\'" . nix-mode)) :config (progn @@ -1529,6 +1484,7 @@ Org is wünderbar. :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/Sync/org" + org-ellipsis "…" org-agenda-files `(,(concat org-directory "/agenda")) org-default-notes-file (concat org-directory "/notes") @@ -1537,7 +1493,8 @@ Org is wünderbar. org-reverse-note-order t org-modules '(org-habit - org-checklist) + org-checklist + org-protocol) ;; Add time done to ‘done’ tasks org-log-done 'time @@ -1564,6 +1521,7 @@ Org is wünderbar. org-log-into-drawer "LOGBOOK") (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) (add-hook 'org-mode-hook #'turn-on-auto-fill) + (org-load-modules-maybe t) (defadvice org-clock-in (after wicked activate) "Mark STARTED when clocked in" (save-excursion @@ -1655,21 +1613,6 @@ I can use this to keep a journal. I should use it. #+END_SRC * Programming -** cedet - -*** TODO Setup cedet and see whether it’s useful - -#+BEGIN_SRC emacs-lisp -(req-package cedet - :disabled t - :config (progn - (semantic-load-enable-code-helpers) - (global-semantic-idle-completions-mode t) - (global-semantic-highlight-func-mode t) - (global-semantic-show-unmatched-syntax-mode t) - (global-semantic-decoration-mode t))) -#+END_SRC - ** flycheck On-the-fly error checking in programming modes? Yes please. @@ -1901,7 +1844,7 @@ quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp (req-package cc-mode - :defer t + :defer 5 :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn @@ -1923,19 +1866,6 @@ really seem to use it. ** Web development -*** skewer-mode - -I don’t use this as often as I probably should. I should figure out -why that is. -#+BEGIN_SRC emacs-lisp -(req-package skewer-mode - :defer t - :init (progn - (add-hook 'js2-mode-hook #'skewer-mode) - (add-hook 'html-mode-hook #'skewer-html-mode) - (add-hook 'css-mode-hook #'skewer-css-mode))) -#+END_SRC - *** js2-mode This mode is really great for editing Javascript. It turns code into @@ -1961,6 +1891,13 @@ it though (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) #+END_SRC +*** coffee-mode + +#+BEGIN_SRC emacs-lisp + (req-package coffee-mode + :mode ("\\.coffee\\'" . coffee-mode)) +#+END_SRC + *** tern Tern understands javascript. It adds really clever documented @@ -2158,36 +2095,30 @@ nice, when I remember to use it. (req-package esh-buf-stack :require eshell :config (progn - (bind-key "M-q" #'eshell-push-command eshell-mode-map)) - :init (progn - (setup-eshell-buf-stack))) + (setup-eshell-buf-stack) + (add-hook 'eshell-load-hook (lambda () + (bind-key "M-q" #'eshell-push-command eshell-mode-map))))) #+END_SRC *** Shells #+BEGIN_SRC emacs-lisp -(req-package shell - :defer t - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(req-package comint - :defer t - :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) + (req-package shell + :defer t + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) -(req-package multi-term - :if (not (eq system-type 'windows-nt)) - :bind ("C-`" . multi-term-dedicated-toggle)) + (req-package comint + :defer t + :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) + (defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC -*** TODO Do I need multi-term? - * Text editing Emacs has an editor within. @@ -2519,7 +2450,9 @@ the =org=-document after changes. "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled." + (interactive) (when (string-suffix-p "init.org" (buffer-file-name)) + (message "Tangling init") (async-start `(lambda () ;; Avoid running hooks when tangling. |