Check-in [a690e0857b]

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

Overview
SHA1:a690e0857baf51c9a3286de6360f1bb0d6807c73
Date: 2018-08-06 21:46:28
User: cfuhrman
Comment:Import latest changes from personal repo (GNUMakefile) - Set rsync(1) timeout to 30 seconds (bash_darwin) - Switch /usr/pkg to /opt/pkg to make installation easier (bashrc) - Make sure /opt/pkg/bin is before /usr/bin on MacOSX. Also, there is no need to have /opt/schily/bin twice in our path - Use an alias instead of GREP_OPTIONS as GREP_OPTIONS is now deprecated[1] (docs/README.org) - Note ShellPAK now support customization of GNU nano(1) editor - Update supported operating systems - It's OpenSUSE, not OpenSuSE - Add instructions for setting up pythong (emacs.d/init.el) - Add /opt/pkg/bin to cmf-path-list - Customize use-fancy-splash-screens-p for emacs version 24.5 (inclusive )-> 25.2.1 (exclusive) - Alignment fixes - Only customize height for when running Emacs under X-Windows - Add hooks via :hook declaration - Remove ac-ispell as it was causing too many issues to be useful - Remove popwin package as it was causing too many issues - Only install ace-window for emacs 24.4 and greater - Only install all-the-icons for emacs 24.4 and greater - Remove diff-mode customizations which were for popwin - Further customize flycheck - Only install gited for emacs 24.4 and greater - Bind gited-list-branches to C-c C-g - Swiper customizations for Emacs 26 - Install and configure markdown-mode - Install and configure org-fancy-priorities - Enable line up of cascading calls when editing PHP files - Set up Python development in Emacs - Add remote-url to VC-Fossil header - which-key requires Emacs 24.4 and greater - Customize org-crypt (emacs.d/shippets/sh-mode/bp) - Align copyright information (global-excludes) - Exclude the following from getting hosed: + .aggrev_defs + .python-environments + tramp (setup.sh) - Add support for customizing python environment (thirdparty/git-completion.bash, thirdparty/git-prompt) - Import git completion and prompt scripts from git v2.15.1 Footnotes: [1] https://www.gnu.org/software/grep/manual/grep.html#index-GREP_005fOPTIONS-environment-variable
Tags And Properties
Context
2018-08-06
21:46
[a690e0857b] Leaf: Import latest changes from personal repo (GNUMakefile) - Set rsync(1) timeout to 30 seconds (bash_darwin) - Switch /usr/pkg to /opt/pkg to make installation easier (bashrc) - Make sure /opt/pkg/bin is before /usr/bin on MacOSX. Also, there is no need to have /opt/schily/bin twice in our path - Use an alias instead of GREP_OPTIONS as GREP_OPTIONS is now deprecated[1] (docs/README.org) - Note ShellPAK now support customization of GNU nano(1) editor - Update supported operating systems - It's OpenSUSE, not OpenSuSE - Add instructions for setting up pythong (emacs.d/init.el) - Add /opt/pkg/bin to cmf-path-list - Customize use-fancy-splash-screens-p for emacs version 24.5 (inclusive )-> 25.2.1 (exclusive) - Alignment fixes - Only customize height for when running Emacs under X-Windows - Add hooks via :hook declaration - Remove ac-ispell as it was causing too many issues to be useful - Remove popwin package as it was causing too many issues - Only install ace-window for emacs 24.4 and greater - Only install all-the-icons for emacs 24.4 and greater - Remove diff-mode customizations which were for popwin - Further customize flycheck - Only install gited for emacs 24.4 and greater - Bind gited-list-branches to C-c C-g - Swiper customizations for Emacs 26 - Install and configure markdown-mode - Install and configure org-fancy-priorities - Enable line up of cascading calls when editing PHP files - Set up Python development in Emacs - Add remote-url to VC-Fossil header - which-key requires Emacs 24.4 and greater - Customize org-crypt (emacs.d/shippets/sh-mode/bp) - Align copyright information (global-excludes) - Exclude the following from getting hosed: + .aggrev_defs + .python-environments + tramp (setup.sh) - Add support for customizing python environment (thirdparty/git-completion.bash, thirdparty/git-prompt) - Import git completion and prompt scripts from git v2.15.1 Footnotes: [1] https://www.gnu.org/software/grep/manual/grep.html#index-GREP_005fOPTIONS-environment-variable (user: cfuhrman, tags: trunk, v2018.08)
2018-02-10
23:48
[392bdcb90e] Further customizations of emacs environment (docs/README.org) - Bump copyright - Update list of supported operating systems (emacs.d/init.el) - Install and configure the following packages: + popwin[1] + calfw[2] + geben[3] + go-mode[4] and related packages - Pin the following packages to melpa-stable + all-the-icons + all-the-icons-ivy - Break out all-the-icons-dired and all-the-icons-ivy to their separate use-package blocks - Switch to using php-doc.el for automatically generating PHP documentation blocks (emacs-d/cmf-org-settings.el) - Add journal tag to all journal entries (setup.sh) - Install gocode and gotags to use with go-mode Footnotes: [1] https://github.com/m2ym/popwin-el [2] https://github.com/m2ym/popwin-el [3] https://github.com/ahungry/geben [4] https://github.com/dominikh/go-mode.el (user: cfuhrman, tags: trunk, v2018.02.11)
Changes

Changes to GNUmakefile.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FOSSIL_REPO=${HOME}/repos/public.fossil
CKOUT_DATE=$(shell fossil info | grep "^checkout" | awk '{ print $$3 }' | sed 's/[-: ]//g')
DISTFILE=shellpak-${FOSSIL_BRANCH}-${CKOUT_DATE}.tar.gz

