Skip to content

Latest commit

 

History

History
3203 lines (2970 loc) · 137 KB

convert-emacs-init-to-literate.org

File metadata and controls

3203 lines (2970 loc) · 137 KB

Reconstruct my emacs init file in the Literate style

Working Notes

Goals to Achieve

  • [ ] enable tramp mode
    • show it works in important cases, like judgy
    • to get there, I need:
      • [X] eshell mode that works?
  • [ ] to support jq literate programming to solve some of the salt challenges I have at work
  • [ ] can install from a new, clean .emacs.d
    • what does this mean? I am not really sure.

Next Up

NEXT Add useful projectile key sequences to my frequently used emacs cheat sheet

<2020-04-05 Sun>

explore these projectile commands from the bindings

C-c p           projectile-command-map

s-p ESC         projectile-project-buffers-other-buffer
s-p SPC         counsel-projectile
s-p !           projectile-run-shell-command-in-root
s-p &           projectile-run-async-shell-command-in-root
s-p 4           Prefix Command
s-p 5           Prefix Command
s-p C           projectile-configure-project
s-p D           projectile-dired
s-p E           projectile-edit-dir-locals
s-p F           projectile-find-file-in-known-projects
s-p I           projectile-ibuffer
s-p O           Prefix Command
s-p P           projectile-test-project
s-p R           projectile-regenerate-tags
s-p S           projectile-save-project-buffers
s-p T           projectile-find-test-file
s-p V           projectile-browse-dirty-projects
s-p a           projectile-find-other-file
s-p b           projectile-switch-to-buffer
s-p c           projectile-compile-project
s-p d           projectile-find-dir
s-p e           projectile-recentf
s-p f           projectile-find-file
s-p g           projectile-find-file-dwim
s-p i           projectile-invalidate-cache
s-p j           projectile-find-tag
s-p k           projectile-kill-buffers
s-p l           projectile-find-file-in-directory
s-p m           projectile-commander
s-p o           projectile-multi-occur
s-p p           projectile-switch-project
s-p q           projectile-switch-open-project
s-p r           projectile-replace
s-p s           Prefix Command
s-p t           projectile-toggle-between-implementation-and-test
s-p u           projectile-run-project
s-p v           projectile-vc
s-p x           Prefix Command
s-p z           projectile-cache-current-file
s-p <left>      projectile-previous-project-buffer
s-p <right>     projectile-next-project-buffer

C-c p ESC       projectile-project-buffers-other-buffer
C-c p SPC       counsel-projectile
C-c p !         projectile-run-shell-command-in-root
C-c p &         projectile-run-async-shell-command-in-root
C-c p 4         Prefix Command
C-c p 5         Prefix Command
C-c p C         projectile-configure-project
C-c p D         projectile-dired
C-c p E         projectile-edit-dir-locals
C-c p F         projectile-find-file-in-known-projects
C-c p I         projectile-ibuffer
C-c p O         Prefix Command
C-c p P         projectile-test-project
C-c p R         projectile-regenerate-tags
C-c p S         projectile-save-project-buffers
C-c p T         projectile-find-test-file
C-c p V         projectile-browse-dirty-projects
C-c p a         projectile-find-other-file
C-c p b         projectile-switch-to-buffer
C-c p c         projectile-compile-project
C-c p d         projectile-find-dir
C-c p e         projectile-recentf
C-c p f         projectile-find-file
C-c p g         projectile-find-file-dwim
C-c p i         projectile-invalidate-cache
C-c p j         projectile-find-tag
C-c p k         projectile-kill-buffers
C-c p l         projectile-find-file-in-directory
C-c p m         projectile-commander
C-c p o         projectile-multi-occur
C-c p p         projectile-switch-project
C-c p q         projectile-switch-open-project
C-c p r         projectile-replace
C-c p s         Prefix Command
C-c p t         projectile-toggle-between-implementation-and-test
C-c p u         projectile-run-project
C-c p v         projectile-vc
C-c p x         Prefix Command
C-c p z         projectile-cache-current-file
C-c p <left>    projectile-previous-project-buffer
C-c p <right>   projectile-next-project-buffer

s-p O a         counsel-projectile-org-agenda
s-p O c         counsel-projectile-org-capture

s-p x e         projectile-run-eshell
s-p x g         projectile-run-gdb
s-p x i         projectile-run-ielm
s-p x s         projectile-run-shell
s-p x t         projectile-run-term
s-p x v         projectile-run-vterm

s-p s g         projectile-grep
s-p s i         counsel-projectile-git-grep
s-p s r         projectile-ripgrep
s-p s s         projectile-ag

s-p 5 D         projectile-dired-other-frame
s-p 5 a         projectile-find-other-file-other-frame
s-p 5 b         projectile-switch-to-buffer-other-frame
s-p 5 d         projectile-find-dir-other-frame
s-p 5 f         projectile-find-file-other-frame
s-p 5 g         projectile-find-file-dwim-other-frame
s-p 5 t         projectile-find-implementation-or-test-other-frame

