GNU bug report logs -
#6157
narrow-to-defun fix when point is on function beginning
Previous Next
Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>
Date: Mon, 10 May 2010 14:52:01 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 24.2
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 6157 <at> debbugs.gnu.org (full text, mbox):
Lennart Borgman <lennart.borgman <at> gmail.com> writes:
> `beginning-of-defun' goes to previous function when point is on the
> first character of a function. This is not currently taken care of in
> `narrow-to-defun'. This patch fixes this:
>
> c:\emacs-lp\bld\emacs\emacsw32\lisp\emacs-lisp>bzr diff --old
> c:\emacs-lp\bld\emacs\trunk -p trunk/:patched/ lisp.el
> === modified file 'lisp/emacs-lisp/lisp.el'
> --- trunk/lisp/emacs-lisp/lisp.el 2010-04-27 17:57:32 +0000
> +++ patched/lisp/emacs-lisp/lisp.el 2010-05-10 14:21:59 +0000
> @@ -438,7 +438,20 @@
> ;; Try first in this order for the sake of languages with nested
> ;; functions where several can end at the same place as with
> ;; the offside rule, e.g. Python.
> - (beginning-of-defun)
> +
> + ;; Finding the start of the function is a bit problematic since
> + ;; `beginning-of-defun' when we are on the first character of
> + ;; the function might go to the previous function.
> + ;;
> + ;; Therefor we first move one character forward and then call
> + ;; `beginning-of-defun'. However now we must check that we did
> + ;; not move into the next function.
> + (let ((here (point)))
> + (unless (eobp) (forward-char))
> + (beginning-of-defun)
> + (when (< (point) here)
> + (goto-char here)
> + (beginning-of-defun)))
> (setq beg (point))
> (end-of-defun)
> (setq end (point))
This patch was apparently approved by Stefan, but not applied, as far as
I can tell. Did it turn out to not be correct after all?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
This bug report was last modified 13 years and 102 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.