Check-in [f5866b1a13]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rewrite Emacs initialization files Rewrite my Emacs initialization files: - Use use-package[1] to set up and configure packages - Switch from using ido-mode to using swiper[2] - Switch from using multi-web-mode to mmm-mode[3] - Move org-mode configuration to its own file, cmf-org-settings.el - Move configuration provided by setup-yasnippet.el into init.el - Use pretty-lambdada[4] for displaying lambda - Simplify displayed minor modes in the mode line using diminish[5] - Magit status is now bound to 'C-x g' - Automatically install third-party packages via use-package[1] instead of having it done via `make install` - Custom written elisp files are now located in lisp directory In addition: - '[g]make install' is now an alias to 'update' - Remove the '-p' option to setup.sh as it's no longer required - Add new boilerplate for php files - Update documentation to reflect removal of 'make install' option - Styling changes to how arrays are declared in various bash scripts - Clean emacs.d sub-directories - Place $HOME/bin before other paths - Use README.md instead of README.org. README.md can be groked by bitbucket - Add svnbp snippet for subversion-managed org-mode files - Remove redundant docs/README.md file Footnotes: [1] https://github.com/jwiegley/use-package [2] https://github.com/abo-abo/swiper [3] https://github.com/purcell/mmm-mode [4] https://www.emacswiki.org/emacs/pretty-lambdada.el [5] https://www.emacswiki.org/emacs/DiminishedModes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f5866b1a1358ab93eb90072f708e20b3af8265e0
User & Date: cfuhrman 2016-03-16 22:47:35
Context
2016-03-16
22:51
Remove table of contents check-in: fc7e1dcd20 user: cfuhrman tags: trunk, v2016.03
22:47
Rewrite Emacs initialization files Rewrite my Emacs initialization files: - Use use-package[1] to set up and configure packages - Switch from using ido-mode to using swiper[2] - Switch from using multi-web-mode to mmm-mode[3] - Move org-mode configuration to its own file, cmf-org-settings.el - Move configuration provided by setup-yasnippet.el into init.el - Use pretty-lambdada[4] for displaying lambda - Simplify displayed minor modes in the mode line using diminish[5] - Magit status is now bound to 'C-x g' - Automatically install third-party packages via use-package[1] instead of having it done via `make install` - Custom written elisp files are now located in lisp directory In addition: - '[g]make install' is now an alias to 'update' - Remove the '-p' option to setup.sh as it's no longer required - Add new boilerplate for php files - Update documentation to reflect removal of 'make install' option - Styling changes to how arrays are declared in various bash scripts - Clean emacs.d sub-directories - Place $HOME/bin before other paths - Use README.md instead of README.org. README.md can be groked by bitbucket - Add svnbp snippet for subversion-managed org-mode files - Remove redundant docs/README.md file Footnotes: [1] https://github.com/jwiegley/use-package [2] https://github.com/abo-abo/swiper [3] https://github.com/purcell/mmm-mode [4] https://www.emacswiki.org/emacs/pretty-lambdada.el [5] https://www.emacswiki.org/emacs/DiminishedModes check-in: f5866b1a13 user: cfuhrman tags: trunk
2015-12-27
14:10
Make README.org a real file ... since github doesn't grok fossil links :/ check-in: db1b2b0ea3 user: cfuhrman tags: trunk, v2015.12
Changes

Changes to GNUmakefile.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96


97
98
99
100
101
102
103
...
131
132
133
134
135
136
137




138
139
140
141
142
143
144
...
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
...
186
187
188
189
190
191
192



193
194
195
196
197
198
199
#
# Targets
#

all: install local remote
	@echo 'All known hosts updated'

# Convenience target
install: txt setup.sh
	@echo 'Executing setup.sh for ShellPAK installation'
	@${SETUP_BIN} ${DRYRUN_OPT} -p

uninstall: setup.sh VERSION
	@echo -n 'Removing ShellPAK '
	@cat VERSION
	@${SETUP_BIN} ${DRYRUN_OPT} -u



update: txt setup.sh
	@echo 'Executing setup.sh for ShellPAK update'
	@${SETUP_BIN} ${DRYRUN_OPT}

tags: gtags

................................................................................

clean-elc: clean-home-elc

