branch: feature/fix-mode-names-overlap
commit c12eba0ba214b5371abef1aee2f6898ad4c17ba7
Author: Ikumi Keita <ik...@ikumi.que.jp>
Commit: Ikumi Keita <ik...@ikumi.que.jp>

    Adjust menu
    
    * tex-jp.el (japanese-plain-TeX-mode-map, japanese-LaTeX-mode-map):
    Use [remap] in keymap instead of :override advice.
    * tex-info.el (Texinfo-mode-map):
    * tex.el (TeX-mode-map):
    Hide "Text" menu entry inherited from text mode
---
 tex-info.el | 3 +++
 tex-jp.el   | 4 +++-
 tex.el      | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tex-info.el b/tex-info.el
index 912ffc66..390524ca 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -546,6 +546,9 @@ is assumed by default."
     (define-key map "\\" #'self-insert-command)
     ;; Users benefit from `TeX-electric-macro' even in Texinfo mode
     (define-key map "@" #'TeX-insert-backslash)
+
+    ;; Hide "Text" menu entry inherited from text mode.
+    (define-key map [menu-bar text] #'undefined)
     map)
   "Keymap for Texinfo mode.")
 
diff --git a/tex-jp.el b/tex-jp.el
index 1d411750..ff562e22 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -512,7 +512,9 @@ overwrite the value already set locally."
   (if (TeX-looking-at-backward "\\\\/\\(}+\\)" 50)
       (replace-match "\\1" t))
   (call-interactively #'japanese-TeX-self-insert-command))
-(advice-add 'TeX-insert-punctuation :override
+(define-key japanese-plain-TeX-mode-map [remap TeX-insert-punctuation]
+            #'japanese-TeX-insert-punctuation)
+(define-key japanese-LaTeX-mode-map [remap TeX-insert-punctuation]
             #'japanese-TeX-insert-punctuation)
 
 ;;; Error Messages
diff --git a/tex.el b/tex.el
index 7ce968d8..13635f61 100644
--- a/tex.el
+++ b/tex.el
@@ -5085,7 +5085,10 @@ Brace insertion is only done if point is in a math 
construct and
     ;; Multifile
     (define-key map "\C-c_" #'TeX-master-file-ask)  ;*** temporary
 
-    (define-key map "\C-xng" #'TeX-narrow-to-group)))
+    (define-key map "\C-xng" #'TeX-narrow-to-group)
+
+    ;; Hide "Text" menu entry inherited from text mode.
+    (define-key map [menu-bar text] #'undefined)))
 
 (defun TeX-mode-specific-command-menu (mode)
   "Return a Command menu specific to the major MODE."

Reply via email to