;ELC ;;; compiled by jwz@thalidomide on Mon May 23 04:12:10 1994 ;;; from file /th/jwz/emacs19/lisp/packages/func-menu.el ;;; emacs version 19.10 Lucid (beta25). ;;; bytecomp version 2.24; 26-Apr-94. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (defvar fume-auto-position-popup t "\ *Set this to nil if you don't want the popup menu to always appear in the corner of the window, in which case it will track the mouse position instead.") (defvar fume-menubar-menu-name "Functions" "\ *Set this to the string you want to appear in the menubar") (make-variable-buffer-local 'fume-menubar-menu-name) (defvar fume-menubar-menu-location "File" "\ *Set this nil if you want the menu to appear last on the menubar. Otherwise set this to the menu you want \"Functions\" to appear in front of.") (defvar fume-max-items 25 "\ *Maximum number of elements in a function (sub)menu.") (defvar fume-index-method 3 "\ *Set this to the method number you want used. Methods currently supported: 0 = if you want submenu names to be numbered 1 = if you want submenu range indicated by first character 2 = if you want submenu range indicated by first 10 characters 3 = if you want submenu range indicated by as many characters as needed") (defvar fume-scanning-message "Scanning buffer... (%3d%%)" "\ *Set this to nil if you don't want any progress messages during the scanning of the buffer.") (defvar fume-rescan-buffer-hook nil "\ *Buffer local hook to call at the end of each buffer rescan") (make-variable-buffer-local 'fume-rescan-buffer-hook) (defvar fume-sort-function 'fume-sort-by-name "\ *The function to use for sorting the function menu. Set this to nil if you don't want any sorting (faster). The items in the menu are then presented in the order they were found in the buffer. The function should take two arguments and return T if the first element should come before the second. The arguments are cons cells; (NAME . POSITION). Look at 'fume-sort-by-name' for an example.") (byte-code "!!" [boundp fume-funclist nil make-variable-buffer-local] 2) (defvar fume-function-name-regexp nil "\ The keywords to show in a menu") (make-variable-buffer-local 'fume-function-name-regexp) (defvar fume-find-next-function-name-method nil "\ The function to use to find the next function name in the buffer") (make-variable-buffer-local 'fume-find-next-function-name-method) (defconst fume-function-name-regexp-lisp (concat "\\(^(defun+\\s-*[#:?A-Za-z0-9_+->]+\\s-*(\\)" "\\|" "\\(^(defmacro+\\s-*[#:?A-Za-z0-9_+->]+\\s-*(\\)" "\\|" "\\(^(de+\\s-*[#:?A-Za-z0-9_+->]+\\s-*(\\)" "\\|" "\\(^(dmd+\\s-*[#:?A-Za-z0-9_+->]+\\s-*(\\)") "\ Expression to get lisp function names") (defconst fume-function-name-regexp-c (byte-code "ð" ["^[a-zA-Z0-9]+\\s-?" "\\([a-zA-Z0-9_*]+\\s-+\\)?" "\\([*&]+\\s-*\\)?" "\\([a-zA-Z0-9_*]+\\)[ \n]*("] 5) "\ Expression to get C function names") (defconst fume-function-name-regexp-c++ (byte-code "‰İB" ["^\\(template\\s +<[^>]+>\\s +\\)?" "\\([a-zA-Z0-9_*&<,>:]+\\s-+\\)?" "\\([a-zA-Z0-9_*&<,>]+\\s-+\\)?" "\\(\\([a-zA-Z0-9_~:<,>*]\\|\\(\\s +::\\s +\\)\\)+\\)" "\\(o?perator\\s *.[^(]*\\)?\\s-*(" 5] 6) "\ Expression to get C++ function names") (defconst fume-function-name-regexp-fortran (concat "^ \\s-*" "+[a-zA-Z0-9*]*\\s-*" "\\(\n [^ 0]\\s-*\\)*" "\\(entry\\|ENTRY\\|function\\|FUNCTION\\|subroutine\\|SUBROUTINE\\)\\s-*" "\\(\n [^ 0]\\s-*\\)*") "\ Expression to get fortran function and subroutine names") (defconst fume-function-name-regexp-modula "^\\s-*PROCEDURE\\s-+[A-Za-z0-9_-]+" "\ Expression to get Modula function names") (defconst fume-function-name-regexp-bacis "module_define(!\\|define_constant(!\\|sys_sysdefine(!\\|<]*" "\ Expression to get postscript function names") (defconst fume-function-name-regexp-ehdm (concat "[A-Za-z0-9_]*:[ ]*" "\\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\|" "[Ll][Ee][Mm][Mm][Aa]\\|" "[Aa][Xx][Ii][Oo][Mm]\\|" "[Pp][Rr][Oo][Vv][Ee]\\|" "[Tt][Hh][Ee][Oo][Rr][Ee][Mm]" "\\)") "\ *Expression to get Ehdm function, theorems, axioms, lemmas, and proofs.") (defconst fume-function-name-regexp-pvs (concat "\\([A-Za-z0-9_]*:[ ]*" "\\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\|" "[Ll][Ee][Mm][Mm][Aa]\\|" "[Aa][Xx][Ii][Oo][Mm]\\|" "[Tt][Hh][Ee][Oo][Rr][Ee][Mm]\\|" "[Ff][Or][Rr][Mm][Uu][La][Aa]" "\\|" "\\[.*\\]" "\\)\\)\\|" "[A-Za-z0-9_]*(.*)[ ]*:") "\ *Expression to get PVS functions, theorems, axioms, lemmas") (byte-code "!!!!!!!!MM\"\"\"\"" [boundp fume-tex-chapter 0 make-variable-buffer-local fume-tex-section fume-tex-subsection fume-tex-subsubsection fume-tex-rescan-buffer-hook #[nil "" [0 fume-tex-chapter fume-tex-section fume-tex-subsection fume-tex-subsubsection] 2] fume-tweak-tex-mode #[nil "!\"" [make-variable-buffer-local fume-sort-function nil add-hook fume-rescan-buffer-hook fume-tex-rescan-buffer-hook] 3] add-hook tex-mode-hook TeX-mode-hook latex-mode-hook LaTeX-mode-hook] 3) (defconst fume-section-name-regexp-latex (concat "^\\s-*\\\\\\(" "\\(sub\\)*section\\|chapter\\)" "\\*?\\(\\[[^]]*\\]\\)?{\\([^}]*\\)}") "\ Expression to get latex section names") (defconst fume-function-name-regexp-ksh (concat "\\(^\\s-*function\\s-+[A-Za-z_][A-Za-z_0-9]*\\)" "\\|" "\\(^\\s-*[A-Za-z_][A-Za-z_0-9]*\\s-*()\\)") "\ Expression to get ksh function names") (defconst fume-function-name-regexp-scheme "^(define [ ]*" "\ Expression to get Scheme function names") (defconst fume-function-name-regexp-bibtex "^@[A-Za-z]*[({]\\([A-Za-z0-9:;&-]*\\)," "\ Expression to get bibtex citation headers.") (defconst fume-function-name-regexp-sgml ">"] 5 "\ Searches for the next Bacis2 function in BUFFER"]) (fset 'fume-find-next-maple-function-name #[(buffer) "q\n#!!`  `{ )B" [buffer re-search-forward fume-function-name-regexp nil t backward-up-list 1 forward-sexp -2 beg] 4 "\ Searches for the next maple function in BUFFER"]) (fset 'fume-find-next-latex-section-name #[(buffer) "q\n#Ŕŕ{ǔǕ{ ʘ T    Q ј T  V P  R ԘT V P   ՘T V P   ՘ P  +B" [buffer re-search-forward fume-function-name-regexp nil t 1 secname 4 beg name "chapter" fume-tex-chapter 0 fume-tex-section fume-tex-subsection fume-tex-subsubsection " " "section" "." "" "subsection" "subsubsection" " "] 9 "\ Searches for the next latex section in BUFFER."]) (fset 'fume-find-next-ksh-function-name #[(buffer) "q\n#Ŕ##˔˕{#˔˕{!B*" [buffer re-search-forward fume-function-name-regexp nil t 0 beg name re-search-backward "\\(^\\|\\s-\\)function\\s-" "\\(function\\s-+\\)\\([A-Za-z_][A-Za-z_0-9]*\\)" 2 "\\(^\\|\\s-\\)\\([A-Za-z_][A-Za-z_0-9]*\\)" fume-find-next-ksh-function-name] 5 "\ Searches for the ksh type function in BUFFER."]) (fset 'fume-find-next-scheme-function #[(buffer) "q\n#!u` `) \n {\n*B" [buffer re-search-forward fume-function-name-regexp nil t looking-at "(" 1 forward-sexp end beg] 5 "\ Searches for the next Scheme function in BUFFER."]) (fset 'fume-find-next-bibtex-citation #[(buffer) "q\n#Ŕŕ{*B" [buffer re-search-forward fume-function-name-regexp nil t 1 end beg] 5 "\ Searches for the next BibTeX citation in BUFFER."]) (fset 'fume-find-next-sgml-element-name #[(buffer) "q\n#Ŕŕ{ƔƔƕ{ ʘ##+B" [buffer re-search-forward fume-function-name-regexp nil t 1 2 name beg type "element" format "%-17s%3s" "EL" "ENT"] 5 "\ Searches for the next SGML declaration in BUFFER."]) (fset 'fume-find-next-ada-function-name #[(buffer) "q\n@#\nA\nA!! {B*" [buffer re-search-forward fume-function-name-regexp-ada nil t end beg looking-at fume-function-name-regexp-ada-ignore fume-find-next-ada-function-name] 4 "\ Searches for the next ada function in BUFFER."]) (fset 'fume-find-next-function-name-make #[(buffer) "q\n#Ŕŕ{*B" [buffer re-search-forward fume-function-name-regexp nil t 1 end beg] 5 "\ Searches for the next make item in BUFFER."]) (fset 'fume-find-next-pascal-function-name #[(buffer) "q\n#Ŕŕ{*B" [buffer re-search-forward fume-function-name-regexp nil t 2 end beg] 5 "\ Searches for the next pascal procedure in BUFFER."]) (fset 'fume-find-next-verilog-function-name #[(buffer) "q\n#Ŕŕ{*B" [buffer re-search-forward fume-function-name-regexp nil t 2 end beg] 5 "\ Searches for the next verilog module in BUFFER."]) (defconst fume-find-function-name-method-alist '((ada-mode . fume-find-next-ada-function-name) (alice-mode . fume-find-next-python-function-name) (bacis-mode . fume-find-next-bacis-function-name) (bibtex-mode . fume-find-next-bibtex-citation) (c++-mode . fume-match-find-next-function-name) (c-mode . fume-find-next-c-function-name) (dired-mode . fume-find-next-directory-name) (ehdm-mode . fume-find-next-ehdm-entity) (pvs-mode . fume-find-next-pvs-entity) (fortran-mode . fume-find-next-fortran-function-name) (ksh-mode . fume-find-next-ksh-function-name) (latex-mode . fume-find-next-latex-section-name) (LaTeX-mode . fume-find-next-latex-section-name) (makefile-mode . fume-find-next-function-name-make) (maple-mode . fume-find-next-maple-function-name) (modula-2-mode . fume-find-next-modula-function-name) (modula-3-mode . fume-find-next-modula-function-name) (pascal-mode . fume-find-next-pascal-function-name) (perl-mode . fume-find-next-perl-function-name) (postscript-mode . fume-find-next-postscript-function-name) (python-mode . fume-find-next-python-function-name) (scheme-mode . fume-find-next-scheme-function) (sgml-mode . fume-find-next-sgml-element-name) (tcl-mode . fume-match-find-next-function-name) (verilog-mode . fume-find-next-verilog-function-name)) "\ The connection between a mode and the defun that finds function names. If no connection is in this alist for a given mode, a default method is used.") (fset 'fume-set-defaults #[nil " \n\"J \" " [assoc major-mode fume-function-name-regexp-alist fume-function-name-regexp fume-find-function-name-method-alist fume-find-next-function-name fume-find-next-function-name-method] 4 "\ Returns nil if unsuccessful in setting up buffer-local defaults. Otherwise returns fume-function-name-regexp"]) (byte-code "MMMMMMMM" [fume-sort-by-name #[(item1 item2) "@ @@ @" [item1 item2] 2] fume-relative-position #[nil "`  V\nS ĥ]\nS_ ]*" [buffer-size total pos 50000 100 1] 3] fume-split #[(list n) "@ BA TUh B] B ," [list nil 0 i sublist result remain n] 5] fume-index-sublist-method-0 #[(sublist count) " P" ["Function sublist #" count] 2] fume-index-sublist-method-1 #[(sublist &rest count) "@@OGS8@O Ǫ \"#*" [sublist 0 1 e s format "Function sublist (%s%s)" "<>" "<>-%s<>"] 6 nil nil] fume-index-sublist-method-2 #[(sublist &rest count) "@@@@G^OGS8@GS8@G^O Ǫ \"#*" [sublist 0 10 e s format "%s%s" "<>" "<> ... %s<>"] 6] fume-index-sublist-method-3-1 #[(sublist ix limit) "@@\n ^OGS8@GS8@G ^O *B" [sublist 0 limit ix s2 s1] 6] fume-index-sublist-method-3 #[(sublist &rest count) "\n@@G\n #@ A W T\n #@ Aa# W\"\"-" [10 cmplength sublist limit fume-index-sublist-method-3-1 result str1 str2 format "%s<> ... %s<>" "%s<>" "%s ..."] 5]] 2) (fset 'fume-rescan-buffer #[(&optional popmenu) "Jpeb\"ʏ < Bl \"c\"\" \" !- " [fume-find-next-function-name-method nil buffer-to-scan funclist funcname funcfinder fume-scanning-message message 0 (funcall funcfinder buffer-to-scan) ((error (byte-code " #)" [re-search-forward fume-function-name-regexp nil t] 4))) fume-relative-position "%s done" format 100 fume-sort-function sort fume-funclist run-hooks fume-rescan-buffer-hook popmenu function-menu fume-update-menubar-entry] 5 "\ Rescans the buffer for function names. If optional arg POPMENU is non-nil, brings up the function-menu." nil]) (fset 'fume-goto-function #[(fn pos) "` \" ĕO \" ĕO  b! \" ))  ! b`U ?\" y`)\" \" +" [nil string-match "DEFUN " fn 0 "^ *" match-fn case-fold-search orig-pos pos looking-at fume-scanning-message fume-rescan-buffer assoc fume-funclist pos-visible-in-window-p push-mark set-window-start selected-window -3 ding message "%s not found" function-menu] 5 "\ Thoughtfully position cursor at location of function probed on popup menu"]) (byte-code "MM" [fume-add-menubar-entry #[nil "\n\" ċ" [string-match "Lucid" emacs-version current-menubar ((function-menu t))] 3 nil nil] fume-remove-menubar-entry #[nil " C! !" [delete-menu-item fume-menubar-menu-name set-buffer-modified-p buffer-modified-p] 2 nil nil]] 2) (fset 'fume-update-menubar-entry #[nil " \n\"?? ć" [assoc fume-menubar-menu-name current-menubar fume-add-menubar-entry t] 3 "\ Returns t if menubar was updated. Nil otherwise" nil]) (fset 'fume-event-window #[(event) " ! ! !D\" ! !SD\"" [event-window event locate-window-from-coordinates selected-screen event-x event-y] 5 "\ Similar to event-window but more robust!"]) (fset 'mouse-function-menu #[(event) " ď)" [selected-window currwin err (byte-code "\n!! )" [select-window fume-event-window event nil fume-auto-position-popup function-menu] 3) ((error (byte-code " ! !" [select-window currwin eval err] 2)))] 3 "\ Wrapper for mouse button bindings for function-menu" "e"]) (fset 'function-menu #[(&optional use-menubar) "" [no-functions (byte-code " \"\"  \"! \"!\"\" V@A P ?D#BB !!\"#D\"%$ ? D#BB) @ A@# VPB!+" [fume-set-defaults use-menubar throw no-functions t error "The mode \"%s\" is not implemented in 'function-menu'." mode-name fume-funclist fume-rescan-buffer "No functions found in this buffer." 0 count intern format "fume-index-sublist-method-%d" fume-index-method index-method mapcar #[(sublist) "T \"\" \"B" [count format "%s" index-method sublist mapcar #[(menu) " @\" @ AE#" [vector format "%s" menu fume-goto-function t] 5]] 5] fume-split fume-max-items function-menu 1 vector "Rescan buffer : " buffer-name "----" fume-remove-menubar-entry set-buffer-menubar copy-sequence current-menubar add-menu nil fume-menubar-menu-name append "Remove Function Menu from menubar" fume-menubar-menu-location popup-menu-up-p fume-update-menubar-entry "Put Function Menu into menubar" fume-auto-position-popup set-mouse-position selected-screen window-edges popup-menu "Function menu" "s"] 10)] 2 "\ Pop up a menu of functions for selection with the mouse. With a prefix arg adds the menu to the current menubar. Jumps to the selected function. A mark is set at the old position, so you can easily go back with C-u \\[set-mark-command]." "P"]) (fset 'fume-prompt-function-goto #[nil " !uv#u` !!uv `{))  \" Q$՘ !՘\"A\"," [fume-funclist fume-set-defaults fume-rescan-buffer looking-at "\\sw\\|\\s_" 1 re-search-backward nil t beg forward-sexp -1 "\\s'" default-name assoc default-exists-p completing-read "Function name (" "): " "Function name: " function-name "" sit-for 0 fume-goto-function] 5 "\ Goto function prompted for in minibuffer (with completion)." nil]) (provide 'func-menu)