# Command options
RSYNC_BIN=rsync
RSYNC_EXCLUDE=global-excludes
RSYNC_OPTS=-Ccavz --exclude='svn-commit*' --exclude='.AppleDouble' --exclude='*~' --exclude-from=${RSYNC_EXCLUDE} --delete
RSYNC_CONN_OPTS=-e ssh
RSYNC_PUBLIC_OPTS=-Ccavz --exclude=GPATH --exclude=GRTAGS --exclude=GTAGS --exclude=docs/*.txt \
  --exclude=.fslckout --exclude=config --exclude=ext --exclude='.AppleDouble' --exclude='*~' \
  --exclude=_FOSSIL_ --exclude=VERSION --delete
SETUP_BIN=${PWD}/setup.sh

SSH=ssh







|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FOSSIL_REPO=${HOME}/repos/public.fossil
CKOUT_DATE=$(shell fossil info | grep "^checkout" | awk '{ print $$3 }' | sed 's/[-: ]//g')
DISTFILE=shellpak-${FOSSIL_BRANCH}-${CKOUT_DATE}.tar.gz

# Command options
RSYNC_BIN=rsync
RSYNC_EXCLUDE=global-excludes
RSYNC_OPTS=-Ccavz --exclude='svn-commit*' --exclude='.AppleDouble' --exclude='*~' --exclude='.DS_Store' --exclude-from=${RSYNC_EXCLUDE} --delete --timeout=30
RSYNC_CONN_OPTS=-e ssh
RSYNC_PUBLIC_OPTS=-Ccavz --exclude=GPATH --exclude=GRTAGS --exclude=GTAGS --exclude=docs/*.txt \
  --exclude=.fslckout --exclude=config --exclude=ext --exclude='.AppleDouble' --exclude='*~' \
  --exclude=_FOSSIL_ --exclude=VERSION --delete
SETUP_BIN=${PWD}/setup.sh

SSH=ssh

Changes to README.md.

31
32
33
34
35
36
37

38
39
40
41
42
43
44
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
...
115
116
117
118
119
120
121






122
123
124
125
126
127
128

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
................................................................................
-   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.8
-   CentOS 6.5
-   Debian 9 (Stretch) 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:

................................................................................
    
    # Do not automatically link files during installation
    $ ./setup.sh -n
    
    # Set up go programming environment
    $ ./setup.sh -g
    






    # Remove ShellPAK
    $ ./setup.sh -u
    
    # Remove ShellPAK & go environment
    $ ./setup.sh -u -g
    
    # Change backup directory







>







 







|







|







 







>
>
>
>
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

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 Nano](https://www.nano-editor.org/)
-   [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
................................................................................
-   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.13 (Darwin)
-   NetBSD 6.1.x
-   OpenBSD 5.8
-   CentOS 6.5
-   Debian 9 (Stretch) 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:

................................................................................
    
    # Do not automatically link files during installation
    $ ./setup.sh -n
    
    # Set up go programming environment
    $ ./setup.sh -g
    
    # Set up python development environment
    $ ./setup.sh -p
    
    # Set up python3 development environment
    $ PYTHON_VERSION=3 PIP_BIN=pip3 setup.sh -p
    
    # Remove ShellPAK
    $ ./setup.sh -u
    
    # Remove ShellPAK & go environment
    $ ./setup.sh -u -g
    
    # Change backup directory

Changes to bash_darwin.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
37
38
39
40
41
42
43





44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# 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"
)

# Pre-pend additional directories if required
for path in ${paths[@]}; do
................................................................................
        fi

done

# Get rid of pre-pended ':' and double colons
PATH=${PATH#:}
PATH=${PATH//::/:}






# Place /usr/local/bin first if Homebrew is present
if [ -d /usr/local/Cellar ]; then
        PATH=/usr/local/bin:${PATH//\/usr\/local\/bin\:/}
fi

# Set MANPATH
MANPATH=/opt/local/man:/opt/local/share/man:$MANPATH:/usr/share/man:/usr/local/git/share/man:~/perl5/man

# Enable LS Colors
CLICOLOR=1
LSCOLORS=Exfxcxdxbxegedhbagacad

export PATH MANPATH CLICOLOR LSCOLORS








|
|

|







 







>
>
>
>
>







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
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
#
# Sets up system environment for Mac OS X Darwin
#

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

# Pre-pend additional directories if required
for path in ${paths[@]}; do
................................................................................
        fi

done

# Get rid of pre-pended ':' and double colons
PATH=${PATH#:}
PATH=${PATH//::/:}

# Place /opt/pkg/bin first if pkgsrc is present
if [ -d /opt/pkg/bin ]; then
	PATH=/opt/pkg/bin:${PATH//\/opt\/pkg\/bin\:/}
fi

# Place /usr/local/bin first if Homebrew is present
if [ -d /usr/local/Cellar ]; then
        PATH=/usr/local/bin:${PATH//\/usr\/local\/bin\:/}
fi

# Set MANPATH
MANPATH=/opt/local/man:/opt/local/share/man:$MANPATH:/usr/share/man:/usr/local/git/share/man:~/perl5/man:/opt/pkg/man

# Enable LS Colors
CLICOLOR=1
LSCOLORS=Exfxcxdxbxegedhbagacad

export PATH MANPATH CLICOLOR LSCOLORS

Changes to bashrc.

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
...
337
338
339
340
341
342
343



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

done

# Note we want to append /opt/schily/bin since sometimes that contains a version
# of tar that doesn't support the -z option
if [ -d /opt/schily/bin ]; then
	PATH=$PATH:/opt/schily/bin
fi

# Get rid of pre-pended ':' and double colons
PATH=${PATH#:}
PATH=${PATH//::/:}

# Set default for YASTISBROKEN
YASTISBROKEN=0

................................................................................
# Operating system PKILL command
PKILL='pkill'

# Set default for awk
AWK=awk

# Make grep(1) output pretty on systems that support color
export GREP_OPTIONS='--color=auto'

# Set up GOPATH
if type -p go >/dev/null; then
        export GOPATH=${HOME}/go

        if [ -d ${GOPATH}/bin ]; then
                echo $PATH | egrep '(^|\:)'${GOPATH}'/bin(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${GOPATH}/bin
................................................................................
if type -p phpcs >/dev/null; then
	alias phpcs='phpcs --standard=PSR2'
fi

if type -p phpcbf >/dev/null; then
	alias phpcbf='phpcbf --standard=PSR2'
fi




# Program defaults
# --------------------------------------------------------------------

# Determine browser
__sp_bashrc_set_browser








<
<
<
<
<
<







 







|







 







>
>
>







216
217
218
219
220
221
222






223
224
225
226
227
228
229
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
        # Determine if this directory is already in $PATH
        if [ -d $path ]; then
                echo $PATH | egrep '(^|\:)'${path}'(\:|$)' >/dev/null 2>&1 || PATH=${path}:$PATH
        fi

done







# Get rid of pre-pended ':' and double colons
PATH=${PATH#:}
PATH=${PATH//::/:}

# Set default for YASTISBROKEN
YASTISBROKEN=0

................................................................................
# Operating system PKILL command
PKILL='pkill'

# Set default for awk
AWK=awk

# Make grep(1) output pretty on systems that support color
export CMF_GREP_OPTIONS='--color=auto'

# Set up GOPATH
if type -p go >/dev/null; then
        export GOPATH=${HOME}/go

        if [ -d ${GOPATH}/bin ]; then
                echo $PATH | egrep '(^|\:)'${GOPATH}'/bin(\:|$)' >/dev/null 2>&1 || PATH=$PATH:${GOPATH}/bin
................................................................................
if type -p phpcs >/dev/null; then
	alias phpcs='phpcs --standard=PSR2'
fi

if type -p phpcbf >/dev/null; then
	alias phpcbf='phpcbf --standard=PSR2'
fi

# GREP_OPTIONS is deprecated, so here is a work-around
alias grep="grep ${CMF_GREP_OPTIONS}"

# Program defaults
# --------------------------------------------------------------------

# Determine browser
__sp_bashrc_set_browser

Changes to docs/README.org.

12
13
14
15
16
17
18

19
20
21
22
23
24
25
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
101
102
103
104
105
106
107






108
109
110
111
112
113
114

  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
................................................................................
    - 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.8
    - CentOS 6.5
    - Debian 9 (Stretch) 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:

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

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

   # Set up go programming environment
   $ ./setup.sh -g







   # Remove ShellPAK
   $ ./setup.sh -u

   # Remove ShellPAK & go environment
   $ ./setup.sh -u -g

   # Change backup directory







>







 







|







|







 







>
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

  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]]
   - [[https://www.nano-editor.org/][GNU Nano]]
   - [[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
................................................................................
    - GNU Make
    - rsync

** Supported Platforms

   The following operating systems are known to be supported:

    - Mac OS X 10.13 (Darwin)
    - NetBSD 6.1.x
    - OpenBSD 5.8
    - CentOS 6.5
    - Debian 9 (Stretch) 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:

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

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

   # Set up go programming environment
   $ ./setup.sh -g

   # Set up python development environment
   $ ./setup.sh -p

   # Set up python3 development environment
   $ PYTHON_VERSION=3 PIP_BIN=pip3 setup.sh -p

   # Remove ShellPAK
   $ ./setup.sh -u

   # Remove ShellPAK & go environment
   $ ./setup.sh -u -g

   # Change backup directory

Changes to emacs.d/init.el.

45
46
47
48
49
50
51

52
53
54
55
56
57
58
...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
...
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
...
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
...
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
...
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
...
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
...
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
...
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
...
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
...
849
850
851
852
853
854
855


856
857
858

859



860













861
862
863
864
865
866
867
...
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
...
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
...
930
931
932
933
934
935
936























































































937
938
939
940
941
942
943
...
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
....
1000
1001
1002
1003
1004
1005
1006


1007
1008
1009
1010
1011
1012
1013
1014
1015
....
1044
1045
1046
1047
1048
1049
1050



1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061


1062
1063
1064
1065
1066
1067

1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
....
1085
1086
1087
1088
1089
1090
1091
1092

1093
1094
1095
1096
1097
1098
1099
1100
(defvar cmf-custom "~/.emacs.d/custom.el")
(defvar cmf-custom-16 "~/.emacs.d/custom-nox.el")
(defvar cmf-custom-256 "~/.emacs.d/custom-nox256.el")

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

                        "/usr/local/bin"
                        "~/.composer/vendor/bin"
                        "~/go/bin"
                        "/Library/TeX/texbin"))

;; Customize generic variables
(custom-set-variables
................................................................................
  "Add given PATHLIST to 'exec-path'."
  (dolist (path pathlist)
    (add-to-list 'exec-path path)
    (setenv "PATH" (concat (getenv "PATH") ":" path)))
  )

;; Override stock use-fancy-splash-screens-p ()
(if (version< emacs-version "25.2.1")
    (defun use-fancy-splash-screens-p ()
      "Return t if fancy splash screens should be used."
      (when (and (display-graphic-p)
                 (or (and (display-color-p)
                          (image-type-available-p 'xpm))
                     (image-type-available-p 'pbm)))
        (let ((frame (fancy-splash-frame)))
................................................................................
;; Macros
;; --------------------------------------------------------------------

(fset 'yes-or-no-p
      'y-or-n-p)

(fset 'align-on-equal
   [?\M-x ?a ?l ?i ?g ?n ?- ?r ?e ?g tab return ?= return])

(fset 'align-on-hash-arrow
   [?\M-x ?a ?l ?i ?g ?n ?- ?r ?e ?g tab return ?= ?> return])


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

;; Custom key bindings for commonly used commands
(global-set-key [?\C-x ?\C-k ?0] 'normal-erase-is-backspace-mode)
................................................................................
(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))

................................................................................
  (if (not (file-exists-p trash-directory))
      (make-directory trash-directory))

  ;; osx-location
  (use-package osx-location
    :ensure t

    :init
    (add-hook 'osx-location-changed-hook
              (lambda ()
                (setq calendar-latitude osx-location-latitude
                      calendar-longitude osx-location-longitude
                      calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)
                      forecast-latitude osx-location-latitude
                      forecast-longitude osx-location-longitude
                      forecast-city (format "%s, %s" osx-location-latitude osx-location-longitude)
                      )
                )
              )

    :config
    (osx-location-watch)

    )
  )

................................................................................
;;
;; For use on all operating systems
;;

;; auto-complete
(use-package auto-complete
  :ensure t
  :ensure ac-ispell
  :ensure fuzzy

  :pin melpa-stable

  :demand

  :bind (:map ac-complete-mode-map
              ("\C-n" . ac-next)
              ("\C-p" . ac-previous)
	      )

  :init
  (add-hook 'text-mode-hook 'ac-ispell-ac-setup)
  (add-hook 'log-mode-hook  'ac-ispell-ac-setup)

  :config
  (ac-config-default)
  (ac-ispell-setup)
  (setq ac-fuzzy-enable 1 )

  :custom
  (ac-dwim t)
  )

;; yasnippet
................................................................................
  :init
  (yas-global-mode 1)

  :custom
  (yas-wrap-around-region t)
  )

;; popwin
(use-package popwin
  :ensure t

  :config
  (setq display-buffer-function 'popwin:display-buffer)

  :custom
  (popwin-mode t)
  )

;; ace-window

(use-package ace-window
  :ensure t
  :pin melpa-stable

  :config
  (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))

  :bind (
         ("C-x o" . ace-window))
  )


;; all-the-icons


(use-package all-the-icons
  :if window-system
  :ensure t
  :pin melpa-stable

  :config

  ;; Install the font files only if we have not already done so
  (defvar cmf-fonts-installed-file "~/SHELL/emacs.d/.icon-fonts-installed")
  (unless (file-exists-p cmf-fonts-installed-file)
    (progn
      (message "Installing icon fonts")
      (all-the-icons-install-fonts t)
      (with-temp-buffer (write-file cmf-fonts-installed-file)))
    )
  )

;; all-the-icons-dired
(use-package all-the-icons-dired
  :if window-system
  :ensure t
  :after all-the-icons

  :config
  (defun nice-all-the-icons-dired-hook ()
    "Hook for disabling font-lock-mode for dired buffers w/ all-the-icons"

    (font-lock-mode 0)
    )

  (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
  (add-hook 'dired-mode-hook 'nice-all-the-icons-dired-hook)
  )

(use-package all-the-icons-ivy
  :if window-system
  :ensure t
  :after all-the-icons
  :pin melpa-stable

  :config
  (all-the-icons-ivy-setup)

  )

;; 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))

  :init
  (add-hook 'apache-mode-hook 'nice-prog-hook)
  )

;; arjen-grey-theme
(use-package arjen-grey-theme
  :ensure t
  :if window-system

................................................................................
  :ensure t
  :no-require t

  :mode (("\\.cron\\(tab\\)?\\'" . crontab-mode)
         ("cron\\(tab\\)?\\."    . crontab-mode))
  )

;; diff-mode
(use-package diff
  :config
  (push '("[Dd]iff"
	  :regexp   t
	  :noselect t
	  :position right
	  :width    0.40)
	popwin:special-display-config)
  )

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

;; emojify
(use-package emojify
................................................................................
(use-package flycheck
  :ensure t

  :init
  (global-flycheck-mode)

  :custom

  (flycheck-disabled-checkers (quote (php-phpcs go-build)))
  (flycheck-highlighting-mode 'lines)

  (flycheck-phpcs-standard "PSR2")
  )

;; flyspell
(use-package flyspell
  :ensure t
  :ensure flyspell-correct-ivy

  :bind (:map flyspell-mode-map
	      ("C-c ;" . flyspell-correct-previous-word-generic))

  :init
  (require 'flyspell-correct-ivy)
  (add-hook 'prog-mode-hook 'flyspell-prog-mode)
  (add-hook 'text-mode-hook 'flyspell-mode)

  :config
  (setq-default ispell-program-name "aspell")
  (ac-flyspell-workaround)
  )

;; forecast
................................................................................
(use-package geben
  :ensure t
  :pin melpa-stable
  :no-require t
  )

;; gited - dired for git branches


(use-package gited
  :ensure t
  :no-require t

  :bind (
         ("C-x C-g" . gited-list-branches)
         )


  )

;; ggtags
(use-package ggtags
  :ensure t

  :diminish ggtags-mode " 🄶"

  :init
  (add-hook 'prog-mode-hook
            (lambda ()
              (ggtags-mode t)))

  )

;; go-mode
(use-package go-mode
  :ensure t
  :ensure go-autocomplete
  :ensure go-direx
................................................................................
  :no-require t

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

  :bind (:map go-mode-map
	      ("C-c C-j" . go-direx-pop-to-buffer))



  :init
  (add-hook 'go-mode-hook 'nice-prog-hook)
  (add-hook 'go-mode-hook 'go-eldoc-setup)
  (add-hook 'go-mode-hook (lambda () (subword-mode 1)))

  :config
  (push '("^\*go-direx:"
	  :regexp    t
	  :position  left
	  :width     0.2
	  :dedicated t
	  :stick     t)
	popwin:special-display-config)
  )

;; highlight-parentheses
(use-package highlight-parentheses
  :ensure t
  :diminish highlight-parentheses-mode

................................................................................
  :init
  (ivy-mode 1)

  :custom
  (ivy-use-virtual-buffers t)
  (ivy-height 10)
  (ivy-count-format "(%d/%d) ")



  )

;; jinja2-mode
(use-package jinja2-mode
  :ensure t
  :defer t
  :mode ("\\.j2\\'" . jinja2-mode)
................................................................................

  )

;; json-mode
(use-package json-mode
  :ensure t

  :init
  ;; Associated JSON files with nice-prog-hook
  (add-hook 'json-mode-hook 'nice-prog-hook)
  )

;; log-edit-mode
(use-package log-edit
  :mode (
         ("COMMIT.*"   . log-edit-mode)
         ("ci-comment" . log-edit-mode)
         ("bzr_log\\." . log-edit-mode)
         ("pico\\."    . log-edit-mode)
         )

  :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)
  )















;; nxml-mode
(use-package nxml-mode
  :ensure auto-complete-nxml

  :mode (("\\.xsd\\'"  . xml-mode)
         ("\\.wsdl\\'" . xml-mode))
................................................................................
  :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














  ;; Org-mode settings are kept in a different file
  (require 'cmf-org-settings)
  ;; 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)
................................................................................
        (require 'ox-md))
    )

  ;; 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 (lambda () (org-bullets-mode 1)))
  )

;; org-gcal
;;
;; LATER: When org-gcal is compliant with version 8.2.10 (Default
................................................................................
  :bind (:map php-mode-map
	      ("C-c C--" . php-current-class)
	      ("C-c C-=" . php-current-namespace)
	      ("C-c C-y" . 'yas/create-php-snippet)
	      ("C-x p"   . php-insert-doc-block)
	      )



  :init
  (require 'php-doc)
  (require 'php-ext)
  (add-hook 'php-mode-hook 'nice-prog-hook)
  (add-hook 'php-mode-hook (lambda () (subword-mode 1)))

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

  :custom
  (php-mode-coding-style (quote psr2))
  ;; (php-lineup-cascaded-calls t)
  (phpcbf-standard "PSR2")
  )

;; pretty-lambdada
(if (version< emacs-version "24.4")
    (use-package pretty-lambdada
      :ensure t
................................................................................

      :config
      (pretty-lambda-for-modes)
      )
  ;; Otherwise use built-in prettify mode
  (global-prettify-symbols-mode t)
  )
























































































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

................................................................................
  )

;; sql
(use-package sql
  :mode (
         ("sql*" . sql-mode))

  :init
  (add-hook 'sql-mode-hook 'nice-prog-hook)
  )

;; sudo-edit
(use-package sudo-edit
  :ensure t
  :no-require t
  )
................................................................................
  )

;; twittering-mode
(use-package twittering-mode
  :ensure t
  :no-require t



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

  :config
  (unless (equal window-system nil)
    (setq twittering-icon-mode t)
    )

  :custom
................................................................................
(use-package vc-fossil
  :ensure t
  :init
  (require 'vc-fossil)

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



  )

;; which-func
(use-package which-func
  :no-require t

  :custom
  (which-function-mode t)
  )

;; which-key


(use-package which-key
  :ensure t
  :pin melpa-stable

  :config
  (which-key-mode)

  )

;; with-editor
(use-package with-editor
  :no-require t

  :init
  (add-hook 'with-editor-mode-hook 'nice-text-hook)
  (add-hook 'with-editor-mode-hook 'turn-on-orgstruct++)
  )

;; xkcd
(use-package xkcd
  :ensure t
  :if window-system
  :no-require t
................................................................................

;; yaml-mode
(use-package yaml-mode
  :ensure t
  :no-require t

  :mode ("\\.sls\\'" . yaml-mode)
  :init

  (add-hook 'yaml-mode-hook 'prog-mode-hook)
  )

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

;; Diminished modes that we have to put here as :diminish doesn't seem
;; to want to work :/







>







 







|







 







|


|







 







<
<
<
<
|
<







 







|
|
|
|
|
|
|
|
|
|
<
<







 







<











<
<
<
<


<







 







<
<
<
<
<
<
<
<
<
<
<

>
|
|
|

|
|

|
|
|
|
>

>
>
|
|
|
|

|

|
|
|
|
|
|
|
|
|

|
|
|
|
|

<
<
<
>
|
|
<
|
<
|

|
|
|
|
|

|
|
>













<
|







 







<
<
<
<
<
<
<
<
<
<
<







 







>
|

>






<




<
<
|
|







 







>
>
|
|
|

|
|
|

>








<
<
<
|
>







 







>
>

<
<

<
<
<
<
<
<
<
<
<







 







>
>
>







 







<
<
|











|
|
|



|
|












>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>



>

>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>







 







<







 







>
>



<







|
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
|







 







>
>
|
|







 







>
>
>











>
>
|
|
|

|
|
>






|
<
|







 







<
>
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
...
249
250
251
252
253
254
255




256

257
258
259
260
261
262
263
...
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330


331
332
333
334
335
336
337
...
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
...
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
...
551
552
553
554
555
556
557











558
559
560
561
562
563
564
...
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
...
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
...
664
665
666
667
668
669
670
671
672
673


674









675
676
677
678
679
680
681
...
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
...
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
...
861
862
863
864
865
866
867

868
869
870
871
872
873
874
...
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
...
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
....
1052
1053
1054
1055
1056
1057
1058

1059
1060
1061
1062
1063
1064
1065
1066
....
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
....
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159

1160
1161
1162
1163
1164
1165
1166
1167
....
1169
1170
1171
1172
1173
1174
1175

1176
1177
1178
1179
1180
1181
1182
1183
1184
(defvar cmf-custom "~/.emacs.d/custom.el")
(defvar cmf-custom-16 "~/.emacs.d/custom-nox.el")
(defvar cmf-custom-256 "~/.emacs.d/custom-nox256.el")

;; List of paths to search
(defvar cmf-path-list '("/usr/texbin"
                        "/usr/pkg/bin"
			"/opt/pkg/bin"
                        "/usr/local/bin"
                        "~/.composer/vendor/bin"
                        "~/go/bin"
                        "/Library/TeX/texbin"))

;; Customize generic variables
(custom-set-variables
................................................................................
  "Add given PATHLIST to 'exec-path'."
  (dolist (path pathlist)
    (add-to-list 'exec-path path)
    (setenv "PATH" (concat (getenv "PATH") ":" path)))
  )

;; Override stock use-fancy-splash-screens-p ()
(if (and (version< emacs-version "25.2.1") (not(version< emacs-version "24.5")))
    (defun use-fancy-splash-screens-p ()
      "Return t if fancy splash screens should be used."
      (when (and (display-graphic-p)
                 (or (and (display-color-p)
                          (image-type-available-p 'xpm))
                     (image-type-available-p 'pbm)))
        (let ((frame (fancy-splash-frame)))
................................................................................
;; Macros
;; --------------------------------------------------------------------

(fset 'yes-or-no-p
      'y-or-n-p)

(fset 'align-on-equal
      [?\M-x ?a ?l ?i ?g ?n ?- ?r ?e ?g tab return ?= return])

(fset 'align-on-hash-arrow
      [?\M-x ?a ?l ?i ?g ?n ?- ?r ?e ?g tab return ?= ?> return])


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

;; Custom key bindings for commonly used commands
(global-set-key [?\C-x ?\C-k ?0] 'normal-erase-is-backspace-mode)
................................................................................
(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




                        :height   100))


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

................................................................................
  (if (not (file-exists-p trash-directory))
      (make-directory trash-directory))

  ;; osx-location
  (use-package osx-location
    :ensure t

    :hook
    (osx-location-changed .
			  (lambda ()
			    (setq calendar-latitude osx-location-latitude
				  calendar-longitude osx-location-longitude
				  calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)
				  forecast-latitude osx-location-latitude
				  forecast-longitude osx-location-longitude
				  forecast-city (format "%s, %s" osx-location-latitude osx-location-longitude)))
			  )



    :config
    (osx-location-watch)

    )
  )

................................................................................
;;
;; For use on all operating systems
;;

;; auto-complete
(use-package auto-complete
  :ensure t

  :ensure fuzzy

  :pin melpa-stable

  :demand

  :bind (:map ac-complete-mode-map
              ("\C-n" . ac-next)
              ("\C-p" . ac-previous)
	      )





  :config
  (ac-config-default)

  (setq ac-fuzzy-enable 1 )

  :custom
  (ac-dwim t)
  )

;; yasnippet
................................................................................
  :init
  (yas-global-mode 1)

  :custom
  (yas-wrap-around-region t)
  )












;; ace-window
(if (not(version< emacs-version "24.4"))
  (use-package ace-window
    :ensure t
    :pin melpa-stable

    :config
    (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))

    :bind (
	   ("C-x o" . ace-window))
    )
  )

;; all-the-icons
(if (version< emacs-version "24.4")
    (message "All-the-icons requires Emacs version 24.4 or later.  Unable to install")
  (use-package all-the-icons
    :if window-system
    :ensure t
    :pin melpa-stable

    :config

    ;; Install the font files only if we have not already done so
    (defvar cmf-fonts-installed-file "~/SHELL/emacs.d/.icon-fonts-installed")
    (unless (file-exists-p cmf-fonts-installed-file)
      (progn
	(message "Installing icon fonts")
	(all-the-icons-install-fonts t)
	(with-temp-buffer (write-file cmf-fonts-installed-file)))
      )
    )

  ;; all-the-icons-dired
  (use-package all-the-icons-dired
    :if window-system
    :ensure t
    :after all-the-icons




    :init
    (require 'font-lock+)


    :hook (dired-mode . all-the-icons-dired-mode)

    )

  (use-package all-the-icons-ivy
    :if window-system
    :ensure t
    :after all-the-icons
    :pin melpa-stable

    :config
    (all-the-icons-ivy-setup)
    )
  )

;; 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))


  :hook (apache-mode . nice-prog-hook)
  )

;; arjen-grey-theme
(use-package arjen-grey-theme
  :ensure t
  :if window-system

................................................................................
  :ensure t
  :no-require t

  :mode (("\\.cron\\(tab\\)?\\'" . crontab-mode)
         ("cron\\(tab\\)?\\."    . crontab-mode))
  )












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

;; emojify
(use-package emojify
................................................................................
(use-package flycheck
  :ensure t

  :init
  (global-flycheck-mode)

  :custom
  (flycheck-check-syntax-automatically (quote (idle-change)))
  (flycheck-disabled-checkers (quote (php-phpcs go-build python-flake8 python-pylint)))
  (flycheck-highlighting-mode 'lines)
  (flycheck-idle-change-delay 1.5)
  (flycheck-phpcs-standard "PSR2")
  )

;; flyspell
(use-package flyspell
  :ensure t


  :bind (:map flyspell-mode-map
	      ("C-c ;" . flyspell-correct-previous-word-generic))



  :hook ((prog-mode . flyspell-prog-mode)
	 (text-mode . flyspell-mode))

  :config
  (setq-default ispell-program-name "aspell")
  (ac-flyspell-workaround)
  )

;; forecast
................................................................................
(use-package geben
  :ensure t
  :pin melpa-stable
  :no-require t
  )

;; gited - dired for git branches
(if (version< emacs-version "24.4")
    (message "Gited requires Emacs version 24.4 or greater.  Unable to install")
  (use-package gited
    :ensure t
    :no-require t

    :bind (
	   ("C-c C-g" . gited-list-branches)
	   )

    )
  )

;; ggtags
(use-package ggtags
  :ensure t

  :diminish ggtags-mode " 🄶"




  :hook (prog-mode . ggtags-mode)

  )

;; go-mode
(use-package go-mode
  :ensure t
  :ensure go-autocomplete
  :ensure go-direx
................................................................................
  :no-require t

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

  :bind (:map go-mode-map
	      ("C-c C-j" . go-direx-pop-to-buffer))

  :hook ((go-mode . nice-prog-hook)
	 (go-mode . go-eldoc-setup))
  :init


  (add-hook 'go-mode-hook (lambda () (subword-mode 1)))









  )

;; highlight-parentheses
(use-package highlight-parentheses
  :ensure t
  :diminish highlight-parentheses-mode

................................................................................
  :init
  (ivy-mode 1)

  :custom
  (ivy-use-virtual-buffers t)
  (ivy-height 10)
  (ivy-count-format "(%d/%d) ")
  (swiper-goto-start-of-match nil)
  (swiper-include-line-number-in-search t)
  (swiper-stay-on-quit t)
  )

;; jinja2-mode
(use-package jinja2-mode
  :ensure t
  :defer t
  :mode ("\\.j2\\'" . jinja2-mode)
................................................................................

  )

;; json-mode
(use-package json-mode
  :ensure t



  :hook (json-mode . nice-prog-hook)
  )

;; log-edit-mode
(use-package log-edit
  :mode (
         ("COMMIT.*"   . log-edit-mode)
         ("ci-comment" . log-edit-mode)
         ("bzr_log\\." . log-edit-mode)
         ("pico\\."    . log-edit-mode)
         )

  :hook ((log-edit-mode . nice-text-hook)
	 (log-edit-mode . turn-on-orgstruct++))

  )

;; magit
(if (version< emacs-version "25.1")
    (message "Magit requires Emacs version 25.1 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)
  )

;; markdown-mode
(use-package markdown-mode
  :ensure t
  :pin melpa-stable
  
  :commands (markdown-mode gfm-mode)

  :mode (("README\\.md\\'"	 . gfm-mode)
         ("\\.md\\'"		 . markdown-mode)
         ("\\.markdown\\'"	 . markdown-mode))

  :init (setq markdown-command "multimarkdown")
  )

;; nxml-mode
(use-package nxml-mode
  :ensure auto-complete-nxml

  :mode (("\\.xsd\\'"  . xml-mode)
         ("\\.wsdl\\'" . xml-mode))
................................................................................
  :bind (
         ("C-c l" . org-store-link)
         ("C-c a" . org-agenda)
         ("C-c c" . org-capture)
         ("C-c b" . org-iswitchb)
         )

  :hook (org-mode . nice-text-hook)

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

  ;; Enable org-crypt as appropriate
  (org-crypt-use-before-save-magic)
 
  :config
  (use-package org-fancy-priorities
    :ensure t

    :diminish " 🄵"

    :hook
    (org-mode . org-fancy-priorities-mode)

    :config
    ;; Customization for org-fancy-priorities
    (setq org-fancy-priorities-list '("⚡" "⬆" "⬇" "☕"))
    (setq org-lowest-priority ?D)
    )

  ;; Org-mode settings are kept in a different file
  (require 'cmf-org-settings)
  ;; 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)
................................................................................
        (require 'ox-md))
    )

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

  ;; Org-mode hooks

  (add-hook 'org-mode-hook 'nice-org-hook)
  (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
  )

;; org-gcal
;;
;; LATER: When org-gcal is compliant with version 8.2.10 (Default
................................................................................
  :bind (:map php-mode-map
	      ("C-c C--" . php-current-class)
	      ("C-c C-=" . php-current-namespace)
	      ("C-c C-y" . 'yas/create-php-snippet)
	      ("C-x p"   . php-insert-doc-block)
	      )

  :hook (php-mode . nice-prog-hook)

  :init
  (require 'php-doc)
  (require 'php-ext)

  (add-hook 'php-mode-hook (lambda () (subword-mode 1)))

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

  :custom
  (php-enable-psr2-coding-style)
  (php-lineup-cascaded-calls t)
  (phpcbf-standard "PSR2")
  )

;; pretty-lambdada
(if (version< emacs-version "24.4")
    (use-package pretty-lambdada
      :ensure t
................................................................................

      :config
      (pretty-lambda-for-modes)
      )
  ;; Otherwise use built-in prettify mode
  (global-prettify-symbols-mode t)
  )

;; python-mode
(use-package python-mode
  :ensure t
  :pin melpa-stable

  :mode ("\\.py\\'" . python-mode)

  :init
  (setq abbrev-file-name "~/.emacs.d/.abbrev_defs")
  (if (not (file-exists-p abbrev-file-name))
      (write-region "" "" abbrev-file-name))

  :config
  (setq save-abbrevs t)

  (use-package jedi
    :ensure t
    :ensure auto-virtualenv
    :no-require t

    :pin melpa-stable

    :hook ((python-mode . jedi:setup)
	   (python-mode . jedi:ac-setup)
	   (python-mode . auto-virtualenv-set-virtualenv)
	   (window-configuration-change-hook . auto-virtualenv-set-virtualenv)
	   (focus-in-hook . auto-virtualenv-set-virtualenv))

    :init
    (jedi:install-server)

    :custom
    (jedi:complete-on-dot 1)
    (jedi:install-python-jedi-dev-command
      (quote
       ("pip3" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@dev#egg=jedi")))
    )

  (use-package jedi-direx
    :ensure t
    :no-require t

    :bind (:map python-mode-map
		("C-c x" . jedi-direx:pop-to-buffer))

    :hook (jedi-mode-hook . jedi-direx:setup)
    )

  (use-package flycheck-pyflakes
    :ensure t
    )

  (use-package py-autopep8
    :ensure t
    :pin melpa-stable

    :hook (python-mode . py-autopep8-enable-on-save)

    :bind (:map python-mode-map
		("C-c C-p" . autopep8))
    )

  (use-package py-yapf
    :ensure t
    :no-require t
    :pin melpa-stable

    :hook (python-mode . py-yapf-enable-on-save)
    )

  (use-package pyimport
    :ensure t
    :pin melpa-stable

    :bind (:map python-mode-map
		("C-c C-i" . pyimport-insert-missing))
    )

  (use-package sphinx-doc
    :ensure t
    :pin melpa-stable

    :config
    (add-hook 'python-mode-hook (lambda () (sphinx-doc-mode t)))
    )
  )

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

................................................................................
  )

;; sql
(use-package sql
  :mode (
         ("sql*" . sql-mode))


  :hook (sql-mode . nice-prog-hook)
  )

;; sudo-edit
(use-package sudo-edit
  :ensure t
  :no-require t
  )
................................................................................
  )

;; twittering-mode
(use-package twittering-mode
  :ensure t
  :no-require t

  :hook
  (twittering-edit-mode . nice-text-hook)
  ;; :init
  ;; (add-hook 'twittering-edit-mode-hook 'nice-text-hook)

  :config
  (unless (equal window-system nil)
    (setq twittering-icon-mode t)
    )

  :custom
................................................................................
(use-package vc-fossil
  :ensure t
  :init
  (require 'vc-fossil)

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

  :custom
  (vc-fossil-extra-header-fields (quote (:remote-url :checkout :tags)))
  )

;; which-func
(use-package which-func
  :no-require t

  :custom
  (which-function-mode t)
  )

;; which-key
(if (version< emacs-version "24.4")
    (message "Which-Key requires Emacs version 24.4 or greater.  Unable to install")
  (use-package which-key
    :ensure t
    :pin melpa-stable

    :config
    (which-key-mode)
    )
  )

;; with-editor
(use-package with-editor
  :no-require t

  :hook ((with-editor-mode . nice-text-hook)

	 (with-editor-mode . turn-on-orgstruct++))
  )

;; xkcd
(use-package xkcd
  :ensure t
  :if window-system
  :no-require t
................................................................................

;; yaml-mode
(use-package yaml-mode
  :ensure t
  :no-require t

  :mode ("\\.sls\\'" . yaml-mode)


  :hook (yaml-mode . nice-prog-hook)
  )

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

;; Diminished modes that we have to put here as :diminish doesn't seem
;; to want to work :/

Changes to emacs.d/lisp/cmf-org-settings.el.

136
137
138
139
140
141
142


143
144
145
146
147
148
149
...
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233

** Tasks

  " :prepend t :empty-lines 1))))
 '(org-clock-persist (quote 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-backends (quote (ascii html icalendar latex md texinfo)))
 '(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)
................................................................................
    (("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







>
>







 







>








136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236

** Tasks

  " :prepend t :empty-lines 1))))
 '(org-clock-persist (quote history))
 '(org-clock-persist-file "~/.org-clock-save.el")
 '(org-complete-tags-always-offer-all-agenda-tags t)
 '(org-crypt-key "ABCDE12345") 		; Add your key here
 '(org-crypt-tag-matcher "CRYPT")
 '(org-default-notes-file "~/org/notes.org")
 '(org-directory "~/org")
 '(org-export-backends (quote (ascii html icalendar latex md texinfo)))
 '(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)
................................................................................
    (("HOME" . 104)
     ("OFFICE" . 111)
     ("ERRAND" . 101)
     ("PHONE" . 112)
     ("EMAIL" . 109)
     ("GGG" . 103)
     ("APPT" . 97))))
 '(org-tags-exclude-from-inheritance (quote ("CRYPT")))
 '(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/python-mode/class.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
# -*- mode: snippet; coding: utf-8 -*-
# name: class
# contributor: Christopher M. Fuhrman
# --
class ${1:name}($2):
    """
    """

    def __init__(self, $3):
    	$0

Changes to emacs.d/snippets/sh-mode/bp.

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
# name: Boiler Plate for Shell Files
# --
#!/bin/${1:bash}
# ====================================================================
#
# `(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 `(current-time-string)` `(car (cdr (current-time-zone)))`
#
# ====================================================================

#
# ${2:Describe shell script here}
#


$0

# Ende







|
|

|
|
|

|






<




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
# name: Boiler Plate for Shell Files
# --
#!/bin/${1:bash}
# ====================================================================
#
# `(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 `(current-time-string)` `(car (cdr (current-time-zone)))`
#
# ====================================================================

#
# ${2:Describe shell script here}
#


$0

# Ende

Added emacs.d/thirdparty/font-lock+.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
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
;;; font-lock+.el --- Enhancements to standard library `font-lock.el'.
;;
;; Filename: font-lock+.el
;; Description: Enhancements to standard library `font-lock.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
;; Copyright (C) 2007-2018, Drew Adams, all rights reserved.
;; Created: Sun Mar 25 15:21:07 2007
;; Version: 0
;; Package-Requires: ()
;; Last-Updated: Mon Jan  1 11:39:08 2018 (-0800)
;;           By: dradams
;;     Update #: 218
;; URL: https://www.emacswiki.org/emacs/download/font-lock%2b.el
;; Doc URL: https://www.emacswiki.org/emacs/HighlightLibrary
;; Keywords: languages, faces, highlighting
;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x, 26.x
;;
;; Features that might be required by this library:
;;
;;   `font-lock', `syntax'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;;    Enhancements to standard library `font-lock.el'.
;;
;;  This library tells font lock to ignore any text that has the text
;;  property `font-lock-ignore'.  This means, in particular, that font
;;  lock will not erase or otherwise interfere with highlighting that
;;  you apply using library `highlight.el'.
;;
;;  Load this library after standard library `font-lock.el' (which
;;  should be preloaded).  Put this in your Emacs init file (~/.emacs):
;;
;;    (require 'font-lock+)
;;
;;
;;  Non-interactive functions defined here:
;;
;;    `put-text-property-unless-ignore'.
;;
;;
;;  ***** NOTE: The following functions defined in `font-lock.el'
;;              have been REDEFINED HERE:
;;
;;    `font-lock-append-text-property', `font-lock-apply-highlight',
;;    `font-lock-apply-syntactic-highlight',
;;    `font-lock-default-unfontify-region',
;;    `font-lock-fillin-text-property',
;;    `font-lock-fontify-anchored-keywords',
;;    `font-lock-fontify-keywords-region',
;;    `font-lock-fontify-syntactically-region',
;;    `font-lock-prepend-text-property'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change Log:
;;
;; 2014/08/30 dadams
;;     Require cl.el when compile, for incf.
;;     Load font-lock.el[c] when compile, for macro save-buffer-state.
;;     font-lock-(prepend|append)-text-property:
;;       Update for Emacs 24: Canonicalize old forms.
;;     font-lock-fontify-syntactically-region: Updated for Emacs 24.
;; 2014/08/28 dadams
;;     put-text-property-unless-ignore: Use next-single-property-change.
;; 2007/03/25 dadams
;;     Created.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:

(require 'font-lock)

(eval-when-compile
  (require 'cl) ;; incf
  (load-library "font-lock")) ;; Macro save-buffer-state

;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun put-text-property-unless-ignore (start end property value &optional object)
  "`put-text-property', but ignore text with property `font-lock-ignore'."
  (let ((here  (min start end))
        (end1  (max start end))
        chg)
    (while (< here end1)
      (setq chg  (next-single-property-change here 'font-lock-ignore object end1))
      (unless (get-text-property here 'font-lock-ignore object)
        (put-text-property here chg property value object))
      (setq here  chg))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Don't unfontify any text that has property `font-lock-ignore'.
;;
(defun font-lock-default-unfontify-region (beg end)
  "Unfontify from BEG to END, except text with property `font-lock-ignore'."
  (let ((here  (min beg end))
        (end1  (max beg end))
        chg)
    (while (< here end1)
      (setq chg  (next-single-property-change here 'font-lock-ignore nil end1))
      (unless (get-text-property here 'font-lock-ignore)
        (remove-list-of-text-properties
         here chg (append font-lock-extra-managed-props
                          (if font-lock-syntactic-keywords
                              '(syntax-table face font-lock-multiline)
                            '(face font-lock-multiline)))))
      (setq here  chg))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
(defun font-lock-prepend-text-property (start end prop value &optional object)
  "Prepend to one property of the text from START to END.
Arguments PROP and VALUE specify the property and value to prepend to the value
already in place.  The resulting property values are always lists.
Optional argument OBJECT is the string or buffer containing the text."
  (let ((val  (if (listp value) value (list value)))
        next prev)
    (while (/= start end)
      (setq next  (next-single-property-change start prop object end)
            prev  (get-text-property start prop object))
      ;; Canonicalize old forms of face property.
      (and (memq prop '(face font-lock-face))  (listp prev)
	   (or (keywordp (car prev))  (memq (car prev)
                                            '(foreground-color background-color)))
	   (setq prev  (list prev)))
      (put-text-property-unless-ignore start next prop
                                       (append val (if (listp prev) prev (list prev)))
                                       object)
      (setq start  next))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
(defun font-lock-append-text-property (start end prop value &optional object)
  "Append to one property of the text from START to END.
Arguments PROP and VALUE specify the property and value to append to the value
already in place.  The resulting property values are always lists.
Optional argument OBJECT is the string or buffer containing the text."
  (let ((val  (if (listp value) value (list value)))
        next prev)
    (while (/= start end)
      (setq next  (next-single-property-change start prop object end)
            prev  (get-text-property start prop object))
      ;; Canonicalize old forms of face property.
      (and (memq prop '(face font-lock-face))  (listp prev)
	   (or (keywordp (car prev))  (memq (car prev)
                                            '(foreground-color background-color)))
	   (setq prev (list prev)))
      (put-text-property-unless-ignore start next prop
                                       (append (if (listp prev) prev (list prev)) val)
                                       object)
      (setq start  next))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
(defun font-lock-fillin-text-property (start end prop value &optional object)
  "Fill in one property of the text from START to END.
Arguments PROP and VALUE specify the property and value to put where none are
already in place.  Therefore existing property values are not overwritten.
Optional argument OBJECT is the string or buffer containing the text."
  (let ((start  (text-property-any start end prop nil object))
        next)
    (while start
      (setq next  (next-single-property-change start prop object end))
      (put-text-property-unless-ignore start next prop value object)
      (setq start  (text-property-any next end prop nil object)))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
(defun font-lock-apply-syntactic-highlight (highlight)
  "Apply HIGHLIGHT following a match.
HIGHLIGHT should be of the form MATCH-HIGHLIGHT,
see `font-lock-syntactic-keywords'."
  (let* ((match     (nth 0 highlight))
         (start     (match-beginning match)) (end (match-end match))
         (value     (nth 1 highlight))
         (override  (nth 2 highlight)))
    (if (not start)
        ;; No match but we might not signal an error.
        (or (nth 3 highlight)
            (error "No match %d in highlight %S" match highlight))
      (when (and (consp value)  (not (numberp (car value)))) (setq value  (eval value)))
      (when (stringp value) (setq value  (string-to-syntax value)))
      ;; Flush the syntax-cache.  I believe this is not necessary for
      ;; font-lock's use of syntax-ppss, but I'm not 100% sure and it can
      ;; still be necessary for other users of syntax-ppss anyway.
      (syntax-ppss-after-change-function start)
      (cond
        ((not override)
         ;; Cannot override existing fontification.
         (or (text-property-not-all start end 'syntax-table nil)
             (put-text-property-unless-ignore start end 'syntax-table value)))
        ((eq override t)
         ;; Override existing fontification.
         (put-text-property-unless-ignore start end 'syntax-table value))
        ((eq override 'keep)
         ;; Keep existing fontification.
         (font-lock-fillin-text-property start end 'syntax-table value))))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
;; (Parameter PPSS is used by Emacs 22 and 23, but not by Emacs 24.)
;;
(defun font-lock-fontify-syntactically-region (start end &optional loudly ppss)
  "Put proper face on each string and comment between START and END.
START should be at the beginning of a line."
  (when (fboundp 'syntax-propertize)    ; Emacs 24+.
    (syntax-propertize end)) ; Apply any needed syntax-table properties.
  (let ((comment-end-regexp  (or font-lock-comment-end-skip
                                 (regexp-quote (replace-regexp-in-string
                                                "^ *" "" comment-end))))
        (state               (or ppss  (syntax-ppss start))) ; Find the `start' state.
        face beg)
    (when loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
    (while (progn ; Find each interesting place between here and `end'.
             (when (or (nth 3 state)  (nth 4 state))
               (setq face   (funcall font-lock-syntactic-face-function state)
                     beg    (max (nth 8 state) start)
                     state  (parse-partial-sexp (point) end nil nil state
                                                'syntax-table))
               (when face (put-text-property-unless-ignore beg (point) 'face face))
               (when (and (eq face 'font-lock-comment-face)
                          (or font-lock-comment-start-skip  comment-start-skip))
                 ;; Find the comment delimiters
                 ;; and use font-lock-comment-delimiter-face for them.
                 (save-excursion
                   (goto-char beg)
                   (when (looking-at (or font-lock-comment-start-skip
                                         comment-start-skip))
                     (put-text-property-unless-ignore
                      beg (match-end 0) 'face font-lock-comment-delimiter-face)))
                 (when (looking-back comment-end-regexp (point-at-bol) t)
                   (put-text-property-unless-ignore (match-beginning 0) (point) 'face
                                                    font-lock-comment-delimiter-face))))
             (< (point) end))
      (setq state  (parse-partial-sexp (point) end nil nil state 'syntax-table)))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; 1. Use `put-text-property-unless-ignore' instead of `put-text-property'.
;; 2. Use `defun' instead of `defsubst', since we don't want to reproduce whole library.
;;
(defun font-lock-apply-highlight (highlight)
  "Apply HIGHLIGHT following a match.
HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'."
  (let* ((match     (nth 0 highlight))
         (start     (match-beginning match)) (end (match-end match))
         (override  (nth 2 highlight)))
    (if (not start)
        ;; No match but we might not signal an error.
        (or (nth 3 highlight)  (error "No match %d in highlight %S" match highlight))
      (let ((val  (eval (nth 1 highlight))))
        (when (eq (car-safe val) 'face)
          (add-text-properties start end (cddr val))
          (setq val  (cadr val)))
        (cond ((not (or val  (eq override t)))
               ;; If `val' is nil, don't do anything.  It is important to do it
               ;; explicitly, because when adding nil via things like
               ;; font-lock-append-text-property, the property is actually
               ;; changed from <face> to (<face>) which is undesirable.  --Stef
               nil)
              ((not override)
               ;; Cannot override existing fontification.
               (unless (text-property-not-all start end 'face nil)
                 (put-text-property-unless-ignore start end 'face val)))
              ((eq override t)
               ;; Override existing fontification.
               (put-text-property-unless-ignore start end 'face val))
              ((eq override 'prepend)
               ;; Prepend to existing fontification.
               (font-lock-prepend-text-property start end 'face val))
              ((eq override 'append)
               ;; Append to existing fontification.
               (font-lock-append-text-property start end 'face val))
              ((eq override 'keep)
               ;; Keep existing fontification.
               (font-lock-fillin-text-property start end 'face val)))))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; 1. Use `put-text-property-unless-ignore' instead of `put-text-property'.
;; 2. Use `defun' instead of `defsubst', since we don't want to reproduce whole library.
;;
(defun font-lock-fontify-anchored-keywords (keywords limit)
  "Fontify according to KEYWORDS until LIMIT.
KEYWORDS should be of the form MATCH-ANCHORED, see `font-lock-keywords',
LIMIT can be modified by the value of its PRE-MATCH-FORM."
  (let ((matcher          (nth 0 keywords))
        (lowdarks         (nthcdr 3 keywords))
        (lead-start       (match-beginning 0))
        (pre-match-value  (eval (nth 1 keywords))) ; Evaluate PRE-MATCH-FORM.
        highlights)
    ;; Set LIMIT to value of PRE-MATCH-FORM or the end of line.
    (if (not (and (numberp pre-match-value)  (> pre-match-value (point))))
        (setq limit  (line-end-position))
      (setq limit  pre-match-value)
      (when (and font-lock-multiline  (>= limit (line-beginning-position 2)))
        ;; this is a multiline anchored match
        ;; (setq font-lock-multiline  t)
        (put-text-property-unless-ignore (if (= limit (line-beginning-position 2))
                                             (1- limit)
                                           (min lead-start (point)))
                                         limit
                                         'font-lock-multiline t)))
    (save-match-data
      ;; Find an occurrence of `matcher' before `limit'.
      (while (and (< (point) limit)  (if (stringp matcher)
                                         (re-search-forward matcher limit t)
                                       (funcall matcher limit)))
        ;; Apply each highlight to this instance of `matcher'.
        (setq highlights  lowdarks)
        (while highlights
          (font-lock-apply-highlight (car highlights))
          (setq highlights  (cdr highlights)))))
    ;; Evaluate POST-MATCH-FORM.
    (eval (nth 2 keywords))))


;; REPLACES ORIGINAL in `font-lock.el'.
;;
;; Use `put-text-property-unless-ignore' instead of `put-text-property'.
;;
(defun font-lock-fontify-keywords-region (start end &optional loudly)
  "Fontify according to `font-lock-keywords' between START and END.
START should be at the beginning of a line.
LOUDLY, if non-nil, allows progress-meter bar."
  (unless (eq (car font-lock-keywords) t)
    (setq font-lock-keywords  (font-lock-compile-keywords font-lock-keywords)))
  (let ((case-fold-search  font-lock-keywords-case-fold-search)
        (keywords          (cddr font-lock-keywords))
        (bufname           (buffer-name))
        (count 0)
        (pos               (make-marker))
        keyword matcher highlights)
    ;;
    ;; Fontify each item in `font-lock-keywords' from `start' to `end'.
    (while keywords
      (when loudly
        (message "Fontifying %s... (regexps..%s)" bufname (make-string (incf count)
                                                                       ?.)))
      ;;
      ;; Find an occurrence of `matcher' from `start' to `end'.
      (setq keyword  (car keywords) matcher (car keyword))
      (goto-char start)
      (while (and (< (point) end)
                  (if (stringp matcher)
                      (re-search-forward matcher end t)
                    (funcall matcher end))
                  ;; Beware empty string matches since they will
                  ;; loop indefinitely.
                  (or (> (point) (match-beginning 0))  (progn (forward-char 1) t)))
        (when (and font-lock-multiline
                   (>= (point) (save-excursion (goto-char (match-beginning 0))
                                               (forward-line 1) (point))))
          ;; this is a multiline regexp match
          ;; (setq font-lock-multiline  t)
          (put-text-property-unless-ignore (if (= (point)
                                                  (save-excursion
                                                    (goto-char (match-beginning 0))
                                                    (forward-line 1) (point)))
                                               (1- (point))
                                             (match-beginning 0))
                                           (point)
                                           'font-lock-multiline t))
        ;; Apply each highlight to this instance of `matcher', which may be
        ;; specific highlights or more keywords anchored to `matcher'.
        (setq highlights  (cdr keyword))
        (while highlights
          (if (numberp (car (car highlights)))
              (font-lock-apply-highlight (car highlights))
            (set-marker pos (point))
            (font-lock-fontify-anchored-keywords (car highlights) end)
            ;; Ensure forward progress.  `pos' is a marker because anchored
            ;; keyword may add/delete text (this happens e.g. in grep.el).
            (when (< (point) pos) (goto-char pos)))
          (setq highlights  (cdr highlights))))
      (setq keywords  (cdr keywords)))
    (set-marker pos nil)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide 'font-lock+)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; font-lock+.el ends here

Changes to global-excludes.

1
2

3
4
5

6
7
8
9
10
11
12
..
17
18
19
20
21
22
23
24
25
26
*.tar.gz
*~

.icon-fonts-installed
.fslckout
.org-id-locations

GPATH
GRTAGS
GTAGS
_FOSSIL_
ac-comphist.dat
ac-dict/
auto-save-list
................................................................................
emojis/
eshell/
ext/
ido.last
org-clock-save.el
recentf
network-security.data
tramp/
url/
xkcd/


>



>







 







|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
19
20
21
22
23
24
25
26
27
28
*.tar.gz
*~
.abbrev_defs
.icon-fonts-installed
.fslckout
.org-id-locations
.python-environments
GPATH
GRTAGS
GTAGS
_FOSSIL_
ac-comphist.dat
ac-dict/
auto-save-list
................................................................................
emojis/
eshell/
ext/
ido.last
org-clock-save.el
recentf
network-security.data
tramp
url/
xkcd/

Added nanorc.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# -*- mode: conf -*-
#
# Configuration file for nano(1)
#
set regexp
set smooth
set speller aspell

# Colors
set titlecolor     white,red
set statuscolor    white,red
set errorcolor     red,white
set keycolor       white,red

Changes to setup.sh.

39
40
41
42
43
44
45

46
47
48
49
50
51




52
53
54
55
56
57
58
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91

92
93
94
95
96
97
98
99
100
101
...
292
293
294
295
296
297
298


























299
300
301
302
303
304
305
...
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
...
414
415
416
417
418
419
420




421
422
423
424
425
426
427
...
508
509
510
511
512
513
514





515
516
517
518
519
520
521
MAKE=make
COPYRIGHT='Copyright (c) 2000-2018 Christopher M. Fuhrman'
OUTPUTSPACING=55
DRYRUN=""
UNINSTALL=0
GOINSTALL=0
GOPATH=${HOME}/go

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
                    #   - ~/tmp directory will not be created
                    #   - Existing files in $HOME will not be backed up





# Read only constants
readonly L1=1
readonly L2=2
readonly TRUE=1
readonly FALSE=0

................................................................................
        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'               \
................................................................................

	# Install gotags for go-direx
	if [ ! -f {$GOBIN}/gotags ]; then
		inform $L2 $TRUE "Installing gotags"
		go get -u github.com/jstemmer/gotags
	fi
}



























# Function: headerDisplay
#
# Displays a header for the world to see

headerDisplay ()
{
................................................................................
        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                     \\
                -g Set up/remove GoLang Development        \\

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

STDERR

} # usage()


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

headerDisplay

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

set -- $args

while [ $# -gt 0 ]
do

        case "$1" in
................................................................................
                BACKUPDIR=$2; shift;
                inform $L1 $TRUE "Existing files to be backed up in ${BACKUPDIR}"
                ;;

	-g)
		GOINSTALL=1
		;;





        -u)
                UNINSTALL=1
                inform $L1 $TRUE 'UNINSTALL invoked'
                ;;

        --)
................................................................................
        inform $L1 $TRUE 'Synchronization not necessary'
fi

# Do we want to set up our environment for golang development?
if [ ${GOINSTALL} -ne 0 ]; then
	goSetup
fi






# Set up appropriate symlinks
if [ ${NOLINK} -ne 1 ]; then

        # Set up links
        for file in ${HOMEDOTFILES[@]}; do








>






>
>
>
>







 







|
|
|
|
|
|
|
>
|
|
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>













|







 







>
>
>
>







 







>
>
>
>
>







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
..
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
...
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
...
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
...
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
...
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
MAKE=make
COPYRIGHT='Copyright (c) 2000-2018 Christopher M. Fuhrman'
OUTPUTSPACING=55
DRYRUN=""
UNINSTALL=0
GOINSTALL=0
GOPATH=${HOME}/go
PYINSTALL=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
                    #   - ~/tmp directory will not be created
                    #   - Existing files in $HOME will not be backed up

# Variables that can be overridden
: ${PYTHON_VERSION:=3}
: ${PIP_BIN:=pip3}

# Read only constants
readonly L1=1
readonly L2=2
readonly TRUE=1
readonly FALSE=0

................................................................................
        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"				\
	      "nanorc"				\
              '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'               \
................................................................................

	# Install gotags for go-direx
	if [ ! -f {$GOBIN}/gotags ]; then
		inform $L2 $TRUE "Installing gotags"
		go get -u github.com/jstemmer/gotags
	fi
}

# Function: pySetup
#
# Installs the tools necessary for python development
pySetup ()
{
	local PYTHON_PKGS=('jedi'		\
			   'flake8'		\
			   'autopep8'		\
			   'yapf'		\
			   'virtualenv'
			  )

	# Make sure that pip is installed
	if ! type ${PIP_BIN} >/dev/null; then
		inform $L1 $TRUE "${RED}ERROR${NORMAL}: python ${PIP_BIN} is not installed on this system.  Cowardly aborting!"
		exit 1
	fi

	inform $L1 $TRUE "Setting up development environment for python${PYTHON_VERSION}"

	for pyPkg in ${PYTHON_PKGS[@]}; do
		inform $L2 $TRUE " ${pyPkg}"
		${PIP_BIN} install --prefix=$HOME $pyPkg
	done
}

# Function: headerDisplay
#
# Displays a header for the world to see

headerDisplay ()
{
................................................................................
        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                     \\
                -g Set up/remove GoLang Development        \\
		-p Set up Python Development               \\
                -u Uninstall ShellPAK                      \\
                -r perform a trial run with no changes made
                   (implies -n)

STDERR

} # usage()


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

headerDisplay

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

set -- $args

while [ $# -gt 0 ]
do

        case "$1" in
................................................................................
                BACKUPDIR=$2; shift;
                inform $L1 $TRUE "Existing files to be backed up in ${BACKUPDIR}"
                ;;

	-g)
		GOINSTALL=1
		;;

	-p)
		PYINSTALL=1
		;;

        -u)
                UNINSTALL=1
                inform $L1 $TRUE 'UNINSTALL invoked'
                ;;

        --)
................................................................................
        inform $L1 $TRUE 'Synchronization not necessary'
fi

# Do we want to set up our environment for golang development?
if [ ${GOINSTALL} -ne 0 ]; then
	goSetup
fi

# Do we want to set up our environment for python development?
if [ ${PYINSTALL} -ne 0 ]; then
	pySetup
fi

# Set up appropriate symlinks
if [ ${NOLINK} -ne 1 ]; then

        # Set up links
        for file in ${HOMEDOTFILES[@]}; do

Changes to thirdparty/git-completion.bash.

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
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
180
181
182
183
184
185
186














187
188
189
190
191
192
193
...
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
...
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
...
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
...
537
538
539
540
541
542
543

544
545
546
547
548
549
550
...
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
...
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
...
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
...
798
799
800
801
802
803
804












































805
806
807
808
809
810
811
...
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
...
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
...
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
...
936
937
938
939
940
941
942

943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982

983
984
985
986
987
988
989
990
991
992
993
994
995
996
....
1019
1020
1021
1022
1023
1024
1025
1026

1027
1028
1029
1030
1031
1032

1033
1034
1035
1036

1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
....
1087
1088
1089
1090
1091
1092
1093

1094



1095
1096
1097
1098
1099


1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133

1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152

1153
1154
1155
1156
1157
1158
1159


1160
1161
1162
1163
1164
1165
1166
....
1169
1170
1171
1172
1173
1174
1175

1176
1177
1178
1179
1180
1181
1182
1183
1184
1185




1186
1187
1188
1189
1190
1191
1192
....
1221
1222
1223
1224
1225
1226
1227

1228
1229
1230
1231
1232
1233
1234
....
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
....
1292
1293
1294
1295
1296
1297
1298





1299

1300





























1301
1302
1303
1304
1305
1306
1307
....
1314
1315
1316
1317
1318
1319
1320


1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
....
1386
1387
1388
1389
1390
1391
1392






1393
1394
1395
1396
1397
1398
1399
....
1423
1424
1425
1426
1427
1428
1429

1430
1431
1432
1433
1434
1435













1436
1437
1438
1439
1440
1441
1442
....
1443
1444
1445
1446
1447
1448
1449








1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460

1461
1462
1463
1464
1465
1466
1467
1468
1469
1470















1471
1472
1473
1474
1475
1476
1477
....
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
....
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
....
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
....
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
....
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674

1675
1676
1677
1678
1679
1680
1681
1682
1683
....
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
....
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
....
1774
1775
1776
1777
1778
1779
1780


















































1781
1782
1783
1784
1785
1786
1787
....
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
....
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
....
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
....
1965
1966
1967
1968
1969
1970
1971

1972
1973
1974



1975


1976

1977

1978
1979

1980
1981
1982
1983
1984
1985
1986
....
2017
2018
2019
2020
2021
2022
2023

2024

2025
2026
2027
2028


2029
2030

2031
2032
2033
2034
2035
2036


2037
2038
2039
2040
2041
2042
2043
2044
2045


2046
2047
2048
2049
2050
2051
2052

2053

2054
2055


2056
2057
2058
2059
2060


2061
2062
2063
2064
2065
2066




2067
2068
2069
2070
2071
2072
2073
....
2080
2081
2082
2083
2084
2085
2086

2087
2088
2089
2090
2091
2092
2093
2094
2095
2096

2097
2098

2099

2100
2101
2102
2103
2104
2105

2106
2107
2108
2109
2110
2111
2112
....
2237
2238
2239
2240
2241
2242
2243


2244
2245
2246
2247
2248
2249
2250
....
2255
2256
2257
2258
2259
2260
2261

2262


2263
2264





2265


2266
2267
2268
2269
2270








2271
2272
2273
2274
2275



2276
2277
2278









2279

2280
2281
2282
2283
2284
2285
2286

















2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310

2311


2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
....
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
....
2353
2354
2355
2356
2357
2358
2359




2360
2361
2362
2363
2364
2365
2366
....
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
....
2399
2400
2401
2402
2403
2404
2405



2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440

2441
2442
2443
2444
2445
2446
2447
2448
2449
2450



























2451
2452
2453
2454
2455
2456
2457
....
2464
2465
2466
2467
2468
2469
2470

2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
....
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
....
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596


























2597
2598
2599

2600
2601
2602
2603
2604
2605
2606
2607
2608




2609
2610
2611
2612
2613
2614
2615











2616
2617
2618
2619
2620
2621
2622
....
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655


2656
2657
2658
2659
2660
2661
2662
2663
2664
....
2696
2697
2698
2699
2700
2701
2702









2703
2704
2705
2706
2707
2708
2709
#       see git-prompt.sh for details.
#
# If you use complex aliases of form '!f() { ... }; f', you can use the null
# command ':' as the first command in the function body to declare the desired
# completion style.  For example '!f() { : git commit ; ... }; f' will
# tell the completion to use commit completion.  This also works with aliases
# of form "!sh -c '...'".  For example, "!sh -c ': git commit ; ... '".









case "$COMP_WORDBREAKS" in
*:*) : great ;;
*)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac

# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()

{
	if [ -z "${1-}" ]; then









		if [ -n "${__git_dir-}" ]; then
			echo "$__git_dir"

		elif [ -n "${GIT_DIR-}" ]; then
			test -d "${GIT_DIR-}" || return 1
			echo "$GIT_DIR"
		elif [ -d .git ]; then
			echo .git

		else
			git rev-parse --git-dir 2>/dev/null
		fi










	elif [ -d "$1/.git" ]; then
		echo "$1/.git"
	else
		echo "$1"
	fi
}









# The following function is based on code from:
#
#   bash_completion - programmable completion functions for bash 3.2+
#
#   Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
#             © 2009-2010, Bash Completion Maintainers
................................................................................
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software Foundation,
#   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#   The latest version of this software can be obtained here:
#
#   http://bash-completion.alioth.debian.org/
#
#   RELEASE: 2.x

................................................................................
			cword=$cword_
			;;
		esac
		shift
	done
}
fi















__gitcompappend ()
{
	local x i=${#COMPREPLY[@]}
	for x in $1; do
		if [[ "$x" == "$3"* ]]; then
			COMPREPLY[i++]="$2$x$4"
................................................................................
# Execute 'git ls-files', unless the --committable option is specified, in
# which case it runs 'git diff-index' to find out the files that can be
# committed.  It return paths relative to the directory specified in the first
# argument, and using the options specified in the second argument.
__git_ls_files_helper ()
{
	if [ "$2" == "--committable" ]; then
		git -C "$1" diff-index --name-only --relative HEAD
	else
		# NOTE: $2 is not quoted in order to support multiple options
		git -C "$1" ls-files --exclude-standard $2
	fi 2>/dev/null
}


# __git_index_files accepts 1 or 2 arguments:
# 1: Options to pass to ls-files (required).
# 2: A directory path (optional).
#    If provided, only files within the specified directory are listed.
#    Sub directories are never recursed.  Path must have a trailing
#    slash.
__git_index_files ()
{
	local dir="$(__gitdir)" root="${2-.}" file

	if [ -d "$dir" ]; then
		__git_ls_files_helper "$root" "$1" |
		while read -r file; do
			case "$file" in
			?*/*) echo "${file%%/*}" ;;
			*) echo "$file" ;;
			esac
		done | sort | uniq
	fi
}






