Subject: Forgotten attachment (was: bug#21072: 24.5; inconsistent behaviour of `C-M-h (mark-defun)' in Emacs Lisp)

From: Marcin Borkowski <[email-masked]>
Date: Sun, 05 Jun 2016 09:01:17 +0200

And a forgotten attachment.

On 2016-06-05, at 08:30, Marcin Borkowski <[email-masked]> wrote:

> On 2016-05-07, at 08:47, Eli Zaretskii <[email-masked]> wrote:
>
>>> From: Marcin Borkowski <[email-masked]>
>>> Cc: [email-masked], [email-masked]
>>> Date: Sat, 07 May 2016 05:47:18 +0200
>>> 
>>> I'm not sure what to do next with this bug.  I tried with the
>>> abovementioned short Elisp file and failed.  Since no-one said that the
>>> current behavior is wrong, maybe I'll try to study the code of
>>> `mark-defun' and modify the docstring/manual accordingly.
>>
>> I'd suggest to change the doc string according to what I recommended a
>> few messages ago.  I think that would be good enough.
>
> Hi Eli, hi all,
>
> and sorry for replying after such a long time (again) - I'm afraid
> I cannot help this, my time has become extremely limited recently.
>
> I studied the code of mark-defun, and it seems that the reason for
> #21072 is quite simple.  I enclose a patch where the two (seemingly)
> offending lines are commented; if this is acceptable, of course I'll
> prepare a proper patch.  (And while at that, I'll propose replacing
> `(and transient-mark-mode mark-active)' with `(use-region-p)'.)
>
> The problem is, I'm not sure whether this change won't break anything.
> The only tests I found that deal with `mark-defun' are in
> python-tests.el, and my version passes all three of them.
>
>> Thanks.
>
> Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
>From e717c6e8a1a0645baa8ea1a3dc965bac9fe9b540 Mon Sep 17 00:00:00 2001
From: Marcin Borkowski <[email-masked]>
Date: Sun, 5 Jun 2016 08:25:36 +0200
Subject: [PATCH] Fix bug#21072

---
 lisp/emacs-lisp/lisp.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index ea7cce6..4b98b80 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -505,8 +505,9 @@ mark-defun
 	   (setq beg (point))
 	   (end-of-defun)
 	   (setq end (point))
-	   (while (looking-at "^\n")
-	     (forward-line 1))
+           ;; The two lines below seemingly caused bug#21072.
+	   ;; (while (looking-at "^\n")
+	   ;;   (forward-line 1))
 	   (if (> (point) opoint)
 	       (progn
 		 ;; We got the right defun.
-- 
2.8.3