s-p 4 C-o       projectile-display-buffer
s-p 4 D         projectile-dired-other-window
s-p 4 a         projectile-find-other-file-other-window
s-p 4 b         projectile-switch-to-buffer-other-window
s-p 4 d         projectile-find-dir-other-window
s-p 4 f         projectile-find-file-other-window
s-p 4 g         projectile-find-file-dwim-other-window
s-p 4 t         projectile-find-implementation-or-test-other-window

C-c p O a       counsel-projectile-org-agenda
C-c p O c       counsel-projectile-org-capture

C-c p x e       projectile-run-eshell
C-c p x g       projectile-run-gdb
C-c p x i       projectile-run-ielm
C-c p x s       projectile-run-shell
C-c p x t       projectile-run-term
C-c p x v       projectile-run-vterm

C-c p s g       projectile-grep
C-c p s i       counsel-projectile-git-grep
C-c p s r       projectile-ripgrep
C-c p s s       projectile-ag

C-c p 5 D       projectile-dired-other-frame
C-c p 5 a       projectile-find-other-file-other-frame
C-c p 5 b       projectile-switch-to-buffer-other-frame
C-c p 5 d       projectile-find-dir-other-frame
C-c p 5 f       projectile-find-file-other-frame
C-c p 5 g       projectile-find-file-dwim-other-frame
C-c p 5 t       projectile-find-implementation-or-test-other-frame

C-c p 4 C-o     projectile-display-buffer
C-c p 4 D       projectile-dired-other-window
C-c p 4 a       projectile-find-other-file-other-window
C-c p 4 b       projectile-switch-to-buffer-other-window
C-c p 4 d       projectile-find-dir-other-window
C-c p 4 f       projectile-find-file-other-window
C-c p 4 g       projectile-find-file-dwim-other-window
C-c p 4 t       projectile-find-implementation-or-test-other-window

setup occur and how it works with swiper [50%]

it doesn’t seem to work well with swiper?

check out this guys emacs configuration

  • State “DOING” from [2019-09-11 Wed 22:49]

In particular, I would like to be able to find file at point in a given window using ace-window

There is find-file-in-project, which is closely related to ivy.

add support for emojis inside emacs on os x

<2020-03-29 Sun>

copy what Daniel Mai has apparently done in his config: Font

edit filenames inline

  • edit dired inline
  • use C-x C-q to edit a filename inline
  • it looks like this is a function provided by dired+, not in stock dired.
  • and with mc mark all, one can edit multiple filenames at once.

explore tramp

  • my tramp notes
  • ivy info on using tramp

General

  • figure out how to get bookmarks? to open file: references in org files defined by org-store-link
  • Find a mechanism to apply configurations to a set of file identified by a predicate
    • eg a way to specify a specific code formatting policy to work vs personal files
    • ask in reddit?

From Howard

maybe explore these

Howard has a bunch of Technical Artifacts sections

Consider reading these for the insights they may contain

Howard has a bunch of font choices. But I don’t know how he possibly installs these fonts. So stick with Monaco for the short term. Well, now I know a bit more about installing fonts. At least, installing Hack.

Here is where Howard chooses between his mac and linux configurations

From Daniel Mai

DEFERRED explore dired mode

  • State “DEFERRED” from “DOING” [2020-03-29 Sun 17:03]
    I think my use of dired is ok now. Moving this down in priority.
  • State “DOING” from “TODO” [2019-09-09 Mon 08:11]
  • [X] read the Help for dired
  • [X] Zamansky videos
    • [X] Using emacs 38 - dired
    • [X] Using emacs 57 - dired narrow
  • [X] what does dired+ add to the picture?
    • [X] read the dired+ docs
    • A: IDK; I couldn’t find a package dired+

CANCELLED consider re-adding try to emacs

  • State “CANCELLED” from [2020-03-29 Sun 21:25]
    not going to do this.

