.emacs-my
changeset 340 6ae9e98a1d53
parent 328 c770f75a351f
parent 339 4e131c57a0ef
child 342 f833d68fa5ae
equal deleted inserted replaced
328:c770f75a351f 340:6ae9e98a1d53
    16 (setq message-log-max 512)
    16 (setq message-log-max 512)
    17 
    17 
    18 ;; Set the debug option to enable a backtrace when a problem occurs.
    18 ;; Set the debug option to enable a backtrace when a problem occurs.
    19 (setq debug-on-error nil)               ; t/nil
    19 (setq debug-on-error nil)               ; t/nil
    20 
    20 
       
    21 ;; ----------------------------------------------------------------------
       
    22 ;; mode groups
       
    23 
       
    24 (defvar my-devel-mode-list
       
    25   '(sh-mode script-mode java-mode c-mode
       
    26             lisp-mode makefile-mode makefile-gmake-mode python-mode)
       
    27   "List of development modes.")
       
    28 
       
    29 (defvar my-devel-mode-hook-list
       
    30   '(sh-mode-hook script-mode-hook java-mode-hook c-mode-hook
       
    31             lisp-mode-hook makefile-mode-hook makefile-gmake-mode-hook python-mode-hook)
       
    32   "List of development mode hooks.")
       
    33 
       
    34 (defvar my-text-mode-list
       
    35   '(outline-mode text-mode)
       
    36   "List of text modes.")
       
    37 
       
    38 (defvar my-text-mode-hook-list
       
    39   '(outline-mode-hook text-mode-hook)
       
    40   "List of text mode hooks.")
       
    41 
    21 ;; ======================================================================
    42 ;; ======================================================================
    22 ;; appearance.
    43 ;; appearance.
    23 
    44 
    24 (menu-bar-mode -1)
    45 (menu-bar-mode -1)
    25 (tool-bar-mode -1)
    46 (tool-bar-mode -1)
    26 (tooltip-mode -1)
    47 (tooltip-mode -1)
    27 (scroll-bar-mode 1)
    48 (scroll-bar-mode 1)
       
    49 
       
    50 (setq frame-title-format "Emacs - %b")
       
    51 
       
    52 ;; show column & line numbers in status bar
       
    53 (setq column-number-mode t)
       
    54 (setq line-number-mode t)
       
    55 
       
    56 ;; Also useful such format: (setq display-time-format " %H:%M %d-%m-%y ")
       
    57 (setq display-time-24hr-format t)
       
    58 (setq display-time-default-load-average nil)
       
    59 (display-time)                          ; display-time-mode
    28 
    60 
    29 (if window-system
    61 (if window-system
    30     ;; For graphical environment.
    62     ;; For graphical environment.
    31     (progn
    63     (progn
    32       (set-background-color "white")
    64       (set-background-color "white")
    33       (set-foreground-color "black")
    65       (set-foreground-color "black")
    34       (set-cursor-color "brown")
    66       (set-cursor-color "brown")
       
    67       ;; (set-mouse-color "white")
    35       (setq cursor-type 'box)           ; box, hollow, bar, hbar
    68       (setq cursor-type 'box)           ; box, hollow, bar, hbar
    36       ;;(setq blink-matching-delay 0.01)
    69       ;;(setq blink-matching-delay 0.01)
    37       (blink-cursor-mode 1)
    70       (blink-cursor-mode 1)
    38       ;; (set-face-font 'default "7x14")
    71       ;; (set-face-font 'default "7x14")
    39       (fringe-mode 'default)
    72       (fringe-mode 'default)
    69 ;; (desktop-read)
   102 ;; (desktop-read)
    70 
   103 
    71 ;; ======================================================================
   104 ;; ======================================================================
    72 ;; standart/general settings.
   105 ;; standart/general settings.
    73 
   106 
       
   107 (if (boundp 'confirm-kill-emacs)
       
   108     (setq confirm-kill-emacs 'yes-or-no-p))
       
   109 
       
   110 ;; Try to speed things up, especially in VM.
       
   111 (setq gc-cons-threshold 2000000)
       
   112 
       
   113 ;; Don't beep in my headphones!
       
   114 (setq ring-bell-function '(lambda () "Empty ring-bell-function." nil))
       
   115 (setq visible-bell t) ; With default ring-bell-function in text terminal
       
   116                       ; revert screen if press [end] or [home]
       
   117 
       
   118 ;; Prompt before evaluating local bits of lisp.  This stops people
       
   119 ;; putting things at the end of files which delete all your files!
       
   120 (setq enable-local-variables t
       
   121       enable-local-eval      1)
       
   122 
    74 (setq kill-whole-line t)
   123 (setq kill-whole-line t)
    75 
   124 
    76 ;; show column & line numbers in status bar
       
    77 (setq column-number-mode t)
       
    78 (setq line-number-mode t)
       
    79 
       
    80 (setq view-read-only t)
   125 (setq view-read-only t)
    81 
       
    82 (setq frame-title-format "Emacs - %b")
       
    83 
   126 
    84 (setq read-quoted-char-radix 16)
   127 (setq read-quoted-char-radix 16)
    85 
   128 
    86 ;; ----------------------------------------------------------------------
   129 ;; ----------------------------------------------------------------------
    87 ;; switching, creating, selecting buffers.
   130 ;; switching, creating, selecting buffers.
   107 (global-set-key "\C-x\C-b" 'ibuffer)
   150 (global-set-key "\C-x\C-b" 'ibuffer)
   108 
   151 
   109 ;; ----------------------------------------------------------------------
   152 ;; ----------------------------------------------------------------------
   110 ;; scrolling.
   153 ;; scrolling.
   111 
   154 
       
   155 (defvar my-scroll-margin 4)
       
   156 
   112 (setq-default
   157 (setq-default
   113  scroll-step 1
   158  scroll-step 1
   114  scroll-conservatively 100
   159  scroll-conservatively my-scroll-margin
   115  ;; При перемещении точка останавливается на расстоянии i строк к границе фрейма.
       
   116  scroll-margin 2
       
   117  scroll-preserve-screen-position t
   160  scroll-preserve-screen-position t
   118  )
   161  )
   119 
   162 
       
   163 ;; Set margin only for desired modes! Do not frustrate calendar any more.
       
   164 (make-variable-buffer-local 'scroll-margin)
       
   165 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
       
   166       (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list
       
   167                            '(recentf-mode-hook))) )
       
   168 
   120 ;; ----------------------------------------------------------------------
   169 ;; ----------------------------------------------------------------------
   121 ;; searching.
   170 ;; searching.
   122 
   171 
   123 (setq case-fold-search t)
   172 (setq case-fold-search t)
   124 
   173 
   126 (setq search-highlight t)               ; highlight incremental search
   175 (setq search-highlight t)               ; highlight incremental search
   127 
   176 
   128 ;; ----------------------------------------------------------------------
   177 ;; ----------------------------------------------------------------------
   129 ;; *Occur*
   178 ;; *Occur*
   130 (global-set-key [f7] 'occur)            ; Key binding as in mc
   179 (global-set-key [f7] 'occur)            ; Key binding as in mc
   131 
       
   132 ;; ----------------------------------------------------------------------
       
   133 ;; *Text*
       
   134 (setq default-major-mode 'text-mode)
       
   135 
   180 
   136 ;; ----------------------------------------------------------------------
   181 ;; ----------------------------------------------------------------------
   137 ;; syntax highlighting.
   182 ;; syntax highlighting.
   138 
   183 
   139 (setq font-lock-maximum-decoration t)
   184 (setq font-lock-maximum-decoration t)
   285 ;; To open from command line file, which names has extended opcode
   330 ;; To open from command line file, which names has extended opcode
   286 ;; (set-file-name-coding-system 'cp1251)
   331 ;; (set-file-name-coding-system 'cp1251)
   287 
   332 
   288 ;; (set-language-environment "Russian") ; XXX not used as set default coding system to koi8-r.
   333 ;; (set-language-environment "Russian") ; XXX not used as set default coding system to koi8-r.
   289 
   334 
   290 ;; ======================================================================
       
   291 ;;
       
   292 ;; NON-STANDARD VARIABLES
       
   293 
       
   294 ;; ======================================================================
       
   295 ;;
       
   296 ;; STANDARD VARIABLES
       
   297 
       
   298 (if (boundp 'confirm-kill-emacs)
       
   299     (setq confirm-kill-emacs 'yes-or-no-p))
       
   300 
       
   301 ;; Try to speed things up, especially in VM.
       
   302 (setq gc-cons-threshold 2000000)
       
   303 
       
   304 ;; Don't beep in my headphones!
       
   305 (setq ring-bell-function '(lambda () "Empty ring-bell-function." nil))
       
   306 (setq visible-bell t) ; With default ring-bell-function in text terminal
       
   307                       ; revert screen if press [end] or [home]
       
   308 
       
   309 ;; Prompt before evaluating local bits of lisp.  This stops people
       
   310 ;; putting things at the end of files which delete all your files!
       
   311 (setq enable-local-variables t
       
   312       enable-local-eval      1)
       
   313 
       
   314 ;; ======================================================================
       
   315 ;; STANDARD LIBRARIES
       
   316 
       
   317 ;; ----------------------------------------------------------------------
   335 ;; ----------------------------------------------------------------------
   318 ;; dired.
   336 ;; dired.
   319 
   337 
   320 (setq dired-dwim-target t)
   338 (setq dired-dwim-target t)
   321 ;; dangerous
   339 ;; dangerous
   403   (setq browse-url-browser-function 'browse-url-default-windows-browser))
   421   (setq browse-url-browser-function 'browse-url-default-windows-browser))
   404  (t
   422  (t
   405   (setq browse-url-browser-function 'browse-url-mozilla)))
   423   (setq browse-url-browser-function 'browse-url-mozilla)))
   406 
   424 
   407 ;; ----------------------------------------------------------------------
   425 ;; ----------------------------------------------------------------------
   408 ;; time.
       
   409 
       
   410 ;; Also useful such format:
       
   411 ;; (setq display-time-format " %H:%M %d-%m-%y ")
       
   412 (setq display-time-24hr-format t)
       
   413 (setq display-time-default-load-average nil)
       
   414 (display-time)                          ; display-time-mode
       
   415 
       
   416 ;; ----------------------------------------------------------------------
       
   417 ;; calendar.
   426 ;; calendar.
   418 
   427 
   419 ;; (setq mark-holidays-in-calendar t)
   428 ;; (setq mark-holidays-in-calendar t)
   420 ;; (setq all-christian-calendar-holidays t)
   429 ;; (setq all-christian-calendar-holidays t)
   421 ;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
   430 ;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
   431 
   440 
   432 ;; ======================================================================
   441 ;; ======================================================================
   433 ;; *auto-fill*
   442 ;; *auto-fill*
   434 
   443 
   435 (setq-default fill-column 78)
   444 (setq-default fill-column 78)
       
   445 
       
   446 (defvar my-fill-column 100
       
   447   "I use greater value then 78 for comment in prog source.")
   436 
   448 
   437 ;; By default used American convention - sentence and with two spaces. Change
   449 ;; By default used American convention - sentence and with two spaces. Change
   438 ;; it to one space. Has affect on filling and M-a, M-e commands.
   450 ;; it to one space. Has affect on filling and M-a, M-e commands.
   439 (setq sentence-end-double-space nil)
   451 (setq sentence-end-double-space nil)
   440 
   452 
   595       (setq org-directory (expand-file-name "~/.gtd"))
   607       (setq org-directory (expand-file-name "~/.gtd"))
   596       (setq org-default-notes-file (expand-file-name "~/.gtd/notes"))
   608       (setq org-default-notes-file (expand-file-name "~/.gtd/notes"))
   597       (setq org-agenda-ndays 14
   609       (setq org-agenda-ndays 14
   598             org-deadline-warning-days 7
   610             org-deadline-warning-days 7
   599             org-agenda-show-all-dates t
   611             org-agenda-show-all-dates t
       
   612             org-agenda-format-date "%Y-%m-%d, %A %e %B"
   600             org-agenda-skip-deadline-if-done t
   613             org-agenda-skip-deadline-if-done t
   601             org-agenda-skip-scheduled-if-done t
   614             org-agenda-skip-scheduled-if-done t
   602             org-agenda-start-on-weekday nil
   615             org-agenda-start-on-weekday nil
   603             org-reverse-note-order t
   616             org-reverse-note-order t
   604             org-hide-leading-stars t
   617             org-hide-leading-stars t
   647 
   660 
   648 (defface my-conflict-face
   661 (defface my-conflict-face
   649   '((t :background "pink" :foreground "red" :weight bold))
   662   '((t :background "pink" :foreground "red" :weight bold))
   650   "Font for showing conflicts."
   663   "Font for showing conflicts."
   651   :group 'basic-faces)
   664   :group 'basic-faces)
   652 
       
   653 (defvar my-devel-mode-list
       
   654   '(sh-mode script-mode java-mode c-mode outline-mode text-mode
       
   655             lisp-mode makefile-mode makefile-gmake-mode python-mode)
       
   656   "List of development modes." )
       
   657 
   665 
   658 (add-hook 'font-lock-mode-hook (function (lambda ()
   666 (add-hook 'font-lock-mode-hook (function (lambda ()
   659   (when (member major-mode my-devel-mode-list)
   667   (when (member major-mode my-devel-mode-list)
   660     (font-lock-add-keywords nil
   668     (font-lock-add-keywords nil
   661      '(
   669      '(
   779 
   787 
   780 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
   788 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
   781 
   789 
   782 (setq-default comment-style (quote indent))
   790 (setq-default comment-style (quote indent))
   783 (setq-default comment-column 44)
   791 (setq-default comment-column 44)
   784 (setq-default comment-fill-column 100)
   792 (setq-default comment-fill-column my-fill-column)
   785 
   793 
   786 (mapc (lambda (mode)
   794 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) ))
   787         (add-hook mode
   795       my-devel-mode-hook-list)
   788                   (lambda ()
       
   789                     (setq fill-column 110) )
       
   790                   ))
       
   791       '(c-mode-hook lisp-mode-hook))
       
   792 
   796 
   793 ;; ----------------------------------------------------------------------
   797 ;; ----------------------------------------------------------------------
   794 ;; diff, patch.
   798 ;; diff, patch.
   795 
   799 
   796 (setq diff-switches "-u")
   800 (setq diff-switches "-u")