__git_heads ()
{
	local dir="$(__gitdir)"
	if [ -d "$dir" ]; then
		git --git-dir="$dir" for-each-ref --format='%(refname:short)' \



			refs/heads
		return
	fi
}



__git_tags ()
{
	local dir="$(__gitdir)"
	if [ -d "$dir" ]; then
		git --git-dir="$dir" for-each-ref --format='%(refname:short)' \



			refs/tags
		return
	fi
}

# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments
# presence of 2nd argument means use the guess heuristic employed
# by checkout for tracking branches











__git_refs ()
{
	local i hash dir="$(__gitdir "${1-}")" track="${2-}"

	local format refs








	if [ -d "$dir" ]; then























		case "$cur" in
		refs|refs/*)
			format="refname"
			refs="${cur%/*}"

			track=""
			;;
		*)
			for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do


				if [ -e "$dir/$i" ]; then echo $i; fi




			done
			format="refname:short"
			refs="refs/tags refs/heads refs/remotes"



			;;
		esac
		git --git-dir="$dir" for-each-ref --format="%($format)" \

			$refs
		if [ -n "$track" ]; then
			# employ the heuristic used by git checkout
			# Try to find a remote branch that matches the completion word
			# but only output if the branch name is unique
			local ref entry
			git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \
				"refs/remotes/" | \
			while read -r entry; do
				eval "$entry"
				ref="${ref#*/}"
				if [[ "$ref" == "$cur"* ]]; then
					echo "$ref"
				fi
			done | sort | uniq -u
		fi
		return
	fi
	case "$cur" in
	refs|refs/*)
		git ls-remote "$dir" "$cur*" 2>/dev/null | \
		while read -r hash i; do
			case "$i" in
			*^{}) ;;
			*) echo "$i" ;;
			esac
		done
		;;
	*)

		echo "HEAD"


		git for-each-ref --format="%(refname:short)" -- \









			"refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"








		;;
	esac
}































# __git_refs2 requires 1 argument (to pass to __git_refs)

__git_refs2 ()
{
	local i
	for i in $(__git_refs "$1"); do
		echo "$i:$i"
	done
}



















# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
	local i hash
	git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \
	while read -r hash i; do
		echo "$i:refs/remotes/$1/${i#refs/heads/}"
	done
}

__git_remotes ()
{
	local d="$(__gitdir)"
	test -d "$d/remotes" && ls -1 "$d/remotes"
	git --git-dir="$d" remote












}

__git_list_merge_strategies ()
{
	git merge -s help 2>&1 |
	sed -n -e '/[Aa]vailable strategies are: /,/^$/{
		s/\.$//
................................................................................
		esac

		case "$COMP_WORDBREAKS" in
		*:*) : great ;;
		*)   pfx="$ref:$pfx" ;;
		esac

		__gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
				| sed '/^100... blob /{
				           s,^.*	,,
				           s,$, ,
				       }
				       /^120000 blob /{
				           s,^.*	,,
				           s,$, ,
................................................................................
				       }
				       s/^.*	//')" \
			"$pfx" "$cur_" ""
		;;
	*...*)
		pfx="${cur_%...*}..."
		cur_="${cur_#*...}"
		__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
		;;
	*..*)
		pfx="${cur_%..*}.."
		cur_="${cur_#*..}"
		__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
		;;
	*)
		__gitcomp_nl "$(__git_refs)"
		;;
	esac
}


# __git_complete_index_file requires 1 argument:
# 1: the options to pass to ls-file
................................................................................
	if [ "$cmd" = "remote" ]; then
		((c++))
	fi
	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;

		--all)
			case "$cmd" in
			push) no_complete_refspec=1 ;;
			fetch)
				return
				;;
			*) ;;
................................................................................
		pfx="+"
		cur_="${cur_#+}"
		;;
	esac
	case "$cmd" in
	fetch)
		if [ $lhs = 1 ]; then
			__gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_"
		else
			__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
		fi
		;;
	pull|remote)
		if [ $lhs = 1 ]; then
			__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
		else
			__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
		fi
		;;
	push)
		if [ $lhs = 1 ]; then
			__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
		else
			__gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
		fi
		;;
	esac
}

__git_complete_strategy ()
{
................................................................................
}

# Lists all set config variables starting with the given section prefix,
# with the prefix removed.
__git_get_config_variables ()
{
	local section="$1" i IFS=$'\n'
	for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do
		echo "${i#$section.}"
	done
}

__git_pretty_aliases ()
{
	__git_get_config_variables "pretty"
................................................................................
{
	__git_get_config_variables "alias"
}

# __git_aliased_command requires 1 argument
__git_aliased_command ()
{
	local word cmdline=$(git --git-dir="$(__gitdir)" \
		config --get "alias.$1")
	for word in $cmdline; do
		case "$word" in
		\!gitk|gitk)
			echo "gitk"
			return
			;;
		\!*)	: shell command alias ;;
................................................................................
				echo "$subcommand"
				return
			fi
		done
		((c++))
	done
}













































__git_has_doubledash ()
{
	local c=1
	while [ $c -lt $cword ]; do
		if [ "--" = "${words[c]}" ]; then
			return 0
................................................................................
	printf "%d" $c
}

__git_whitespacelist="nowarn warn error error-all fix"

_git_am ()
{
	local dir="$(__gitdir)"
	if [ -d "$dir"/rebase-apply ]; then
		__gitcomp "--skip --continue --resolved --abort"
		return
	fi
	case "$cur" in
	--whitespace=*)
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
		return
................................................................................
	--*)
		__gitcomp "
			--stat --numstat --summary --check --index
			--cached --index-info --reverse --reject --unidiff-zero
			--apply --no-add --exclude=
			--ignore-whitespace --ignore-space-change
			--whitespace= --inaccurate-eof --verbose

			"
		return
	esac
}

_git_add ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--interactive --refresh --patch --update --dry-run
			--ignore-errors --intent-to-add
			"
		return
	esac

	# XXX should we check for --update and --all options ?
	__git_complete_index_file "--others --modified --directory --no-empty-directory"





}

_git_archive ()
{
	case "$cur" in
	--format=*)
		__gitcomp "$(git archive --list)" "" "${cur##--format=}"
................................................................................
	--remote=*)
		__gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}"
		return
		;;
	--*)
		__gitcomp "
			--format= --list --verbose
			--prefix= --remote= --exec=
			"
		return
		;;
	esac
	__git_complete_file
}

................................................................................
_git_bisect ()
{
	__git_has_doubledash && return

	local subcommands="start bad good skip reset visualize replay log run"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then

		if [ -f "$(__gitdir)"/BISECT_START ]; then
			__gitcomp "$subcommands"
		else
			__gitcomp "replay start"
		fi
		return
	fi

	case "$subcommand" in
	bad|good|reset|skip|start)
		__gitcomp_nl "$(__git_refs)"
		;;
	*)
		;;
	esac
}

_git_branch ()
{
	local i c=1 only_local_ref="n" has_r="n"

	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		-d|-m)	only_local_ref="y" ;;
		-r)	has_r="y" ;;
		esac
		((c++))
	done

	case "$cur" in
	--set-upstream-to=*)
		__gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}"
		;;
	--*)
		__gitcomp "
			--color --no-color --verbose --abbrev= --no-abbrev
			--track --no-track --contains --merged --no-merged
			--set-upstream-to= --edit-description --list
			--unset-upstream

			"
		;;
	*)
		if [ $only_local_ref = "y" -a $has_r = "n" ]; then
			__gitcomp_nl "$(__git_heads)"
		else
			__gitcomp_nl "$(__git_refs)"
		fi
		;;
	esac
}

_git_bundle ()
{
................................................................................
	case "$cur" in
	--conflict=*)
		__gitcomp "diff3 merge" "" "${cur##--conflict=}"
		;;
	--*)
		__gitcomp "
			--quiet --ours --theirs --track --no-track --merge
			--conflict= --orphan --patch

			"
		;;
	*)
		# check if --track, --no-track, or --no-guess was specified
		# if so, disable DWIM mode
		local flags="--track --no-track --no-guess" track=1

		if [ -n "$(__git_find_on_cmdline "$flags")" ]; then
			track=''
		fi
		__gitcomp_nl "$(__git_refs '' $track)"

		;;
	esac
}

_git_cherry ()
{
	__gitcomp_nl "$(__git_refs)"
}

_git_cherry_pick ()
{
	local dir="$(__gitdir)"
	if [ -f "$dir"/CHERRY_PICK_HEAD ]; then
		__gitcomp "--continue --quit --abort"
		return
	fi
	case "$cur" in
	--*)
		__gitcomp "--edit --no-commit --signoff --strategy= --mainline"
		;;
	*)
		__gitcomp_nl "$(__git_refs)"
		;;
	esac
}

_git_clean ()
{
	case "$cur" in
................................................................................
			--bare
			--mirror
			--origin
			--upload-pack
			--template=
			--depth
			--single-branch

			--branch



			"
		return
		;;
	esac
}



_git_commit ()
{
	case "$prev" in
	-c|-C)
		__gitcomp_nl "$(__git_refs)" "" "${cur}"
		return
		;;
	esac

	case "$cur" in
	--cleanup=*)
		__gitcomp "default scissors strip verbatim whitespace
			" "" "${cur##--cleanup=}"
		return
		;;
	--reuse-message=*|--reedit-message=*|\
	--fixup=*|--squash=*)
		__gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
		return
		;;
	--untracked-files=*)
		__gitcomp "all no normal" "" "${cur##--untracked-files=}"
		return
		;;
	--*)
		__gitcomp "
			--all --author= --signoff --verify --no-verify
			--edit --no-edit
			--amend --include --only --interactive
			--dry-run --reuse-message= --reedit-message=
			--reset-author --file= --message= --template=
			--cleanup= --untracked-files --untracked-files=
			--verbose --quiet --fixup= --squash=

			"
		return
	esac

	if git rev-parse --verify --quiet HEAD >/dev/null; then
		__git_complete_index_file "--committable"
	else
		# This is the first commit
		__git_complete_index_file "--cached"
	fi
}

_git_describe ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--all --tags --contains --abbrev= --candidates=
			--exact-match --debug --long --match --always

			"
		return
	esac
	__gitcomp_nl "$(__git_refs)"
}

__git_diff_algorithms="myers minimal patience histogram"



__git_diff_common_options="--stat --numstat --shortstat --summary
			--patch-with-stat --name-only --name-status --color
			--no-color --color-words --no-renames --check
			--full-index --binary --abbrev --diff-filter=
			--find-copies-harder
			--text --ignore-space-at-eol --ignore-space-change
................................................................................
			--no-prefix --src-prefix= --dst-prefix=
			--inter-hunk-context=
			--patience --histogram --minimal
			--raw --word-diff --word-diff-regex=
			--dirstat --dirstat= --dirstat-by-file
			--dirstat-by-file= --cumulative
			--diff-algorithm=

"

_git_diff ()
{
	__git_has_doubledash && return

	case "$cur" in
	--diff-algorithm=*)
		__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
		return




		;;
	--*)
		__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
			--base --ours --theirs --no-index
			$__git_diff_common_options
			"
		return
................................................................................
}

__git_fetch_recurse_submodules="yes on-demand no"

__git_fetch_options="
	--quiet --verbose --append --upload-pack --force --keep --depth=
	--tags --no-tags --all --prune --dry-run --recurse-submodules=

"

_git_fetch ()
{
	case "$cur" in
	--recurse-submodules=*)
		__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
................................................................................

_git_fsck ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--tags --root --unreachable --cache --no-reflogs --full
			--strict --verbose --lost-found
			"
		return
		;;
	esac
}

_git_gc ()
................................................................................
}

_git_gitk ()
{
	_gitk
}






__git_match_ctag() {

	awk "/^${1//\//\\/}/ { print \$1 }" "$2"





























}

_git_grep ()
{
	__git_has_doubledash && return

	case "$cur" in
................................................................................
			--perl-regexp
			--threads
			--files-with-matches --name-only
			--files-without-match
			--max-depth
			--count
			--and --or --not --all-match


			"
		return
		;;
	esac

	case "$cword,$prev" in
	2,*|*,-*)
		if test -r tags; then
			__gitcomp_nl "$(__git_match_ctag "$cur" tags)"
			return
		fi
		;;
	esac

	__gitcomp_nl "$(__git_refs)"
}

_git_help ()
{
	case "$cur" in
	--*)
		__gitcomp "--all --info --man --web"
		return
		;;
	esac
	__git_compute_all_commands
	__gitcomp "$__git_all_commands $(__git_aliases)
		attributes cli core-tutorial cvs-migration
		diffcore gitk glossary hooks ignore modules
		namespaces repository-layout tutorial tutorial-2
		workflows
		"
}

_git_init ()
{
	case "$cur" in
................................................................................
	# XXX ignore options like --modified and always suggest all cached
	# files.
	__git_complete_index_file "--cached"
}

_git_ls_remote ()
{






	__gitcomp_nl "$(__git_remotes)"
}

_git_ls_tree ()
{
	__git_complete_file
}
................................................................................

__git_log_pretty_formats="oneline short medium full fuller email raw format:"
__git_log_date_formats="relative iso8601 rfc2822 short local default raw"

_git_log ()
{
	__git_has_doubledash && return


	local g="$(git rev-parse --git-dir 2>/dev/null)"
	local merge=""
	if [ -f "$g/MERGE_HEAD" ]; then
		merge="--merge"
	fi













	case "$cur" in
	--pretty=*|--format=*)
		__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
			" "" "${cur#*=}"
		return
		;;
	--date=*)
................................................................................
		__gitcomp "$__git_log_date_formats" "" "${cur##--date=}"
		return
		;;
	--decorate=*)
		__gitcomp "full short no" "" "${cur##--decorate=}"
		return
		;;








	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_shortlog_options
			$__git_log_gitk_options
			--root --topo-order --date-order --reverse
			--follow --full-diff
			--abbrev-commit --abbrev=
			--relative-date --date=
			--pretty= --format= --oneline
			--show-signature

			--cherry-pick
			--graph
			--decorate --decorate=
			--walk-reflogs
			--parents --children
			$merge
			$__git_diff_common_options
			--pickaxe-all --pickaxe-regex
			"
		return















		;;
	esac
	__git_complete_revlist
}

# Common merge options shared by git-merge(1) and git-pull(1).
__git_merge_options="
................................................................................
_git_merge ()
{
	__git_complete_strategy && return

	case "$cur" in
	--*)
		__gitcomp "$__git_merge_options
			--rerere-autoupdate --no-rerere-autoupdate --abort"
		return
	esac
	__gitcomp_nl "$(__git_refs)"
}

_git_mergetool ()
{
	case "$cur" in
	--tool=*)
		__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
		return
		;;
	--*)
		__gitcomp "--tool="
		return
		;;
	esac
}

_git_merge_base ()
{
	case "$cur" in
	--*)
		__gitcomp "--octopus --independent --is-ancestor --fork-point"
		return
		;;
	esac
	__gitcomp_nl "$(__git_refs)"
}

_git_mv ()
{
	case "$cur" in
	--*)
		__gitcomp "--dry-run"
................................................................................
	case "$subcommand,$cur" in
	,--*)
		__gitcomp '--ref'
		;;
	,*)
		case "$prev" in
		--ref)
			__gitcomp_nl "$(__git_refs)"
			;;
		*)
			__gitcomp "$subcommands --ref"
			;;
		esac
		;;
	add,--reuse-message=*|append,--reuse-message=*|\
	add,--reedit-message=*|append,--reedit-message=*)
		__gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
		;;
	add,--*|append,--*)
		__gitcomp '--file= --message= --reedit-message=
				--reuse-message='
		;;
	copy,--*)
		__gitcomp '--stdin'
................................................................................
	prune,*)
		;;
	*)
		case "$prev" in
		-m|-F)
			;;
		*)
			__gitcomp_nl "$(__git_refs)"
			;;
		esac
		;;
	esac
}

_git_pull ()
................................................................................
		"
		return
		;;
	esac
	__git_complete_remote_or_refspec
}

__git_push_recurse_submodules="check on-demand"

__git_complete_force_with_lease ()
{
	local cur_=$1

	case "$cur_" in
	--*=)
		;;
	*:*)
		__gitcomp_nl "$(__git_refs)" "" "${cur_#*:}"
		;;
	*)
		__gitcomp_nl "$(__git_refs)" "" "$cur_"
		;;
	esac
}

_git_push ()
{
	case "$prev" in
................................................................................
		;;
	esac
	__git_complete_remote_or_refspec
}

_git_rebase ()
{
	local dir="$(__gitdir)"
	if [ -f "$dir"/rebase-merge/interactive ]; then
		__gitcomp "--continue --skip --abort --edit-todo"
		return

	elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
		__gitcomp "--continue --skip --abort"
		return
	fi
	__git_complete_strategy && return
	case "$cur" in
	--whitespace=*)
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
		return
................................................................................
			--verify --no-verify
			--keep-empty --root --force-rebase --no-ff
			--exec
			"

		return
	esac
	__gitcomp_nl "$(__git_refs)"
}

_git_reflog ()
{
	local subcommands="show delete expire"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"

	if [ -z "$subcommand" ]; then
		__gitcomp "$subcommands"
	else
		__gitcomp_nl "$(__git_refs)"
	fi
}

__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"

_git_send_email ()
{
	case "$prev" in
	--to|--cc|--bcc|--from)
		__gitcomp "
		$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
		"
		return
		;;
	esac

	case "$cur" in
	--confirm=*)
		__gitcomp "
................................................................................
	--thread=*)
		__gitcomp "
			deep shallow
			" "" "${cur##--thread=}"
		return
		;;
	--to=*|--cc=*|--bcc=*|--from=*)
		__gitcomp "
		$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
		" "" "${cur#--*=}"
		return
		;;
	--*)
		__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
			--compose --confirm= --dry-run --envelope-sender
			--from --identity
			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
................................................................................
	__git_complete_revlist
}

_git_stage ()
{
	_git_add
}



















































__git_config_get_set_variables ()
{
	local prevword word config_file= c=$cword
	while [ $c -gt 1 ]; do
		word="${words[c]}"
		case "$word" in
................................................................................
			break
			;;
		esac
		prevword=$word
		c=$((--c))
	done

	git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null
}

_git_config ()
{
	case "$prev" in
	branch.*.remote|branch.*.pushremote)
		__gitcomp_nl "$(__git_remotes)"
		return
		;;
	branch.*.merge)
		__gitcomp_nl "$(__git_refs)"
		return
		;;
	branch.*.rebase)
		__gitcomp "false true preserve interactive"
		return
		;;
	remote.pushdefault)
................................................................................
		fi
		__gitcomp_nl "$(__git_refs_remotes "$remote")"
		return
		;;
	remote.*.push)
		local remote="${prev#remote.}"
		remote="${remote%.push}"
		__gitcomp_nl "$(git --git-dir="$(__gitdir)" \
			for-each-ref --format='%(refname):%(refname)' \
			refs/heads)"
		return
		;;
	pull.twohead|pull.octopus)
		__git_compute_merge_strategies
		__gitcomp "$__git_merge_strategies"
		return
		;;
................................................................................
	branch.*.*)
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
		return
		;;
	branch.*)
		local pfx="${cur%.*}." cur_="${cur#*.}"
		__gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."
		__gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_"
		return
		;;
	guitool.*.*)
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "
			argprompt cmd confirm needsfile noconsole norescan
................................................................................
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
		return
		;;
	esac
	__gitcomp "
		add.ignoreErrors

		advice.commitBeforeMerge
		advice.detachedHead
		advice.implicitIdentity



		advice.pushNonFastForward


		advice.resolveConflict

		advice.statusHints

		alias.
		am.keepcr

		apply.ignorewhitespace
		apply.whitespace
		branch.autosetupmerge
		branch.autosetuprebase
		browser.
		clean.requireForce
		color.branch
................................................................................
		color.interactive.prompt
		color.pager
		color.showbranch
		color.status
		color.status.added
		color.status.changed
		color.status.header

		color.status.nobranch

		color.status.unmerged
		color.status.untracked
		color.status.updated
		color.ui


		commit.status
		commit.template

		core.abbrev
		core.askpass
		core.attributesfile
		core.autocrlf
		core.bare
		core.bigFileThreshold


		core.compression
		core.createObject
		core.deltaBaseCacheLimit
		core.editor
		core.eol
		core.excludesfile
		core.fileMode
		core.fsyncobjectfiles
		core.gitProxy


		core.ignoreStat
		core.ignorecase
		core.logAllRefUpdates
		core.loosecompression
		core.notesRef
		core.packedGitLimit
		core.packedGitWindowSize

		core.pager

		core.preferSymlinkRefs
		core.preloadindex


		core.quotepath
		core.repositoryFormatVersion
		core.safecrlf
		core.sharedRepository
		core.sparseCheckout


		core.symlinks
		core.trustctime
		core.untrackedCache
		core.warnAmbiguousRefs
		core.whitespace
		core.worktree




		diff.autorefreshindex
		diff.external
		diff.ignoreSubmodules
		diff.mnemonicprefix
		diff.noprefix
		diff.renameLimit
		diff.renames
................................................................................
		difftool.
		difftool.prompt
		fetch.recurseSubmodules
		fetch.unpackLimit
		format.attach
		format.cc
		format.coverLetter

		format.headers
		format.numbered
		format.pretty
		format.signature
		format.signoff
		format.subjectprefix
		format.suffix
		format.thread
		format.to
		gc.

		gc.aggressiveWindow
		gc.auto

		gc.autopacklimit

		gc.packrefs
		gc.pruneexpire
		gc.reflogexpire
		gc.reflogexpireunreachable
		gc.rerereresolved
		gc.rerereunresolved

		gitcvs.allbinary
		gitcvs.commitmsgannotation
		gitcvs.dbTableNamePrefix
		gitcvs.dbdriver
		gitcvs.dbname
		gitcvs.dbpass
		gitcvs.dbuser
................................................................................
		sendemail.smtpserverport
		sendemail.smtpuser
		sendemail.suppresscc
		sendemail.suppressfrom
		sendemail.thread
		sendemail.to
		sendemail.validate


		showbranch.default
		status.relativePaths
		status.showUntrackedFiles
		status.submodulesummary
		submodule.
		tar.umask
		transfer.unpackLimit
................................................................................
		web.browser
		branch. remote.
	"
}

_git_remote ()
{

	local subcommands="add rename remove set-head set-branches set-url show prune update"


	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then





		__gitcomp "$subcommands"


		return
	fi

	case "$subcommand" in
	rename|remove|set-url|show|prune)








		__gitcomp_nl "$(__git_remotes)"
		;;
	set-head|set-branches)
		__git_complete_remote_or_refspec
		;;



	update)
		__gitcomp "$(__git_get_config_variables "remotes")"
		;;









	*)

		;;
	esac
}

_git_replace ()
{
	__gitcomp_nl "$(__git_refs)"

















}

_git_reset ()
{
	__git_has_doubledash && return

	case "$cur" in
	--*)
		__gitcomp "--merge --mixed --hard --soft --patch"
		return
		;;
	esac
	__gitcomp_nl "$(__git_refs)"
}

_git_revert ()
{
	local dir="$(__gitdir)"
	if [ -f "$dir"/REVERT_HEAD ]; then
		__gitcomp "--continue --quit --abort"
		return
	fi
	case "$cur" in
	--*)

		__gitcomp "--edit --mainline --no-edit --no-commit --signoff"


		return
		;;
	esac
	__gitcomp_nl "$(__git_refs)"
}

_git_rm ()
{
	case "$cur" in
	--*)
		__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
................................................................................
	__git_has_doubledash && return

	case "$cur" in
	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_shortlog_options
			--numbered --summary
			"
		return
		;;
	esac
	__git_complete_revlist
}

................................................................................
		__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
			" "" "${cur#*=}"
		return
		;;
	--diff-algorithm=*)
		__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
		return




		;;
	--*)
		__gitcomp "--pretty= --format= --abbrev-commit --oneline
			--show-signature
			$__git_diff_common_options
			"
		return
................................................................................
	esac
	__git_complete_revlist
}

_git_stash ()
{
	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
	local subcommands='save list show apply clear drop pop create branch'
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		case "$cur" in
		--*)
			__gitcomp "$save_opts"
			;;
		*)
................................................................................
			if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
				__gitcomp "$subcommands"
			fi
			;;
		esac
	else
		case "$subcommand,$cur" in



		save,--*)
			__gitcomp "$save_opts"
			;;
		apply,--*|pop,--*)
			__gitcomp "--index --quiet"
			;;
		drop,--*)
			__gitcomp "--quiet"
			;;
		show,--*|branch,--*)
			;;
		branch,*)
			if [ $cword -eq 3 ]; then
				__gitcomp_nl "$(__git_refs)";
			else
				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
						| sed -n -e 's/:.*//p')"
			fi
			;;
		show,*|apply,*|drop,*|pop,*)
			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
					| sed -n -e 's/:.*//p')"
			;;
		*)
			;;
		esac
	fi
}

