-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs
1697 lines (1362 loc) · 53.3 KB
/
.emacs
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
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
; .emacs
;; (> emacs-major-version 19)
;; (>= emacs-minor-version 14))
;; start a server for emacsclient to use.
(server-mode 1)
; commenting out for new home ubuntu vm
;; add all the emacs libs to this session - nothing works without it.
;(progn (cd "/usr/local/share/emacs/23.2")
; (normal-top-level-add-subdirs-to-load-path))
;; add all the emacs libs to this session - nothing works without it.
;; (progn (cd "/usr/local/share/emacs/site-lisp")
;; (normal-top-level-add-subdirs-to-load-path))
;; this does
;; works in emacs Sun Feb 28 10:45:47 2010
(global-unset-key [f1] )
(define-key global-map [f1] 'repeat-complex-command)
;;Mon Oct 22 09:14:16 2001
;; bind control-z to the very useful "undo" not minimize!
;; tony
;; todo - fix this bindiing
(global-unset-key [C-z])
;; gold -- unsets "c-x backspace" which has caused me a lot of grief
(global-unset-key "\C-x")
(global-set-key "\C-x" 'backward-delete-char-untabify)
;; gold - use ctrl-meta . and comma to goto beg and end of buffer
(global-unset-key [C-M-.])
(global-unset-key [C-M-,])
(global-set-key [C-M-.] 'end-of-buffer)
(global-set-key [C-M-,] 'beg-of-buffer)
(global-unset-key [C-next])
(global-set-key [C-next] 'end-of-buffer)
(global-set-key [ ] 'beg-of-buffer)
;; add all the emacs libs to this session - nothing works without it.
(progn (cd "~/.emacs.d")
(normal-top-level-add-subdirs-to-load-path))
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-thansmann)
;; (color-theme-thansmann2)
;; (color-theme-zenburn) ;; sets gutter to black
(color-theme-lawrence) ;; under lines key words, nice for learning a lang, has a 'notch' on the linun line that seems to indicate where classes and do/end start/stop
))
;; nice trick from http://emacswiki.org/emacs/ColorTheme
(setq my-color-themes (list
'color-theme-thansmann
'color-theme-thansmann2
'color-theme-zenburn
'color-theme-simple-1
'color-theme-billw
'color-theme-taylor
'color-theme-classic
'color-theme-midnight
'color-theme-hober
'color-theme-oswald
'color-theme-dark-laptop
'color-theme-taming-mr-arneson
'color-theme-jonadabian-slate
'color-theme-ld-dark
'color-theme-comidia
'color-theme-arjen
'color-theme-aliceblue
'color-theme-clarity
'color-theme-charcoal-black
'color-theme-calm-forest
'color-theme-lawrence
'color-theme-matrix
'color-theme-railscasts
))
(defun my-theme-set-default () ; Set the first row
(interactive)
(setq theme-current my-color-themes)
(funcall (car theme-current)))
(defun my-describe-theme () ; Show the current theme
(interactive)
(message "%s" (car theme-current)))
; Set the next theme (fixed by Chris Webber - tanks)
(defun my-theme-cycle ()
(interactive)
(setq theme-current (cdr theme-current))
(if (null theme-current)
(setq theme-current my-color-themes))
(funcall (car theme-current))
(message "%S" (car theme-current)))
(setq theme-current my-color-themes)
(setq color-theme-is-global nil) ; Initialization
(my-theme-set-default)
(global-set-key [f7] 'my-theme-cycle)
;; END color theme messing around
;; set for the mac Wed May 30 12:09:44 2012
(set-face-attribute 'default nil :font "Monospace-11")
(set-default-font "Monospace-11")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auto-compression-mode t nil (jka-compr))
'(case-fold-search t)
'(column-number-mode 4)
'(cperl-close-paren-offset -4)
'(cperl-continued-statement-offset 4)
'(cperl-indent-level 4)
'(cperl-indent-parens-as-block t)
'(cperl-tab-always-indent t)
'(current-language-environment "ASCII")
'(debug-on-error t)
'(global-font-lock-mode t nil (font-lock))
'(inhibit-startup-screen t)
'(initial-buffer-choice "~/diary")
'(line-number-mode 4)
'(save-place t nil (saveplace))
'(show-paren-mode t nil (paren))
'(tool-bar-mode nil)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))
;; enable visual feedback on selections
(setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs
(setq diff-switches "-u")
;; always end a file with a newline
(setq require-final-newline t)
;; ensure we do this *after* default.el is loaded!
;; throws a lisp error - might be useful sometime tho -T Wed Mar 3 13:32:22 2010
;; (add-hook after-init-hook
;; (lambda ()
;; ;; (setq require-final-newline t)
;; (global-unset-key "")
;; (global-unset-key "")
;; (define-key global-map "" 'undo)
;; (define-key global-map "" 'undo)
;; )
;; )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; tony .emacs stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Options Menu Settings
;; =====================
;; (whitespace-toggle-trailing-check)
(setq kill-ring-max 150)
(set-variable (quote bell-volume) 0)
(setq-default case-replace t)
(setq-default teach-extended-commands-p t)
(setq-default teach-extended-commands-timeout 7)
(setq-default debug-on-error nil) ;; moved this to true while debugging feb 2010
(setq-default debug-on-quit nil)
(setq-default get-frame-for-buffer-default-instance-limit nil)
;; breaks things -T Sun Feb 28 16:39:56 2010
;; (setq-default temp-buffer-show-function 'show-temp-buffer-in-current-frame)
(require 'font-lock)
(setq-default font-lock-auto-fontify t)
(setq-default font-lock-use-fonts '(or (mono) (grayscale)))
(setq-default font-lock-use-colors '(color))
(setq-default font-lock-maximum-decoration t)
(setq-default font-lock-maximum-size 256000)
(setq-default font-lock-mode-enable-list t)
(setq-default font-lock-mode-disable-list nil)
;; (add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
(remove-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
(require 'paren)
;; db session
;; (paren-set-mode 'sexp)
(message "after paren mode")
(setq-default buffers-menu-sort-function 'sort-buffers-menu-alphabetically)
(setq-default buffers-menu-grouping-function nil)
(setq-default buffers-menu-submenus-for-groups-p nil)
;; fucntion for getting to the end of a line into the kill
;; ring.
(defun copy-line-as-kill (arg)
"does a kill-line, then puts it back. this is for the side
effect of getting the line in kill ring."
(interactive "*p")
(kill-line arg)
(yank)
(exchange-point-and-mark )
)
;; fucntion for getting the files i like most
;; and it even works
;; works in emacs feb 2010
(defun tony-fav-files (arg)
"load a list of the files i am always using."
(interactive "*p")
;; (find-file "~/oratony")
;; (find-file "~/irritant")
;; (find-file "~/running.proj")
(find-file "~/diary")
)
;; fucntion for getting the files i like most
;; and it even works
(defun rcs-head (arg)
"insert file rcshead at point from the ~/vault dir into document"
(interactive "*p")
(insert-file-contents "~/vault/rcshead")
)
(message "after some of my defun's rcs-head")
(defun tony-perl-expect-pair (arg)
"insert file perl-expect-pair at point from the ~/vault dir into document"
(interactive "*p")
(insert-file-contents "~/vault/perl-expect-pair.txt")
(goto-char (search-forward-regexp "FOO")
) ;; end goto-char
(delete-char -3)
)
(defun tony-perl-expect-prompt (arg)
"insert file perl-expect-pair at point from the ~/vault dir into document"
(interactive "*p")
(insert-file-contents "~/vault/perl-expect-prompt.txt")
(goto-char (search-forward-regexp "BAR")
) ;; end goto-char
(delete-char -3)
)
;; (defun tony-work-files (arg)
;; "load a list of the files i am always using."
;; (interactive "*p")
;; (find-file "/u/tony/develop/web_ads_interface/bin/src/adsform/adsform_enhance.h")
;; (find-file "/u/tony/develop/web_ads_interface/bin/src/adsform/read_user_defined.c")
;; (find-file "/u/tony/develop/web_ads_interface/bin/src/adsform/Makefile")
;; ) ;; end tony-work-files
;; (defun tony-did-today (arg)
;; "insert file did-today at point from the ~/vault dir into document"
;; (interactive "*p")
;; (insert-file-contents "~/vault/did-today")
;; )
;; ;; works in emacs feb 2010
;; (global-set-key [M-f2] 'tony-did-today)
(global-set-key [f4] 'tony-fav-files)
;; get a a MS style highlight thing
;;
(defun highlight-ms-eol (arg)
"goto the end of line, whilst defining a region, MS behavior"
(interactive "*p")
(set-mark-command nil)
(end-of-line)
; (exchange-point-and-mark)
)
(defun highlight-ms-bol (arg)
"goto the end of line, whilst defining a region, MS behavior"
(interactive "*p")
(set-mark-command nil)
(beginning-of-line)
)
;;(define-key global-map '(control-x end) 'highlight-ms-eol)
;; (global-set-key 'Sh-end 'highlight-ms-eol)
;(global-set-key (quote [#<keypress-event control-X> #<keypress-event end>]) (quote highlight-ms-eol))
;;(global-set-key 'Sh-home 'highligh-ms-bol)
(message "before sub_head")
;; commenting out for debug emacs 24.1 startu
;; ;; put in my header stuff
;; ;; doesn't work on emacs Sun Feb 28 10:43:16 2010
;; (fset 'sub_head
;; [ (control \3) (control \0) \# return (control \1) (control \0) \# return \# space (control f2) return \# return ])
;; (fset 'end-sub
;; [ (control \1) (control \5) \# E N D S U B (control \1) (control \5) \# return ])
;; These work - Sun Feb 28 10:44:36 2010
(global-set-key [f12] 'sub_head)
(define-key global-map [S-f12] 'end-sub)
;; ;; cool thing that works
;; (fset 'perl-html-table-start "print \"<TABLE>\\n\"; # start an HTML TABLE")
;; (global-set-key [f7] 'perl-html-table-start)
(setq shell-multiple-shells t)
(message "after sub_head")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; subject stuff
; Wed Jan 7 15:11:27 1998
;; works in emacs Sun Feb 28 10:40:30 2010
(defun put-date (arg)
"inserts the 'date' shell command output
into the current buffer."
(interactive "*p")
(insert (current-time-string)) ;; add utc here too
(insert " // ")
(insert (format-time-string "%F %T %Z" (current-time)))
(insert " // ")
(insert (format-time-string "%F %T %Z" (current-time) 'universal))
;;(insert (current-time-string))
)
;; define f2 key to do the deed. -tony Wed May 7 10:20:51 MST 1997
;; works emacs Sun Feb 28 10:41:54 2010
(define-key global-map [f2] 'subject-break)
(define-key global-map [C-f2] 'put-date)
;;;;;;;;;;;;;;;;;;;;; end subject stuff
;; good to here Sun Feb 28 10:45:12 2010
;; http://xahlee.org/emacs/keyboard_shortcuts.html
(global-set-key (kbd "C-z") 'undo) ;; works!
(global-set-key (kbd "C-x C-z") 'undo) ;; works!
;; these dont work ;; (define-key global-map [C-z] 'undo)
;; these dont work ;; (define-key global-map [C-x-C-z] 'undo)
;; looks like when i switched to 20.4 the binding for cntl-q changed,
;; i really need this.....
;; works in emacs Sun Feb 28 10:47:34 2010
(define-key global-map [C-q] 'quoted-insert)
;; couple of function I wrote for this -T Wed Mar 3 16:49:08 2010
(define-key global-map [(shift end)] 'highlight-ms-eol)
(define-key global-map [(shift home)] 'highlight-ms-bol)
(global-set-key (kbd "C-;") 'goto-line) ;; works -t Thu Mar 4 15:40:59 2010
(global-set-key (kbd "C-:") 'goto-line) ;; works -t Thu Mar 4 15:40:59 2010
(global-set-key (kbd "ESC ;") 'goto-line)
(global-set-key (kbd "ESC :") 'goto-line)
;; weird thing i had to do make ubuntu work thru vnc
;; maps alt-x to the meta-x command Tue Apr 10 11:56:21 2012
;; (global-set-key (kbd "A-x") 'execute-extended-command)
(setq x-alt-keysym 'meta)
;; loads- but doesn't really work Sun Feb 28 11:15:35 2010
(defun string-trim (arg)
"trim the leading and trailing space from as many lines as you want"
(interactive "*p")
(query-replace-regexp " *$" "" nil)
(query-replace-regexp "^ *" "" nil)
)
;; bind it up to control end
;; don't think i use this anymote Sun Feb 28 11:17:50 2010
(define-key global-map '[(control delete)] 'copy-line-as-kill)
(define-key global-map '[(control insert)] 'yank)
;; Make ^c-/ do query-replace-regexp
;; works great in emacs Sun Feb 28 11:18:33 2010
(define-key global-map '[(control /)] 'query-replace-regexp)
(global-set-key [f11] 'rcs-head)
;; (global-set-key '[(control f11)] 'rcs-fix)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; this sets my pref for cperl-mode over the perl mode
;; also sets the font-locks for it as well as the
;; cool hairy mode
(setq cperl-hairy t)
(load-library "cperl-mode")
;; failing on mac
;; (load-library "highlight-parentheses")
;; (add-hook 'cperl-mode-hook 'highlight-parentheses-mode)
;; (add-hook 'fundamental-mode-hook 'highlight-parentheses-mode)
;; (add-hook 'cperl-mode-hook 'font-lock-mode)
;;(add-hook 'cperl-mode-hook 'set-hairy)
;; (setq font-lock-maximum-decoration t)
;; (add-hook 'cperl-mode-hook 'font-lock-maximum-decoration t)
;;
;;
;; in emacs 24.1 things with a square brace seem to break
;; ;; from the cperl mode code, a recommendation:
;; (setq auto-mode-alist
;; (append '(("\\.\\([pP][Llm]\\|al\\)$" . perl-mode)) auto-mode-alist ))
;; (setq interpreter-mode-alist (append interpreter-mode-alist
;; '(("miniperl" . perl-mode))))
;(setq options-save-faces t)
;;(display-time)
;;(column-number-mode)
;; (setq line-number-mode t)
;; (setq column-number-mode t)
(setq
line-number-mode 4
column-number-mode 4
display-column-mode 4
;; display-time-day-and-date t
;; display-time t
options-save-faces t
)
(setq vc-mistrust-permissions t)
(require 'vc)
;; both work in emacs Sun Feb 28 12:49:25 2010
;; Make F5 be `rectangle-kill'
(global-set-key [f5] 'kill-rectangle)
;; Make F6 be `rectangle-yank'
(global-set-key [f6] 'yank-rectangle)
;; adding the comment region stuff finially
(global-set-key '[C-f12] 'tony-perl-insert-sub)
(global-set-key [C-x-C-r] (quote eval-print-last-sexp))
;; f10 doesn't work on my thinkpad -t Sun Feb 28 11:42:14 2010
(global-set-key [f8] 'indent-region)
(global-set-key [f9] 'comment-region)
(global-set-key [f10] 'ruby-hash-var-region)
(global-set-key [C-tab] 'fixup-whitespace)
;; Make `C-x C-m' and `C-x RET' be different (since I tend to type
;; the latter by accident sometimes.)
;; db session
;; (define-key global-map [C-l return] nil)
;;; ********************
;;; Load ange-ftp, which uses the FTP protocol as a pseudo-filesystem.
;;; When this is loaded, the pathname syntax /user@host:/remote/path
;;; refers to files accessible through ftp.
;;;
(require 'dired)
;; ok to here Sun Feb 28 12:50:37 2010(global-set-key '(control tab) 'fixup-whitespace)
;;; ********************
;;; Load the auto-save.el package, which lets you put all of your autosave
;;; files in one place, instead of scattering them around the file system.
;;;
;; db session
;;(require 'auto-save)
;;(setq auto-save-directory (expand-file-name "~/autosaves/"))
;;(setq auto-save-interval 900)
;;(setq auto-save-hash-p nil)
(global-set-key [button3] 'popup-buffer-menu)
(setq next-screen-context-lines 3)
(global-set-key [button4] 'scroll-down-command)
(global-set-key [button5] 'scroll-up-command)
(define-key global-map [S-button4] 'scroll-down-one)
(define-key global-map [S-button5] 'scroll-up-one)
(global-unset-key '[(control $)])
(define-key global-map '[(control $)] 'shell-var-last-word)
;;; I invoke this from my .emacs file with the following incantation
(setq c-auto-newline t)
(add-hook 'c-mode-hook 'elec-c-mode)
(add-hook 'cc-mode-hook 'elec-c-mode)
(add-hook 'elec-c-mode-hook 'turn-on-auto-fill)
(autoload 'elec-c-mode "elec-c" "High powered C editing mode." t)
(setq explicit-sh-args '("--login" ))
;;; Mon Feb 22 11:54:59 1999 works Need these two setting together to get the
;;; buffer menus that i want which grouped within modes, then alpha with line
;;; breaks between the mode catagories. -anh
(setq buffers-menu-sort-function 'sort-buffers-menu-by-mode-then-alphabetically)
;;;
(setq buffers-menu-grouping-function 'group-buffers-menu-by-mode-then-alphabetically)
;; i wrote this one
;; Thu Sep 2 11:24:21 1999
;;(load-library "make-macroify")
(defun make-macroify ()
"place $( and ) around the string preceeding the point"
(interactive "*")
(save-excursion
(save-restriction
(save-match-data
(widen)
(setq started_here (point))
(while (char= (string-to-char(regexp-quote " "))
(char-before (point)
) ;; end char-before
) ;; end char=
(goto-char (- (point) 1))
) ;; end while
(insert ")")
(goto-char (search-backward-regexp
(concat (regexp-quote " ") "\\|^") nil t)
) ;; end goto-char
(while (char= (string-to-char(regexp-quote " "))
(char-after (point)
) ;; end char-before
) ;; end char=
(goto-char (+ (point) 1))
) ;; end while
(insert "$(")
(goto-char (+ 4 started_here))
) ;; end save-match-data
);; end save-restriction
) ;; end save-excursion
(forward-char 1) ;; added Wed Jul 19 10:47:44 2000 does exactly what i want
;; places the cursor
(nil)
)
;; Fri Oct 8 16:51:12 1999
(setq mouse-yank-at-point t)
;;
(setq-default ispell-program-name "aspell")
; for makefiles only, map this key
; Thu Sep 2 11:25:25 1999
(add-hook 'makefile-mode-hook '(lambda ()
(define-key makefile-mode-map [(control x) (control m) ] 'make-macroify)))
; for perl mode only, map this key
; Thu Sep 2 11:25:25 1999
(add-hook 'cperl-mode-hook '(lambda ()
(define-key cperl-mode-map [(control x) (control e) ] 'tony-perl-expect-pair)))
(add-hook 'cperl-mode-hook '(lambda ()
(define-key cperl-mode-map [(control x) (control r) ] 'tony-perl-expect-prompt)))
;;; ********************
;;; Load a partial-completion mechanism, which makes minibuffer completion
;;; search multiple words instead of just prefixes; for example, the command
;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
;;; because there are no other commands whose first three words begin with
;;; the letters `b', `c', and `a' respectively.
;;;
;; db session
;;(load-library "completer")
;;("mwheel" ("/usr/local/lib/xemacs-21.4.6/lisp/auto-autoloads.elc" . 69304) t nil)
(load-library "mwheel")
(load-library "uniquify")
;; this setq really fouls the editor.... Wed Mar 24 13:11:29 1999 tony
;; and i found this out again feb 2010
;;(setq uniquify-buffer-name-style "post-forward-angle-brackets")
;; (setq uniquify-buffer-name-style t)
;; (setq uniquify-min-dir-content t)
;; (setq case-fold-search t)
;; debug session
;; (require 'pending-del)
;; (custom-set-variables
;; '(c-electric-pound-behavior (quote (alignleft))))
;;(custom-set-faces)
(setq options-save-faces t)
;;;aspell is a replacement for ispell
;(setq-default ispell-program-name "aspell")
;(setq-default ispell-extra-args '("-reverse"))
;; debug session
;; (setq auto-mode-alist (append auto-mode-alist
;; (list '("\\.sql$" . sql-mode))))
;; end of the file Tony Hansmann ([email protected]) Mon May
;; 24 10:24:41 2004
;; works in emacs Sun Feb 28 12:44:27 2010
(defun unreturn-to-space-eof (arg)
(interactive "*p")
"replace returns with space to the end of the file"
(replace-regexp "\n" " " nil)
)
;; fucntion for replacing return char with a tab char through the end
;; of the file Tony Hansmann ([email protected]) Mon May 24
;; 10:24:41 2004
;; works in emacs Sun Feb 28 12:44:27 2010
(defun unreturn-to-tab-eof (arg)
(interactive "*p")
"replace returns with tabs to the end of the file. Useful for pasting to spreadsheets "
(replace-regexp "\n" "\t" nil)
)
;; fucntion for replacing multiple spaces with one through the end of
;; the file Tony Hansmann ([email protected]) Thu Aug 23
;; 17:56:39 2007
;; doesn't work
(defun multi-spaces-or-newline-to-space-eof (arg)
(interactive "*p")
"replace multiple spaces with one space"
(replace-regexp " +\\|\n" " " nil)
)
;; bind the function to ctrl-f5
(define-key global-map [C-f5] 'nl2space)
;; bind the function to ctrl-f6
(define-key global-map [C-f6] 'unreturn-to-tab-eof)
(global-set-key [f3] 'multi-spaces-or-newline-to-space-eof)
(defun tony-perl-insert-sub (arg)
"insert file perl sub definition into script"
(interactive "*p")
(insert-file-contents "~/vault/perl_sub")
(goto-char (search-forward " ")
) ;; end goto-char
)
;############################################################################
;# Emacs config (Recommended) from Appendix C of "Perl Best Practices" #
;# Copyright (c) O'Reilly & Associates, 2005. All Rights Reserved. #
;# See: http://www.oreilly.com/pub/a/oreilly/ask_tim/2001/codepolicy.html #
;############################################################################
;; Use cperl mode instead of the default perl mode
(defalias 'perl-mode 'cperl-mode)
;; turn autoindenting on
(global-set-key "\r" 'newline-and-indent)
;; Use 4 space indents via cperl mode
;; Insert spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; Set line width to 78 columns...
(setq fill-column 78)
(setq auto-fill-mode t)
;; Use % to match various kinds of brackets...
;; See: http://www.lifl.fr/~hodique/uploads/Perso/patches.el
;; (global-set-key "%" 'match-paren)
;; (defun match-paren (arg)
;; "Go to the matching paren if on a paren; otherwise insert %."
;; (interactive "p")
;; (let ((prev-char (char-to-string (preceding-char)))
;; (next-char (char-to-string (following-char))))
;; (cond ((string-match "[[{(<]" next-char) (forward-sexp 1))
;; ((string-match "[\]})>]" prev-char) (backward-sexp 1))
;; (t (self-insert-command (or arg 1))))))
;; Load an applicationtemplate in a new unattached buffer...
(defun application-template-pm ()
"Inserts the standard Perl application template" ; For help and info.
(interactive "*") ; Make this user accessible.
(switch-to-buffer "application-template-pm")
(insert-file "~/.code_templates/perl_application.pl"))
;; Set to a specific key combination...
(global-set-key "\C-ca" 'application-template-pm)
;; Load a module template in a new unattached buffer...
(defun module-template-pm ()
"Inserts the standard Perl module template" ; For help and info.
(interactive "*") ; Make this user accessible.
(switch-to-buffer "module-template-pm")
(insert-file "~/.code_templates/perl_module.pl"))
;; Set to a specific key combination...
(global-set-key "\C-cm" 'module-template-pm)
;; Expand the following abbreviations while typing in text files...
(abbrev-mode 1)
;; change these to ruby
(define-abbrev-table 'global-abbrev-table '(
("pdbg" "use Data::Dumper qw( Dumper );\nwarn Dumper[];" nil 1)
("phbp" "#!/usr/bin/perl -w" nil 1)
("pbmk" "use Benchmark qw( cmpthese );\ncmpthese -10, {};" nil 1)
("pusc" "use Smart::Comments;\n\n### " nil 1)
("putm" "use Test::More 'no_plan';" nil 1)
("rbsh" "#!/usr/bin/env ruby" nil 1)
("rbdef" "
# Public|Private: zz
#
# args description: yy - some arg
# rr - other arg
#
# Examples
#
# zz(yy, rr)
# # => <return example>
#
# Returns the duplicated String.
def zz(yy, rr)
yy * rr
end # end def zz
" nil 1)
("rbcase" "
case
when xx == 'aa'
puts 'jj!'
when /\s?(\w*)/.match(zz)
puts \"zz is %s\" % zz
else
ff.mm
end
" nil 1)
("rbhash" "hash = { one: 1,\ntwo: 2,\nthree: 3\n}" nil 1 )
("rbARGV" "ARGV.each do |xx|\n xx.split()\nend # end ARGV" nil 1)
("rbARGF" "ARGF.each do |xx|\n xx.split()\nend # end ARGF" nil 1)
)) ;; end snippet lines
(add-hook 'fundamental-mode-hook 'show-paren-mode )
;; (add-hook 'fundamental-mode-hook 'highlight-parentheses-mode)
(add-hook 'text-mode-hook (lambda () (abbrev-mode 1)))
;; works -T Thu Jul 21 16:08:27 2011
(add-hook 'ruby-mode-hook (lambda ()
(linum-mode 1)
(define-key ruby-mode-map '[(control \#)] 'ruby-hash-var-last-word)
)) ;; Thu Apr 26 08:23:33 2012
(add-hook 'cperl-mode-hook (lambda () (linum-mode 1)))
(add-hook 'Python-mode-hook (lambda () (linum-mode 1)))
(add-hook 'sh-mode-hook (lambda ()
(linum-mode 1)
)
)
;; does not work - figure it out - t Sun Feb 28 12:56:43 2010
;; need to figure out how to quote the ';' to make this work. -t
;; (global-set-key [C-;] 'goto-line) ; [Ctrl]-[L]
;; Mon Mar 1 22:58:25 2010 turn off the button bar
;; (tool-bar-mode 0)
;; move the scroll bar to the right side
;; (set-scroll-bar-mode 'right)
;; Tue Mar 2 00:03:59 2010
(set-mouse-color "white")
(set-cursor-color "white")
(blink-cursor-mode nil)
;; Tue Mar 2 00:55:27 2010
;; emacs - make shift-insert, disable overwrite, make insert
(global-unset-key [insert])
(global-set-key [insert] 'yank)
;; Tue Mar 2 14:49:52 2010
(global-unset-key [delete])
(global-set-key [delete] 'delete-char)
;; comment a region with a C-mouse click
;;; commenting out -t Thu May 13 13:41:39 2010
; (global-unset-key [C-down-mouse-1])
; (global-set-key [C-down-mouse-1] 'comment-region)
;; bind x pop-up buffer menu to 3rd button
(global-set-key [C-down-mouse-3] 'mouse-buffer-menu)
(global-set-key [down-mouse-3] 'mouse-buffer-menu)
(global-set-key [M-tab] 'buffer-menu)
;; @#---------
;; Tue Mar 2 15:26:38 2010
;; @#---------
;; Sun Feb 28 17:14:16 2010
(defun subject-break (arg)
"insert a unique string and the date as a subject break"
(setq subject-delimiter "@#---------\n")
(interactive "*p")
(move-beginning-of-line nil)
(insert subject-delimiter)
;;(put-date)
;; (insert (current-time-string)) ;; add utc here too
;; (insert " // ")
(insert (format-time-string "%F %T %Z %a" (current-time)))
(insert " // ")
(insert (format-time-string "%F %T %Z" (current-time) 'universal))
)
;; tie in with temp file system -
(define-key global-map [C-f3] 'tony-next-temp-file)
(define-key global-map [C-f4] 'tony-current-temp-file)
;; having some issue Tue Aug 17 13:49:39 2010
(defun tony-next-temp-file (arg)
"Get a new temp file from perl script next_file_named and open it for edit"
(interactive "*p")
(find-file
(chomp
(shell-command-to-string "/home/thansmann/bin/next_file_named -d /home/thansmann/tmp/foo -f foo")
)
)
)
(defun tony-current-temp-file (arg)
"Get the current temp file from perl script current_file_named and open it for edit"
(interactive "*p")
(find-file
(chomp
(shell-command-to-string "/home/thansmann/bin/current_file_named -d /home/thansmann/tmp/foo -f foo")
)
)
)
;; fucntion for replacing multiple spaces with one through the end of
;; the file Tony Hansmann ([email protected]) Thu Aug 23
;; 17:56:39 2007
;; doesn't work
;; (defun multi-spaces-or-newline-to-space-eof (arg)
;; (interactive "*p")
;; "replace multiple spaces with one space"
;; (replace-regexp " +\\|\n" " " nil)
;; )
;; (custom-set-faces
;; ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; ;; Your init file should contain only one such instance.
;; '(show-paren-match-face ((((class color)) (:background "turquoise")))))
;; nice func pulled from: http://www.emacswiki.org/emacs/ElispCookbook#toc5
;; Tony Mon Jun 28 12:12:40 2010
(defun chomp (str)
"Chomp leading and tailing whitespace from STR."
(let ((s (if (symbolp str) (symbol-name str) str)))
(replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" s)))
;; adding in factory emacs lib for git -T Mon May 28 12:09:30 2012
;; (add-to-list 'load-path "/usr/share/doc/git-core/contrib/emacs")
;;(require 'git)
;; trouble-shooting this Mon Jul 12 11:48:30 2010
(add-to-list 'load-path "/usr/local/share/emacs/23.2/lisp/progmodes")
;; totally lame hard-code to make this work - don't know why. -T Mon Jul 12 12:10:09 2010
;;(if (load-library "/usr/local/src/emacs-23.2/lisp/progmodes/python.elc")
;; (print "Info: Loadinsdfg python.el")
;; (print "WARN: Can't find plsdjfysjdlfthon.el"))
;; working out a config for s1 - T Mon Jul 12 11:51:04 2010
;; (require 'auto-complete)
;; (require 'yasnippet)
;; yay for super auto complete!
;; http://cx4a.org/software/auto-complete/#Latest_Stable
;; Wed May 30 12:28:35 2012
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(put 'narrow-to-region 'disabled nil)
(defalias 'bash-mode 'shell-script-mode)
(defun replace-region-with-shell-output ()
"Run pcut and get first space seperated field in region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "/usr/local/bin/pcut -f 1 |/usr/local/bin/squeeze|/usr/local/bin/fstrip" nil t)))
(defun pvwin2pvnfs ()
"convert a CIFS pv path to NFS pv path."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "/home/thansmann/bin/pvwin2pvnfs" nil t)))
(defun perltidy ()
"Run perltidy on the current region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "perltidy -q -pbp" nil t)))
(defun perltidy-defun ()
"Run perltidy on the current defun."
(interactive)
(save-excursion (mark-defun)
(perltidy-region)))
(defun pythontidy ()
"Run pythontidy on the current region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "~/bin/pythontidy" nil t)))
(defun nl2space ()
"change newlines to a space in region - useful for making bash for i in loops"
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "/usr/local/bin/nl2space|/usr/local/bin/squeeze|/usr/local/bin/fstrip" nil t)))
(defun space2nl ()
"change spaces to a newline in region - useful for making bash for i in loops"
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "/usr/local/bin/space2nl|/usr/local/bin/squeeze|/usr/local/bin/fstrip" nil t)))
(defun space2comma ()
"change spaces to commas in region - useful for making jsh commandlines"
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "/usr/local/bin/squeeze|/usr/local/bin/space2comma" nil t)))
(defun nl2comma ()
"change newlines to commas in region - useful for making jsh commandlines"
(interactive)
(save-excursion