diff options
| author | Lars Ingebrigtsen | 2019-05-17 06:53:58 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-05-17 06:53:58 +0200 |
| commit | e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3 (patch) | |
| tree | e196b25985418d1a7c2587e7174534d10001a388 | |
| parent | 670c5126a094f6c7d7043db62db36ed30fef84af (diff) | |
| download | emacs-e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3.tar.gz emacs-e0ea878a89f6944d8949d3df1f5d83b5ca5f48e3.zip | |
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.
| -rw-r--r-- | lisp/imenu.el | 92 |
1 files changed, 0 insertions, 92 deletions
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." | |||
| 348 | (signal 'imenu-unavailable | 348 | (signal 'imenu-unavailable |
| 349 | (list (apply #'format-message format args)))) | 349 | (list (apply #'format-message format args)))) |
| 350 | 350 | ||
| 351 | (defun imenu-example--lisp-extract-index-name () | ||
| 352 | ;; Example of a candidate for `imenu-extract-index-name-function'. | ||
| 353 | ;; This will generate a flat index of definitions in a lisp file. | ||
| 354 | (declare (obsolete nil "23.2")) | ||
| 355 | (save-match-data | ||
| 356 | (and (looking-at "(def") | ||
| 357 | (condition-case nil | ||
| 358 | (progn | ||
| 359 | (down-list 1) | ||
| 360 | (forward-sexp 2) | ||
| 361 | (let ((beg (point)) | ||
| 362 | (end (progn (forward-sexp -1) (point)))) | ||
| 363 | (buffer-substring beg end))) | ||
| 364 | (error nil))))) | ||
| 365 | |||
| 366 | (defun imenu-example--create-lisp-index () | ||
| 367 | ;; Example of a candidate for `imenu-create-index-function'. | ||
| 368 | ;; It will generate a nested index of definitions. | ||
| 369 | (declare (obsolete nil "23.2")) | ||
| 370 | (let ((index-alist '()) | ||
| 371 | (index-var-alist '()) | ||
| 372 | (index-type-alist '()) | ||
| 373 | (index-unknown-alist '())) | ||
| 374 | (goto-char (point-max)) | ||
| 375 | ;; Search for the function | ||
| 376 | (while (beginning-of-defun) | ||
| 377 | (save-match-data | ||
| 378 | (and (looking-at "(def") | ||
| 379 | (save-excursion | ||
| 380 | (down-list 1) | ||
| 381 | (cond | ||
| 382 | ((looking-at "def\\(var\\|const\\)") | ||
| 383 | (forward-sexp 2) | ||
| 384 | (push (imenu-example--name-and-position) | ||
| 385 | index-var-alist)) | ||
| 386 | ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)") | ||
| 387 | (forward-sexp 2) | ||
| 388 | (push (imenu-example--name-and-position) | ||
| 389 | index-alist)) | ||
| 390 | ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)") | ||
| 391 | (forward-sexp 2) | ||
| 392 | (if (= (char-after (1- (point))) ?\)) | ||
| 393 | (progn | ||
| 394 | (forward-sexp -1) | ||
| 395 | (down-list 1) | ||
| 396 | (forward-sexp 1))) | ||
| 397 | (push (imenu-example--name-and-position) | ||
| 398 | index-type-alist)) | ||
| 399 | (t | ||
| 400 | (forward-sexp 2) | ||
| 401 | (push (imenu-example--name-and-position) | ||
| 402 | index-unknown-alist))))))) | ||
| 403 | (and index-var-alist | ||
| 404 | (push (cons "Variables" index-var-alist) | ||
| 405 | index-alist)) | ||
| 406 | (and index-type-alist | ||
| 407 | (push (cons "Types" index-type-alist) | ||
| 408 | index-alist)) | ||
| 409 | (and index-unknown-alist | ||
| 410 | (push (cons "Syntax-unknown" index-unknown-alist) | ||
| 411 | index-alist)) | ||
| 412 | index-alist)) | ||
| 413 | |||
| 414 | ;; Regular expression to find C functions | ||
| 415 | (defvar imenu-example--function-name-regexp-c | ||
| 416 | (concat | ||
| 417 | "^[a-zA-Z0-9]+[ \t]?" ; Type specs; there can be no | ||
| 418 | "\\([a-zA-Z0-9_*]+[ \t]+\\)?" ; more than 3 tokens, right? | ||
| 419 | "\\([a-zA-Z0-9_*]+[ \t]+\\)?" | ||
| 420 | "\\([*&]+[ \t]*\\)?" ; Pointer. | ||
| 421 | "\\([a-zA-Z0-9_*]+\\)[ \t]*(" ; Name. | ||
| 422 | )) | ||
| 423 | |||
| 424 | (defun imenu-example--create-c-index (&optional regexp) | ||
| 425 | (declare (obsolete nil "23.2")) | ||
| 426 | (let ((index-alist '()) | ||
| 427 | char) | ||
| 428 | (goto-char (point-min)) | ||
| 429 | ;; Search for the function | ||
| 430 | (save-match-data | ||
| 431 | (while (re-search-forward | ||
| 432 | (or regexp imenu-example--function-name-regexp-c) | ||
| 433 | nil t) | ||
| 434 | (backward-up-list 1) | ||
| 435 | (save-excursion | ||
| 436 | (goto-char (scan-sexps (point) 1)) | ||
| 437 | (setq char (following-char))) | ||
| 438 | ;; Skip this function name if it is a prototype declaration. | ||
| 439 | (if (not (eq char ?\;)) | ||
| 440 | (push (imenu-example--name-and-position) index-alist)))) | ||
| 441 | (nreverse index-alist))) | ||
| 442 | |||
| 443 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 351 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 444 | ;;; | 352 | ;;; |
| 445 | ;;; Internal variables | 353 | ;;; Internal variables |