From 42f48126a24dfadd1a46575c62dd13d4f4d7cc93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 11:23:21 +0200 Subject: Emacs: Configure flyspell --- emacs/.emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 44b0a3c..bd7ee3f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2138,6 +2138,13 @@ I derived a mode for twig, in order to use its =mode-hook=. ispell-really-hunspell t))))) #+END_SRC +#+BEGIN_SRC emacs-lisp +(use-package flyspell + :config (progn + (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) + (add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode +1))))) +#+END_SRC + * Scripting Make a shell-script buffer executable after saving it, if it has a shebang. -- cgit 1.4.1 From d3e3f4ce1edce7fb26dd8c359f4f47caf3458d7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 11:23:30 +0200 Subject: Emacs: Add yarn-run command --- emacs/.emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index bd7ee3f..aa7add4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -510,6 +510,11 @@ based upon some folder conventions I use. (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "add " package)))) + (defun yarn-run (cmd) + (interactive "scommand: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "run " cmd)))) + (defun ap/open-work-project (&optional arg) (interactive "P") (ap/open-subfolder-project work-project-directory arg)) -- cgit 1.4.1 From c7548f30622665198145067d32e44c2348ff7fbc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 14:45:53 +0200 Subject: Emacs: Move insensitive email configuration to init.org --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 2468 -> 2136 bytes emacs/.emacs.d/init.org | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index f29f0d0..e8c7590 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index aa7add4..43a861d 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1181,6 +1181,52 @@ rather useful. (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC +* Mail + +** Gnus + +At work, I use gnus for email. Some of the setup is specific to my +workplace, so I keep it in a host-specific, GPG-encrypted file. + +#+BEGIN_SRC emacs-lisp +(use-package gnus + :config (progn + (setq gnus-gcc-mark-as-read t + mml-secure-openpgp-encrypt-to-self t + send-mail-function #'smtpmail-send-it + message-send-mail-function #'smtpmail-send-it))) + +(with-eval-after-load 'gnus-mime + (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) + +(with-eval-after-load "mailcap" + (when (eq system-type 'darwin) + (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) + +(with-eval-after-load "mm-decode" + (add-to-list 'mm-discouraged-alternatives "text/html") + (add-to-list 'mm-discouraged-alternatives "text/richtext")) +#+END_SRC + +** BBDB + +As I'm using Emacs for email, it makes sense to have contact +information here as well. + +#+BEGIN_SRC emacs-lisp +(use-package bbdb + :config (progn + (bbdb-initialize 'gnus 'mail 'message 'pgp) + (bbdb-mua-auto-update-init 'gnus 'message) + (setq bbdb-send-mail-style 'gnus + bbdb-complete-mail-allow-cycling t + bbdb-mua-auto-update t + bbdb-mua-update-interactive-p '(query . create) + bbdb-message-all-addresses t + bbdb-offer-save t + bbdb-offer-to-create 1))) +#+END_SRC + * Misc #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 967dc8a329804a7b3517a34a4b6c35f11ed9edc4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:35:24 +0200 Subject: Emacs: Use one projects directory --- emacs/.emacs.d/init.org | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 43a861d..e7cbedc 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -430,14 +430,13 @@ configuration with crux.el * Projects #+BEGIN_SRC emacs-lisp -(defvar work-project-directory "~/work") -(defvar home-project-directory "~/projects") +(defvar projects-root-directory "~/projects") #+END_SRC #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (expand-file-name "~/dotfiles"))) + (projectile-switch-project-by-name (expand-file-name "~/projects/git.alanpearce.uk/alan/dotfiles/"))) #+END_SRC ** The Silver Searcher @@ -515,13 +514,9 @@ based upon some folder conventions I use. (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "run " cmd)))) - (defun ap/open-work-project (&optional arg) + (defun ap/open-project (&optional arg) (interactive "P") - (ap/open-subfolder-project work-project-directory arg)) - - (defun ap/open-home-project (&optional arg) - (interactive "P") - (ap/open-subfolder-project home-project-directory arg)) + (ap/open-subfolder-project projects-root-directory arg)) (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) -- cgit 1.4.1 From 0c35d3d3e99aa95c07ad76dac62c002500115b9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:35:52 +0200 Subject: Emacs: Re-implement project-directory functions --- emacs/.emacs.d/init.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e7cbedc..0f43c84 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -482,16 +482,21 @@ based upon some folder conventions I use. :config (progn (projectile-global-mode) (add-to-list 'projectile-globally-ignored-directories ".stversions") - (defun ap/subfolder-projects (dir) - (--map (file-relative-name it dir) - (-filter (lambda (subdir) - (--reduce-from (or acc (funcall it subdir)) nil - projectile-project-root-files-functions)) - (-filter #'file-directory-p (directory-files dir t "\\<"))))) + + (defun directory-directories (dir) + (seq-filter #'file-directory-p + (directory-files dir t (rx string-start + (char alnum))))) + + (defun project-directories (start-dir) + (seq-map (lambda (x) (file-relative-name x start-dir)) + (seq-mapcat #'directory-directories + (seq-mapcat #'directory-directories + (directory-directories start-dir))))) (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (projectile-completing-read "Open project: " - (ap/subfolder-projects from-dir)))) + (project-directories from-dir)))) (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) (defun yarn-install (&optional arg) -- cgit 1.4.1 From 2d2bcaa101b46d8c139c1f679e4f679b6ab5af04 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:38:39 +0200 Subject: Emacs: Remove dash library usage Emacs lisp already includes seq- functions which work as expected --- emacs/.emacs.d/init.org | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0f43c84..4a1d757 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -120,10 +120,6 @@ Ring the bell sometimes, but not so often (ding)))) #+END_SRC -#+BEGIN_SRC emacs-lisp -(use-package dash) -#+END_SRC - ** Colours Let’s try a more minimal theme. @@ -329,7 +325,7 @@ modes. (setq cyphejor-rules `(("emacs" "ε") ("diff" "Δ") ("js2" "js") - ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + ("magit-status" ,(char-to-string (seq-find #'char-displayable-p '(11942 5848 177)))) ("inferior" "i" :prefix) ("interaction" "i" :prefix) ("interactive" "i" :prefix) @@ -1125,9 +1121,9 @@ helps to make documentation for other languages easier to access `(progn (defun ,fun () (when (require 'counsel-dash nil :noerror) - (-each (-difference ',docsets - (helm-dash-installed-docsets)) - #'counsel-dash-install-docset) + (seq-map #'counsel-dash-install-docset + (seq-difference ',docsets + (helm-dash-installed-docsets))) (setq-local counsel-dash-docsets ',docsets))) (add-hook (quote ,hook) (function ,fun))))) -- cgit 1.4.1 From 7e21e4ccc85a2a119d4ad090031071caa08fa5bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Apr 2017 16:21:24 +0200 Subject: Emacs: Use ccl for a lisp, if available --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4a1d757..2003d9d 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1920,7 +1920,8 @@ A REPL thing (and more) for Lisp. (if (file-exists-p ql-slime-helper) (load ql-slime-helper)) (slime-setup)) - (setq inferior-lisp-program (executable-find "sbcl")))) + (setq inferior-lisp-program (or (executable-find "sbcl") + (executable-find "ccl64"))))) #+END_SRC *** Clojure -- cgit 1.4.1 From 9f656fdbcdcbc155864b8bebe474ed29af39ff76 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Apr 2017 16:21:40 +0200 Subject: Emacs: Fix error initialising flyspell-prog-mode --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2003d9d..a15a0c0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2190,7 +2190,7 @@ I derived a mode for twig, in order to use its =mode-hook=. (use-package flyspell :config (progn (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) - (add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode +1))))) + (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC * Scripting -- cgit 1.4.1 From 26f20345f819eb8da49ecc6e1eee28a617d2d90a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:30:59 +0200 Subject: Emacs: Configure ghq --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a15a0c0..f37a818 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -584,6 +584,17 @@ a particular way, but it changed later. :commands git-timemachine) #+END_SRC +** ghq + +[[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should +seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a +simple wrapper for it. + +#+BEGIN_SRC emacs-lisp +(use-package ghq + :if (executable-find "ghq")) +#+END_SRC + * Files ** Auto-saving -- cgit 1.4.1 From 5e7a227e8090b32949e0e8468f5401475f7fabd1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:31:09 +0200 Subject: Emacs: Install and configure hyperspec --- emacs/.emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f37a818..6419d28 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1906,6 +1906,14 @@ I don’t work with these as often as I would like (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC +**** hyperspec + +#+BEGIN_SRC emacs-lisp +(use-package hyperspec + :config (progn + (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/"))) +#+END_SRC + **** geiser A REPL thing for Scheme. Hopefully I’ll get to use it more in the -- cgit 1.4.1 From 688f26cd969fbad37721b2522bea2fb8c702c62b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:31:23 +0200 Subject: Emacs: Setup slime-asdf plugin --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6419d28..120b4a3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1938,7 +1938,7 @@ A REPL thing (and more) for Lisp. (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) (if (file-exists-p ql-slime-helper) (load ql-slime-helper)) - (slime-setup)) + (slime-setup '(slime-fancy slime-asdf))) (setq inferior-lisp-program (or (executable-find "sbcl") (executable-find "ccl64"))))) #+END_SRC -- cgit 1.4.1 From ebf4da622c7c25ea7768de7b94925db7c4a1e8c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 15:29:53 +0200 Subject: Emacs: Bind multiple-cursors keys via override keymap --- emacs/.emacs.d/init.org | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 120b4a3..a2a664a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2437,12 +2437,11 @@ saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp (use-package multiple-cursors :defer 1 - :config (progn - (bind-key "C-." #'mc/mark-next-like-this) - (bind-key "C-," #'mc/mark-previous-like-this) - (bind-key "M-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) + :bind* (("C-." . mc/mark-next-like-this) + ("C-," . mc/mark-previous-like-this) + ("M-" . mc/mark-all-like-this-dwim) + ("C-" . mc/mark-more-like-this-extended) + ("C-S-L" . mc/edit-lines))) #+END_SRC ** paredit -- cgit 1.4.1 From dda94cd1c0e1b3ec5f7c7d6002c75b4ce90a2c68 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 15:44:07 +0200 Subject: Emacs: Spell-check camelCased words correctly Configure "run-together" for aspell --- emacs/.emacs.d/init.org | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a2a664a..8d25e6c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2208,7 +2208,47 @@ I derived a mode for twig, in order to use its =mode-hook=. #+BEGIN_SRC emacs-lisp (use-package flyspell :config (progn - (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) + (defun flyspell-detect-ispell-args (&optional run-together) + "If RUN-TOGETHER is true, spell check the CamelCase words. + Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." + (let (args) + (when ispell-program-name + (cond + ((string-match "aspell$" ispell-program-name) + (setq args (list "--sug-mode=ultra")) + (if run-together + (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) + ((string-match "hunspell$" ispell-program-name) + (setq args nil)))) + args)) + ;; `ispell-extra-args' is *always* used when start CLI aspell process + (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) + ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) + (defadvice ispell-word (around my-ispell-word activate) + (let ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + + (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) + (let* ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + (setq flyspell-issue-message-flag nil) + + (defun fly-text-mode-hook-setup () + ;; Turn off RUN-TOGETHER option when spell check text-mode + (setq-local ispell-extra-args (flyspell-detect-ispell-args))) + (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC -- cgit 1.4.1 From 8bec2093fa057e99b3a87b18935bca131045fbfa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:14:28 +0200 Subject: Remove empty section --- emacs/.emacs.d/init.org | 2 -- 1 file changed, 2 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8d25e6c..307e0a5 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2388,8 +2388,6 @@ I like to use the clipboard more than the primary selection in X11. ("s" . copy-as-format-slack))) #+END_SRC -** - ** Selection I’m quite used to deleting text by selecting it and typing. Emacs has -- cgit 1.4.1 From 493ca6247b8fad2d6c20221e6baec59334e784ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:17:08 +0200 Subject: Emacs: Don't change tramp-remote-path I don't think this is necessary any more --- emacs/.emacs.d/init.org | 7 ------- 1 file changed, 7 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 307e0a5..da2a0f0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -730,13 +730,6 @@ that I can sudo on remote machines (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" (concat "/" tramp-default-method ":%h:"))) (add-to-list 'tramp-default-proxies-alist `(,(regexp-quote (system-name)) nil nil)) (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) - -(use-package tramp-sh - :ensure nil - :defer t - :config (progn - (add-to-list 'tramp-remote-path "/usr/local/sbin") - (add-to-list 'tramp-remote-path "~/bin"))) #+END_SRC ** ediff -- cgit 1.4.1 From cc70e91eeeefc70bced1e1e126e3b0a2875e7899 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:25:55 +0200 Subject: Emacs: Use ghq to get dotfiles directory --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index da2a0f0..f5737eb 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -432,7 +432,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (expand-file-name "~/projects/git.alanpearce.uk/alan/dotfiles/"))) + (projectile-switch-project-by-name (split-string (shell-command-to-string "ghq list --full-path dotfiles")))) #+END_SRC ** The Silver Searcher -- cgit 1.4.1 From 7f7087d808a6e441e6c3aa36aa8328e93f63d256 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:24:44 +0200 Subject: Emacs: Fix switch-to-dotfiles issue --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f5737eb..5830055 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -432,7 +432,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (split-string (shell-command-to-string "ghq list --full-path dotfiles")))) + (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) #+END_SRC ** The Silver Searcher -- cgit 1.4.1 From 819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:34:02 +0200 Subject: Emacs: Simplify project opening logic Use ghq to do the heavy lifting --- emacs/.emacs.d/init.org | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5830055..84609ac 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -479,22 +479,6 @@ based upon some folder conventions I use. (projectile-global-mode) (add-to-list 'projectile-globally-ignored-directories ".stversions") - (defun directory-directories (dir) - (seq-filter #'file-directory-p - (directory-files dir t (rx string-start - (char alnum))))) - - (defun project-directories (start-dir) - (seq-map (lambda (x) (file-relative-name x start-dir)) - (seq-mapcat #'directory-directories - (seq-mapcat #'directory-directories - (directory-directories start-dir))))) - - (defun ap/open-subfolder-project (from-dir &optional arg) - (let ((project-dir (projectile-completing-read "Open project: " - (project-directories from-dir)))) - (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) - (defun yarn-install (&optional arg) (interactive "P") (projectile-with-default-dir (projectile-project-root) @@ -517,7 +501,11 @@ based upon some folder conventions I use. (defun ap/open-project (&optional arg) (interactive "P") - (ap/open-subfolder-project projects-root-directory arg)) + (let ((project-dir (projectile-completing-read + "Open project: " + (ghq--find-projects)))) + (projectile-switch-project-by-name + (expand-file-name project-dir (ghq--find-root)) arg))) (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) -- cgit 1.4.1 From a90d2adc0804fda23f86a5a444abe7cfaa0e311e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:37:18 +0200 Subject: Emacs: Remove unused var --- emacs/.emacs.d/init.org | 4 ---- 1 file changed, 4 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 84609ac..6ecd906 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -425,10 +425,6 @@ configuration with crux.el * Projects -#+BEGIN_SRC emacs-lisp -(defvar projects-root-directory "~/projects") -#+END_SRC - #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) -- cgit 1.4.1 From 3a676d464339bac6f2f3a00ddc9866726da1a014 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:42:15 +0200 Subject: Emacs: Setup company-nixos-options on all OSes --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6ecd906..6d0b4e2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -954,7 +954,6 @@ seems to work perfectly well for me. #+BEGIN_SRC emacs-lisp (use-package company-nixos-options - :if (eq system-type 'gnu/linux) :config (progn (add-to-list 'company-backends 'company-nixos-options))) #+END_SRC -- cgit 1.4.1 From d018f3c8491f92de09b12ede0186b5fc8c0d2716 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:36:44 +0200 Subject: Emacs: Remove ivy completion inconsistency --- emacs/.emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6d0b4e2..e464b12 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1354,8 +1354,7 @@ replacement for helm so far. :demand t :config (progn (ivy-mode 1) - (setq ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) - (t . ivy--regex-plus))) + (setq ivy-re-builders-alist '((t . ivy--regex-plus))) (defun ivy-imenu-get-candidates-from (alist &optional prefix) (cl-loop for elm in alist nconc (if (imenu--subalist-p elm) -- cgit 1.4.1 From 605640f02a13c311fa6a1726f93cb5be52472ff0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:37:00 +0200 Subject: Emacs: Install and configure counsel-projectile --- emacs/.emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e464b12..2d7e3f9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -505,6 +505,9 @@ based upon some folder conventions I use. (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) + +(use-package counsel-projectile + :config (counsel-projectile-on)) #+END_SRC ** vc -- cgit 1.4.1 From cf8274074e6eb6b8f35003a92fae1d90d8e1981d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:39:08 +0200 Subject: Emacs: Remove ./ and ../ from ivy file completions --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2d7e3f9..0446397 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1357,7 +1357,8 @@ replacement for helm so far. :demand t :config (progn (ivy-mode 1) - (setq ivy-re-builders-alist '((t . ivy--regex-plus))) + (setq ivy-re-builders-alist '((t . ivy--regex-plus)) + ivy-extra-directories '()) (defun ivy-imenu-get-candidates-from (alist &optional prefix) (cl-loop for elm in alist nconc (if (imenu--subalist-p elm) -- cgit 1.4.1 From 42e6eb4f62d10a09c24299a61cfe1f4ff354dd09 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:35:05 +0200 Subject: Emacs: Re-add . to ivy directory lists --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0446397..6311196 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1358,7 +1358,7 @@ replacement for helm so far. :config (progn (ivy-mode 1) (setq ivy-re-builders-alist '((t . ivy--regex-plus)) - ivy-extra-directories '()) + ivy-extra-directories '("./")) (defun ivy-imenu-get-candidates-from (alist &optional prefix) (cl-loop for elm in alist nconc (if (imenu--subalist-p elm) -- cgit 1.4.1