_git_submodule ()
{
	__git_has_doubledash && return

	local subcommands="add status init deinit update summary foreach sync"
	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then

		case "$cur" in
		--*)
			__gitcomp "--quiet --cached"
			;;
		*)
			__gitcomp "$subcommands"
			;;
		esac
		return
	fi



























}

_git_svn ()
{
	local subcommands="
		init fetch clone rebase dcommit log find-rev
		set-tree commit-diff info create-ignore propget
................................................................................
	else
		local remote_opts="--username= --config-dir= --no-auth-cache"
		local fc_opts="
			--follow-parent --authors-file= --repack=
			--no-metadata --use-svm-props --use-svnsync-props
			--log-window-size= --no-checkout --quiet
			--repack-flags --use-log-author --localtime

			--ignore-paths= --include-paths= $remote_opts
			"
		local init_opts="
			--template= --shared= --trunk= --tags=
			--branches= --stdlayout --minimize-url
			--no-metadata --use-svm-props --use-svnsync-props
			--rewrite-root= --prefix= --use-log-author
			--add-author-from $remote_opts
			"
		local cmt_opts="
			--edit --rmdir --find-copies-harder --copy-similarity=
			"

		case "$subcommand,$cur" in
		fetch,--*)
................................................................................
_git_tag ()
{
	local i c=1 f=0
	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		-d|-v)
			__gitcomp_nl "$(__git_tags)"
			return
			;;
		-f)
			f=1
			;;
		esac
		((c++))
