unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should `fill-paragraph' respect formatting?
@ 2021-12-08 16:15 Tor Kringeland
  2021-12-09  1:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Tor Kringeland @ 2021-12-08 16:15 UTC (permalink / raw)
  To: emacs-devel

I sent the following to an `org-mode' mailing list:

> Applying `org-fill-paragraph' to /e.g./
> 
>   /Some text./  Some more text.
> 
> when `sentence-end-double-space' is t removes the double space to a
> single space.  The same happens with other formatting like *bold* and
> _underline_.  In other instances it is more context aware.  /E.g./
> applying it to
> 
>   (Some text.)  Some more text.
> 
> does nothing, which is correct.

`org-mode' binds it's own variant of `fill-paragraph', but should the
default `fill-paragraph' respect formatting like this also?  /E.g./ when
writing text outside `org-mode' (or something similar like
`markdown-mode' for that matter), like in an e-mail, it's not uncommon
to use formatting like _this._  Or is it better to leave this to individual
major modes?



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

* Re: Should `fill-paragraph' respect formatting?
  2021-12-08 16:15 Should `fill-paragraph' respect formatting? Tor Kringeland
@ 2021-12-09  1:03 ` Lars Ingebrigtsen
  2021-12-09  2:05   ` Tor Kringeland
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-09  1:03 UTC (permalink / raw)
  To: Tor Kringeland; +Cc: emacs-devel

Tor Kringeland <tor.a.s.kringeland@ntnu.no> writes:

> I sent the following to an `org-mode' mailing list:
>
>> Applying `org-fill-paragraph' to /e.g./
>> 
>>   /Some text./  Some more text.

Shouldn't that be

  /Some text/.  Some more text.

😀

> `org-mode' binds it's own variant of `fill-paragraph', but should the
> default `fill-paragraph' respect formatting like this also?  /E.g./ when
> writing text outside `org-mode' (or something similar like
> `markdown-mode' for that matter), like in an e-mail, it's not uncommon
> to use formatting like _this._  Or is it better to leave this to individual
> major modes?

I think it's up to the individual modes.  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Should `fill-paragraph' respect formatting?
  2021-12-09  1:03 ` Lars Ingebrigtsen
@ 2021-12-09  2:05   ` Tor Kringeland
  0 siblings, 0 replies; 3+ messages in thread
From: Tor Kringeland @ 2021-12-09  2:05 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

On 09/12/2021 02:03, Lars Ingebrigtsen wrote:
>    /Some text/.  Some more text.
> 
> 😀

I think it's a matter of choice, similar to putting a period before or
after a quote.  À la Americans it's Some "text." while otherwise it's
Some "text". --- I think, though it's not a rule.  If you're
formatting a whole sentence it makes more sense to surround it
including the period for consistency, but for one word at the end of
the sentence /vice versa/.

> I think it's up to the individual modes.
> 
I think it's a matter of choice, similar to placing a period before or
after a quote.  À la Americans it's Some "text." while otherwise it's
Some "text". --- I think, though it's not a rule.  If you're
formatting a whole sentence it makes more sense to surround it
including the period for consistency, but for one word at the end of
the sentence /vice versa/.

Maybe it'd be possible to have a customizable regex for what defines
the end of a sentence in a given mode?  /E.g./ in `text-mode' derived
modes that doesn't have the pretty formatting like `org-mode'
formatting like this is still used sometimes, but not by everyone.

Another example is TeX where $-encapsulated "math" ending in a double
space afterwards isn't respected.  Though it respect the three most
common brackets (), [] and {}.

I did some digging with regard to how `fill-paragraph' treats
quotation marks, and found some interesting results.  For example it
respect the "standard ASCII" ones

   Some."  Text

   Some.'  Text

and Norwegian, Swedish and Japanese ones like

   Some.»  Text

   Some«.  Text

   Some」.  Text

and some rarer ones

   Some.›  Text

   Some〞.  Text

probably because it doesn't recognize these as quotation marks and
guesses that they're part of the word itself.  However, for the
following ones it removes the double space

   Some.‘  Text

   Some.“  Text

   Some.❜  Text

   Some.❞  Text

which I guess means it understands that these are quotation marks and
not part of the word, but doesn't respect the double space like with
the first two examples.



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

end of thread, other threads:[~2021-12-09  2:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 16:15 Should `fill-paragraph' respect formatting? Tor Kringeland
2021-12-09  1:03 ` Lars Ingebrigtsen
2021-12-09  2:05   ` Tor Kringeland

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).