emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex bd21b34 17/43: Remove code for compatibility wit


From: Tassilo Horn
Subject: [elpa] externals/auctex bd21b34 17/43: Remove code for compatibility with very old emacsens in bib-cite.el
Date: Tue, 20 Mar 2018 11:34:08 -0400 (EDT)

branch: externals/auctex
commit bd21b34ecb22bafbd93eb18c8dc83204e17f670a
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>

    Remove code for compatibility with very old emacsens in bib-cite.el
    
    * bib-cite.el (bib-cite-minor-mode):
    (bib-cite-setup-highlight-mouse-keymap):
    (bib-cite-fontify-help-as-bibtex):
    (bib-cite-fontify-help-as-latex):
    (bib-etags):
    (bib-highlight-mouse):
    (bib-toggle-highlight):
    (bib-guess-or-prompt-for-label):
    (bib-etags-find-noselect): Remove compatibility code.
---
 bib-cite.el | 264 +++++++++++-------------------------------------------------
 1 file changed, 45 insertions(+), 219 deletions(-)

diff --git a/bib-cite.el b/bib-cite.el
index 0ff47fb..0be0eb0 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -759,32 +759,17 @@ runs bib-find, and [mouse-3] runs bib-display."
        (progn
          (bib-cite-setup-highlight-mouse-keymap)
          (bib-highlight-mouse)
-         (when (featurep 'xemacs)
-           (make-local-hook 'after-change-functions))
          (add-hook 'after-change-functions
-                   'bib-cite-setup-mouse-function nil t)))
-    (if (featurep 'xemacs)
-       (progn
-         (or (local-variable-p 'current-menubar (current-buffer))
-             (set-buffer-menubar current-menubar))
-         (add-submenu nil bib-cite-minor-mode-menu))))
+                   'bib-cite-setup-mouse-function nil t))))
    (t
    ;;;Undo the minor-mode
     ;; mouse overlay
-    (cond
-     ((featurep 'xemacs)
-      (while bib-ext-list
-       (delete-extent (car bib-ext-list))
-       (setq bib-ext-list (cdr bib-ext-list))))
-     (t
-      (remove-hook 'after-change-functions 'bib-cite-setup-mouse-function t)
-      (let ((before-change-functions) (after-change-functions))
-       ;; FIXME This detroys all mouse-faces and local-maps!
-       ;; FIXME Hope no other package is using them in this buffer!
-       (remove-text-properties (point-min) (point-max)
-                               '(mouse-face t local-map t)))))
-    (if (featurep 'xemacs)
-       (delete-menu-item '("BCite"))))))
+    (remove-hook 'after-change-functions 'bib-cite-setup-mouse-function t)
+    (let ((before-change-functions) (after-change-functions))
+      ;; FIXME This detroys all mouse-faces and local-maps!
+      ;; FIXME Hope no other package is using them in this buffer!
+      (remove-text-properties (point-min) (point-max)
+                             '(mouse-face t local-map t))))))
 
 ;;This must be eval'ed when the LaTeX mode is in use.
 ;; bib-highlight-mouse-keymap is a local variable so each buffer can have it's
@@ -799,46 +784,22 @@ runs bib-find, and [mouse-3] runs bib-display."
    ;;;        menus to display.  Maybe on `highlighted' commands we could only
    ;;;        display the bib-cite stuff (or a subset of it).
        (let ((m (copy-keymap (current-local-map))))
+         ;; emacs 19
          (cond
-          ((featurep 'xemacs)
-           (set-keymap-name m 'bib-highlight-mouse-keymap)
-           (cond
-            ;;action-key stuff from Vladimir Alexiev <address@hidden>
-            ((commandp 'action-key)
-             ;; for hyperbole. The Right Way is to define implicit buttons
-             ;; (defib) bib-cite and label-ref instead of overriding
-             ;; action-key and assist key, so that eg smart key help can
-             ;; be obtained, but I'm lazy.
-             (substitute-key-definition 'action-key 'bib-find m global-map)
-             (substitute-key-definition 'assist-key 'bib-display m global-map)
-             (substitute-key-definition 'action-key-depress
-                                        'bib-find-mouse m global-map)
-             (substitute-key-definition 'assist-key-depress
-                                        'bib-display-mouse m global-map)
-             (substitute-key-definition 'action-mouse-key nil m global-map)
-             (substitute-key-definition 'assist-mouse-key nil m global-map))
-            (t                               ; xemacs, not hyperbole
-             (define-key m "\e\r" 'bib-find-mouse) ;   bug Fixed in V2.17
-             (define-key m "\e\n" 'bib-display-mouse) ;bug Fixed in V2.17
-             ;;(define-key m [(shift button1)] 'bib-display-mouse)
-             (define-key m [button3] 'bib-display-mouse)
-             (define-key m [button2] 'bib-find-mouse))))
-           (t                                 ; emacs 19
-            (cond
-             ((commandp 'action-key)
-              (substitute-key-definition 'action-key 'bib-find m global-map)
-              (substitute-key-definition 'assist-key 'bib-display m global-map)
-              (substitute-key-definition 'action-mouse-key-emacs19
-                                         'bib-find-mouse m global-map)
-              (substitute-key-definition 'assist-mouse-key-emacs19
-                                         'bib-display-mouse m global-map)
-              (substitute-key-definition 'action-key-depress-emacs19
-                                         nil m global-map)
-              (substitute-key-definition 'assist-key-depress-emacs19
-                                         nil m global-map))
-             (t                               ; emacs 19, not hyperbole
-              (define-key m [down-mouse-3] 'bib-display-mouse)
-              (define-key m [mouse-2] 'bib-find-mouse)))))
+          ((commandp 'action-key)
+           (substitute-key-definition 'action-key 'bib-find m global-map)
+           (substitute-key-definition 'assist-key 'bib-display m global-map)
+           (substitute-key-definition 'action-mouse-key-emacs19
+                                      'bib-find-mouse m global-map)
+           (substitute-key-definition 'assist-mouse-key-emacs19
+                                      'bib-display-mouse m global-map)
+           (substitute-key-definition 'action-key-depress-emacs19
+                                      nil m global-map)
+           (substitute-key-definition 'assist-key-depress-emacs19
+                                      nil m global-map))
+          (t                               ; emacs 19, not hyperbole
+           (define-key m [down-mouse-3] 'bib-display-mouse)
+           (define-key m [mouse-2] 'bib-find-mouse)))
          m)))
 
 ;;;###autoload
@@ -888,83 +849,6 @@ runs bib-find, and [mouse-3] runs bib-display."
                minor-mode-map-alist)))
 
 
-;;; Add a menu entry to bibtex.el (Perhaps I should not do this).
-(cond
- ((and (featurep 'xemacs)
-       (or window-system
-          (fboundp 'smart-menu)))      ;text menus by Bob Weiner
-  ;;
-  ;; xemacs under X with AUCTeX
-  ;;
-
-  ;; Add to bibtex.el's popup menu
-  (defvar bib-cite-xemacs-bibtex-mode-menu
-    '("---"
-      "Bib-Cite"
-      "---"
-      ["Search apropos BibTeX files" bib-apropos t]
-      ["Create AUCTeX auto parsing file" bib-create-auto-file t])
-    "Submenu of bibtex-mode menu, used by bib-cite.")
-
-  (if (boundp 'bibtex-menu)
-      ;; Add menu now
-      (setq bibtex-menu
-           (append
-            bibtex-menu
-            bib-cite-xemacs-bibtex-mode-menu))
-    ;; Setup to add menu later
-    (defun bib-cite-bibtex-mode-hook ()
-      (if (boundp 'bibtex-menu)
-         (progn
-           (setq bibtex-menu
-                 (append
-                  bibtex-menu
-                  bib-cite-xemacs-bibtex-mode-menu))
-           (remove-hook 'bibtex-mode-hook 'bib-cite-bibtex-mode-hook))))
-    (add-hook 'bibtex-mode-hook 'bib-cite-bibtex-mode-hook))
-  )
-
- ((and (not (featurep 'xemacs))
-       (string-equal "19" (substring emacs-version 0 2))
-       (or window-system
-          (fboundp 'tmm-menubar)))     ; 19.30 - Will autoload if necessary
-  ;;
-  ;; emacs-19 under X-windows (or non-X with tmm)
-  ;;
-
-  ;; This *almost* makes me want to switch over to XEmacs...
-
-  ;; to AUCTeX auto file for a bibtex buffer
-  (eval-after-load
-   "bibtex"
-   '(progn
-      (add-hook 'bibtex-mode-hook 'TeX-bibtex-set-BibTeX-dialect)
-      (cond
-       ((lookup-key bibtex-mode-map [menu-bar move/edit])
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar move/edit])
-         [bib-nil] '("---" . nil) '"--")
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar move/edit])
-         [bib-apropos] '("Search Apropos" . bib-apropos) 'bib-nil)
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar move/edit])
-         [auc-tex-parse]
-         '("Create AUCTeX auto parsing file" . bib-create-auto-file)
-         'bib-apropos))
-       ((lookup-key bibtex-mode-map [menu-bar bibtex-edit])
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar bibtex-edit])
-         [bib-nil] '("---" . nil) '"--")
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar bibtex-edit])
-         [bib-apropos] '("Search Apropos" . bib-apropos) 'bib-nil)
-       (define-key-after
-         (lookup-key bibtex-mode-map [menu-bar bibtex-edit])
-         [auc-tex-parse]
-         '("Create AUCTeX auto parsing file" . bib-create-auto-file)
-         'bib-apropos)))))))
-
 ;; Following from bibtex.el
 (defvar
   bib-cite-bibtex-font-lock-keywords
@@ -1227,19 +1111,6 @@ to create a bibtex file containing only the references 
used in the document."
       (put-text-property (point-min)(or limit (point-max))
                         'face 'red-bold))))
 
-(when (featurep 'xemacs)
-  (defun bib-cite-fontify-help-xemacs (defaults)
-    (if (fboundp 'font-lock-set-defaults-1) ; >= XEmacs 19.14
-        (with-current-buffer "*Help*"
-          (setq font-lock-defaults-computed nil
-                font-lock-keywords nil)
-          (font-lock-set-defaults-1
-           (and defaults (font-lock-find-font-lock-defaults defaults)))
-          (font-lock-fontify-buffer)
-          (setq font-lock-defaults-computed nil
-                font-lock-keywords nil)
-          (font-lock-set-defaults-1)))))
-
 (defun bib-cite--fontify-help ()
   ;; FIXME: This looks ugly and incorrect.
   (if font-lock-mode
@@ -1254,10 +1125,6 @@ to create a bibtex file containing only the references 
used in the document."
   (cond
    ((not (featurep 'font-lock))
     nil)                                ;No font-lock! Stop here.
-   ;; font-lock under Emacs and XEmacs
-   ((featurep 'xemacs)
-    ;; XEmacs
-    (bib-cite-fontify-help-xemacs 'bibtex-mode))
    (t
     ;; Emacs
     (with-current-buffer "*Help*"
@@ -1270,11 +1137,6 @@ to create a bibtex file containing only the references 
used in the document."
   (cond
    ((not (featurep 'font-lock))
     nil)                                ;No font-lock! Stop here.
-   ;; font-lock under Emacs and XEmacs
-   ((featurep 'xemacs)
-    ;; XEmacs, not necessary to do s.th. special for font-latex, we do *not*
-    ;; want the buffer-local faces!
-    (bib-cite-fontify-help-xemacs 'latex-mode))
    (t
     ;; Emacs
     (with-current-buffer "*Help*"
@@ -1337,9 +1199,8 @@ See variables bib-etags-command and bib-etags-filename"
     ;;  buffer and returns an error because TAGS buffer does have
     ;;  tags-file-name set.
     ;;  To get around this.  I'm setting this variable in the TAGS buffer.
-    ;; Skip this in XEmacs (Changed by Anders Stenman)
-    (if (and (not (featurep 'xemacs))
-            (get-file-buffer the-tags-file))
+    ;; (Changed by Anders Stenman)
+    (if (get-file-buffer the-tags-file)
        (with-current-buffer (get-file-buffer the-tags-file)
          (set (make-local-variable 'tags-file-name) the-tags-file))))
 
@@ -1381,21 +1242,12 @@ See variables bib-etags-command and bib-etags-filename"
       ;; * peta Wed Nov  8 16:27:29 1995 -- better remove the mouse face
       ;;   properties first.
       (setq bib-ext-list nil)          ;Reconstructed below...
-      (if (featurep 'xemacs)
-         (while local-extent-list
-           (setq extent (car local-extent-list))
-           (if (or (extent-detached-p extent)
-                   (and (<= (point-min)(extent-start-position extent))
-                        (>= (point-max)(extent-end-position extent))))
-               (delete-extent extent)
-             (setq bib-ext-list (cons extent bib-ext-list)))
-           (setq local-extent-list (cdr local-extent-list)))
-       ;; Remove properties for regular emacs
-       ;; FIXME This detroys all mouse-faces and local-maps!
-       ;; FIXME Hope no other package is using them in this buffer!
-       (let ((before-change-functions) (after-change-functions))
-         (remove-text-properties (point-min) (point-max)
-                                 '(mouse-face t local-map t))))
+      ;; Remove properties for regular emacs
+      ;; FIXME This detroys all mouse-faces and local-maps!
+      ;; FIXME Hope no other package is using them in this buffer!
+      (let ((before-change-functions) (after-change-functions))
+       (remove-text-properties (point-min) (point-max)
+                               '(mouse-face t local-map t)))
       (goto-char (point-min))
       (while
          (re-search-forward
@@ -1405,29 +1257,19 @@ See variables bib-etags-command and bib-etags-filename"
           nil t)
        (setq s (match-beginning 0))
        (setq e (match-end 0))
-       (cond
-        ((featurep 'xemacs)
-         (setq extent (make-extent s e))
-         (setq bib-ext-list (cons extent bib-ext-list))
-         (set-extent-property extent 'highlight t)
-         (set-extent-property extent 'start-open t)
-         (set-extent-property extent 'balloon-help 'bib-label-help)
-         (set-extent-property extent 'help-echo 'bib-label-help-echo)
-         (set-extent-property extent 'keymap bib-highlight-mouse-keymap))
-        (t
-         (let ((before-change-functions) (after-change-functions)
-               ;;(this-overlay (make-overlay s e))
-               )
+       (let ((before-change-functions) (after-change-functions)
+             ;;(this-overlay (make-overlay s e))
+             )
 ;;;  Even using overlays doesn't help here.  If bib-highlight-mouse-keymap
 ;;;  does not include the AucTeX menus, then these disappear when we click
 ;;;  onto a \cite command.  Perhaps using bib-cite as a minor mode will fix
 ;;;  this?  For now, bib-cite must be loaded after these menus are built.
 ;;;  It must therefore be loaded in a mode-hook.
-           (put-text-property s e 'local-map bib-highlight-mouse-keymap)
-           (put-text-property s e 'mouse-face 'highlight)
+         (put-text-property s e 'local-map bib-highlight-mouse-keymap)
+         (put-text-property s e 'mouse-face 'highlight)
          ;;(overlay-put this-overlay 'local-map bib-highlight-mouse-keymap)
          ;;(overlay-put this-overlay 'mouse-face 'highlight)
-           ))))
+         ))
       (set-buffer-modified-p modified))))
 
 (defun bib-toggle-highlight ()
@@ -1438,15 +1280,9 @@ See variables bib-etags-command and bib-etags-filename"
       (bib-highlight-mouse)
     (let ((modified (buffer-modified-p))
          (inhibit-read-only t))
-      (cond
-       ((featurep 'xemacs)
-       (while bib-ext-list
-         (delete-extent (car bib-ext-list))
-         (setq bib-ext-list (cdr bib-ext-list))))
-       (t
-       (let ((before-change-functions) (after-change-functions))
-         (remove-text-properties (point-min) (point-max)
-                                 '(mouse-face local-map)))))
+      (let ((before-change-functions) (after-change-functions))
+       (remove-text-properties (point-min) (point-max)
+                               '(mouse-face local-map)))
       (set-buffer-modified-p modified))))
 
 (defun bib-label-help-echo (object)
@@ -1676,17 +1512,13 @@ If within a multi-file document (in auctex only)
        ;;;  '(("label3" "label4")("label1" "label2") nil)
        ;; so let's get rid of that nil part in embedded list.
             (the-name
-             (if (string-equal "18" (substring emacs-version 0 2))
-                 (completing-read "Label: " the-alist nil nil nil)
-               (completing-read "Label: " the-alist nil nil nil
-                                'LaTeX-find-label-hist-alist))))
+             (completing-read "Label: " the-alist nil nil nil
+                              'LaTeX-find-label-hist-alist)))
        (if (not (equal the-name ""))
            (concat "\\\\label{" (regexp-quote the-name) "}")
          ;; else try to get a \ref
-         (if (string-equal "18" (substring emacs-version 0 2))
-             (setq the-name (completing-read "Ref: " the-alist nil nil nil))
-           (setq the-name (completing-read "Ref: " the-alist nil nil nil
-                                           'LaTeX-find-label-hist-alist)))
+         (setq the-name (completing-read "Ref: " the-alist nil nil nil
+                                         'LaTeX-find-label-hist-alist))
          (if (not (equal the-name ""))
              (concat bib-ref-regexpc (regexp-quote the-name) "}")
            nil)))))))
@@ -2296,15 +2128,9 @@ Makes sure TAGS file exists, etc."
        (visit-tags-table the-tags-file-name))
     ;; find-tag-noselect should set the TAGS file for the new buffer
     ;; that's what C-h f visit-tags-table says...
-    (cond
-     ((featurep 'xemacs)
-      (find-tag tag)
-      (setq new-buffer (current-buffer))
-      (set-buffer the-buffer))
-     (t
-      (setq new-buffer (find-tag-noselect tag nil t))
+    (setq new-buffer (find-tag-noselect tag nil t))
                                        ; -> Seems to set buffer to TAGS
-      (set-buffer the-buffer)))
+    (set-buffer the-buffer)
     new-buffer))
 
 ;; --------------------------------------------------------------------------



reply via email to

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