Emacs配置記錄

gaorongchao1990626發表於2013-06-30

Emacs配置記錄

1 前言

以前用傳說中的大神的配置,也折騰了好多會了,裡面有很多有用的東西,但是 對emacs的配置,並沒有太多的進步,出了問題,也不知道怎麼解決,所以我覺 得我們要的不是emacs大神的配置,而是他的思想,在以後的過程中會通過檢視 大神的配置而模仿其精華,當然有可能都是精華。比如說自動補全括號這方面, 還是會遇到很多問題,如果你設定了小於號的補全,那麼當你要輸入程式的時候 <s +tab就不管用了。所以還要即使總結和更新

2 去掉啟動畫面

在.emacs.d裡新建init.el檔案,然後在裡面新增一行

;;隱藏開始的啟動畫面
(setq inhibit-startup-message t)

3 配色方案

下載color-theme然後解壓,將其中的檔案color-theme和theme資料夾複製到~/。emacsd 的資料夾內。然後開啟init.el,新增

(add-to-list 'load-path' "~./.emacs.d/")
(require 'color-theme)
(color-theme-initialize)
(color-theme-matrix)

開啟emacs後,tools下會有一個color themes,點選後會出現很多的主題,名字,Enter會顯示 效果。找到合適的主題後,修改上面配置中的最後一行。然後重新開啟emacs就可以看到效果了 注意:主題的名稱如果有空格那麼用連字元代替,用小寫字母就可以。

4 emacs寫perl程式

在一下網址,我們找到這篇文章,摘錄如下: www.khngai.com/emacs/perl.php

;;Using Emacs for Perl Programming 

;;There is a default perl-mode for Emacs. However, 
;;there is a better one hidden within Emacs. 
;;The following lisp statements will activate cperl-mode.
;;Emacs中的perl-mode雖好,但是還有一個更好的內建mode,cperl-mode
;; Use cperl-mode instead of the default perl-mode
;; 用cpel-mode來代替預設的perl-mode
(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
;;Since I do not like the default indentations, I have the followings:
;;但是我太喜歡預設的perl-mode中的縮排了,所以我按照下面這樣做
(add-hook 'cperl-mode-hook 'n-cperl-mode-hook t)
(defun n-cperl-mode-hook ()
  (setq cperl-indent-level 4)
  (setq cperl-continued-statement-offset 0)
  (setq cperl-extra-newline-before-brace t)
  (set-face-background 'cperl-array-face "wheat")
  (set-face-background 'cperl-hash-face "wheat")
  )


;;Using Emacs for Perl Scripts 

;;If you have perl installed on your computer,
;; you may debug a perl script by simply typing "alt-x perldb" "perl -d myscript.pl". 
;;Once the command is entered, you will see 2 buffers in Emacs,
;; the top buffer is the debugger, the bottom buffer is your perl script.

5 org模式

5.1 org模式匯出pdf問題

因為有中文的存在,所有如果不加配置直接是不能匯出的,匯出的PDF也是 不含中文的,沒辦法看,所以我們這裡來提供幾種思考的方案。

5.1.1 匯出tex格式

我們在匯出tex的格式是沒有任何的問題的,然後我們開啟tex的檔案,進行 修改,也就是開始的語句改成:
\documentclass[UTF8,adobefonts]{ctexart}
然後再在命令列中用xelatex命令匯出pdf。這個方法經過實踐是可行的。

5.1.2 匯出html,然後列印

自然這種方法是可行的

5.1.3 修改org的配置

這個難度較大,以後再學習。

6 emacs自動補全

Date: 2013-06-30T19:32+0800

Author: grc

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0

相關文章