* [FR] fill caption
@ 2014-06-14 17:21 Daniele Pizzolli
2014-06-14 18:04 ` Nicolas Goaziou
2014-06-14 22:34 ` Aaron Ecay
0 siblings, 2 replies; 8+ messages in thread
From: Daniele Pizzolli @ 2014-06-14 17:21 UTC (permalink / raw
To: emacs-orgmode
[-- 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-14 17:21 [FR] fill caption Daniele Pizzolli
@ 2014-06-14 18:04 ` Nicolas Goaziou
2014-06-15 18:15 ` Daniele Pizzolli
2014-06-14 22:34 ` Aaron Ecay
1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2014-06-14 18:04 UTC (permalink / raw
To: Daniele Pizzolli; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-14 17:21 [FR] fill caption Daniele Pizzolli
2014-06-14 18:04 ` Nicolas Goaziou
@ 2014-06-14 22:34 ` Aaron Ecay
2014-06-15 18:17 ` Daniele Pizzolli
2014-07-27 17:24 ` Bastien
1 sibling, 2 replies; 8+ messages in thread
From: Aaron Ecay @ 2014-06-14 22:34 UTC (permalink / raw
To: Daniele Pizzolli, emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-14 18:04 ` Nicolas Goaziou
@ 2014-06-15 18:15 ` Daniele Pizzolli
0 siblings, 0 replies; 8+ messages in thread
From: Daniele Pizzolli @ 2014-06-15 18:15 UTC (permalink / raw
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-14 22:34 ` Aaron Ecay
@ 2014-06-15 18:17 ` Daniele Pizzolli
2014-06-19 23:52 ` Aaron Ecay
2014-07-27 17:24 ` Bastien
1 sibling, 1 reply; 8+ messages in thread
From: Daniele Pizzolli @ 2014-06-15 18:17 UTC (permalink / raw
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-15 18:17 ` Daniele Pizzolli
@ 2014-06-19 23:52 ` Aaron Ecay
0 siblings, 0 replies; 8+ messages in thread
From: Aaron Ecay @ 2014-06-19 23:52 UTC (permalink / raw
To: Daniele Pizzolli; +Cc: emacs-orgmode@gnu.org
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-06-14 22:34 ` Aaron Ecay
2014-06-15 18:17 ` Daniele Pizzolli
@ 2014-07-27 17:24 ` Bastien
2014-08-06 3:55 ` Aaron Ecay
1 sibling, 1 reply; 8+ messages in thread
From: Bastien @ 2014-07-27 17:24 UTC (permalink / raw
To: Aaron Ecay; +Cc: Daniele Pizzolli, emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FR] fill caption
2014-07-27 17:24 ` Bastien
@ 2014-08-06 3:55 ` Aaron Ecay
0 siblings, 0 replies; 8+ messages in thread
From: Aaron Ecay @ 2014-08-06 3:55 UTC (permalink / raw
To: Bastien; +Cc: Daniele Pizzolli, emacs-orgmode
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-08-06 3:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-14 17:21 [FR] fill caption Daniele Pizzolli
2014-06-14 18:04 ` Nicolas Goaziou
2014-06-15 18:15 ` Daniele Pizzolli
2014-06-14 22:34 ` Aaron Ecay
2014-06-15 18:17 ` Daniele Pizzolli
2014-06-19 23:52 ` Aaron Ecay
2014-07-27 17:24 ` Bastien
2014-08-06 3:55 ` Aaron Ecay
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.