Function: meson-function-at-point

meson-function-at-point is a natively compiled function defined in meson-mode.el.

Signature

(meson-function-at-point)

Documentation

Return name of the function under point.

The point can be anywhere within function name or argument list.

Source Code

;; Defined in /nix/store/57kn62wrv0z1jads9j9blmagdm8rh132-emacs-packages-deps/share/emacs/site-lisp/elpa/meson-mode-20240601.1647/meson-mode.el
(defun meson-function-at-point ()
  "Return name of the function under point.
The point can be anywhere within function name or argument list."
  (save-excursion
    (skip-syntax-backward "w_")
    (let ((ppss (syntax-ppss))
	  (functions (mapcar 'car meson-builtin-functions)))
      (cond
       ((or (nth 3 ppss)		; inside string
	    (nth 4 ppss))		; inside comment
	(goto-char (nth 8 ppss))	; go to the beginning
	(meson-function-at-point))
       ((cl-some (lambda (fname) (when (looking-at-p fname) fname)) functions))
       ((and (> (nth 0 ppss) 0)			 ; inside parentheses
	     (eq (char-after (nth 1 ppss)) ?\()) ; rounded parentheses
	(goto-char (nth 1 ppss))
	(cl-some (lambda (fname)
		   (when (looking-back (concat fname (rx (zero-or-more (any " " "\t"))))
				       (line-beginning-position))
		     fname))
		 functions))
       ((> (nth 0 ppss) 1)		; inside nested parentheses - other than rounded
	(goto-char (nth 1 ppss))
	(meson-function-at-point))))))