]> Cypherpunks repositories - gostls13.git/commitdiff
misc/emacs: when defining prog-mode, define it like GNU Emacs 24 would
authorDominik Honnef <dominik.honnef@gmail.com>
Fri, 16 Aug 2013 03:40:38 +0000 (20:40 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 16 Aug 2013 03:40:38 +0000 (20:40 -0700)
Fixes #6156.

R=adonovan
CC=golang-dev
https://golang.org/cl/13035043

misc/emacs/go-mode.el

index e4855c9d900b85e8727812683a7781165ffbd265..a896b143d8aadb823105932d7a450a846bc0ae87 100644 (file)
 (defun go--old-completion-list-style (list)
   (mapcar (lambda (x) (cons x nil)) list))
 
-;; GNU Emacs 24 has prog-mode, older GNU Emacs and XEmacs do not.
-;; Ideally we'd use defalias instead, but that breaks in XEmacs.
-;;
-;; TODO: If XEmacs decides to add prog-mode, change this to use
-;; defalias to alias prog-mode or fundamental-mode to go--prog-mode
-;; and use that in define-derived-mode.
+;; GNU Emacs 24 has prog-mode, older GNU Emacs and XEmacs do not, so
+;; copy its definition for those.
 (if (not (fboundp 'prog-mode))
-    (define-derived-mode prog-mode fundamental-mode "" ""))
+    (define-derived-mode prog-mode fundamental-mode "Prog"
+      "Major mode for editing source code."
+      (set (make-local-variable 'require-final-newline) mode-require-final-newline)
+      (set (make-local-variable 'parse-sexp-ignore-comments) t)
+      (setq bidi-paragraph-direction 'left-to-right)))
 
 (defun go--regexp-enclose-in-symbol (s)
   ;; XEmacs does not support \_<, GNU Emacs does. In GNU Emacs we make