................................................................................
	done

	case "$prev" in
	-m|-F)
		;;
	-*|tag)
		if [ $f = 1 ]; then
			__gitcomp_nl "$(__git_tags)"
		fi
		;;
	*)
		__gitcomp_nl "$(__git_refs)"
		;;
	esac

	case "$cur" in
	--*)
		__gitcomp "
			--list --delete --verify --annotate --message --file
			--sign --cleanup --local-user --force --column --sort
			--contains --points-at
			"
		;;
	esac
}

_git_whatchanged ()
{
	_git_log
}



























__git_main ()
{
	local i c=1 command __git_dir


	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
		--git-dir)   ((c++)) ; __git_dir="${words[c]}" ;;
		--bare)      __git_dir="." ;;
		--help) command="help"; break ;;
		-c|--work-tree|--namespace) ((c++)) ;;




		-*) ;;
		*) command="$i"; break ;;
		esac
		((c++))
	done

	if [ -z "$command" ]; then











		case "$cur" in
		--*)   __gitcomp "
			--paginate
			--no-pager
			--git-dir=
			--bare
			--version
................................................................................
		*)     __git_compute_porcelain_commands
		       __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;;
		esac
		return
	fi

	local completion_func="_git_${command//-/_}"
	declare -f $completion_func >/dev/null && $completion_func && return

	local expansion=$(__git_aliased_command "$command")
	if [ -n "$expansion" ]; then
		words[1]=$expansion
		completion_func="_git_${expansion//-/_}"
		declare -f $completion_func >/dev/null && $completion_func
	fi
}

