Improvements to emacs packages for llvm and tablegen mode.

* Both files have valid package headers and footers (you can verify
with M-x checkdoc).
* Fixed style warnings generated by checkdoc.
* Fixed a byte-compiler warning in llvm-mode.el.
* Ensure that the modes are autoloaded, so users do not need to
(require 'llvm-mode) to use them.

Patch by Wilfred Hughes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-01-07 15:52:51 +00:00
parent 92512386a2
commit 1763c0ad7f
2 changed files with 65 additions and 51 deletions

View File

@ -1,8 +1,13 @@
;; Maintainer: The LLVM team, http://llvm.org/ ;;; llvm-mode.el --- Major mode for the LLVM assembler language.
;; Description: Major mode for the LLVM assembler language.
;; Updated: 2007-09-19 ;; Maintainer: The LLVM team, http://llvm.org/
;;; Commentary:
;; Major mode for editing LLVM IR files.
;;; Code:
;; Create mode-specific tables.
(defvar llvm-mode-syntax-table nil (defvar llvm-mode-syntax-table nil
"Syntax table used while in LLVM mode.") "Syntax table used while in LLVM mode.")
(defvar llvm-font-lock-keywords (defvar llvm-font-lock-keywords
@ -52,7 +57,7 @@
`(,(regexp-opt '("uselistorder" "uselistorder_bb") 'words) . font-lock-keyword-face) `(,(regexp-opt '("uselistorder" "uselistorder_bb") 'words) . font-lock-keyword-face)
) )
"Syntax highlighting for LLVM" "Syntax highlighting for LLVM."
) )
;; ---------------------- Syntax table --------------------------- ;; ---------------------- Syntax table ---------------------------
@ -62,7 +67,7 @@
(if (not llvm-mode-syntax-table) (if (not llvm-mode-syntax-table)
(progn (progn
(setq llvm-mode-syntax-table (make-syntax-table)) (setq llvm-mode-syntax-table (make-syntax-table))
(mapcar (function (lambda (n) (mapc (function (lambda (n)
(modify-syntax-entry (aref n 0) (modify-syntax-entry (aref n 0)
(aref n 1) (aref n 1)
llvm-mode-syntax-table))) llvm-mode-syntax-table)))
@ -113,11 +118,11 @@
(define-key llvm-mode-map "\es" 'center-line) (define-key llvm-mode-map "\es" 'center-line)
(define-key llvm-mode-map "\eS" 'center-paragraph)) (define-key llvm-mode-map "\eS" 'center-paragraph))
;;;###autoload
(defun llvm-mode () (defun llvm-mode ()
"Major mode for editing LLVM source files. "Major mode for editing LLVM source files.
\\{llvm-mode-map} \\{llvm-mode-map}
Runs llvm-mode-hook on startup." Runs `llvm-mode-hook' on startup."
(interactive) (interactive)
(kill-all-local-variables) (kill-all-local-variables)
(use-local-map llvm-mode-map) ; Provides the local keymap. (use-local-map llvm-mode-map) ; Provides the local keymap.
@ -136,8 +141,9 @@
; customize the mode with a hook. ; customize the mode with a hook.
;; Associate .ll files with llvm-mode ;; Associate .ll files with llvm-mode
(setq auto-mode-alist ;;;###autoload
(append '(("\\.ll$" . llvm-mode)) auto-mode-alist)) (add-to-list 'auto-mode-alist (cons (purecopy "\\.ll\\'") 'llvm-mode))
(provide 'llvm-mode) (provide 'llvm-mode)
;; end of llvm-mode.el
;;; llvm-mode.el ends here

View File

@ -1,12 +1,17 @@
;;; tablegen-mode.el --- Major mode for TableGen description files (part of LLVM project)
;; Maintainer: The LLVM team, http://llvm.org/ ;; Maintainer: The LLVM team, http://llvm.org/
;; Description: Major mode for TableGen description files (part of LLVM project)
;; Updated: 2007-12-18 ;;; Commentary:
;; A major mode for TableGen description files in LLVM.
(require 'comint) (require 'comint)
(require 'custom) (require 'custom)
(require 'ansi-color) (require 'ansi-color)
;; Create mode-specific tables. ;; Create mode-specific tables.
;;; Code:
(defvar td-decorators-face 'td-decorators-face (defvar td-decorators-face 'td-decorators-face
"Face method decorators.") "Face method decorators.")
(make-face 'td-decorators-face) (make-face 'td-decorators-face)
@ -93,10 +98,11 @@
(define-key tablegen-mode-map "\es" 'center-line) (define-key tablegen-mode-map "\es" 'center-line)
(define-key tablegen-mode-map "\eS" 'center-paragraph)) (define-key tablegen-mode-map "\eS" 'center-paragraph))
;;;###autoload
(defun tablegen-mode () (defun tablegen-mode ()
"Major mode for editing TableGen description files. "Major mode for editing TableGen description files.
\\{tablegen-mode-map} \\{tablegen-mode-map}
Runs tablegen-mode-hook on startup." Runs `tablegen-mode-hook' on startup."
(interactive) (interactive)
(kill-all-local-variables) (kill-all-local-variables)
(use-local-map tablegen-mode-map) ; Provides the local keymap. (use-local-map tablegen-mode-map) ; Provides the local keymap.
@ -117,7 +123,9 @@
; customize the mode with a hook. ; customize the mode with a hook.
;; Associate .td files with tablegen-mode ;; Associate .td files with tablegen-mode
(setq auto-mode-alist (append '(("\\.td$" . tablegen-mode)) auto-mode-alist)) ;;;###autoload
(add-to-list 'auto-mode-alist (cons (purecopy "\\.td\\'") 'tablegen-mode))
(provide 'tablegen-mode) (provide 'tablegen-mode)
;; end of tablegen-mode.el
;;; tablegen-mode.el ends here