bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37325: About 'latex-insert/close-block' in 'latex-mode'


From: Sebastian Urban
Subject: bug#37325: About 'latex-insert/close-block' in 'latex-mode'
Date: Sun, 12 Jul 2020 21:15:06 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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: examples.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]