.emacs-my
changeset 189 c3ec8e16a007
parent 188 e36736f245fd
parent 183 6454364c25cf
child 190 f511a2b4694b
equal deleted inserted replaced
188:e36736f245fd 189:c3ec8e16a007
    10 ;; ~/.emacs load this file after ~/.emacs-pre, but before ~/.emacs-post.
    10 ;; ~/.emacs load this file after ~/.emacs-pre, but before ~/.emacs-post.
    11 
    11 
    12 ;; ======================================================================
    12 ;; ======================================================================
    13 ;; Debugging.
    13 ;; Debugging.
    14 
    14 
    15 ;; Shut off message buffer by setting nil. Note - if you need to debug emacs,
    15 ;; Shut off message buffer by setting nil.
    16 ;; comment these out so you can see what's going on.
       
    17 (setq message-log-max 100)
    16 (setq message-log-max 100)
    18 
    17 
    19 ;;(add-hook 'after-init-hook
    18 ;;(add-hook 'after-init-hook
    20 ;;    '(lambda () (setq debug-on-error t)))
    19 ;;    '(lambda () (setq debug-on-error t)))
    21 ;;(debug-on-entry 'command-line-1)
    20 ;;(debug-on-entry 'command-line-1)
    33 (scroll-bar-mode 1)
    32 (scroll-bar-mode 1)
    34 
    33 
    35 (if window-system
    34 (if window-system
    36     ;; Для X-window и Win
    35     ;; Для X-window и Win
    37     (progn
    36     (progn
    38       ;; size of emacs area and position
       
    39       (set-frame-height (selected-frame) 60)
       
    40       (set-frame-width (selected-frame) 120)
       
    41       ;; (set-frame-position (selected-frame) 10 25)
       
    42 
       
    43       ;;установка цветов экрана
    37       ;;установка цветов экрана
    44       (set-background-color "white")
    38       (set-background-color "white")
    45       (set-foreground-color "black")
    39       (set-foreground-color "black")
    46       ;;установка режимов работы курсора
    40       ;;установка режимов работы курсора
    47       (set-cursor-color "brown")
    41       (set-cursor-color "brown")
    48       ;;(setq blink-matching-delay 0.01)
    42       ;;(setq blink-matching-delay 0.01)
    49       ;; курсор не мигает!
    43       ;; курсор не мигает!
    50       ;; (blink-cursor-mode nil)
    44       ;; (blink-cursor-mode nil)
    51       ;; (set-face-font 'default "7x14")
    45       ;; (set-face-font 'default "7x14")
       
    46       (fringe-mode 'default)
    52       )
    47       )
    53   ;; Для tty
    48   ;; Для tty
    54   (progn
    49   (progn
    55     )
    50     )
    56 )
    51 )
    66 
    61 
    67 ;; (load "~/emacs/bin/gnuserv/gnuserv.el")
    62 ;; (load "~/emacs/bin/gnuserv/gnuserv.el")
    68 ;; (require 'gnuserv)
    63 ;; (require 'gnuserv)
    69 ;; (setq gnuserv-frame (selected-frame))
    64 ;; (setq gnuserv-frame (selected-frame))
    70 
    65 
       
    66 (require 'server)
       
    67 (when (and (= emacs-major-version 23) (equal window-system 'w32))
       
    68   (defun server-ensure-safe-dir (dir) "Noop" t)) ; Suppress error directory ~/.emacs.d/server is unsafe on windows.
       
    69 
    71 (server-start)
    70 (server-start)
    72 
    71 
    73 ;; (desktop-load-default)
    72 ;; (desktop-load-default)
    74 ;; (desktop-read)
    73 ;; (desktop-read)
    75 
    74 
    83 (setq line-number-mode t)
    82 (setq line-number-mode t)
    84 
    83 
    85 (setq view-read-only t)
    84 (setq view-read-only t)
    86 
    85 
    87 (setq frame-title-format "Emacs - %b")
    86 (setq frame-title-format "Emacs - %b")
       
    87 
       
    88 ;; Always end a file with a newline.
       
    89 ;; (setq require-final-newline t)
    88 
    90 
    89 ;; ----------------------------------------------------------------------
    91 ;; ----------------------------------------------------------------------
    90 ;; Switching, creating, selecting buffers.
    92 ;; Switching, creating, selecting buffers.
    91 (iswitchb-mode 1)
    93 (iswitchb-mode 1)
    92 (setq iswitchb-buffer-ignore nil)
    94 (setq iswitchb-buffer-ignore nil)
   116  scroll-conservatively 100
   118  scroll-conservatively 100
   117  ;; при перемещении точка останавливается на расстоянии i строк к границе фрейма,
   119  ;; при перемещении точка останавливается на расстоянии i строк к границе фрейма,
   118  scroll-margin 2
   120  scroll-margin 2
   119  scroll-preserve-screen-position t
   121  scroll-preserve-screen-position t
   120  )
   122  )
   121 
       
   122 ;; ----------------------------------------------------------------------
       
   123 ;; fringe-mode
       
   124 
   123 
   125 ;; ----------------------------------------------------------------------
   124 ;; ----------------------------------------------------------------------
   126 ;; *Text*
   125 ;; *Text*
   127 (setq default-major-mode 'text-mode)
   126 (setq default-major-mode 'text-mode)
   128 
   127 
   401 (add-hook 'write-file-hooks 'time-stamp)
   400 (add-hook 'write-file-hooks 'time-stamp)
   402 
   401 
   403 ;; ======================================================================
   402 ;; ======================================================================
   404 ;; *auto-fill*
   403 ;; *auto-fill*
   405 
   404 
   406 ;; To enable/disable auto-fill mode type ESC M-f.
       
   407 
       
   408 (setq-default fill-column 78)
   405 (setq-default fill-column 78)
   409 
   406 
   410 ;; By default used American convention - sentence and with two spaces. Change
   407 ;; By default used American convention - sentence and with two spaces. Change
   411 ;; it to one space. Has affect on filling and M-a, M-e commands.
   408 ;; it to one space. Has affect on filling and M-a, M-e commands.
   412 (setq sentence-end-double-space nil)
   409 (setq sentence-end-double-space nil)
   454 ;; Miscellaneous
   451 ;; Miscellaneous
   455 
   452 
   456 ;; (desire 'abbrev)
   453 ;; (desire 'abbrev)
   457 ;; (desire 'bibtex)
   454 ;; (desire 'bibtex)
   458 ;; (desire 'calc)
   455 ;; (desire 'calc)
   459 ;; (desire 'cc-mode)
       
   460 ;; (desire 'ediff)
   456 ;; (desire 'ediff)
   461 ;; (desire 'eiffel-mode)
   457 ;; (desire 'eiffel-mode)
   462 ;; (desire 'emacs-w3m)
   458 ;; (desire 'emacs-w3m)
   463 ;; (desire 'eudc)
   459 ;; (desire 'eudc)
   464 ;; (desire 'filladapt)
   460 ;; (desire 'filladapt)
   725           jabber-backlog-days 30
   721           jabber-backlog-days 30
   726           jabber-alert-presence-message-function (lambda (who oldstatus newstatus statustext) nil)
   722           jabber-alert-presence-message-function (lambda (who oldstatus newstatus statustext) nil)
   727           )
   723           )
   728   )
   724   )
   729 
   725 
       
   726 ;; fsm used in emacs jabber
       
   727 (when (featurep 'fsm)
       
   728   (setq fsm-debug nil)                  ; Disable *fsm-debug* buffer.
       
   729   )
   730 
   730 
   731 ;; ----------------------------------------------------------------------
   731 ;; ----------------------------------------------------------------------
   732 ;; rcirc
   732 ;; rcirc
   733 
   733 
   734 ;; Turn on logging everything to a special buffer, for debugging.
   734 ;; Turn on logging everything to a special buffer, for debugging.
   762 (if (file-exists-p (concat my-el-dir "/mercurial.el"))
   762 (if (file-exists-p (concat my-el-dir "/mercurial.el"))
   763     (require 'mercurial)
   763     (require 'mercurial)
   764   )
   764   )
   765 
   765 
   766 (if window-system
   766 (if window-system
   767     (setq-default vc-annotate-background "white")
   767     (progn
       
   768      (custom-set-variables
       
   769       '(vc-annotate-very-old-color "#0b5b20")
       
   770       '(vc-annotate-background "white")
       
   771       '(vc-annotate-color-map
       
   772         (quote (
       
   773                 (20 .  "#EE0000")
       
   774                 (40 .  "#E0800D")
       
   775                 (60 .  "#D3001A")
       
   776                 (80 .  "#C68027")
       
   777                 (100 . "#B90034")
       
   778                 (120 . "#AB8042")
       
   779                 (140 . "#9E004F")
       
   780                 (160 . "#91805C")
       
   781                 (180 . "#840069")
       
   782                 (200 . "#778077")
       
   783                 (220 . "#690084")
       
   784                 (240 . "#5C8091")
       
   785                 (260 . "#4F009E")
       
   786                 (280 . "#4280AB")
       
   787                 (300 . "#3400B9")
       
   788                 (320 . "#2780C6")
       
   789                 (340 . "#1A00D3")
       
   790                 (360 . "#0D80E0"))))
       
   791       )
       
   792      )
   768   )
   793   )
   769 
   794 
   770 ;; ----------------------------------------------------------------------
   795 ;; ----------------------------------------------------------------------
   771 ;; DVC
   796 ;; DVC
   772 
   797 
   777 ;; ======================================================================
   802 ;; ======================================================================
   778 ;; Devel, prog
   803 ;; Devel, prog
   779 
   804 
   780 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
   805 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
   781 
   806 
   782 (setq comment-style (quote indent))
   807 (setq-default comment-style (quote indent))
       
   808 (setq-default comment-column 44)
       
   809 (setq-default comment-fill-column 100)
   783 
   810 
   784 (setq-default show-trailing-whitespace t)
   811 (setq-default show-trailing-whitespace t)
   785 
   812 
   786 ;; ----------------------------------------------------------------------
   813 ;; ----------------------------------------------------------------------
   787 ;; Diff, patch
   814 ;; Diff, patch
   829 ;; ----------------------------------------------------------------------
   856 ;; ----------------------------------------------------------------------
   830 ;; asm
   857 ;; asm
   831 ;; (setq-default asm-comment-char 59)
   858 ;; (setq-default asm-comment-char 59)
   832 (add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
   859 (add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
   833 
   860 
       
   861 ;; (add-hook 'asm-mode-hook '(lambda () (local-unset-key ":")))
       
   862 ;; (add-hook 'asm-mode-hook '(lambda () (local-set-key ":" ":")))
       
   863 
   834 ;; ----------------------------------------------------------------------
   864 ;; ----------------------------------------------------------------------
   835 ;; LISP
   865 ;; LISP
   836 (setq list-command-history-max 256)
   866 (setq list-command-history-max 256)
   837 
   867 
   838 ;; ----------------------------------------------------------------------
   868 ;; ----------------------------------------------------------------------
   839 ;; C, c-lang
   869 ;; C, c-mode, C++, c++-mode
       
   870 
   840 (setq c-echo-syntactic-information-p t)
   871 (setq c-echo-syntactic-information-p t)
       
   872 (add-hook 'c-mode-common-hook
       
   873  (lambda ()
       
   874    ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
       
   875    (c-toggle-auto-newline -1)
       
   876    ;; Delete all preceding whitespace by DEL.
       
   877    (c-toggle-hungry-state -1)
       
   878    ))
   841 
   879 
   842 (defconst my-c-style
   880 (defconst my-c-style
   843   '((c-tab-always-indent . t)
   881   '((c-tab-always-indent . t)
   844     (c-comment-only-line-offset . 4)
   882     (c-comment-only-line-offset . 4)
   845     (c-hanging-braces-alist
   883     (c-hanging-braces-alist
   879         (substatement-open . 0)
   917         (substatement-open . 0)
   880         ))
   918         ))
   881     (c-echo-syntactic-information-p . t))
   919     (c-echo-syntactic-information-p . t))
   882   "My C Programming Style")
   920   "My C Programming Style")
   883 
   921 
   884 ;; (objc-mode . "my-mode") (c++-mode . "cc-mode")
       
   885 (add-hook 'c-mode-common-hook
   922 (add-hook 'c-mode-common-hook
   886           (lambda () (c-add-style "my" my-c-style t)))
   923           (lambda () (c-add-style "my" my-c-style t)))
   887 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (other . "my")))
   924 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") (other . "my")))
   888 
       
   889 ;; Customizations for all modes in CC Mode.
       
   890 ;; (defun my-c-mode-common-hook ()
       
   891 ;;   ;; add my personal style and set it for the current buffer
       
   892 ;;   (c-add-style "PERSONAL" my-c-style t)
       
   893 ;;   ;; other customizations
       
   894 ;;   ;; we like auto-newline and hungry-delete
       
   895 ;;   (c-toggle-auto-hungry-state 1)
       
   896 ;;   ;; key bindings for all supported languages.  We can put these in
       
   897 ;;   ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
       
   898 ;;   ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
       
   899 ;;   (define-key c-mode-base-map "\C-m" 'c-context-line-break))
       
   900 
       
   901 ;; (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
       
   902 
   925 
   903 ;; ----------------------------------------------------------------------
   926 ;; ----------------------------------------------------------------------
   904 ;; *csharp*, c-sharp
   927 ;; *csharp*, c-sharp
   905 ;;
   928 ;;
   906 (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
   929 (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)