* bug#37325: About 'latex-insert/close-block' in 'latex-mode' @ 2019-09-06 17:31 Sebastian Urban 2019-09-07 10:16 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Sebastian Urban @ 2019-09-06 17:31 UTC (permalink / raw) To: 37325 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2019-09-06 17:31 bug#37325: About 'latex-insert/close-block' in 'latex-mode' Sebastian Urban @ 2019-09-07 10:16 ` Eli Zaretskii 2019-09-07 19:15 ` Sebastian Urban 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2019-09-07 10:16 UTC (permalink / raw) To: Sebastian Urban; +Cc: 37325 > From: Sebastian Urban <mrsebastianurban@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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2019-09-07 10:16 ` Eli Zaretskii @ 2019-09-07 19:15 ` Sebastian Urban 2019-09-08 17:08 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Sebastian Urban @ 2019-09-07 19:15 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 37325 > 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2019-09-07 19:15 ` Sebastian Urban @ 2019-09-08 17:08 ` Eli Zaretskii 2020-04-23 12:29 ` Sebastian Urban 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2019-09-08 17:08 UTC (permalink / raw) To: Sebastian Urban; +Cc: 37325 > From: Sebastian Urban <mrsebastianurban@gmail.com> > Cc: 37325@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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2019-09-08 17:08 ` Eli Zaretskii @ 2020-04-23 12:29 ` Sebastian Urban 2020-05-04 14:48 ` Sebastian Urban 2020-05-28 15:58 ` Sebastian Urban 0 siblings, 2 replies; 10+ messages in thread From: Sebastian Urban @ 2020-04-23 12:29 UTC (permalink / raw) To: eliz; +Cc: 37325 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2020-04-23 12:29 ` Sebastian Urban @ 2020-05-04 14:48 ` Sebastian Urban 2020-07-12 19:15 ` Sebastian Urban 2022-01-28 16:12 ` Lars Ingebrigtsen 2020-05-28 15:58 ` Sebastian Urban 1 sibling, 2 replies; 10+ messages in thread From: Sebastian Urban @ 2020-05-04 14:48 UTC (permalink / raw) To: mrsebastianurban; +Cc: 37325 [-- Attachment #1: Type: text/plain, Size: 626 bytes --] >> 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. [-- Attachment #2: text.diff --] [-- Type: text/plain, Size: 1656 bytes --] --- old/text.texi 2020-05-04 16:18:42.920418600 +0200 +++ new/text.texi 2020-05-04 16:37:46.208831200 +0200 @@ -1663,17 +1663,17 @@ @table @kbd @item C-c C-o Insert @samp{\begin} and @samp{\end} for @LaTeX{} block and position -point on a line between them (@code{tex-latex-block}). +point on a line between them (@code{latex-insert-block}). @item C-c C-e Close the innermost @LaTeX{} block not yet closed -(@code{tex-close-latex-block}). +(@code{latex-close-block}). @end table -@findex tex-latex-block +@findex latex-insert-block @kindex C-c C-o @r{(@LaTeX{} mode)} In @LaTeX{} input, @samp{\begin} and @samp{\end} tags are used to group blocks of text. To insert a block, type @kbd{C-c C-o} -(@code{tex-latex-block}). This prompts for a block type, and inserts +(@code{latex-insert-block}). This prompts for a block type, and inserts the appropriate matching @samp{\begin} and @samp{\end} tags, leaving a blank line between the two and moving point there. @@ -1684,11 +1684,11 @@ want additional block types for completion, customize the list variable @code{latex-block-names}. -@findex tex-close-latex-block +@findex latex-close-block @kindex C-c C-e @r{(@LaTeX{} mode)} @findex latex-electric-env-pair-mode In @LaTeX{} input, @samp{\begin} and @samp{\end} tags must balance. -You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to insert an +You can use @kbd{C-c C-e} (@code{latex-close-block}) to insert an @samp{\end} tag which matches the last unmatched @samp{\begin}. It also indents the @samp{\end} to match the corresponding @samp{\begin}, and inserts a newline after the @samp{\end} tag if point is at the ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2020-05-04 14:48 ` Sebastian Urban @ 2020-07-12 19:15 ` Sebastian Urban 2022-01-28 16:28 ` Lars Ingebrigtsen 2022-01-28 16:12 ` Lars Ingebrigtsen 1 sibling, 1 reply; 10+ messages in thread From: Sebastian Urban @ 2020-07-12 19:15 UTC (permalink / raw) To: 37325 [-- Attachment #1: Type: text/plain, Size: 2318 bytes --] 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. [-- Attachment #2: examples.txt --] [-- Type: text/plain, Size: 4266 bytes --] -*- mode: outline -*- * FUN: latex-insert-block | ALIAS: tex-latex-block ** PREFIX & latex-insert-block latex-insert-block (C-c C-t, C-c C-o); its alias M-x tex-latex-block RET ** NO_PREFIX & latex-insert-block latex-insert-block is on C-c C-t, C-c C-o ** PREFIX & tex-latex-block M-x tex-latex-block RET; it's an alias for latex-insert-block (C-c C-t, C-c C-o) ** NO_PREFIX & tex-latex-block tex-latex-block is not on any key; it's an alias for latex-insert-block, which is on C-c C-t, C-c C-o ** REMAP (define-key latex-mode-map [remap latex-insert-block] 'my-l-i-b) *** PREFIX & latex-insert-block latex-insert-block, remapped to my-l-i-b (C-c C-t, C-c C-o); its alias M-x tex-latex-block RET *** NO_PREFIX & latex-insert-block latex-insert-block is remapped to my-l-i-b, which is on C-c C-t, C-c C-o *** PREFIX & tex-latex-block M-x tex-latex-block RET; it's an alias for latex-insert-block, remapped to my-l-i-b (C-c C-t, C-c C-o) *** NO_PREFIX & tex-latex-block tex-latex-block is not on any key; it's an alias for latex-insert-block, which is remapped to my-l-i-b, which is on C-c C-t, C-c C-o * FUN: hi-lock-line-face-buffer | ALIAS: highlight-lines-matching-regexp ** PREFIX & hi-lock-line-face-buffer M-x hi-lock-line-face-buffer RET; its alias highlight-lines-matching-regexp (M-s h l) ** NO_PREFIX & hi-lock-line-face-buffer hi-lock-line-face-buffer is not on any key; its alias highlight-lines-matching-regexp is on M-s h l ** PREFIX & highlight-lines-matching-regexp highlight-lines-matching-regexp (M-s h l); it's an alias for M-x hi-lock-line-face-buffer RET ** NO_PREFIX & highlight-lines-matching-regexp highlight-lines-matching-regexp is on M-s h l * FUN: help-for-help-internal | ALIAS: help | ALIAS: help-for-help ** PREFIX & help-for-help-internal M-x help-for-help-internal RET; its alias M-x help RET; its alias help-for-help (C-h ?, C-h <f1>, C-h <help>, C-h C-h, <f1> ?, <f1> <f1>, <f1> <help>, <f1> C-h, <help> ?, <help> <f1>, <help> <help>, <help> C-h) ** NO_PREFIX & help-for-help-internal help-for-help-internal is not on any key; its alias help-for-help is on C-h ?, C-h <f1>, C-h <help>, C-h C-h, <f1> ?, <f1> <f1>, <f1> <help>, <f1> C-h, <help> ?, <help> <f1>, <help> <help>, <help> C-h ** PREFIX & help-for-help help-for-help (C-h ?, C-h <f1>, C-h <help>, C-h C-h, <f1> ?, <f1> <f1>, <f1> <help>, <f1> C-h, <help> ?, <help> <f1>, <help> <help>, <help> C-h); it's an alias for M-x help RET; it's an alias for M-x help-for-help-internal RET ** NO_PREFIX & help-for-help help-for-help is on C-h ?, C-h <f1>, C-h <help>, C-h C-h, <f1> ?, <f1> <f1>, <f1> <help>, <f1> C-h, <help> ?, <help> <f1>, <help> <help>, <help> C-h * FUN: move-end-of-line | ALIAS: test-move-eol | REMAP to end-of-visual-line TMP ALIAS: (defalias 'test-move-eol 'move-end-of-line) TMP BIND: M-x global-set-key RET C-c <right> RET test-move-eol RET ** PREFIX & move-end-of-line move-end-of-line, remapped to end-of-visual-line (C-e, <end>); its alias M-x test-move-eol RET *** With binding for test-move-eol move-end-of-line, remapped to end-of-visual-line (C-e, <end>); its alias test-move-eol (C-c <right>) ** NO_PREFIX & move-end-of-line move-end-of-line is remapped to end-of-visual-line, which is on C-e, <end> *** With binding for test-move-eol move-end-of-line is remapped to end-of-visual-line, which is on C-e, <end>; its alias test-move-eol is on C-c <right> ** PREFIX & end-of-visual-line end-of-visual-line (C-e, <end>) ** NO_PREFIX & end-of-visual-line end-of-visual-line is on C-e, <end> ** PREFIX & test-move-eol M-x test-move-eol RET; it's an alias for move-end-of-line, remapped to end-of-visual-line (C-e, <end>) *** With binding for test-move-eol test-move-eol (C-c <right>); it's an alias for move-end-of-line, remapped to end-of-visual-line (C-e, <end>) ** NO_PREFIX & test-move-eol test-move-eol is not on any key; it's an alias for move-end-of-line, which is remapped to end-of-visual-line, which is on C-e, <end> *** With binding for test-move-eol test-move-eol is on C-c <right>; it's an alias for move-end-of-line, which is remapped to end-of-visual-line, which is on C-e, <end> ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2020-07-12 19:15 ` Sebastian Urban @ 2022-01-28 16:28 ` Lars Ingebrigtsen 0 siblings, 0 replies; 10+ messages in thread From: Lars Ingebrigtsen @ 2022-01-28 16:28 UTC (permalink / raw) To: Sebastian Urban; +Cc: 37325 Sebastian Urban <mrsebastianurban@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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2020-05-04 14:48 ` Sebastian Urban 2020-07-12 19:15 ` Sebastian Urban @ 2022-01-28 16:12 ` Lars Ingebrigtsen 1 sibling, 0 replies; 10+ messages in thread From: Lars Ingebrigtsen @ 2022-01-28 16:12 UTC (permalink / raw) To: Sebastian Urban; +Cc: 37325 Sebastian Urban <mrsebastianurban@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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#37325: About 'latex-insert/close-block' in 'latex-mode' 2020-04-23 12:29 ` Sebastian Urban 2020-05-04 14:48 ` Sebastian Urban @ 2020-05-28 15:58 ` Sebastian Urban 1 sibling, 0 replies; 10+ messages in thread From: Sebastian Urban @ 2020-05-28 15:58 UTC (permalink / raw) To: eliz; +Cc: 37325 A reminder. At least documentation change (point 3.) could be done. I already sent separate e-mail with DIFF. S. U. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-01-28 16:28 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-09-06 17:31 bug#37325: About 'latex-insert/close-block' in 'latex-mode' Sebastian Urban 2019-09-07 10:16 ` Eli Zaretskii 2019-09-07 19:15 ` Sebastian Urban 2019-09-08 17:08 ` Eli Zaretskii 2020-04-23 12:29 ` Sebastian Urban 2020-05-04 14:48 ` Sebastian Urban 2020-07-12 19:15 ` Sebastian Urban 2022-01-28 16:28 ` Lars Ingebrigtsen 2022-01-28 16:12 ` Lars Ingebrigtsen 2020-05-28 15:58 ` Sebastian Urban
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.