免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3499 | 回复: 2
打印 上一主题 下一主题

有点冷清 上一个我的 emacs 相关的配置吧 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-17 16:49 |只看该作者 |倒序浏览
在清茶灌了两天,回来这里一看,好冷清
上一个我在学 haskell 时用的 emacs 的配置文件吧(关于 haskell mode 的, haskell mode 的库可以和 emacs wiki 下载到)

(load "haskell-site-file")

(setq auto-mode-alist
      (append auto-mode-alist
              '(("\\.[hg]s$"  . haskell-mode)
                ("\\.hi$"     . haskell-mode)
                ("\\.l[hg]s$" . literate-haskell-mode))))
(autoload 'haskell-mode "haskell-mode"
  "Major mode for editing Haskell scripts." t)
(autoload 'literate-haskell-mode "haskell-mode"
  "Major mode for editing literate Haskell scripts." t)

;; adding the following lines according to which modules you want to use:

(add-hook 'haskell-mode-hook 'turn-on-haskell-font-lock)
(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-hugs)
(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)

(add-hook 'haskell-mode-hook
          #'(lambda ()
              (setq haskell-program-name "ghci")
              (setq haskell-ghci-program-name "ghci")
              (setq comment-padding " ")
              (setq haskell-font-lock-symbols 'unicode)
              (setq haskell-indent-offset 8)
              (define-key haskell-mode-map "\C-cc"
                'credmp/flymake-display-err-minibuf) ;for flymake display error in minibuf
;;;               (define-key haskell-mode-map "\C-cc"
;;;                 'flymake-display-err-menu-for-current-line) ;flymake display error in menu
              (define-key haskell-mode-map "\C-cn"
                'flymake-goto-next-error) ;

              (setq comment-start "--")))

;; flymake mode for haskell
(require 'flymake)

(defun flymake-Haskell-init ()
  (flymake-simple-make-init-impl
   'flymake-create-temp-with-folder-structure nil nil
   (file-name-nondirectory buffer-file-name)
   'flymake-get-Haskell-cmdline))

(defun flymake-get-Haskell-cmdline (source base-dir)
  (list "flycheck_haskell.pl"
        (list source base-dir)))

(push '(".+\\.hs$" flymake-Haskell-init flymake-simple-java-cleanup)
      flymake-allowed-file-name-masks)
(push '(".+\\.lhs$" flymake-Haskell-init flymake-simple-java-cleanup)
      flymake-allowed-file-name-masks)
(push
'("^\\(\.+\.hs\\|\.lhs\\):\\([0-9]+\\):\\([0-9]+\\):\\(.+\\)"
   1 2 3 4) flymake-err-line-patterns)

;; optional setting
;; if you want to use flymake always, then add the following hook.
(add-hook
'haskell-mode-hook
'(lambda ()
    (if (not (null buffer-file-name)) (flymake-mode))))


(defun credmp/flymake-display-err-minibuf ()
  "Displays the error/warning for the current line in the minibuffer"
  (interactive)
  (let* ((line-no             (flymake-current-line-no))
         (line-err-info-list  (nth 0 (flymake-find-err-info flymake-err-info line-no)))
         (count               (length line-err-info-list))
         )
    (while (> count 0)
      (when line-err-info-list
        (let* ((file       (flymake-ler-file (nth (1- count) line-err-info-list)))
               (full-file  (flymake-ler-full-file (nth (1- count) line-err-info-list)))
               (text (flymake-ler-text (nth (1- count) line-err-info-list)))
               (line       (flymake-ler-line (nth (1- count) line-err-info-list))))
          (message "[%s] %s" line text)
          )
        )
      (setq count (1- count)))))


关于最后一个在 minibuffer 显示错误的键绑定,随个人喜好吧,我不是喜欢

对了,还要用到一个 perl 文件,也传上来(请把其中 perl 的位置改成你的 perl 的实际位置)
check.tar (10 KB, 下载次数: 39)

论坛徽章:
0
2 [报告]
发表于 2008-09-17 18:43 |只看该作者
我的 EMACS 懒得配置了。觉得默认的就很好。

论坛徽章:
0
3 [报告]
发表于 2008-09-17 18:44 |只看该作者
最喜欢的就是按 TAB 就自动 indent 了。
其他的功能还是要慢慢发掘一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP