Subject: bug#24427: 25.1.50; end-of-defun jumps too far

From: Robert Cochran <[email-masked]>
Date: Tue, 13 Sep 2016 13:26:59 -0700

Appears to be an off-by-one error when calling `beginning-of-defun-raw`
during the second part of moving forward. This patch `1+`s the `(- arg)`
to make both methods equivalent.

Please do not hesitate to mention anything I may have missed.

-----

>From 0f4facc6ea2bfe01ba3b8c7e3a0e99210d1bb1e1 Mon Sep 17 00:00:00 2001
From: Robert Cochran <[email-masked]>
Date: Tue, 13 Sep 2016 13:17:32 -0700
Subject: [PATCH] Fix off-by-one error when going forward in end-of-defun

end-of-defun (C-M-e) goes forward one too many defuns when given a
prefix argument. Fix this so that doing 'C-M-e' foo times and using 'C-u
foo C-M-e' do the same thing.

* lisp/emacs-lisp/lisp.el (end-of-defun): Fix off-by-one error when
going forward.
---
 lisp/emacs-lisp/lisp.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index ea7cce6..bf03c44 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -452,7 +452,7 @@ end-of-defun
         ;; We started from after the end of the previous function.
         (goto-char pos))
       (unless (zerop arg)
-        (beginning-of-defun-raw (- arg))
+        (beginning-of-defun-raw (1+ (- arg)))
         (funcall end-of-defun-function)))
      ((< arg 0)
       ;; Moving backward.
-- 
2.7.4

-----

HTH,
-- 
~Robert Cochran

GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26  AD2D E5C3 EB36 4886 8871