Skip to content

Wrong beginning-of-defun-function implementation #503

Closed
@sergeyklay

Description

@sergeyklay

From the documentation:

The function takes the same argument as `beginning-of-defun' and should behave similarly, returning non-nil if it found the beginning of a defun.

So this code will always fail:

(defsubst in-function-p (&optional pos)
  "Determine whether POS is inside a function."
  (let (bof (pos (or pos (point))))
    (save-excursion
      (when (beginning-of-defun)
        (setq bof (point))
        (end-of-defun)
        (and (> pos bof)
             (< pos (point)))))))

because (beginning-of-defun) always return nil in php-mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions