;;; My init.el (previously .emacs) for use under MS Windows 10 Pro ;;; Meant to work with EMACS v25.1 ;;; Copyright 2018-2019 Dr. Thomas Redelberger, redetho@gmx.de ;; Added by Package.el. This must come before configurations of ;; installed packages. Don't delete this line. If you don't want it, ;; just comment it out by adding a semicolon to the start of the line. ;; You may delete these explanatory comments. (package-initialize) ;;; My custom org-mode HTML export (require 'tr-html) ;;; I use EMACS Frames more like traditional windows in MS Windows ;; See in customize 'pop-up-frames 'graphic-only ;; and 'org-agenda-window-setup 'other-frame and 'org-src-window-setup 'other-frame ; Treat words_with_various_pieces like one when selecting, etc. (modify-syntax-entry ?_ "w" (standard-syntax-table)) ;;; Big screens these days... (add-to-list 'default-frame-alist '(height . 40)) (add-to-list 'default-frame-alist '(width . 100)) ;;; disable message logging ;;(setq message-log-max nil) ;;; get rid of the messages buffer ;;(kill-buffer "*Messages*") ;;; This is what I usually use (set-language-environment "Latin-1") ;;; The setting has no effect on graphical terminals. ;;;(set-terminal-coding-system 'latin-1) ;;; The setting has no effect on graphical terminals. ;;;(set-keyboard-coding-system 'latin-1) ;;; matching in C (defun my-c-mode-common-hook () (setq c-basic-offset 4) (setq tab-width 4)) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) ;;; not "make -k" but... ;;(setq compile-command "gcc -Wall -o ") (setq compile-command "myBuild.cmd") (global-set-key [f5] 'compile) ;;; some unicode characters I use for text processing e.g. in org-mode (global-set-key [f8] (lambda () (interactive) (insert-char #x00A0))) ; non-breaking space (global-set-key [f7] (lambda () (interactive) (insert-char #x2011))) ; non-breaking hyphen (global-set-key [f6] (lambda () (interactive) (insert-char #x00AD))) ; soft hyphen ;;; My org-mode HTML export (global-set-key [f9] 'ox-tr-html-export-to-html) ;;; Key settings I prefer (resembling MS Windows) ; save file (global-set-key [?\C-s] 'save-buffer) ;;; Close file without the question "which buffer?" (global-set-key [C-f4] (lambda () (interactive) (kill-buffer (current-buffer)))) ; I leave EMACS running instead of exiting as I use runemacs.exe --daemon (defun my-close-all-buffers () (interactive) (mapcar 'kill-buffer (buffer-list)) (delete-other-windows) (delete-frame)) (global-set-key [M-f4] 'my-close-all-buffers) ; continue tags search was becoming unbound in v25.1 or v25 ? (global-set-key (kbd "M-,") 'tags-loop-continue) ; Cycle through buffers (setq skippable-buffers '("*Messages*" "*scratch*" "*Help*" "*Occur*" "TAGS")) (defun my-next-buffer () "next-buffer that skips certain buffers" (interactive) (when (seq-difference (seq-remove (lambda (elt) (string-prefix-p " " elt) ) (mapcar (function buffer-name) (buffer-list) ) ) skippable-buffers ) (next-buffer) (while (member (buffer-name) skippable-buffers) (next-buffer) ) ) ) (global-set-key [C-tab] 'my-next-buffer) ;;(global-set-key [remap next-buffer] 'my-next-buffer) ; ...and override for org-mode because it has its own idea what C-tab does (add-hook 'org-mode-hook '(lambda () (local-set-key [(control tab)] 'my-next-buffer))) ; search key (global-set-key [?\C-f] 'nonincremental-search-forward) ; repeat search key (global-set-key [f3] 'nonincremental-repeat-search-forward) ; shift indent right and left keys (global-set-key [C-M-right] 'increase-left-margin) (global-set-key [C-M-left] 'decrease-left-margin) ; Zooming using the mouse (global-set-key [C-wheel-up] 'text-scale-increase) (global-set-key [C-wheel-down] 'text-scale-decrease) ; To set zoom to normal, I would like to use (global-set-key [C-0] (lambda () (text-scale-adjust 0))) ; but that does not work. Unclear why not ;;; visual basic mode for VBS etc. (autoload 'visual-basic-mode "visual-basic-mode" "Visual Basic mode." t) (add-to-list 'auto-mode-alist '("\\.vbs\\'" . visual-basic-mode)) (add-to-list 'auto-mode-alist '("\\.wsf\\'" . visual-basic-mode)) (add-to-list 'auto-mode-alist '("\\.bas\\'" . visual-basic-mode)) ;;; My AVR custom mode. Very basic still. E.g. keywords do not seem to fit AVRASM2 which I use (define-derived-mode avr-mode asm-mode "AVR" "Simple mode for editing AVR 8-bit assembler source files." ;; (font-lock-add-keywords ;; 'avr-mode ;; '( ;; ("^\\(#[ \t]*include\\|#[ \t]*code\\|#[ \t]*static\\|#[ \t]*storage\\|#[ \t]*readonly\\|#[ \t]*const\\)\\>" . font-lock-preprocessor-face) ;; ("\\<\\(program\\|procedure\\|begin\\|end\\|const\\|readonly\\|static\\|storage\\|var\\|val\\)\\>" . font-lock-keyword-face) ;; ("^[ \t]*\\(;\\).*$" . font-lock-comment-face) ;; ("\\<\\(int8\\|int16\\|int32\\|uns8\\|uns16\\|uns32\\|real32\\|real64\\|real80\\|char\\|boolean\\|byte\\|word\\|dword\\|qword\\|tbyte\\|string\\|text\\|pointer to\\|cset\\)\\>" . font-lock-type-face) ;; ("\\<\\(nl\\)\\>" . font-lock-constant-face) ;; ("[ \t]*\\(@nostorage\\)\\>" . font-lock-keyword-face) ;; )) ;; (setq indent-line-function 'indent-relative-maybe) ) (add-to-list 'auto-mode-alist '("\\.asm\\'" . avr-mode)) (add-to-list 'auto-mode-alist '("\\.inc\\'" . avr-mode)) (add-hook 'avr-mode-hook '(lambda () ;; (local-set-key "\t" 'tab-to-tab-stop) ;; (local-set-key "\r" 'newline-and-indent) ;; (when (fboundp 'column-marker-1) ;; (column-marker-1 79)) (setq tab-width 8) (setq comment-column 40) ;; (setq show-trailing-whitespace t) )) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(c-tab-always-indent nil) '(case-fold-search nil) '(column-number-mode t) '(comment-auto-fill-only-comments t) '(cua-mode t nil (cua-base)) '(dired-listing-switches "-Al") '(inhibit-startup-screen t) '(ispell-dictionary "british") '(ispell-program-name "C:\\Users\\xyz\\OneDrive\\myPrograms\\Aspell\\bin\\aspell.exe") '(ls-lisp-dirs-first t) '(ls-lisp-format-time-list (quote ("%Y-%m-%d %H:%M:%S" "%Y-%m-%d %H:%M:%S"))) '(ls-lisp-use-localized-time-format t) '(make-backup-files nil) '(org-agenda-files (quote ("."))) '(org-directory "C:\\Users\\xyz\\Documents\\org") '(org-export-with-creator nil) '(org-export-with-section-numbers nil) '(org-export-with-sub-superscripts (quote {})) '(org-export-with-toc nil) '(org-html-coding-system (quote utf-8)) '(org-html-extension "htm") '(org-html-head-include-default-style nil) '(org-html-head-include-scripts nil) '(org-html-postamble nil) '(org-html-preamble nil) '(org-html-text-markup-alist (quote ((bold . "%s") (code . "%s") (italic . "%s") (strike-through . "%s") (underline . "%s") (verbatim . "%s")))) '(org-html-toplevel-hlevel 1) '(org-html-use-infojs (quote when-configured)) '(org-mobile-checksum-binary "C:/Users/xyz/OneDrive/myPrograms/git-2.20.1/usr/bin/md5sum.exe") '(org-mobile-directory "M:/orgmobile") '(org-mobile-inbox-for-pull "C:/Users/xyz/Documents/org/from-mobile.org") '(org-src-window-setup (quote other-frame)) '(org-startup-truncated nil) '(org-startup-with-inline-images t) '(org-support-shift-select t) '(pop-up-frames (quote graphic-only)) '(scroll-conservatively 999) '(sentence-end-double-space nil) '(server-auth-dir "C:/Users/xyz/.emacs.d/server") '(size-indication-mode t) '(tab-width 4) '(tool-bar-mode nil) '(tooltip-mode nil) '(xsl-element-indent-step 4) '(xsl-offer-save nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 113 :width normal)))) '(xsl-xslt-alternate-face ((((background light)) (:foreground "black")))) '(xsl-xslt-main-face ((((background light)) (:bold t :foreground "black"))))) (put 'dired-find-alternate-file 'disabled nil)