emacs-diffs
[Top][All Lists]
Advanced

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

master 8d7a7c1 1/9: Remove XEmacs compat code from idlwave.el


From: Lars Ingebrigtsen
Subject: master 8d7a7c1 1/9: Remove XEmacs compat code from idlwave.el
Date: Tue, 18 Aug 2020 06:12:37 -0400 (EDT)

branch: master
commit 8d7a7c16a8627295267a5021b14ecd631a339d5f
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Remove XEmacs compat code from idlwave.el
    
    idlwave.el: (idlwave-comment-line-start-skip, idlwave-mode-map)
    (idlwave-mode, idlwave-get-buffer-visiting)
    (idlwave-find-file-noselect, idlwave-complete-in-buffer)
    (idlwave-attach-classes, idlwave-popup-select)
    (idlwave-split-menu-emacs, idlwave-display-completion-list)
    (idlwave-default-choose-completion)
    (idlwave-display-completion-list-emacs)
    (idlwave-display-completion-list-1)
    (idlwave-make-modified-completion-map-emacs)
    (idlwave-class-file-or-buffer, idlwave-rinfo-mouse-map)
    (idlwave-display-calling-sequence)
    (idlwave-insert-source-location)
    (idlwave-list-load-path-shadows, idlwave-edit-in-idlde): Remove
    XEmacs compat code.
---
 lisp/progmodes/idlwave.el | 190 ++++++++--------------------------------------
 1 file changed, 33 insertions(+), 157 deletions(-)

diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index ab820d5..153f257 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -581,12 +581,7 @@ like this:
 MyMethod <Class1,Class2,Class3>
 
 The value of this variable may be nil to inhibit display, or an integer to
-indicate the maximum number of classes to display.
-
-On XEmacs, a full list of classes will also be placed into a `help-echo'
-property on the completion items, so that the list of classes for the current
-item is displayed in the echo area.  If the value of this variable is a
-negative integer, the `help-echo' property will be suppressed."
+indicate the maximum number of classes to display."
   :group 'idlwave-completion
   :type '(choice (const :tag "Don't show" nil)
                 (integer :tag "Number of classes shown" 1)))
@@ -1054,7 +1049,6 @@ goto                 Goto Statements
 common-blocks        Common Blocks
 keyword-parameters   Keyword Parameters in routine definitions and calls
 system-variables     System Variables
-fixme                FIXME: Warning in comments (on XEmacs only v. 21.0 and up)
 class-arrows         Object Arrows with class property"
   :group 'idlwave-misc
   :type '(set
@@ -1069,7 +1063,6 @@ class-arrows         Object Arrows with class property"
          (const :tag "Common Blocks"                     common-blocks)
          (const :tag "Keyword Parameters"                keyword-parameters)
          (const :tag "System Variables"                  system-variables)
