-
Notifications
You must be signed in to change notification settings - Fork 0
/
myload.el
922 lines (687 loc) · 24.7 KB
/
myload.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
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
(setq mydir "")
(setq mydir
(file-name-directory
(or load-file-name (buffer-file-name)))
)
(add-to-list 'load-path mydir)
(add-to-list 'load-path (concat mydir "mylisp"))
(defun my-hide/show-entry ()
(interactive)
(let ((ol (save-excursion
(end-of-line)
(overlays-at (point)))))
(cond (ol
(dolist (o ol)
(cond ((eq 'outline (overlay-get o 'invisible))
(show-entry)
(return))
(t
(hide-entry)))))
(t
(hide-entry)))
))
(require 'outline)
(define-key outline-mode-map [(f7)] 'hide-body)
(define-key outline-mode-map [(f10)] 'my-hide/show-entry)
(define-key outline-minor-mode-map [(f7)] 'hide-body)
(define-key outline-minor-mode-map [(f10)] 'my-hide/show-entry)
(setq column-number-mode t)
(setq mouse-yank-at-point t)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;(mouse-avoidance-mode 'animate)
(setq frame-title-format "%b@emacs")
(setq default-major-mode 'text-mode)
(setq next-line-add-newlines nil)
(setq make-backup-files nil) ;; Don't create the backup file
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
;; ====================
;; undo and redo
;; ====================
(require 'redo)
(global-set-key [(f5)] 'undo)
(global-set-key [(shift f5)] 'redo)
;; (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checking" t)
;; (autoload 'global-flyspell-mode "flyspell" "On-the-fly spelling" t)
;; (global-flyspell-mode t)
(add-hook 'text-mode-hook (lambda () (turn-on-auto-fill)))
;; ================================
;; % for paren match
;; ================================
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
;; ====== end of paren match ============
;; Change the outline prefix command for C-c @ to C-o
(setq outline-minor-mode-prefix [(control o)])
;; ibuffer
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; linum, much faster than setnu!!! Use it.
(require 'linum)
(setq linum-eager nil)
;; htmlize
(require 'htmlize)
;; browse-kill-ring
(require 'browse-kill-ring)
(global-set-key [(control c)(k)] 'browse-kill-ring)
(browse-kill-ring-default-keybindings)
(require 'ido)
(ido-mode t)
(cua-mode t)
;; ;; =====CEDET============
(defun ce ()
(interactive)
;; cvs version. 8-14-2009
(load-file (concat mydir "cedet/common/cedet.el"))
;; (global-ede-mode t) ;; project support!
(semantic-load-enable-excessive-code-helpers)
(require 'semantic-ia)
(require 'semantic-gcc)
;; (semantic-add-system-include "~/exp/include/boost_1_37" 'c++-mode)
)
;; ;; ======ECB========
(defun lecb ()
(interactive)
;; ecb
(add-to-list 'load-path (concat mydir "ecb-2.32"))
(require 'ecb-autoloads)
)
;; (require 'ecb)
;; ;;(require 'ecb-autoloads)
;; Call "M-x ecb-activate" to activated ECB.
;; Call "M-x ecb-customize-most-important" to get a list of the most important
;; options of ECB. These are options you should at least know that they exist.
;; Call "M-x ecb-show-help" to get a detailed online-help for ECB. If you are
;; using ECB the first time you should read the online help accurately!
;; ;; =====End of ECB======
(defun s-serv ()
""
(interactive)
(server-start)
;; (setq frame-title-format "[%b@emacs]")
;; (setq global-hl-line-mode nil)
)
;; (s-serv)
;; ispell
;; (add-to-list 'Info-default-directory-list "c:/usr/local/info/")
(auto-image-file-mode t)
(defun w32-restore-frame ()
"Restore a minimized frame"
(interactive)
(w32-send-sys-command 61728))
(defun w32-maximize-frame ()
"Maximize the current frame"
(interactive)
(w32-send-sys-command 61488))
;; (add-hook 'after-make-frame-functions 'w32-maximize-frame)
(require 'saveplace)
(require 'savehist)
(require 'recentf)
;; misc
;;(require 'test)
(load-file (concat mydir "mylisp/test.el"))
(defalias 'bl 'emacs-lisp-byte-compile-and-load)
(defalias 'll 'longlines-mode)
;; clisp/slime
;; ==============================================================================================
(defun load-slime ()
(interactive)
(add-to-list 'load-path (concat mydir "slime-2.0")) ; your SLIME directory
(setq inferior-lisp-program "C:/clisp-2.41-win32-with-readline-and-gettext/clisp-2.41/clisp -K full") ; your Lisp system
(require 'slime)
(slime-setup)
(define-key slime-mode-map (kbd "(") 'insert-parentheses)
(define-key slime-mode-map (kbd ")") 'move-past-close-and-reindent)
(define-key slime-mode-map (kbd ")") 'up-list)
(define-key emacs-lisp-mode-map (kbd "C-c C-q") 'slime-close-parens-at-point)
)
;; Common Lisp indentation.
(autoload 'common-lisp-indent-function "cl-indent")
;;(setq lisp-indent-function 'common-lisp-indent-function)
(add-hook 'lisp-mode-hook (lambda ()
(local-set-key "\r" 'newline-and-indent)
(setq lisp-indent-function 'common-lisp-indent-function)
(setq indent-tabs-mode nil)
(hs-minor-mode 1)
))
;; Emacs Lisp mode, auto indent.
(add-hook 'emacs-lisp-mode-hook (lambda ()
(local-set-key "\r" 'newline-and-indent)
(hs-minor-mode 1)
))
;; Original value: "http://www.lispworks.com/reference/HyperSpec/"
(setq common-lisp-hyperspec-root "file:///E:/ftp/clisp/lispworks-box-4.0/lib/5-0-0-0/manual/online/web/CLHS/")
(define-key emacs-lisp-mode-map (kbd "(") 'insert-parentheses)
;;(define-key emacs-lisp-mode-map (kbd ")") 'move-past-close-and-reindent)
(define-key emacs-lisp-mode-map (kbd ")") 'up-list)
;; lisp: for convenient
(defun uplp ()
"Close current block with addition paren"
(interactive)
(let (pip)
(save-excursion
(save-match-data
(unless (looking-at "(")
(backward-up-list))
(setq pip (point))
(insert "(")
(forward-list)
(insert ")")
(goto-char pip)
;;(indent-pp-sexp)
))
(when pip
(goto-char (+ pip 1)))
))
(global-set-key "\M-`" 'uplp)
(defun inddefun ()
"indent defun"
(interactive)
(save-excursion
(beginning-of-defun)
(indent-pp-sexp)
))
(defun preg ()
"Paren the region"
(interactive)
(when (and transient-mark-mode mark-active)
(let (b)
(if (> (point)
(mark))
(exchange-point-and-mark))
(goto-char (point))
(lisp-indent-line)
(setq b (point))
(goto-char (mark))
(skip-chars-backward "\n\t\s")
(insert ")")
(goto-char b)
(insert "(")
(goto-char (+ b 1))
)))
(defun unpb ()
"Un-paren block."
(interactive)
(let ((pos (point)))
(save-excursion
(backward-up-list)
(delete-region (1+ (point)) pos)
(delete-pair)
(inddefun)
)))
;; ======================================================
(defun ht ()
"tag -> <tag> </tag>"
(interactive)
(let ((cw (current-word))
(pos))
(re-search-backward "\\_<")
(kill-word 1)
(insert (concat "<" cw ">\n"))
(indent-according-to-mode)
(setq pos (point))
(insert "\n")
(insert (concat "</" cw ">"))
(indent-according-to-mode)
(goto-char pos)
))
(defun hl ()
"tag -> <tag> </tag>"
(interactive)
(let ((cw (current-word))
(pos))
(re-search-backward "\\_<")
(kill-word 1)
(insert (concat "<" cw ">"))
(setq pos (point))
(insert (concat "</" cw ">"))
(goto-char pos)
))
(defun vi-list ()
"Simulate a :set list in Vi."
(interactive)
(standard-display-ascii ?\t "^I")
(standard-display-ascii ?\n "$\n")
)
(defun vi-nolist ()
"Simulate a :set nolist in Vi."
(interactive)
(standard-display-ascii ?\t "\t")
(standard-display-ascii ?\n "\n")
)
(add-hook 'python-mode-hook (lambda () (local-set-key "\r" 'newline-and-indent)))
;; MUSE
;; ===========================================
(add-to-list 'load-path (concat mydir "muse-3.12/lisp"))
(require 'muse-mode) ; load authoring mode
(require 'muse-html) ; load publishing styles I use
;(require 'muse-latex)
;(require 'muse-texinfo)
;(require 'muse-docbook)
(require 'muse-colors)
(require 'muse-wiki)
;(setq muse-wiki-allow-nonexistent-wikiword t)
(require 'muse-project) ; publish files in projects
;;(setq muse-html-style-sheet "d:/WiKi/core.css")
(setq muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"./core.css\" />")
(setq muse-xhtml-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"./core.css\" />")
(muse-derive-style "wiki-xhtml" "xhtml"
;;:header "~/.journal/header.html"
;;:footer "~/.journal/footer.html"
:style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"./core.css\" />")
; Self-defined style
(setq muse-project-alist
'(
;; ("Wiki"
;; ("/media/d/text/wiki" :default "index")
;; (:base "wiki-xhtml"
;; :path "/media/d/text/wiki/publish"
;; :force-publish ("WikiIndex")))
("WiKi"
("d:/WiKi/" :default "index")
(:base "wiki-xhtml"
:path "d:/publish"))
;; ("WikiPlanner"
;; ("d:/plans" ;; Or wherever you want your planner files to be
;; :default "index"
;; :major-mode planner-mode
;; :visit-link planner-visit-link))
))
(defvar muse-css-file)
(setq muse-css-file "D:/publish/core.css")
(defun muse-publish-file-imbed-css ()
""
(interactive)
(let* ((sheet (concat "<STYLE TYPE=\"text/css\">\n<!--\n<lisp> (progn (insert-file-contents \""
muse-css-file
"\") nil)</lisp>\n-->\n</STYLE>"))
(muse-html-style-sheet sheet)
(muse-xhtml-style-sheet sheet))
(muse-project-publish-this-file)
))
(add-hook 'muse-mode-hook 'outline-minor-mode)
;; Remember
(require 'remember)
(autoload 'remember "remember" nil t)
(autoload 'remember-region "remember" nil t)
;; (require 'remember-planner)
;; (setq remember-handler-functions '(remember-planner-append))
;; (setq remember-annotation-functions planner-annotation-functions)
;; ;;(plan)
;; support "DEFUN" in emacs source codes:
(require 'cc-menus)
(setq cc-imenu-c-generic-expression
(append cc-imenu-c-generic-expression '(("Defun" "^DEFUN[ \t]*([ \t]*\"\\([a-zA-Z0-9-]+\\)\"" 1))))
;; Horizontal scroll
;; =======================================
(setq auto-hscroll-mode nil)
(defvar number-to-scroll 1)
(global-set-key [(control ?\,)]
(lambda (n) (interactive "P") (scroll-right (or n number-to-scroll) nil)))
(global-set-key [(control ?\.)]
(lambda (n) (interactive "P") (scroll-left (or n number-to-scroll) nil)))
(put 'scroll-left 'disabled nil)
;; Complete (HE) AutoType
;; There are totally 14 funcs available. Here 11 are used.
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
;; ===Muse===Skeleton===
(define-skeleton exm
"Muse <example> </example> make up"
nil
"<example>\n"
_ "\n"
"</example>\n"
)
(define-skeleton src
"Insert scr tag in Muse"
nil
"<src lang=\"" (skeleton-read "Lang name: " "lisp") "\">\n"
_ "\n"
"</src>\n"
)
;; ====elisp skeleton====
(define-skeleton defi
""
nil
"(defun " (skeleton-read "Proc name: ") " ()\n"
> "\"\"\n"
> "(interactive)\n"
> "(let ((case-fold-search t))\n"
> "(save-excursion\n"
> "(save-match-data\n"
> _ "\n"
> "))\n"
> "))"
)
(global-set-key "<" 'skeleton-pair-insert-maybe)
(global-set-key "(" 'skeleton-pair-insert-maybe)
(global-set-key "[" 'skeleton-pair-insert-maybe)
(global-set-key "{" 'skeleton-pair-insert-maybe)
;;(global-set-key "\"" 'skeleton-pair-insert-maybe)
; Single ' is often used in elisp, so don't pair it.
;(global-set-key "\'" 'skeleton-pair-insert-maybe)
(defun my-double-quote (arg)
"Document string:"
(interactive "*P")
(if (and (char-after (point))
(= ?\" (char-after (point))))
(forward-char)
(skeleton-pair-insert-maybe arg)))
(global-set-key "\"" 'my-double-quote)
(setq skeleton-pair t)
;; ===snippet===
(require 'snippet)
(defun defk ()
(interactive)
(snippet-insert (concat "(defun $${proc-name} ($$)\n"
"$>\"$${Document string:}\"\n"
"$>(interactive$$)\n"
"$>(let ((case-fold-search t))\n"
"$>(save-excursion\n"
"$>(save-match-data\n"
"$>$.\n"
"$>))\n"
"$>))")))
(defun ss ()
(interactive)
(snippet-insert "\"$${string...}\"")
)
(defun pse ()
(interactive)
(delete-char -1)
(snippet-insert "(\"$${String....}\\n\"$$)$.")
)
;; ;; (setq last-kbd-macro
;; ;; [?\M-b ?\M-@ ?\M-w ?\C-s ?\M-y ?\C-s])
;; ;; [134217826 134217792 134217847 19 134217849 19]
;; (fset 'search-id
;; (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217826 134217792 134217847 19 134217849 19] 0 "%d")) arg)))
;; (global-set-key [(f3)] 'search-id)
;;; Prevent Extraneous Tabs
(setq-default indent-tabs-mode nil)
(setq set-mark-command-repeat-pop t)
;** line-move-ignore-invisible now defaults to t.
;; Org mode
(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-hide-leading-stars t)
;; (setq org-agenda-files (list "d:/org/work.org"
;; "d:/org/school.org"
;; "d:/org/home.org"))
(setq org-directory "d:/org/")
;; (appt-activate 1)
(defun bzg-org-agenda-to-appt ()
"Activate appointments found in `org-agenda-files'."
(interactive)
(require 'org)
(let* ((today (org-date-to-gregorian
(time-to-days (current-time))))
(files org-agenda-files)
entries file)
(while (setq file (pop files))
(setq entries (append entries (org-agenda-get-day-entries
file today :timestamp))))
(mapc (lambda(x)
(let* ((event (org-trim (get-text-property 1 'txt x)))
(time (number-to-string
(get-text-property 1 'time-of-day x)))
(time-st (concat (substring time 0 2) ":"
(substring time 2 4))))
(appt-add time-st event))) entries)))
(require 'appt)
(defun appt-list ()
"List all the Appt"
(interactive)
(with-output-to-temp-buffer "*Appt-list*"
(save-excursion
(set-buffer standard-output)
(dolist (el appt-time-msg-list)
(insert (nth 1 el) "\n")))))
;; org and remember....
;; (setq org-default-notes-file "~/.notes")
;; (setq remember-annotation-functions '(org-remember-annotation))
;; (setq remember-handler-functions '(org-remember-handler))
;; (add-hook 'remember-mode-hook 'org-remember-apply-template)
;; (setq org-remember-templates
;; '((?t "* TODO %?\n %i\n %a\n" "d:/org/MiscTask.org")
;; (?j "* %?\n%i\n %a %U\n\n----" "c:/.notes")
;; (?i "* %^{Title}\n %i\n %a %U\n\n----" "c:/.notes" "Quick Notes")))
;; codepilot
(load-file (concat mydir "mylisp/codepilot/load.el"))
;; (windmove-default-keybindings)
;;(setq windmove-wrap-around t)
;; Remove the print-buffer button in the tool bar.
;; ===============================================
(delete-if (lambda (button)
(and (consp button)
(eq (car button) 'print-buffer)))
tool-bar-map)
(setq tramp-default-method "ftp")
;; Erlang
;; ---------------------
;; (add-to-list 'load-path "C:/Program Files/erl5.5.5/lib/tools-2.5.5/emacs")
;; (setq erlang-root-dir "C:/Program Files/erl5.5.5")
;; ;;(setq exec-path (cons "C:/Program Files/erl5.5.5/bin" exec-path))
;; (add-to-list 'exec-path "C:/Program Files/erl5.5.5/bin")
;; (require 'erlang-start)
;; ;; ACL
;; ;; ------------------
;; ;;(load "C:/Program Files/acl81-express/eli/fi-site-init.el")
;; ; This is sample code for starting and specifying defaults to the
;; ; Emacs-Lisp interface. Uncomment this code if you want the ELI
;; ; to load automatically when you start emacs.
;; (push "C:/Program Files/acl81-express/eli" load-path)
;; (load "fi-site-init.el")
;; ;
;; ;; (setq fi:common-lisp-image-name "C:/Program Files/acl81-express/mlisp.exe")
;; ;; (setq fi:common-lisp-image-file "C:/Program Files/acl81-express/mlisp.dxl")
;; (setq fi:common-lisp-image-name "C:/Program Files/acl81-express/allegro-express.exe")
;; (setq fi:common-lisp-image-file "C:/Program Files/acl81-express/allegro-express.dxl")
;; (setq fi:common-lisp-directory "C:/Program Files/acl81-express")
;; (defun run-lisp ()
;; (interactive)
;; (fi:common-lisp "*common-lisp*"
;; "c:/program files/acl81-express/"
;; "c:/program files/acl81-express/allegro-express.exe"
;; '("+B" "+cn")
;; "localhost"
;; "c:/program files/acl81-express/allegro-express.dxl"))
(setq slime-multiprocessing t)
(setq *slime-lisp* "allegro-express.exe")
(setq *slime-port* 4006)
;; (add-to-list 'exec-path "C:/Program Files/acl81-express")
(setenv "PATH" (concat (getenv "PATH") ";C:\\Program Files\\acl81-express"))
(defun acl-slime ()
(interactive)
(shell-command
(format "%s +B +cm -L c:/.slime.lisp -- -p %s --ef %s &"
*slime-lisp* *slime-port*
slime-net-coding-system))
(delete-other-windows)
(while (not (ignore-errors (slime-connect "localhost" *slime-port*)))
(sleep-for 0.2)))
(add-to-list 'auto-mode-alist '("\\.cl$" . lisp-mode))
;; ;; Color Theme
;; (add-to-list 'load-path (concat mydir "color-theme-6.6.0"))
;; (require 'pink-bliss)
;; (require 'mycolor)
;; (defalias 'pink 'color-theme-pink-bliss)
;; (defalias 'cold 'color-theme-pok-wog)
;; Anything!!!!
;; ==================
(require 'anything)
(require 'anything-config)
(setq w32-pass-lwindow-to-system nil)
(setq w32-lwindow-modifier 'hyper)
(global-set-key [(hyper ?\h)] 'anything)
;; ----mark----
(global-set-key [(control f6)] 'push-mark-command)
(global-set-key [(meta f6)] 'pop-to-mark-command)
;; Regex-tool
;; ===========================
;; (load "regex-tool" t) ; load regex-tool if it's available
;; Misc
;; ===============
(defun gfn ()
""
(interactive)
(kill-new (buffer-file-name)))
;; (global-set-key "\C-x\C-m" 'execute-extended-command)
(define-key text-mode-map "\C-d" 'backward-kill-word)
(defalias 'im 'imenu-add-menubar-index)
;; Ruby
;; ================
(defun load-ruby ()
""
(interactive)
(require 'find-recursive)
;; (require 'snippet)
(add-to-list 'load-path "F:/Ruby/misc")
(add-to-list 'load-path (concat mydir "emacs-rails"))
(require 'rails)
(define-skeleton qq
"<% -%>"
nil
"<%" _ " %>"
)
)
;; nxhtml
;; =================
;; (load (concat mydir "nxhtml/autostart.el"))
(define-skeleton aa
""
nil
"{% " _ " %}"
)
;; VI keys:
;; ===================
(global-set-key [(hyper ?j)] 'next-line)
(global-set-key [(hyper ?k)] 'previous-line)
(global-set-key [(hyper ?h)] 'backward-char)
;; (global-set-key [(hyper ?l)] 'forward-char)
(require 'callplot)
;; (setq mouse-drag-copy-region nil)
;; ciciles
;; ============
;; (add-to-list 'load-path (concat mydir "icicles"))
(defalias 'c 'calculator)
;; color
(when (eq system-type 'windows-nt)
(w32-define-rgb-color 204 232 207 "Nice Green")
(set-background-color "Nice Green")
(push '(background-color . "Nice Green") default-frame-alist))
(when (eq system-type 'windows-nt)
(push '(font . "-outline-DejaVu Sans Mono-normal-r-normal-normal-13-97-96-96-c-*-iso8859-1")
default-frame-alist)
(set-frame-font "-outline-DejaVu Sans Mono-normal-r-normal-normal-13-97-96-96-c-*-iso8859-1")
;; ÑźÚ
;; (set-default-font "YaHei Consolas Hybrid-13")
(set-fontset-font (frame-parameter nil 'font)
'han '("΢ÈíÑźÚ". "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'cjk-misc '("΢ÈíÑźÚ" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'bopomofo '("΢ÈíÑźÚ" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'gb18030 '("΢ÈíÑźÚ". "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'symbol '("΢ÈíÑźÚ". "unicode-bmp")))
;; temp:
(modify-syntax-entry ?- "w" emacs-lisp-mode-syntax-table)
(modify-syntax-entry ?- "w" python-mode-syntax-table)
;; company mode:
(add-to-list 'load-path (concat mydir "company-0.4.3"))
(autoload 'company-mode "company" nil t)
;; yasnippet
(add-to-list 'load-path (concat mydir "yasnippet-0.5.7"))
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory (concat mydir "yasnippet-0.5.7/snippets"))
;; js2-mode
(defun load-js2 ()
(interactive)
(when (> emacs-major-version 22)
(provide 'js2-mode)
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
))
(setq find-program "find1")
;; haskell
(defun load-haskell ()
(interactive)
(add-to-list 'load-path (concat mydir "haskell-mode-2.4"))
(load (concat mydir "haskell-mode-2.4/haskell-site-file"))
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
(add-hook 'haskell-mode-hook
(lambda ()
(interactive)
(define-key haskell-mode-map "\C-c\C-f" 'haskell-hoogle)))
)
(load-haskell)
;; javascript mode
(autoload #'espresso-mode "espresso" "Start espresso-mode" t)
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))
(add-hook 'espresso-mode-hook 'hs-minor-mode)
;; php mode
(add-to-list 'load-path (concat mydir "php-mode-1.5.0"))
(require 'php-mode)
(add-to-list 'auto-mode-alist '("\\.module$" . php-mode))
;; Load the php-imenu index function
(autoload 'php-imenu-create-index "php-imenu" nil t)
;; Add the index creation function to the php-mode-hook
(add-hook 'php-mode-hook 'php-imenu-setup)
(defun php-imenu-setup ()
(setq imenu-create-index-function (function php-imenu-create-index))
;; uncomment if you prefer speedbar:
;;(setq php-imenu-alist-postprocessor (function reverse))
;; (imenu-add-menubar-index)
)
(pushnew 'php-mode codepilot-cc-major-modes)
;; desktop
;; M-x desktop-save
;; It's better put this near the end of the file, after
;; the setting related to file opening since desktop script
;; will open some files automatically.
;; e.g., put it after chinese setting and CEDET.
;;
;; Move it to the end regarding the case .emacs has problem.
;;
(load "desktop")
;; (if (string< "21" (substring (emacs-version) 10 12 ))
;; (desktop-save-mode)
;; (desktop-load-default))
(desktop-save-mode)
;!!!!!delete!!!!(desktop-read)!!!otherwise, the buffer will be
;restore twice! That's why longlines mode doesn't work well.
(setq inhibit-startup-screen t)
;; (add-hook 'after-init-hook (lambda ()
;; (w32-maximize-frame)
;; ;; (sit-for 0.2)
;; ;; (codepilot-ide)
;; )
;; :append)