emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master e0ea878: Remove obsolete example functions from ime


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master e0ea878: Remove obsolete example functions from imenu.el
Date: Fri, 17 May 2019 00:54:07 -0400 (EDT)

branch: master
commit e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 lisp/imenu.el | 92 -----------------------------------------------------------
 1 file changed, 92 deletions(-)

diff --git a/lisp/imenu.el b/lisp/imenu.el
index df39ff3..5084fe6 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



reply via email to

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