(setq require-final-newline t) (setq inhibit-startup-message t) (global-set-key "\C-xf" 'find-file) (global-set-key "\C-z" 'scroll-down) (global-set-key "\C-cc" 'compile) (global-set-key "\C-c\C-m" 'manual-entry) (global-set-key "\C-c\C-k" 'comment-region) (global-set-key "\C-x\C-g" 'goto-line) (global-set-key "\C-x\C-z" 'save-buffers-kill-emacs) (global-set-key "\M-m" 'set-mark-command) ;; (global-font-lock-mode t) ;;If you are really unlucky, your terminal is connected to the computer ;;through a concentrator which sends flow control to the computer, or it ;;insists on sending flow control itself no matter how much padding you ;;give it. You are screwed! You should replace the terminal or ;;concentrator with a properly designed one. In the mean time, ;;some drastic measures can make Emacs semi-work. ;;One drastic measure to ignore C-s and C-q, while sending enough ;;padding that the terminal will not really lose any output. ;;Ignoring C-s and C-q can be done by using keyboard-translate-table ;;to map them into an undefined character such as C-^ or C-\. Sending ;;lots of padding is done by changing the termcap entry. ;;Here is how to swap Delete and Backspace in the keyboard-translate-table (defun swap-delete-backspace() "Swaps the delete and backspace keys." (interactive) (cond ((eq keyboard-translate-table nil) (let ((the-table (make-string 128 0))) ;; Default is to translate each character into itself. (let ((i 0)) (while (< i 128) (aset the-table i i) (setq i (1+ i)))) ;; Swap C-h with C-DEL (aset the-table ?\C-h ?\C-?) (aset the-table ?\C-? ?\C-h) (setq keyboard-translate-table the-table))) (t (let ((old-bspace (aref keyboard-translate-table ?\C-h)) (old-del (aref keyboard-translate-table ?\C-? ))) (aset keyboard-translate-table ?\C-h old-del ) (aset keyboard-translate-table ?\C-? old-bspace)))) ) (global-set-key "\C-ct" 'swap-delete-backspace) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; scroll window so that the current line is at ;; the top of the emacs window ;; Bind to key: ctrl-c,u ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun move-line-window-top() "Scroll current line to the top of its window." (interactive) (let (h1 h) (setq h1 (count-lines (point-min) (point))) (setq h (min h1 (/ (- (window-height) 1) 2) ) ) (recenter) (scroll-up h) ) ) (global-set-key "\C-cu" 'move-line-window-top) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Function to insert common includes ; Bind to ctrl-c, # ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c-insert-common-includes() (interactive) (insert-string "#include #include #include #include #include #include #include ") ) (defun c-insert-brackets() (interactive) (insert-string "{ ") (setq pos (point)) (insert-string " }") (c-indent-command) (goto-char pos) (c-indent-command) ) (setq c-mode-hook '((lambda() (local-set-key "\C-cc" 'compile) (local-set-key "\C-c#" 'c-insert-common-includes) (local-set-key "\M-{" 'c-insert-brackets) nil )))