|
|
|
|
|
|
j***o 发帖数: 2842 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: jigao (左季高), 信区: Linux
标 题: 在windows系统上安装emacs24
发信站: BBS 未名空间站 (Sun Apr 21 13:20:33 2013, 美东)
我用linux的主要原因是要用latex写文章和slides,emacs具有很多很多软件不具备的
优势,主要是lisp语言的支持,能做很多的智能选择,定义快捷键等,这里就不多说了
linux的主要问题是驱动和一些乱七八糟的问题,还有不能用office系列。如果能安装
emacs在windows上,可以说是一个完美的解决计划。
用下面的方法来安装,就能实现,不建议任何从源码编译的安装方法,太麻烦了。
第一步,安装miktex系统,这个就是latex所需要的所有软件包,很简单,只要等就可
以了,不过,建议你安装完整版本。
第二步,下载emacs系统的binary for windows,地址是
http://ftp.gnu.org/gnu/emacs/windows/
最好安装最新版本:emacs-24.3-bin-i386.zip 是最新版本。解压到c:\program files
\下面,创建一个文件夹emacs-24.3
然后到产生的bin文件夹下运行addpm.exe会在启动文件夹下面安装icon等
第三步,安装gsview和ghostscript,到相应的网站下载安装即可,默认安装就能搞定。
第四步,安装auctex插件,下载地址是
http://ftp.gnu.org/pub/gnu/auctex/auctex-11.87-e24.2-msw.zip
解压到一个临时目录下,然后把产生的文件拷贝到c:\program files\emacs-24.3\下面
,可以覆盖原有的文件
第五步,安装拼写检查,需要安装两个东西
1。安装Aspell-0-50-3-3-Setup.exe到c:\program files\emacs-24.3\下面,会自动产
生一个Aspell的文件夹
2。安装英文字典,Aspell-en-0.50-2-3.exe到c:\program files\emacs-24.3\下面
第六步,配置.emacs和.emacsmap.el文件
windows一般不支持.开始的文件,需要设定HOME这个环境变量
右键我的电脑-〉属性->advanced-〉environment variable
增加一个HOME变量,值为c:\documents and settings\XXXXXX
这里的XXXXXX是你的用户名
第七步,启动emacs,ctrl+x ctrl+f以后输入~/.emacs文件
输入下面的东西,拷贝两个******行中间的内容。当然可以作相应的修改
******************************************************************
(server-start)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(set-default-font "-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859
-1")
;;; We test if AucTeX is available
(if (locate-library "tex-site")
(progn
(load "tex-site")
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
;;; Replace AUCTeX functions
(setq reftex-plug-into-AUCTeX t)
)
(add-hook 'latex-mode-hook 'turn-on-reftex)
)
;; reftex
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
(setq reftex-label-alist '(AMSTeX))
(setq reftex-plug-into-auctex t)
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-add-to-label-alist "reftex" "RefTeX Minor Mode" nil)
;; map my latex shortcut
(add-hook 'LaTex-mode-hook
(load (expand-file-name "~/.emacsmap.el"))
)
;; Support Wheel Mouse Scrolling
(mouse-wheel-mode t)
;; make all "yes or no" prompts show "y or n" instead
(fset 'yes-or-no-p 'y-or-n-p)
;; Compare windows
(global-set-key "\C-cw" 'compare-windows)
(add-to-list 'exec-path "C:/Program Files/emacs-24.2/Aspell/bin/")
(setq-default ispell-program-name "aspell")
;; (setq text-mode-hook (lambda() (flyspell-mode t) ))
;; word wrap and flyspell
(add-hook 'text-mode-hook
(lambda ()
(text-mode-hook-identify)
(turn-on-auto-fill)
(flyspell-mode)
)
)
;;load path
(add-to-list 'load-path' "~/.emacs.d/site-lisp")
;; Set the geometric size of initial window.
(setq initial-frame-alist '((width . 81) (height . 50)))
;; Set background color to black
;(require 'color-theme)
;(color-theme-classic)
(set-background-color "black")
(set-foreground-color "white")
;; when there is a selection, delete key deletes the region instead of just
a char.
(delete-selection-mode t)
******************************************************************
最后一步,安装lisp的配置文件.emacsmap.el
启动emacs,ctrl+x ctrl+f以后输入~/.emacsmap.el文件
输入下面的东西,拷贝两个******行中间的内容。当然可以作相应的修改
******************************************************************
(define-key global-map "\C-cm"
(lambda () (interactive)
(insert "$")
(save-excursion (insert "$"))))
(define-key global-map "\C-ce"
(lambda () (interactive)
(insert "\\begin{equation}\n")
(save-excursion (insert "\n\\end{equation}\n"))))
(define-key global-map "\C-ci"
(lambda () (interactive)
(insert "\\begin{alignat}{2}\n")
(save-excursion (insert "\n\\end{alignat}\n"))))
(define-key global-map "\C-cn"
(lambda () (interactive)
(insert "\\begin{align}\n")
(save-excursion (insert "\n\\end{align}\n"))))
(define-key global-map "\C-cu"
(lambda () (interactive)
(insert "\\begin{enumerate}\n\\item ")
(save-excursion (insert "\n\\item\n\\end{enumerate}\n"))))
(define-key global-map "\C-co"
(lambda () (interactive)
(insert "\\left(") ;()
(save-excursion (insert "\\right)"))))
(define-key global-map "\C-cb" ;{}
(lambda () (interactive)
(insert "\\left\\{")
(save-excursion (insert "\\right\\}"))))
(define-key global-map "\C-ct"
(lambda () (interactive) ;\textrm{}
(insert "\\textrm{")
(save-excursion (insert "}"))))
(define-key global-map "\C-cp" 'reftex-parse-all)
(define-key global-map "\C-cr"
(lambda () (interactive)
(insert "\\redtext{")
(save-excursion (insert "}"))))
(defun insert-math-braces (num)
"Move point to first visible character on line."
(interactive "p")
(cond ( (<= num 1) (insert "\\left\\{ ") (save-excursion (insert " \\
right\\}")))
( (eq num 2) (insert "\\bigl\\{ ") (save-excursion (insert " \\bigr\\}"
)))
( (eq num 3) (insert "\\Bigl\\{ ") (save-excursion (insert " \\Bigr\\}"
)))
( (eq num 4) (insert "\\biggl\\{ ") (save-excursion (insert " \\biggr\\
}")))
( (eq num 5) (insert "\\Biggl\\{ ") (save-excursion (insert " \\Biggr\\
}")))
( (>= num 6) (insert "\\left\\{ ") (save-excursion (insert " \\right\\}
")))
)
)
(defun insert-math-parens (num)
"Move point to first visible character on line."
(interactive "p")
(cond ( (<= num 1) (insert "\\left(") (save-excursion (insert " \\
right )")))
( (eq num 2) (insert "\\bigl( ") (save-excursion (insert " \\bigr )")))
( (eq num 3) (insert "\\Bigl( ") (save-excursion (insert " \\Bigr )")))
( (eq num 4) (insert "\\biggl( ") (save-excursion (insert " \\biggr )")
))
( (eq num 5) (insert "\\Biggl( ") (save-excursion (insert " \\Biggr )")
))
( (>= num 5) (insert "\\left( ") (save-excursion (insert " \\right )")))
)
)
*******************************************************************
这两个文件救灾c:\documents and settings\XXXXXX下面,想做修改日后可以直接上了。
Enjoy! |
|
|
|
|
|