Merge branch 'master' of github.com:IvanMalison/dotfiles

This commit is contained in:
Ivan Malison 2016-10-25 14:21:45 -07:00
commit c405a2e9a9
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 104 additions and 61 deletions

View File

@ -8,23 +8,50 @@ like the incredibly well commented literate configurations of [[http://pages.sac
[[http://doc.rix.si/cce/cce.html][Ryan Rix]], but I haven't quite gotten around to polishing it to the point that [[http://doc.rix.si/cce/cce.html][Ryan Rix]], but I haven't quite gotten around to polishing it to the point that
those two have. Still, there are definitely a few sections of which I am quite those two have. Still, there are definitely a few sections of which I am quite
proud, and that others may find to be useful. proud, and that others may find to be useful.
** Highlights * Highlights
These sections are the ones that have the most potential to be interesting to These sections are the ones that have the most potential to be interesting to
others: others:
*** [[Functions][My functions section]] ** How I generate http://ivanmalison.github.io/dotfiles/
*** Git Hooks
I wrote a [[https://github.com/IvanMalison/dotfiles/tree/master/dotfiles/emacs.d/bin][githook and an installer script]] that automatically update index.html
at the root of the repository by running ~org-html-export-to-html~ on my
README.org (essentially this document) . These should work no matter where they
are placed in a repository. The org-mode file that they target is set [[https://github.com/IvanMalison/dotfiles/blob/16a4f6c3aadef39a45d30c15e8637b40858721ea/dotfiles/emacs.d/bin/util.sh#L4][here]] and
should be relatively easy to change.
*** [[https://github.com/fniessen/org-html-themes][Read The Org]]
I use [[https://github.com/fniessen][fniessen]]'s ReadTheOrg theme which can be found at https://github.com/fniessen/org-html-themes.
*** Heading Links
To make it so that internal heading links have names that correspond to the
heading text, and don't change when new headings are added to the document, I
wrote a custom version of ~org-export-get-reference~.
See how [[Use my own default naming scheme for org-headings][this link]] (which is just a normal internal link in the original
document) takes you to http://ivanmalison.github.io/dotfiles/#usemyowndefaultnamingschemefororgheadings.
In case you haven't noticed, that is where you should go grab the code that does
this.
I'm considering turning this snippet in to a package, so please let me know if
that is something you are interested in.
*** Set Background Color Source Blocks
For some reason, org-mode uses all of your currently active fontification when exporting EXCEPT for background color. [[Set Background Color of Source Blocks for Export][This]] modification fixes this.
** [[Functions][My functions section]]
...has a bunch of generally useful functions: ...has a bunch of generally useful functions:
+ [[https://github.com/IvanMalison/emit/blob/2e4d788abd68bac538acb06443179b8d5885052e/emit.el#L104][emit-prefix-selector]] (SUPER USEFUL, moved to emit) See [[https://github.com/IvanMalison/emit#prefix-selector][README]] for explantion
+ [[Font Size][Font Size]] functions and an [[fontsizehydra][Awesome Hydra]] for them
+ [[downloadfile][Download a file into a buffer]] (curl straight into a file) + [[downloadfile][Download a file into a buffer]] (curl straight into a file)
+ [[editscript][Edit a script on $PATH]] + [[editscript][Edit a script on $PATH]]
+ [[namedbuild][Named Build of Builder Macros]] and [[composemacros][A Compose Supporting Macros]] + [[Yanking][Copy Portions of Buffer File Path Hydra]] and the associated [[Copy String Functions][Copy String Functions]]
*** Configuration of My Own Packages + [[namedbuild][Named Build of Builder Macros]] ([[https://github.com/IvanMalison/emit#named-builder][README]]) and [[composemacros][A Compose Supporting Macros]] ([[https://github.com/IvanMalison/emit#compose][README]])
** Configuration of My Own Packages
- [[term-projectile][term-projectile]] and [[term-manager][term-manager]] - [[term-projectile][term-projectile]] and [[term-manager][term-manager]]
- [[org-projectile][org-projectile]] - [[org-projectile][org-projectile]]
- [[multi-line][multi-line]] - [[multi-line][multi-line]]
- [[github-search][github-search]] - [[github-search][github-search]]
- [[flimenu][flimenu]] - [[flimenu][flimenu]]
*** [[programminglanguages][Programming Language Configurations]] ** [[programminglanguages][Programming Language Configurations]]
My programming language major mode configurations can all be found [[programminglanguages][here]]. My programming language major mode configurations can all be found [[programminglanguages][here]].
*** [[org][org-mode]] ** [[org][org-mode]]
My [[org][org-mode]] configuration is pretty comprehensive, but not super well commented. My [[org][org-mode]] configuration is pretty comprehensive, but not super well commented.
* HTML Headers * HTML Headers
@ -781,7 +808,7 @@ A macro for composing functions together to build an interactive command to copy
#+END_SRC #+END_SRC
** Edit a script on PATH ** Edit a script on PATH
<<editscript>> Note that you'll need to make sure that emacs properly inherits <<editscript>> Note that you'll need to make sure that emacs properly inherits
the path variable for this work. Check out my [[exec-path-from-shell]] config for the path variable for this work. Check out my [[exec-path-from-shell][exec-path-from-shell]] config for
details. details.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:get-executables-at-path (filepath) (defun imalison:get-executables-at-path (filepath)
@ -1388,7 +1415,11 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
("C-c 6" . imalison:compile/body)) ("C-c 6" . imalison:compile/body))
:config :config
(progn (progn
(defhydra imalison:hydra-font-resize #+END_SRC
*** Font Size
<<fontsizehydra>>
#+BEGIN_SRC emacs-lisp
(defhydra imalison:hydra-font-resize
nil nil
"Resize Font" "Resize Font"
("-" imalison:font-size-decr "Decrease") ("-" imalison:font-size-decr "Decrease")
@ -1399,29 +1430,35 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
("h" imalison:set-huge-font-size "Huge") ("h" imalison:set-huge-font-size "Huge")
("f" set-frame-font "Set Frame Font") ("f" set-frame-font "Set Frame Font")
("0" imalison:font-size-reset "Reset to default size")) ("0" imalison:font-size-reset "Reset to default size"))
#+END_SRC
(defhydra imalison:hydra-yank *** Yanking
#+BEGIN_SRC emacs-lisp
(defhydra imalison:hydra-yank
nil nil
"Yank text" "Yank text"
("p" imalison:copy-buffer-file-path "Projectile path") ("p" imalison:copy-buffer-file-path "Projectile path")
("f" imalison:copy-buffer-file-path-full "Full path") ("f" imalison:copy-buffer-file-path-full "Full path")
("n" imalison:copy-buffer-file-name "File name") ("n" imalison:copy-buffer-file-name "File name")
("b" imalison:copy-current-git-branch "Git Branch")) ("b" imalison:copy-current-git-branch "Git Branch"))
#+END_SRC
(defun imalison:make-test () *** Compile
#+BEGIN_SRC emacs-lisp
(defun imalison:make-test ()
(interactive) (interactive)
(let ((default-directory (projectile-project-root))) (let ((default-directory (projectile-project-root)))
(imalison:named-compile "make test"))) (imalison:named-compile "make test")))
(defun imalison:glide-up () (defun imalison:glide-up ()
(interactive) (interactive)
(imalison:named-compile "glide up")) (imalison:named-compile "glide up"))
(defhydra imalison:compile nil "Compile" (defhydra imalison:compile nil "Compile"
("s" imalison:projectile-helm-command-from-zsh "Select a command from shell history") ("s" imalison:projectile-helm-command-from-zsh "Select a command from shell history")
("c" imalison:named-compile "Enter Custom Command") ("c" imalison:named-compile "Enter Custom Command")
("t" imalison:make-test "Test") ("t" imalison:make-test "Test")
("u" imalison:glide-up "Update Dependencies")))) ("u" imalison:glide-up "Update Dependencies"))
;; The following parens close the use-package/progn created several blocks above
))
#+END_SRC #+END_SRC
** kill-emacs ** kill-emacs
This ensures that C-x C-c will always kill emacs, even if we are running in server mode. This ensures that C-x C-c will always kill emacs, even if we are running in server mode.
@ -3056,7 +3093,8 @@ Intero seems to be causing hangs, so it has been disabled
;; blame. ;; blame.
)) ))
#+END_SRC #+END_SRC
**** Correct BG color for org-export **** Set Background Color of Source Blocks for Export
This was taken from [[http://emacs.stackexchange.com/questions/3374/set-the-background-of-org-exported-code-blocks-according-to-theme][here]].
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package org (use-package org
:config :config
@ -3104,7 +3142,10 @@ as its link target.
This function replaces the default naming scheme with a call to This function replaces the default naming scheme with a call to
~imalison:generate-name~, and uses a slightly different uniquify approach. ~imalison:generate-name~, and uses a slightly different uniquify approach.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun org-export-get-reference (datum info) (use-package ox
:ensure nil
:config
(defun org-export-get-reference (datum info)
"Return a unique reference for DATUM, as a string. "Return a unique reference for DATUM, as a string.
DATUM is either an element or an object. INFO is the current DATUM is either an element or an object. INFO is the current
export state, as a plist. Returned reference consists of export state, as a plist. Returned reference consists of
@ -3124,7 +3165,7 @@ alphanumeric characters only."
(new-name (format "%s%s" name (if (< 0 number) number "")))) (new-name (format "%s%s" name (if (< 0 number) number ""))))
(puthash name number reverse-cache) (puthash name number reverse-cache)
(puthash datum new-name cache) (puthash datum new-name cache)
new-name)))) new-name)))))
#+END_SRC #+END_SRC
**** org-projectile **** org-projectile
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp

View File

@ -1,15 +1,15 @@
# -*- mode: sh -*- # -*- mode: sh -*-
EMACS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" EMACS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
TOP_LEVEL="$(git rev-parse --show-toplevel)" TOP_LEVEL="$(git rev-parse --show-toplevel)"
README="$EMACS_DIR/README.org" TARGET="$EMACS_DIR/README.org"
REPOSITORY_NAME="$(realpath --relative-to="$TOP_LEVEL" "$README")" REPOSITORY_NAME="$(realpath --relative-to="$TOP_LEVEL" "$TARGET")"
readme_was_updated() { readme_was_updated() {
git diff HEAD HEAD~1 --name-only | grep --quiet "$REPOSITORY_NAME" git diff HEAD HEAD~1 --name-only | grep --quiet "$REPOSITORY_NAME"
} }
update_index () { update_index () {
emacsclient -e "(with-current-buffer (find-file-noselect \"$README\") emacsclient -e "(with-current-buffer (find-file-noselect \"$TARGET\")
(org-html-export-to-html))" (org-html-export-to-html))"
cp -f "$EMACS_DIR/README.html" "$TOP_LEVEL/index.html" cp -f "$EMACS_DIR/README.html" "$TOP_LEVEL/index.html"
} }

View File

@ -203,3 +203,5 @@ function swap_mirror_swap {
function brew_relink { function brew_relink {
brew unlink "$1" && brew link "$1" brew unlink "$1" && brew link "$1"
} }
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig: