Skip to content

Latest commit

 

History

History
512 lines (438 loc) · 19.9 KB

convert-emacs-init-to-literate.org_archive

File metadata and controls

512 lines (438 loc) · 19.9 KB

Archived entries from file /Users/jeff/jwm/proj/literate-emacs.d/convert-emacs-init-to-literate.org

Next Up

  • [X] do I have access to Alain’s config?
  • add some bindings for:
    • split window
      • vertically
      • horizontally
  • or maybe work on shell mode?!
    • 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 Introcution to Eshell (local copy)
  • switch to counsel and see if I prefer it to helm?
    • that might also enable tramp mode, which I would like to get done
  • explore winner mode to manipulate a stack of window configurations
  • explore undo-tree
  • explore the limits of dired mode
    • learn to make new directories
    • move files around within those directories

Done

  • [X] rm .emacs.jwm.d
    • vega
    • sift mac
  • [X] git rm the classic config from jwm-dotfiles
  • [X] fix diff-dot-files to use the literate emacs config

Done

  • [X] investigate helm-occur as a replacement for isearch and/or swiper
    • no, I decided to use swiper for C-s
  • [X] exec-path-from-shell
    • evaluated, and I am not going to use this at this time.
  • [X] consider moving my old revert-buffer binding from C-x y to C-c u per Daniel
  • [X] consider setting up abo-abo’s ace-window
  • [X] json-mode
  • [X] Daniels org-babel config looks good for my use case

Done or Otherwise Completed

  • [X] Consider swapping out my default emacs config for this new one.
  • [X] Turn off all disabled emacs commands; follow Howards config there.
  • NO NOT NEEDED company
    • do I use this now? I am not really sure
    • is this compatible with ivy, swiper, counsel?
    • I don’t think so.
    • I think company and counsel are both completion frameworks
  • [X] babel
    • enough to support shell
    • and particularly iterating on jq recipes
    • from Daniel Mai
  • [X] js2-mode
  • [X] json-mode
  • terraform-mode
  • [X] crux
    • which of these functions do I actually use?
      • rename buffer and file every once in a while
    • yes, probably add this back in
  • expand-region

Tier 3: Drop These in this Refactor

not used enough

  • key-chord
  • macro-step
  • rbenv
  • robe
  • scala-mode
  • winner
    • replace with eyebrowse?

packages I never use

Goals Achieived

  • [X] how to use projectile to navigate between projects as I so often want to do
    • between notes and work projects specifically
  • [X] create support for bash execution in org babel sections
    • ie literate programming using bash at the shell

explore a window configuration manager

  • State “DONE” from “DOING” [2019-09-02 Mon 21:18]
  • State “DOING” from [2019-09-02 Mon 20:52]
  • reddit topic: suggestions for a window resizer
  • winner is built in apparently
  • what is eyebrowse?
    • provides bindings to window configurations
  • what does Zamansky use?
    • he has a video on eyebrowse

Ok, I setup eyebrowse.

explore using PCRE regexp patterns across emacs

  • State “DONE” from [2019-09-11 Wed 22:48]

this seems like a win to me; only one regex syntax to remember.

  • package: pcre2el

But this package has not been updated since 2016.

And its author recommends learning emacs regexp syntax.

So pass on this package.

preliminaries

  • State “DONE” from “DOING” [2019-07-30 Tue 20:41]
  • State “DOING” from “DONE” [2019-07-30 Tue 17:48]
  • State “DONE” from “DOING” [2019-07-26 Fri 08:33]
  • State “DOING” from [2019-07-21 Sun 12:59]
  • what method should I use to publish the compile init file into my home directory?

REJECTED symlink to .emacs.d

  • State “DONE” from [2019-07-21 Sun 12:30]

how many other top level emacs directories do I have now?

❯ print -l ~/.emacs.jwm.d/**/*(.)
/Users/jeff/.emacs.jwm.d/elisp/c-m-supl.el
/Users/jeff/.emacs.jwm.d/elisp/jc_ctags.el
/Users/jeff/.emacs.jwm.d/elisp/jc_misc.el
/Users/jeff/.emacs.jwm.d/elisp/ps-ccrypt.el
/Users/jeff/.emacs.jwm.d/emacs-custom-23.el
/Users/jeff/.emacs.jwm.d/emacs-custom-24.el
/Users/jeff/.emacs.jwm.d/emacs-custom-future.el

