emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Filling comments in Org code block vs in temporary buffer
@ 2012-10-24 14:31 Sebastien Vauban
  2012-10-24 14:48 ` Nicolas Goaziou
  2012-12-18 11:50 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastien Vauban @ 2012-10-24 14:31 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

#+TITLE:     Filling comments
#+LANGUAGE:  en

* Context

I've stopped using FillAdapt in Org files, and do not suffer any particular
problems, except this one (though, certainly unrelated).

* Problem

When trying to refill the comment directly in the following code block
(staying in the Org file), it has *no effect*.

#+begin_src emacs-lisp
  ;; a single space does end a sentence. But this sentence is the longest I could write...
  (setq-default sentence-end-double-space nil)
#+end_src

FYI, C-h k M-q gives:

    ╭────
    │ M-q runs the command fill-paragraph, which is an interactive compiled
    │ Lisp function in `fill.el'.
    │
    │ It is bound to M-q.
    │
    │ (fill-paragraph &optional JUSTIFY REGION)
    │
    │ Fill paragraph at or after point.
    ╰────

* Workaround

- Open it in a temporary buffer (via C-c ')
- Re-run M-q anywhere on the comment

#+begin_src emacs-lisp
  ;; a single space does end a sentence. But this sentence is the longest I
  ;; could write...
  (setq-default sentence-end-double-space nil)
#+end_src

FYI, when inside the temporary buffer, C-h k M-q just gives exactly the
same (and expected command): =fill-paragraph=.

* Questions

I think this is quite new, but could not identify anything peculiar in my
config. Do you have the same?

Do you understand why?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-24 14:31 Filling comments in Org code block vs in temporary buffer Sebastien Vauban
@ 2012-10-24 14:48 ` Nicolas Goaziou
  2012-10-24 18:53   ` Sebastien Vauban
  2012-12-18 11:50 ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2012-10-24 14:48 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> When trying to refill the comment directly in the following code block
> (staying in the Org file), it has *no effect*.
>
> #+begin_src emacs-lisp
>   ;; a single space does end a sentence. But this sentence is the longest I could write...
>   (setq-default sentence-end-double-space nil)
> #+end_src

Org doesn't know how to fill foreign code. Thus, you cannot fill
directly a src-block (or an example block or even an export block for
that matter).

As you tried, you can edit that chunk of code in a separate buffer with
the appropriate major mode (and subsequent filling rules) using C-c '.


Regards,

-- 
Nicolas Goaziou

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-24 14:48 ` Nicolas Goaziou
@ 2012-10-24 18:53   ` Sebastien Vauban
  2012-10-24 20:38     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2012-10-24 18:53 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Nicolas,

Nicolas Goaziou wrote:
> "Sebastien Vauban" writes:
>
>> When trying to refill the comment directly in the following code block
>> (staying in the Org file), it has *no effect*.
>>
>> #+begin_src emacs-lisp
>>   ;; a single space does end a sentence. But this sentence is the longest I could write...
>>   (setq-default sentence-end-double-space nil)
>> #+end_src
>
> Org doesn't know how to fill foreign code. Thus, you cannot fill
> directly a src-block (or an example block or even an export block for
> that matter).
>
> As you tried, you can edit that chunk of code in a separate buffer with
> the appropriate major mode (and subsequent filling rules) using C-c '.

For sure, that did work before -- at least in my setup... Maybe because of
FillAdapt and such, which I used back then.

Is there no way to make such a practical feature[1] available?

Best regards,
  Seb

[1] For example, mails I get are enclosed in a "verse" block, and I've the
habit of reformatting them before saving my "inbox" file.

-- 
Sebastien Vauban

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-24 18:53   ` Sebastien Vauban
@ 2012-10-24 20:38     ` Nicolas Goaziou
  2012-10-25  8:34       ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2012-10-24 20:38 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Is there no way to make such a practical feature[1] available?

There's a mechanism to send commands to the src-block through the
appropriate major-mode. It may be possible to ask for a filling with
that. But I don't think Org should treat a src-block as plain text when
M-q is used.

> [1] For example, mails I get are enclosed in a "verse" block, and I've the
> habit of reformatting them before saving my "inbox" file.

Verse blocks are for free-form poetry and cannot be filled. I suggest to
use quote blocks, which can be filled, for that.

Regards,

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-24 20:38     ` Nicolas Goaziou
@ 2012-10-25  8:34       ` Sebastien Vauban
  2012-10-25 12:15         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2012-10-25  8:34 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Nicolas,

Nicolas Goaziou wrote:
> "Sebastien Vauban" writes:
>
>> Is there no way to make such a practical feature[1] available?
>
> There's a mechanism to send commands to the src-block through the
> appropriate major-mode. It may be possible to ask for a filling with that.
> But I don't think Org should treat a src-block as plain text when M-q is
> used.
>
>> [1] For example, mails I get are enclosed in a "verse" block, and I've the
>> habit of reformatting them before saving my "inbox" file.
>
> Verse blocks are for free-form poetry and cannot be filled. I suggest to use
> quote blocks, which can be filled, for that.

I used VERSE (instead of EXAMPLE) by following (what I understood from) your
advice, see http://comments.gmane.org/gmane.emacs.orgmode/33919.

Maybe that's stupid of mine, but I have such a capture template for received
emails:

#+begin_src emacs-lisp
  (setq org-capture-templates
        `(("m" "Mail" entry
           (file+headline ,org-default-notes-file "Tasks")
           "* TODO %:subject%? (from %:fromname) :mail:
  SCHEDULED: %t
  %:date-timestamp-inactive

#+begin_verse
%i
#+end_verse

From %a"
           :empty-lines 1 :immediate-finish t)))
#+end_src

That allows for

- easy followup of emails to answer to (by setting SCHEDULED to today), and

- nice HTML export (LaTeX not especially used) of project documentation (where
  mail extracts may serve as documentation).

Now, I don't need anything special (no treatment of the emails contents), but
I need some "respectful" filling (what FillAdapt did), so that the following:

#+begin_quote
> I think VERSE (patched) is better than EXAMPLE because you can still
> benefit from text markup (and LaTeX snippets). Sadly, mails can
> sometimes be, well, very distant from poetry...
#+end_quote

does not become:

#+begin_quote
> I think VERSE (patched) is better than EXAMPLE because you can still >
benefit from text markup (and LaTeX snippets). Sadly, mails can > sometimes
be, well, very distant from poetry...
#+end_quote

when refilled.

Any better advice?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-25  8:34       ` Sebastien Vauban
@ 2012-10-25 12:15         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2012-10-25 12:15 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> I used VERSE (instead of EXAMPLE) by following (what I understood from) your
> advice, see http://comments.gmane.org/gmane.emacs.orgmode/33919.

A verse block implies that every line of its contents have a line break.
You can do many things with verse blocks beside poetry, but certainly
not filling them.

> Now, I don't need anything special (no treatment of the emails contents), but
> I need some "respectful" filling (what FillAdapt did), so that the following:
>
> #+begin_quote
>> I think VERSE (patched) is better than EXAMPLE because you can still
>> benefit from text markup (and LaTeX snippets). Sadly, mails can
>> sometimes be, well, very distant from poetry...
> #+end_quote
>
> does not become:
>
> #+begin_quote
>> I think VERSE (patched) is better than EXAMPLE because you can still >
> benefit from text markup (and LaTeX snippets). Sadly, mails can > sometimes
> be, well, very distant from poetry...
> #+end_quote

This is some special requirement. Org doesn't know about message mode
filling rules.

> Any better advice?

Configure FillAdapt to be compatible with Org mode? Since it's a FAQ, it
may be useful to many people.


Regards,

-- 
Nicolas Goaziou

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

* Re: Filling comments in Org code block vs in temporary buffer
  2012-10-24 14:31 Filling comments in Org code block vs in temporary buffer Sebastien Vauban
  2012-10-24 14:48 ` Nicolas Goaziou
@ 2012-12-18 11:50 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2012-12-18 11:50 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> When trying to refill the comment directly in the following code block
> (staying in the Org file), it has *no effect*.

Fixed, thanks.

-- 
 Bastien

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

end of thread, other threads:[~2012-12-18 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-24 14:31 Filling comments in Org code block vs in temporary buffer Sebastien Vauban
2012-10-24 14:48 ` Nicolas Goaziou
2012-10-24 18:53   ` Sebastien Vauban
2012-10-24 20:38     ` Nicolas Goaziou
2012-10-25  8:34       ` Sebastien Vauban
2012-10-25 12:15         ` Nicolas Goaziou
2012-12-18 11:50 ` Bastien

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