bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19182: 24.4; which-function-mode end of function detection (easy sug


From: Carlos Pita
Subject: bug#19182: 24.4; which-function-mode end of function detection (easy suggestion for improvement)
Date: Tue, 25 Nov 2014 15:38:46 -0300

It's a known and documented limitation of which-function mode that it
doesn't detect the end of a function due to it's dependence on
imenu. The following quotes are taken from which-func.el:

;; Really this package shows not "function where the current point is
;; located now", but "nearest function which defined above the current

;;     1. Dependence on imenu package should be removed.  Separate
;; function determination mechanism should be used to determine the end

What do you think about the following strategy which avoids to remove
the dependence on imenu and, instead, leverages imenu and the
end-of-defun functionality already provided by many major modes (in one
way or another)?

1) Detect the beginning of function using imenu, as it's currently done.

2) Detect the end of function using the end-of-defun variant for the
current major mode. The function implementing the corresponding
functionality for the current major mode should be configured explicitly
on a per-mode basis, but an *unsafe* option (disabled by default) could
also be provided to take it automatically from the M-C-e binding.

This is not to say that a separate mechanism would be undesirable but to
improve which-function support for many major modes out of the box in
the short term and in a very easy way.

Cheers
--
Carlos





reply via email to

[Prev in Thread] Current Thread [Next in Thread]