Skip to content

Commit

Permalink
Big update
Browse files Browse the repository at this point in the history
  • Loading branch information
Anler Hp committed Aug 31, 2014
1 parent c375993 commit d33ae70
Show file tree
Hide file tree
Showing 23 changed files with 135 additions and 1,437 deletions.
Empty file modified .gitignore 100755 → 100644
Empty file.
21 changes: 1 addition & 20 deletions README.org 100755 → 100644
@@ -1,22 +1,3 @@
[[file:org-mode-logo.png]]

Sometime ago, a good friend of a good friend of mine told him about
emacs, org-mode and literate programming, then he told me about
literate programming and I deliberately built these dotfiles on top of
his.

This is the result.

*Installation*:
1. Clone repo.
#+BEGIN_SRC sh
git clone https://github.com/ikame/dotfiles.git
#+END_SRC
2. Go into repo.
#+BEGIN_SRC sh
cd dotfiles
#+END_SRC
3. Tangle all ~*.org~ files.
#+BEGIN_SRC sh
sh tangle
#+END_SRC
My configuration files using a /literate-programming/ style.
90 changes: 0 additions & 90 deletions Xresources.org

This file was deleted.

81 changes: 21 additions & 60 deletions bin.org 100755 → 100644
@@ -1,62 +1,15 @@
* Emacs diff tool
#+BEGIN_SRC sh :shebang #!/bin/bash :tangle ~/.local/bin/ediff :mkdirp true
if [ ! ${#} -ge 2 ]; then
echo 1>&2 "Usage: ${0} LOCAL REMOTE [MERGED BASE]"
echo 1>&2 " (LOCAL, REMOTE, MERGED, BASE can be provided by \`git mergetool'.)"
exit 1
fi

# tools
_EMACSCLIENT=`which emacsclient`
_BASENAME=`basename`
_CP=`cp`
_EGREP=`egrep`
_MKTEMP=`mktemp`

# args
_LOCAL=${1}
_REMOTE=${2}
if [ ${3} ] ; then
_MERGED=${3}
else
_MERGED=${_REMOTE}
fi
if [ ${4} -a -r ${4} ] ; then
_BASE=${4}
_EDIFF=ediff-merge-files-with-ancestor
_EVAL="${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" \"${_BASE}\" nil \"${_MERGED}\""
elif [ ${_REMOTE} = ${_MERGED} ] ; then
_EDIFF=ediff
_EVAL="${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\""
else
_EDIFF=ediff-merge-files
_EVAL="${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" nil \"${_MERGED}\""
fi

# console vs. X
if [ "${TERM}" = "linux" ]; then
unset DISPLAY
_EMACSCLIENTOPTS="-t"
else
_EMACSCLIENTOPTS="-c"
fi

# run emacsclient
${_EMACSCLIENT} ${_EMACSCLIENTOPTS} -a "" -e "(${_EVAL})" 2>&1

# check modified file
if [ ! $(egrep -c '^(<<<<<<<|=======|>>>>>>>|####### Ancestor)' ${_MERGED}) = 0 ]; then
_MERGEDSAVE=$(${_MKTEMP} --tmpdir `${_BASENAME} ${_MERGED}`.XXXXXXXXXX)
${_CP} ${_MERGED} ${_MERGEDSAVE}
echo 1>&2 "Oops! Conflict markers detected in $_MERGED."
echo 1>&2 "Saved your changes to ${_MERGEDSAVE}"
echo 1>&2 "Exiting with code 1."
exit 1
fi

exit 0
#+END_SRC
* Emacs pipe tool
#+STARTUP: showall
* Table of contents :toc:
- [[#pipe-into-emacs][Pipe into Emacs]]
- [[#enumerate][Enumerate]]
- [[#capture-screen][Capture screen]]
- [[#tangle][Tangle]]
- [[#clipboard][Clipboard]]
- [[#kill-process-on-port][Kill process on port]]

* Pipe into Emacs
Emacs must be running in daemon mode.

#+BEGIN_SRC sh :shebang #!/bin/bash :tangle ~/.local/bin/emp :mkdirp true
# -*- coding: utf-8 -*-
# -*- Shell -*-
Expand Down Expand Up @@ -89,7 +42,9 @@
pipe_to_emacs $1
fi
#+END_SRC

* Enumerate
Enumerate the lines of a file
#+BEGIN_SRC sh :shebang #!/bin/bash :tangle ~/.local/bin/enum :mkdirp true
#
# examples:
Expand Down Expand Up @@ -132,20 +87,24 @@
enumerate
fi
#+END_SRC

* Capture screen
Capture screen with scrot. If an argument is provided the screenshot
will be named *<argument>.png*, else it's going to be *last-capture.png*:

#+BEGIN_SRC sh :shebang #!/bin/bash :tangle ~/.local/bin/capture :mkdirp true
if [ $# -eq 1 ]; then
filename=$1
else
filename='last-capture'
fi

scrot -s -e "mv \$f ~/screenshots/$filename.png"
scrot -s -e "mv \$f ~/Screenshots/$filename.png"
#+END_SRC

* Tangle
Tangle all the org files in a directory:

#+BEGIN_SRC sh :shebang #!/bin/bash :tangle ~/.local/bin/tangle :mkdirp true
if [ $# -eq 0 ]; then
dir=`pwd`
Expand Down Expand Up @@ -173,6 +132,7 @@ Tangle all the org files in a directory:

emacs -Q --batch --eval "$TANGLE"
#+END_SRC

* Clipboard
#+BEGIN_SRC sh :tangle ~/.local/bin/cb :shebang #!/bin/bash
if [ -t 0 ]; then
Expand All @@ -181,6 +141,7 @@ Tangle all the org files in a directory:
cat | xclip -i -selection clipboard
fi
#+END_SRC

* Kill process on port
#+BEGIN_SRC sh :tangle ~/.local/bin/kill-on-port :shebang #!/bin/bash
lsof -i tcp:$1 | grep LISTEN | cut -d' ' -f3 | xargs kill
Expand Down

0 comments on commit d33ae70

Please sign in to comment.