[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107861: `narrow-to-defun' fixup
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107861: `narrow-to-defun' fixup |
Date: |
Wed, 11 Apr 2012 04:12:20 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107861
fixes bug(s): http://debbugs.gnu.org/6157
author: Lennart Borgman <address@hidden>
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2012-04-11 04:12:20 +0200
message:
`narrow-to-defun' fixup
* emacs-lisp/lisp.el (narrow-to-defun): `beginning-of-defun' goes
to previous function when point is on the first character of a
function. Take care of that in `narrow-to-defun'.
modified:
lisp/ChangeLog
lisp/emacs-lisp/lisp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-04-11 02:06:59 +0000
+++ b/lisp/ChangeLog 2012-04-11 02:12:20 +0000
@@ -1,3 +1,9 @@
+2012-04-11 Lennart Borgman <address@hidden>
+
+ * emacs-lisp/lisp.el (narrow-to-defun): `beginning-of-defun' goes
+ to previous function when point is on the first character of a
+ function. Take care of that in `narrow-to-defun' (bug#6157).
+
2012-04-11 Glenn Morris <address@hidden>
* vc/vc-bzr.el (vc-bzr-status): Handle all errors,
=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el 2012-02-23 08:13:48 +0000
+++ b/lisp/emacs-lisp/lisp.el 2012-04-11 02:12:20 +0000
@@ -447,7 +447,21 @@
;; 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.
+ ;;
+ ;; Therefore 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 (eolp)
+ (forward-char))
+ (beginning-of-defun)
+ (when (< (point) here)
+ (goto-char here)
+ (beginning-of-defun)))
(setq beg (point))
(end-of-defun)
(setq end (point))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107861: `narrow-to-defun' fixup,
Lars Magne Ingebrigtsen <=