investigate dired-x

  • State “DONE” from “DOING” [2019-09-11 Wed 21:27]
  • State “DOING” from [2019-09-11 Wed 08:07]
  • [ ] read the manual Dired Extra
    • [ ] do any of the emacs folks I follow use dired-x? A: yes they do.
    find /t/emacs-configs -type f -name \*.el -maxdepth 4 | xargs fgrep -l dired-x
        
    • bbatsov has a nice config
      (use-package dired
        :config
        ;; dired - reuse current buffer by pressing 'a'
        (put 'dired-find-alternate-file 'disabled nil)
      
        ;; always delete and copy recursively
        (setq dired-recursive-deletes 'always)
        (setq dired-recursive-copies 'always)
      
        ;; if there is a dired buffer displayed in the next window, use its
        ;; current subdir, instead of the current subdir of this dired buffer
        (setq dired-dwim-target t)
      
        ;; enable some really cool extensions like C-x C-j(dired-jump)
        (require 'dired-x))
              
    • abo-abo has an involved config
    • and a simple one
      (use-package dired
        :commands dired
        :init
        (setq dired-listing-switches
              (if (memq system-type '(windows-nt darwin))
                  "-alh"
                  "-laGh1v --group-directories-first")))
      (use-package dired-x
        :commands dired-jump)
              
  • I definitely want =dired-jump= and =dired-dump-other-window=
  • here is how to write elisp to mark files in dired buffer
  • I think I do not want the =dired-x-find-file= stuff

read about how abo-abo uses dired

other dired investigations

  • State “NEXT” from “DOING” [2020-02-01 Sat 19:00]
  • State “DOING” from [2019-09-30 Mon 11:56]
  • [X] read jcs dired article
    • but apparently I need ivy-occur to make this all work?
  • [ ] read about dired-narrow
  • [ ] learn to make new directories?
  • [ ] move files around within those directories

notes

  • One can mark based on regex
  • and invert the selection
    • ie mark all .jpeg files
    • then mark all files in the directory that are not .jpeg files

switch to counsel, counsel-projectile [100%]

  • State “DONE” from “DOING” [2020-03-29 Sun 21:05]
  • State “DOING” from [2019-09-02 Mon 21:50]
  • [X] enable the config
  • [X] make a table of common keybindings that I would want to use.
  • [X] Read the docs to get the basic key bindings down.
  • [X] set up counsel-rg to use ripgrep on vega and sift mac
    • [X] on vega
    • [X] on sift mac

DEFERRED investigate ivy-push-view

  • State “DEFERRED” from “DOING” [2020-03-29 Sun 17:04]
    interesting, but not right now.
  • State “DOING” from [2019-09-02 Mon 20:52]

ivy-push-view appears to have some basic window layout capture functionality. And since I am wanting to try the whole ivy/counsel combo in preference to helm, lets just do that and try out ivy-push-view as part of that refactoring.

make a links section to my favorite authors’ config files

  • State “DONE” from [2020-03-29 Sun 17:05]
  • both on the web and to my local copies

figure out how to search at point with swiper

  • State “DONE” from “DOING” [2020-03-29 Sun 14:11]
  • State “DOING” from [2020-03-15 Sun 20:49]

the answer here is M-j, which is ivy-yank-word.

I often want to search for the text at point with swiper Like I used to do with i-search

I’m sure this is possible; I just don’t know how to do it.

the method is: swiper-thing-at-point

is there a binding for it? A: no.

I can also yank text into the ivy completion buffer.

Looks like the magic is M-j bound to ivy-yank-word

the key bindings are displayed by

M-x describe-function ivy-mode

reddit thread about most useful parts of ivy

add a key-binding C-c ~ to insert ~~ pairs

  • State “DONE” from “DOING” [2020-03-29 Sun 14:04]

explore wrap-region

  • State “DONE” from “DOING” [2020-03-29 Sun 14:04]
  • State “DOING” from [2020-03-29 Sun 13:21]

Added the below config; lets see how I like it.

It looks like Howard has started using =wrap-region=.

And I like his keyboard mapping to add pairs of characters with meta bindings:

(global-set-key (kbd "M-[") 'insert-pair)
(global-set-key (kbd "M-{") 'insert-pair)
(global-set-key (kbd "M-<") 'insert-pair)
(global-set-key (kbd "M-'") 'insert-pair)
(global-set-key (kbd "M-`") 'insert-pair)
(global-set-key (kbd "M-\"") 'insert-pair)

So see if I can’t just follow that pattern and ease my code editing in org-mode particularly.

bind-key vs define-key

  • State “DONE” from “DOING” [2020-03-29 Sun 14:04]
  • State “DOING” from “DONE” [2020-02-03 Mon 13:38]
  • State “DONE” from “NEXT” [2020-02-03 Mon 13:24]
  • State “NEXT” from [2020-02-03 Mon 13:18]

Howard uses bind-key in his definitions.

However, the emacs manual changing key bindings does not mention bind-key, instead uses define-key. Why?

Well, it looks like `bind-key` is a use-package level macro with different evaluation implications.

Here is the full snippet that Howard uses to define some of his org mode keys:

(use-package org
  :config
   (bind-keys :map org-mode-map
   ("A-b" . (surround-text-with "+"))
   ("s-b" . (surround-text-with "*"))
   ("A-i" . (surround-text-with "/"))
   ("s-i" . (surround-text-with "/"))
   ("A-=" . (surround-text-with "="))
   ("s-=" . (surround-text-with "="))
   ("A-`" . (surround-text-with "~"))
   ("s-`" . (surround-text-with "~"))

   ("C-s-f" . forward-sentence)
   ("C-s-b" . backward-sentence)))

however, Howard used define-key at the top of his org file as well:

(define-key org-mode-map (kbd "M-C-n") 'org-end-of-item-list)
(define-key org-mode-map (kbd "M-C-p") 'org-beginning-of-item-list)
(define-key org-mode-map (kbd "M-C-u") 'outline-up-heading)
(define-key org-mode-map (kbd "M-C-w") 'org-table-copy-region)
(define-key org-mode-map (kbd "M-C-y") 'org-table-paste-rectangle)

(define-key org-mode-map [remap org-return] (lambda () (interactive)
                                              (if (org-in-src-block-p)
                                                  (org-return)
                                                (org-return-indent)))))

so there seems to be some clear evaluation time discrimination going on here.

hypothesis:

  • surround-text-with is not defined until initialization time
  • bind-keys defers the actual call (it is a special form) until it is evaluated at init time
    • reducing the ordering problem on which set of Howard’s many init files get evaluated first
  • bind-keys calls define-key under the covers
CANCELLED does bind-key call define-key?
  • State “CANCELLED” from [2020-03-29 Sun 13:12]

Assume the answer is yes, or that the answer does not really matter to this work.

create a org-mode-map keymap?

  • State “DONE” from “NEXT” [2020-03-29 Sun 13:06]

and/or investigate if I can generate an Alt or Super keyboard prefix from my mac os x keyboard. As described by `C-h c`:

Cmd maps to Meta Option maps to Super

So I should be able to use Howards bindings above, once I figure out how to create an org-mode-map.

(define-key org-mode-map (kbd "s-=") 'jwm/mac-p)

so that does work, even though jwm/mac-p is not an interactive function.

does org-mode define the symbol org-mode-map?

  • State “DONE” from “NEXT” [2020-03-29 Sun 13:01]
  • State “NEXT” from [2020-02-03 Mon 13:30]

It certainly appears to.

org-mode-map is a variable defined in ‘org.el’.

first attempt

  • State “DONE” from [2020-03-29 Sun 12:50]
  • State “DOING” from “TODO” [2019-05-06 Mon 08:39]

<2018-09-13 Thu>

or find the idiom from one my emacs dot file authors and replicate it. Looks like this is the idiom from howard:

howardabrams-dot-files/emacs-org.org
108:       (bind-key "A-`" (surround-text-with "~") org-mode-map)
109:       (bind-key "s-`" (surround-text-with "~") org-mode-map))

find a key to bind it to

  • State “DONE” from [2020-03-29 Sun 12:48]

tldr: I now have super bound to the mac os option key, as distinct from meta bound to the mac os command key.

the problem with this is that I can’t figure out how to generate a “A-” or a “s-” prefix from my mac keyboard the way I have it set up.

Maybe send a message to the emacs reddit? Or go look at the code that implements mac key bindings for a hint. So Left-option is already bound to “s-“. So I am good to go there. It looks like Howard has set up an org-mode-map. I should do that as well.

what is the difference in org mode between equals, tilde and back quote?

  • State “DONE” from [2020-02-03 Mon 13:30]

According to the org mode markup guide, specifically emphasis and monospace,

You can make words ‘*bold*’, ‘/italic/’, ‘_underlined_’, ‘=verbatim=’ and ‘~code~’, and, if you must, ‘+strike-through+’. Text in the code and verbatim string is not processed for Org specific syntax; it is exported verbatim.

So the answer is that:

  • backquote does not have any special meaning
  • tilde is for code
  • equals is for verbatim

add a recent keybinding section to visible docs

  • State “DONE” from “DOING” [2020-03-29 Sun 12:45]
  • State “DOING” from [2020-03-13 Fri 08:11]

the observation is that I often need a way to establish key combinations for recently acquired functionality.

Examples:

tangle babel

C-c C-v t

yasnippet / auto-yasnippet

C-c & C-s   yas-insert-snippet
s-w         aya-create
s-y         aya-expand

use emacs-cheat-sheet for this task

  • [ ] refactor to put my most recently used bindings at the top
  • [ ] add a new section “new bindings to get used to”

add support for avy

  • State “DONE” from [2020-03-28 Sat 21:38]

what do others do with avy?

it looks like the main avy function in use is avy-goto-char-timer

❯ for d in $PWD/*(/); do (cd $d && print ${d}/ && git grep -w avy-goto-char-timer); done | pbcopy

/Users/jeff/thirdparty/emacs-configs/abo-abo-dotemacs/
keys.el:(global-set-key (kbd "C-'") 'avy-goto-char-timer)
modes/ora-avy.el:  ("s" avy-goto-char-timer)

/Users/jeff/thirdparty/emacs-configs/howardabrams-dot-files/
emacs-evil.org:                  ("t" . avy-goto-char-timer)
emacs-evil.org:        "j" 'avy-goto-char-timer
emacs.org:     (global-set-key (kbd "s-h") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "s-j") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "A-h") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "A-j") 'avy-goto-char-timer)

/Users/jeff/thirdparty/emacs-configs/jwiegley-dotemacs/
init.el:  :bind* ("C-." . avy-goto-char-timer)

/Users/jeff/thirdparty/emacs-configs/steve-purcell-dotemacs/
lisp/init-editing-utils.el:  (global-set-key (kbd "C-;") 'avy-goto-char-timer))

looks like we have 3 variants of binding it to C-something:

  • C-.
  • C-;
  • =C-‘=

I guess I will choose C-., following jwiegley here.

(use-package avy
  :bind* ("C-." . avy-goto-char-timer)
  :config
  (avy-setup-default))
grep avy
❯ for d in $PWD/*(/); do (cd $d && print $(pwd) && git grep -w avy); done | pbcopy

/Users/jeff/thirdparty/emacs-configs/abo-abo-dotemacs
init.el:(require 'ora-avy)
keys.el:(global-set-key (kbd "C-'") 'avy-goto-char-timer)
keys.el:(global-set-key (kbd "π") 'avy-goto-char)                    ; [p]
keys.el:(global-set-key (kbd "M-t") 'avy-goto-word-or-subword-1)
keys.el:(global-set-key (kbd "M-p") 'avy-pop-mark)
keys.el:(global-set-key (kbd "C-c C-j") 'avy-resume)
keys.el:(global-set-key (kbd "C-π") 'avy-resume)
keys.el:(global-set-key (kbd "M-g g") 'avy-goto-line)
keys.el:(global-set-key (kbd "C-M-g") 'avy-goto-line)
keys.el:(global-set-key (kbd "M-g e") 'avy-goto-word-0)
keys.el:(global-set-key (kbd "M-g w") 'avy-goto-word-1)
keys.el:(global-set-key (kbd "M-g s") 'avy-goto-subword-0)
keys.el:  ("a" vimish-fold-avy "avy")
loaddefs.el:;;;### (autoloads nil "modes/ora-avy" "modes/ora-avy.el" (0 0 0 0))
loaddefs.el:;;; Generated autoloads from modes/ora-avy.el
loaddefs.el:(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "modes/ora-avy" '("hydra-avy")))
modes/ora-avy.el:(avy-setup-default)
modes/ora-avy.el:(csetq avy-all-windows t)
modes/ora-avy.el:(csetq avy-all-windows-alt nil)
modes/ora-avy.el:(csetq avy-styles-alist '((avy-goto-char-2 . post)
modes/ora-avy.el:                          (ivy-avy . pre)
modes/ora-avy.el:                          (avy-goto-line . pre)))
modes/ora-avy.el:;; (advice-add 'swiper :before 'avy-push-mark)
modes/ora-avy.el:;; (advice-remove 'swiper 'avy-push-mark)
modes/ora-avy.el:(csetq avy-keys-alist
modes/ora-avy.el:(defhydra hydra-avy (:color teal)
modes/ora-avy.el:  ("j" avy-goto-char)
modes/ora-avy.el:  ("k" avy-goto-word-1)
modes/ora-avy.el:  ("l" avy-goto-line)
modes/ora-avy.el:  ("s" avy-goto-char-timer)
modes/ora-avy.el:(defhydra hydra-avy-cycle ()
modes/ora-avy.el:  ("j" avy-next "next")
modes/ora-avy.el:  ("k" avy-prev "prev")
modes/ora-avy.el:(global-set-key (kbd "C-M-'") 'hydra-avy-cycle/body)
modes/ora-avy.el:(provide 'ora-avy)
modes/ora-elisp.el:    (setq lispy-avy-style-symbol 'at-full)))
modes/ora-eww.el:(require 'avy)
modes/ora-eww.el:  (call-interactively #'avy-goto-char)
modes/ora-javascript.el:  (setq-local avy-subword-extra-word-chars nil)

/Users/jeff/thirdparty/emacs-configs/andreyorst-dotfiles
/Users/jeff/thirdparty/emacs-configs/bbatsov-dotemacs
init.el:(use-package avy
init.el:  :bind (("s-." . avy-goto-word-or-subword-1)
init.el:         ("s-," . avy-goto-char))
init.el:  (setq avy-background t))

/Users/jeff/thirdparty/emacs-configs/danielmai-dotemacs
config.org:   ("C-'" . ivy-avy))
config.org:(use-package avy
config.org:  :bind ("C-S-s" . avy-goto-char))

/Users/jeff/thirdparty/emacs-configs/ebzzry-dotfiles
/Users/jeff/thirdparty/emacs-configs/editorconfig-emacs
/Users/jeff/thirdparty/emacs-configs/greendog-gtd
/Users/jeff/thirdparty/emacs-configs/helm-ag

/Users/jeff/thirdparty/emacs-configs/howardabrams-dot-files
emacs-evil.org:                  ;; Wanna rebind f to avy?
emacs-evil.org:                  ;; How about avy to 't'?
emacs-evil.org:                  ("t" . avy-goto-char-timer)
emacs-evil.org:                  ("T" . avy-goto-word-timer)
emacs-evil.org:        "j" 'avy-goto-char-timer
emacs-fixes.org:   I find it better than =avy= when in a macro.t
emacs.org:   Mostly using the [[https://github.com/abo-abo/avy][avy]] project's [[help:avy-goto-word-timer][avy-goto-word-1]] function, so I bind
emacs.org:     (use-package avy
emacs.org:       :init (setq avy-background t))
emacs.org:     (global-set-key (kbd "s-h") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "s-j") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "s-H") 'avy-pop-mark)
emacs.org:     (global-set-key (kbd "s-J") 'avy-pop-mark)
emacs.org:     (global-set-key (kbd "A-h") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "A-j") 'avy-goto-char-timer)
emacs.org:     (global-set-key (kbd "A-H") 'avy-pop-mark)
emacs.org:     (global-set-key (kbd "A-J") 'avy-pop-mark)

/Users/jeff/thirdparty/emacs-configs/jwiegley-dotemacs
init.el:(use-package avy
init.el:  :bind* ("C-." . avy-goto-char-timer)
init.el:  (avy-setup-default))
init.el:(use-package avy-zap
init.el:  :bind (("M-z" . avy-zap-to-char-dwim)
init.el:         ("M-Z" . avy-zap-up-to-char-dwim)))
init.el:              ("C-." . swiper-avy)
settings.el: '(avy-case-fold-search t)
settings.el: '(avy-keys (quote (97 111 101 117 105 100 104 116 110 115)))
settings.el: '(avy-timeout-seconds 0.3)

/Users/jeff/thirdparty/emacs-configs/munen-emacs.d
/Users/jeff/thirdparty/emacs-configs/prelude
README.md:<kbd>jj</kbd>      | Jump to the beginning of a word(`avy-goto-word-1`)
README.md:<kbd>jk</kbd>      | Jump to a character(`avy-goto-char`)
README.md:<kbd>jl</kbd>      | Jump to the beginning of a line(`avy-goto-line`)
core/prelude-editor.el:;; avy allows us to effectively navigate to visible things
core/prelude-editor.el:(require 'avy)
core/prelude-editor.el:(setq avy-background t)
core/prelude-editor.el:(setq avy-style 'at-full)
core/prelude-global-keybindings.el:(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
core/prelude-global-keybindings.el:(global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)
core/prelude-packages.el:    avy
modules/prelude-evil.el:;;; enable avy with evil-mode
modules/prelude-evil.el:(define-key evil-normal-state-map (kbd "SPC") 'avy-goto-word-1)
modules/prelude-key-chord.el:(key-chord-define-global "jj" 'avy-goto-word-1)
modules/prelude-key-chord.el:(key-chord-define-global "jl" 'avy-goto-line)
modules/prelude-key-chord.el:(key-chord-define-global "jk" 'avy-goto-char)
sample/prelude-pinned-packages.el:        (avy . "melpa-stable")

/Users/jeff/thirdparty/emacs-configs/sacha-chua-dotemacs
Sacha.org:      (key-chord-define-global "jj"     'avy-goto-word-1)
Sacha.org:      (key-chord-define-global "jl"     'avy-goto-line)
Sacha.org:      ;(key-chord-define-global "jZ"     'avy-zap-to-char)
Sacha.org:  (use-package avy)
Sacha.org:(use-package avy-zap
Sacha.org:  (("M-z" . avy-zap-up-to-char-dwim)
Sacha.org:   ("M-Z" . avy-zap-to-char-dwim)))

/Users/jeff/thirdparty/emacs-configs/sirpscl-emacs.d
/Users/jeff/thirdparty/emacs-configs/smartparens

/Users/jeff/thirdparty/emacs-configs/steve-purcell-dotemacs
lisp/init-editing-utils.el:(when (maybe-require-package 'avy)
lisp/init-editing-utils.el:  (global-set-key (kbd "C-;") 'avy-goto-char-timer))
expand in org mode
for d in *(/); do
  (cd $d && print -- $(pwd) && print $d && git grep -w avy)
done | sed 4q
zsh -f <<'EOF'
<<find-other-emac-users-use-of-avy>>
EOF

will bash work with that example as well?

bash <<'EOF'
<<find-other-emac-users-use-of-avy>>
EOF

A: no, the result is:

bash: line 1: syntax error near unexpected token `('
bash: line 1: `for d in *(/); do'
literal expansion
zsh -f <<'EOF'
for d in $(print *(/)); do
  (cd $d && print -- $(pwd) && print $d && git grep -w avy)
done | sed 10q
EOF

build a better emacs / python working env

  • State “DONE” from “TODO” [2020-03-14 Sat 14:42]

<2020-03-14 Sat>

Mike Z uses the inferior python process C-c C-p to test his python code the binding in elpy is C-c C-z Much like my use of the terminal

The interaction with virtualenv/pipenv makes thats style hard for me? A: elpy has explicit support for virtual envs via pyvenv

inferior python usage

  • State “DONE” from [2020-03-14 Sat 14:42]

answer: re-installing brew python3, and configuring emacs to prefer python3 works here.

working notes
  • State “DONE” from [2020-03-14 Sat 13:33]

start in ~/tmp/foo.py

here is what i get:

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and “python” is not part of the ‘python-shell-completion-native-disabled-interpreters’ list. Native completions have been disabled locally.

what is my current python setup? nil

  • [X] So try out the generic elpy install

and try inferior python again:

same result

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and “python” is not part of the ‘python-shell-completion-native-disabled-interpreters’ list. Native completions have been disabled locally.

So try generic elpy configuration, ie, emacs menu -> elpy -> config then I see:

Elpy Configuration

Emacs………….: 26.2 Elpy…………..: 1.32.0 Virtualenv……..: None Interactive Python: python 2.7.16 (usr/bin/python) RPC virtualenv….: rpc-venv (/Users/jeff.emacs.d/elpy/rpc-venv) Python………..: python 3.7.7 (Users/jeff.emacs.d/elpy/rpc-venv/bin/python) Jedi………….: 0.16.0 Rope………….: 0.16.0 Autopep8………: 1.5 Yapf………….: 0.29.0 Black…………: 19.10b0 Syntax checker….: Not found (flake8)

Warnings

You have not activated a virtual env. While Elpy supports this, it is often a good idea to work inside a virtual env. You can use M-x pyvenv-activate or M-x pyvenv-workon to activate a virtual env.

The directory ~/.local/bin/ is not in your PATH. As there is no active virtualenv, installing Python packages locally will place executables in that directory, so Emacs won’t find them. If you are missing some commands, do add this directory to your PATH – and then do `elpy-rpc-restart’.

The configured syntax checker could not be found. Elpy uses this program to provide syntax checks of your programs, so you might want to install one. Elpy by default uses flake8.

[Install flake8]

Options

so elpy has explicit support for virtualenv but at present, does not seem to ahve any support for pipenv? Correct.

however, a google search reveals many sources:

trying setting WORKON_HOME for emacs at invocation time:

❯ WORKON_HOME=$HOME/.local/share/virtualenvs emacs foo.py

this initial experiment did not work:

Elpy Configuration

Emacs………….: 26.2 Elpy…………..: 1.32.0 Virtualenv……..: None Interactive Python: python 2.7.16 (usr/bin/python) RPC virtualenv….: rpc-venv (/Users/jeff.emacs.d/elpy/rpc-venv) Python………..: python 3.7.7 (Users/jeff.emacs.d/elpy/rpc-venv/bin/python) Jedi………….: 0.16.0 Rope………….: 0.16.0 Autopep8………: 1.5 Yapf………….: 0.29.0 Black…………: 19.10b0 Syntax checker….: Not found (flake8)

Warnings

You have not activated a virtual env. While Elpy supports this, it is often a good idea to work inside a virtual env. You can use M-x pyvenv-activate or M-x pyvenv-workon to activate a virtual env.

NB: I don’t seem to have the pyenv- group of funcions inside emacs either. A: user-error. they are pyvenv, not pyenv.

make interactive python == python3
  • State “DONE” from [2020-03-14 Sat 13:32]

so I set python3 as the python shell interpreter in the elpy settings and that seems to work. So try setting that in my generic configuration. that works.

  • [X] Commit that code.
  • [X] And take it out of settings.el
prefer pipenv location for virtualenv over virtualenv
  • State “DONE” from [2020-03-14 Sat 13:58]
where do I store environment vars? A: $HOME/.exports
  • State “DONE” from [2020-03-14 Sat 14:06]

where is ~/.exports defined? which project? A: jwm-dotfiles

what is $HOME/.local about?
  • State “DONE” from [2020-03-14 Sat 13:47]

An answer from stackoverflow

The /usr/local directory mirrors the structure of the /usr directory, but can be used by system administrators to install local or third party packages for all users.

The ~/.local directory now has the same purpose just for a single user.

show that it works
  • State “DONE” from [2020-03-14 Sat 14:11]

So after these changes, and

M-x pyvenv-workon treasury-scraper-xxxx

now elpy reports:

Elpy Configuration

Emacs………….: 26.2 Elpy…………..: 1.32.0 Virtualenv……..: (Users/jeff.local/share/virtualenvs/treasury-scraper-1HRn0RJi/) Interactive Python: python3 3.7.7 (Users/jeff.local/share/virtualenvs/treasury-scraper-1HRn0RJi/bin/python3)

make flake8 work

  • State “DONE” from [2020-03-14 Sat 14:42]

get it installed figure out how to invoke it

installed
  • State “DONE” from [2020-03-14 Sat 14:16]

(treasury-scraper) ❯ pipenv install –dev flake8 …

Elpy Configuration

Emacs………….: 26.2 Elpy…………..: 1.32.0 Virtualenv……..: (Users/jeff.local/share/virtualenvs/treasury-scraper-1HRn0RJi/) Interactive Python: python3 3.7.7 (Users/jeff.local/share/virtualenvs/treasury-scraper-1HRn0RJi/bin/python3) RPC virtualenv….: rpc-venv (Users/jeff.emacs.d/elpy/rpc-venv) Python………..: python 3.7.7 (Users/jeff.emacs.d/elpy/rpc-venv/bin/python) Jedi………….: 0.16.0 Rope………….: 0.16.0 Autopep8………: 1.5 Yapf………….: 0.29.0 Black…………: 19.10b0 Syntax checker….: flake8 (Users/jeff.local/share/virtualenvs/treasury-scraper-1HRn0RJi/bin/flake8)

usage
  • State “DONE” from [2020-03-14 Sat 14:41]

keybinding appears to be C-c C-v

configure a long line for flake8 default: 79 -> 108
  • State “DONE” from [2020-03-14 Sat 14:41]

looks like the value can be defined several places, including in ~/.config/flake8

configure yasnippet and auto yasnippet

  • State “DONE” from “DOING” [2020-03-11 Wed 19:16]
  • State “DOING” from [2020-03-10 Tue 20:49]

Mike Z has a couple of nice videos here

use case: github issue template use case: table to report in financial review meetings

In particular, the auto snippet functionality looks useful to my normal flow. and auto yasnippets is from aboabo

what snippets do I have loaded?

  • State “DONE” from [2020-03-10 Tue 21:42]
yas-snippet-dirs
tree ~/.emacs.d/elpa/yasnippet-snippets-20200122.1140

snippet modes that look useful to me

  • State “DONE” from [2020-03-12 Thu 21:08]
  • org mode
  • python mode
  • sh mode

DOING read yasnippet docs

  • State “DOING” from [2020-03-10 Tue 21:59]

Prefer per-mode configuration over global mode.

It looks like I also want yasnippets-snippets

  • State “DONE” from [2020-03-10 Tue 21:58]

    according to the docs yas-snippet-dirs default takes into account both a personal snippet dir, and the bundled snippets. so no need for me to over ride that one

  • State “DONE” from [2020-03-10 Tue 21:59]

I can expand a mode specific snippet via C-c & C-s

what yasnippets config did I used to have?

  • State “DONE” from [2020-03-10 Tue 21:59]

here it is

it looks pretty vanilla; just with yas-global-mode seems a bit questionable to me.

Get a working eshell

  • State “DONE” from “DOING” [2020-02-03 Mon 19:13]
  • State “DOING” from [2019-09-02 Mon 22:09]

Well, it appears that my hack to disable reading init files for zsh has had the side effect of making zsh be an effective shell for eshell. Huzzah!

That apparently also has the benefit that I can now start to work through the eshell

  • [X] Explore the three shell modes in the play emacs like an instrument video (local copy)
    • it looks like Alain was using eshell mostly
  • [ ] and there is Howards Introduction to Eshell (local copy)

evaluate better shell

DEFERRED Install Essential Packages

  • State “DEFERRED” from [2020-02-01 Sat 18:46]
    these will not be needed until much later.

Tier 2: Maybe, Consider These

Packages that I most likely want to keep, but which need some investigation to validate:

  • undo-tree
  • flycheck
  • elpy
    • python programming mode from Howard
    • check it out
  • yaml-mode
  • visual-regexp
  • I would like to consider git-gutter-fringe
  • ox-twbs
    • twitter bootstrap rendering of generated org mode files
  • avy
  • jedi from Howards config
  • imenu-anywhere
  • Howards font size increase/decrease functions
  • superword mode? jwm::comment-region, jwm::c-ifdef-region?
(defun jwm::prog-mode-hook ()
  (superword-mode t))
(add-hook 'prog-mode-hook #'jwm::prog-mode-hook)
  • maybe: yasnippet

Open Questions

tabs not working?

Tabs; it looks like my tab-wdith setting is not taking effect

(setq tab-width 2)

Resources

good literate configs to read, and selectively pick from

  • State “DOING” from [2019-07-21 Sun 16:12]
  • pull the ‘use dumb term in zsh’ so emacs shell can run zsh for me, just without colors
  • munen references this config as a good example as well
  • I like the keyboard hints he has at the top of his config as well