diff options
| author | Dave Love | 2000-02-03 15:45:10 +0000 |
|---|---|---|
| committer | Dave Love | 2000-02-03 15:45:10 +0000 |
| commit | 3f429351937ec6540e1e9929977c5f3761d53b75 (patch) | |
| tree | bfffeb589c9e890d2b49aa70f8353c287e530231 | |
| parent | 048d06bdf5b6401a1b28854f6d4df9f0f6af73ff (diff) | |
| download | emacs-3f429351937ec6540e1e9929977c5f3761d53b75.tar.gz emacs-3f429351937ec6540e1e9929977c5f3761d53b75.zip | |
Replace completion-dolist with dolist.
| -rw-r--r-- | lisp/completion.el | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/lisp/completion.el b/lisp/completion.el index 24b5326afee..0b6d9626877 100644 --- a/lisp/completion.el +++ b/lisp/completion.el | |||
| @@ -367,31 +367,6 @@ DON'T CHANGE WITHOUT RECOMPILING ! This is used by macros.") | |||
| 367 | (mapcar 'eval body) | 367 | (mapcar 'eval body) |
| 368 | (cons 'progn body)) | 368 | (cons 'progn body)) |
| 369 | 369 | ||
| 370 | (eval-when-compile | ||
| 371 | (defvar completion-gensym-counter 0) | ||
| 372 | (defun completion-gensym (&optional arg) | ||
| 373 | "Generate a new uninterned symbol. | ||
| 374 | The name is made by appending a number to PREFIX, default \"G\"." | ||
| 375 | (let ((prefix (if (stringp arg) arg "G")) | ||
| 376 | (num (if (integerp arg) arg | ||
| 377 | (prog1 completion-gensym-counter | ||
| 378 | (setq completion-gensym-counter (1+ completion-gensym-counter)))))) | ||
| 379 | (make-symbol (format "%s%d" prefix num))))) | ||
| 380 | |||
| 381 | (defmacro completion-dolist (spec &rest body) | ||
| 382 | "(completion-dolist (VAR LIST [RESULT]) BODY...): loop over a list. | ||
| 383 | Evaluate BODY with VAR bound to each `car' from LIST, in turn. | ||
| 384 | Then evaluate RESULT to get return value, default nil." | ||
| 385 | (let ((temp (completion-gensym "--dolist-temp--"))) | ||
| 386 | (append (list 'let (list (list temp (nth 1 spec)) (car spec)) | ||
| 387 | (append (list 'while temp | ||
| 388 | (list 'setq (car spec) (list 'car temp))) | ||
| 389 | body (list (list 'setq temp | ||
| 390 | (list 'cdr temp))))) | ||
| 391 | (if (cdr (cdr spec)) | ||
| 392 | (cons (list 'setq (car spec) nil) (cdr (cdr spec))) | ||
| 393 | '(nil))))) | ||
| 394 | |||
| 395 | (defun completion-eval-when () | 370 | (defun completion-eval-when () |
| 396 | (eval-when-compile-load-eval | 371 | (eval-when-compile-load-eval |
| 397 | ;; These vars. are defined at both compile and load time. | 372 | ;; These vars. are defined at both compile and load time. |
| @@ -573,9 +548,9 @@ Used to decide whether to save completions.") | |||
| 573 | (let ((symbol-chars '(?@ ?/ ?\\ ?* ?+ ?~ ?$ ?< ?> ?%)) | 548 | (let ((symbol-chars '(?@ ?/ ?\\ ?* ?+ ?~ ?$ ?< ?> ?%)) |
| 574 | (symbol-chars-ignore '(?_ ?- ?: ?.)) | 549 | (symbol-chars-ignore '(?_ ?- ?: ?.)) |
| 575 | ) | 550 | ) |
| 576 | (completion-dolist (char symbol-chars) | 551 | (dolist (char symbol-chars) |
| 577 | (modify-syntax-entry char "_" table)) | 552 | (modify-syntax-entry char "_" table)) |
| 578 | (completion-dolist (char symbol-chars-ignore) | 553 | (dolist (char symbol-chars-ignore) |
| 579 | (modify-syntax-entry char "w" table) | 554 | (modify-syntax-entry char "w" table) |
| 580 | ) | 555 | ) |
| 581 | ) | 556 | ) |
| @@ -587,7 +562,7 @@ Used to decide whether to save completions.") | |||
| 587 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) | 562 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) |
| 588 | (symbol-chars '(?! ?& ?? ?= ?^)) | 563 | (symbol-chars '(?! ?& ?? ?= ?^)) |
| 589 | ) | 564 | ) |
| 590 | (completion-dolist (char symbol-chars) | 565 | (dolist (char symbol-chars) |
| 591 | (modify-syntax-entry char "_" table)) | 566 | (modify-syntax-entry char "_" table)) |
| 592 | table)) | 567 | table)) |
| 593 | 568 | ||
| @@ -595,7 +570,7 @@ Used to decide whether to save completions.") | |||
| 595 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) | 570 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) |
| 596 | (separator-chars '(?+ ?* ?/ ?: ?%)) | 571 | (separator-chars '(?+ ?* ?/ ?: ?%)) |
| 597 | ) | 572 | ) |
| 598 | (completion-dolist (char separator-chars) | 573 | (dolist (char separator-chars) |
| 599 | (modify-syntax-entry char " " table)) | 574 | (modify-syntax-entry char " " table)) |
| 600 | table)) | 575 | table)) |
| 601 | 576 | ||
| @@ -603,7 +578,7 @@ Used to decide whether to save completions.") | |||
| 603 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) | 578 | (let ((table (copy-syntax-table cmpl-standard-syntax-table)) |
| 604 | (separator-chars '(?+ ?- ?* ?/ ?:)) | 579 | (separator-chars '(?+ ?- ?* ?/ ?:)) |
| 605 | ) | 580 | ) |
| 606 | (completion-dolist (char separator-chars) | 581 | (dolist (char separator-chars) |
| 607 | (modify-syntax-entry char " " table)) | 582 | (modify-syntax-entry char " " table)) |
| 608 | table)) | 583 | table)) |
| 609 | 584 | ||
| @@ -2033,9 +2008,9 @@ Prefix args :: | |||
| 2033 | (while (< i 256) | 2008 | (while (< i 256) |
| 2034 | (modify-syntax-entry i "w" table) | 2009 | (modify-syntax-entry i "w" table) |
| 2035 | (setq i (1+ i))) | 2010 | (setq i (1+ i))) |
| 2036 | (completion-dolist (char whitespace-chars) | 2011 | (dolist (char whitespace-chars) |
| 2037 | (modify-syntax-entry char "_" table)) | 2012 | (modify-syntax-entry char "_" table)) |
| 2038 | (completion-dolist (char separator-chars) | 2013 | (dolist (char separator-chars) |
| 2039 | (modify-syntax-entry char " " table)) | 2014 | (modify-syntax-entry char " " table)) |
| 2040 | (modify-syntax-entry ?\[ "(]" table) | 2015 | (modify-syntax-entry ?\[ "(]" table) |
| 2041 | (modify-syntax-entry ?\{ "(}" table) | 2016 | (modify-syntax-entry ?\{ "(}" table) |
| @@ -2251,7 +2226,7 @@ If file name is not specified, use `save-completions-file-name'." | |||
| 2251 | (erase-buffer) | 2226 | (erase-buffer) |
| 2252 | ;; (/ 1 0) | 2227 | ;; (/ 1 0) |
| 2253 | (insert (format saved-cmpl-file-header completion-version)) | 2228 | (insert (format saved-cmpl-file-header completion-version)) |
| 2254 | (completion-dolist (completion (list-all-completions)) | 2229 | (dolist (completion (list-all-completions)) |
| 2255 | (setq total-in-db (1+ total-in-db)) | 2230 | (setq total-in-db (1+ total-in-db)) |
| 2256 | (setq last-use-time (completion-last-use-time completion)) | 2231 | (setq last-use-time (completion-last-use-time completion)) |
| 2257 | ;; Update num uses and maybe write completion to a file | 2232 | ;; Update num uses and maybe write completion to a file |