__gitk_main ()
{
	__git_has_doubledash && return

	local g="$(__gitdir)"


	local merge=""
	if [ -f "$g/MERGE_HEAD" ]; then
		merge="--merge"
	fi
	case "$cur" in
	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_gitk_options
................................................................................
				array[${#array[@]}+1]="$c"
			done
			compset -P '*[=:]'
			compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
			;;
		esac
	}










	__gitcomp_nl ()
	{
		emulate -L zsh

		local IFS=$'\n'
		compset -P '*[=:]'







>
>
>
>
>
>
>
>






|
|
|
>

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






>
>
>
>
>
>
>
>







 







|
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|


|
|











|

<
|
|
|
|
|
|
|
<


>
>
>
>
>


<
<
<
>
>
>
|
<
<


>
>


<
<
<
>
>
>
|
<
<


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


|
>

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


<
>




>
>
|
>
>
>
>

|
<
>
>
>


<
>
|




|
|
|
<
<
<
<
<
<
|



|

|



|




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




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|







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







 







|







 







|




|


|







 







>







 







|

|




|

|




|

|







 







|







 







<
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|







 







>











|




<
|
>
>
>
>
>







 







|







 







>
|









|













|
|






|




|

|
>




|

|







 







|
>





|
>
|
|

<
>






|




|
|








|







 







>

>
>
>





>
>





|












|



|











>




|













|
>



|



>
>







 







>










>
>
>
>







 







>







 







|







 







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







 







>
>







|
<
<
<



|






|






|
|







 







>
>
>
>
>
>







 







>

<

|


>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>











>










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|


|










|













|







 







|








|







 







|







 







|









|


|







 







|
|
|

>
|
|







 







|










|










<
|
<







 







<
<
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|










|







 







|
|
<







 







|







 







>



>
>
>
|
>
>

>

>


>







 







>

>




>
>


>






>
>









>
>







>

>


>
>





>
>






>
>
>
>







 







>










>


>

>






>







 







>
>







 







>
|
>
>


>
>
>
>
>
|
>
>



|
|
>
>
>
>
>
>
>
>
|

|


>
>
>
|


>
>
>
>
>
>
>
>
>

>






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








|



|




|
|





>
|
>
>



|







 







|







 







>
>
>
>







 







|







 







>
>
>













|

|




|













|
>


|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>






|
<







 







|







 







|



|







|
|










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
>









>
>
>
>







>
>
>
>
>
>
>
>
>
>
>







 







|





|







|
>
>

|







 







>
>
>
>
>
>
>
>
>







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
...
107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
...
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
...
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
...
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
...
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
...
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
...
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
...
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
...
936
937
938
939
940
941
942

943
944
945
946
947
948
949
950
...
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
....
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
....
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129

1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
....
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
....
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
....
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263

1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
....
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
....
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
....
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
....
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
....
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
....
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609



1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
....
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
....
1707
1708
1709
1710
1711
1712
1713
1714
1715

1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
....
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
....
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
....
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
....
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
....
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
....
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
....
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044

2045

2046
2047
2048
2049
2050
2051
2052
....
2068
2069
2070
2071
2072
2073
2074


2075
2076
2077
2078
2079
2080
2081
2082
....
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
....
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
....
2197
2198
2199
2200
2201
2202
2203
2204
2205

2206
2207
2208
2209
2210
2211
2212
....
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
....
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
....
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
....
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
....
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
....
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
....
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
....
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
....
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
....
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
....
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966

2967
2968
2969
2970
2971
2972
2973
....
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
....
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
....
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
....
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
#       see git-prompt.sh for details.
#
# If you use complex aliases of form '!f() { ... }; f', you can use the null
# command ':' as the first command in the function body to declare the desired
# completion style.  For example '!f() { : git commit ; ... }; f' will
# tell the completion to use commit completion.  This also works with aliases
# of form "!sh -c '...'".  For example, "!sh -c ': git commit ; ... '".
#
# You can set the following environment variables to influence the behavior of
# the completion routines:
#
#   GIT_COMPLETION_CHECKOUT_NO_GUESS
#
#     When set to "1", do not include "DWIM" suggestions in git-checkout
#     completion (e.g., completing "foo" when "origin/foo" exists).

case "$COMP_WORDBREAKS" in
*:*) : great ;;
*)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac

# Discovers the path to the git repository taking any '--git-dir=<path>' and
# '-C <path>' options into account and stores it in the $__git_repo_path
# variable.
__git_find_repo_path ()
{

	if [ -n "$__git_repo_path" ]; then
		# we already know where it is
		return
	fi

	if [ -n "${__git_C_args-}" ]; then
		__git_repo_path="$(git "${__git_C_args[@]}" \
			${__git_dir:+--git-dir="$__git_dir"} \
			rev-parse --absolute-git-dir 2>/dev/null)"
	elif [ -n "${__git_dir-}" ]; then
		test -d "$__git_dir" &&
		__git_repo_path="$__git_dir"
	elif [ -n "${GIT_DIR-}" ]; then
		test -d "${GIT_DIR-}" &&
		__git_repo_path="$GIT_DIR"
	elif [ -d .git ]; then

		__git_repo_path=.git
	else
		__git_repo_path="$(git rev-parse --git-dir 2>/dev/null)"
	fi
}

# Deprecated: use __git_find_repo_path() and $__git_repo_path instead
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
	if [ -z "${1-}" ]; then
		__git_find_repo_path || return 1
		echo "$__git_repo_path"
	elif [ -d "$1/.git" ]; then
		echo "$1/.git"
	else
		echo "$1"
	fi
}

# Runs git with all the options given as argument, respecting any
# '--git-dir=<path>' and '-C <path>' options present on the command line
__git ()
{
	git ${__git_C_args:+"${__git_C_args[@]}"} \
		${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
}

# The following function is based on code from:
#
#   bash_completion - programmable completion functions for bash 3.2+
#
#   Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
#             © 2009-2010, Bash Completion Maintainers
................................................................................
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, see <http://www.gnu.org/licenses/>.

#
#   The latest version of this software can be obtained here:
#
#   http://bash-completion.alioth.debian.org/
#
#   RELEASE: 2.x

................................................................................
			cword=$cword_
			;;
		esac
		shift
	done
}
fi

# Fills the COMPREPLY array with prefiltered words without any additional
# processing.
# Callers must take care of providing only words that match the current word
# to be completed and adding any prefix and/or suffix (trailing space!), if
# necessary.
# 1: List of newline-separated matching completion words, complete with
#    prefix and suffix.
__gitcomp_direct ()
{
	local IFS=$'\n'

	COMPREPLY=($1)
}

__gitcompappend ()
{
	local x i=${#COMPREPLY[@]}
	for x in $1; do
		if [[ "$x" == "$3"* ]]; then
			COMPREPLY[i++]="$2$x$4"
................................................................................
# Execute 'git ls-files', unless the --committable option is specified, in
# which case it runs 'git diff-index' to find out the files that can be
# committed.  It return paths relative to the directory specified in the first
# argument, and using the options specified in the second argument.
__git_ls_files_helper ()
{
	if [ "$2" == "--committable" ]; then
		__git -C "$1" diff-index --name-only --relative HEAD
	else
		# NOTE: $2 is not quoted in order to support multiple options
		__git -C "$1" ls-files --exclude-standard $2
	fi
}


# __git_index_files accepts 1 or 2 arguments:
# 1: Options to pass to ls-files (required).
# 2: A directory path (optional).
#    If provided, only files within the specified directory are listed.
#    Sub directories are never recursed.  Path must have a trailing
#    slash.
__git_index_files ()
{
	local root="${2-.}" file


	__git_ls_files_helper "$root" "$1" |
	while read -r file; do
		case "$file" in
		?*/*) echo "${file%%/*}" ;;
		*) echo "$file" ;;
		esac
	done | sort | uniq

}

# Lists branches from the local repository.
# 1: A prefix to be added to each listed branch (optional).
# 2: List only branches matching this word (optional; list all branches if
#    unset or empty).
# 3: A suffix to be appended to each listed branch (optional).
__git_heads ()
{



	local pfx="${1-}" cur_="${2-}" sfx="${3-}"

	__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
			"refs/heads/$cur_*" "refs/heads/$cur_*/**"


}

# Lists tags from the local repository.
# Accepts the same positional parameters as __git_heads() above.
__git_tags ()
{



	local pfx="${1-}" cur_="${2-}" sfx="${3-}"

	__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
			"refs/tags/$cur_*" "refs/tags/$cur_*/**"


}


# Lists refs from the local (by default) or from a remote repository.
# It accepts 0, 1 or 2 arguments:
# 1: The remote to list refs from (optional; ignored, if set but empty).
#    Can be the name of a configured remote, a path, or a URL.
# 2: In addition to local refs, list unique branches from refs/remotes/ for
#    'git checkout's tracking DWIMery (optional; ignored, if set but empty).
# 3: A prefix to be added to each listed ref (optional).
# 4: List only refs matching this word (optional; list all refs if unset or
#    empty).
# 5: A suffix to be appended to each listed ref (optional; ignored, if set
#    but empty).
#
# Use __git_complete_refs() instead.
__git_refs ()
{
	local i hash dir track="${2-}"
	local list_refs_from=path remote="${1-}"
	local format refs
	local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
	local match="${4-}"
	local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers

	__git_find_repo_path
	dir="$__git_repo_path"

	if [ -z "$remote" ]; then
		if [ -z "$dir" ]; then
			return
		fi
	else
		if __git_is_configured_remote "$remote"; then
			# configured remote takes precedence over a
			# local directory with the same name
			list_refs_from=remote
		elif [ -d "$remote/.git" ]; then
			dir="$remote/.git"
		elif [ -d "$remote" ]; then
			dir="$remote"
		else
			list_refs_from=url
		fi
	fi

	if [ "$list_refs_from" = path ]; then
		if [[ "$cur_" == ^* ]]; then
			pfx="$pfx^"
			fer_pfx="$fer_pfx^"
			cur_=${cur_#^}
			match=${match#^}
		fi
		case "$cur_" in
		refs|refs/*)
			format="refname"

			refs=("$match*" "$match*/**")
			track=""
			;;
		*)
			for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
				case "$i" in
				$match*)
					if [ -e "$dir/$i" ]; then
						echo "$pfx$i$sfx"
					fi
					;;
				esac
			done
			format="refname:strip=2"

			refs=("refs/tags/$match*" "refs/tags/$match*/**"
				"refs/heads/$match*" "refs/heads/$match*/**"
				"refs/remotes/$match*" "refs/remotes/$match*/**")
			;;
		esac

		__git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
			"${refs[@]}"
		if [ -n "$track" ]; then
			# employ the heuristic used by git checkout
			# Try to find a remote branch that matches the completion word
			# but only output if the branch name is unique
			__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
				--sort="refname:strip=3" \
				"refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \






			uniq -u
		fi
		return
	fi
	case "$cur_" in
	refs|refs/*)
		__git ls-remote "$remote" "$match*" | \
		while read -r hash i; do
			case "$i" in
			*^{}) ;;
			*) echo "$pfx$i$sfx" ;;
			esac
		done
		;;
	*)
		if [ "$list_refs_from" = remote ]; then
			case "HEAD" in
			$match*)	echo "${pfx}HEAD$sfx" ;;
			esac
			__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
				"refs/remotes/$remote/$match*" \
				"refs/remotes/$remote/$match*/**"
		else
			local query_symref
			case "HEAD" in
			$match*)	query_symref="HEAD" ;;
			esac
			__git ls-remote "$remote" $query_symref \
				"refs/tags/$match*" "refs/heads/$match*" \
				"refs/remotes/$match*" |
			while read -r hash i; do
				case "$i" in
				*^{})	;;
				refs/*)	echo "$pfx${i#refs/*/}$sfx" ;;
				*)	echo "$pfx$i$sfx" ;;  # symbolic refs
				esac
			done
		fi
		;;
	esac
}

# Completes refs, short and long, local and remote, symbolic and pseudo.
#
# Usage: __git_complete_refs [<option>]...
# --remote=<remote>: The remote to list refs from, can be the name of a
#                    configured remote, a path, or a URL.
# --track: List unique remote branches for 'git checkout's tracking DWIMery.
# --pfx=<prefix>: A prefix to be added to each ref.
# --cur=<word>: The current ref to be completed.  Defaults to the current
#               word to be completed.
# --sfx=<suffix>: A suffix to be appended to each ref instead of the default
#                 space.
__git_complete_refs ()
{
	local remote track pfx cur_="$cur" sfx=" "

	while test $# != 0; do
		case "$1" in
		--remote=*)	remote="${1##--remote=}" ;;
		--track)	track="yes" ;;
		--pfx=*)	pfx="${1##--pfx=}" ;;
		--cur=*)	cur_="${1##--cur=}" ;;
		--sfx=*)	sfx="${1##--sfx=}" ;;
		*)		return 1 ;;
		esac
		shift
	done

	__gitcomp_direct "$(__git_refs "$remote" "$track" "$pfx" "$cur_" "$sfx")"
}

# __git_refs2 requires 1 argument (to pass to __git_refs)
# Deprecated: use __git_complete_fetch_refspecs() instead.
__git_refs2 ()
{
	local i
	for i in $(__git_refs "$1"); do
		echo "$i:$i"
	done
}

# Completes refspecs for fetching from a remote repository.
# 1: The remote repository.
# 2: A prefix to be added to each listed refspec (optional).
# 3: The ref to be completed as a refspec instead of the current word to be
#    completed (optional)
# 4: A suffix to be appended to each listed refspec instead of the default
#    space (optional).
__git_complete_fetch_refspecs ()
{
	local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }"

	__gitcomp_direct "$(
		for i in $(__git_refs "$remote" "" "" "$cur_") ; do
			echo "$pfx$i:$i$sfx"
		done
		)"
}

# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
	local i hash
	__git ls-remote "$1" 'refs/heads/*' | \
	while read -r hash i; do
		echo "$i:refs/remotes/$1/${i#refs/heads/}"
	done
}

__git_remotes ()
{
	__git_find_repo_path
	test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes"
	__git remote
}

# Returns true if $1 matches the name of a configured remote, false otherwise.
__git_is_configured_remote ()
{
	local remote
	for remote in $(__git_remotes); do
		if [ "$remote" = "$1" ]; then
			return 0
		fi
	done
	return 1
}

