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

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 19 11:30:26 PDT 2023


luke marked 2 inline comments as done.
luke added inline comments.


================
Comment at: llvm/utils/emacs/llvm-mode.el:111
   (setq font-lock-defaults `(llvm-font-lock-keywords))
+  (setq-local defun-prompt-regexp "^[ \t]*define[ \t]+.+[ \t]+ at .+(.+)[ \t]*")
+  (setq-local add-log-current-defun-function #'llvm-current-defun-name)
----------------
goldstein.w.n wrote:
> luke wrote:
> > goldstein.w.n wrote:
> > > Likewise here.
> > Whoops. Also found we need to handle trailing attributes like nounwind etc., since `defun-prompt-regexp` needs to match right up to the first `{`
> Does this still need to be fixed. Don't see any codes for matching `{`.
This is fixed, IIUC emacs automatically looks between top-level `{` braces for defuns, but by default they have to be in column 0. So `defun-prompt-regexp` skips over those characters so that `{` is then the first character, e.g. see the definition for bash: https://github.com/emacs-mirror/emacs/blob/7b30e11b2ac5cd360db7ee8b6aed07bd918b93a2/lisp/progmodes/sh-script.el#L1531C1-L1537


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158196



More information about the llvm-commits mailing list