emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [FR] fill caption


From: Aaron Ecay
Subject: Re: [O] [FR] fill caption
Date: Sat, 14 Jun 2014 18:34:09 -0400
User-agent: Notmuch/0.17+160~g03680d1 (http://notmuchmail.org) Emacs/24.4.50.4 (x86_64-unknown-linux-gnu)

Hi Daniele,

2014ko ekainak 14an, Daniele Pizzolli-ek idatzi zuen:
> 
> Hello @ll,
> 
> I noticed that multi line caption works as expected, but there is no
> way to fill it (at least to my knowledge).
> 
> I added a test case that should speak by itself.
> 
> I do not know a lot of elisp, but if you have some pointer I could try
> to implement it by myself.
> 
> Maybe this could be extended to handle also OPTIONS and LocalWords
> and others.

I have the following function in my org-mode-hook:

(defun awe-org-setup-fill-hook ()
  (make-local-variable 'filladapt-token-table)
  (make-local-variable 'filladapt-token-match-table)
  (make-local-variable 'filladapt-token-conversion-table)
  (cl-pushnew `(,(rx "#+" (or "caption" "CAPTION") ": ") org-caption)
              filladapt-token-table :test #'equal)
  (cl-pushnew '(org-caption org-caption)
              filladapt-token-match-table :test #'equal)
  (cl-pushnew '(org-caption . exact)
              filladapt-token-conversion-table :test #'equal))

It uses filladapt <http://www.emacswiki.org/emacs/FillAdapt> to fill
caption keywords properly (it doesn’t handle the case of short captions,
since these are complicated, as Nicolas points out in his reply).

There’s a warning in the Org manual about using filladapt with org, but
I’ve never noticed any problems.

If you use ispell’s facility for adding to LocalWords (pressing A
(i.e. shift+a) at the spelling correction prompt, or “Accept (buffer)”
in the context menu), it will handle breaking the LocalWords lines for
you.

Hope this is useful,

-- 
Aaron Ecay



reply via email to

[Prev in Thread] Current Thread [Next in Thread]