__git_list_merge_strategies ()
{
	git merge -s help 2>&1 |
	sed -n -e '/[Aa]vailable strategies are: /,/^$/{
		s/\.$//
................................................................................
		esac

		case "$COMP_WORDBREAKS" in
		*:*) : great ;;
		*)   pfx="$ref:$pfx" ;;
		esac

		__gitcomp_nl "$(__git ls-tree "$ls" \
				| sed '/^100... blob /{
				           s,^.*	,,
				           s,$, ,
				       }
				       /^120000 blob /{
				           s,^.*	,,
				           s,$, ,
................................................................................
				       }
				       s/^.*	//')" \
			"$pfx" "$cur_" ""
		;;
	*...*)
		pfx="${cur_%...*}..."
		cur_="${cur_#*...}"
		__git_complete_refs --pfx="$pfx" --cur="$cur_"
		;;
	*..*)
		pfx="${cur_%..*}.."
		cur_="${cur_#*..}"
		__git_complete_refs --pfx="$pfx" --cur="$cur_"
		;;
	*)
		__git_complete_refs
		;;
	esac
}


# __git_complete_index_file requires 1 argument:
# 1: the options to pass to ls-file
................................................................................
	if [ "$cmd" = "remote" ]; then
		((c++))
	fi
	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
		-d|--delete) [ "$cmd" = "push" ] && lhs=0 ;;
		--all)
			case "$cmd" in
			push) no_complete_refspec=1 ;;
			fetch)
				return
				;;
			*) ;;
................................................................................
		pfx="+"
		cur_="${cur_#+}"
		;;
	esac
	case "$cmd" in
	fetch)
		if [ $lhs = 1 ]; then
			__git_complete_fetch_refspecs "$remote" "$pfx" "$cur_"
		else
			__git_complete_refs --pfx="$pfx" --cur="$cur_"
		fi
		;;
	pull|remote)
		if [ $lhs = 1 ]; then
			__git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
		else
			__git_complete_refs --pfx="$pfx" --cur="$cur_"
		fi
		;;
	push)
		if [ $lhs = 1 ]; then
			__git_complete_refs --pfx="$pfx" --cur="$cur_"
		else
			__git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
		fi
		;;
	esac
}

__git_complete_strategy ()
{
................................................................................
}

# Lists all set config variables starting with the given section prefix,
# with the prefix removed.
__git_get_config_variables ()
{
	local section="$1" i IFS=$'\n'
	for i in $(__git config --name-only --get-regexp "^$section\..*"); do
		echo "${i#$section.}"
	done
}

__git_pretty_aliases ()
{
	__git_get_config_variables "pretty"
................................................................................
{
	__git_get_config_variables "alias"
}

# __git_aliased_command requires 1 argument
__git_aliased_command ()
{

	local word cmdline=$(__git config --get "alias.$1")
	for word in $cmdline; do
		case "$word" in
		\!gitk|gitk)
			echo "gitk"
			return
			;;
		\!*)	: shell command alias ;;
................................................................................
				echo "$subcommand"
				return
			fi
		done
		((c++))
	done
}

# Echo the value of an option set on the command line or config
#
# $1: short option name
# $2: long option name including =
# $3: list of possible values
# $4: config string (optional)
#
# example:
# result="$(__git_get_option_value "-d" "--do-something=" \
#     "yes no" "core.doSomething")"
#
# result is then either empty (no option set) or "yes" or "no"
#
# __git_get_option_value requires 3 arguments
__git_get_option_value ()
{
	local c short_opt long_opt val
	local result= values config_key word

	short_opt="$1"
	long_opt="$2"
	values="$3"
	config_key="$4"

	((c = $cword - 1))
	while [ $c -ge 0 ]; do
		word="${words[c]}"
		for val in $values; do
			if [ "$short_opt$val" = "$word" ] ||
			   [ "$long_opt$val"  = "$word" ]; then
				result="$val"
				break 2
			fi
		done
		((c--))
	done

	if [ -n "$config_key" ] && [ -z "$result" ]; then
		result="$(__git config "$config_key")"
	fi

	echo "$result"
}

__git_has_doubledash ()
{
	local c=1
	while [ $c -lt $cword ]; do
		if [ "--" = "${words[c]}" ]; then
			return 0
................................................................................
	printf "%d" $c
}

__git_whitespacelist="nowarn warn error error-all fix"

_git_am ()
{
	__git_find_repo_path
	if [ -d "$__git_repo_path"/rebase-apply ]; then
		__gitcomp "--skip --continue --resolved --abort"
		return
	fi
	case "$cur" in
	--whitespace=*)
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
		return
................................................................................
	--*)
		__gitcomp "
			--stat --numstat --summary --check --index
			--cached --index-info --reverse --reject --unidiff-zero
			--apply --no-add --exclude=
			--ignore-whitespace --ignore-space-change
			--whitespace= --inaccurate-eof --verbose
			--recount --directory=
			"
		return
	esac
}

_git_add ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--interactive --refresh --patch --update --dry-run
			--ignore-errors --intent-to-add --force --edit --chmod=
			"
		return
	esac


	local complete_opt="--others --modified --directory --no-empty-directory"
	if test -n "$(__git_find_on_cmdline "-u --update")"
	then
		complete_opt="--modified"
	fi
	__git_complete_index_file "$complete_opt"
}

_git_archive ()
{
	case "$cur" in
	--format=*)
		__gitcomp "$(git archive --list)" "" "${cur##--format=}"
................................................................................
	--remote=*)
		__gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}"
		return
		;;
	--*)
		__gitcomp "
			--format= --list --verbose
			--prefix= --remote= --exec= --output
			"
		return
		;;
	esac
	__git_complete_file
}

................................................................................
_git_bisect ()
{
	__git_has_doubledash && return

	local subcommands="start bad good skip reset visualize replay log run"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		__git_find_repo_path
		if [ -f "$__git_repo_path"/BISECT_START ]; then
			__gitcomp "$subcommands"
		else
			__gitcomp "replay start"
		fi
		return
	fi

	case "$subcommand" in
	bad|good|reset|skip|start)
		__git_complete_refs
		;;
	*)
		;;
	esac
}

_git_branch ()
{
	local i c=1 only_local_ref="n" has_r="n"

	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		-d|--delete|-m|--move)	only_local_ref="y" ;;
		-r|--remotes)		has_r="y" ;;
		esac
		((c++))
	done

	case "$cur" in
	--set-upstream-to=*)
		__git_complete_refs --cur="${cur##--set-upstream-to=}"
		;;
	--*)
		__gitcomp "
			--color --no-color --verbose --abbrev= --no-abbrev
			--track --no-track --contains --no-contains --merged --no-merged
			--set-upstream-to= --edit-description --list
			--unset-upstream --delete --move --remotes
			--column --no-column --sort= --points-at
			"
		;;
	*)
		if [ $only_local_ref = "y" -a $has_r = "n" ]; then
			__gitcomp_direct "$(__git_heads "" "$cur" " ")"
		else
			__git_complete_refs
		fi
		;;
	esac
}

_git_bundle ()
{
................................................................................
	case "$cur" in
	--conflict=*)
		__gitcomp "diff3 merge" "" "${cur##--conflict=}"
		;;
	--*)
		__gitcomp "
			--quiet --ours --theirs --track --no-track --merge
			--conflict= --orphan --patch --detach --ignore-skip-worktree-bits
			--recurse-submodules --no-recurse-submodules
			"
		;;
	*)
		# check if --track, --no-track, or --no-guess was specified
		# if so, disable DWIM mode
		local flags="--track --no-track --no-guess" track_opt="--track"
		if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
		   [ -n "$(__git_find_on_cmdline "$flags")" ]; then
			track_opt=''
		fi

		__git_complete_refs $track_opt
		;;
	esac
}

_git_cherry ()
{
	__git_complete_refs
}

_git_cherry_pick ()
{
	__git_find_repo_path
	if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
		__gitcomp "--continue --quit --abort"
		return
	fi
	case "$cur" in
	--*)
		__gitcomp "--edit --no-commit --signoff --strategy= --mainline"
		;;
	*)
		__git_complete_refs
		;;
	esac
}

_git_clean ()
{
	case "$cur" in
................................................................................
			--bare
			--mirror
			--origin
			--upload-pack
			--template=
			--depth
			--single-branch
			--no-tags
			--branch
			--recurse-submodules
			--no-single-branch
			--shallow-submodules
			"
		return
		;;
	esac
}

__git_untracked_file_modes="all no normal"

_git_commit ()
{
	case "$prev" in
	-c|-C)
		__git_complete_refs
		return
		;;
	esac

	case "$cur" in
	--cleanup=*)
		__gitcomp "default scissors strip verbatim whitespace
			" "" "${cur##--cleanup=}"
		return
		;;
	--reuse-message=*|--reedit-message=*|\
	--fixup=*|--squash=*)
		__git_complete_refs --cur="${cur#*=}"
		return
		;;
	--untracked-files=*)
		__gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
		return
		;;
	--*)
		__gitcomp "
			--all --author= --signoff --verify --no-verify
			--edit --no-edit
			--amend --include --only --interactive
			--dry-run --reuse-message= --reedit-message=
			--reset-author --file= --message= --template=
			--cleanup= --untracked-files --untracked-files=
			--verbose --quiet --fixup= --squash=
			--patch --short --date --allow-empty
			"
		return
	esac

	if __git rev-parse --verify --quiet HEAD >/dev/null; then
		__git_complete_index_file "--committable"
	else
		# This is the first commit
		__git_complete_index_file "--cached"
	fi
}

_git_describe ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--all --tags --contains --abbrev= --candidates=
			--exact-match --debug --long --match --always --first-parent
			--exclude --dirty --broken
			"
		return
	esac
	__git_complete_refs
}

__git_diff_algorithms="myers minimal patience histogram"

__git_diff_submodule_formats="diff log short"

__git_diff_common_options="--stat --numstat --shortstat --summary
			--patch-with-stat --name-only --name-status --color
			--no-color --color-words --no-renames --check
			--full-index --binary --abbrev --diff-filter=
			--find-copies-harder
			--text --ignore-space-at-eol --ignore-space-change
................................................................................
			--no-prefix --src-prefix= --dst-prefix=
			--inter-hunk-context=
			--patience --histogram --minimal
			--raw --word-diff --word-diff-regex=
			--dirstat --dirstat= --dirstat-by-file
			--dirstat-by-file= --cumulative
			--diff-algorithm=
			--submodule --submodule=
"

_git_diff ()
{
	__git_has_doubledash && return

	case "$cur" in
	--diff-algorithm=*)
		__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
		return
		;;
	--submodule=*)
		__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
		return
		;;
	--*)
		__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
			--base --ours --theirs --no-index
			$__git_diff_common_options
			"
		return
................................................................................
}

__git_fetch_recurse_submodules="yes on-demand no"

__git_fetch_options="
	--quiet --verbose --append --upload-pack --force --keep --depth=
	--tags --no-tags --all --prune --dry-run --recurse-submodules=
	--unshallow --update-shallow
"

_git_fetch ()
{
	case "$cur" in
	--recurse-submodules=*)
		__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
................................................................................

_git_fsck ()
{
	case "$cur" in
	--*)
		__gitcomp "
			--tags --root --unreachable --cache --no-reflogs --full
			--strict --verbose --lost-found --name-objects
			"
		return
		;;
	esac
}

_git_gc ()
................................................................................
}

_git_gitk ()
{
	_gitk
}

# Lists matching symbol names from a tag (as in ctags) file.
# 1: List symbol names matching this word.
# 2: The tag file to list symbol names from.
# 3: A prefix to be added to each listed symbol name (optional).
# 4: A suffix to be appended to each listed symbol name (optional).
__git_match_ctag () {
	awk -v pfx="${3-}" -v sfx="${4-}" "
		/^${1//\//\\/}/ { print pfx \$1 sfx }
		" "$2"
}

# Complete symbol names from a tag file.
# Usage: __git_complete_symbol [<option>]...
# --tags=<file>: The tag file to list symbol names from instead of the
#                default "tags".
# --pfx=<prefix>: A prefix to be added to each symbol name.
# --cur=<word>: The current symbol name to be completed.  Defaults to
#               the current word to be completed.
# --sfx=<suffix>: A suffix to be appended to each symbol name instead
#                 of the default space.
__git_complete_symbol () {
	local tags=tags pfx="" cur_="${cur-}" sfx=" "

	while test $# != 0; do
		case "$1" in
		--tags=*)	tags="${1##--tags=}" ;;
		--pfx=*)	pfx="${1##--pfx=}" ;;
		--cur=*)	cur_="${1##--cur=}" ;;
		--sfx=*)	sfx="${1##--sfx=}" ;;
		*)		return 1 ;;
		esac
		shift
	done

	if test -r "$tags"; then
		__gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")"
	fi
}

_git_grep ()
{
	__git_has_doubledash && return

	case "$cur" in
................................................................................
			--perl-regexp
			--threads
			--files-with-matches --name-only
			--files-without-match
			--max-depth
			--count
			--and --or --not --all-match
			--break --heading --show-function --function-context
			--untracked --no-index
			"
		return
		;;
	esac

	case "$cword,$prev" in
	2,*|*,-*)
		__git_complete_symbol && return



		;;
	esac

	__git_complete_refs
}

_git_help ()
{
	case "$cur" in
	--*)
		__gitcomp "--all --guides --info --man --web"
		return
		;;
	esac
	__git_compute_all_commands
	__gitcomp "$__git_all_commands $(__git_aliases)
		attributes cli core-tutorial cvs-migration
		diffcore everyday gitk glossary hooks ignore modules
		namespaces repository-layout revisions tutorial tutorial-2
		workflows
		"
}

_git_init ()
{
	case "$cur" in
................................................................................
	# XXX ignore options like --modified and always suggest all cached
	# files.
	__git_complete_index_file "--cached"
}

_git_ls_remote ()
{
	case "$cur" in
	--*)
		__gitcomp "--heads --tags --refs --get-url --symref"
		return
		;;
	esac
	__gitcomp_nl "$(__git_remotes)"
}

_git_ls_tree ()
{
	__git_complete_file
}
................................................................................

__git_log_pretty_formats="oneline short medium full fuller email raw format:"
__git_log_date_formats="relative iso8601 rfc2822 short local default raw"

_git_log ()
{
	__git_has_doubledash && return
	__git_find_repo_path


	local merge=""
	if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
		merge="--merge"
	fi
	case "$prev,$cur" in
	-L,:*:*)
		return	# fall back to Bash filename completion
		;;
	-L,:*)
		__git_complete_symbol --cur="${cur#:}" --sfx=":"
		return
		;;
	-G,*|-S,*)
		__git_complete_symbol
		return
		;;
	esac
	case "$cur" in
	--pretty=*|--format=*)
		__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
			" "" "${cur#*=}"
		return
		;;
	--date=*)
................................................................................
		__gitcomp "$__git_log_date_formats" "" "${cur##--date=}"
		return
		;;
	--decorate=*)
		__gitcomp "full short no" "" "${cur##--decorate=}"
		return
		;;
	--diff-algorithm=*)
		__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
		return
		;;
	--submodule=*)
		__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
		return
		;;
	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_shortlog_options
			$__git_log_gitk_options
			--root --topo-order --date-order --reverse
			--follow --full-diff
			--abbrev-commit --abbrev=
			--relative-date --date=
			--pretty= --format= --oneline
			--show-signature
			--cherry-mark
			--cherry-pick
			--graph
			--decorate --decorate=
			--walk-reflogs
			--parents --children
			$merge
			$__git_diff_common_options
			--pickaxe-all --pickaxe-regex
			"
		return
		;;
	-L:*:*)
		return	# fall back to Bash filename completion
		;;
	-L:*)
		__git_complete_symbol --cur="${cur#-L:}" --sfx=":"
		return
		;;
	-G*)
		__git_complete_symbol --pfx="-G" --cur="${cur#-G}"
		return
		;;
	-S*)
		__git_complete_symbol --pfx="-S" --cur="${cur#-S}"
		return
		;;
	esac
	__git_complete_revlist
}

# Common merge options shared by git-merge(1) and git-pull(1).
__git_merge_options="
................................................................................
_git_merge ()
{
	__git_complete_strategy && return

	case "$cur" in
	--*)
		__gitcomp "$__git_merge_options
			--rerere-autoupdate --no-rerere-autoupdate --abort --continue"
		return
	esac
	__git_complete_refs
}

_git_mergetool ()
{
	case "$cur" in
	--tool=*)
		__gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}"
		return
		;;
	--*)
		__gitcomp "--tool= --prompt --no-prompt"
		return
		;;
	esac
}

_git_merge_base ()
{
	case "$cur" in
	--*)
		__gitcomp "--octopus --independent --is-ancestor --fork-point"
		return
		;;
	esac
	__git_complete_refs
}

_git_mv ()
{
	case "$cur" in
	--*)
		__gitcomp "--dry-run"
................................................................................
	case "$subcommand,$cur" in
	,--*)
		__gitcomp '--ref'
		;;
	,*)
		case "$prev" in
		--ref)
			__git_complete_refs
			;;
		*)
			__gitcomp "$subcommands --ref"
			;;
		esac
		;;
	add,--reuse-message=*|append,--reuse-message=*|\
	add,--reedit-message=*|append,--reedit-message=*)
		__git_complete_refs --cur="${cur#*=}"
		;;
	add,--*|append,--*)
		__gitcomp '--file= --message= --reedit-message=
				--reuse-message='
		;;
	copy,--*)
		__gitcomp '--stdin'
................................................................................
	prune,*)
		;;
	*)
		case "$prev" in
		-m|-F)
			;;
		*)
			__git_complete_refs
			;;
		esac
		;;
	esac
}

_git_pull ()
................................................................................
		"
		return
		;;
	esac
	__git_complete_remote_or_refspec
}

__git_push_recurse_submodules="check on-demand only"

__git_complete_force_with_lease ()
{
	local cur_=$1

	case "$cur_" in
	--*=)
		;;
	*:*)
		__git_complete_refs --cur="${cur_#*:}"
		;;
	*)
		__git_complete_refs --cur="$cur_"
		;;
	esac
}

_git_push ()
{
	case "$prev" in
................................................................................
		;;
	esac
	__git_complete_remote_or_refspec
}

_git_rebase ()
{
	__git_find_repo_path
	if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
		__gitcomp "--continue --skip --abort --quit --edit-todo"
		return
	elif [ -d "$__git_repo_path"/rebase-apply ] || \
	     [ -d "$__git_repo_path"/rebase-merge ]; then
		__gitcomp "--continue --skip --abort --quit"
		return
	fi
	__git_complete_strategy && return
	case "$cur" in
	--whitespace=*)
		__gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
		return
................................................................................
			--verify --no-verify
			--keep-empty --root --force-rebase --no-ff
			--exec
			"

		return
	esac
	__git_complete_refs
}

_git_reflog ()
{
	local subcommands="show delete expire"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"

	if [ -z "$subcommand" ]; then
		__gitcomp "$subcommands"
	else
		__git_complete_refs
	fi
}

__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"

_git_send_email ()
{
	case "$prev" in
	--to|--cc|--bcc|--from)

		__gitcomp "$(__git send-email --dump-aliases)"

		return
		;;
	esac

	case "$cur" in
	--confirm=*)
		__gitcomp "
