]> Cypherpunks repositories - gostls13.git/commitdiff
misc/emacs: Derive mode from prog-mode if possible
authorDominik Honnef <dominik.honnef@gmail.com>
Mon, 25 Mar 2013 15:58:13 +0000 (08:58 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 25 Mar 2013 15:58:13 +0000 (08:58 -0700)
R=golang-dev, bradfitz
CC=adonovan, cw, golang-dev, patrick.allen.higgins
https://golang.org/cl/7956044

misc/emacs/go-mode.el

index 9b6ea74f3aeaeb4853987abf11d18e3d42fe7358..76dad67613ff869a152b61b9fa03b9f39a4305c3 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.
+(if (not (fboundp 'prog-mode))
+    (define-derived-mode prog-mode fundamental-mode "" ""))
 
 (defun go--regexp-enclose-in-symbol (s)
   ;; XEmacs does not support \_<, GNU Emacs does. In GNU Emacs we make
@@ -370,7 +378,7 @@ current line will be returned."
       (forward-char))))
 
 ;;;###autoload
-(define-derived-mode go-mode fundamental-mode "Go"
+(define-derived-mode go-mode prog-mode "Go"
   "Major mode for editing Go source text.
 
 This mode provides (not just) basic editing capabilities for