언어에 대한 이맥스 메이저 모드 (일명 mydsl)를 개발 중입니다. 그러나 xahlee 사이트의 기술을 사용하는 것은 어떤 이유로 든 작동하지 않는 것 같습니다. (아마도 구형 이맥스 방언 일 수도 있습니다.)이맥스 메이저 모드에서 올바르게 강조 표시
내가 쟁점으로 삼는 주요 이슈는 (1) 강조 표시가 작동하지 않고 (2) , regexp-opt
회선 사용이 작동하지 않습니다.
나는 GNU 매뉴얼을 검토하고 cc-mode와 elisp 모드를 살펴 봤는데 ... 필자가 필요로하는 것보다 훨씬 더 복잡하다.
;;;Standard # to newline comment
;;;Eventually should also have %% to %% multiline block comments
(defun mydsl-comment-dwim (arg)
"comment or uncomment"
(interactive "*P")
(require 'newcomment)
(let
((deactivate-mark nil)
(comment-start "#")
(comment-end "")
comment-dwim arg)))
(defvar mydsl-events
'("reservedword1"
"reservedword2"))
(defvar mydsl-keywords
'("other-keyword" "another-keyword"))
;;Highlight various elements
(setq mydsl-hilite
'(
; stuff between "
("\"\\.\\*\\?" . font-lock-string-face)
; : , ; { } => @ $ = are all special elements
(":\\|,\\|;\\|{\\|}\\|=>\\|@\\|$\\|=" . font-lock-keyword-face)
(,(regexp-opt mydsl-keywords 'words) . font-lock-builtin-face)
(,(regexp-opt mydsl-events 'words) . font-lock-constant-face)
))
(defvar mydsl-tab-width nil "Width of a tab for MYDSL mode")
(define-derived-mode mydsl-mode fundamental-mode
"MYDSL mode is a major mode for editing MYDSL files"
;Recommended by manual
(kill-all-local-variables)
(setq mode-name "MYDSL script")
(setq font-lock-defaults '((mydsl-hilite)))
(if (null mydsl-tab-width)
(setq tab-width mydsl-tab-width)
(setq tab-width default-tab-width)
)
;Comment definitions
(define-key mydsl-mode-map [remap comment-dwim] 'mydsl-comment-dwim)
(modify-syntax-entry ?# "< b" mydsl-mode-syntax-table)
(modify-syntax-entry ?\n "> b" mydsl-mode-syntax-table)
;;A gnu-correct program will have some sort of hook call here.
)
(provide 'mydsl-mode)
: 여기
mydsl-mode
에 버퍼를 옳은 일을 할 것으로 보인다 내 편집 한 버전이다? – jrockway@jrockway - 그의 이맥스 물건은 대체로 견고한 것 같습니다. 무슨 뜻인지 모르겠다. –
나는 jrockway에 대해 말할 수 없다. Emacs에 관한 Xah의 정보를 다작하고 선의로 구할 수 있지만, Emacs의 lisp 규범과 규칙에서 벗어나는 경우가있다. 예 : 'mydsl-comment-dwim'은'comment'의 동작을 커스터마이징하는 잘못된 방법입니다. 비슷하게, Xah의 페이지에서 나는 (함수 적 임에도 불구하고) 인수를 취하고'(interactive "r")'를 사용하여이 지역을 통과하는 'wrap-markup'정의를 신속하게 발견했다. –