From: Lars Ingebrigtsen Date: Fri, 17 May 2019 04:53:58 +0000 (+0200) Subject: Remove obsolete example functions from imenu.el X-Git-Tag: emacs-27.0.90~2853 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3;p=emacs.git Remove obsolete example functions from imenu.el * 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. --- diff --git a/lisp/imenu.el b/lisp/imenu.el index df39ff3c07d..5084fe61eff 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -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