auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex e625dc05ea 01/60: Improve keymap


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex e625dc05ea 01/60: Improve keymap handling
Date: Fri, 8 Apr 2022 11:52:45 -0400 (EDT)

branch: externals/auctex
commit e625dc05ea31846ee0aaffde7104602bea22b581
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Improve keymap handling
    
    * latex.el (LaTeX-mode-map):
    (LaTeX-common-initialization):
    * tex.el (VirTeX-common-initialization):
    (TeX-mode-map):
    Bind narrowing command just once.
    * latex.el (LaTeX-mode-map,LaTeX-common-initialization): Use
    `beginning-of-defun-function' and `end-of-defun-function' instead of
    overriding bindings of C-M-a and C-M-e.
    * preview.el.in (preview-mode-setup):
    (LaTeX-preview-setup):
    Bind preview tool button just once.
---
 latex.el      | 13 +++++++++----
 preview.el.in | 16 ++++++++--------
 tex.el        |  4 ++--
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/latex.el b/latex.el
index 06627c4bdb..27c865a420 100644
--- a/latex.el
+++ b/latex.el
@@ -6000,8 +6000,10 @@ environments."
     ;; (define-key map "\eq"     'LaTeX-fill-paragraph) ;*** Alias
     ;; This key is now used by Emacs for face settings.
     ;; (define-key map "\eg"     'LaTeX-fill-region) ;*** Alias
-    (define-key map "\e\C-e"  #'LaTeX-find-matching-end)
-    (define-key map "\e\C-a"  #'LaTeX-find-matching-begin)
+    ;; We now set `beginning-of-defun-function' and
+    ;; `end-of-defun-function' instead.
+    ;; (define-key map "\e\C-e"  #'LaTeX-find-matching-end)
+    ;; (define-key map "\e\C-a"  #'LaTeX-find-matching-begin)
 
     (define-key map "\C-c\C-q\C-p" #'LaTeX-fill-paragraph)
     (define-key map "\C-c\C-q\C-r" #'LaTeX-fill-region)
@@ -6027,6 +6029,8 @@ environments."
     (define-key map "(" #'LaTeX-insert-left-brace)
     (define-key map "{" #'LaTeX-insert-left-brace)
     (define-key map "[" #'LaTeX-insert-left-brace)
+
+    (define-key map "\C-xne" #'LaTeX-narrow-to-environment)
     map)
   "Keymap used in `LaTeX-mode'.")
 
@@ -7047,6 +7051,9 @@ function would return non-nil and `(match-string 1)' 
would return
   (set (make-local-variable 'TeX-search-files-type-alist)
        LaTeX-search-files-type-alist)
 
+  (setq-local beginning-of-defun-function #'LaTeX-find-matching-begin
+              end-of-defun-function       #'LaTeX-find-matching-end)
+
   (set (make-local-variable 'LaTeX-item-list) '(("description" . 
LaTeX-item-argument)
                                                 ("thebibliography" . 
LaTeX-item-bib)
                                                 ("array" . LaTeX-item-array)
@@ -7654,8 +7661,6 @@ function would return non-nil and `(match-string 1)' 
would return
 
   (use-local-map LaTeX-mode-map)
 
-  (define-key LaTeX-mode-map "\C-xne" #'LaTeX-narrow-to-environment)
-
   ;; Initialization of `add-log-current-defun-function':
   (set (make-local-variable 'add-log-current-defun-function)
        #'TeX-current-defun-name)
diff --git a/preview.el.in b/preview.el.in
index 9dda6582aa..70c9798830 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -3062,14 +3062,6 @@ pp")
        #'desktop-buffer-preview-misc-data)
   (add-hook 'pre-command-hook #'preview-mark-point nil t)
   (add-hook 'post-command-hook #'preview-move-point nil t)
-  (unless preview-tb-icon
-    (setq preview-tb-icon (preview-filter-specs preview-tb-icon-specs)))
-  (when preview-tb-icon
-    (define-key LaTeX-mode-map [tool-bar preview]
-      `(menu-item "Preview at point" preview-at-point
-                  :image ,preview-tb-icon
-                  :help "Preview on/off at point"
-                  :vert-only t)))
   (when buffer-file-name
     (let* ((filename (expand-file-name buffer-file-name))
            format-cons)
@@ -3127,6 +3119,14 @@ to add the preview functionality."
         ["Report Bug" preview-report-bug]))
     (if (eq major-mode 'latex-mode)
         (preview-mode-setup))
+    (unless preview-tb-icon
+      (setq preview-tb-icon (preview-filter-specs preview-tb-icon-specs)))
+    (when preview-tb-icon
+      (define-key LaTeX-mode-map [tool-bar preview]
+        `(menu-item "Preview at point" preview-at-point
+                    :image ,preview-tb-icon
+                    :help "Preview on/off at point"
+                    :vert-only t)))
     (if (boundp 'desktop-buffer-misc)
         (preview-buffer-restore desktop-buffer-misc))))
 
diff --git a/tex.el b/tex.el
index e3f4d118e7..eeca1aecae 100644
--- a/tex.el
+++ b/tex.el
@@ -3809,8 +3809,6 @@ The algorithm is as follows:
   ;; we enter TeX mode the first time.
   (add-hook 'write-contents-functions #'TeX-safe-auto-write nil t)
 
-  (define-key TeX-mode-map "\C-xng" #'TeX-narrow-to-group)
-
   ;; Minor modes
   (when TeX-source-correlate-mode
     (TeX-source-correlate-mode 1))
@@ -5024,6 +5022,8 @@ 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)
     map)
   "Keymap for common TeX and LaTeX commands.")
 




reply via email to

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