clean-home-elc:
	@echo 'Removing installed elc files:'
	@rm ${RM_OPTS} ${HOME}/.emacs.d/*.elc
	@rm ${RM_OPTS} ${HOME}/.emacs.d/*~





clean-xkcd:
	@echo 'Removing left-over xkcd comics:'
	@rm ${RM_OPTS}r ${HOME}/.emacs.d/xkcd/*

clean-tags: clean-gtags

................................................................................
	@rm ${RM_OPTS} shellpak*.tar.gz
	@rm ${RM_OPTS}r shellpak

# WARNING: Will remove *all* installed packages.  Use with care!
clean-elpa: clean-elc
	@rm ${RM_OPTS}r ${HOME}/.emacs.d/elpa/*

public:

	@echo 'Syncing with public repository'
	${RSYNC} ${RSYNC_PUBLIC_OPTS} . ${PUBLICCO}

# Target for importing changes from public Fossil repository
git-import: .git
	@echo 'Importing changes from Fossil'
	fossil export --git ${FOSSIL_REPO} | \
................................................................................
	@which emacs >/dev/null


#
# Documentation Targets
#




docbook: emacs ${DBKDIRS}
${DBKDIRS}:
	${MAKE} -C $(@:docbook-%=%) docbook

html: emacs ${HTMDIRS}
${HTMDIRS}:
	${MAKE} -C $(@:html-%=%) html







<
<
<
<
<




>
>







 







>
>
>
>







 







|
>







 







>
>
>







81
82
83
84
85
86
87





88
89
90
91
92
93
94
95
96
97
98
99
100
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#
# Targets
#

all: install local remote
	@echo 'All known hosts updated'






uninstall: setup.sh VERSION
	@echo -n 'Removing ShellPAK '
	@cat VERSION
	@${SETUP_BIN} ${DRYRUN_OPT} -u

install: update

update: txt setup.sh
	@echo 'Executing setup.sh for ShellPAK update'
	@${SETUP_BIN} ${DRYRUN_OPT}

tags: gtags

................................................................................

clean-elc: clean-home-elc

clean-home-elc:
	@echo 'Removing installed elc files:'
	@rm ${RM_OPTS} ${HOME}/.emacs.d/*.elc
	@rm ${RM_OPTS} ${HOME}/.emacs.d/*~
	@rm ${RM_OPTS} ${HOME}/.emacs.d/lisp/*.elc
	@rm ${RM_OPTS} ${HOME}/.emacs.d/lisp/*~
	@rm ${RM_OPTS} ${HOME}/.emacs.d/thirdparty/*.elc
	@rm ${RM_OPTS} ${HOME}/.emacs.d/thirdparty/*~

clean-xkcd:
	@echo 'Removing left-over xkcd comics:'
	@rm ${RM_OPTS}r ${HOME}/.emacs.d/xkcd/*

clean-tags: clean-gtags

................................................................................
	@rm ${RM_OPTS} shellpak*.tar.gz
	@rm ${RM_OPTS}r shellpak

# WARNING: Will remove *all* installed packages.  Use with care!
clean-elpa: clean-elc
	@rm ${RM_OPTS}r ${HOME}/.emacs.d/elpa/*

public: readme
	@rm ${RM_OPTS} docs/README.md
	@echo 'Syncing with public repository'
	${RSYNC} ${RSYNC_PUBLIC_OPTS} . ${PUBLICCO}

# Target for importing changes from public Fossil repository
git-import: .git
	@echo 'Importing changes from Fossil'
	fossil export --git ${FOSSIL_REPO} | \
................................................................................
	@which emacs >/dev/null


#
# Documentation Targets
#

readme: markdown
	@cp -rp docs/README.md .

docbook: emacs ${DBKDIRS}
${DBKDIRS}:
	${MAKE} -C $(@:docbook-%=%) docbook

html: emacs ${HTMDIRS}
${HTMDIRS}:
	${MAKE} -C $(@:html-%=%) html

Added README.md.











































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. Description</a>
<ul>
<li><a href="#sec-1-1">1.1. Requirements</a></li>
<li><a href="#sec-1-2">1.2. Supported Platforms</a></li>
</ul>
</li>
<li><a href="#sec-2">2. Obtaining ShellPAK</a>
<ul>
<li><a href="#sec-2-1">2.1. Alternate Repositories</a></li>
</ul>
</li>
<li><a href="#sec-3">3. Installation</a>
<ul>
<li><a href="#sec-3-1">3.1. Other setup options</a></li>
</ul>
</li>
<li><a href="#sec-4">4. Bugs</a></li>
<li><a href="#sec-5">5. Author</a></li>
<li><a href="#sec-6">6. Copyright</a></li>
</ul>
</div>
</div>



# Description<a id="sec-1" name="sec-1"></a>

ShellPAK allows for the automatic installation and configuration of
my personal [GNU Bash](http://www.gnu.org/software/bash/) shell environment as well as the configuration
of the following programs:

-   [Git](http://git-scm.com)
-   [GNU Emacs](http://www.gnu.org/software/emacs/)
-   [GNU Screen](http://www.gnu.org/software/screen/)
-   [GNU Indent](https://www.gnu.org/software/indent/)
-   [mg Text Editor](http://homepage.boetes.org/software/mg/)
-   [Perl::Tidy](http://search.cpan.org/~shancock/Perl-Tidy-20140711/lib/Perl/Tidy.pod)
-   [tmux](http://tmux.sourceforge.net)

This code is specific to my own needs and is here in the hopes it
will be useful as a reference.

## Requirements<a id="sec-1-1" name="sec-1-1"></a>

-   GNU Bash version 3.2 or greater
-   GNU Emacs 24.1 or greater (Emacs 24.4 or greater preferred)
-   GNU Make
-   rsync

## Supported Platforms<a id="sec-1-2" name="sec-1-2"></a>

The following operating systems are known to be supported:

-   Mac OS X 10.9 (Darwin)
-   NetBSD 6.1.x
-   OpenBSD 5.4
-   CentOS 6.5
-   Debian 7 (Wheezy) and derivatives
-   SunOS solaris 5.10
-   AIX 1 7

In addition, ShellPAK has been known to run on OpenSuSE, SuSE
Enterprise Linux, Ubuntu, FreeBSD, and Cygwin.

# Obtaining ShellPAK<a id="sec-2" name="sec-2"></a>

As of <span class="timestamp-wrapper"><span class="timestamp">&lt;2014-07-30 Wed&gt;</span></span>, [ShellPAK](https://chiselapp.com/user/cfuhrman/repository/shpak/home) is managed by the [Fossil](http://fossil-scm.org)
distributed version control system.  To check out a repository:

    # Clone the repository
    $ fossil clone https://chiselapp.com/user/cfuhrman/repository/shpak ~/shellpak.fossil
    
    # Check out the repository
    $ mkdir shellpak
    $ cd shellpak
    $ fossil open ~/shellpak.fossil

Further information on Fossil can be found at this [Quick Start
Guide](http://www.fossil-scm.org/index.html/doc/trunk/www/quickstart.wiki).

## Alternate Repositories<a id="sec-2-1" name="sec-2-1"></a>

[ShellPAK](https://chiselapp.com/user/cfuhrman/repository/shpak/home) is also available for checkout from the following
locations:

-   **Git:** [GitHub](https://github.com/cfuhrman/shpak), [BitBucket](https://bitbucket.org/chrisfuhrman/shellpak)
-   **Fossil:** [FuhrWerks](https://fossil.fuhrwerks.com/shpak)
-   **Bazaar:** [Launchpad](https://code.launchpad.net/~cfuhrman/shpak/trunk)

Be aware that portions of the ShellPAK infrastructure relies on
Fossil.  Conversion to support the conventions of an alternative
revision control system is an exercise left to the user.

# Installation<a id="sec-3" name="sec-3"></a>

    # Install ShellPAK
    $ ./setup.sh

Note that during installation, ShellPAK will store dot-files (e.g.,
`bashrc`, `bash_profile`, etc) in `~/Backup/shell` (or whatever is
specified by the `-b` flag).  These files will be restored during
un-installation (via the `-u` flag)

## Other setup options<a id="sec-3-1" name="sec-3-1"></a>

    # Perform a dry-run
    $ ./setup.sh -r
    
    # Install into another directory
    $ ./setup.sh -d /path/to/directory
    
    # Do not automatically link files during installation
    $ ./setup.sh -n
    
    # Remove ShellPAK
    $ ./setup.sh -u
    
    # Change backup directory
    $ ./setup.sh -b /path/to/directory
    
    # List runtime options
    $ ./setup.sh -h

Previous versions of `setup.sh` provided options for installation
of Emacs packages.  This is no longer required as Emacs will now
automatically install necessary packages on startup.

# Bugs<a id="sec-4" name="sec-4"></a>

Please report any bugs or feature requests by [filing a ticket](https://chiselapp.com/user/cfuhrman/repository/shpak/reportlist) via
the ShellPAK repository website.

# Author<a id="sec-5" name="sec-5"></a>

Christopher M. Fuhrman
[cfuhrman@pobox.com](cfuhrman@pobox.com)

# Copyright<a id="sec-6" name="sec-6"></a>

Copyright (c) 2000-2016 Christopher M. Fuhrman
All rights reserved.

All files contained herein can be redistributed and/or modified
under the terms of the Simplified BSD License (also known as the
"2-Clause License" or "FreeBSD License".) unless otherwise noted.

Deleted README.org.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#+TITLE: ShellPAK README
#+AUTHOR: Christopher M. Fuhrman
#+EMAIL: cfuhrman@pobox.com
#+OPTIONS: email:t
#
#+LATEX_HEADER: \usepackage{fancyhdr}
#+LATEX_HEADER: \pagestyle{fancyplain}

#+LATEX: \thispagestyle{empty}
# [TABLE-OF-CONTENTS]

* Description

  ShellPAK allows for the automatic installation and configuration of
  my personal [[http://www.gnu.org/software/bash/][GNU Bash]] shell environment as well as the configuration
  of the following programs:

   - [[http://git-scm.com][Git]]
   - [[http://www.gnu.org/software/emacs/][GNU Emacs]]
   - [[http://www.gnu.org/software/screen/][GNU Screen]]
   - [[https://www.gnu.org/software/indent/][GNU Indent]]
   - [[http://homepage.boetes.org/software/mg/][mg Text Editor]]
   - [[http://search.cpan.org/~shancock/Perl-Tidy-20140711/lib/Perl/Tidy.pod][Perl::Tidy]]
   - [[http://tmux.sourceforge.net][tmux]]

  This code is specific to my own needs and is here in the hopes it
  will be useful as a reference.

** Requirements

    - GNU Bash version 3.2 or greater
    - GNU Emacs 23.1 or greater (Emacs >24.1 preferred)
    - GNU Make
    - rsync

** Supported Platforms

   The following operating systems are known to be supported:

    - Mac OS X 10.9 (Darwin)
    - NetBSD 6.1.x
    - OpenBSD 5.4
    - CentOS 6.5
    - Debian 7 (Wheezy) and derivatives
    - SunOS solaris 5.10
    - AIX 1 7

   In addition, ShellPAK has been known to run on OpenSuSE, SuSE
   Enterprise Linux, Ubuntu, FreeBSD, and Cygwin.

* Obtaining ShellPAK

  As of <2014-07-30 Wed>, [[https://chiselapp.com/user/cfuhrman/repository/shpak/home][ShellPAK]] is managed by the [[http://fossil-scm.org][Fossil]]
  distributed version control system.  To check out a repository:

  #+begin_src sh
  # Clone the repository
  $ fossil clone https://chiselapp.com/user/cfuhrman/repository/shpak ~/shellpak.fossil

  # Check out the repository
  $ mkdir shellpak
  $ cd shellpak
  $ fossil open ~/shellpak.fossil
  #+end_src

  Further information on Fossil can be found at this [[http://www.fossil-scm.org/index.html/doc/trunk/www/quickstart.wiki][Quick Start
  Guide]].

** Alternate Repositories

   [[https://chiselapp.com/user/cfuhrman/repository/shpak/home][ShellPAK]] is also available for checkout from the following
   locations:

    - Git :: [[https://github.com/cfuhrman/shpak][GitHub]], [[https://bitbucket.org/chrisfuhrman/shellpak][BitBucket]]
    - Fossil :: [[https://fossil.fuhrwerks.com/shpak][FuhrWerks]]
    - Bazaar :: [[https://code.launchpad.net/~cfuhrman/shpak/trunk][Launchpad]]

   Be aware that portions of the ShellPAK infrastructure relies on
   Fossil.  Conversion to support the conventions of an alternative
   revision control system is an exercise left to the user.

* Installation

  #+begin_src sh
  # Install ShellPAK
  $ ./setup.sh
  #+end_src

  Note that during installation, ShellPAK will store dot-files (e.g.,
  =bashrc=, =bash_profile=, etc) in =~/Backup/shell= (or whatever is
  specified by the =-b= flag).  These files will be restored during
  un-installation (via the =-u= flag)

** Other setup options

   #+begin_src sh
   # Perform a dry-run
   $ ./setup.sh -r

   # Install into another directory
   $ ./setup.sh -d /path/to/directory

   # Install ShellPAK and automatically download & install
   # personal set of Emacs packages
   $ ./setup.sh -p

   # Do not automatically link files during installation
   $ ./setup.sh -n

   # Remove ShellPAK
   $ ./setup.sh -u

   # Change backup directory
   $ ./setup.sh -b /path/to/directory

   # List runtime options
   $ ./setup.sh -h
   #+end_src


* Bugs

  Please report any bugs or feature requests by [[https://chiselapp.com/user/cfuhrman/repository/shpak/reportlist][filing a ticket]] via
  the ShellPAK repository website.

* Author

  Christopher M. Fuhrman
  [[mailto:cfuhrman@pobox.com][cfuhrman@pobox.com]]

* Copyright

  Copyright (c) 2000-2015 Christopher M. Fuhrman
  All rights reserved.

  All files contained herein can be redistributed and/or modified
  under the terms of the Simplified BSD License (also known as the
  "2-Clause License" or "FreeBSD License".) unless otherwise noted.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































Changes to bash_bsd.

16
17
18
19
20
21
22
23

24

25
26
27
28
29
30
31
..
74
75
76
77
78
79
80
81

82


83
84
85
86
87
88
89
90
# Sets up system environment for BSD-flavored boxen
#

# Set default locale
MYLOCALE=en_US.UTF-8

# Determine PATH
paths=('/usr/games'      '/usr/pkg/sbin'     \

       '/usr/pkg/lib/perl5/site_perl/bin')


# Append additional directories if required
for path in ${paths[@]}; do

        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}
        fi
................................................................................
                LC_MONETARY='C'
                LC_NUMERIC='C'
                LC_ALL=""
        else
                LC_ALL=${MYLOCALE}
        fi

        export FILE_OPS_FLAGS      FILE_OPS_RM_FLAGS   \

               LANG LC_COLLATE     LC_MONETARY         \


               LC_NUMERIC LC_ALL

fi

# See if coreutils is installed
aliasCoreUtils

# Ende







|
>
|
>







 







|
>
|
>
>
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Sets up system environment for BSD-flavored boxen
#

# Set default locale
MYLOCALE=en_US.UTF-8

# Determine PATH
paths=('/usr/games'                             \
       '/usr/pkg/sbin'                          \
       '/usr/pkg/lib/perl5/site_perl/bin'
      )

# Append additional directories if required
for path in ${paths[@]}; do

        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}
        fi
................................................................................
                LC_MONETARY='C'
                LC_NUMERIC='C'
                LC_ALL=""
        else
                LC_ALL=${MYLOCALE}
        fi

        export FILE_OPS_FLAGS                   \
               FILE_OPS_RM_FLAGS                \
               LANG LC_COLLATE                  \
               LC_MONETARY                      \
               LC_NUMERIC                       \
               LC_ALL

fi

# See if coreutils is installed
aliasCoreUtils

# Ende

Changes to bash_darwin.

13
14
15
16
17
18
19

20

21

22

23
24
25
26
27
28
29
30
# ====================================================================

#
# Sets up system environment for Mac OS X Darwin
#

# Determine PATH

paths=('/opt/local/bin'       '/opt/local/sbin'                  \

       '/usr/pkg/bin'         '/usr/pkg/sbin'                    \

       '/usr/local/git/bin'   '/usr/pkg/lib/perl5/site_perl/bin' \

       '/Applications/oracle' '/usr/texbin'                      \
       "${HOME}/perl5/bin"
)

# Append additional directories if required
for path in ${paths[@]}; do

        # We only want to add the directory if it exists







>
|
>
|
>
|
>
|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# ====================================================================

#
# Sets up system environment for Mac OS X Darwin
#

# Determine PATH
paths=('/opt/local/bin'                         \
       '/opt/local/sbin'                        \
       '/usr/pkg/bin'                           \
       '/usr/pkg/sbin'                          \
       '/usr/local/git/bin'                     \
       '/usr/pkg/lib/perl5/site_perl/bin'       \
       '/Applications/oracle'                   \
       '/usr/texbin'                            \
       "${HOME}/perl5/bin"
)

# Append additional directories if required
for path in ${paths[@]}; do

        # We only want to add the directory if it exists

Changes to bash_unix_sv.

18
19
20
21
22
23
24
25

26

27

28

29

30


31
32
33
34
35
36
37
# cannot determine the host operating system.
#

# Try to overcome limitations of UnixWARE
stty intr ^C

# Determine PATH
paths=('/usr/local/bin'            '/usr/pkg/bin'      \

       '/usr/ccs/bin'              '/usr/sfw/bin'      \

       '/opt/sfw/bin'              '/usr/dt/bin'       \

       '/opt/csw/sbin'             '/opt/csw/bin'      \

       '/usr/X11/bin'              '/usr/java/bin'     \

       '/usr/X/bin'                '/usr/ucb')



# Append additional directories if required
for path in ${paths[@]}; do

        # We only want to add the directory if it exists
        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}







|
>
|
>
|
>
|
>
|
>
|
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# cannot determine the host operating system.
#

# Try to overcome limitations of UnixWARE
stty intr ^C

# Determine PATH
paths=('/usr/local/bin'                         \
       '/usr/pkg/bin'                           \
       '/usr/ccs/bin'                           \
       '/usr/sfw/bin'                           \
       '/opt/sfw/bin'                           \
       '/usr/dt/bin'                            \
       '/opt/csw/sbin'                          \
       '/opt/csw/bin'                           \
       '/usr/X11/bin'                           \
       '/usr/java/bin'                          \
       '/usr/X/bin'                             \
       '/usr/ucb'
      )

# Append additional directories if required
for path in ${paths[@]}; do

        # We only want to add the directory if it exists
        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}

Changes to bashrc.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
...
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
...
147
148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
...
191
192
193
194
195
196
197


198

199

200

201
202
203


204
205
206
207
208
209
210
#  * elinks
#  * lynx

setBrowser ()
{

        # Set preferred browsers in order of evaluation
        browsers=('firefox'   \
                  'galeon'    \
                  'epiphany'  \
                  'konqueror' \
                  'mozilla'   \
                  'w3m'       \
                  'elinks'    \
                  'lynx')


        for browser in ${browsers[@]}; do

                if type -p ${browser} >/dev/null; then
                        BROWSER=$browser
                        break;
                fi
................................................................................
#  * vim
#  * vi (if all else fails)

setEditor ()
{

        # Set preferred editors in order of evaluation
        editors=('emacs'      \
                 'mg'         \
                 'nano'       \
                 'vim'        \
                 'vi')


        for edit in ${editors[@]}; do

                if type -p ${edit} >/dev/null; then
                        EDITOR=$edit
                        export EDITOR;

................................................................................
        # Should this be an emacs terminal, then set $PAGER to 'cat' since
        # emacs will do our paging for us
        if [ $TERM == 'dumb' ] || [ $TERM == 'emacs' ]; then
                PAGER='cat'
        else

                # Set preferred pagers in order of evaluation
                pagers=('less' \
                        'more' \
                        'view')


                for pagr in ${pagers[@]}; do

                        if type -p ${pagr} >/dev/null; then
                                PAGER=$pagr
                                break;
                        fi
................................................................................
        else
                promptCMF
        fi

fi

# Determine PATH


paths=('/usr/games'      '/usr/X11R6/bin'    \

       '/usr/X11R7/bin'  '/usr/sbin'         \

       '/opt/bin'        '/opt/sbin'         \

       '/sbin'           '/opt/schily/bin'   \
       '/usr/local/sbin' "$HOME/bin"         \
       '.'               "$HOME/.composer/vendor/bin")



# Append additional directories if required
for path in ${paths[@]}; do

        # Determine if this directory is already in $PATH
        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}







|
|
|
|
|
|
|
|
>







 







|
|
|
|
|
>







 







|
|
|
>







 







>
>
|
>
|
>
|
>
|
|
|
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#  * elinks
#  * lynx

setBrowser ()
{

        # Set preferred browsers in order of evaluation
        browsers=('firefox'                     \
                  'galeon'                      \
                  'epiphany'                    \
                  'konqueror'                   \
                  'mozilla'                     \
                  'w3m'                         \
                  'elinks'                      \
                  'lynx'
                 )

        for browser in ${browsers[@]}; do

                if type -p ${browser} >/dev/null; then
                        BROWSER=$browser
                        break;
                fi
................................................................................
#  * vim
#  * vi (if all else fails)

setEditor ()
{

        # Set preferred editors in order of evaluation
        editors=('emacs'                        \
                 'mg'                           \
                 'nano'                         \
                 'vim'                          \
                 'vi'
                )

        for edit in ${editors[@]}; do

                if type -p ${edit} >/dev/null; then
                        EDITOR=$edit
                        export EDITOR;

................................................................................
        # Should this be an emacs terminal, then set $PAGER to 'cat' since
        # emacs will do our paging for us
        if [ $TERM == 'dumb' ] || [ $TERM == 'emacs' ]; then
                PAGER='cat'
        else

                # Set preferred pagers in order of evaluation
                pagers=('less'                  \
                        'more'                  \
                        'view'
                       )

                for pagr in ${pagers[@]}; do

                        if type -p ${pagr} >/dev/null; then
                                PAGER=$pagr
                                break;
                        fi
................................................................................
        else
                promptCMF
        fi

fi

# Determine PATH
paths=("$HOME/bin"                              \
       '/usr/games'                             \
       '/usr/X11R6/bin'                         \
       '/usr/X11R7/bin'                         \
       '/usr/sbin'                              \
       '/opt/bin'                               \
       '/opt/sbin'                              \
       '/sbin'                                  \
       '/opt/schily/bin'                        \
       '/usr/local/sbin'                        \
       "$HOME/.composer/vendor/bin"             \
       '.'
      )

# Append additional directories if required
for path in ${paths[@]}; do

        # Determine if this directory is already in $PATH
        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${path}

Deleted docs/README.md.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Description<a id="sec-1" name="sec-1"></a>

ShellPAK allows for the automatic installation and configuration of
my personal [GNU Bash](http://www.gnu.org/software/bash/) shell environment as well as the configuration
of the following programs:

-   [Git](http://git-scm.com)
-   [GNU Emacs](http://www.gnu.org/software/emacs/)
-   [GNU Screen](http://www.gnu.org/software/screen/)
-   [GNU Indent](https://www.gnu.org/software/indent/)
-   [mg Text Editor](http://homepage.boetes.org/software/mg/)
-   [Perl::Tidy](http://search.cpan.org/~shancock/Perl-Tidy-20140711/lib/Perl/Tidy.pod)
-   [tmux](http://tmux.sourceforge.net)

This code is specific to my own needs and is here in the hopes it
will be useful as a reference.

## Requirements<a id="sec-1-1" name="sec-1-1"></a>

-   GNU Bash version 3.2 or greater
-   GNU Emacs 23.1 or greater (Emacs >24.1 preferred)
-   GNU Make
-   rsync

## Supported Platforms<a id="sec-1-2" name="sec-1-2"></a>

The following operating systems are known to be supported:

-   Mac OS X 10.9 (Darwin)
-   NetBSD 6.1.x
-   OpenBSD 5.4
-   CentOS 6.5
-   Debian 7 (Wheezy) and derivatives
-   SunOS solaris 5.10
-   AIX 1 7

In addition, ShellPAK has been known to run on OpenSuSE, SuSE
Enterprise Linux, Ubuntu, FreeBSD, and Cygwin.

# Obtaining ShellPAK<a id="sec-2" name="sec-2"></a>

As of <span class="timestamp-wrapper"><span class="timestamp">&lt;2014-07-30 Wed&gt;</span></span>, [ShellPAK](https://chiselapp.com/user/cfuhrman/repository/shpak/home) is managed by the [Fossil](http://fossil-scm.org)
distributed version control system.  To check out a repository:

    # Clone the repository
    $ fossil clone https://chiselapp.com/user/cfuhrman/repository/shpak ~/shellpak.fossil
    
    # Check out the repository
    $ mkdir shellpak
    $ cd shellpak
    $ fossil open ~/shellpak.fossil

Further information on Fossil can be found at this [Quick Start
Guide](http://www.fossil-scm.org/index.html/doc/trunk/www/quickstart.wiki).

## Alternate Repositories<a id="sec-2-1" name="sec-2-1"></a>

[ShellPAK](https://chiselapp.com/user/cfuhrman/repository/shpak/home) is also available for checkout from the following
locations:

-   **Git:** [GitHub](https://github.com/cfuhrman/shpak), [BitBucket](https://bitbucket.org/chrisfuhrman/shellpak)
-   **Fossil:** [FuhrWerks](https://fossil.fuhrwerks.com/shpak)
-   **Bazaar:** [Launchpad](https://code.launchpad.net/~cfuhrman/shpak/trunk)

Be aware that portions of the ShellPAK infrastructure relies on
Fossil.  Conversion to support the conventions of an alternative
revision control system is an exercise left to the user.

# Installation<a id="sec-3" name="sec-3"></a>

    # Install ShellPAK
    $ ./setup.sh

Note that during installation, ShellPAK will store dot-files (e.g.,
`bashrc`, `bash_profile`, etc) in `~/Backup/shell` (or whatever is
specified by the `-b` flag).  These files will be restored during
un-installation (via the `-u` flag)

## Other setup options<a id="sec-3-1" name="sec-3-1"></a>

    # Perform a dry-run
    $ ./setup.sh -r
    
    # Install into another directory
    $ ./setup.sh -d /path/to/directory
    
    # Install ShellPAK and automatically download & install
    # personal set of Emacs packages
    $ ./setup.sh -p
    
    # Do not automatically link files during installation
    $ ./setup.sh -n
    
    # Remove ShellPAK
    $ ./setup.sh -u
    
    # Change backup directory
    $ ./setup.sh -b /path/to/directory
    
    # List runtime options
    $ ./setup.sh -h

# Bugs<a id="sec-4" name="sec-4"></a>

Please report any bugs or feature requests by [filing a ticket](https://chiselapp.com/user/cfuhrman/repository/shpak/reportlist) via
the ShellPAK repository website.

# Author<a id="sec-5" name="sec-5"></a>

Christopher M. Fuhrman
[cfuhrman@pobox.com](cfuhrman@pobox.com)

# Copyright<a id="sec-6" name="sec-6"></a>

Copyright (c) 2000-2015 Christopher M. Fuhrman
All rights reserved.

All files contained herein can be redistributed and/or modified
under the terms of the Simplified BSD License (also known as the
"2-Clause License" or "FreeBSD License".) unless otherwise noted.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































Changes to emacs.d/GNUmakefile.

1
2
3
4





5
6
7
8
9
10
11
12
13
14



15
#
# emacs.d/GNUmakefile
#






RM_OPTS=$(shell if [ `uname` != "OpenBSD" ]; then echo '-vf'; else echo '-f'; fi)

clean:
	@rm ${RM_OPTS} *~
	@rm ${RM_OPTS} *.bak
	@rm ${RM_OPTS} *-baseline
	@rm ${RM_OPTS} *-merge
	@rm ${RM_OPTS} *-original
	@rm ${RM_OPTS} *.elc




# Ende




>
>
>
>
>


|







>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# emacs.d/GNUmakefile
#

SUBDIRS+=lisp
SUBDIRS+=thirdparty

CLEANDIRS=$(SUBDIRS:%=clean-%)

RM_OPTS=$(shell if [ `uname` != "OpenBSD" ]; then echo '-vf'; else echo '-f'; fi)

clean: ${CLEANDIRS}
	@rm ${RM_OPTS} *~
	@rm ${RM_OPTS} *.bak
	@rm ${RM_OPTS} *-baseline
	@rm ${RM_OPTS} *-merge
	@rm ${RM_OPTS} *-original
	@rm ${RM_OPTS} *.elc

${CLEANDIRS} :
	${MAKE} -C $(@:clean-%=%) clean

# Ende

Changes to emacs.d/init.el.

1
2
3
4
5
6
7
8
9
10
11
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46








47
48
49

50
51
52
53

54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
98



99
100
101
102
103
104


105
106
107

108
109
110
111
112
113
114
115
116
117

118
119
120
121
122

123
124
125
126
127
128

129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172


173
174

175
176
177
178
179
180
181
182
183
184
185








186
187
188
189
190
191
192
193
194

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
...
257
258
259
260
261
262
263
264


265
266
267
268
269
270
271
272
273
274
275
276
277
278
279

280
281
282
283
284
285

286

287
288
289
290
291
292
293
294


295

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315




316
317
318
319
320
321
322
323
324
325


326
327
328
329
330
331
332
333
334
335


336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927





















;;; init.el --- Personal customizations
;; ====================================================================
;;
;; Copyright (c) 2008 Christopher M. Fuhrman
;; All rights reserved.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Simplified BSD License (also known
;; as the "2-Clause License" or "FreeBSD License".)
;;
;; Created Thu Feb 29 17:16:39 2008 PST
................................................................................
;;      *THE WORLD*!
;;

;;; Code:

;; Make sure all Emacs Lisp files are byte-compiled for speed
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)

;; Load the appropriate customization file based on if we are running
;; under a window system, such as "x" or "ns" (Mac OS X or GNUstep)
(if (equal window-system nil)
    (if (or (string-match "term-256" (getenv "TERM"))
            (string-match "screen-256" (getenv "TERM")))
        (setq custom-file "~/.emacs.d/custom-nox256.el")
      (setq custom-file "~/.emacs.d/custom-nox.el"))
  (setq custom-file "~/.emacs.d/custom.el"))

(load custom-file)

;; Variable definitions
(defvar local-execpaths '("/usr/texbin" "/usr/pkg/bin" "/usr/local/bin"  "~/.composer/vendor/bin"))
(defvar local-loadpaths '("/usr/pkg/share/emacs/site-lisp" "/usr/local/share/emacs/site-lisp"))
(defvar my-package-list nil)










;; Sane defaults
(setq-default indent-tabs-mode nil)


;; Add personal paths
;; (add-to-list 'load-path (format "%s/.emacs.d" (getenv "HOME")))
(add-to-list 'load-path (format "%s/.emacs.d/thirdparty" (getenv "HOME")))


;; Load individual files
(load-file (format "%s/.emacs.d/thirdparty/phpdocumentor.el" (getenv "HOME")))


;; Define desired packages
(package-initialize)
(setq my-package-list '(ac-ispell
                        ac-emoji
                        apache-mode
                        auctex
                        auto-complete
                        crontab-mode
                        csv-nav
                        geben
                        go-autocomplete
                        go-direx
                        go-eldoc
                        go-mode
                        go-snippets
                        indent-guide
                        markdown-mode
                        multi-web-mode
                        org-ac
                        org-bullets
                        php-eldoc
                        php-extras
                        php-mode
                        psvn
                        solarized-theme
                        sr-speedbar
                        sunshine
                        twilight-theme
                        twittering-mode
                        vc-fossil
                        xkcd
                        yaml-mode
                        yasnippet))


;; Add Emacs-24-specific packages
(if (>= emacs-major-version 24)
    (setq my-package-list
          (append my-package-list '(flycheck
                                    ggtags
                                    magit
                                    smart-mode-line)))
  (setq my-package-list



        (append my-package-list '(flymake-go
                                  flymake-php
                                  flymake-shell
                                  flymake-yaml)))
  )



;; Use Emacs 'ls' emulation
(require 'ls-lisp)


;; Customize font under X
(if (equal window-system 'x)
    (set-face-attribute 'default nil
                        :family  "DejaVu Sans Mono"
                        :foundry 'unknown
                        :slant   'normal
                        :weight  'normal
                        :height   100
                        :width   'normal))


;; Fix normal-erase-is-backspace under non-Linux OS
(if (and (equal window-system nil)
         (equal (equal system-type 'gnu/linux) nil))
    (normal-erase-is-backspace-mode 0))


;; Enable Apple Color Emoji
(if (equal window-system 'ns)
    (set-fontset-font
     t 'symbol
     (font-spec :family "Apple Color Emoji") nil 'prepend))


;; Install Org-Mode, if present
(if (>= emacs-major-version 23)
    (require 'org-install)
  (message "Emacs version %d does not include org-mode, so not setting it up" emacs-major-version))


;; Set speller to aspell
(setq-default ispell-program-name "aspell")


;; Aliases
;; --------------------------------------------------------------------

(defalias 'perl-mode 'cperl-mode)


;; Macros
;; --------------------------------------------------------------------

(fset 'align-on-equal
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 97 108 105 103 110 45 114 101 103 101 120 112 return 61 return] 0 "%d")) arg)))

(fset 'align-on-hash-arrow
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 97 108 105 103 110 45 114 101 103 101 120 return 61 62 return] 0 "%d")) arg)))


;; Keyboard Bindings
;; --------------------------------------------------------------------

;; Use Option Key for Meta under Mac OS X
(setq mac-option-modifier 'meta)

;; Define some org-mode maps
(define-key global-map "\C-ca" 'org-agenda)
(define-key global-map "\C-cb" 'org-iswitchb)
(define-key global-map "\C-cc" 'org-capture)
(define-key global-map "\C-cl" 'org-store-link)

;; Custom key bindings for commonly used commands
(global-set-key [?\C-x ?\C-k ?0] 'normal-erase-is-backspace-mode)
(global-set-key [?\C-x ?\C-k ?1] 'delete-trailing-whitespace)
(global-set-key [?\C-x ?\C-k ?2] 'align-on-equal)
(global-set-key [?\C-x ?\C-k ?3] 'align-on-hash-arrow)
(global-set-key [?\C-x ?\C-g]    'magit-status)



;; Functions
;; --------------------------------------------------------------------


(defun cmf-autoinstall-packages ()
  "Automatically downloads and install list of preferred packages."
  (interactive)
  (package-initialize)
  (unless package-archive-contents
    (package-refresh-contents))
  (dolist (package my-package-list)
    (unless (package-installed-p package)
      (package-install package)))
  )









;; Debug a simple PHP script.
(defun cmf-php-debug ()
  "Run current PHP script for debugging with geben."
  (interactive)
  (call-interactively 'geben)
  (shell-command
    (concat "XDEBUG_CONFIG='idekey=emacs' /usr/bin/php "
    (buffer-file-name) " &"))

  )

;; Function for loading exec paths
(defun nice-exec-path (pathlist)
  "Add given PATHLIST to 'exec-path'."
  (dolist (path pathlist)
    (add-to-list 'exec-path path)
    (setenv "PATH" (concat (getenv "PATH") ":" path)))
  )

;; Function for loading library paths
;; TODO: Simplify list iteration logic a la nice-exec-path
(defun nice-load-path (pathlist)
  "Add given PATHLIST to 'load-path'."
  (while pathlist
    (if (and (file-directory-p (car pathlist))
             (not (member (car pathlist) load-path)))
        (let ((default-directory (car pathlist)))
          (normal-top-level-add-to-load-path '("."))
          (normal-top-level-add-subdirs-to-load-path)))
    (setq pathlist (cdr pathlist)))
  )

;; Functions for perltidy
(defun perltidy-region ()
  "Run perltidy on the current region."
  (interactive)
  (save-excursion
    (shell-command-on-region (point) (mark) "perltidy -q" nil t))
  )

(defun perltidy-defun ()
  "Run perltidy on the current defun."
  (interactive)
  (save-excursion (mark-defun)
		  (perltidy-region))
  )

;; Define modes
;; --------------------------------------------------------------------

(define-derived-mode nice-msg-mode
  text-mode "Nice"
  "Major mode for editing messages."
  )

;; Programming styles
;; --------------------------------------------------------------------

;; OpenBSD Coding Style
(c-add-style "openbsd"
             '("bsd"
................................................................................
;; My own style
(c-add-style "cmf"
             '("bsd"
	       (indent-tabs-mode . nil)
               (c-offsets-alist
                (statement-cont . (first c-lineup-cascaded-calls +)))))

;; Hooks


;; --------------------------------------------------------------------

;; Enable code folding
(defun folding-code-hook ()
  "Enable code folding."
  (defvar outline-minor-mode-prefix)
  (setq outline-minor-mode-prefix "\C-co")
  (outline-minor-mode t)
  (hide-body)
  )

;; Define a basic hook for Emacs lisp files
(defun nice-elisp-hook ()
  "Hook for sane editing of Lisp files."
  (setq indent-tabs-mode nil)

  )

;; Define a basic hook for enabling ac-ispell
(defun nice-ispell-hook ()
  "Hook for enabling ac-ispell."
  (if (package-installed-p 'ac-ispell)

      (add-to-list 'ac-sources 'ac-source-ispell))

  )

;; Define a basic hook for sane editing of makefiles
(defun nice-makefile-hook ()
  "Hook for sane editing of Makefiles."
  (if (>= emacs-major-version 23)
      (linum-mode t))
  )




;; Define a basic hook for sane editing of org-mode documents
(defun nice-org-hook ()
  "Hook for sane editing of 'org-mode' documents."
  (defvar org-mode-map)
  (org-defkey org-mode-map "\C-c[" 'org-time-stamp-inactive)
  (org-ac/setup-current-buffer)
  (if (package-installed-p 'org-bullets)
      (org-bullets-mode t))
  (if (equal (car (split-string org-version ".")) 8)
      (require 'ox-md))
  )

;; Define a nice hook for editing nXML files
(defun nice-nxml-hook ()
  "Hook for sane editing of nXML files."
  (if (>= emacs-major-version 23)
      (linum-mode t))
  (if (package-installed-p 'indent-guide)
      (indent-guide-mode t))
  (auto-fill-mode -1)




  )

;; Define a basic hook for editing PHP files
(defun nice-php-hook ()
  "Hook for sane editing of PHP files."
  (c-set-style "cmf")
  (if (package-installed-p 'php-auto-yasnippets)
      (define-key php-mode-map (kbd "C-c C-y") 'yas/create-php-snippet))
  (define-key php-mode-map (kbd "C-x p") 'phpdoc)
  )



;; Define a nice programming hook
(defun nice-prog-hook ()
  "Enable some sanity for programming source files."
  (if (>= emacs-major-version 23)
      (linum-mode t))
  (if (package-installed-p 'ggtags)
      (ggtags-mode t))
  (if (package-installed-p 'indent-guide)
      (indent-guide-mode t))


  (auto-fill-mode t)
  (eldoc-mode t)
  (electric-pair-mode t)
  )

;; Define a nice hook for editing SQL files
(defun nice-sql-hook ()
  "Hook for sane editing of SQL files."
  (if (>= emacs-major-version 23)
      (linum-mode t))
  (auto-fill-mode t)
  (electric-pair-mode t)
  )

;; Define a basic hook for sane editing of text documents
(defun nice-text-hook ()
  "Hook for sane editing of text (ASCII) documents."
  (auto-fill-mode t)
  (flyspell-mode t)
  (footnote-mode t)
  (if (package-installed-p 'auto-complete)
      (auto-complete-mode t))
  )

;; Real lisp hackers use the lambda character
;; Source: https://github.com/edmore/dotemacs/blob/master/modules/defuns.el
(defun sm-lambda-mode-hook ()
  "Replace the word 'lambda' with the greek character 'λ'."
  (if (equal custom-file "~/.emacs.d/custom.el")
      (font-lock-add-keywords
       nil `(("\\<lambda\\>"
              (0 (progn (compose-region (match-beginning 0) (match-end 0)
                                        ,(make-char 'greek-iso8859-7 107))
                        nil))))))
  )

;;
;; Enable appropriate programming hooks
;;

;; For C files
(add-hook 'c-mode-common-hook 'nice-prog-hook)
(add-hook 'c-mode-common-hook
          (lambda ()
            (font-lock-add-keywords nil
                                    '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))

;; For Emacs Lisp files
(add-hook 'emacs-lisp-mode-hook    'nice-prog-hook)
(add-hook 'emacs-lisp-mode-hook    'nice-elisp-hook)
(add-hook 'emacs-lisp-mode-hook    'sm-lambda-mode-hook)
(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (font-lock-add-keywords nil
                                    '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))

;; For Perl files
(add-hook 'cperl-mode-hook    'nice-prog-hook)
(add-hook 'cperl-mode-hook    'folding-code-hook)
(add-hook 'cperl-mode-hook
          (lambda ()
            (font-lock-add-keywords nil
                                    '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))

;; For Go language files
(add-hook 'go-mode-hook       'nice-prog-hook)

;; For HTML files
(add-hook 'html-mode-hook     'nice-prog-hook)

;; For javascript files
(add-hook 'js-mode-hook       'nice-prog-hook)

;; For Makefiles
(add-hook 'makefile-mode-hook 'nice-makefile-hook)

;; For PHP files
(add-hook 'php-mode-hook      'nice-php-hook)

;; For Ruby files
(add-hook 'ruby-mode-hook     'nice-prog-hook)

;; For Shell Scripts
(add-hook 'sh-mode-hook       'nice-prog-hook)
(add-hook 'sh-mode-hook
          (lambda ()
            (font-lock-add-keywords nil
                                    '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))

;; For SQL files
(add-hook 'sql-mode-hook      'nice-sql-hook)

;; For XML files
(add-hook 'nxml-mode-hook     'nice-nxml-hook)

;; For YAML files
(if (package-installed-p 'flymake-mode)
    (add-hook 'yaml-mode-hook 'flymake-yaml-load))

;;
;; Enable appropriate hooks for text documents
;;

;; Org-mode hooks
(add-hook 'org-mode-hook      'nice-org-hook)
(add-hook 'org-mode-hook      'ac-emoji-setup)

;; Text-mode hooks
(add-hook 'text-mode-hook        'nice-text-hook)
(add-hook 'log-edit-mode-hook    'nice-text-hook)
(add-hook 'log-edit-mode-hook    'turn-on-orgstruct++)
(add-hook 'log-edit-mode-hook    'ac-emoji-setup)
(add-hook 'muse-mode-hook        'nice-text-hook)
(add-hook 'with-editor-mode-hook 'turn-on-orgstruct++)
(add-hook 'with-editor-mode-hook 'ac-emoji-setup)

;; Add hook(s) for twittering mode
(add-hook 'twittering-edit-mode-hook 'nice-text-hook)

;; A hook for nice-msg-mode
(add-hook 'nice-msg-mode-hook 'turn-on-orgstruct++)
(add-hook 'nice-msg-mode-hook 'ac-emoji-setup)

;; nice-ispell-hook() will automatically detect presence of ac-ispell
(add-hook 'LaTeX-mode-hook    'nice-ispell-hook)
(add-hook 'log-edit-mode-hook 'nice-ispell-hook)
(add-hook 'muse-mode-hook     'nice-ispell-hook)
(add-hook 'org-mode-hook      'nice-ispell-hook)
(add-hook 'text-mode-hook     'nice-ispell-hook)

;; Enable lambda character translation for appropriate Lisp documents
(add-hook 'lisp-interactive-mode-hook 'sm-lambda-mode-hook)
(add-hook 'scheme-mode-hook           'sm-lambda-mode-hook)


;; Filename associations
;; --------------------------------------------------------------------

;; Apache Mode
(add-to-list 'auto-mode-alist '("\\.htaccess\\'"           . apache-mode))
(add-to-list 'auto-mode-alist '("access\\.conf\\'"         . apache-mode))
(add-to-list 'auto-mode-alist '("httpd\\.conf\\'"          . apache-mode))
(add-to-list 'auto-mode-alist '("sites-\\(available\\|enabled\\)/" . apache-mode))
(add-to-list 'auto-mode-alist '("srm\\.conf\\'"            . apache-mode))

;; CPERL Mode
(add-to-list 'auto-mode-alist '("\\.cgi\\'"                . cperl-mode))

;; Crontab Mode
(add-to-list 'auto-mode-alist '("\\.cron\\(tab\\)?\\'"     . crontab-mode))
(add-to-list 'auto-mode-alist '("cron\\(tab\\)?\\."        . crontab-mode))

;; CSV files
(add-to-list 'auto-mode-alist '("\\.csv\\'"                . csv-nav-mode))

;; Go files
(add-to-list 'auto-mode-alist '("\\.go\\'"                 . go-mode))

;; HTML Mode
(add-to-list 'auto-mode-alist '("\\.tmpl\\'"               . html-mode))

;; Makefile Mode
(add-to-list 'auto-mode-alist '("[Mm]akefile\\."           . makefile-mode))

;; Muse Mode
(add-to-list 'auto-mode-alist '("\\.muse\\'"               . muse-mode))

;; Org Mode
(add-to-list 'auto-mode-alist '("\\.org\\'"                . org-mode))

;; PHP Mode
(add-to-list 'auto-mode-alist '("\\.php\\'"                . php-mode))

;; Puppet Mode
(add-to-list 'auto-mode-alist '("\\.pp\\'"                 . puppet-mode))

;; Text Mode
(add-to-list 'auto-mode-alist '("COMMIT"                   . nice-msg-mode))
(add-to-list 'auto-mode-alist '("ci-comment"               . nice-msg-mode))
(add-to-list 'auto-mode-alist '("bzr_log\\."               . nice-msg-mode))
(add-to-list 'auto-mode-alist '("pico\\."                  . nice-msg-mode))

;; XML Mode
(add-to-list 'auto-mode-alist '("\\.xsd\\'"                . xml-mode))
(add-to-list 'auto-mode-alist '("\\.wsdl\\'"               . xml-mode))

;; YAML Mode
(add-to-list 'auto-mode-alist '("\\.sls\\'"                . yaml-mode))


;; Customized Variables
;; --------------------------------------------------------------------

;; Change if I decide to go with another theme.
(custom-set-faces
 '(which-func ((t (:foreground "goldenrod")))))

(custom-set-variables
 '(ac-ispell-requires 4)
 '(all-christian-calendar-holidays t)
 '(ansi-color-names-vector
   ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
 '(c-default-style
   (quote
    ((c-mode . "cmf")
     (c++-mode . "cmf")
     (objc-mode . "cmf")
     (java-mode . "cmf")
     (awk-mode . "awk")
     (other . "cmf"))))
 '(c-echo-syntactic-information-p t)
 '(c-report-syntactic-errors t)
 '(c-require-final-newline
   (quote
    ((c-mode . t)
     (c++-mode . t)
     (objc-mode . t)
     (java-mode . t))))
 '(calendar-christian-all-holidays-flag t)
 '(calendar-daylight-time-zone-name "PDT")
 '(calendar-latitude 37.7822)
 '(calendar-location-name "San Francisco, CA")
 '(calendar-longitude -122.4167)
 '(calendar-mark-holidays-flag t)
 '(calendar-standard-time-zone-name "PST")
 '(calendar-time-zone -480)
 '(calendar-view-holidays-initially-flag nil)
 '(column-number-mode t)
 '(comment-auto-fill-only-comments t)
 '(comment-fill-column 80)
 '(comment-multi-line t)
 '(comment-style (quote indent))
 '(cperl-continued-brace-offset -8)
 '(cperl-continued-statement-offset 4)
 '(cperl-electric-keywords t)
 '(cperl-electric-linefeed t)
 '(cperl-electric-parens nil)
 '(cperl-font-lock t)
 '(cperl-highlight-variables-indiscriminately t)
 '(cperl-indent-level 8)
 '(custom-enabled-themes (quote (twilight)))
 '(custom-safe-themes
   (quote
    ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa"
     "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e"
     "e24180589c0267df991cf54bf1a795c07d00b24169206106624bb844292807b9"
     "51e228ffd6c4fff9b5168b31d5927c27734e82ec61f414970fc6bcce23bc140d"
     default)))
 '(delete-selection-mode nil)
 '(diff-switches "-u")
 '(dired-listing-switches "-alh")
 '(display-time-mode t)
 '(emerge-combine-versions-template "
%b
%a
")
 '(flycheck-completion-system 'ido)
 '(flycheck-highlighting-mode 'lines)
 '(global-hl-line-mode t)
 '(gud-gdb-command-name "gdb --annotate=1")
 '(ido-mode t)
 '(js-indent-level 8)
 '(js-expr-indent-offset 4)
 '(linum-delay t)
 '(log-edit-hook (quote (log-edit-show-files)))
 '(mark-even-if-inactive t)
 '(mark-holidays-in-calendar t)
 '(org-agenda-custom-commands
   (quote
    (("n" "Agenda and all TODO's"
      ((agenda "")
       (alltodo)))
     ("g" . "GTD Task Lists")
     ("gh" "Home" tags-todo "HOME")
     ("go" "Office" tags-todo "OFFICE")
     ("gg" "G.G. Guards" tags-todo "GGG")
     ("gr" "Tasks to refile"
      ((todo "TODO"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))
       (todo "STARTED"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))
       (todo "WAITING"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))))
     ("B" "GTD (B)lock Agenda"
      ((tags-todo "OFFICE")
       (tags-todo "GGG")
       (tags-todo "HOME"))
      nil)
     ("H" "Home Agenda"
      ((agenda "")
       (tags-todo "HOME"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+HOME")))))
     ("O" "Office Agenda"
      ((agenda "")
       (tags-todo "OFFICE"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+OFFICE")))))
     ("G" "G.G. Guards Agenda"
      ((agenda "")
       (tags-todo "GGG"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+GGG"))))))))
 '(org-agenda-files (quote ("~/org/tasks.org")))
 '(org-ascii-charset (quote utf-8))
 '(org-archive-location "~/org/archive/%s_archive::datetree/")
 '(org-capture-templates
   (quote
    (("t" "Task" entry
      (file+headline "~/org/refile.org" "New Tasks")
      "* TODO %^{Description}  %^G
  Added: %U
  Context: %a

  %?")
     ("i" "Idea" entry
      (file+headline "~/org/refile.org" "New Ideas")
      "* %^{Title} %^G
  Added: %U
  Context: %a

  %?
            ")
     ("a" "Appointment" entry
      (file+headline "~/org/tasks.org" "Appointments")
      "* TODO %^{Description}  :APPT:%^G
  Added: %U
  Context: %a

  %?")
     ("n" "Note" entry
      (file+datetree "~/org/notes.org")
      "* %^{Description}  %^G
  Added: %U
  Context: %a

  %?" :empty-lines 1)
     ("j" "Journal Entry" entry
      (file+datetree "~/org/journal.org")
      "** %^{Heading}
  Added: %U

  %?" :empty-lines 1)
     ("K" "Kawasaki Riding Log Entry" table-line
      (file+headline "~/org/journal.org" "Kawasaki Riding Log")
      " | %^u | %^{Miles} |")
     ("B" "Blood Pressure Log Entry" table-line
      (file+headline "~/org/journal.org" "Blood Pressure Log")
      "| %^u | %^{Systolic} | %^{Diastolic} |")
     ("E" "Household Expense" table-line
      (file+headline "~/org/journal.org" "Household Expenses")
      "| %^u | %^{Vendor} | %^{Description} | %^{Cost} |")
     ("P" "Project" entry
      (file+headline "~/org/projects.org" "Projects")
      "* %^{Description} :%^G:
  Added: %U
  Context: %a

** Why?

   %?

** Outcome

** Lead

** Stakeholders

** Tasks

  " :prepend t :empty-lines 1))))
 '(org-clock-persist 'history)
 '(org-clock-persist-file "~/.org-clock-save.el")
 '(org-complete-tags-always-offer-all-agenda-tags t)
 '(org-default-notes-file "~/org/notes.org")
 '(org-directory "~/org")
 '(org-export-latex-listings t)
 '(org-export-latex-packages-alist (quote (("" "listings") ("" "color"))))
 '(org-export-with-tags nil)
 '(org-fast-tag-selection-single-key t)
 '(org-latex-pdf-process
   (quote
    ("pdflatex -interaction nonstopmode -output-directory %o %f" "bibtex %b" "pdflatex -interaction nonstopmode -output-directory %o %f" "pdflatex -interaction nonstopmode -output-directory %o %f")))
 '(org-log-done (quote note))
 '(org-log-refile (quote time))
 '(org-mobile-directory "~/Dropbox/MobileOrg")
 '(org-mobile-files
   (quote
    (org-agenda-files "~/org/notes.org" "~/org/journal.org" "~/org/incubate.org" "~/org/ideas.org")))
 '(org-log-note-clock-out t)
 '(org-refile-targets (quote ((org-agenda-files :maxlevel . 2) ("~/org/incubate.org" :maxlevel . 1) ("~/org/ideas.org" :maxlevel . 1))))
 '(org-refile-use-outline-path t)
 '(org-src-fontify-natively t)
 '(org-stuck-projects
   (quote
    ("+LEVEL=2/-DONE"
     ("TODO" "NEXT" "STARTED" "WAITING")
     nil "")))
 '(org-tag-persistent-alist
   (quote
    (("HOME" . 104)
     ("OFFICE" . 111)
     ("ERRAND" . 101)
     ("PHONE" . 112)
     ("EMAIL" . 109)
     ("GGG" . 103)
     ("APPT" . 97))))
 '(org-todo-keywords
   (quote
    ((sequence "TODO" "NEXT(n!)" "STARTED(s!/@)" "DEFERRED(f!/@)" "DELEGATED(l@/@)" "WAITING(w@/@)" "|" "CANCELED(x@)" "DONE(d@)"))))
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("marmalade" . "http://marmalade-repo.org/packages/")
     ("melpa" . "http://melpa.org/packages/"))))
 '(recentf-mode t)
 '(scroll-bar-mode (quote right))
 '(set-time-zone-rule "America/Los_Angeles")
 '(sh-basic-offset 8)
 '(sh-indent-comment t)
 '(sh-indent-for-case-alt (quote +))
 '(sh-indent-for-case-label 0)
 '(sh-indent-for-continuation 4)
 '(sh-indentation 8)
 '(show-paren-mode 1)
 '(sr-speedbar-max-width 20)
 '(sr-speedbar-right-side nil)
 '(sunshine-location "94110,USA")
 '(transient-mark-mode 1)
 '(twittering-display-remaining t)
 '(twittering-timer-interval 900)
 '(twittering-tinyurl-service (quote tinyurl))
 '(twittering-use-icon-storage t)
 '(twittering-use-master-password t)
 ;; '(twittering-username "your_twitter_account_here")
 '(user-full-name "Christopher M. Fuhrman")
 '(user-mail-address "cfuhrman@pobox.com")
 '(view-calendar-holidays-initially nil)
 '(which-function-mode t)
 )


;; Miscellany
;; --------------------------------------------------------------------

;; Additional paths to load
(nice-load-path local-loadpaths)
(nice-exec-path local-execpaths)

;; Enable flycheck-mode globally
(if (package-installed-p 'flycheck-mode)
    (add-hook 'after-init-hook #'global-flycheck-mode))

;; Library evaluations
;; --------------------------------------------------------------------

(eval-after-load "auto-complete"
  '(progn
     (require 'auto-complete-config)
     (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
     (ac-config-default)
     (ac-set-trigger-key "TAB")
     (ac-set-trigger-key "<tab>")
     (if (package-installed-p 'ac-ispell)
         (ac-ispell-setup))))

(eval-after-load "dired"
  '(progn
     ;; Use Emacs ls(1) emulation
     (setq ls-lisp-use-insert-directory-program nil)
     (if (equal window-system 'ns)
         (setq default-directory (concat (getenv "HOME") "/")))
     ))

(eval-after-load "go-mode"
  '(progn
     (if (package-installed-p 'flymake-mode)
         '(require 'flymake-go))
     ))

(eval-after-load "multi-web-mode"
  '(progn
     ;; Set up multi-web-mode
     (setq mweb-default-major-mode 'html-mode)
     (setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
                       (js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
                       (css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
     (setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
     (multi-web-global-mode 1)
     ))

(eval-after-load "org-mode"
  (org-clock-persistence-insinuate))

;; php-auto-yasnippets attempts to use php-mode *before* it has had a
;; chance to compile, so only append php-auto-yasnippets to the
;; package list until after we know it's been loaded.
(eval-after-load "php-mode"
  '(progn
     (setq php-executable "php")
     (add-to-list 'my-package-list 'php-auto-yasnippets t)
     (if (package-installed-p 'flymake-php)
         (add-hook 'php-mode-hook      'flymake-php-load))
     (if (package-installed-p 'php-auto-yasnippets)
         (cmf-autoinstall-packages))
     ))

(eval-after-load "sh-mode"
  '(progn
     (if (package-installed-p 'flymake-shell)
         (add-hook 'sh-set-shell-hook 'flymake-shell-load))
     ))

(eval-after-load "smart-mode-line"
  '(progn
     (sml/apply-theme 'dark)
     ))

(eval-after-load "solarized-theme"
  '(progn
     (if (window-system)
         (load-theme 'solarized-dark t))
     ))

(eval-after-load "twittering-mode"
  '(progn
     (if (window-system)
         (twittering-icon-mode t))
     ))

(eval-after-load "vc-fossil"
  '(progn
     ;; Add Fossil support to VC
     (add-to-list 'vc-handled-backends 'Fossil)
     ))

(eval-after-load "yasnippet"
  '(progn
     (require 'setup-yasnippet)
     ))


;; Post-init processing
;; --------------------------------------------------------------------

;; Load post-init packages
(add-hook 'after-init-hook
          #'(lambda ()
	      (if (package-installed-p 'yasnippet)
                  (require 'yasnippet))
              (if (package-installed-p 'auto-complete)
                  (require 'auto-complete))
              (if (package-installed-p 'flymake-shell)
                  (progn
                    (require 'flymake)
                    (require 'flymake-shell)))
              (if (package-installed-p 'geben)
                  (autoload 'geben "geben" "DBGp protocol frontend, a script debugger" t))
              (if (package-installed-p 'go-direx)
                  (require 'go-direx))
              (if (package-installed-p 'indent-guide)
                  (require 'indent-guide))
              (if (package-installed-p 'multi-web-mode)
                  (require 'multi-web-mode))
              (if (package-installed-p 'org-ac)
                  (require 'org-ac))
              (if (package-installed-p 'org-bullets)
                  (require 'org-bullets))
              (if (package-installed-p 'php-auto-yasnippets)
                  (require 'php-auto-yasnippets))
              (if (package-installed-p 'vc-fossil)
                  (require 'vc-fossil))
              (if (package-installed-p 'xlicense)
                  (require 'xlicense))
              (if (package-installed-p 'smart-mode-line)
                  (sml/setup))
              ;; (if (package-installed-p 'solarized-theme)
              ;;     (load-theme 'solarized-dark t))
	      (if (package-installed-p 'twilight-theme)
		  (load-theme 'twilight))
              ))

;;; init.el ends here
























|







 








|
|
|
<
<
<
<
<

<

|
<
<
<
>

>
>
>
>
>
>
>
>
|
<

>
|
|
|
<
>
|
<

>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
|
<
<
<
>
>
>
|
|
|
|
<
<
>
>
|
|
<
>
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
<
>
|
|
|
|
|
<
>
|
|
|
|
<
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>
>
|
<
>
|
<
<
<
<
<
<
<
<
<
|
>
>
>
>
>
>
>
>

<
<
<
<
<
<
<
<
>
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
>
>


<
|
|
|
|
|
|


|
|
|
|
>


<
|
|
|
>
|
>


<
<
<
<
<
|
>
>

>
|
|
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<
<
>
>
>
>
|

<
<
<
<
<
<
<
<
>
>










>
>


<
<
<
<
<
<
<
<
<









|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
..
23
24
25
26
27
28
29
30
31
32
33





34

35
36



37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52

53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95



96
97
98
99
100
101
102


103
104
105
106

107
108
109
110
111
112
113
114
115
116

117
118
119
120
121

122
123
124
125
126
127

128
129
130
131
132

133
134
135





































136
137
138

139
140









141
142
143
144
145
146
147
148
149
150








151
152












































153
154
155
156
157
158
159
...
170
171
172
173
174
175
176

177
178
179
180

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

196
197
198
199
200
201
202
203





204
205
206
207
208
209
210








211
212








213
214
215
216
217
218








219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234









235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
;;; init.el --- Personal customizations
;; ====================================================================
;;
;; Copyright (c) 2008, 2016 Christopher M. Fuhrman
;; All rights reserved.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Simplified BSD License (also known
;; as the "2-Clause License" or "FreeBSD License".)
;;
;; Created Thu Feb 29 17:16:39 2008 PST
................................................................................
;;      *THE WORLD*!
;;

;;; Code:

;; Make sure all Emacs Lisp files are byte-compiled for speed
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)

;; Update load paths
(add-to-list 'load-path "~/.emacs.d/lisp")
(add-to-list 'load-path "~/.emacs.d/thirdparty")








;; Variables



;; --------------------------------------------------------------------

;; Variable definitions
(defvar cmf-full-name "Christopher M. Fuhrman")
(defvar cmf-mail-address "cfuhrman@pobox.com")
(defvar cmf-latitude 37.7822)
(defvar cmf-longitude -122.4167)
(defvar cmf-location-name "San Francisco, CA")
(defvar cmf-time-zone "America/Los Angeles")
(defvar cmf-time-zone-short-name "PST")
(defvar cmf-time-zone-short-name-daylight "PDT")


;; List of paths to search
(defvar cmf-path-list '("/usr/texbin"
                        "/usr/pkg/bin"
                        "/usr/local/bin"

                        "~/.composer/vendor/bin"
                        "/Library/TeX/texbin"))


;; Customize generic variables
(custom-set-variables
 '(c-default-style
   (quote
    ((c-mode . "cmf")
     (c++-mode . "cmf")
     (objc-mode . "cmf")
     (java-mode . "cmf")
     (awk-mode . "awk")
     (other . "cmf"))))
 '(calendar-christian-all-holidays-flag t)
 '(calendar-daylight-time-zone-name cmf-time-zone-short-name-daylight)
 '(calendar-latitude cmf-latitude)
 '(calendar-location-name cmf-location-name)
 '(calendar-longitude cmf-longitude)
 '(calendar-mark-holidays-flag t)
 '(calendar-standard-time-zone-name cmf-time-zone-short-name)
 '(calendar-time-zone -480)
 '(calendar-view-holidays-initially-flag nil)
 '(column-number-mode t)
 '(comment-auto-fill-only-comments t)
 '(comment-fill-column 80)
 '(comment-multi-line t)
 '(comment-style (quote indent))
 '(cperl-continued-brace-offset -8)
 '(cperl-continued-statement-offset 4)
 '(cperl-electric-keywords t)
 '(cperl-electric-linefeed t)
 '(cperl-electric-parens nil)
 '(cperl-font-lock t)
 '(cperl-highlight-variables-indiscriminately t)
 '(cperl-indent-level 8)
 '(custom-enabled-themes (quote (twilight)))
 '(delete-selection-mode nil)

 '(diff-switches "-u")
 '(dired-listing-switches "-alh")
 '(dired-use-ls-dired (quote unspecified))
 '(flycheck-disabled-checkers (quote (php-phpcs)))
 '(display-time-mode t)
 '(emerge-combine-versions-template "



%b
%a
")
 '(flycheck-highlighting-mode 'lines)
 '(forecast-latitude cmf-latitude)
 '(forecast-longitude cmf-longitude)
 '(forecast-city cmf-location-name)


 '(forecast-country "United States")
 '(forecast-units 'us)
 '(forecast-api-key "bb1192e68c5d975f3a263cddbd18dcd9")
 '(global-hl-line-mode t)

 '(ivy-use-virtual-buffers t)
 '(ivy-height 10)
 '(ivy-count-format "(%d/%d) ")
 '(linum-delay t)
 '(log-edit-hook (quote (log-edit-show-files)))
 '(mac-option-modifier 'meta)
 '(mark-even-if-inactive t)
 '(mark-holidays-in-calendar t)
 '(recentf-mode t)
 '(scroll-bar-mode (quote right))

 '(sh-basic-offset 8)
 '(sh-indent-comment t)
 '(sh-indent-for-case-alt (quote +))
 '(sh-indent-for-case-label 0)
 '(sh-indent-for-continuation 4)

 '(sh-indentation 8)
 '(show-paren-mode 1)
 '(sml/modified-char "★")
 '(sml/read-only-char "🔒")
 '(transient-mark-mode 1)
 '(twittering-display-remaining t)

 '(twittering-timer-interval 900)
 '(twittering-tinyurl-service (quote tinyurl))
 '(twittering-use-icon-storage t)
 '(twittering-use-master-password t)
 ;; '(twittering-username "your_twitter_account_here")

 '(undo-tree-visualizer-diff t)
 '(undo-tree-visualizer-timestamps t)
 '(use-package-concat t)





































 '(user-full-name cmf-full-name)
 '(user-mail-address cmf-mail-address)
 '(which-function-mode t)

 '(yas-snippet-dirs '("~/.emacs.d/snippets"))
 )










;; Load the appropriate customization file based on if we are running
;; under a window system, such as "x" or "ns" (Mac OS X or GNUstep)
(if (equal window-system nil)
    (if (or (string-match "term-256" (getenv "TERM"))
            (string-match "screen-256" (getenv "TERM")))
        (setq custom-file "~/.emacs.d/custom-nox256.el")
      (setq custom-file "~/.emacs.d/custom-nox.el"))
  (setq custom-file "~/.emacs.d/custom.el"))









(load custom-file)














































;; Programming styles
;; --------------------------------------------------------------------

;; OpenBSD Coding Style
(c-add-style "openbsd"
             '("bsd"
................................................................................
;; My own style
(c-add-style "cmf"
             '("bsd"
	       (indent-tabs-mode . nil)
               (c-offsets-alist
                (statement-cont . (first c-lineup-cascaded-calls +)))))



;; Functions
;; --------------------------------------------------------------------


;; Functions for perltidy
(defun cmf/perltidy-region ()
  "Run perltidy on the current region."
  (interactive)
  (save-excursion
    (shell-command-on-region (point) (mark) "perltidy -q" nil t))
  )

(defun cmf/perltidy-defun ()
  "Run perltidy on the current defun."
  (interactive)
  (save-excursion (mark-defun)
                  (perltidy-region))
  )


;; Function for loading exec paths
(defun cmf/update-exec-path (pathlist)
  "Add given PATHLIST to 'exec-path'."
  (dolist (path pathlist)
    (add-to-list 'exec-path path)
    (setenv "PATH" (concat (getenv "PATH") ":" path)))
  )







;; Defined modes
;; --------------------------------------------------------------------

(define-derived-mode nice-msg-mode
  text-mode "Nice"
  "Major mode for editing text documents."








  )









;; Apply hooks as appropriate
(add-hook 'nice-msg-mode-hook 'nice-text-hook)
(add-hook 'nice-msg-mode-hook 'turn-on-orgstruct++)
(add-hook 'nice-msg-mode-hook 'ac-emoji-setup)










;; Hooks
;; --------------------------------------------------------------------

;; Define a nice programming hook
(defun nice-prog-hook ()
  "Enable some sanity for programming source files."
  (if (>= emacs-major-version 23)
      (linum-mode t))
  (if (package-installed-p 'ggtags)
      (ggtags-mode t))
  (if (package-installed-p 'indent-guide)
      (indent-guide-mode t))
  (if (package-installed-p 'undo-tree)
      (undo-tree-mode t))
  (auto-fill-mode t)
  (eldoc-mode t)









  (electric-pair-mode t)
  )

;; Define a basic hook for sane editing of text documents
(defun nice-text-hook ()
  "Hook for sane editing of text (ASCII) documents."
  (auto-fill-mode t)
  (flyspell-mode t)
  (footnote-mode t)
  (if (package-installed-p 'undo-tree)
      (undo-tree-mode t))
  (if (package-installed-p 'auto-complete)
      (auto-complete-mode t))
  )

;; Aliases
;; --------------------------------------------------------------------

(defalias 'perl-mode 'cperl-mode)


;; Macros
;; --------------------------------------------------------------------

(fset 'align-on-equal
      (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 97 108 105 103 110 45 114 101 103 101 120 112 return 61 return] 0 "%d")) arg)))

(fset 'align-on-hash-arrow
      (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 97 108 105 103 110 45 114 101 103 101 120 return 61 62 return] 0 "%d")) arg)))


;; Keyboard Bindings
;; --------------------------------------------------------------------

;; Custom key bindings for commonly used commands
(global-set-key [?\C-x ?\C-k ?0] 'normal-erase-is-backspace-mode)
(global-set-key [?\C-x ?\C-k ?1] 'delete-trailing-whitespace)
(global-set-key [?\C-x ?\C-k ?2] 'align-on-equal)
(global-set-key [?\C-x ?\C-k ?3] 'align-on-hash-arrow)


;; Additional Initializations
;; --------------------------------------------------------------------

;; Update path list
(cmf/update-exec-path cmf-path-list)

;; Fix normal-erase-is-backspace under non-Linux OS
(if (and (equal window-system nil)
         (equal (equal system-type 'gnu/linux) nil))
    (normal-erase-is-backspace-mode 0))

;; Customize font under X
(if (equal window-system 'x)
    (set-face-attribute 'default nil
                        :family  "DejaVu Sans Mono"
                        :foundry 'unknown
                        :slant   'normal
                        :weight  'normal
                        :height   100
                        :width   'normal))

;; Enable Apple Color Emoji
(if (equal window-system 'ns)
    (set-fontset-font
     t 'symbol
     (font-spec :family "Apple Color Emoji") nil 'prepend))

;; Use Emacs ls(1) emulation
(require 'ls-lisp)


;; Package configuration
;; --------------------------------------------------------------------

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))
(require 'diminish)
(require 'bind-key)

;; Packages loaded through external files
(require 'cmf-org-settings)

;; apache-mode
(use-package apache-mode
  :ensure t
  :defer t
  :no-require t
  :mode (("\\.htaccess\\'"                   . apache-mode)
         ("access\\.conf\\'"                 . apache-mode)
         ("httpd\\.conf\\'"                  . apache-mode)
         ("sites-\\(available\\|enabled\\)/" . apache-mode)
         ("srm\\.conf\\'"                    . apache-mode))
  :config
  (add-hook 'apache-mode-hook 'nice-prog-hook)
  )

;; auto-complete
(use-package auto-complete
  :ensure auto-complete
  :ensure ac-emoji
  :ensure ac-ispell

  :init
  (require 'auto-complete)

  :config
  (require 'auto-complete-config)
  (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
  (ac-config-default)
  (ac-set-trigger-key "TAB")
  (ac-set-trigger-key "<tab>")
  (if (package-installed-p 'ac-ispell)
      (ac-ispell-setup))
  )

;; auto-compile
(use-package auto-compile
  :ensure t
  :config (auto-compile-on-load-mode))

(setq load-prefer-newer t)

;; cc-mode
(use-package cc-mode
  :config
  (add-hook 'c-mode-common-hook 'nice-prog-hook)
  (add-hook 'c-mode-common-hook
            (lambda ()
              (font-lock-add-keywords nil
                                      '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))
  )

;; [c]perl-mode
(use-package cperl-mode
  :config
  (add-hook 'cperl-mode-hook 'nice-prog-hook)
  (add-hook 'cperl-mode-hook
            (lambda ()
              (font-lock-add-keywords nil
                                      '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))

  :mode ("\\.cgi\\'" . cperl-mode)
  )

;; crontab-mode
(use-package crontab-mode
  :ensure t
  :defer t
  :mode (("\\.cron\\(tab\\)?\\'" . crontab-mode)
         ("cron\\(tab\\)?\\."    . crontab-mode))
  )

;; csv-nav-mode
(use-package csv-nav-mode
  :ensure csv-nav
  :defer t
  :mode ("\\.csv\\'" . csv-nav-mode)
  )

;; eldoc
(use-package eldoc
  :diminish eldoc-mode " Edoc"
  )

;; flycheck
(use-package flycheck
  :ensure t
  :defer t
  :config
  (add-hook 'after-init-hook  #'global-flycheck-mode)
  )

;; flyspell
(use-package flyspell
  :config
  (setq-default ispell-program-name "aspell")
  )

;; forecast
(if (version< emacs-version "24.4")
    (message "Forecast requires Emacs version 24.4 or later.  Unable to install")
  (use-package forecast
    :ensure t
    :defer t
    )
  )

;; ggtags
(use-package ggtags
  :ensure t
  :defer t
  :diminish ggtags-mode " G"
  )

;; go-mode
(use-package go-mode
  :no-require t

  :ensure go-mode
  :ensure go-autocomplete
  :ensure go-direx
  :ensure go-eldoc
  :ensure go-mode
  :ensure go-snippets

  :defer t

  :mode ("\\.go\\'" . go-mode)

  :config
  (add-hook 'go-mode-hook 'nice-prog-hook)
  )

;; html-mode
(use-package html-mode
  :mode ("\\.tmpl\\'" . html-mode)
  )

;; indent-guide
(use-package indent-guide
  :ensure t
  :defer t
  :diminish indent-guide-mode
  )

;; ivy-mode
(use-package ivy-mode
  :ensure counsel
  :ensure swiper

  :bind (
         ("C-s"     . swiper)
         ("C-c C-r" . ivy-resume)
         ("M-x"     . counsel-M-x)
         ("C-x C-f" . counsel-find-file)
         ("<f1> f"  . counsel-describe-function)
         ("<f1> v"  . counsel-describe-variable)
         ("<f1> l"  . counsel-load-library)
         ("<f2> i"  . counsel-info-lookup-symbol)
         ("<f2> u"  . counsel-unicode-char)
         )

  :init
  (ivy-mode 1)
  )

;; lisp-mode
(use-package lisp-mode
  :config
  ;; Define a basic hook for Emacs lisp files
  (defun nice-elisp-hook ()
    "Hook for sane editing of Lisp files."
    (setq indent-tabs-mode nil)
    )

  (add-hook 'emacs-lisp-mode-hook 'nice-prog-hook)
  (add-hook 'emacs-lisp-mode-hook 'nice-elisp-hook)
  (add-hook 'emacs-lisp-mode-hook
            (lambda ()
              (font-lock-add-keywords nil
                                      '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))
  )

;; log-edit-mode
(use-package log-edit
  :init
  (add-hook 'log-edit-mode-hook 'nice-text-hook)
  (add-hook 'log-edit-mode-hook 'turn-on-orgstruct++)
  )

;; magit
(if (version< emacs-version "24.4")
    (message "Magit requires Emacs version 24.4 or later.  Unable to install")
  (use-package magit
    :ensure t

    :bind
    ("C-x g" . magit-status)
    )
  )

;; make-mode
(use-package make-mode
  :mode ("[Mm]akefile\\." . makefile-mode)

  :config
  ;; Define a basic hook for sane editing of makefiles
  (defun nice-makefile-hook ()
    "Hook for sane editing of Makefiles."
    (if (>= emacs-major-version 23)
        (linum-mode t))
    )

  (add-hook 'makefile-mode-hook 'nice-makefile-hook)
  )

;; markdown-mode
(use-package markdown-mode
  :ensure t
  :defer t
  )

;; nxml-mode
(use-package nxml-mode
  :mode (("\\.xsd\\'"  . xml-mode)
         ("\\.wsdl\\'" . xml-mode))

  :config
  ;; Define a nice hook for editing nXML files
  (defun nice-nxml-hook ()
    "Hook for sane editing of nXML files."
    (if (>= emacs-major-version 23)
        (linum-mode t))
    (if (package-installed-p 'indent-guide)
        (indent-guide-mode t))
    (auto-fill-mode -1)
    )

  (add-hook 'nxml-mode-hook 'nice-nxml-hook)
  )

;; org-mode
(use-package org
  :ensure org-ac
  :ensure org-bullets
  :ensure ox-twbs

  :defer t

  :bind (
         ("C-c l" . org-store-link)
         ("C-c a" . org-agenda)
         ("C-c c" . org-capture)
         ("C-c b" . org-iswitchb)
         )

  :init
  (require 'org-install)
  (require 'org-bullets)

  :config
  ;; Define a basic hook for sane editing of org-mode documents
  (defun nice-org-hook ()
    "Hook for sane editing of 'org-mode' documents."
    (org-defkey org-mode-map "\C-c[" 'org-time-stamp-inactive)
    (org-ac/setup-current-buffer)
    (if (equal (car (split-string org-version ".")) 8)
        (require 'ox-md))
    (if (package-installed-p 'undo-tree)
        (undo-tree-mode t))
    )

  ;; Persist org-clock appropriately
  (org-clock-persistence-insinuate)

  ;; Org-mode hooks
  (add-hook 'org-mode-hook 'nice-text-hook)
  (add-hook 'org-mode-hook 'nice-org-hook)
  (add-hook 'org-mode-hook 'ac-emoji-setup)
  (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
  )

;; php-mode
(use-package php-mode
  :ensure ac-php
  :ensure mmm-mode
  :ensure php-mode
  :ensure php-auto-yasnippets
  :ensure php-eldoc
  :ensure php-extras
  :ensure phpcbf
  :ensure phpunit

  :defer t
  :mode ("\\.php\\'" . php-mode)

  :config
  ;; Define a nice hook for editing php files
  (defun nice-php-hook()
    "Hook for sane editing of PHP files."
    (c-set-style "cmf")
    (if (package-installed-p 'php-auto-yasnippets)
        (define-key php-mode-map (kbd "C-c C-y") 'yas/create-php-snippet))
    (if (package-installed-p 'mmm-mode)
        (mmm-mode t))
    (define-key php-mode-map (kbd "C-x p") 'phpdoc)
    )

  ;; For PHP files
  (add-hook 'php-mode-hook 'nice-php-hook)

  ;; Load phpdocumentor
  (load-file "~/.emacs.d/thirdparty/phpdocumentor.el")

  ;; Set up mmm-mode
  (require 'mmm-auto)
  (setq mmm-global-mode 'maybe)
  (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)

  )

;; pretty-lambdada
(use-package pretty-lambdada
  :ensure t
  :defer t

  :init
  (require 'pretty-lambdada)

  :config
  (pretty-lambda-for-modes)
  )

;; ruby-mode
(use-package ruby-mode
  :init
  (add-hook 'ruby-mode-hook 'nice-prog-hook)
  )

;; smart-mode-line
(use-package smart-mode-line
  :ensure t

  :init
  (add-to-list 'custom-safe-themes
               "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa")
  (add-to-list 'custom-safe-themes
               "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e")
  (sml/setup)

  :config
  (sml/apply-theme 'dark)
  )

;; sh-script
(use-package sh-script
  :config
  (add-hook 'sh-mode-hook 'nice-prog-hook)
  (add-hook 'sh-mode-hook
            (lambda ()
              (font-lock-add-keywords nil
                                      '(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))
  )

;; sql
(use-package sql
  :config
  ;; Define a nice hook for editing SQL files
  (defun nice-sql-hook ()
    "Hook for sane editing of SQL files."
    (if (>= emacs-major-version 23)
        (linum-mode t))
    (auto-fill-mode t)
    (electric-pair-mode t)
    )

  (add-hook 'sql-mode-hook 'nice-sql-hook)
  )

;; tex
(use-package tex
  :ensure auctex
  )

;; text-mode
(use-package text-mode
  :mode (
         ("COMMIT"     . nice-msg-mode)
         ("ci-comment" . nice-msg-mode)
         ("bzr_log\\." . nice-msg-mode)
         ("pico\\."    . nice-msg-mode)
         )

  :config
  (add-hook 'text-mode-hook     'nice-text-hook)
  (add-hook 'log-edit-mode-hook 'ac-emoji-setup)
  )

;; twilight-theme
(use-package twilight-theme
  :ensure t

  :init
  (load-theme 'twilight t)
  )

;; twittering-mode
(use-package twittering-mode
  :ensure t
  :defer t

  :config
  (add-hook 'twittering-edit-mode-hook 'nice-text-hook)

  :if window-system
  :config
  (twittering-icon-mode t)
  )

;; undo-tree
(use-package undo-tree
  :ensure t
  )

;; vc-fossil
(use-package vc-fossil
  :ensure t
  :defer t

  :init
  (require 'vc-fossil)

  :config
  (add-to-list 'vc-handled-backends 'Fossil)
  )

;; which-func
(use-package which-func
  :no-require t
  :config
  (custom-set-faces
   '(which-func ((t (:foreground "goldenrod")))))
  )

;; xkcd
(use-package xkcd
  :ensure t
  )

;; yaml-mode
(use-package yaml-mode
  :ensure t
  :defer t

  :mode ("\\.sls\\'" . yaml-mode)
  :config
  (add-hook 'yaml-mode-hook 'nice-prog-hook)
  )

(use-package yasnippet
  :ensure t

  :config
  ;; Inter-field navigation
  (defun yas/goto-end-of-active-field ()
    (interactive)
    (let* ((snippet (car (yas--snippets-at-point)))
           (position (yas--field-end (yas--snippet-active-field snippet))))
      (if (= (point) position)
          (move-end-of-line 1)
        (goto-char position))))

  (defun yas/goto-start-of-active-field ()
    (interactive)
    (let* ((snippet (car (yas--snippets-at-point)))
           (position (yas--field-start (yas--snippet-active-field snippet))))
      (if (= (point) position)
          (move-beginning-of-line 1)
        (goto-char position))))

  ;; fix some org-mode + yasnippet conflicts:
  (defun yas/org-very-safe-expand ()
    (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))

  ;; Turn on snippets
  (yas-global-mode t)

  ;; Keybindings
  (define-key yas-keymap (kbd "<return>") 'yas-exit-all-snippets)
  (define-key yas-keymap (kbd "C-e") 'yas/goto-end-of-active-field)
  (define-key yas-keymap (kbd "C-a") 'yas/goto-start-of-active-field)

  ;; Update org-mode configuration
  (add-hook 'org-mode-hook
            (lambda ()
              (make-variable-buffer-local 'yas/trigger-key)
              (setq yas/trigger-key [tab])
              (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
              (define-key yas/keymap [tab] 'yas/next-field)))

  ;; Wrap around region
  (setq yas-wrap-around-region t)
  )

;; Diminished functions
(diminish 'ivy-mode "")
(diminish 'yas-minor-mode " Y")
(diminish 'undo-tree-mode " UT")

;;; init.el ends here

Added emacs.d/lisp/GNUmakefile.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# emacs.d/lisp/GNUmakefile
#

RM_OPTS=$(shell if [ `uname` != "OpenBSD" ]; then echo '-vf'; else echo '-f'; fi)

clean: ${CLEANDIRS}
	@rm ${RM_OPTS} *~
	@rm ${RM_OPTS} *.bak
	@rm ${RM_OPTS} *-baseline
	@rm ${RM_OPTS} *-merge
	@rm ${RM_OPTS} *-original
	@rm ${RM_OPTS} *.elc

# Ende

Added emacs.d/lisp/cmf-org-settings.el.









































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
;;; cmf-org-settings.el --- Personal customizations for org-mode
;; ====================================================================
;;;
;; Copyright (c) 2016 Christopher M. Fuhrman
;; All rights reserved
;;
;; This program is free software; you can redistribute it and/or
;; modify it under terms of the Simplified BSD License (also
;; known as the "2-Clause License" or "FreeBSD License".)
;;
;; Created Wed Feb 17 21:20:03 2016 PST
;;
;; ====================================================================

;;; Commentary:
;;
;; Applies personal customizations for org-mode
;;

;;; Code:

;; Variables
(custom-set-variables
 '(org-agenda-custom-commands
   (quote
    (("n" "Agenda and all TODO's"
      ((agenda "")
       (alltodo)))
     ("g" . "GTD Task Lists")
     ("gh" "Home" tags-todo "HOME")
     ("go" "Office" tags-todo "OFFICE")
     ("gg" "G.G. Guards" tags-todo "GGG")
     ("gr" "Tasks to refile"
      ((todo "TODO"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))
       (todo "STARTED"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))
       (todo "WAITING"
             ((org-agenda-files
               (quote
                ("~/org/from-mobile.org" "~/org/refile.org")))))))
     ("B" "GTD (B)lock Agenda"
      ((tags-todo "OFFICE")
       (tags-todo "GGG")
       (tags-todo "HOME"))
      nil)
     ("H" "Home Agenda"
      ((agenda "")
       (tags-todo "HOME"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+HOME")))))
     ("O" "Office Agenda"
      ((agenda "")
       (tags-todo "OFFICE"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+OFFICE")))))
     ("G" "G.G. Guards Agenda"
      ((agenda "")
       (tags-todo "GGG"))
      ((org-agenda-tag-filter-preset
        (quote
         ("+GGG"))))))))
 '(org-agenda-files (quote ("~/org/tasks.org")))
 '(org-ascii-charset (quote utf-8))
 '(org-archive-location "~/org/archive/%s_archive::datetree/")
 '(org-capture-templates
   (quote
    (("t" "Task" entry
      (file+headline "~/org/refile.org" "New Tasks")
      "* TODO %^{Description}  %^G
  Added: %U
  Context: %a

  %?")
     ("i" "Idea" entry
      (file+headline "~/org/refile.org" "New Ideas")
      "* %^{Title} %^G
  Added: %U
  Context: %a

  %?
            ")
     ("a" "Appointment" entry
      (file+headline "~/org/tasks.org" "Appointments")
      "* TODO %^{Description}  :APPT:%^G
  Added: %U
  Context: %a

  %?")
     ("n" "Note" entry
      (file+datetree "~/org/notes.org")
      "* %^{Description}  %^G
  Added: %U
  Context: %a

  %?" :empty-lines 1)
     ("j" "Journal Entry" entry
      (file+datetree "~/org/journal.org")
      "** %^{Heading}
  Added: %U

  %?" :empty-lines 1)
     ("K" "Kawasaki Riding Log Entry" table-line
      (file+headline "~/org/journal.org" "Kawasaki Riding Log")
      " | %^u | %^{Miles} |")
     ("B" "Blood Pressure Log Entry" table-line
      (file+headline "~/org/journal.org" "Blood Pressure Log")
      "| %^u | %^{Systolic} | %^{Diastolic} |")
     ("E" "Household Expense" table-line
      (file+headline "~/org/journal.org" "Household Expenses")
      "| %^u | %^{Vendor} | %^{Description} | %^{Cost} |")
     ("P" "Project" entry
      (file+headline "~/org/projects.org" "Projects")
      "* %^{Description} :%^G:
  Added: %U
  Context: %a

** Why?

   %?

** Outcome

** Lead

** Stakeholders

** Tasks

  " :prepend t :empty-lines 1))))
 '(org-clock-persist 'history)
 '(org-clock-persist-file "~/.org-clock-save.el")
 '(org-complete-tags-always-offer-all-agenda-tags t)
 '(org-default-notes-file "~/org/notes.org")
 '(org-directory "~/org")
 '(org-export-latex-listings t)
 '(org-export-latex-packages-alist (quote (("" "listings") ("" "color"))))
 '(org-export-with-tags nil)
 '(org-fast-tag-selection-single-key t)
 '(org-latex-pdf-process
   (quote
    ("pdflatex -interaction nonstopmode -output-directory %o %f" "bibtex %b" "pdflatex -interaction nonstopmode -output-directory %o %f" "pdflatex -interaction nonstopmode -output-directory %o %f")))
 '(org-log-done (quote note))
 '(org-log-refile (quote time))
 '(org-mobile-directory "~/Dropbox/MobileOrg")
 '(org-mobile-files
   (quote
    (org-agenda-files "~/org/notes.org" "~/org/journal.org" "~/org/incubate.org" "~/org/ideas.org")))
 '(org-log-note-clock-out t)
 '(org-refile-targets (quote ((org-agenda-files :maxlevel . 2) ("~/org/incubate.org" :maxlevel . 1) ("~/org/ideas.org" :maxlevel . 1))))
 '(org-refile-use-outline-path t)
 '(org-src-fontify-natively t)
 '(org-stuck-projects
   (quote
    ("+LEVEL=2/-DONE"
     ("TODO" "NEXT" "STARTED" "WAITING")
     nil "")))
 '(org-tag-persistent-alist
   (quote
    (("HOME" . 104)
     ("OFFICE" . 111)
     ("ERRAND" . 101)
     ("PHONE" . 112)
     ("EMAIL" . 109)
     ("GGG" . 103)
     ("APPT" . 97))))
 '(org-todo-keywords
   (quote
    ((sequence "TODO" "NEXT(n!)" "STARTED(s!/@)" "DEFERRED(f!/@)" "DELEGATED(l@/@)" "WAITING(w@/@)" "|" "CANCELED(x@)" "DONE(d@)"))))
 )

(provide 'cmf-org-settings)

;;; cmf-org-settings.el ends here

Added emacs.d/snippets/org-mode/svnbp.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- mode: snippet -*-
# name: Boiler Plate for Org-mode files managed by subversion
# --
#+TITLE: $1
#+AUTHOR: `(user-full-name)`
#+EMAIL: `(format "%s" user-mail-address)`
#+OPTIONS: email:t
#
#+LATEX_HEADER: \usepackage[today,fancyhdr]{svninfo}
#+LATEX_HEADER: \pagestyle{fancyplain}
#+LATEX_HEADER: \usepackage{bookmark}
#+LATEX_HEADER: \hypersetup{urlcolor=blue}
#+LATEX_HEADER: \hypersetup{colorlinks,urlcolor=blue}
#+LATEX_HEADER: \usepackage[backend=bibtex]{biblatex}
#+LATEX_HEADER: \fancyhead[RE,LO]{\leftmark}
#+LATEX_HEADER: \fancyhead[LE,RO]{\thepage}
#+LATEX_HEADER: \svnInfo $Id$

#+LATEX: \thispagestyle{empty}

* Overview

  $0

Added emacs.d/snippets/php-mode/bp.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- mode: snippet -*-
# name: PHP File Boilerplate
# expand-env: ((yas/indent-line 'fixed))
#
# --
<?php

/*
 * `(file-name-nondirectory (buffer-file-name))`
 *
 * Copyright (c) `(format-time-string "%Y")` `(user-full-name)`
 * All rights reserved
 *
 * This program is free software; you can redistribute it and/or
 * modify it under terms of the Simplified BSD License (also
 * known as the "2-Clause License" or "FreeBSD License".)
 *
 * Created on `(current-time-string)` `(car (cdr (current-time-zone)))`
 */

