Here is the the configuration I run (defun turn-on-full-org-mailing () (turn-on-orgstruct++) (turn-on-orgtbl) (load "org-html-mail")) (add-hook 'mail-mode-hook 'turn-on-full-org-mailing) in order make use of Org minor mode (struct, tbl) within mail-mode. Unfortunately with this, calling M-q (fill-paragraph) right after the header separator ("--text follows this line--") leads to filling the header along with the first paragraph of my mail. It turns out that the org minor mode rebinds M-q to `orgstruct-hijacker-command-22' : ,---- | M-q runs the command orgstruct-hijacker-command-22, which is an | interactive Lisp function. | | It is bound to M-q. | | (orgstruct-hijacker-command-22 arg) | | In Structure, run `fill-paragraph'. | Outside of structure, run the binding of `\361'. `---- Any idea on how to make use of org minor mode in mail-mode and still be able to fill-paragraph without impacting mail headers? -- René
René <jlr_0@yahoo.com> writes: > Here is the the configuration I run > > (defun turn-on-full-org-mailing () > (turn-on-orgstruct++) > (turn-on-orgtbl) > (load "org-html-mail")) > > (add-hook 'mail-mode-hook 'turn-on-full-org-mailing) > > Unfortunately with this, calling M-q (fill-paragraph) right after the > header separator ("--text follows this line--") leads to filling the > header along with the first paragraph of my mail. > [...] > > Any idea on how to make use of org minor mode in mail-mode and still > be able to fill-paragraph without impacting mail headers? The org minor modes set the local value of fill-paragraph-function to org-fill-paragraph. You can override this by adding a line to your hook function: (defun turn-on-full-org-mailing () (turn-on-orgstruct++) (turn-on-orgtbl) (load "org-html-mail") (setq fill-paragraph-function 'message-fill-paragraph)) I'm not sure how this will affect calling fill on lists or tables, however. A proper fix would probably add a test to org-fill-paragraph to see if we are in message mode. Best, Matt
Hello, Matt Lundin <mdl@imapmail.org> writes: >> Any idea on how to make use of org minor mode in mail-mode and still >> be able to fill-paragraph without impacting mail headers? > > The org minor modes set the local value of fill-paragraph-function to > org-fill-paragraph. You can override this by adding a line to your hook > function: > > (defun turn-on-full-org-mailing () > (turn-on-orgstruct++) > (turn-on-orgtbl) > (load "org-html-mail") > (setq fill-paragraph-function 'message-fill-paragraph)) > > I'm not sure how this will affect calling fill on lists or tables, > however. It will break list and tables filling. > A proper fix would probably add a test to org-fill-paragraph to see if > we are in message mode. Another idea would be to change `paragraph-start' and `paragraph-separate' values when turning on orgstruct and orgtbl. #+begin_src emacs-lisp (setq paragraph-start (concat (regexp-quote mail-header-separator) "$\\|" "-- $\\|" ; signature delimiter "---+$\\|" ; delimiters for forwarded messages page-delimiter "$\\|" ; spoiler warnings ".*wrote:$\\|" ; attribution lines message-cite-prefix-regexp "$\\|" ; empty lines in quoted text ; mml tags "<#!*/?\\(multipart\\|part\\|external\\|mml\\|secure\\)" paragraph-start)) (setq paragraph-separate paragraph-start) #+end_src Regards, -- Nicolas
> >> Any idea on how to make use of org minor mode in mail-mode and still > >> be able to fill-paragraph without impacting mail headers? > > > > The org minor modes set the local value of fill-paragraph-function to > > org-fill-paragraph. You can override this by adding a line to your hook > > function: > > > > (defun turn-on-full-org-mailing () > > (turn-on-orgstruct++) > > (turn-on-orgtbl) > > (load "org-html-mail") > > (setq fill-paragraph-function 'message-fill-paragraph)) > > > > I'm not sure how this will affect calling fill on lists or tables, > > however. As matter of fact, the trouble comes from `turn-on-orgstruct++'. Using `turn-on-orgstruct' instead is alright. When called `fill-paragraph' operates without interfering with the mail header. > Another idea would be to change `paragraph-start' and > `paragraph-separate' values when turning on orgstruct and orgtbl. Does not seem to work for me. -- Rene
René <jlr_0 <at> yahoo.com> writes:
> Here is the the configuration I run
>
> (defun turn-on-full-org-mailing ()
> (turn-on-orgstruct++)
> (turn-on-orgtbl)
> (load "org-html-mail"))
>
> (add-hook 'mail-mode-hook 'turn-on-full-org-mailing)
>
> in order make use of Org minor mode (struct, tbl) within mail-mode.
>
> Unfortunately with this, calling M-q (fill-paragraph) right after the
> header separator ("--text follows this line--") leads to filling the
> header along with the first paragraph of my mail.
I found the right solution. I just needed to toggle Filladapt minor mode.
This way `auto-fill-mode' and the `fill-paragraph' command are both smarter
about guessing a proper fill-prefix and finding paragraph boundaries when
indented lines and paragraphs are used.
(require 'filladapt)
(setq-default filladapt-mode t)
--
Rene
On Sat, Sep 10 2011, Rene wrote:
> René <jlr_0 <at> yahoo.com> writes:
>
>> Here is the the configuration I run
>>
>> (defun turn-on-full-org-mailing ()
>> (turn-on-orgstruct++)
>> (turn-on-orgtbl)
>> (load "org-html-mail"))
>>
>> (add-hook 'mail-mode-hook 'turn-on-full-org-mailing)
>>
>> in order make use of Org minor mode (struct, tbl) within mail-mode.
>>
>> Unfortunately with this, calling M-q (fill-paragraph) right after the
>> header separator ("--text follows this line--") leads to filling the
>> header along with the first paragraph of my mail.
>
> I found the right solution. I just needed to toggle Filladapt minor mode.
> This way `auto-fill-mode' and the `fill-paragraph' command are both smarter
> about guessing a proper fill-prefix and finding paragraph boundaries when
> indented lines and paragraphs are used.
>
> (require 'filladapt)
> (setq-default filladapt-mode t)
Thanks for this hint! I had been advising fill-paragraph, this seems
like a more comprehensive solution.
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
> Thanks for this hint! I had been advising fill-paragraph, this seems
> like a more comprehensive solution.
What is strange though is that (turn-on-orgstruct++) messes up with the header
separator ("--text follows this line--") when calling M-q (fill-paragraph);
whereas (turn-on-orgstruct) doesn't pose any problem.
Why such a different behavior between turn-on-orgstruct++ and turn-on-orgstruct?
Is that a feature or a bug?
--
Rene