Re: [O] Trouble with autofill mode

2015-08-05 Thread Sebastien Vauban
Eric S Fraga e.fr...@ucl.ac.uk writes:
 For LaTeX directives that I used to always put in #+latex: lines when
 I needed these within a paragraph, I now increasingly use
 @@latex:...@@.

FYI, you could make it smelt to just @@l:...@@ with:

--8---cut here---start-8---
(add-to-list 'org-export-snippet-translation-alist
 '(l . latex))
--8---cut here---end---8---

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Trouble with autofill mode

2015-08-05 Thread Eric S Fraga
On Wednesday,  5 Aug 2015 at 10:17, Sebastien Vauban wrote:
 Eric S Fraga e.fr...@ucl.ac.uk writes:
 For LaTeX directives that I used to always put in #+latex: lines when
 I needed these within a paragraph, I now increasingly use
 @@latex:...@@.

 FYI, you could make it smelt to just @@l:...@@ with:

 (add-to-list 'org-export-snippet-translation-alist
  '(l . latex))

Cute!  Org has something for everything. :-)  Thanks.

(mind you, pabbrev means that typing @@l TAB usually gives me what I want!)
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1315-ga3b2b7



Re: [O] Trouble with autofill mode

2015-08-04 Thread Eric S Fraga
On Tuesday,  4 Aug 2015 at 09:52, Vikas Rawal wrote:

[...]

 Yes, I have been thinking about this too. visual-line-mode with each
 sentence in a separate line would have many other advantages too. It
 would perhaps be better for git-like version control of documents
 written in orgmode. Isn’t it?

 Do others have an experience to share about this?

For org documents, I switched to visual-line-mode and org-indent mode a
while back now after *years* using auto-fill.  Visual-line-mode without
org-indent is less æsthetically pleasing, I find.

I typically have one paragraph per line and this works well.  It may be
less efficient with respect to revision control, e.g. git, but the
efficiency loss is minimal in my opinion.

For LaTeX directives that I used to always put in #+latex: lines when I
needed these within a paragraph, I now increasingly use @@latex:...@@.

The only issue is working with wide tables.  For this, I do have a key
binding to toggle visual-line-mode on and off to make it easier to work
with tables.  It would be nice if somehow org knew not to allow
visual-line-mode to wrap tables but I would imagine this would be
difficult if not impossible.

For emails, I continue to use auto-fill-mode however.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1315-ga3b2b7



Re: [O] Trouble with autofill mode

2015-08-04 Thread John Kitchin
I would have thought something like this would work:
(defun nobreak-p ()
  (interactive)
  (let ((result (if (and (looking-at  )
 (save-excursion
   (re-search-forward [^{]*} (line-end-position) 
'end))
 (save-excursion
   (re-search-backward [^}]*index{ 
(line-beginning-position) 'end)))
t
  nil)))
(message %s result)
result))

(add-hook 'fill-nobreak-predicate #'nobreak-p)

at least, from what I can see it returns true everywhere it should not
break, but I still get breaks where I do not want them. maybe it could
give you an idea though.

Vikas Rawal writes:


 Hello,
 This StackExchange question might help you out:
 https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
 (Only if I got your question right...)

 Thanks very much. This should work. Let me try to modify it to my use case.

 Much appreciated.


 This is turning out to be non-trivial for my limited knowledge of regex. We 
 need a regex that would return true for all white spaces between  \index{ 
 and “} in a string like

 \index{this is an index} and then some text \index(and then another index}

 And then add-hook it to 'fill-nobreak-predicate.

 Various things that I have tried since yesterday did not get me anywhere.

 Vikas

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] Trouble with autofill mode

2015-08-04 Thread John Kitchin
I turned off auto-fill everywhere many years ago (it messed up my code
blocks in org-mode too much. I usually write them in org-mode, not the
programming mode). I use (global-visual-line-mode 1)

I cannot think of any issues that causes. I even have an
unfill-paragraph to fix what my students do ;) I cannot say I seen many
advantages with git with this, but we usually have one paragraph on a
line.  One day I just need to learn how to do word-based diffs/merge for
text, instead of line-based.

The only exception to auto-fill i can think of is in mu4e, where emails to get 
filled
so they fit in about an 80 character field.

Vikas Rawal writes:



 On 2015-08-03 at 23:11, Vikas Rawal vikasli...@agrarianresearch.org wrote:
 But I guess one has to have some compromise somewhere :)

 Another compromise would be to stop using autofill mode and use 
 visual-line-mode or something else. I recently made the switch after many 
 years of auto-fill. It takes a bit of getting used to, but it works well.



 Yes, I have been thinking about this too. visual-line-mode with each sentence 
 in a separate line would have many other advantages too. It would perhaps be 
 better for git-like version control of documents written in orgmode. Isn’t it?

 Do others have an experience to share about this?

 Vikas

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] Trouble with autofill mode

2015-08-03 Thread Vikas Rawal
 
 Hello,
 This StackExchange question might help you out:
 https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
 (Only if I got your question right...)
 
 Thanks very much. This should work. Let me try to modify it to my use case.
 
 Much appreciated.
 

This is turning out to be non-trivial for my limited knowledge of regex. We 
need a regex that would return true for all white spaces between  \index{ and 
“} in a string like

\index{this is an index} and then some text \index(and then another index}

And then add-hook it to 'fill-nobreak-predicate.

Various things that I have tried since yesterday did not get me anywhere.

Vikas


Re: [O] Trouble with autofill mode

2015-08-03 Thread Nick Dokos
Vikas Rawal vikasli...@agrarianresearch.org writes:

 
 I am inserting LaTeX \index{} commands in an org document to create an
 index. Almost everything works fine. But I am having trouble with
 auto-fill-mode. It often puts a line break in the middle of an index
 entry, and then it does not work.
 
 That is, \index{my name} is sometimes broken into \index{my
 name}. This creates a problem for LaTeX.
 
 I have disabled auto-fill-mode for now, but that is clearly
 a sub-optimal thing to do. Is there a way to tell it not to put line
 breaks in the middle of \index{} entries?
 
 Have you tried
 
 #+INDEX: my name
 
 Regards,
 


 I am sorry for not being clear. \index{} may have to be used inline in
 a para since the index has to pick up the right page where a term
 appears. So you want to put it as close as possible to the keywords.


So put it as close as possible to the keywords:

--8---cut here---start-8---
This section needs to index some
#+INDEX: multi word term
multi word terms.
--8---cut here---end---8---

-- 
Nick




Re: [O] Trouble with autofill mode

2015-08-03 Thread Ken Mankoff

On 2015-08-03 at 23:11, Vikas Rawal vikasli...@agrarianresearch.org wrote:
 But I guess one has to have some compromise somewhere :)

Another compromise would be to stop using autofill mode and use 
visual-line-mode or something else. I recently made the switch after many years 
of auto-fill. It takes a bit of getting used to, but it works well.

  -k.




Re: [O] Trouble with autofill mode

2015-08-03 Thread Vikas Rawal
 
 
 On 2015-08-03 at 23:11, Vikas Rawal vikasli...@agrarianresearch.org wrote:
 But I guess one has to have some compromise somewhere :)
 
 Another compromise would be to stop using autofill mode and use 
 visual-line-mode or something else. I recently made the switch after many 
 years of auto-fill. It takes a bit of getting used to, but it works well.
 
  

