Attached: Patch to copy all local functions to script.

- Karthik

diff -u /home/karthik/.local/share/git/matlab-emacs-src/matlab-shell.el /home/karthik/.local/share/git/matlab-emacs-src/matlab-shell-new.el
--- ./matlab-emacs-src/matlab-shell.el	2021-07-18 22:49:53.525471052 -0700
+++ ./matlab-emacs-src/matlab-shell-new.el	2021-07-25 22:41:19.801839800 -0700
@@ -2413,13 +2413,12 @@
       (goto-char (point-min))
       (dolist (F functions)
 	(save-excursion
-	  (when (re-search-forward (semantic-tag-name F) nil t)
-	    ;; Found, copy it in.
-	    (let ((ft (matlab-semantic-tag-text F orig)))
-	      (goto-char (point-max))
-	      (insert "% Copy of " (semantic-tag-name F) "\n\n")
-	      (insert ft)
-	      (insert "\n%%\n"))))
+	  ;; Copy all local functions to script.
+	  (let ((ft (matlab-semantic-tag-text F orig)))
+	    (goto-char (point-max))
+	    (insert "% Copy of " (semantic-tag-name F) "\n\n")
+	    (insert ft)
+	    (insert "\n%%\n")))
 	)
 
       ;; Save buffer, and setup ability to run this new script.

Diff finished.  Sun Jul 25 22:41:51 2021

Uwe Brauer <o...@mat.ucm.es> writes:

>>>> "EL" == Eric Ludlam <ericlud...@gmail.com> writes:
>
> Hi Karthik and Eric
>> Hi Karthik and Uwe,
>
>> Nice find. I think the first solution Karthik suggests of just copying
>> over all local functions makes the most sense. Chasing down all the
>> dependencies would be tricky.
>
>> It might also make sense to check if there are any functions in the
>> file, and improve the auto-selector for which region command to use.
>> If local functions exist, it probably makes sense to always use the
>> script generator. Doing that check will be much easier once we merge
>> over the hairyblocks branch. I still owe that changelog, so I'll work
>> on that today.
>
> I did the merge some days ago, and it seems ok, no problems occurred so far. 
> What do you think, shall we use Karthik first solution, or is it worth to 
> generalise it a bit?
>
> If the first solution is fine (for me at least it is), Karthik, could you 
> please pull the latest master and provide a patch?
>
> Thanks and regards
>
> Uwe 
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to