diff options
| author | Richard M. Stallman | 1997-01-07 08:14:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-01-07 08:14:12 +0000 |
| commit | c5c890bac4615ecb61ccc05e89c6e5e9661cd250 (patch) | |
| tree | 8f6eb0241ef4f37b87a3c39c28f02223bfedffa4 | |
| parent | b36701cc099704654a5260b51db567165ddcae5b (diff) | |
| download | emacs-c5c890bac4615ecb61ccc05e89c6e5e9661cd250.tar.gz emacs-c5c890bac4615ecb61ccc05e89c6e5e9661cd250.zip | |
No longer a minor mode.
(expand-submit-bug-report): Function deleted.
(expand-mode-version, expand-mode-help-address): Variables deleted.
(expand-mode): Variable and function deleted.
(expand-mode-hook, expand-mode-name): Variables deleted.
(expand-load-hook): Variable renamed from expand-mode-load-hook.
(expand-map): Variable deleted.
(expand-jump-to-next-slot): Renamed from expand-jump-to-next-mark.
Add autoload.
(expand-jump-to-previous-slot): Add autoload.
Renamed from expand-jump-to-previous-mark.
| -rw-r--r-- | lisp/expand.el | 113 |
1 files changed, 28 insertions, 85 deletions
diff --git a/lisp/expand.el b/lisp/expand.el index 121a97514bc..1b46d4b3f68 100644 --- a/lisp/expand.el +++ b/lisp/expand.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;; expand.el --- minor mode to make abbreviations more usable. | 1 | ;; expand.el --- make abbreviations more usable. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -27,7 +27,7 @@ | |||
| 27 | ;; | 27 | ;; |
| 28 | ;; This package defines abbrevs which expand into structured constructs | 28 | ;; This package defines abbrevs which expand into structured constructs |
| 29 | ;; for certain languages. The construct is indented for you, | 29 | ;; for certain languages. The construct is indented for you, |
| 30 | ;; and contains points for you to ;; fill in other text. | 30 | ;; and contains slots for you to fill in other text. |
| 31 | 31 | ||
| 32 | ;; These abbrevs expand only at the end of a line and when not in a comment | 32 | ;; These abbrevs expand only at the end of a line and when not in a comment |
| 33 | ;; or a string. | 33 | ;; or a string. |
| @@ -48,62 +48,40 @@ | |||
| 48 | ;; ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37)) | 48 | ;; ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37)) |
| 49 | ;; "Expansions for C mode") | 49 | ;; "Expansions for C mode") |
| 50 | ;; | 50 | ;; |
| 51 | ;; and enter Expand mode with the following hook : | 51 | ;; and enter Abbrev mode with the following hook : |
| 52 | ;; | 52 | ;; |
| 53 | ;; (add-hook 'c-mode-hook (function (lambda () | 53 | ;; (add-hook 'c-mode-hook (function (lambda () |
| 54 | ;; (expand-add-abbrevs c-mode-abbrev-table c-expand-list) | 54 | ;; (expand-add-abbrevs c-mode-abbrev-table c-expand-list) |
| 55 | ;; (expand-mode)))) | 55 | ;; (abbrev-mode)))) |
| 56 | ;; | 56 | ;; |
| 57 | ;; you can also bind jump functions to some keys and init some post-process | 57 | ;; you can also init some post-process hooks : |
| 58 | ;; hooks : | ||
| 59 | ;; | 58 | ;; |
| 60 | ;; (add-hook 'expand-mode-load-hook | 59 | ;; (add-hook 'expand-load-hook |
| 61 | ;; (function | 60 | ;; (function |
| 62 | ;; (lambda () | 61 | ;; (lambda () |
| 63 | ;; (add-hook 'expand-expand-hook 'indent-according-to-mode) | 62 | ;; (add-hook 'expand-expand-hook 'indent-according-to-mode) |
| 64 | ;; (add-hook 'expand-jump-hook 'indent-according-to-mode) | 63 | ;; (add-hook 'expand-jump-hook 'indent-according-to-mode)))) |
| 65 | ;; (define-key expand-map '[(control tab)] 'expand-jump-to-next-mark) | ||
| 66 | ;; (define-key expand-map '[(control shift tab)] 'expand-jump-to-previous-mark)))) | ||
| 67 | ;; | 64 | ;; |
| 68 | ;; Remarks: | 65 | ;; Remarks: |
| 69 | ;; | 66 | ;; |
| 70 | ;; Has been tested under emacs 19.28-19.34 and XEmacs 19.11. | ||
| 71 | ;; Many thanks to Heddy Boubaker <boubaker@cenatls.cena.dgac.fr>, | 67 | ;; Many thanks to Heddy Boubaker <boubaker@cenatls.cena.dgac.fr>, |
| 72 | ;; Jerome Santini <santini@chambord.univ-orleans.fr>, | 68 | ;; Jerome Santini <santini@chambord.univ-orleans.fr>, |
| 73 | ;; Jari Aalto <jaalto@tre.tele.nokia.fi>. | 69 | ;; Jari Aalto <jaalto@tre.tele.nokia.fi>. |
| 74 | ;; | 70 | ;; |
| 75 | ;; Please send me a word to give me your feeling about this mode or | 71 | ;; Please send me a word to give me your feeling about this feature or |
| 76 | ;; to explain me how you use it (your expansions table for example) using | 72 | ;; to explain me how you use it (your expansions table for example) using |
| 77 | ;; the function expand-mode-submit-report. | 73 | ;; the function expand-submit-report. |
| 78 | 74 | ||
| 79 | ;; Expand mode is not a replacement for abbrev it is just a layer above it. | ||
| 80 | |||
| 81 | ;;; Constants: | 75 | ;;; Constants: |
| 82 | 76 | ||
| 83 | (defconst expand-mode-version "$Id: expand.el,v 1.1 1996/12/28 19:41:45 rms Exp rms $" | 77 | (defvar expand-load-hook nil |
| 84 | "Version tag for expand.el.") | 78 | "Hooks run when `expand.el' is loaded.") |
| 85 | |||
| 86 | (defconst expand-mode-help-address "expand-help@sugix.frmug.org" | ||
| 87 | "Email address to send requests, comments or bug reports.") | ||
| 88 | |||
| 89 | (defvar expand-mode nil | ||
| 90 | "Status variable for Expand mode.") | ||
| 91 | (make-variable-buffer-local 'expand-mode) | ||
| 92 | |||
| 93 | (defvar expand-mode-name " Expand" | ||
| 94 | "Name of mode displayed in the modeline for Expand mode.") | ||
| 95 | |||
| 96 | (defvar expand-mode-hook nil | ||
| 97 | "Hooks run when Expand mode is enabled.") | ||
| 98 | |||
| 99 | (defvar expand-mode-load-hook nil | ||
| 100 | "Hooks run when expand is loaded.") | ||
| 101 | 79 | ||
| 102 | (defvar expand-expand-hook nil | 80 | (defvar expand-expand-hook nil |
| 103 | "Hooks run when expansion is done.") | 81 | "Hooks run when an abbrev made by `expand-add-abbrevs' is expanded.") |
| 104 | 82 | ||
| 105 | (defvar expand-jump-hook nil | 83 | (defvar expand-jump-hook nil |
| 106 | "Hooks run when jump to mark occurs.") | 84 | "Hooks run by `expand-jump-to-previous-slot' and `expand-jump-to-next-slot'.") |
| 107 | 85 | ||
| 108 | ;;; Samples: | 86 | ;;; Samples: |
| 109 | 87 | ||
| @@ -276,32 +254,6 @@ | |||
| 276 | ;;; Code: | 254 | ;;; Code: |
| 277 | 255 | ||
| 278 | ;;;###autoload | 256 | ;;;###autoload |
| 279 | (defun expand-mode (&optional arg) | ||
| 280 | "Toggle Expand mode. | ||
| 281 | With argument ARG, turn Expand mode on if ARG is positive. | ||
| 282 | In Expand mode, inserting an abbreviation at the end of a line | ||
| 283 | causes it to expand and be replaced by its expansion." | ||
| 284 | (interactive "P") | ||
| 285 | (setq expand-mode (if (null arg) (not expand-mode) | ||
| 286 | (> (prefix-numeric-value arg) 0))) | ||
| 287 | (if expand-mode | ||
| 288 | (progn | ||
| 289 | (setq abbrev-mode nil) | ||
| 290 | (run-hooks 'expand-mode-hook)))) | ||
| 291 | |||
| 292 | ;;;###autoload | ||
| 293 | (defvar expand-map (make-sparse-keymap) | ||
| 294 | "Key map used in Expand mode.") | ||
| 295 | |||
| 296 | (or (assq 'expand-mode minor-mode-alist) | ||
| 297 | (setq minor-mode-alist (cons (list 'expand-mode expand-mode-name) | ||
| 298 | minor-mode-alist))) | ||
| 299 | |||
| 300 | (or (assq 'expand-mode minor-mode-map-alist) | ||
| 301 | (setq minor-mode-map-alist (cons (cons 'expand-mode expand-map) | ||
| 302 | minor-mode-map-alist))) | ||
| 303 | |||
| 304 | ;;;###autoload | ||
| 305 | (defun expand-add-abbrevs (table abbrevs) | 257 | (defun expand-add-abbrevs (table abbrevs) |
| 306 | "Add a list of abbrev to abbrev table TABLE. | 258 | "Add a list of abbrev to abbrev table TABLE. |
| 307 | ABBREVS is a list of abbrev definitions; each abbrev description entry | 259 | ABBREVS is a list of abbrev definitions; each abbrev description entry |
| @@ -319,8 +271,8 @@ beginning of the expanded text. | |||
| 319 | 271 | ||
| 320 | If ARG is a list of numbers, point is placed according to the first | 272 | If ARG is a list of numbers, point is placed according to the first |
| 321 | member of the list, but you can visit the other specified positions | 273 | member of the list, but you can visit the other specified positions |
| 322 | cyclicaly with the functions `expand-jump-to-previous-mark' and | 274 | cyclicaly with the functions `expand-jump-to-previous-slot' and |
| 323 | `expand-jump-to-next-mark'. | 275 | `expand-jump-to-next-slot'. |
| 324 | 276 | ||
| 325 | If ARG is omitted, point is placed at the end of the expanded text." | 277 | If ARG is omitted, point is placed at the end of the expanded text." |
| 326 | 278 | ||
| @@ -330,7 +282,7 @@ If ARG is omitted, point is placed at the end of the expanded text." | |||
| 330 | (nth 2 (car abbrevs))) | 282 | (nth 2 (car abbrevs))) |
| 331 | (expand-add-abbrevs table (cdr abbrevs)))) | 283 | (expand-add-abbrevs table (cdr abbrevs)))) |
| 332 | 284 | ||
| 333 | (defvar expand-list nil "Temporary variable used by Expand mode.") | 285 | (defvar expand-list nil "Temporary variable used by the Expand package.") |
| 334 | 286 | ||
| 335 | (defvar expand-pos nil | 287 | (defvar expand-pos nil |
| 336 | "If non nil, stores a vector containing markers to positions defined by the last expansion. | 288 | "If non nil, stores a vector containing markers to positions defined by the last expansion. |
| @@ -438,8 +390,10 @@ See `expand-add-abbrevs'." | |||
| 438 | (backward-word 1) | 390 | (backward-word 1) |
| 439 | (buffer-substring p (point))))) | 391 | (buffer-substring p (point))))) |
| 440 | 392 | ||
| 441 | (defun expand-jump-to-previous-mark () | 393 | ;;;###autoload |
| 442 | "Move the cursor to previous mark created by the expansion." | 394 | (defun expand-jump-to-previous-slot () |
| 395 | "Move the cursor to the previous slot in the last abbrev expansion. | ||
| 396 | This is used only in conjunction with `expand-add-abbrevs'." | ||
| 443 | (interactive) | 397 | (interactive) |
| 444 | (if expand-pos | 398 | (if expand-pos |
| 445 | (progn | 399 | (progn |
| @@ -449,8 +403,10 @@ See `expand-add-abbrevs'." | |||
| 449 | (goto-char (aref expand-pos expand-index)) | 403 | (goto-char (aref expand-pos expand-index)) |
| 450 | (run-hooks 'expand-jump-hook)))) | 404 | (run-hooks 'expand-jump-hook)))) |
| 451 | 405 | ||
| 452 | (defun expand-jump-to-next-mark () | 406 | ;;;###autoload |
| 453 | "Move the cursor to next mark created by the expansion." | 407 | (defun expand-jump-to-next-slot () |
| 408 | "Move the cursor to the next slot in the last abbrev expansion. | ||
| 409 | This is used only in conjunction with `expand-add-abbrevs'." | ||
| 454 | (interactive) | 410 | (interactive) |
| 455 | (if expand-pos | 411 | (if expand-pos |
| 456 | (progn | 412 | (progn |
| @@ -460,6 +416,9 @@ See `expand-add-abbrevs'." | |||
| 460 | (goto-char (aref expand-pos expand-index)) | 416 | (goto-char (aref expand-pos expand-index)) |
| 461 | (run-hooks 'expand-jump-hook)))) | 417 | (run-hooks 'expand-jump-hook)))) |
| 462 | 418 | ||
| 419 | ;;;###autoload (define-key ctl-x-map "ap" 'expand-jump-to-previous-slot) | ||
| 420 | ;;;###autoload (define-key ctl-x-map "an" 'expand-jump-to-next-slot) | ||
| 421 | |||
| 463 | (defun expand-build-list (len l) | 422 | (defun expand-build-list (len l) |
| 464 | "Build a vector of offset positions from the list of positions." | 423 | "Build a vector of offset positions from the list of positions." |
| 465 | (expand-clear-markers) | 424 | (expand-clear-markers) |
| @@ -507,22 +466,6 @@ See `expand-add-abbrevs'." | |||
| 507 | ((nth 4 state) 'comment) | 466 | ((nth 4 state) 'comment) |
| 508 | (t nil))))) | 467 | (t nil))))) |
| 509 | 468 | ||
| 510 | (defun expand-mode-submit-report () | ||
| 511 | "Report a problem, a suggestion or a comment about Expand mode." | ||
| 512 | (interactive) | ||
| 513 | (require 'reporter) | ||
| 514 | (reporter-submit-bug-report | ||
| 515 | expand-mode-help-address | ||
| 516 | (concat "expand.el " expand-mode-version) | ||
| 517 | '(expand-mode-name | ||
| 518 | expand-mode-hook | ||
| 519 | expand-mode-load-hook | ||
| 520 | expand-map | ||
| 521 | ) | ||
| 522 | nil | ||
| 523 | nil | ||
| 524 | "Dear expand.el maintainer,")) | ||
| 525 | |||
| 526 | ;; support functions to add marks to jump from outside function | 469 | ;; support functions to add marks to jump from outside function |
| 527 | 470 | ||
| 528 | (defun expand-list-to-markers (l) | 471 | (defun expand-list-to-markers (l) |
| @@ -548,6 +491,6 @@ See `expand-add-abbrevs'." | |||
| 548 | (provide 'expand) | 491 | (provide 'expand) |
| 549 | 492 | ||
| 550 | ;; run load hooks | 493 | ;; run load hooks |
| 551 | (run-hooks 'expand-mode-load-hook) | 494 | (run-hooks 'expand-load-hook) |
| 552 | 495 | ||
| 553 | ;;; expand.el ends here | 496 | ;;; expand.el ends here |