[-- Attachment #1: Type: text/plain, Size: 381 bytes --] 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. Thanks in advance, Daniele [-- Attachment #2: fill-caption-test.diff --] [-- Type: text/x-patch, Size: 779 bytes --] diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 39db5bf..7ebac61 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -362,6 +362,19 @@ (end-of-line) (org-auto-fill-function) (buffer-string)))))) + ;; Correctly fill the caption. + (should + (equal "#+CAPTION: this is a very very\n#+CAPTION: long caption" + (org-test-with-temp-text "#+CAPTION: this is a very very long caption" + (let ((fill-column 30)) + (org-fill-paragraph) + (buffer-string))))) + (should + (equal "#+CAPTION: this is a very short caption" + (org-test-with-temp-text #+CAPTION: this is a very \n#+CAPTION: short caption" + (let ((fill-column 80)) + (org-fill-paragraph) + (buffer-string))))) \f
Hello, Daniele Pizzolli <dan@toel.it> writes: > 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. This was requested before. In a nutshell, this can be done, but there are some caveats (see http://permalink.gmane.org/gmane.emacs.orgmode/82083). Regards, -- Nicolas Goaziou
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
On 06/14/2014 08:04 PM, Nicolas Goaziou wrote: > Hello, > > Daniele Pizzolli writes: > >> I noticed that multi line caption works as expected, but there is no >> way to fill it (at least to my knowledge). [] > This was requested before. > > In a nutshell, this can be done, but there are some caveats (see > http://permalink.gmane.org/gmane.emacs.orgmode/82083). Thanks Nicolas, I missed it, I double checked only: http://orgmode.org/worg/org-issues.html Next time will do a search on the mailing list before submitting a feature request. Best, Daniele
On 06/15/2014 12:34 AM, Aaron Ecay wrote: > 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 have the following function in my org-mode-hook: Hello Aaron, Nice, since I do not use short caption, this could be really a viable solution. How I am supposed to set it up? I added it as: (add-hook 'org-mode-hook (lambda () (awe-org-setup-fill-hook))) When pressing M-q it does nothing on #+caption: lines. If I enable the debug (fill-adapt-debug) I can see (org-message) in the status bar and "#+caption: " becomes highlighted. But again M-q does nothing. I am using: org 8.2.7. > 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. Yes, but do not re-fill the previous lines (eg: if you change fill-column). But that is a minor annoyance, let’s drop it now. > Hope this is useful, Sure! Thanks, Daniele
Hi Daniele,
>
> Hello Aaron,
>
> Nice, since I do not use short caption, this could be really a
> viable solution.
>
> How I am supposed to set it up?
>
> I added it as:
>
> (add-hook 'org-mode-hook (lambda () (awe-org-setup-fill-hook)))
>
> When pressing M-q it does nothing on #+caption: lines.
>
> If I enable the debug (fill-adapt-debug) I can see (org-message) in
> the status bar and "#+caption: " becomes highlighted. But again M-q
> does nothing.
I'm puzzled. I have other customizations related to filling in my
org-mode-hook (to make fill-paragraph split text into one sentence per
line for better git diffs). The customization I sent works in the
context of that other code, but I haven't been able to get it to
function independently.
Sorry,
Aaron
Hi Aaron,
Aaron Ecay <aaronecay@gmail.com> writes:
> There’s a warning in the Org manual about using filladapt with org, but
> I’ve never noticed any problems.
Interesting -- was it always like this? Or is it due to the recent
improvements Nicolas made to the filling mechanisms? If the manual
needs to remove the warning, let's do so.
--
Bastien
Hi Bastien,
2014ko uztailak 27an, Bastien-ek idatzi zuen:
>
> Hi Aaron,
>
> Aaron Ecay <aaronecay@gmail.com> writes:
>
>> There’s a warning in the Org manual about using filladapt with org, but
>> I’ve never noticed any problems.
>
> Interesting -- was it always like this? Or is it due to the recent
> improvements Nicolas made to the filling mechanisms? If the manual
> needs to remove the warning, let's do so.
This warning was introduced on Sep 21 2012 in commit 6cb676f6. AFAIK,
that predates Nicolas’s work. I will let you make the decision about
whether the warning should be removed.
--
Aaron Ecay