]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove obsolete example functions from imenu.el
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 17 May 2019 04:53:58 +0000 (06:53 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 17 May 2019 04:53:58 +0000 (06:53 +0200)
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--function-name-regexp-c)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name): Remove functions (and
internal variables used by those functions) declared obsolete in
Emacs 23.2.  The functions gave compilation warnings.

lisp/imenu.el

index df39ff3c07d79423105a8e7bbb136dbd5e034a51..5084fe61effccf698610c0884a8b44c5bd070e03 100644 (file)
@@ -348,98 +348,6 @@ Don't move point."
   (signal 'imenu-unavailable
           (list (apply #'format-message format args))))
 
-(defun imenu-example--lisp-extract-index-name ()
-  ;; Example of a candidate for `imenu-extract-index-name-function'.
-  ;; This will generate a flat index of definitions in a lisp file.
-  (declare (obsolete nil "23.2"))
-  (save-match-data
-    (and (looking-at "(def")
-        (condition-case nil
-            (progn
-              (down-list 1)
-              (forward-sexp 2)
-              (let ((beg (point))
-                    (end (progn (forward-sexp -1) (point))))
-                (buffer-substring beg end)))
-          (error nil)))))
-
-(defun imenu-example--create-lisp-index ()
-  ;; Example of a candidate for `imenu-create-index-function'.
-  ;; It will generate a nested index of definitions.
-  (declare (obsolete nil "23.2"))
-  (let ((index-alist '())
-       (index-var-alist '())
-       (index-type-alist '())
-       (index-unknown-alist '()))
-    (goto-char (point-max))
-    ;; Search for the function
-    (while (beginning-of-defun)
-         (save-match-data
-           (and (looking-at "(def")
-                (save-excursion
-              (down-list 1)
-                  (cond
-               ((looking-at "def\\(var\\|const\\)")
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                          index-var-alist))
-               ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)")
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                          index-alist))
-               ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)")
-                    (forward-sexp 2)
-                (if (= (char-after (1- (point))) ?\))
-                        (progn
-                      (forward-sexp -1)
-                          (down-list 1)
-                      (forward-sexp 1)))
-                    (push (imenu-example--name-and-position)
-                          index-type-alist))
-                   (t
-                    (forward-sexp 2)
-                    (push (imenu-example--name-and-position)
-                      index-unknown-alist)))))))
-    (and index-var-alist
-        (push (cons "Variables" index-var-alist)
-              index-alist))
-    (and index-type-alist
-        (push (cons "Types" index-type-alist)
-              index-alist))
-    (and index-unknown-alist
-        (push (cons "Syntax-unknown" index-unknown-alist)
-              index-alist))
-    index-alist))
-
-;; Regular expression to find C functions
-(defvar imenu-example--function-name-regexp-c
-  (concat
-   "^[a-zA-Z0-9]+[ \t]?"               ; Type specs; there can be no
-   "\\([a-zA-Z0-9_*]+[ \t]+\\)?"       ; more than 3 tokens, right?
-   "\\([a-zA-Z0-9_*]+[ \t]+\\)?"
-   "\\([*&]+[ \t]*\\)?"                        ; Pointer.
-   "\\([a-zA-Z0-9_*]+\\)[ \t]*("       ; Name.
-   ))
-
-(defun imenu-example--create-c-index (&optional regexp)
-  (declare (obsolete nil "23.2"))
-  (let ((index-alist '())
-       char)
-    (goto-char (point-min))
-    ;; Search for the function
-    (save-match-data
-      (while (re-search-forward
-             (or regexp imenu-example--function-name-regexp-c)
-             nil t)
-       (backward-up-list 1)
-       (save-excursion
-         (goto-char (scan-sexps (point) 1))
-         (setq char (following-char)))
-       ;; Skip this function name if it is a prototype declaration.
-       (if (not (eq char ?\;))
-           (push (imenu-example--name-and-position) index-alist))))
-    (nreverse index-alist)))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Internal variables