📜 ⬆️ ⬇️

Open Emacs doors in windows, or how to build acceptable .emacs under Windows

Kind time of the day,% username%, has long wanted to share with you my emacs file.

The fact is that my appeal was overshadowed by inconvenience and it may not even be acceptable to work with emax without first setting it up. Moreover, under Windows, emax looks fascinatingly wild, and most programmers and admins are scared to death. I’m on this way of initiating emaks secrets, I think I’ve come through, so I want to paint my emaks config, maybe someone will emphasize something new, and someone else will turn to our faith. Immediately I warn you that this is, in fact, a hodgepodge that I built during the last six months of work in this editor.

1. Under Windows, the encoding does not work correctly, therefore, there is this
(set-language-environment 'UTF-8)
(setq default-input-method 'russian-computer)
(set-selection-coding-system 'windows-1251)
(set-default-coding-systems 'windows-1251)
(prefer-coding-system 'windows-1251)


2. Setting a nice heart colors
(custom-set-faces
'(default ((t (:inherit nil :stipple nil :background "gray17" :foreground "snow" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "outline" :family "Courier New"))))
'(cursor ((t (:background "peach puff"))))
'(font-lock-comment-delimiter-face ((default (:inherit font-lock-comment-face)) (((class color) (min-colors 16)) (:background "green"))))
'(font-lock-comment-face ((nil nil)))
'(font-lock-doc-face ((t (:inherit font-lock-string-face :background "black")))))

(set-background-color "#333333")
(set-foreground-color "#ffffff")

')
3. Linking mods by file extensions, you can continue for yourself
(autoload 'javascript-mode "javascript" nil t)
(setq auto-mode-alist
(append
'(
( "\\.el$". emacs-lisp-mode)
( ".emacs". emacs-lisp-mode)
( "\\.py$". python-mode)
( "\\.pyw$". python-mode)
( "\\.html$". sgml-mode)
( "\\.xml$". sgml-mode)
( "\\.js$". javascript-mode)
( "\\.cpp$". c++-mode)
( "\\.h$". c++-mode)
)))
(global-font-lock-mode 1) ;; ,


4. Another bunch of clever sharpening
(tool-bar-mode -1) ;;
(setq scroll-step 1) ;; =1
(setq default-tab-width 4) ;; 4
(global-hl-line-mode 1) ;;
(windmove-default-keybindings 'meta) ;;
(fset 'yes-or-no-p 'y-or-np) ;;
(iswitchb-mode 1) ;;
(desktop-save-mode t) ;;


5. This is an inscription here that it is easy to navigate to a config file.
(defun load-config ()
(interactive)
(find-file "~/.emacs"))
(global-set-key "\Cx/" 'load-config)


6. Short-katy to make life easier in difficult office conditions.
(global-set-key [(control tab)] 'previous-buffer)
(global-set-key [(control shift tab)] 'next-buffer)
(global-set-key [f4] 'revert-buffer)
(global-set-key [f5] 'call-last-kbd-macro)
(global-set-key [f8] 'linum-mode) ;;
(global-set-key [f11] 'ibuffer)
(global-set-key [f10] 'bookmark-bmenu-list) ;; , Ctrl-D , (C-xrm) .


7. And short cate
(global-set-key [?\C-'] 'toggle-truncate-lines) ;; word-wrap -
(global-set-key "\C-cr" 'rename-buffer)
(global-set-key "\Cc!" 'revert-buffer)
(global-set-key "\Cz" 'undo) ;;
(global-set-key "\Cc\Cr" 'replace-string)


8. This is just a matter of laziness.
(add-hook 'javascript-mode-hook 'linum-mode 'toggle-truncate-lines)
(add-hook 'python-mode-hook 'linum-mode)


Source: https://habr.com/ru/post/83291/


All Articles