找到了一个Ansys APDL语言的emacs的语法亮显的包。但是在.emacs文件中设置后不起效果,请各位指点。
语法亮显文件:ansys-mod.el
存放目录:/home/xsl/.emacs.d/elisp/ansys-mod.el
.emacs中相应的设置为:
;; Ansys APDL语法加亮
(load-file "/home/xsl/.emacs.d/elisp/ansys-mod.el")
(autoload 'ansys-mode "ansys-mod" nil t)
(setq auto-mode-alist
(cons '("\\.mac$" . ansys-mode) auto-mode-alist))
(setq auto-mode-alist (mapcar 'purecopy
'(("\\.mac\\'" . ansys-mode))))
(add-hook 'ansys-mode-hook
(lambda()
(abbrev-mode 1)
(auto-fill-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
;;
在emacs中打开类似于model.mac格式的文件没有语法加亮的效果,不知如何处理?
Emacs的一个语法亮显问题
-
- 帖子: 156
- 注册时间: 2005-05-31 19:32
-
- 帖子: 156
- 注册时间: 2005-05-31 19:32
没有成功。
M-x ansys-mode 显示找不到匹配的命令。
下面是ansys-mode.el的开头一部分内容:
;;; ansys-mod.el --- editing Ansys log files under Emacs
;;; Copyright (C) 1997 Free Software Foundation, Inc.
;; Author: Tim Read <Tim.Read@fp.co.nz>
;; Author: Geoff Foster <fosterg@fp.co.nz>
;; Maintainer: Tim Read <Tim.Read@fp.co.nz>
;; Keywords: languages
;;
;; This file has used code from octave-mod.el
;; Copyright (C) 1997 Free Software Foundation, Inc.
;; Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
;; Author: John Eaton <jwe@bevo.che.wisc.edu>
;;
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This package provides Emacs support for Ansys.
;; It defines Ansys mode, a major mode for editing Ansys log files.
;;; Code:
(defconst ansys-maintainer-address
"Tim Read <Tim.Read@fp.co.nz> "
"Current maintainer of the Emacs Ansys package.")
;; Extra highlighting of matching parenthesis (or brace or bracket)
(require 'paren)
(defvar ansys-abbrev-table nil
"Abbrev table for Ansys's reserved words.
All Ansys abbrevs start with a grave accent (`).")
(if ansys-abbrev-table
()
(let ((ac abbrevs-changed))
(define-abbrev-table 'ansys-abbrev-table ())
(define-abbrev ansys-abbrev-table "`i" "*IF,,LT,,THEN" nil)
(define-abbrev ansys-abbrev-table "`eli" "*ELSEIF," nil)
(define-abbrev ansys-abbrev-table "`el" "*ELSE\n" nil)
(define-abbrev ansys-abbrev-table "`ei" "*ENDIF\n" nil)
(define-abbrev ansys-abbrev-table "`cy" "*CYCLE" nil)
(define-abbrev ansys-abbrev-table "`d" "*DO,,1,10,1\n\n*ENDDO" nil)
(define-abbrev ansys-abbrev-table "`ex" "*EXIT" nil)
(define-abbrev ansys-abbrev-table "`g" "*GO" nil)
(define-abbrev ansys-abbrev-table "`cr" "*CREATE\n\n*END" nil)
(define-abbrev ansys-abbrev-table "`e" "*END" nil)
(define-abbrev ansys-abbrev-table "`rp" "/REPLOT" nil)
(define-abbrev ansys-abbrev-table "`t" "/TITLE," nil)
(setq abbrevs-changed ac)))
(defvar ansys-comment-char ?!
"Character to start an Ansys comment.")
M-x ansys-mode 显示找不到匹配的命令。
下面是ansys-mode.el的开头一部分内容:
;;; ansys-mod.el --- editing Ansys log files under Emacs
;;; Copyright (C) 1997 Free Software Foundation, Inc.
;; Author: Tim Read <Tim.Read@fp.co.nz>
;; Author: Geoff Foster <fosterg@fp.co.nz>
;; Maintainer: Tim Read <Tim.Read@fp.co.nz>
;; Keywords: languages
;;
;; This file has used code from octave-mod.el
;; Copyright (C) 1997 Free Software Foundation, Inc.
;; Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
;; Author: John Eaton <jwe@bevo.che.wisc.edu>
;;
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This package provides Emacs support for Ansys.
;; It defines Ansys mode, a major mode for editing Ansys log files.
;;; Code:
(defconst ansys-maintainer-address
"Tim Read <Tim.Read@fp.co.nz> "
"Current maintainer of the Emacs Ansys package.")
;; Extra highlighting of matching parenthesis (or brace or bracket)
(require 'paren)
(defvar ansys-abbrev-table nil
"Abbrev table for Ansys's reserved words.
All Ansys abbrevs start with a grave accent (`).")
(if ansys-abbrev-table
()
(let ((ac abbrevs-changed))
(define-abbrev-table 'ansys-abbrev-table ())
(define-abbrev ansys-abbrev-table "`i" "*IF,,LT,,THEN" nil)
(define-abbrev ansys-abbrev-table "`eli" "*ELSEIF," nil)
(define-abbrev ansys-abbrev-table "`el" "*ELSE\n" nil)
(define-abbrev ansys-abbrev-table "`ei" "*ENDIF\n" nil)
(define-abbrev ansys-abbrev-table "`cy" "*CYCLE" nil)
(define-abbrev ansys-abbrev-table "`d" "*DO,,1,10,1\n\n*ENDDO" nil)
(define-abbrev ansys-abbrev-table "`ex" "*EXIT" nil)
(define-abbrev ansys-abbrev-table "`g" "*GO" nil)
(define-abbrev ansys-abbrev-table "`cr" "*CREATE\n\n*END" nil)
(define-abbrev ansys-abbrev-table "`e" "*END" nil)
(define-abbrev ansys-abbrev-table "`rp" "/REPLOT" nil)
(define-abbrev ansys-abbrev-table "`t" "/TITLE," nil)
(setq abbrevs-changed ac)))
(defvar ansys-comment-char ?!
"Character to start an Ansys comment.")
-
- 帖子: 750
- 注册时间: 2006-03-19 11:39
-
- 帖子: 156
- 注册时间: 2005-05-31 19:32