comparison lisp/progmodes/idlwave.el @ 111428:043aac1cda3c

Minor idlwave change. * lisp/progmodes/idlwave.el (idlwave-routine-entry-compare-twins): (idlwave-study-twins): Prefix dynamic local `class'. (idlwave-routine-twin-compare): Update for above name change.
author Glenn Morris <rgm@gnu.org>
date Sat, 06 Nov 2010 12:55:44 -0700
parents 4fc3989048ca
children 05dc9dca8729
comparison
equal deleted inserted replaced
111427:28be5d9560c5 111428:043aac1cda3c
8826 non-dangerous because many IDL routines are implemented as library 8826 non-dangerous because many IDL routines are implemented as library
8827 routines, and may have been scanned." 8827 routines, and may have been scanned."
8828 (let* ((entry (car entries)) 8828 (let* ((entry (car entries))
8829 (name (car entry)) ; 8829 (name (car entry)) ;
8830 (type (nth 1 entry)) ; Must be bound for 8830 (type (nth 1 entry)) ; Must be bound for
8831 (class (nth 2 entry)) ; idlwave-routine-twin-compare 8831 (idlwave-twin-class (nth 2 entry)) ; idlwave-routine-twin-compare
8832 (cnt 0) 8832 (cnt 0)
8833 source type type-cons file alist syslibp key) 8833 source type type-cons file alist syslibp key)
8834 (while (setq entry (pop entries)) 8834 (while (setq entry (pop entries))
8835 (incf cnt) 8835 (incf cnt)
8836 (setq source (nth 3 entry) 8836 (setq source (nth 3 entry)
8868 (setcar entry 'builtin)) 8868 (setcar entry 'builtin))
8869 (sort alist 'idlwave-routine-twin-compare))) 8869 (sort alist 'idlwave-routine-twin-compare)))
8870 8870
8871 ;; FIXME: Dynamically scoped vars need to use the `idlwave-' prefix. 8871 ;; FIXME: Dynamically scoped vars need to use the `idlwave-' prefix.
8872 ;; (defvar type) 8872 ;; (defvar type)
8873 ;; (defvar class)
8874 (defmacro idlwave-xor (a b) 8873 (defmacro idlwave-xor (a b)
8875 `(and (or ,a ,b) 8874 `(and (or ,a ,b)
8876 (not (and ,a ,b)))) 8875 (not (and ,a ,b))))
8877 8876
8878 (defun idlwave-routine-entry-compare (a b) 8877 (defun idlwave-routine-entry-compare (a b)
8901 (idlwave-routine-entry-compare-twins a b))))) 8900 (idlwave-routine-entry-compare-twins a b)))))
8902 8901
8903 (defun idlwave-routine-entry-compare-twins (a b) 8902 (defun idlwave-routine-entry-compare-twins (a b)
8904 "Compare two routine entries, under the assumption that they are twins. 8903 "Compare two routine entries, under the assumption that they are twins.
8905 This basically calls `idlwave-routine-twin-compare' with the correct args." 8904 This basically calls `idlwave-routine-twin-compare' with the correct args."
8906 (let* ((name (car a)) (type (nth 1 a)) (class (nth 2 a)) ; needed outside 8905 (let* ((name (car a))
8906 (type (nth 1 a))
8907 (idlwave-twin-class (nth 2 a)) ; used in idlwave-routine-twin-compare
8907 (asrc (nth 3 a)) 8908 (asrc (nth 3 a))
8908 (atype (car asrc)) 8909 (atype (car asrc))
8909 (bsrc (nth 3 b)) 8910 (bsrc (nth 3 b))
8910 (btype (car bsrc)) 8911 (btype (car bsrc))
8911 (afile (idlwave-routine-source-file asrc)) 8912 (afile (idlwave-routine-source-file asrc))
8914 (if (stringp afile) 8915 (if (stringp afile)
8915 (list (file-truename afile) afile (list atype)) 8916 (list (file-truename afile) afile (list atype))
8916 (list atype afile (list atype))) 8917 (list atype afile (list atype)))
8917 (if (stringp bfile) 8918 (if (stringp bfile)
8918 (list (file-truename bfile) bfile (list btype)) 8919 (list (file-truename bfile) bfile (list btype))
8919 (list btype bfile (list btype)))) 8920 (list btype bfile (list btype))))))
8920 ))
8921 8921
8922 ;; Bound in idlwave-study-twins,idlwave-routine-entry-compare-twins. 8922 ;; Bound in idlwave-study-twins,idlwave-routine-entry-compare-twins.
8923 ;; FIXME: Dynamically scoped vars need to use the `idlwave-' prefix. 8923 (defvar idlwave-twin-class)
8924 (defvar class)
8925 8924
8926 (defun idlwave-routine-twin-compare (a b) 8925 (defun idlwave-routine-twin-compare (a b)
8927 "Compare two routine twin entries for sorting. 8926 "Compare two routine twin entries for sorting.
8928 In here, A and B are not normal routine info entries, but special 8927 In here, A and B are not normal routine info entries, but special
8929 lists (KEY FILENAME (TYPES...)). 8928 lists (KEY FILENAME (TYPES...)).
8930 This expects NAME TYPE CLASS to be bound to the right values." 8929 This expects NAME TYPE IDLWAVE-TWIN-CLASS to be bound to the right values."
8931 (let* (;; Dis-assemble entries 8930 (let* (;; Dis-assemble entries
8932 (akey (car a)) (bkey (car b)) 8931 (akey (car a)) (bkey (car b))
8933 (afile (nth 1 a)) (bfile (nth 1 b)) 8932 (afile (nth 1 a)) (bfile (nth 1 b))
8934 (atypes (nth 2 a)) (btypes (nth 2 b)) 8933 (atypes (nth 2 a)) (btypes (nth 2 b))
8935 ;; System routines? 8934 ;; System routines?
8957 (anpath (length (memq apathp tpath-alist))) 8956 (anpath (length (memq apathp tpath-alist)))
8958 (bnpath (length (memq bpathp tpath-alist))) 8957 (bnpath (length (memq bpathp tpath-alist)))
8959 ;; Look at file names 8958 ;; Look at file names
8960 (aname (if (stringp afile) (downcase (file-name-nondirectory afile)) "")) 8959 (aname (if (stringp afile) (downcase (file-name-nondirectory afile)) ""))
8961 (bname (if (stringp bfile) (downcase (file-name-nondirectory bfile)) "")) 8960 (bname (if (stringp bfile) (downcase (file-name-nondirectory bfile)) ""))
8962 (fname-re (if class (format "\\`%s__\\(%s\\|define\\)\\.pro\\'" 8961 (fname-re (if idlwave-twin-class
8963 (regexp-quote (downcase class)) 8962 (format "\\`%s__\\(%s\\|define\\)\\.pro\\'"
8964 (regexp-quote (downcase name))) 8963 (regexp-quote (downcase idlwave-twin-class))
8964 (regexp-quote (downcase name)))
8965 (format "\\`%s\\.pro" (regexp-quote (downcase name))))) 8965 (format "\\`%s\\.pro" (regexp-quote (downcase name)))))
8966 ;; Is file name derived from the routine name? 8966 ;; Is file name derived from the routine name?
8967 ;; Method file or class definition file? 8967 ;; Method file or class definition file?
8968 (anamep (string-match fname-re aname)) 8968 (anamep (string-match fname-re aname))
8969 (adefp (and class anamep (string= "define" (match-string 1 aname)))) 8969 (adefp (and idlwave-twin-class anamep
8970 (string= "define" (match-string 1 aname))))
8970 (bnamep (string-match fname-re bname)) 8971 (bnamep (string-match fname-re bname))
8971 (bdefp (and class bnamep (string= "define" (match-string 1 bname))))) 8972 (bdefp (and idlwave-twin-class bnamep
8973 (string= "define" (match-string 1 bname)))))
8972 8974
8973 ;; Now: follow JD's ideas about sorting. Looks really simple now, 8975 ;; Now: follow JD's ideas about sorting. Looks really simple now,
8974 ;; doesn't it? The difficult stuff is hidden above... 8976 ;; doesn't it? The difficult stuff is hidden above...
8975 (cond 8977 (cond
8976 ((idlwave-xor asysp bsysp) asysp) ; System entries first 8978 ((idlwave-xor asysp bsysp) asysp) ; System entries first
8978 ((and idlwave-sort-prefer-buffer-info 8980 ((and idlwave-sort-prefer-buffer-info
8979 (idlwave-xor abufp bbufp)) abufp) ; Buffers before non-buffers 8981 (idlwave-xor abufp bbufp)) abufp) ; Buffers before non-buffers
8980 ((idlwave-xor acompp bcompp) acompp) ; Compiled entries 8982 ((idlwave-xor acompp bcompp) acompp) ; Compiled entries
8981 ((idlwave-xor apathp bpathp) apathp) ; Library before non-library 8983 ((idlwave-xor apathp bpathp) apathp) ; Library before non-library
8982 ((idlwave-xor anamep bnamep) anamep) ; Correct file names first 8984 ((idlwave-xor anamep bnamep) anamep) ; Correct file names first
8983 ((and class anamep bnamep ; both file names match -> 8985 ((and idlwave-twin-class anamep bnamep ; both file names match ->
8984 (idlwave-xor adefp bdefp)) bdefp) ; __define after __method 8986 (idlwave-xor adefp bdefp)) bdefp) ; __define after __method
8985 ((> anpath bnpath) t) ; Who is first on path? 8987 ((> anpath bnpath) t) ; Who is first on path?
8986 (t nil)))) ; Default 8988 (t nil)))) ; Default
8987 8989
8988 (defun idlwave-routine-source-file (source) 8990 (defun idlwave-routine-source-file (source)