Subject: bug#3437: Add patch to bug #3437

From: Teemu Likonen <[email-masked]>
Date: Tue, 09 Jun 2009 18:17:45 +0300

Here's a patch that does what I mean. It changes the original "if" form
to "cond" form and adds a condition branch for the case when the point
is at the end of logical line:

    (cond ((eolp)
           (goto-char (1+ (point))))
          ...)

The semantics of the original "if" form is reproduced in the place of
"..." above, that is, as other "cond" branches.

--- simple.el.orig	2009-06-09 17:42:26.000000000 +0300
+++ simple.el	2009-06-09 17:54:16.000000000 +0300
@@ -4488,15 +4488,18 @@
 	  (signal 'end-of-buffer nil))
       (setq end (save-excursion
 		  (end-of-visual-line) (point)))
-      (if (or (save-excursion
-		;; If trailing whitespace is visible,
-		;; don't treat it as nothing.
-		(unless show-trailing-whitespace
-		  (skip-chars-forward " \t" end))
-		(= (point) end))
-	      (and kill-whole-line (bolp)))
-	  (line-move 1)
-	(goto-char end)))
+      (cond ((eolp)
+	     (goto-char (1+ (point))))
+	    ((or (save-excursion
+		   ;; If trailing whitespace is visible,
+		   ;; don't treat it as nothing.
+		   (unless show-trailing-whitespace
+		     (skip-chars-forward " \t" end))
+		   (= (point) end))
+		 (and kill-whole-line (bolp)))
+	     (line-move 1))
+	    (t
+	     (goto-char end))))
     (kill-region opoint (point))))
 
 (defun next-logical-line (&optional arg try-vscroll)