.emacs-my
changeset 1378 892deca62b56
parent 1377 04728230f16b
child 1379 d9e284adf519
equal deleted inserted replaced
1377:04728230f16b 1378:892deca62b56
   322   (if (fboundp 'toggle-frame-maximized)
   322   (if (fboundp 'toggle-frame-maximized)
   323       (toggle-frame-maximized)
   323       (toggle-frame-maximized)
   324     (my-maximize) ))
   324     (my-maximize) ))
   325 
   325 
   326 (menu-bar-mode -1)
   326 (menu-bar-mode -1)
       
   327 (tooltip-mode -1)
   327 (when window-system
   328 (when window-system
   328   (mouse-avoidance-mode 'animate)
   329   (mouse-avoidance-mode 'animate)
   329   (scroll-bar-mode 1)
   330   (scroll-bar-mode 1)
   330   (tool-bar-mode -1)
   331   (tool-bar-mode -1)
   331   (setq-default line-spacing nil)
   332   (setq-default line-spacing nil)
   332   (defun my-popup-menu ()
   333   (defun my-popup-menu ()
   333     "Menu from keyboard by emulating mouse event."
   334     "Menu from keyboard by emulating mouse event."
   334     (interactive)
   335     (interactive)
   335     (mouse-popup-menubar
   336     (mouse-popup-menubar
   336      (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
   337      (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
   337      nil)
   338      nil) )
   338     )
       
   339   (global-set-key [f10] 'my-popup-menu)
   339   (global-set-key [f10] 'my-popup-menu)
   340   (global-set-key [apps] 'my-popup-menu)
   340   (global-set-key [apps] 'my-popup-menu)
   341   (global-set-key [menu] 'my-popup-menu)
   341   (global-set-key [menu] 'my-popup-menu) )
   342   (when (>= emacs-major-version 22) (tooltip-mode -1))
       
   343   )
       
   344 
   342 
   345 ;; Prefer horizontal windows splitting.
   343 ;; Prefer horizontal windows splitting.
   346 (when (>= emacs-major-version 23)
   344 (when (>= emacs-major-version 23)
   347   (setq split-height-threshold nil)
   345   (setq split-height-threshold nil)
   348   (setq split-width-threshold nil)
   346   (setq split-width-threshold nil)
   408   (setq confirm-kill-emacs 'y-or-n-p))
   406   (setq confirm-kill-emacs 'y-or-n-p))
   409 
   407 
   410 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   411 (message "silent runing")
   409 (message "silent runing")
   412 
   410 
   413 ;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
   411 (setq inhibit-splash-screen t)
   414 (setq inhibit-startup-message t)
   412 (setq inhibit-startup-message t)
   415 
   413 
   416 (setq initial-scratch-message nil)
   414 (setq initial-scratch-message nil)
   417 
   415 
   418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   416 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   689  )
   687  )
   690 
   688 
   691 ;; Set margin only for desired modes! Do not frustrate calendar any more.
   689 ;; Set margin only for desired modes! Do not frustrate calendar any more.
   692 (make-variable-buffer-local 'scroll-margin)
   690 (make-variable-buffer-local 'scroll-margin)
   693 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
   691 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
   694       ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
   692       (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list)) )
   695       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
       
   696 
   693 
   697 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   694 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   698 (message "chars, unicode")
   695 (message "chars, unicode")
   699 
   696 
   700 (defun my-print-unicode (&optional start end)
   697 (defun my-print-unicode (&optional start end)
   788 
   785 
   789   ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
   786   ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
   790   (require 'pc-select)
   787   (require 'pc-select)
   791   (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
   788   (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
   792   (setq pc-select-meta-moves-sexps t)
   789   (setq pc-select-meta-moves-sexps t)
   793   (cond
   790   (pc-selection-mode 1) )
   794    ((= emacs-major-version 21) (pc-selection-mode))
       
   795    ((>= emacs-major-version 22) (pc-selection-mode 1))
       
   796    )
       
   797   )
       
   798 
   791 
   799 (when window-system
   792 (when window-system
   800   (set-face-attribute 'region nil :background "light blue"))
   793   (set-face-attribute 'region nil :background "light blue"))
   801 
   794 
   802 (when (eq window-system 'x)
   795 (when (eq window-system 'x)
   803   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
   796   (setq x-select-enable-clipboard t))
   804   )
       
   805 
   797 
   806 (when (fboundp 'er/expand-region)
   798 (when (fboundp 'er/expand-region)
   807   (global-set-key (kbd "C-=") 'er/expand-region))
   799   (global-set-key (kbd "C-=") 'er/expand-region))
   808 
   800 
   809 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   801 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   833 ;; (pc-bindings-mode) ; I define own keybinding...
   825 ;; (pc-bindings-mode) ; I define own keybinding...
   834 
   826 
   835 ;; cyrillic-jis-russian  for 567 is :,.
   827 ;; cyrillic-jis-russian  for 567 is :,.
   836 ;; cyrillic-jcuken  for SHIFT 567 is :,.
   828 ;; cyrillic-jcuken  for SHIFT 567 is :,.
   837 ;; russian-computer for SHIFT 567 is %^&
   829 ;; russian-computer for SHIFT 567 is %^&
   838 (setq my-russian-input-method 'russian-computer)
   830 (setq default-input-method 'russian-computer)
   839 (setq my-ukranian-input-method 'ukrainian-computer)
       
   840 (setq my-ipa-input-method 'ipa-x-sampa)
       
   841 (when (<= emacs-major-version 21)
       
   842   (setq my-russian-input-method 'cyrillic-jcuken)
       
   843   (setq my-ukranian-input-method 'cyrillic-jcuken))
       
   844 (setq default-input-method my-russian-input-method)
       
   845 
   831 
   846 (defun my-toggle-input-method (&optional arg)
   832 (defun my-toggle-input-method (&optional arg)
   847   (interactive "P")
   833   (interactive "P")
   848   (if (numberp arg)
   834   (if (numberp arg)
   849       (cond
   835       (cond
   850        ((eq arg 1)
   836        ((eq arg 1)
   851         (activate-input-method nil))
   837         (activate-input-method nil))
   852        ((eq arg 2)
   838        ((eq arg 2)
   853         (activate-input-method my-russian-input-method))
   839         (activate-input-method 'russian-computer))
   854        ((eq arg 3)
   840        ((eq arg 3)
   855         (activate-input-method my-ukranian-input-method))
   841         (activate-input-method 'ukrainian-computer))
   856        ((eq arg 4)
   842        ((eq arg 4)
   857         (activate-input-method 'greek))
   843         (activate-input-method 'greek))
   858        ((eq arg 5)
   844        ((eq arg 5)
   859         (activate-input-method my-ipa-input-method))
   845         (activate-input-method 'ipa-x-sampa))
   860        ((eq arg 6)
   846        ((eq arg 6)
   861         (activate-input-method 'TeX)) )
   847         (activate-input-method 'TeX)) )
   862     (toggle-input-method arg)) )
   848     (toggle-input-method arg)) )
   863 
   849 
   864 (global-set-key (kbd "C-\\") 'my-toggle-input-method)
   850 (global-set-key (kbd "C-\\") 'my-toggle-input-method)
  1138 (unless window-system
  1124 (unless window-system
  1139   (define-key dired-mode-map (kbd "DEL") 'my-dired-up-dir)
  1125   (define-key dired-mode-map (kbd "DEL") 'my-dired-up-dir)
  1140   (define-key dired-mode-map (kbd "RET") 'my-dired-enter-to-dir)
  1126   (define-key dired-mode-map (kbd "RET") 'my-dired-enter-to-dir)
  1141   )
  1127   )
  1142 
  1128 
  1143 (when (>= emacs-major-version 22)
  1129 ;; Enable 'a' command.
  1144   ;; Enable 'a' command.
  1130 (put 'dired-find-alternate-file 'disabled nil)
  1145   (put 'dired-find-alternate-file 'disabled nil)
       
  1146   )
       
  1147 
  1131 
  1148 (defvar my--file-name-tmp-refex
  1132 (defvar my--file-name-tmp-refex
  1149   (concat
  1133   (concat
  1150    "\\(?:^#.*#"
  1134    "\\(?:^#.*#"
  1151    "\\|~"
  1135    "\\|~"
  2297                      (or (buffer-file-name)
  2281                      (or (buffer-file-name)
  2298                          (buffer-name)))
  2282                          (buffer-name)))
  2299        (save-excursion
  2283        (save-excursion
  2300          (re-search-forward "\\_<class\\_>" nil t))))
  2284          (re-search-forward "\\_<class\\_>" nil t))))
  2301 
  2285 
  2302 (when (>= emacs-major-version 22)
  2286 (add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode))
  2303   (add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode))
       
  2304   )
       
  2305 
  2287 
  2306 (setq-default comment-style (quote indent))
  2288 (setq-default comment-style (quote indent))
  2307 (setq-default comment-column 44)
  2289 (setq-default comment-column 44)
  2308 (setq-default comment-fill-column my-fill-column)
  2290 (setq-default comment-fill-column my-fill-column)
  2309 
  2291 
  3397 (setq auto-save-interval 300)
  3379 (setq auto-save-interval 300)
  3398 ;; Note: if you kill unsaved file auto save file not deleted.
  3380 ;; Note: if you kill unsaved file auto save file not deleted.
  3399 (setq delete-auto-save-files t)
  3381 (setq delete-auto-save-files t)
  3400 
  3382 
  3401 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3383 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
  3384 (message "desktop")
       
  3385 
  3402 ;; Save and restore my buffers every time.
  3386 ;; Save and restore my buffers every time.
  3403 
  3387 (require 'desktop)
  3404 (eval-when 'compile (require 'desktop))
       
  3405 
  3388 
  3406 (setq desktop-base-file-name ".emacs.desktop")
  3389 (setq desktop-base-file-name ".emacs.desktop")
  3407 (setq desktop-base-lock-name ".emacs.desktop.lock")
  3390 (setq desktop-base-lock-name ".emacs.desktop.lock")
  3408 (when (eq system-type 'cygwin)
  3391 (when (eq system-type 'cygwin)
  3409   (setq desktop-base-file-name ".emacs.desktop-cygwin")
  3392   (setq desktop-base-file-name ".emacs.desktop-cygwin")
  3410   (setq desktop-base-lock-name ".emacs.desktop-cygwin.lock")
  3393   (setq desktop-base-lock-name ".emacs.desktop-cygwin.lock")
  3411   )
  3394   )
  3412 (setq desktop-dirname user-emacs-directory)
  3395 (setq desktop-dirname user-emacs-directory)
  3413 
  3396 
  3414 (when (>= emacs-major-version 22)
  3397 (add-to-list 'desktop-path desktop-dirname)
  3415   (require 'desktop)
  3398 (setq desktop-restore-frames nil)
  3416   (add-to-list 'desktop-path desktop-dirname)
  3399 (desktop-save-mode 1)
  3417   (setq desktop-restore-frames nil)
  3400 (setq
  3418   (desktop-save-mode 1)
  3401  desktop-globals-to-save
  3419   (setq
  3402  (append
  3420    desktop-globals-to-save
  3403   '((file-name-history . 100)
  3421    (append
  3404     (compile-history . 100)
  3422     '((file-name-history . 100)
  3405     (command-history . 100)
  3423       (compile-history . 100)
  3406     (extended-command-history . 100)
  3424       (command-history . 100)
  3407     (shell-command-history . 100)
  3425       (extended-command-history . 100)
  3408     (search-ring . 20)
  3426       (shell-command-history . 100)
  3409     (query-replace-history . 100)
  3427       (search-ring . 20)
  3410     (regexp-history . 100)
  3428       (query-replace-history . 100)
  3411     (grep-history . 100)
  3429       (regexp-history . 100)
  3412     (minibuffer-history . 100)
  3430       (grep-history . 100)
  3413     tags-file-name
  3431       (minibuffer-history . 100)
  3414     register-alist)
  3432       tags-file-name
  3415   desktop-globals-to-save))
  3433       register-alist)
       
  3434     desktop-globals-to-save))
       
  3435   )
       
  3436 
  3416 
  3437 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3417 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3438 (message "User welcome msg")
  3418 (message "User welcome msg")
  3439 
  3419 
  3440 (add-hook 'emacs-startup-hook
  3420 (add-hook 'emacs-startup-hook