* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
@ 2010-12-28 20:45 Drew Adams
2010-12-28 21:36 ` Lawrence Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2010-12-28 20:45 UTC (permalink / raw
To: 7751
This is a regression introduced in Emacs 22.1. There is no such problem
in Emacs 20 or 21.
emacs -Q
Put this in *scratch* or an Emacs-Lisp mode buffer:
(defun foo ()
"WHAT'S WITH THIS?
The usual menu keywords are allowed: :enable, :visible, :keys, :filter,...."
42)
Put the cursor on the second sentence of the doc string and hit `M-q'.
The sentence gets wrapped this way:
The usual menu keywords are
allowed: :enable, :visible, :keys, :filter,...."
The line should instead be broken between ":keys" and ":filter", since
there is enough space for "... allowed: :enable, :visible, :keys,".
Remove the colon before ":enable" or add a space to get ": enable" and
the line gets broken as one would expect. But with the colons as they
are, and no matter how much space is between "allowed:" and ":enable",
the line is broken incorrectly.
The same problem occurs if you change "allowed:" to "allowed.",
"allowed!", "allowed?", "allowed,", or just "allowed", and no matter how
much space you leave after it. The same problem occurs if you remove
"allowed:" altogether, i.e., with "The usual menu keywords are :enable,
...".
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2010-12-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2010-12-28 20:45 bug#7751: 24.0.50; `fill-paragraph' on doc string with colons Drew Adams
@ 2010-12-28 21:36 ` Lawrence Mitchell
2012-02-17 12:55 ` Lawrence Mitchell
2016-04-28 10:05 ` Lars Ingebrigtsen
0 siblings, 2 replies; 7+ messages in thread
From: Lawrence Mitchell @ 2010-12-28 21:36 UTC (permalink / raw
To: bug-gnu-emacs
Drew Adams wrote:
> This is a regression introduced in Emacs 22.1. There is no such problem
> in Emacs 20 or 21.
[...]
> The same problem occurs if you change "allowed:" to "allowed.",
> "allowed!", "allowed?", "allowed,", or just "allowed", and no matter how
> much space you leave after it. The same problem occurs if you remove
> "allowed:" altogether, i.e., with "The usual menu keywords are :enable,
> ...".
Here's an even more minimal test-case:
emacs -Q
(setq emacs-lisp-docstring-fill-column 30)
(insert "\"a word, another word and more :bar\"")
M-q
gives a break of:
| a word, another word and
| more :bar
whereas one would expect
| a word, another word and more
| :bar
The problem appears to be in the regexp used to define
paragraph-start in lisp-fill-paragraph:
...
(let ((paragraph-start (concat paragraph-start
"\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)"))
...
Removing the colon leads to "expected" line breaking.
FWIW, the colon was introduced by this commit:
commit cd3f5084abdd59a8392cedee90ddbaa096d61d55
Author: Dave Love <fx@gnu.org>
Date: Wed Mar 18 16:02:37 1998 +0000
(lisp-fill-paragraph): Adjust
paragraph-start in default filling case so that filling doc
strings works.
Cheers,
Lawrence
--
Lawrence Mitchell <wence@gmx.li>
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2010-12-28 21:36 ` Lawrence Mitchell
@ 2012-02-17 12:55 ` Lawrence Mitchell
2012-02-17 14:13 ` Chong Yidong
2016-04-28 10:05 ` Lars Ingebrigtsen
1 sibling, 1 reply; 7+ messages in thread
From: Lawrence Mitchell @ 2012-02-17 12:55 UTC (permalink / raw
To: 7751
Following up open bugs...
Lawrence Mitchell wrote:
[...]
> Here's an even more minimal test-case:
> emacs -Q
> (setq emacs-lisp-docstring-fill-column 30)
> (insert "\"a word, another word and more :bar\"")
> M-q
> gives a break of:
> | a word, another word and
> | more :bar
> whereas one would expect
> | a word, another word and more
> | :bar
> The problem appears to be in the regexp used to define
> paragraph-start in lisp-fill-paragraph:
> ...
> (let ((paragraph-start (concat paragraph-start
> "\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)"))
> ...
> Removing the colon leads to "expected" line breaking.
[...]
Would a patch to do this be welcome?
Lawrence
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2012-02-17 12:55 ` Lawrence Mitchell
@ 2012-02-17 14:13 ` Chong Yidong
2012-02-17 14:55 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2012-02-17 14:13 UTC (permalink / raw
To: Lawrence Mitchell; +Cc: 7751
Lawrence Mitchell <wence@gmx.li> writes:
>> The problem appears to be in the regexp used to define
>> paragraph-start in lisp-fill-paragraph:
>
>> (let ((paragraph-start (concat paragraph-start
>> "\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)"))
>
>> Removing the colon leads to "expected" line breaking.
>
> Would a patch to do this be welcome?
As explained in the comments in that file, the colon is there so that
forms like
(defcustom foo nil
:bar 3)
Don't get refilled to
(defcustom foo nil :bar 3)
when you type M-q. The effect on docstrings containing colons is
unfortunate, but simply removing the colon from the regexp would be
incorrect.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2012-02-17 14:13 ` Chong Yidong
@ 2012-02-17 14:55 ` Drew Adams
2012-09-17 0:15 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2012-02-17 14:55 UTC (permalink / raw
To: 'Chong Yidong', 'Lawrence Mitchell'; +Cc: 7751
> the colon is there so that forms like
> (defcustom foo nil
> :bar 3)
>
> Don't get refilled to
> (defcustom foo nil :bar 3)
>
> when you type M-q.
And just why is that important?
If there is room for it given the value of `fill-column', such filling makes
sense - a good thing, not a bad thing.
Sure, it would be best if a keyword and its value were always (`fill-column'
permitting) on the same line. But that's a nice-to-have - it should not be the
first priority or the reason for mangling filling of doc strings.
Anyway, the #7751 bug report is not about that, at all.
It's about using `M-q' on a _doc string_. It's not about using `M-q' on a sexp
such as you present above (which has no strings at all). Let's not take a
detour. If the current code does not distinguish the doc-string case, maybe it
should.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2012-02-17 14:55 ` Drew Adams
@ 2012-09-17 0:15 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2012-09-17 0:15 UTC (permalink / raw
To: 'Chong Yidong', 'Lawrence Mitchell'; +Cc: 7751
ping
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#7751: 24.0.50; `fill-paragraph' on doc string with colons
2010-12-28 21:36 ` Lawrence Mitchell
2012-02-17 12:55 ` Lawrence Mitchell
@ 2016-04-28 10:05 ` Lars Ingebrigtsen
1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-28 10:05 UTC (permalink / raw
To: Lawrence Mitchell; +Cc: 7751
Lawrence Mitchell <wence@gmx.li> writes:
> The problem appears to be in the regexp used to define
> paragraph-start in lisp-fill-paragraph:
>
> ...
> (let ((paragraph-start (concat paragraph-start
> "\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)"))
> ...
>
> Removing the colon leads to "expected" line breaking.
I've now removed the colon from that regexp when we're doing `M-q'
inside a string.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-28 10:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-28 20:45 bug#7751: 24.0.50; `fill-paragraph' on doc string with colons Drew Adams
2010-12-28 21:36 ` Lawrence Mitchell
2012-02-17 12:55 ` Lawrence Mitchell
2012-02-17 14:13 ` Chong Yidong
2012-02-17 14:55 ` Drew Adams
2012-09-17 0:15 ` Drew Adams
2016-04-28 10:05 ` Lars Ingebrigtsen
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.