Subject: Re: bug#18183: 24.3; table-fixed-width-mode fails with kill/yank

From: Boruch Baum <[email-masked]>
Date: Tue, 8 Dec 2020 08:56:53 -0500

On 2020-12-08 14:40, Lars Ingebrigtsen wrote:
> Boruch Baum <[email-masked]> writes:
>
> > Hi Lars. I've been doing some more work on the bug and have a solution
> > for the secondary issue found, the one that I marked previously as
> > 'tangent'. In that related bug, aborting from a table.el edit sets POINT
> > at the beginning of the table instead of where it was upon entry to the
> > edit session. The solution was simply to save and restore point. The
> > saving is done in function org-src--edit-element and the restore is
> > performed in function org-edit-src-abort. Here are the modified
> > functions with the two additional lines marked with arrows ; <------
>
> Could you send that as a patch instead?  It's easier to read.
>

Attached.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
diff --git a/org-src.el b/org-src.el
index 7876dea..96ab8ad 100644
--- a/org-src.el
+++ b/org-src.el
@@ -479,6 +479,7 @@ Leave point in edit buffer."
 		 (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ")))
 	;; Move to existing buffer.
 	(org-src-switch-to-buffer old-edit-buffer 'return)
+      (setq-local org-src--return-point (point))
       ;; Discard old edit buffer.
       (when old-edit-buffer
 	(with-current-buffer old-edit-buffer (org-src--remove-overlay))
@@ -1106,7 +1107,9 @@ the area in the Org mode buffer."
 (defun org-edit-src-abort ()
   "Abort editing of the src code and return to the Org buffer."
   (interactive)
-  (let (org-src--allow-write-back) (org-edit-src-exit)))
+  (let (org-src--allow-write-back)
+    (org-edit-src-exit)
+    (goto-char org-src--return-point)))

 (defun org-edit-src-continue (e)
   "Unconditionally return to buffer editing area under point.