GNU bug report logs -
#1169
23.0.60; (substitute-command-keys "\\{...}") adds extra newline
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Tue, 14 Oct 2008 22:55:04 UTC
Severity: minor
Tags: fixed
Fixed in version 24.1
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1169 in the body.
You can then email your comments to 1169 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1169
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Drew Adams" <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
emacs -Q
(substitute-command-keys "\\{minibuffer-local-map}") ; or another map
The returned string ends in \n\n. It should end in just \n.
If text is added after the returned string, then it should be up to
that text to start with a \n if it wants a blank separator line. If,
for example, it starts instead with ^L, then the current code includes
an extra blank line before the form feed.
It should be up to the calling function to decide whether it wants a
blank line at the end - only the calling function knows the context
and whether such a line is appropriate.
In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
of 2008-10-03 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
Severity set to `minor' from `normal'
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> emacsbugs.donarmstrong.com
.
(Mon, 01 Dec 2008 21:55:05 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1169
; Package
emacs
.
(Wed, 18 Feb 2009 19:15:04 GMT)
Full text and
rfc822 format available.
View this message in rfc822 format
"Drew Adams" <drew.adams <at> oracle.com> writes:
> (substitute-command-keys "\\{minibuffer-local-map}") ; or another map
>
> The returned string ends in \n\n. It should end in just \n.
>
> If text is added after the returned string, then it should be up to
> that text to start with a \n if it wants a blank separator line. If,
> for example, it starts instead with ^L, then the current code includes
> an extra blank line before the form feed.
>
> It should be up to the calling function to decide whether it wants a
> blank line at the end - only the calling function knows the context
> and whether such a line is appropriate.
I've now made the change, but I haven't totally replicated the look of
`C-h b' and the like. It used to have
... stuff ...
^L
... more stuff ...
With the change, it now says:
... stuff ...
^L
... more stuff ...
I can add back the newlines if people want. I'd rather get rid of the
^L characters, though. Do they have any purpose any more?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Thu, 07 Jul 2011 17:26:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> I'd rather get rid of the ^L characters, though.
> Do they have any purpose any more?
No, no, no.
Yes, of course they serve a purpose - more than one purpose.
See `(emacs) Pages', to start with.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Thu, 07 Jul 2011 17:34:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 1169 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
>> I'd rather get rid of the ^L characters, though.
>> Do they have any purpose any more?
>
> No, no, no.
> Yes, of course they serve a purpose - more than one purpose.
> See `(emacs) Pages', to start with.
I know what they do, but is there any point in actually inserting
something as visually distracting as ^L into the buffer people are
looking at?
If one, for instance, just made the ^L invisible, it'd look nicer, and
there would be minimal code change.
A better solution would probably to get rid of it altogether and instead
insert a `form-feed' text property that the `C-x [' (and friends)
command would use instead.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Thu, 07 Jul 2011 17:51:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> >> I'd rather get rid of the ^L characters, though.
> >> Do they have any purpose any more?
> >
> > No, no, no.
> > Yes, of course they serve a purpose - more than one purpose.
> > See `(emacs) Pages', to start with.
>
> I know what they do, but is there any point in actually inserting
> something as visually distracting as ^L into the buffer people are
> looking at?
>
> If one, for instance, just made the ^L invisible, it'd look nicer, and
> there would be minimal code change.
>
> A better solution would probably to get rid of it altogether and
> instead insert a `form-feed' text property that the `C-x [' (and friends)
> command would use instead.
1. If you want to propose an Emacs design change, then please propose it to
emacs-devel, for discussion. This is not the place.
2. The presence and purpose of ^L are one thing.
The appearance is something else.
Wrt #2, I use (and I proposed to Emacs Dev) pp-c-l.el, which lets users
customize the appearance of a page break to virtually anything they like.
http://www.emacswiki.org/emacs/download/pp-c-l.el - code
http://www.emacswiki.org/emacs/PrettyControlL - description
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Thu, 07 Jul 2011 20:08:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 1169 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jul 7, 2011 at 19:32, Lars Magne Ingebrigtsen <larsi <at> gnus.org> wrote:
> I know what they do, but is there any point in actually inserting
> something as visually distracting as ^L into the buffer people are
> looking at?
>
> If one, for instance, just made the ^L invisible, it'd look nicer, and
> there would be minimal code change.
(defface page-break
'((t :strike-through t))
"Face to make page breaks more visible.")
(define-minor-mode page-break-mode
"Toggle Page Break mode.
This is a global minor mode: all buffers which don't have an
overriding window or buffer display-table will be affected."
:init-value nil
:global t
(aset (or standard-display-table
(setq standard-display-table (make-display-table)))
?\^L
(and page-break-mode
(or (get 'page-break-mode :glyph-vector)
(put 'page-break-mode :glyph-vector
(make-vector 78 (make-glyph-code ?\s 'page-break)))))))
Juanma
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 12 Jul 2011 08:50:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.1, send any further explanations to
1169 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 12 Jul 2011 08:50:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 09 Aug 2011 11:24:06 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Johan Bockgard <bojohan <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 29 May 2012 17:37:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Tue, 29 May 2012 17:48:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 1169 <at> debbugs.gnu.org (full text, mbox):
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:
> "Drew Adams" <drew.adams <at> oracle.com> writes:
>
>> (substitute-command-keys "\\{minibuffer-local-map}") ; or another map
>>
>> The returned string ends in \n\n. It should end in just \n.
[...]
> I've now made the change,
This change breaks the highlighting code in `help-make-xrefs' which
assumes that a list of key bindings produced by substitute-command-keys
(in `documentation') ends with an extra blank line:
(while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n"
nil t)
(let ((col (- (match-end 1) (match-beginning 1))))
(while
(and (not (eobp))
;; Stop at a pair of blank lines.
(not (looking-at "\n\\s-*\n")))
Example:
emacs -Q
C-h m
C-x o
M->
Note the highlighted "or"s in the last two paragraphs.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Tue, 29 May 2012 19:09:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> This change breaks the highlighting code in `help-make-xrefs' which
> assumes that a list of key bindings produced by
> substitute-command-keys
> (in `documentation') ends with an extra blank line:
>
> (while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n"
> nil t)
> (let ((col (- (match-end 1) (match-beginning 1))))
> (while
> (and (not (eobp))
> ;; Stop at a pair of blank lines.
> (not (looking-at "\n\\s-*\n")))
>
> Example:
> emacs -Q
> C-h m
> C-x o
> M->
>
> Note the highlighted "or"s in the last two paragraphs.
So maybe a different fix is needed. Some fix for 1169 is needed, in any case.
But the visual change I see from a build from 2011-07-11 and a build from
2011-07-18 (and later builds) is that function names are now links (which is
generally a good thing).
Isn't that a separate thing (feature) from the fix for bug #1169?
That function-name highlighting can sometimes be "off" - highlighting the word
`or' as if it was intended as the function `or', seems a separate problem from
`substitute-command-keys' adding an extra newline char. No?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 14:13:01 GMT)
Full text and
rfc822 format available.
Message #40 received at 1169 <at> debbugs.gnu.org (full text, mbox):
Johan Bockgård <bojohan <at> gnu.org> writes:
>> I've now made the change,
>
> This change breaks the highlighting code in `help-make-xrefs' which
> assumes that a list of key bindings produced by substitute-command-keys
> (in `documentation') ends with an extra blank line
Thanks. I've reverted the change in the emacs-24 branch, and added a
note to the docstring of substitute-command-keys that the two newlines
are needed by `help-make-xrefs'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 14:47:01 GMT)
Full text and
rfc822 format available.
Message #43 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> >> I've now made the change,
> >
> > This change breaks the highlighting code in `help-make-xrefs' which
> > assumes that a list of key bindings produced by
> > substitute-command-keys (in `documentation') ends with an extra blank line
>
> Thanks. I've reverted the change in the emacs-24 branch, and added a
> note to the docstring of substitute-command-keys that the two newlines
> are needed by `help-make-xrefs'.
Huh? Two newlines is the wrong thing. It is the point of this bug report.
If some other fix is needed than the one that you made, fine. Just DTRT.
Sounds like `help-make-xrefs' needs to be fixed - dunno.
In any case, the extra newline still needs to be removed. It is simply wrong -
doesn't belong in `substitute-command-keys' - is not part of its mission.
And you added your note to the _doc string_? Of `substitute-command-keys'? If
you need to make a note that this bug still needs to be fixed then that should
be done elsewhere than a doc string.
There is absolutely nothing in the purpose of `substitute-command-keys' that
constrains it or invites it to add an extra newline. Quite the contrary.
`substitute-command-keys' is a very general utility function. It is not some
helper routine for `help-make-xrefs'. Bending it to fix inadequate code in
`help-make-xrefs' is _way_ wrong. And putting that kind of note into its doc
string is doubly wrong.
To repeat, from the bug report:
> If text is added after the returned string, then it should be up
> to *that* text to start with a \n if it wants a blank separator line.
> If, for example, it starts instead with ^L, then the current code
> includes an extra blank line before the form feed.
>
> It should be up to the *calling* function to decide whether it wants
> a blank line at the end - *only* the calling function knows the
> context and whether such a line is appropriate.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 16:43:02 GMT)
Full text and
rfc822 format available.
Message #46 received at 1169 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> Huh? Two newlines is the wrong thing. It is the point of this bug
> report.
>
> If some other fix is needed than the one that you made, fine. Just
> DTRT. Sounds like `help-make-xrefs' needs to be fixed - dunno.
Two newlines does not seem obviously wrong to me. It is a way of
denoting the end of the key summary, just like the "key" and "binding"
column headers that are also inserted to denote the start. We could
probably do something fancy like using a text property to mark the
extent of the key summary, but that seems like overengineering, and
anyway it might break third-party code that relies on the old behavior.
Feel free to submit a patch for consideration, if you care a lot about
replacing those two newlines, though.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 17:39:02 GMT)
Full text and
rfc822 format available.
Message #49 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> > Huh? Two newlines is the wrong thing. It is the point of this bug
> > report.
> >
> > If some other fix is needed than the one that you made, fine. Just
> > DTRT. Sounds like `help-make-xrefs' needs to be fixed - dunno.
>
> Two newlines does not seem obviously wrong to me. It is a way of
> denoting the end of the key summary, just like the "key" and "binding"
> column headers that are also inserted to denote the start.
The `}' character "denotes the end", perfectly. The code that calls `s-c-k' has
no need to guess where the substituted text ends: it ends where the code uses
`}' in the string argument.
Everything depends on what the calling code wants to do with the returned
string. You are assuming that it always wants an extra separator line (extra
newline) at the end, because you are thinking of a particular calling context.
I reported the bug because I use this utility string function in other contexts,
some of which do not want an extra newline. I gave a good example: ^L following
\{...}. Isn't that reasonable, that some code might want to end a page with a
key listing? Why impose an extra newline char at the page end?
Calling code can always add an extra newline whenever it wants it - it can add
15 newlines if it likes. That's the point. By shoving this extra newline into
the `s-c-k' substitution systematically, you make it impossible NOT to have the
extra newline.
This should be a no-brainer. Nothing prevents a caller from writing (s-c-k "foo
\\{barmap}\ntoto") instead of (s-c-k "foo\\{barmap}toto").
> We could probably do something fancy like using a text property to mark the
> extent of the key summary,
Huh? Why do you need to "mark" it? It is "marked" by the delimiters \\{...}.
Whatever comes after the `}' is the first char after the key listing - no
question about it. If nothing comes after the `}' then the end of the key
listing is the end of the resulting string.
> but that seems like overengineering, and anyway it might break third-party
> code that relies on the old behavior.
Give me a break, please. Any code that expects the extra newline can add "\n".
And the change due to the fix will be obvious, if it is important.
`s-c-k' is a general-purpose string manipulation function. It simply
substitutes key and keymap descriptions for placeholders (\[], \{}, and \<>).
There is zero need to "denote the end" of the substituted text - it is indicated
in the source string by `}'.
> Feel free to submit a patch for consideration, if you care a lot about
> replacing those two newlines, though.
I do care a lot about it, but you know that I will not be submitting a C patch.
If it were coded in Lisp then I would submit a patch.
It is obvious that the (trivial) fix is to (a) not insert an extra newline in
`s-c-k' and (b) insert such a newline in the particular caller that expects the
newline in this case.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 20:05:02 GMT)
Full text and
rfc822 format available.
Message #52 received at 1169 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
>> > Huh? Two newlines is the wrong thing. It is the point of this bug
>> > report.
>> >
>> > If some other fix is needed than the one that you made, fine. Just
>> > DTRT. Sounds like `help-make-xrefs' needs to be fixed - dunno.
>>
>> Two newlines does not seem obviously wrong to me. It is a way of
>> denoting the end of the key summary, just like the "key" and "binding"
>> column headers that are also inserted to denote the start.
>
> The `}' character "denotes the end", perfectly.
Which '}' character?
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#1169
; Package
emacs
.
(Wed, 30 May 2012 20:24:02 GMT)
Full text and
rfc822 format available.
Message #55 received at 1169 <at> debbugs.gnu.org (full text, mbox):
> > The `}' character "denotes the end", perfectly.
>
> Which '}' character?
Which double-newline?
There is a lot less (zero?) ambiguity in finding the `}' that corresponds to a
given `\{' than there is to trying to parse the _resulting_, substituted text
for \n\n to determine the end of the text that was substituted for `}'. Try
(substiture-command-keys "\\{global-map}") and see how many \n\n there are.
Why rely on the content of the _resulting_ string, after substitution?
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 28 Jun 2012 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 293 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.