I can just group all of that source code into my single literate file.

  • is this a new gh repo? A: no. Put it in jeff-dotfiles

DEFERRED move jeff-dotfiles to github from bitbucket

  • State “DEFERRED” from [2019-07-21 Sun 12:30]
    I don’t need to do this now; instead, create a separate emacs repo.

[these notes](https://gist.github.com/mandiwise/5954bbb2e95c011885ff) suggest that there is a githum import tool. check it out. 2FA did not work with that tool. This still makes sense for my dot files, to move them out of bitbucket I can move them around by configuring additional git remotes and syncing them that way.

git clone it in place

  • State “DONE” from “DOING” [2019-07-21 Sun 12:59]
  • State “DOING” from [2019-07-21 Sun 12:33]

Like munen does So create a new repo at github named emacs-d and undo the mechanism I have now to replace? move? the .emacs.d directory and .emacs.jwm.d

plan the transition

  • State “DONE” from “DOING” [2019-07-21 Sun 15:28]
  • State “DOING” from [2019-07-21 Sun 12:59]

how do I evolve my current config into a literate form while not screwing up my working emacs? A1: git branches Just build the new config on a git branch. Start the master with the git config at: jwm-dotfiles/.emacs.d and .emacs.jwm.d But that suggests that I collapse the .emacs.jwm.d functions into the main init.el first.

  • [X] So evaluate if I need any of those older functions.

choose to move the .emacs.d in and out of the home directory to facilitate working the transition.

  • [X] write 2 shell scripts to make it easier to rotate between configurations
    • prefer-literate-emacs-config
    • prefer-classic-emacs-config

figure out how to tangle init.el from the org file

  • State “DONE” from [2019-07-21 Sun 16:12]

munen: Alain doesn’t do any tangling of the org file into the init.el file; he just loads in the org file using org-babel-load-file check out SriPscl he does much the same as munen seems like this is a way to get bootstrapped here. what does Howard Abrams do? Howard has split out his org file into many individual file and has a build script (written in elisp) what does Sacha do?

My ~/.emacs.d/init.el is now a symlink to Sacha.el, which is what M-x org-babel-tangle (C-c C-v t) produces.

So Sacha writes her changes to Sacha.el, then tangles it, then revision controls the pair of files. She also splits out each elisp into a separate buffer with =C-c ‘= then she can run the debugger or eval buffer —- Decision: I am going to follow Sacha’s pattern, with one org file that I explicitly tangle

read the org babel introducton for context

  • State “DONE” from “DOING” [2019-07-30 Tue 20:37]
  • State “DOING” from [2019-07-26 Fri 08:51]

no, skip that intro; it appears to be quite out of date. it refers to a variable? org-babel-interpreters which doesn’t exist in my emacs.

  • [X] So read Working with source code in the guide instead

structure of a block

  • State “DONE” from [2019-07-30 Tue 20:37]
#+NAME: <name>
  <body>

switches: control the export of the block header args: control many aspects of the code block behavior

editing blocks

  • State “DONE” from [2019-07-30 Tue 20:37]

Use C-c ’ to enter and exit an evaluation buffer for that block

evaluating code blocks

  • State “DONE” from [2019-07-30 Tue 20:37]

Use C-c C-c in the block to evaluate it and insert its results in the emacs buffer. By default, only emacs-lisp is supported; other languages must be explicitly turned on. See the manual. (where?)

(+ 45 6)

another example

input

zsh block examples

  • State “DONE” from [2019-07-30 Tue 20:37]

According to the manual, this function will enable babel support for added languages

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (shell . t)))

Ok, that worked. So now try to execute some shell

awk '{print $2}' <<=eod
every good boy
does fine
eod

Ok, now figure out how to name which shell is invoked

sh_pid=$(echo "$$")
ps uww $sh_pid

good it is my shell; zsh

count how many lines are given to the input from a here document

