emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* About indentation when the src block is under a list
@ 2013-04-28 10:59 zwz
  2013-04-28 15:49 ` Charles Berry
  0 siblings, 1 reply; 3+ messages in thread
From: zwz @ 2013-04-28 10:59 UTC (permalink / raw)
  To: emacs-orgmode

--text follows this line--

Here is an example:

* array
** search
   - example
  #+BEGIN_SRC c
  /* find score in scores
   ,* return the index if found or -1 */
  int search(int scores[], int n, int score){
    int i = 0;
    for(; i<n; ++i) if(scores[i]==score) return i;
    return -1;
  }
  #+END_SRC

  <point>
   - test

The indentation of the src block is OK, but it is relative to the
second-level headline ("**search"), rather than the list "- example".

In this way, I can not create another list item ("- test") at the point
(illustrated by <point>) by Alt+Enter.

I tried the variable org-indent-indentation-per-level,
org-adapt-indentation and so on, but failed to indent the src block
relative to the list item. So anyone please give me some hint.

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

* Re: About indentation when the src block is under a list
  2013-04-28 10:59 About indentation when the src block is under a list zwz
@ 2013-04-28 15:49 ` Charles Berry
  2013-04-30 12:48   ` zwz
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Berry @ 2013-04-28 15:49 UTC (permalink / raw)
  To: emacs-orgmode

zwz <zhangweize <at> gmail.com> writes:


> Here is an example:
> 
> * array
> ** search
>    - example
>   #+BEGIN_SRC c
>   /* find score in scores
>    ,* return the index if found or -1 */
>   int search(int scores[], int n, int score){
>     int i = 0;
>     for(; i<n; ++i) if(scores[i]==score) return i;
>     return -1;
>   }
>   #+END_SRC
> 
>   <point>
>    - test
> 

If you want a manual fix, put point in the begin_src line then use 

      <M-right>  <down> C-c ' C-c '

that's org-metaright, next-line, org-edit-special, org-edit-src-exit

HTH,

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

* Re: About indentation when the src block is under a list
  2013-04-28 15:49 ` Charles Berry
@ 2013-04-30 12:48   ` zwz
  0 siblings, 0 replies; 3+ messages in thread
From: zwz @ 2013-04-30 12:48 UTC (permalink / raw)
  To: emacs-orgmode


Thanks! :)
 
Charles Berry <ccberry@ucsd.edu> writes:

> zwz <zhangweize <at> gmail.com> writes:
>
>
>> Here is an example:
>> 
>> * array
>> ** search
>>    - example
>>   #+BEGIN_SRC c
>>   /* find score in scores
>>    ,* return the index if found or -1 */
>>   int search(int scores[], int n, int score){
>>     int i = 0;
>>     for(; i<n; ++i) if(scores[i]==score) return i;
>>     return -1;
>>   }
>>   #+END_SRC
>> 
>>   <point>
>>    - test
>> 
>
> If you want a manual fix, put point in the begin_src line then use 
>
>       <M-right>  <down> C-c ' C-c '
>
> that's org-metaright, next-line, org-edit-special, org-edit-src-exit
>
> HTH,

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

end of thread, other threads:[~2013-04-30 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-28 10:59 About indentation when the src block is under a list zwz
2013-04-28 15:49 ` Charles Berry
2013-04-30 12:48   ` zwz

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).