[llvm] r323705 - Fix some regular expressions in llvm-mode.el.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 14:56:41 PST 2018


Author: rafael
Date: Mon Jan 29 14:56:41 2018
New Revision: 323705

URL: http://llvm.org/viewvc/llvm-project?rev=323705&view=rev
Log:
Fix some regular expressions in llvm-mode.el.

In some cases it was using "\" unnecessarily.  In another case it
needed an additional "\" to properly indicate a numbered sub-match.

Make comment-start buffer-local in llvm-mode.el

llvm-mode was setting comment-start globally.  However, it is better
to only set it locally in the current buffer.

Don't use purecopy in llvm-mode.el

There's no reason to use purecopy in llvm-mode.el.
purecopy is only needed for files that are dumped in emacs.

Add a version header to llvm-mode.el

Adding a version header to llvm-mode.el allows it to be installed by
the Emacs package manager.  There are not many requirements on the
version number; however it is useful to users to bump it when
something significant changes.  Here I've chosen just to start at 1.0.

Patch by Tom Tromey!

Modified:
    llvm/trunk/utils/emacs/llvm-mode.el

Modified: llvm/trunk/utils/emacs/llvm-mode.el
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/llvm-mode.el?rev=323705&r1=323704&r2=323705&view=diff
==============================================================================
--- llvm/trunk/utils/emacs/llvm-mode.el (original)
+++ llvm/trunk/utils/emacs/llvm-mode.el Mon Jan 29 14:56:41 2018
@@ -1,6 +1,7 @@
 ;;; llvm-mode.el --- Major mode for the LLVM assembler language.
 
 ;; Maintainer:  The LLVM team, http://llvm.org/
+;; Version: 1.0
 
 ;;; Commentary:
 
@@ -20,9 +21,9 @@
 (defvar llvm-font-lock-keywords
   (list
    ;; Variables
-   '("%[-a-zA-Z$\._][-a-zA-Z$\._0-9]*" . font-lock-variable-name-face)
+   '("%[-a-zA-Z$._][-a-zA-Z$._0-9]*" . font-lock-variable-name-face)
    ;; Labels
-   '("[-a-zA-Z$\._0-9]+:" . font-lock-variable-name-face)
+   '("[-a-zA-Z$._0-9]+:" . font-lock-variable-name-face)
    ;; Unnamed variable slots
    '("%[-]?[0-9]+" . font-lock-variable-name-face)
    ;; Types
@@ -30,7 +31,7 @@
    ;; Integer literals
    '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
    ;; Floating point constants
-   '("\\b[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?\\b" . font-lock-preprocessor-face)
+   '("\\b[-+]?[0-9]+.[0-9]*\\([eE][-+]?[0-9]+\\)?\\b" . font-lock-preprocessor-face)
    ;; Hex constants
    '("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
    ;; Keywords
@@ -74,11 +75,11 @@
 \\{llvm-mode-map}
   Runs `llvm-mode-hook' on startup."
   (setq font-lock-defaults `(llvm-font-lock-keywords))
-  (setq comment-start ";"))
+  (setq-local comment-start ";"))
 
 ;; Associate .ll files with llvm-mode
 ;;;###autoload
-(add-to-list 'auto-mode-alist (cons (purecopy "\\.ll\\'")  'llvm-mode))
+(add-to-list 'auto-mode-alist (cons "\\.ll\\'" 'llvm-mode))
 
 (provide 'llvm-mode)
 




More information about the llvm-commits mailing list