;;;for programming
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; c mode indentation
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 (setq c-default-style '((c-mode . "k&r") (other . "gnu")))
5 (setq c-basic-offset 4)
6
7 (setq-default c-electric-flag t)
8 ;;tab设置4个字符
9 (setq-default tab-width 4)
10
11 (defun c-lineup-arglist-tabs-only (ignored)
12 "Line up argument lists by tabs, not spaces"
13 (let* ((anchor (c-langelem-pos c-syntactic-element))
14 (column (c-langelem-2nd-pos c-syntactic-element))
15 (offset (- (1+ column) anchor))
16 (steps (floor offset c-basic-offset)))
17 (* (max steps 1)
18 c-basic-offset)))
19
20 (add-hook 'c-mode-common-hook
21 (lambda ()
22 ;; Add kernel style
23 (c-add-style
24 "linux-tabs-only"
25 '("linux" (c-offsets-alist
26 (arglist-cont-nonempty
27 c-lineup-gcc-asm-reg
28 c-lineup-arglist-tabs-only))))))
29
30 ;;;(add-hook 'c-mode-hook
31 ;;; (lambda ()
32 ;;; (let ((filename (buffer-file-name)))
33 ;;; ;; Enable kernel mode for the appropriate files
34 ;;; (when (and filename
35 ;;; (string-match (expand-file-name "~/src/linux-trees")
36 ;;; filename))
37 ;;; (setq indent-tabs-mode t)
38 ;;; (c-set-style "linux-tabs-only")))))
39
40 ;;;(require 'ctypes)
41 ;;;(setq ctypes-write-types-at-exit t)
42 ;;;(ctypes-read-file nil nil t t)
43 ;;;(ctypes-auto-parse-mode 1)
44
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ;;;scheme
47 ;;(setq scheme-program-name "scm")
48 ;;(setq scheme-program-name "mit-scheme")
49 ;(setq scheme-program-name "guile")
50
51 ;;;(defun xscheme ()
52 ;;; "Loads xscheme and runs a scheme process in the current buffer."
53 ;;; (interactive)
54 ;;; (load-library "xscheme")
55 ;;; (xscheme-start "scheme -emacs"
56 ;;; (buffer-name)
57 ;;; (buffer-name)))
58 ;;;
59 (global-set-key [f6] 'eval-region)
60 (global-set-key [(shift f6)] 'eval-buffer)