[PATCH] D158196: [emacs] Add regexps for defuns

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 02:44:01 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
luke marked an inline comment as done.
Closed by commit rGb0af89cbdad4: [emacs] Add regexps for defuns (authored by luke).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158196/new/

https://reviews.llvm.org/D158196

Files:
  llvm/utils/emacs/llvm-mode.el


Index: llvm/utils/emacs/llvm-mode.el
===================================================================
--- llvm/utils/emacs/llvm-mode.el
+++ llvm/utils/emacs/llvm-mode.el
@@ -95,12 +95,21 @@
    `(,(regexp-opt '("uselistorder" "uselistorder_bb") 'symbols) . font-lock-keyword-face))
   "Syntax highlighting for LLVM.")
 
+(defun llvm-current-defun-name ()
+  "The `add-log-current-defun' function in LLVM mode."
+  (save-excursion
+    (end-of-line)
+    (if (re-search-backward "^[ \t]*define[ \t]+.+[ \t]+@\\(.+\\)(.*)" nil t)
+	(match-string-no-properties 1))))
+
 ;;;###autoload
 (define-derived-mode llvm-mode prog-mode "LLVM"
   "Major mode for editing LLVM source files.
 \\{llvm-mode-map}
   Runs `llvm-mode-hook' on startup."
   (setq font-lock-defaults `(llvm-font-lock-keywords))
+  (setq-local defun-prompt-regexp "^[ \t]*define[ \t]+.+[ \t]+ at .+(.*).+")
+  (setq-local add-log-current-defun-function #'llvm-current-defun-name)
   (setq-local comment-start ";"))
 
 ;; Associate .ll files with llvm-mode


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158196.551945.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230821/68f95ad5/attachment.bin>


More information about the llvm-commits mailing list