GNU bug report logs -
#37325
About 'latex-insert/close-block' in 'latex-mode'
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37325 in the body.
You can then email your comments to 37325 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Fri, 06 Sep 2019 17:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sebastian Urban <mrsebastianurban <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 06 Sep 2019 17:32:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
in 'latex-mode' (not AUCTeX) there are:
- 'latex-insert-block' (function) & 'tex-latex-block' (alias)
on 'C-c C-o' and 'C-c C-t';
- 'latex-close-block' (function) & 'tex-close-latex-block' (alias)
on 'C-c C-e' and 'C-c /' and 'C-c ]'.
1. Why so many key bindings? Can we have 'C-c [' for "insert" and
'C-c ]' for "close" - and just that? When I do 'C-c [' it's
"undefined", so maybe...
2. When I use 'where-is' on both aliases I get (echo area, 2 lines):
tex-latex-block is not on any key;
its alias latex-insert-block is on C-c C-t, C-c C-o
If I'm not mistaken, it says that 'latex-insert-block' is an alias for
'tex-latex-block' when it's completely otherwise. So 2nd line should
rather say:
it's na alias for latex-insert-block, which is on C-c C-t, C-c C-o
2.1. Why the one char indent in 2nd line?
3. In INFO 25.11.2 "LaTeX Editing Commands" for 'C-c C-o' alias
'tex-latex-block' is used and for 'C-c C-e' alias
'tex-close-latex-block' is used - why not real functions names:
'latex-insert-block' and 'latex-close-block'? They would even sound
better (look at the name of the section).
4. And then, after all, are those aliases needed at all?
S. U.
GNU Emacs 26.2 (build 1, i686-w64-mingw32) of 2019-04-13
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Sat, 07 Sep 2019 10:17:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 37325 <at> debbugs.gnu.org (full text, mbox):
> From: Sebastian Urban <mrsebastianurban <at> gmail.com>
> Date: Fri, 6 Sep 2019 19:31:05 +0200
>
> 2. When I use 'where-is' on both aliases I get (echo area, 2 lines):
>
> tex-latex-block is not on any key;
> its alias latex-insert-block is on C-c C-t, C-c C-o
>
> If I'm not mistaken, it says that 'latex-insert-block' is an alias for
> 'tex-latex-block' when it's completely otherwise. So 2nd line should
> rather say:
>
> it's na alias for latex-insert-block, which is on C-c C-t, C-c C-o
>
> 2.1. Why the one char indent in 2nd line?
I cannot reproduce these 2 parts: when I use "C-h w" on these two
aliases, I get a single line in the echo area saying they are not on
any key. No second line, indented or otherwise.
Can you show a complete recipe starting from "emacs -Q"?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Sat, 07 Sep 2019 21:16:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 37325 <at> debbugs.gnu.org (full text, mbox):
> Can you show a complete recipe starting from "emacs -Q"?
1. emacs -Q
2. C-x b a RET ('a' is random name)
3. M-x latex-mode
4a. C-h w tex-latex-block
4b. C-h w tex-close-latex-block
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Sun, 08 Sep 2019 17:09:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 37325 <at> debbugs.gnu.org (full text, mbox):
> From: Sebastian Urban <mrsebastianurban <at> gmail.com>
> Cc: 37325 <at> debbugs.gnu.org
> Date: Sat, 7 Sep 2019 21:15:24 +0200
>
> > Can you show a complete recipe starting from "emacs -Q"?
>
> 1. emacs -Q
> 2. C-x b a RET ('a' is random name)
> 3. M-x latex-mode
> 4a. C-h w tex-latex-block
> 4b. C-h w tex-close-latex-block
Thanks, now I see it.
It sounds like the code which adds aliases treats an alias as a
symmetric relation. Not sure if this is correct.
As for the extra blank, I think it's a matter of personal preference
whether it improves the display or makes it worse.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Thu, 23 Apr 2020 12:30:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 37325 <at> debbugs.gnu.org (full text, mbox):
So, I revisited this bug and I should update it.
> 1. Why so many key bindings? Can we have 'C-c [' for "insert" and
> 'C-c ]' for "close" - and just that? When I do 'C-c [' it's
> "undefined", so maybe...
After looking into "tex-mode.el" I found explanation in
"tex-mode-map":
;; Redundant keybindings, for consistency with SGML mode.
(define-key map "\C-c\C-t" 'latex-insert-block)
(define-key map "\C-c]" 'latex-close-block)
(define-key map "\C-c/" 'latex-close-block)
This group is separated from other keybindings with empty lines, so
I'm guessing by default "C-c C-o" inserts block and "C-c C-e" closes
block, the rest (C-c C-t, C-c ], C-c /) are additional shortcuts.
Therefore I think this part of the bug can be "closed".
> 2. When I use 'where-is' on both aliases I get (echo area, 2
> lines):
>
> tex-latex-block is not on any key;
> its alias latex-insert-block is on C-c C-t, C-c C-o
>
> If I'm not mistaken, it says that 'latex-insert-block' is an alias
> for 'tex-latex-block' when it's completely otherwise. So 2nd line
> should rather say:
>
> it's na alias for latex-insert-block, which is on C-c C-t, C-c C-o
AND quoting Eli:
> It sounds like the code which adds aliases treats an alias as a
> symmetric relation. Not sure if this is correct.
You might be right, because e.g. in "hi-lock.el" there is:
(defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer)
After using "where-is" on "hi-lock-line-face-buffer" I get:
hi-lock-line-face-buffer is not on any key;
its alias highlight-lines-matching-regexp is on M-s h l
It seems to be OK, because "highlight-lines-matching-regexp" is an
alias for "hi-lock-line-face-buffer".
But I think this way of handling aliases is wrong. According to the
dictionary alias is a "false name", which means no symmetric relation.
Name B can be false name for Real Name A, but not the other way (going
further Name B can have additional false name in form of Name C etc.).
I hope I didn't mess this up. So while it does the job in example
from "hi-lock.el", it fails in example from "tex-mode.el", which means
the function should be corrected to have 2 strings, current one (its
alias) and perhaps suggested by me - "it's an alias for".
> 2.1. Why the one char indent in 2nd line?
AND quoting Eli:
> As for the extra blank, I think it's a matter of personal preference
> whether it improves the display or makes it worse.
Well, since it indicates (form similar to unordered list) that second
line is "continuation" of information from first line, rather than new
information, it could stay as it is. So this part can be also
"closed".
> 3. In INFO 25.11.2 "LaTeX Editing Commands" for 'C-c C-o' alias
> 'tex-latex-block' is used and for 'C-c C-e' alias
> 'tex-close-latex-block' is used - why not real functions names:
> 'latex-insert-block' and 'latex-close-block'? They would even sound
> better (look at the name of the section).
And this is a bug. In "tex-mode.el", under "tex-mode-map", there is:
(define-key map "\C-c\C-o" 'latex-insert-block)
AND
(define-key map "\C-c\C-e" 'latex-close-block)
In "text.texi", lines 1666, 1669, 1676 and 1691 should be updated.
> 4. And then, after all, are those aliases needed at all?
As I searched through "tex-mode.el", I was able to find them
("tex-close-latex-block" and "tex-latex-block") only where they are
defined as an alias. So if they are not used somewhere outside, maybe
they could be removed?
S. U.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Mon, 04 May 2020 14:49:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 37325 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> 3. In INFO 25.11.2 "LaTeX Editing Commands" for 'C-c C-o' alias
>> 'tex-latex-block' is used and for 'C-c C-e' alias
>> 'tex-close-latex-block' is used - why not real functions names:
>> 'latex-insert-block' and 'latex-close-block'? They would even sound
>> better (look at the name of the section).
>
> And this is a bug. In "tex-mode.el", under "tex-mode-map", there is:
>
> (define-key map "\C-c\C-o" 'latex-insert-block)
> AND
> (define-key map "\C-c\C-e" 'latex-close-block)
>
> In "text.texi", lines 1666, 1669, 1676 and 1691 should be updated.
I'm attaching diff for this, to help a bit.
S. U.
[text.diff (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Thu, 28 May 2020 15:59:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 37325 <at> debbugs.gnu.org (full text, mbox):
A reminder. At least documentation change (point 3.) could be done.
I already sent separate e-mail with DIFF.
S. U.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Sun, 12 Jul 2020 19:22:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 37325 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
So, I tried to write something that would make "where-is" better at
handling aliases. Here is the diff, which, of course, should be
treated as an idea, rather than a patch:
--8<---------------cut here---------------start------------->8---
--- old/help.el 2020-06-26 18:34:05.000000000 +0200
+++ new/help.el 2020-07-12 18:29:29.639145100 +0200
@@ -566,15 +566,20 @@
(if insert
(if (> (length keys) 0)
(if remapped
- (format "%s (%s) (remapped from %s)"
- keys remapped symbol)
- (format "%s (%s)" keys symbol))
+ (format "%s, remapped to %s (%s)"
+ symbol remapped keys)
+ (format "%s (%s)" symbol keys))
(format "M-x %s RET" symbol))
(if (> (length keys) 0)
(if remapped
- (format "%s is remapped to %s which is on %s"
- symbol remapped keys)
- (format "%s is on %s" symbol keys))
+ (if (eq symbol (symbol-function definition))
+ (format "%s, which is remapped to %s, which is on %s"
+ symbol remapped keys)
+ (format "%s is remapped to %s, which is on %s"
+ symbol remapped keys))
+ (if (eq symbol (symbol-function definition))
+ (format "%s, which is on %s" symbol keys)
+ (format "%s is on %s" symbol keys)))
;; If this is the command the user asked about,
;; and it is not on any key, say so.
;; For other symbols, its aliases, say nothing
@@ -583,7 +588,9 @@
(format "%s is not on any key" symbol)))))
(when string
(unless (eq symbol definition)
- (princ ";\n its alias "))
+ (if (eq definition (symbol-function symbol))
+ (princ ";\n its alias ")
+ (princ ";\n it's an alias for ")))
(princ string)))))
nil)
--8<---------------cut here---------------end--------------->8---
The problem is, it doesn't work out of the box, i.e. commands are
described like before changes. I have to evaluate "where-is", by C-x
C-e or byte-compile and load whole help.el, then it works...
Also, if there is:
(defalias 'B 'A)
(defalias 'C 'A)
A... "its alias" B...
A... "its alias" C...
B... "it's an alias for" A...
C... "it's an alias for" A...
What about the relation between B and C?
Can I say B is an alias for C, AND C is an alias for B?
S. U.
P.S. I'm attaching file "examples" - it shows how "where-is" works
after the changes.
[examples.txt (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Fri, 28 Jan 2022 16:14:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 37325 <at> debbugs.gnu.org (full text, mbox):
Sebastian Urban <mrsebastianurban <at> gmail.com> writes:
>> In "text.texi", lines 1666, 1669, 1676 and 1691 should be updated.
>
> I'm attaching diff for this, to help a bit.
Thanks; applied to Emacs 29.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37325
; Package
emacs
.
(Fri, 28 Jan 2022 16:29:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 37325 <at> debbugs.gnu.org (full text, mbox):
Sebastian Urban <mrsebastianurban <at> gmail.com> writes:
> So, I tried to write something that would make "where-is" better at
> handling aliases. Here is the diff, which, of course, should be
> treated as an idea, rather than a patch:
This seems to lead to more correct results, so I've pushed it to Emacs
29.
This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
37325 <at> debbugs.gnu.org and Sebastian Urban <mrsebastianurban <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 28 Jan 2022 16:29:02 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
.
(Sat, 26 Feb 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.