................................................................................
	--thread=*)
		__gitcomp "
			deep shallow
			" "" "${cur##--thread=}"
		return
		;;
	--to=*|--cc=*|--bcc=*|--from=*)


		__gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}"
		return
		;;
	--*)
		__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
			--compose --confirm= --dry-run --envelope-sender
			--from --identity
			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
................................................................................
	__git_complete_revlist
}

_git_stage ()
{
	_git_add
}

_git_status ()
{
	local complete_opt
	local untracked_state

	case "$cur" in
	--ignore-submodules=*)
		__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
		return
		;;
	--untracked-files=*)
		__gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
		return
		;;
	--column=*)
		__gitcomp "
			always never auto column row plain dense nodense
			" "" "${cur##--column=}"
		return
		;;
	--*)
		__gitcomp "
			--short --branch --porcelain --long --verbose
			--untracked-files= --ignore-submodules= --ignored
			--column= --no-column
			"
		return
		;;
	esac

	untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \
		"$__git_untracked_file_modes" "status.showUntrackedFiles")"

	case "$untracked_state" in
	no)
		# --ignored option does not matter
		complete_opt=
		;;
	all|normal|*)
		complete_opt="--cached --directory --no-empty-directory --others"

		if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then
			complete_opt="$complete_opt --ignored --exclude=*"
		fi
		;;
	esac

	__git_complete_index_file "$complete_opt"
}

__git_config_get_set_variables ()
{
	local prevword word config_file= c=$cword
	while [ $c -gt 1 ]; do
		word="${words[c]}"
		case "$word" in
................................................................................
			break
			;;
		esac
		prevword=$word
		c=$((--c))
	done

	__git config $config_file --name-only --list
}

_git_config ()
{
	case "$prev" in
	branch.*.remote|branch.*.pushremote)
		__gitcomp_nl "$(__git_remotes)"
		return
		;;
	branch.*.merge)
		__git_complete_refs
		return
		;;
	branch.*.rebase)
		__gitcomp "false true preserve interactive"
		return
		;;
	remote.pushdefault)
................................................................................
		fi
		__gitcomp_nl "$(__git_refs_remotes "$remote")"
		return
		;;
	remote.*.push)
		local remote="${prev#remote.}"
		remote="${remote%.push}"
		__gitcomp_nl "$(__git for-each-ref \
			--format='%(refname):%(refname)' refs/heads)"

		return
		;;
	pull.twohead|pull.octopus)
		__git_compute_merge_strategies
		__gitcomp "$__git_merge_strategies"
		return
		;;
................................................................................
	branch.*.*)
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
		return
		;;
	branch.*)
		local pfx="${cur%.*}." cur_="${cur#*.}"
		__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
		__gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_"
		return
		;;
	guitool.*.*)
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "
			argprompt cmd confirm needsfile noconsole norescan
................................................................................
		local pfx="${cur%.*}." cur_="${cur##*.}"
		__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
		return
		;;
	esac
	__gitcomp "
		add.ignoreErrors
		advice.amWorkDir
		advice.commitBeforeMerge
		advice.detachedHead
		advice.implicitIdentity
		advice.pushAlreadyExists
		advice.pushFetchFirst
		advice.pushNeedsForce
		advice.pushNonFFCurrent
		advice.pushNonFFMatching
		advice.pushUpdateRejected
		advice.resolveConflict
		advice.rmHints
		advice.statusHints
		advice.statusUoption
		alias.
		am.keepcr
		am.threeWay
		apply.ignorewhitespace
		apply.whitespace
		branch.autosetupmerge
		branch.autosetuprebase
		browser.
		clean.requireForce
		color.branch
................................................................................
		color.interactive.prompt
		color.pager
		color.showbranch
		color.status
		color.status.added
		color.status.changed
		color.status.header
		color.status.localBranch
		color.status.nobranch
		color.status.remoteBranch
		color.status.unmerged
		color.status.untracked
		color.status.updated
		color.ui
		commit.cleanup
		commit.gpgSign
		commit.status
		commit.template
		commit.verbose
		core.abbrev
		core.askpass
		core.attributesfile
		core.autocrlf
		core.bare
		core.bigFileThreshold
		core.checkStat
		core.commentChar
		core.compression
		core.createObject
		core.deltaBaseCacheLimit
		core.editor
		core.eol
		core.excludesfile
		core.fileMode
		core.fsyncobjectfiles
		core.gitProxy
		core.hideDotFiles
		core.hooksPath
		core.ignoreStat
		core.ignorecase
		core.logAllRefUpdates
		core.loosecompression
		core.notesRef
		core.packedGitLimit
		core.packedGitWindowSize
		core.packedRefsTimeout
		core.pager
		core.precomposeUnicode
		core.preferSymlinkRefs
		core.preloadindex
		core.protectHFS
		core.protectNTFS
		core.quotepath
		core.repositoryFormatVersion
		core.safecrlf
		core.sharedRepository
		core.sparseCheckout
		core.splitIndex
		core.sshCommand
		core.symlinks
		core.trustctime
		core.untrackedCache
		core.warnAmbiguousRefs
		core.whitespace
		core.worktree
		credential.helper
		credential.useHttpPath
		credential.username
		credentialCache.ignoreSIGHUP
		diff.autorefreshindex
		diff.external
		diff.ignoreSubmodules
		diff.mnemonicprefix
		diff.noprefix
		diff.renameLimit
		diff.renames
................................................................................
		difftool.
		difftool.prompt
		fetch.recurseSubmodules
		fetch.unpackLimit
		format.attach
		format.cc
		format.coverLetter
		format.from
		format.headers
		format.numbered
		format.pretty
		format.signature
		format.signoff
		format.subjectprefix
		format.suffix
		format.thread
		format.to
		gc.
		gc.aggressiveDepth
		gc.aggressiveWindow
		gc.auto
		gc.autoDetach
		gc.autopacklimit
		gc.logExpiry
		gc.packrefs
		gc.pruneexpire
		gc.reflogexpire
		gc.reflogexpireunreachable
		gc.rerereresolved
		gc.rerereunresolved
		gc.worktreePruneExpire
		gitcvs.allbinary
		gitcvs.commitmsgannotation
		gitcvs.dbTableNamePrefix
		gitcvs.dbdriver
		gitcvs.dbname
		gitcvs.dbpass
		gitcvs.dbuser
................................................................................
		sendemail.smtpserverport
		sendemail.smtpuser
		sendemail.suppresscc
		sendemail.suppressfrom
		sendemail.thread
		sendemail.to
		sendemail.validate
		sendemail.smtpbatchsize
		sendemail.smtprelogindelay
		showbranch.default
		status.relativePaths
		status.showUntrackedFiles
		status.submodulesummary
		submodule.
		tar.umask
		transfer.unpackLimit
................................................................................
		web.browser
		branch. remote.
	"
}

_git_remote ()
{
	local subcommands="
		add rename remove set-head set-branches
		get-url set-url show prune update
		"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		case "$cur" in
		--*)
			__gitcomp "--verbose"
			;;
		*)
			__gitcomp "$subcommands"
			;;
		esac
		return
	fi

	case "$subcommand,$cur" in
	add,--*)
		__gitcomp "--track --master --fetch --tags --no-tags --mirror="
		;;
	add,*)
		;;
	set-head,--*)
		__gitcomp "--auto --delete"
		;;
	set-branches,--*)
		__gitcomp "--add"
		;;
	set-head,*|set-branches,*)
		__git_complete_remote_or_refspec
		;;
	update,--*)
		__gitcomp "--prune"
		;;
	update,*)
		__gitcomp "$(__git_get_config_variables "remotes")"
		;;
	set-url,--*)
		__gitcomp "--push --add --delete"
		;;
	get-url,--*)
		__gitcomp "--push --all"
		;;
	prune,--*)
		__gitcomp "--dry-run"
		;;
	*)
		__gitcomp_nl "$(__git_remotes)"
		;;
	esac
}

_git_replace ()
{
	case "$cur" in
	--*)
		__gitcomp "--edit --graft --format= --list --delete"
		return
		;;
	esac
	__git_complete_refs
}

_git_rerere ()
{
	local subcommands="clear forget diff remaining status gc"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if test -z "$subcommand"
	then
		__gitcomp "$subcommands"
		return
	fi
}

_git_reset ()
{
	__git_has_doubledash && return

	case "$cur" in
	--*)
		__gitcomp "--merge --mixed --hard --soft --patch --keep"
		return
		;;
	esac
	__git_complete_refs
}

_git_revert ()
{
	__git_find_repo_path
	if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
		__gitcomp "--continue --quit --abort"
		return
	fi
	case "$cur" in
	--*)
		__gitcomp "
			--edit --mainline --no-edit --no-commit --signoff
			--strategy= --strategy-option=
			"
		return
		;;
	esac
	__git_complete_refs
}

_git_rm ()
{
	case "$cur" in
	--*)
		__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
................................................................................
	__git_has_doubledash && return

	case "$cur" in
	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_shortlog_options
			--numbered --summary --email
			"
		return
		;;
	esac
	__git_complete_revlist
}

................................................................................
		__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
			" "" "${cur#*=}"
		return
		;;
	--diff-algorithm=*)
		__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
		return
		;;
	--submodule=*)
		__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
		return
		;;
	--*)
		__gitcomp "--pretty= --format= --abbrev-commit --oneline
			--show-signature
			$__git_diff_common_options
			"
		return
................................................................................
	esac
	__git_complete_revlist
}

_git_stash ()
{
	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
	local subcommands='push save list show apply clear drop pop create branch'
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		case "$cur" in
		--*)
			__gitcomp "$save_opts"
			;;
		*)
................................................................................
			if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
				__gitcomp "$subcommands"
			fi
			;;
		esac
	else
		case "$subcommand,$cur" in
		push,--*)
			__gitcomp "$save_opts --message"
			;;
		save,--*)
			__gitcomp "$save_opts"
			;;
		apply,--*|pop,--*)
			__gitcomp "--index --quiet"
			;;
		drop,--*)
			__gitcomp "--quiet"
			;;
		show,--*|branch,--*)
			;;
		branch,*)
			if [ $cword -eq 3 ]; then
				__git_complete_refs
			else
				__gitcomp_nl "$(__git stash list \
						| sed -n -e 's/:.*//p')"
			fi
			;;
		show,*|apply,*|drop,*|pop,*)
			__gitcomp_nl "$(__git stash list \
					| sed -n -e 's/:.*//p')"
			;;
		*)
			;;
		esac
	fi
}

_git_submodule ()
{
	__git_has_doubledash && return

	local subcommands="add status init deinit update summary foreach sync"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		case "$cur" in
		--*)
			__gitcomp "--quiet"
			;;
		*)
			__gitcomp "$subcommands"
			;;
		esac
		return
	fi

	case "$subcommand,$cur" in
	add,--*)
		__gitcomp "--branch --force --name --reference --depth"
		;;
	status,--*)
		__gitcomp "--cached --recursive"
		;;
	deinit,--*)
		__gitcomp "--force --all"
		;;
	update,--*)
		__gitcomp "
			--init --remote --no-fetch
			--recommend-shallow --no-recommend-shallow
			--force --rebase --merge --reference --depth --recursive --jobs
		"
		;;
	summary,--*)
		__gitcomp "--cached --files --summary-limit"
		;;
	foreach,--*|sync,--*)
		__gitcomp "--recursive"
		;;
	*)
		;;
	esac
}

_git_svn ()
{
	local subcommands="
		init fetch clone rebase dcommit log find-rev
		set-tree commit-diff info create-ignore propget
................................................................................
	else
		local remote_opts="--username= --config-dir= --no-auth-cache"
		local fc_opts="
			--follow-parent --authors-file= --repack=
			--no-metadata --use-svm-props --use-svnsync-props
			--log-window-size= --no-checkout --quiet
			--repack-flags --use-log-author --localtime
			--add-author-from
			--ignore-paths= --include-paths= $remote_opts
			"
		local init_opts="
			--template= --shared= --trunk= --tags=
			--branches= --stdlayout --minimize-url
			--no-metadata --use-svm-props --use-svnsync-props
			--rewrite-root= --prefix= $remote_opts

			"
		local cmt_opts="
			--edit --rmdir --find-copies-harder --copy-similarity=
			"

		case "$subcommand,$cur" in
		fetch,--*)
................................................................................
_git_tag ()
{
	local i c=1 f=0
	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		-d|-v)
			__gitcomp_direct "$(__git_tags "" "$cur" " ")"
			return
			;;
		-f)
			f=1
			;;
		esac
		((c++))
................................................................................
	done

	case "$prev" in
	-m|-F)
		;;
	-*|tag)
		if [ $f = 1 ]; then
			__gitcomp_direct "$(__git_tags "" "$cur" " ")"
		fi
		;;
	*)
		__git_complete_refs
		;;
	esac

	case "$cur" in
	--*)
		__gitcomp "
			--list --delete --verify --annotate --message --file
			--sign --cleanup --local-user --force --column --sort=
			--contains --no-contains --points-at --merged --no-merged --create-reflog
			"
		;;
	esac
}

_git_whatchanged ()
{
	_git_log
}

_git_worktree ()
{
	local subcommands="add list lock prune unlock"
	local subcommand="$(__git_find_on_cmdline "$subcommands")"
	if [ -z "$subcommand" ]; then
		__gitcomp "$subcommands"
	else
		case "$subcommand,$cur" in
		add,--*)
			__gitcomp "--detach"
			;;
		list,--*)
			__gitcomp "--porcelain"
			;;
		lock,--*)
			__gitcomp "--reason"
			;;
		prune,--*)
			__gitcomp "--dry-run --expire --verbose"
			;;
		*)
			;;
		esac
	fi
}

__git_main ()
{
	local i c=1 command __git_dir __git_repo_path
	local __git_C_args C_args_count=0

	while [ $c -lt $cword ]; do
		i="${words[c]}"
		case "$i" in
		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
		--git-dir)   ((c++)) ; __git_dir="${words[c]}" ;;
		--bare)      __git_dir="." ;;
		--help) command="help"; break ;;
		-c|--work-tree|--namespace) ((c++)) ;;
		-C)	__git_C_args[C_args_count++]=-C
			((c++))
			__git_C_args[C_args_count++]="${words[c]}"
			;;
		-*) ;;
		*) command="$i"; break ;;
		esac
		((c++))
	done

	if [ -z "$command" ]; then
		case "$prev" in
		--git-dir|-C|--work-tree)
			# these need a path argument, let's fall back to
			# Bash filename completion
			return
			;;
		-c|--namespace)
			# we don't support completing these options' arguments
			return
			;;
		esac
		case "$cur" in
		--*)   __gitcomp "
			--paginate
			--no-pager
			--git-dir=
			--bare
			--version
................................................................................
		*)     __git_compute_porcelain_commands
		       __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;;
		esac
		return
	fi

	local completion_func="_git_${command//-/_}"
	declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return

	local expansion=$(__git_aliased_command "$command")
	if [ -n "$expansion" ]; then
		words[1]=$expansion
		completion_func="_git_${expansion//-/_}"
		declare -f $completion_func >/dev/null 2>/dev/null && $completion_func
	fi
}

__gitk_main ()
{
	__git_has_doubledash && return

	local __git_repo_path
	__git_find_repo_path

	local merge=""
	if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
		merge="--merge"
	fi
	case "$cur" in
	--*)
		__gitcomp "
			$__git_log_common_options
			$__git_log_gitk_options
................................................................................
				array[${#array[@]}+1]="$c"
			done
			compset -P '*[=:]'
			compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
			;;
		esac
	}

	__gitcomp_direct ()
	{
		emulate -L zsh

		local IFS=$'\n'
		compset -P '*[=:]'
		compadd -Q -- ${=1} && _ret=0
	}

	__gitcomp_nl ()
	{
		emulate -L zsh

		local IFS=$'\n'
		compset -P '*[=:]'

Changes to thirdparty/git-prompt.sh.

78
79
80
81
82
83
84

85
86
87
88
89
90
91
...
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
...
439
440
441
442
443
444
445


446
447
448
449
450
451
452
# If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values:
#
#     contains      relative to newer annotated tag (v1.6.3.2~35)
#     branch        relative to newer tag or branch (master~4)
#     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)

#     default       exactly matching tag
#
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.
#
................................................................................
	# Assume that the shell follows the POSIX specification and
	# expands PS1 unless determined otherwise.  (This is more
	# likely to be correct if the user has a non-bash, non-zsh
	# shell and safer than the alternative if the assumption is
	# incorrect.)
	#
	local ps1_expanded=yes
	[ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
	[ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no

	local repo_info rev_parse_exit_code
	repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
		--is-bare-repository --is-inside-work-tree \
		--short HEAD 2>/dev/null)"
	rev_parse_exit_code="$?"

	if [ -z "$repo_info" ]; then
		return $exit
	fi

	local short_sha
	if [ "$rev_parse_exit_code" = "0" ]; then
		short_sha="${repo_info##*$'\n'}"
		repo_info="${repo_info%$'\n'*}"
	fi
	local inside_worktree="${repo_info##*$'\n'}"
	repo_info="${repo_info%$'\n'*}"
	local bare_repo="${repo_info##*$'\n'}"
................................................................................
				detached=yes
				b="$(
				case "${GIT_PS1_DESCRIBE_STYLE-}" in
				(contains)
					git describe --contains HEAD ;;
				(branch)
					git describe --contains --all HEAD ;;


				(describe)
					git describe HEAD ;;
				(* | default)
					git describe --tags --exact-match HEAD ;;
				esac 2>/dev/null)" ||

				b="$short_sha..."







>







 







|
|











|







 







>
>







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
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
...
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values:
#
#     contains      relative to newer annotated tag (v1.6.3.2~35)
#     branch        relative to newer tag or branch (master~4)
#     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
#     tag           relative to any older tag (v1.6.3.1-13-gdd42c2f)
#     default       exactly matching tag
#
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.
#
................................................................................
	# Assume that the shell follows the POSIX specification and
	# expands PS1 unless determined otherwise.  (This is more
	# likely to be correct if the user has a non-bash, non-zsh
	# shell and safer than the alternative if the assumption is
	# incorrect.)
	#
	local ps1_expanded=yes
	[ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
	[ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no

	local repo_info rev_parse_exit_code
	repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
		--is-bare-repository --is-inside-work-tree \
		--short HEAD 2>/dev/null)"
	rev_parse_exit_code="$?"

	if [ -z "$repo_info" ]; then
		return $exit
	fi

	local short_sha=""
	if [ "$rev_parse_exit_code" = "0" ]; then
		short_sha="${repo_info##*$'\n'}"
		repo_info="${repo_info%$'\n'*}"
	fi
	local inside_worktree="${repo_info##*$'\n'}"
	repo_info="${repo_info%$'\n'*}"
	local bare_repo="${repo_info##*$'\n'}"
................................................................................
				detached=yes
				b="$(
				case "${GIT_PS1_DESCRIBE_STYLE-}" in
				(contains)
					git describe --contains HEAD ;;
				(branch)
					git describe --contains --all HEAD ;;
				(tag)
					git describe --tags HEAD ;;
				(describe)
					git describe HEAD ;;
				(* | default)
					git describe --tags --exact-match HEAD ;;
				esac 2>/dev/null)" ||

				b="$short_sha..."