[llvm-branch-commits] [llvm] [emacs] Rework tablegen mode (PR #182076)

Francesco Petrogalli via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 18 10:52:50 PST 2026


================
@@ -90,36 +88,19 @@
 (defvar tablegen-mode-hook nil)
 (defvar tablegen-mode-map nil)   ; Create a mode-specific keymap.
 
-(if (not tablegen-mode-map)
-    ()  ; Do not change the keymap if it is already set up.
+(unless tablegen-mode-map
   (setq tablegen-mode-map (make-sparse-keymap))
   (define-key tablegen-mode-map "\t"  'tab-to-tab-stop)
   (define-key tablegen-mode-map "\es" 'center-line)
   (define-key tablegen-mode-map "\eS" 'center-paragraph))
 
 ;;;###autoload
-(defun tablegen-mode ()
-  "Major mode for editing TableGen description files.
-\\{tablegen-mode-map}
-  Runs `tablegen-mode-hook' on startup."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map tablegen-mode-map)      ; Provides the local keymap.
-  (make-local-variable 'font-lock-defaults)
-  (setq major-mode 'tablegen-mode        ; This is how describe-mode
-                                         ;   finds the doc string to print.
-	mode-name             "TableGen" ; This name goes into the modeline.
-        local-abbrev-table    tablegen-mode-abbrev-table
-	font-lock-defaults    `(tablegen-font-lock-keywords)
-	require-final-newline t
-        )
-
-  (set-syntax-table tablegen-mode-syntax-table)
-  (make-local-variable 'comment-start)
-  (setq comment-start "//")
-  (setq indent-tabs-mode nil)
-  (run-hooks 'tablegen-mode-hook))       ; Finally, this permits the user to
----------------
fpetrogalli wrote:

I never really used this part, my understanding is that allows to customize the appearance of the syntax, right? In the new implementation, is it still possible to customize the mode?

https://github.com/llvm/llvm-project/pull/182076


More information about the llvm-branch-commits mailing list