.emacs-my
changeset 1142 7906db469af0
parent 1141 294e4bafc4a5
child 1146 5ab87924ad83
equal deleted inserted replaced
1141:294e4bafc4a5 1142:7906db469af0
   809   nil
   809   nil
   810   )
   810   )
   811  )
   811  )
   812 
   812 
   813 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   813 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   814 (message "selecting/switching, creating, killing buffers")
   814 (message "selecting/switching, creating/killing buffers, open file")
       
   815 (message "ido, ffap")
       
   816 
       
   817 ;; Loaded and used by ido.
       
   818 ;; (require 'ffap)
       
   819 
       
   820 (require 'ido)
       
   821 
       
   822 (setq ido-enable-flex-matching t)
       
   823 
       
   824 (setq ido-use-filename-at-point 'guess)
       
   825 (setq ido-use-url-at-point t)
       
   826 (setq ido-enable-tramp-completion t)
       
   827 (setq ido-use-virtual-buffers t)
       
   828 
       
   829 (setq ido-create-new-buffer 'always)
       
   830 
       
   831 (setq ido-file-extensions-order '(".java" ".c" ".py" ".xml" ".txt" ".el" ".ini" ".cfg" ".cnf" ".log"))
       
   832 
       
   833 (setq ido-ignore-buffers
       
   834       '("\\` "))
       
   835 ;; ido-ignore-directories
       
   836 ;; ido-ignore-files
       
   837 
       
   838 (ido-mode 1)
   815 
   839 
   816 (global-set-key [?\C-x right] 'next-buffer)
   840 (global-set-key [?\C-x right] 'next-buffer)
   817 (global-set-key [?\C-x left]  'previous-buffer)
   841 (global-set-key [?\C-x left]  'previous-buffer)
   818 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
   842 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
   819 (defun my-kill-this-buffer-maybe-switch-to-next ()
   843 (defun my-kill-this-buffer-maybe-switch-to-next ()
   829 (global-set-key [?\C-x up] '(lambda ()
   853 (global-set-key [?\C-x up] '(lambda ()
   830                               (interactive)
   854                               (interactive)
   831                               (other-window -1)))
   855                               (other-window -1)))
   832 (global-set-key [?\C-x down] 'other-window)
   856 (global-set-key [?\C-x down] 'other-window)
   833 
   857 
   834 (iswitchb-mode 1)
       
   835 (setq iswitchb-regexp t)
       
   836 (setq iswitchb-use-virtual-buffers t)
       
   837 (setq iswitchb-buffer-ignore
       
   838       '("^ "
       
   839         "^\\*Buffer"
       
   840         "^\\*Completions\\*"
       
   841         "^\\*tramp"
       
   842         "^\\*Dired log\\*"
       
   843         "^\\*Quail Completions\\*"
       
   844         "^\\*Disabled Command\\*"
       
   845         "^TAGS"
       
   846         ))
       
   847 
       
   848 (require 'uniquify)
   858 (require 'uniquify)
   849 (setq uniquify-buffer-name-style 'post-forward)
   859 (setq uniquify-buffer-name-style 'post-forward)
   850 (setq uniquify-separator "|")
   860 (setq uniquify-separator "|")
   851 (setq uniquify-after-kill-buffer-p t)
   861 (setq uniquify-after-kill-buffer-p t)
   852 
   862 
   856 ;; buffer-menu better then buffer-list, but ibuffer much better.
   866 ;; buffer-menu better then buffer-list, but ibuffer much better.
   857 (global-set-key "\C-x\C-b" 'ibuffer)
   867 (global-set-key "\C-x\C-b" 'ibuffer)
   858 
   868 
   859 (icomplete-mode 1)
   869 (icomplete-mode 1)
   860 (setq icomplete-with-completion-tables t)
   870 (setq icomplete-with-completion-tables t)
   861 
       
   862 (mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
       
   863       '(
       
   864         ".class" "~" ".aux"
       
   865         ".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
       
   866         ;; Place dir at end to appear at the start of completion-ignored-extensions.
       
   867         "CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
       
   868         ) )
       
   869 
   871 
   870 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   872 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   871 (message "completion")
   873 (message "completion")
   872 
   874 
   873 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   875 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   886 ;;       ((stringp yas/root-directory) (setq yas/root-directory (list my-yas-root-directory yas/root-directory)))
   888 ;;       ((stringp yas/root-directory) (setq yas/root-directory (list my-yas-root-directory yas/root-directory)))
   887 ;;       (t (error "I expect that yas/root-directory is a list of string")) )
   889 ;;       (t (error "I expect that yas/root-directory is a list of string")) )
   888 ;;      (mapc 'yas/load-directory yas/root-directory)))
   890 ;;      (mapc 'yas/load-directory yas/root-directory)))
   889 
   891 
   890 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   892 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   891 (message "open file, ffap, dired")
   893 (message "dired")
   892 
   894 
   893 (setq-default save-place t)
   895 (setq-default save-place t)
   894 (require 'saveplace)
   896 (require 'saveplace)
   895 
   897 
   896 (require 'dired)
   898 (require 'dired)
   897 
       
   898 (require 'ffap)
       
   899 (ffap-bindings)
       
   900 
       
   901 ;; I usually mistype "C-x C-f" to "C-x d" or "C-x C-d", so always use find-file,
       
   902 ;; because when file if directory find-file load dired, if regular file open it.
       
   903 (global-set-key (kbd "C-x C-f") 'find-file-at-point)
       
   904 (global-set-key (kbd "C-x C-d") 'find-file-at-point)
       
   905 (global-set-key (kbd "C-x d") 'find-file-at-point)
       
   906 
       
   907 ;; Stop 'ffap' in Dired as its suggestion is inconvenient.
       
   908 (define-key dired-mode-map (kbd "C-x C-f") 'find-file)
       
   909 (define-key dired-mode-map (kbd "C-x C-d") 'find-file)
       
   910 (define-key dired-mode-map (kbd "C-x d") 'find-file)
       
   911 
   899 
   912 (setq dired-dwim-target t)
   900 (setq dired-dwim-target t)
   913 ;; dangerous
   901 ;; dangerous
   914 ;; (setq
   902 ;; (setq
   915 ;;  dired-recursive-copies 'top
   903 ;;  dired-recursive-copies 'top