$0

/* Ende */

Added emacs.d/thirdparty/GNUmakefile.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# emacs.d/thirdparty/GNUmakefile
#

RM_OPTS=$(shell if [ `uname` != "OpenBSD" ]; then echo '-vf'; else echo '-f'; fi)

clean: ${CLEANDIRS}
	@rm ${RM_OPTS} *~
	@rm ${RM_OPTS} *.bak
	@rm ${RM_OPTS} *-baseline
	@rm ${RM_OPTS} *-merge
	@rm ${RM_OPTS} *-original
	@rm ${RM_OPTS} *.elc

# Ende

Deleted emacs.d/thirdparty/setup-yasnippet.el.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;; setup-yasnippet.el --- Make autocomplete and yasnippet play nice 
;; ====================================================================
;;;
;; Copyright (c) 2014 Christopher M. Fuhrman
;; All rights reserved
;;
;; This program is free software; you can redistribute it and/or
;; modify it under terms of the Simplified BSD License (also
;; known as the "2-Clause License" or "FreeBSD License".)
;;
;; Created Thu Jul  3 13:31:46 2014 PDT
;;
;; ====================================================================

;;; Commentary:
;;
;; Describe Lisp File here
;;

;;; Code:

;; (require 'yasnippet)

;; Use only own snippets, do not use bundled ones
;; (setq yas-snippet-dirs '("~/.emacs.d/snippets"))
(yas-global-mode 1)

;; ;; Include snippets for stuff
;; (require 'buster-snippets)
;; (require 'angular-snippets)
;; (require 'datomic-snippets)

;; Jump to end of snippet definition
(define-key yas-keymap (kbd "<return>") 'yas-exit-all-snippets)

;; Inter-field navigation
(defun yas/goto-end-of-active-field ()
  (interactive)
  (let* ((snippet (car (yas--snippets-at-point)))
        (position (yas--field-end (yas--snippet-active-field snippet))))
    (if (= (point) position)
        (move-end-of-line 1)
      (goto-char position))))

(defun yas/goto-start-of-active-field ()
  (interactive)
  (let* ((snippet (car (yas--snippets-at-point)))
        (position (yas--field-start (yas--snippet-active-field snippet))))
    (if (= (point) position)
        (move-beginning-of-line 1)
      (goto-char position))))

;; fix some org-mode + yasnippet conflicts:
(defun yas/org-very-safe-expand ()
  (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))

(define-key yas-keymap (kbd "C-e") 'yas/goto-end-of-active-field)
(define-key yas-keymap (kbd "C-a") 'yas/goto-start-of-active-field)

;; ;; No dropdowns please, yas
;; (setq yas-prompt-functions '(yas/ido-prompt yas/completing-prompt))

;; ;; No need to be so verbose
;; (setq yas-verbosity 1)

;; Wrap around region
(setq yas-wrap-around-region t)

;; Update org-mode configuration
(add-hook 'org-mode-hook
          (lambda ()
            (make-variable-buffer-local 'yas/trigger-key)
            (setq yas/trigger-key [tab])
            (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
            (define-key yas/keymap [tab] 'yas/next-field)))

(provide 'setup-yasnippet)

;;; setup-yasnippet.el ends here
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































Changes to setup.sh.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
...
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
SHELLDIR=${HOME}/SHELL
BACKUPDIR=${HOME}/Backup/shell
HOMETMPDIR=${HOME}/tmp
RSYNC=rsync
RSYNC_EXCLUDE=global-excludes
RSYNC_OPTS="-Ccav --delete --exclude-from=${RSYNC_EXCLUDE}"
MAKE=make
COPYRIGHT='Copyright (c) 2000-2015 Christopher M. Fuhrman'
OUTPUTSPACING=55
DRYRUN=""
UNINSTALL=0
BUILD_EMACS_PACKAGES=0
EMACS_OUTPUT_LOG=${HOME}/tmp/emacs-pkg-install-$$-`date +%y%m%d`.log
NOLINK=0            # If set to 1 (true), then the following apply:
                    #   - Linked files will not be created
................................................................................
        WHITE=$(tput -T ${TERM} setaf 7)
        BOLD=$(tput -T ${TERM} bold)
        UNDERLINE=$(tput sgr 0 1)
        NORMAL=$(tput -T ${TERM} sgr0)
fi

# Dot-files to link
HOMEDOTFILES=('bash_logout'   \
              'bash_profile'  \
              'bashrc'        \
              'emacs.d'       \
              'gitconfig'     \
              'indent.pro'    \
              "mg"            \
              'perltidyrc'    \
              'tmux.conf'     \
              'screenrc'      \
              'Xresources')


# Use GNU Make if available, otherwise blindly assume that the system
# make is compatible.
makepaths=('/usr/pkg/bin/gmake'      \
           '/usr/local/bin/gmake'    \
           '/usr/bin/gnumake'        \
           '/opt/csw/bin/gmake'      \
           '/usr/sfw/bin/gmake'      \
           '/opt/freeware/bin/gmake' \
           '/usr/ccs/bin/make'       \
           '/opt/csw/bin/make'       \
           '/usr/bin/make')


for makeprog in ${makepaths[@]}; do
        if [ -e ${makeprog} ]; then
                MAKE=${makeprog}
                break
        fi
done
................................................................................

        cat 1>&2 <<STDERR
usage: ${0##*/} -h This screen                             \\
                -d (Default:\$HOME/SHELL) Target directory  \\
                -b (Default:\$HOME/Backup/shell) Location   \\
                   of backup files
                -n Do _not_ link files                     \\
                -p Automatically install emacs packages    \\
                -u Uninstall ShellPAK                      \\
                -r perform a trial run with no changes made
                   (implies -n)

STDERR

} # usage()


# --------------------------------------------------------------------

headerDisplay

args=$(getopt d:b:hpnru $*)

set -- $args

while [ $# -gt 0 ]
do

        case "$1" in
................................................................................
                ;;

        -n)
                NOLINK=1
                inform $L1 $TRUE "Shell-related files will ${UNDERLINE}not${NORMAL} be linked to \$HOME"
                ;;

        -p)
                BUILD_EMACS_PACKAGES=1
                inform $L1 $TRUE 'Emacs packages will automatically be installed'
                ;;

        -r)
                DRYRUN=' --dry-run '
                NOLINK=1
                inform $L1 $TRUE 'DRY-RUN: No changes will be propagated'
                ;;

        -b)
................................................................................
# Create ~/tmp directory if it doesn't exist
if [[ ${NOLINK} -ne 1 && ! -d ${HOMETMPDIR} ]]; then
        inform $L1 $FALSE "Creating ${HOMETMPDIR}"
        mkdir ${HOMETMPDIR}
        echo -e "${GREEN}done${NORMAL}"
fi

# Automatically build emacs packages
if [[ ${BUILD_EMACS_PACKAGES} -eq 1 ]]; then

        inform $L1 $FALSE 'Building Emacs Packages'

        if type emacs >/dev/null; then
                tmplog=$(mktemp /tmp/${0##*/}.XXXXXX) || exit 1
                ${MAKE} emacs-packages >${tmplog} 2>&1
                echo -e "${GREEN}done${NORMAL}"
                mv $tmplog $EMACS_OUTPUT_LOG
                inform $L2 $TRUE "Package log located at ${EMACS_OUTPUT_LOG}"
        else
                echo -e "${RED}failed${NORMAL}"
                inform $L2 $TRUE "Unable to locate emacs binary"
        fi
fi

# We're done
echo ''
echo "${BOLD}ShellPAK${NORMAL} setup complete on ${CYAN}${HOSTNAME}${NORMAL}!"

# Ende







|







 







|
|
|
|
|
|
|
|
|
|
|
|
>


|
|
|
|
|
|
|
|
|
>







 







<













|







 







<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<





33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
293
294
295
296
297
298
299

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
...
328
329
330
331
332
333
334





335
336
337
338
339
340
341
...
456
457
458
459
460
461
462

















463
464
465
466
467
SHELLDIR=${HOME}/SHELL
BACKUPDIR=${HOME}/Backup/shell
HOMETMPDIR=${HOME}/tmp
RSYNC=rsync
RSYNC_EXCLUDE=global-excludes
RSYNC_OPTS="-Ccav --delete --exclude-from=${RSYNC_EXCLUDE}"
MAKE=make
COPYRIGHT='Copyright (c) 2000-2016 Christopher M. Fuhrman'
OUTPUTSPACING=55
DRYRUN=""
UNINSTALL=0
BUILD_EMACS_PACKAGES=0
EMACS_OUTPUT_LOG=${HOME}/tmp/emacs-pkg-install-$$-`date +%y%m%d`.log
NOLINK=0            # If set to 1 (true), then the following apply:
                    #   - Linked files will not be created
................................................................................
        WHITE=$(tput -T ${TERM} setaf 7)
        BOLD=$(tput -T ${TERM} bold)
        UNDERLINE=$(tput sgr 0 1)
        NORMAL=$(tput -T ${TERM} sgr0)
fi

# Dot-files to link
HOMEDOTFILES=('bash_logout'                     \
              'bash_profile'                    \
              'bashrc'                          \
              'emacs.d'                         \
              'gitconfig'                       \
              'indent.pro'                      \
              "mg"                              \
              'perltidyrc'                      \
              'tmux.conf'                       \
              'screenrc'                        \
              'Xresources'
             )

# Use GNU Make if available, otherwise blindly assume that the system
# make is compatible.
makepaths=('/usr/pkg/bin/gmake'                 \
           '/usr/local/bin/gmake'               \
           '/usr/bin/gnumake'                   \
           '/opt/csw/bin/gmake'                 \
           '/usr/sfw/bin/gmake'                 \
           '/opt/freeware/bin/gmake'            \
           '/usr/ccs/bin/make'                  \
           '/opt/csw/bin/make'                  \
           '/usr/bin/make'
          )

for makeprog in ${makepaths[@]}; do
        if [ -e ${makeprog} ]; then
                MAKE=${makeprog}
                break
        fi
done
................................................................................

        cat 1>&2 <<STDERR
usage: ${0##*/} -h This screen                             \\
                -d (Default:\$HOME/SHELL) Target directory  \\
                -b (Default:\$HOME/Backup/shell) Location   \\
                   of backup files
                -n Do _not_ link files                     \\

                -u Uninstall ShellPAK                      \\
                -r perform a trial run with no changes made
                   (implies -n)

STDERR

} # usage()


# --------------------------------------------------------------------

headerDisplay

args=$(getopt d:b:hnru $*)

set -- $args

while [ $# -gt 0 ]
do

        case "$1" in
................................................................................
                ;;

        -n)
                NOLINK=1
                inform $L1 $TRUE "Shell-related files will ${UNDERLINE}not${NORMAL} be linked to \$HOME"
                ;;






        -r)
                DRYRUN=' --dry-run '
                NOLINK=1
                inform $L1 $TRUE 'DRY-RUN: No changes will be propagated'
                ;;

        -b)
................................................................................
# Create ~/tmp directory if it doesn't exist
if [[ ${NOLINK} -ne 1 && ! -d ${HOMETMPDIR} ]]; then
        inform $L1 $FALSE "Creating ${HOMETMPDIR}"
        mkdir ${HOMETMPDIR}
        echo -e "${GREEN}done${NORMAL}"
fi


















# We're done
echo ''
echo "${BOLD}ShellPAK${NORMAL} setup complete on ${CYAN}${HOSTNAME}${NORMAL}!"

# Ende