-         (const :tag "FIXME: Warning"                    fixme)
          (const :tag "Object Arrows with class property " class-arrows)))
 
 (defcustom idlwave-mode-hook nil
@@ -1138,23 +1131,16 @@ As a user, you should not set this to t.")
        ;; Common blocks
        (common-blocks
        '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?"
-         (1 font-lock-keyword-face)              ; "common"
-         (2 font-lock-constant-face nil t)      ; block name
+         (1 font-lock-keyword-face)        ; "common"
+         (2 font-lock-constant-face nil t) ; block name
          ("[ \t]*\\(\\sw+\\)[ ,]*"
           ;; Start with point after block name and comma
-          (goto-char (match-end 0))  ; needed for XEmacs, could be nil
-          nil
-          (1 font-lock-variable-name-face)       ; variable names
-          )))
+          nil nil (1 font-lock-variable-name-face))))       ; variable names
 
        ;; Batch files
        (batch-files
        '("^[ \t]*\\(@[^ \t\n]+\\)" (1 font-lock-string-face)))
 
-       ;; FIXME warning.
-       (fixme
-       '("\\<FIXME:" (0 font-lock-warning-face t)))
-
        ;; Labels
        (label
        '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-constant-face)))
@@ -1241,9 +1227,6 @@ As a user, you should not set this to t.")
     ((?$ . "w") (?_ . "w") (?. . "w") (?| . "w") (?& . "w"))
     beginning-of-line))
 
-(put 'idlwave-mode 'font-lock-defaults
-     idlwave-font-lock-defaults) ; XEmacs
-
 (defconst idlwave-comment-line-start-skip "^[ \t]*;"
   "Regexp to match the start of a full-line comment.
 That is the _beginning_ of a line containing a comment delimiter `;' preceded
@@ -1479,9 +1462,7 @@ Otherwise ARGS forms a list that is evaluated."
     (define-key map "\M-\C-i" 'idlwave-complete)
     (define-key map "\C-c\C-i" 'idlwave-update-routine-info)
     (define-key map "\C-c="    'idlwave-resolve)
-    (define-key map
-      (if (featurep 'xemacs) [(shift button3)] [(shift mouse-3)])
-      'idlwave-mouse-context-help)
+    (define-key map [(shift mouse-3)] 'idlwave-mouse-context-help)
     map)
   "Keymap used in IDL mode.")
 
@@ -1916,8 +1897,6 @@ The main features of this mode are
       (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS")))
 
   ;; Font-lock additions
-  ;; Following line is for Emacs - XEmacs uses the corresponding property
-  ;; on the `idlwave-mode' symbol.
   (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
   (set (make-local-variable 'font-lock-mark-block-function)
        'idlwave-mark-subprogram)
@@ -3814,15 +3793,8 @@ If PATTERN is omitted, it defaults to \"[ 
\\f\\t\\n\\r\\v]+\"."
       (setq start (match-end 0)))
     (setq ret_string (concat ret_string (substring string start last)))))
 
-(defun idlwave-get-buffer-visiting (file)
-  ;; Return the buffer currently visiting FILE
-  (cond
-   ((boundp 'find-file-compare-truenames) ; XEmacs
-    (let ((find-file-compare-truenames t))
-      (get-file-buffer file)))
-   ((fboundp 'find-buffer-visiting)       ; Emacs
-    (find-buffer-visiting file))
-   (t (error "This should not happen (idlwave-get-buffer-visiting)"))))
+(define-obsolete-function-alias 'idlwave-get-buffer-visiting
+  #'find-buffer-visiting "28.1")
 
 (defvar idlwave-outlawed-buffers nil
   "List of buffers pulled up by IDLWAVE for special reasons.
@@ -3830,7 +3802,7 @@ Buffers in this list may be killed by 
`idlwave-kill-autoloaded-buffers'.")
 
 (defun idlwave-find-file-noselect (file &optional why)
   ;; Return a buffer visiting file.
-  (or (idlwave-get-buffer-visiting file)
+  (or (find-buffer-visiting file)
       (let ((buf (find-file-noselect file)))
        (if why (add-to-list 'idlwave-outlawed-buffers (cons buf why)))
        buf)))
@@ -6618,7 +6590,6 @@ This function is not general, can only be used for 
completion stuff."
   "A form to evaluate after completion selection in *Completions* buffer.")
 (defconst idlwave-completion-mark (make-marker)
   "A mark pointing to the beginning of the completion string.")
-(defvar completion-highlight-first-word-only) ;XEmacs.
 
 (defun idlwave-complete-in-buffer (type stype list selector prompt isa
                                        &optional prepare-display-function
@@ -6697,12 +6668,7 @@ accumulate information on matching completions."
              list))
       (let* ((list all-completions)
             ;; "complete" means, this is already a valid completion
-            (complete (memq spart all-completions))
-            (completion-highlight-first-word-only t)) ; XEmacs
-            ;; (completion-fixup-function             ; Emacs
-            ;;  (lambda () (and (eq (preceding-char) ?>)
-            ;;               (re-search-backward " <" beg t)))))
-
+            (complete (memq spart all-completions)))
        (setq list (sort list (lambda (a b)
                                (string< (downcase a) (downcase b)))))
        (if prepare-display-function
@@ -6764,7 +6730,6 @@ accumulate information on matching completions."
     (let* ((do-prop (and (>= show-classes 0)
                         (>= emacs-major-version 21)))
           (do-buf (not (= show-classes 0)))
-          ;; (do-dots (featurep 'xemacs))
           (do-dots t)
           (inherit (if (and (not (eq type 'class-tag)) super-classes)
                        (cons class-selector super-classes)))
@@ -6830,10 +6795,6 @@ accumulate information on matching completions."
 ;;----------------------------------------------------------------------
 ;;----------------------------------------------------------------------
 ;;----------------------------------------------------------------------
-(when (featurep 'xemacs)
-  (defvar rtn)
-  (defun idlwave-pset (item)
-    (set 'rtn item)))
 
 (defun idlwave-popup-select (ev list title &optional sort)
   "Select an item in LIST with a popup menu.
@@ -6844,17 +6805,6 @@ sort the list before displaying."
     (cond ((null list))
          ((= 1 (length list))
           (setq rtn (car list)))
-         ((featurep 'xemacs)
-          (if sort (setq list (sort list (lambda (a b)
-                                           (string< (upcase a) (upcase b))))))
-          (setq menu
-                (append (list title)
-                        (mapcar (lambda (x) (vector x (list 'idlwave-pset
-                                                            x)))
-                                list)))
-          (setq menu (idlwave-split-menu-xemacs menu maxpopup))
-          (let ((resp (get-popup-menu-response menu)))
-             (funcall (event-function resp) (event-object resp))))
          (t
           (if sort (setq list (sort list (lambda (a b)
                                            (string< (upcase a) (upcase b))))))
@@ -6862,36 +6812,14 @@ sort the list before displaying."
                            (list
                             (append (list "")
                                     (mapcar (lambda(x) (cons x x)) list)))))
-          (setq menu (idlwave-split-menu-emacs menu maxpopup))
+          (setq menu (idlwave-split-menu menu maxpopup))
           (setq rtn (x-popup-menu ev menu))))
     rtn))
 
-(defun idlwave-split-menu-xemacs (menu N)
-  "Split the MENU into submenus of maximum length N."
-  (if (<= (length menu) (1+ N))
-      ;; No splitting needed
-      menu
-    (let* ((title (car menu))
-          (entries (cdr menu))
-          (menu (list title))
-          (cnt 0)
-          (nextmenu nil))
-      (while entries
-       (while (and entries (< cnt N))
-         (setq cnt (1+ cnt)
-               nextmenu (cons (car entries) nextmenu)
-               entries (cdr entries)))
-       (setq nextmenu (nreverse nextmenu))
-       (setq nextmenu (cons (format "%s...%s"
-                                    (aref (car nextmenu) 0)
-                                    (aref (nth (1- cnt) nextmenu) 0))
-                            nextmenu))
-       (setq menu (cons nextmenu menu)
-             nextmenu nil
-             cnt 0))
-      (nreverse menu))))
+(define-obsolete-function-alias 'idlwave-split-menu-emacs
+  #'idlwave-split-menu "28.1")
 
-(defun idlwave-split-menu-emacs (menu N)
+(defun idlwave-split-menu (menu N)
   "Split the MENU into submenus of maximum length N."
   (if (<= (length (nth 1 menu)) (1+ N))
       ;; No splitting needed
@@ -6946,10 +6874,7 @@ sort the list before displaying."
     (move-marker idlwave-completion-mark beg)
     (setq idlwave-before-completion-wconf (current-window-configuration)))
 
-  (if (featurep 'xemacs)
-      (idlwave-display-completion-list-xemacs
-       list)
-    (idlwave-display-completion-list-emacs list))
+  (idlwave-display-completion-list-1 list)
 
   ;; Store a special value in `this-command'.  When `idlwave-complete'
   ;; finds this in `last-command', it will scroll the *Completions* buffer.
@@ -7093,42 +7018,17 @@ If these don't exist, a letter in the string is 
automatically selected."
     (and (local-variable-p var (current-buffer))
         (symbol-value var))))
 
-;; In XEmacs, we can use :activate-callback directly to advice the
-;; choose functions.  We use the private keymap only for the online
-;; help feature.
-
 (defvar idlwave-completion-map nil
   "Keymap for `completion-list-mode' with `idlwave-complete'.")
 
-(defun idlwave-display-completion-list-xemacs (list &rest cl-args)
-  (with-output-to-temp-buffer "*Completions*"
-    (apply 'display-completion-list list
-          ':activate-callback 'idlwave-default-choose-completion
-          cl-args))
-  (with-current-buffer "*Completions*"
-    (use-local-map
-     (or idlwave-completion-map
-        (setq idlwave-completion-map
-              (idlwave-make-modified-completion-map-xemacs
-               (current-local-map)))))))
-
 (defun idlwave-default-choose-completion (&rest args)
   "Execute `default-choose-completion' and then restore the win-conf."
   (apply 'idlwave-choose 'default-choose-completion args))
 
-(defun idlwave-make-modified-completion-map-xemacs (old-map)
-  "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
-  (let ((new-map (copy-keymap old-map)))
-    (define-key new-map [button3up] 'idlwave-mouse-completion-help)
-    (define-key new-map [button3] (lambda ()
-                                   (interactive)
-                                   (setq this-command last-command)))
-    new-map))
-
-;; In Emacs we also replace keybindings in the completion
-;; map in order to install our wrappers.
+(define-obsolete-function-alias 'idlwave-display-completion-list-emacs
+  #'idlwave-display-completion-list-1 "28.1")
 
-(defun idlwave-display-completion-list-emacs (list)
+(defun idlwave-display-completion-list-1 (list)
   "Display completion list and install the choose wrappers."
   (with-output-to-temp-buffer "*Completions*"
     (display-completion-list list))
@@ -7136,10 +7036,12 @@ If these don't exist, a letter in the string is 
automatically selected."
     (use-local-map
      (or idlwave-completion-map
         (setq idlwave-completion-map
-              (idlwave-make-modified-completion-map-emacs
-               (current-local-map)))))))
+              (idlwave-make-modified-completion-map (current-local-map)))))))
 
-(defun idlwave-make-modified-completion-map-emacs (old-map)
+(define-obsolete-function-alias 'idlwave-make-modified-completion-map-emacs
+  #'idlwave-make-modified-completion-map "28.1")
+
+(defun idlwave-make-modified-completion-map (old-map)
   "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
   (let ((new-map (copy-keymap old-map)))
     (substitute-key-definition
@@ -7351,7 +7253,7 @@ class/struct definition."
         (file (idlwave-routine-source-file
                (nth 3 (idlwave-rinfo-assoc pro 'pro nil
                                            (idlwave-routines))))))
-    (cons file (if file (idlwave-get-buffer-visiting file)))))
+    (cons file (if file (find-buffer-visiting file)))))
 
 
 (defun idlwave-scan-class-info (class)
@@ -8222,15 +8124,9 @@ If we do not know about MODULE, just return KEYWORD 
literally."
 
 (defvar idlwave-rinfo-mouse-map
   (let ((map (make-sparse-keymap)))
-    (define-key map
-      (if (featurep 'xemacs) [button2] [mouse-2])
-      'idlwave-mouse-active-rinfo)
-    (define-key map
-      (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)])
-      'idlwave-mouse-active-rinfo-shift)
-    (define-key map
-      (if (featurep 'xemacs) [button3] [mouse-3])
-      'idlwave-mouse-active-rinfo-right)
+    (define-key map [mouse-2] 'idlwave-mouse-active-rinfo)
+    (define-key map [(shift mouse-2)] 'idlwave-mouse-active-rinfo-shift)
+    (define-key map [mouse-3] 'idlwave-mouse-active-rinfo-right)
     (define-key map " " 'idlwave-active-rinfo-space)
     (define-key map "q" 'idlwave-quit-help)
     map))
@@ -8282,7 +8178,6 @@ If we do not know about MODULE, just return KEYWORD 
literally."
          "Button2: Display info about same method in superclass")
         (col 0)
         (data (list name type class (current-buffer) nil initial-class))
-        (km-prop (if (featurep 'xemacs) 'keymap 'local-map))
         (face 'idlwave-help-link)
         beg props win cnt total)
     ;; Fix keywords, but don't add chained super-classes, since these
@@ -8307,7 +8202,7 @@ If we do not know about MODULE, just return KEYWORD 
literally."
                                  idlwave-current-obj_new-class)
        (when superclasses
          (setq props (list 'mouse-face 'highlight
-                           km-prop idlwave-rinfo-mouse-map
+                           'local-map idlwave-rinfo-mouse-map
                            'help-echo help-echo-class
                            'data (cons 'class data)))
          (let ((classes (cons initial-class superclasses)) c)
@@ -8323,7 +8218,7 @@ If we do not know about MODULE, just return KEYWORD 
literally."
                    (add-text-properties beg (point) props))))
            (insert "\n")))
        (setq props (list 'mouse-face 'highlight
-                         km-prop idlwave-rinfo-mouse-map
+                         'local-map idlwave-rinfo-mouse-map
                          'help-echo help-echo-use
                          'data (cons 'usage data)))
        (if html-file (setq props (append (list 'face face 'link html-file)
@@ -8351,7 +8246,7 @@ If we do not know about MODULE, just return KEYWORD 
literally."
             (setq beg (point)
                   ;; Relevant keywords already have link property attached
                   props (list 'mouse-face 'highlight
-                              km-prop idlwave-rinfo-mouse-map
+                              'local-map idlwave-rinfo-mouse-map
                               'data (cons 'keyword data)
                               'help-echo help-echo-kwd
                               'keyword (car x)))
@@ -8365,7 +8260,7 @@ If we do not know about MODULE, just return KEYWORD 
literally."
        ;; Here entry is (key file (list of type-conses))
        (while (setq entry (pop all))
          (setq props (list 'mouse-face 'highlight
-                           km-prop idlwave-rinfo-mouse-map
+                           'local-map idlwave-rinfo-mouse-map
                            'help-echo help-echo-src
                            'source (list (car (car (nth 2 entry))) ;type
                                          (nth 1 entry)
@@ -8470,8 +8365,7 @@ to it."
       (add-text-properties beg (point) (list 'face 'bold)))
     (when (and file (not (equal file "")))
       (setq beg (point))
-      (insert (apply 'abbreviate-file-name
-                    (if (featurep 'xemacs) (list file t) (list file))))
+      (insert (apply 'abbreviate-file-name (list file)))
       (if file-props
          (add-text-properties beg (point) file-props)))))
 
@@ -8631,10 +8525,9 @@ can be used to detect possible name clashes during this 
process."
                           idlwave-user-catalog-routines
                           idlwave-buffer-routines
                           nil))
-        (km-prop (if (featurep 'xemacs) 'keymap 'local-map))
         (keymap (make-sparse-keymap))
         (props (list 'mouse-face 'highlight
-                     km-prop keymap
+                     'local-map keymap
                      'help-echo "Mouse2: Find source"))
         (nroutines (length (or special-routines routines)))
         (step (/ nroutines 100))
@@ -8657,7 +8550,7 @@ can be used to detect possible name clashes during this 
process."
                                               (nth 2 b) (car b)))))))
     (message "Sorting routines...done")
 
-    (define-key keymap (if (featurep 'xemacs) [(button2)] [(mouse-2)])
+    (define-key keymap [(mouse-2)]
       (lambda (ev)
        (interactive "e")
        (mouse-set-point ev)
@@ -9019,23 +8912,6 @@ Assumes that point is at the beginning of the unit as 
found by
                 'imenu)
             (error nil)))))
 
-;; Here we hack func-menu.el in order to support this new mode.
-;; The latest versions of func-menu.el already have this stuff in, so
-;; we hack only if it is not already there.
-(when (featurep 'xemacs)
-  (eval-after-load "func-menu"
-    '(progn
-       (or (assq 'idlwave-mode fume-function-name-regexp-alist)
-          (not (boundp 'fume-function-name-regexp-idl))      ; avoid problems
-          (setq fume-function-name-regexp-alist
-                (cons '(idlwave-mode . fume-function-name-regexp-idl)
-                      fume-function-name-regexp-alist)))
-       (or (assq 'idlwave-mode fume-find-function-name-method-alist)
-          (not (fboundp 'fume-find-next-idl-function-name))  ; avoid problems
-          (setq fume-find-function-name-method-alist
-                (cons '(idlwave-mode . fume-find-next-idl-function-name)
-                      fume-find-function-name-method-alist))))))
-
 (defun idlwave-edit-in-idlde ()
   "Edit the current file in IDL Development environment."
   (interactive)



reply via email to

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