wc <<=eod
every good boy
does fine
eod
  • State “DONE” from “DOING” [2019-07-30 Tue 20:39]
  • State “DOING” from [2019-07-26 Fri 08:52]

the library of babel source is a good example of org blocks with emacs-lisp to pattern after

read Org mode literal examples

  • State “DONE” from “DOING” [2019-07-30 Tue 20:41]
  • State “DOING” from [2019-07-28 Sun 15:05]

Looks like easy templates have what I want for expanding blocks of examples, especailly shell code

< - e  expands to BEGIN_EXAMPLE

and editing in those source blocks with ~C-c ‘~ is explicitly supported.

(defun xor (a b)
       (if (a
            a
            ! b)))

this example is not valid emacs-lisp

Archived entries from file /Users/jeff/jwm/proj/literate-emacs.d/convert-emacs-init-to-literate.org

start writing my updated config

  • State “DONE” from “DOING” [2020-02-01 Sat 18:29]
  • State “DOING” from “TODO” [2019-07-30 Tue 23:34]

write the first version and figure out how to get emacs to execute it

  • State “DONE” from [2019-07-30 Tue 23:30]

start with the basics

  • figure out how to make the most basic, valid emacs config initialization file
  • and test it
    • test the init fragments inside each block with C-c '= and =eval-buffer
    • then tangle and
      • emacs -Q -l init.el

how does Sacha tangle her file?

She names the output file in a file-scoped property, then runs C-c C-v t to generate that output.

Initial Goals [4/4]

  • State “DONE” from [2020-02-01 Sat 18:27]
  • [X] switch to a literate construction method for emacs
  • [X] prefer ivy, counsle and swiper over helm
  • [X] my color scheme applies to new frames; while the global color scheme applies to the startup frame. fix this?
  • [X] remove unnecessary :ensure t blocks in my use-package uses

literate emacs config: finish moving the working items to convert-emacs-init-to-literate.org

  • State “DONE” from “NEXT” [2020-02-01 Sat 18:36]
  • State “NEXT” from “TODO” [2020-02-01 Sat 18:25]

<2020-02-01 Sat>

  • [X] and add that to an agenda file so I can search next on it.

explore smex

  • State “DONE” from “TODO” [2019-09-09 Mon 07:55]
  • [X] read the smex docs

    > Smex is a M-x enhancement for Emacs. Built on top of Ido, it provides a convenient interface to your recently and most frequently used commands. And to all the other commands, too.

  • [X] does abo-abo use smex in his configuration?
  • so I don’t think smex is going to work for me with counsel
  • there is helm-smex though, so I could have smex if I went back to helm it appears

do I use ido? or just ivy, counsel and swiper

  • State “DONE” from “DOING” [2020-02-01 Sat 18:53]
    • State “DOING” from [2019-07-21 Sun 12:59]

For now, I am going to stick with counsel and swiper.

write an emacs <something> hook that runs whitespace-cleanup

  • State “DONE” from “NEXT” [2020-02-02 Sun 10:38]
  • State “NEXT” from “TODO” [2020-02-01 Sat 18:16]

<2019-10-28 Mon>

dir-locals.el approach

define a directory local variable?

  • then the file save hook runs based on that?

I have an example /Users/jeff/jwm/proj/zsh-hacking/.dir-locals.el

Here is an example from copyright.el of a before-save-hook

How do I create a dir-locals.el file? A: M-x add-dir-locals

(add-hook 'before-save-hook (lambda () (whitespace-cleanup)))

when I think the hook was working, I had this for the value of before-save-hook

((lambda nil
   (whitespace-cleanup)))

well this, didn’t work so well for me. Mostly because I could not rationalize how to evaluate the variable at the correct time. Should I use `add-hook`? Wouldn’t that cause multiple copies of the hook to be added?

so bind it to org-mode at init time? No.

make a function (hook) that runs whitespace-cleanup based on some jwm- variable on hooked to `before-save-buffer`. then set that variable in a dir-locals.el to apply to the scopes that I want that behavior in:

  • ~/jwm
  • ~/sift

jwm-clean-whitespace-on-save-buffer

Working code

then run `add-dir-local` at a directory scope to set jwm/run-whitespace-cleanup-on-save-p where desired.