Yes, I have been thinking about this too. visual-line-mode with each sentence 
in a separate line would have many other advantages too. It would perhaps be 
better for git-like version control of documents written in orgmode. Isn’t it?

Do others have an experience to share about this?

Vikas





Re: [O] Trouble with autofill mode

2015-08-03 Thread Vikas Rawal
 
 
 I am sorry for not being clear. \index{} may have to be used inline in
 a para since the index has to pick up the right page where a term
 appears. So you want to put it as close as possible to the keywords.
 
 
 So put it as close as possible to the keywords:
 
 --8---cut here---start-8---
 This section needs to index some
 #+INDEX: multi word term
 multi word terms.
 --8---cut here---end---8—
 

Yes, I did not think one could put them in the middle of text like this. This 
should be fine except that having lots of these in the middle of paragraphs 
would make the text much more difficult to read. But I guess one has to have 
some compromise somewhere :)

Thanks and cheers.

Vikas




[O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal
I am inserting LaTeX \index{} commands in an org document to create an index. 
Almost everything works fine. But I am having trouble with auto-fill-mode. It 
often puts a line break in the middle of an index entry, and then it does not 
work. 

That is, \index{my name} is sometimes broken into \index{my
name}. This creates a problem for LaTeX.

I have disabled auto-fill-mode for now, but that is clearly a sub-optimal thing 
to do. Is there a way to tell it not to put line breaks in the middle of 
\index{} entries?

Vikas


Re: [O] Trouble with autofill mode

2015-08-02 Thread Nicolas Goaziou
Hello,

Vikas Rawal vikasli...@agrarianresearch.org writes:

 I am inserting LaTeX \index{} commands in an org document to create an
 index. Almost everything works fine. But I am having trouble with
 auto-fill-mode. It often puts a line break in the middle of an index
 entry, and then it does not work.

 That is, \index{my name} is sometimes broken into \index{my
 name}. This creates a problem for LaTeX.

 I have disabled auto-fill-mode for now, but that is clearly
 a sub-optimal thing to do. Is there a way to tell it not to put line
 breaks in the middle of \index{} entries?

Have you tried

 #+INDEX: my name

Regards,

-- 
Nicolas Goaziou



Re: [O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal
 
 I am inserting LaTeX \index{} commands in an org document to create an
 index. Almost everything works fine. But I am having trouble with
 auto-fill-mode. It often puts a line break in the middle of an index
 entry, and then it does not work.
 
 That is, \index{my name} is sometimes broken into \index{my
 name}. This creates a problem for LaTeX.
 
 I have disabled auto-fill-mode for now, but that is clearly
 a sub-optimal thing to do. Is there a way to tell it not to put line
 breaks in the middle of \index{} entries?
 
 Have you tried
 
 #+INDEX: my name
 
 Regards,
 


I am sorry for not being clear. \index{} may have to be used inline in a para 
since the index has to pick up the right page where a term appears. So you want 
to put it as close as possible to the keywords.

Vikas


Re: [O] Trouble with autofill mode

2015-08-02 Thread Vicente Vera
Hello,
This StackExchange question might help you out:
https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
(Only if I got your question right...)



Re: [O] Trouble with autofill mode

2015-08-02 Thread Vikas Rawal

 On 03-Aug-2015, at 8:37 am, Vicente Vera vicente...@gmail.com wrote:
 
 Hello,
 This StackExchange question might help you out:
 https://emacs.stackexchange.com/questions/12392/prevent-fill-paragraph-from-breaking-latex-citations-in-org-mode
 (Only if I got your question right...)

Thanks very much. This should work. Let me try to modify it to my use case.

Much appreciated.

Vikas