emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* close a template?
@ 2018-06-14  8:10 Uwe Brauer
  2018-06-14  9:39 ` Eric S Fraga
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2018-06-14  8:10 UTC (permalink / raw)
  To: emacs-orgmode


Hi

I asked that more than a year ago, but maybe meanwhile there are some
news in master which I did not noticed.

Consider please the following template

#+begin_src matlab  :results output latex :exports results  :eval never-export 
clear all
f1=5;
f2=4;
f3=6;
h=(1-(-1))/2;
s=misimp(5,4,6,h);
disp('\begin{equation*}')
fprintf('I  = %g \\\\\n', s)
disp('\end{eqaution*}')
#+end_src

Suppose I accidentally delete the last line, so the template would be
invalid. Is there, meanwhile, any command which would guess the correct
template and insert the missing line?


Auctex has a similar functionality called 
«close environment» which is a real time saver.

Uwe Brauer  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: close a template?
  2018-06-14  8:10 close a template? Uwe Brauer
@ 2018-06-14  9:39 ` Eric S Fraga
  2018-06-14  9:48   ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2018-06-14  9:39 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

On Thursday, 14 Jun 2018 at 10:10, Uwe Brauer wrote:
> Hi
>
> I asked that more than a year ago, but maybe meanwhile there are some
> news in master which I did not noticed.
>
> Consider please the following template
>
> #+begin_src matlab  :results output latex :exports results  :eval never-export 
> clear all
> f1=5;
> f2=4;
> f3=6;
> h=(1-(-1))/2;
> s=misimp(5,4,6,h);
> disp('\begin{equation*}')
> fprintf('I  = %g \\\\\n', s)
> disp('\end{eqaution*}')
> #+end_src
>
> Suppose I accidentally delete the last line, so the template would be
> invalid. Is there, meanwhile, any command which would guess the correct
> template and insert the missing line?

Unlikely to be a solution available given that you are wanting an
autocompletion that understands LaTeX within MATLAB...  I don't know of
any tool that could help unfortunately.

(and your last line is misspelled, by the way ;-))

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: close a template?
  2018-06-14  9:39 ` Eric S Fraga
@ 2018-06-14  9:48   ` Uwe Brauer
  2018-06-14 10:30     ` Eric S Fraga
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2018-06-14  9:48 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]

>>> "Eric" == Eric S Fraga <esflists@gmail.com> writes:

   > On Thursday, 14 Jun 2018 at 10:10, Uwe Brauer wrote:
   >> Hi
   >> 
   >> I asked that more than a year ago, but maybe meanwhile there are some
   >> news in master which I did not noticed.
   >> 
   >> Consider please the following template
   >> 
   >> #+begin_src matlab  :results output latex :exports results  :eval never-export 
   >> clear all
   >> f1=5;
   >> f2=4;
   >> f3=6;
   >> h=(1-(-1))/2;
   >> s=misimp(5,4,6,h);
   >> disp('\begin{equation*}')
   >> fprintf('I  = %g \\\\\n', s)
   >> disp('\end{eqaution*}')
   >> #+end_src
   >> 
   >> Suppose I accidentally delete the last line, so the template would be
   >> invalid. Is there, meanwhile, any command which would guess the correct
   >> template and insert the missing line?

   > Unlikely to be a solution available given that you are wanting an
   > autocompletion that understands LaTeX within MATLAB...  I don't know of
   > any tool that could help unfortunately.

Aeh, no I think this is a misunderstanding!

Suppose I have 
#+begin_src matlab  :results output latex :exports results  :eval never-export 
clear all
s=misimp(5,4,6,h);


All I want to get is 
#+begin_src matlab  :results output latex :exports results  :eval never-export 
clear all
s=misimp(5,4,6,h);
#+end_src


And if it were 

#+BEGIN_EXPORT latex
\begin{align*}
Z2&= \frac{55-50}{\sqrt{25}}   = 1 \\
P(1\leq Z)&=N(0,1;55)  = 0.158655 
\end{align*}

The function should complete 

#+BEGIN_EXPORT latex
\begin{align*}
Z2&= \frac{55-50}{\sqrt{25}}   = 1 \\
P(1\leq Z)&=N(0,1;55)  = 0.158655 
\end{align*}
#+END_EXPORT



   > (and your last line is misspelled, by the way ;-))

Yes I know!

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: close a template?
  2018-06-14  9:48   ` Uwe Brauer
@ 2018-06-14 10:30     ` Eric S Fraga
  2018-06-14 23:05       ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2018-06-14 10:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

On Thursday, 14 Jun 2018 at 11:48, Uwe Brauer wrote:
>>>> "Eric" == Eric S Fraga <esflists@gmail.com> writes:
>    > Unlikely to be a solution available given that you are wanting an
>    > autocompletion that understands LaTeX within MATLAB...  I don't know of
>    > any tool that could help unfortunately.
>
> Aeh, no I think this is a misunderstanding!

Ah sorry.  What you want (adding the #+end_src line) is definitely more
easily achievable and conceptually possible.  I don't think there's
anything there already, however, but maybe somebody else knows better.

I simply use the new template system so the end line is already always
there (and I guess I make sure not to delete it...) and one of the great
features is that it will wrap a region for you within the block type you
request.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: close a template?
  2018-06-14 10:30     ` Eric S Fraga
@ 2018-06-14 23:05       ` Nick Dokos
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2018-06-14 23:05 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <esflists@gmail.com> writes:

> On Thursday, 14 Jun 2018 at 11:48, Uwe Brauer wrote:
>>>>> "Eric" == Eric S Fraga <esflists@gmail.com> writes:
>>    > Unlikely to be a solution available given that you are wanting an
>>    > autocompletion that understands LaTeX within MATLAB...  I don't know of
>>    > any tool that could help unfortunately.
>>
>> Aeh, no I think this is a misunderstanding!
>
> Ah sorry.  What you want (adding the #+end_src line) is definitely more
> easily achievable and conceptually possible.  I don't think there's
> anything there already, however, but maybe somebody else knows better.
>
> I simply use the new template system so the end line is already always
> there (and I guess I make sure not to delete it...) and one of the great
> features is that it will wrap a region for you within the block type you
> request.

You can always add another template and delete the begin line.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-14 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14  8:10 close a template? Uwe Brauer
2018-06-14  9:39 ` Eric S Fraga
2018-06-14  9:48   ` Uwe Brauer
2018-06-14 10:30     ` Eric S Fraga
2018-06-14 23:05       ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).