Mercurial > emacs
comparison lisp/dabbrev.el @ 14169:83f275dcd93a
Update FSF's address.
author | Erik Naggum <erik@naggum.no> |
---|---|
date | Sun, 14 Jan 1996 07:34:30 +0000 |
parents | 187735b53d52 |
children | 180245e93214 |
comparison
equal
deleted
inserted
replaced
14168:3b925cc52931 | 14169:83f275dcd93a |
---|---|
1 ;;; dabbrev.el --- dynamic abbreviation package | 1 ;;; dabbrev.el --- dynamic abbreviation package |
2 | |
2 ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc. |
3 | 4 |
4 ;; Author: Don Morrison | 5 ;; Author: Don Morrison |
5 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se> | 6 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se> |
6 ;; Created: 16 Mars 1992 | 7 ;; Created: 16 Mars 1992 |
7 ;; Lindberg's last update version: 5.7 | 8 ;; Lindberg's last update version: 5.7 |
8 ;; Keywords: abbrev expand completion | 9 ;; Keywords: abbrev expand completion |
9 | 10 |
10 ;; This program is free software; you can redistribute it and/or modify | 11 ;; This file is part of GNU Emacs. |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | 14 ;; it under the terms of the GNU General Public License as published by |
12 ;; the Free Software Foundation; either version 2 of the License, or | 15 ;; the Free Software Foundation; either version 2, or (at your option) |
13 ;; (at your option) any later version. | 16 ;; any later version. |
14 ;; | 17 |
15 ;; This program is distributed in the hope that it will be useful, | 18 ;; GNU Emacs is distributed in the hope that it will be useful, |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 ;; GNU General Public License for more details. | 21 ;; GNU General Public License for more details. |
19 ;; | 22 |
20 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
21 ;; along with this program; if not, write to the Free Software | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
26 ;; Boston, MA 02111-1307, USA. | |
23 | 27 |
24 ;;; Commentary: | 28 ;;; Commentary: |
25 | 29 |
26 ;; The purpose with this package is to let you write just a few | 30 ;; The purpose with this package is to let you write just a few |
27 ;; characters of words you've written earlier to be able to expand | 31 ;; characters of words you've written earlier to be able to expand |
88 ;; [hawley] Bob Hawley <rth1@quartet.mt.att.com> | 92 ;; [hawley] Bob Hawley <rth1@quartet.mt.att.com> |
89 ;; ... and to all the people who have participated in the beta tests. | 93 ;; ... and to all the people who have participated in the beta tests. |
90 | 94 |
91 ;;; Code: | 95 ;;; Code: |
92 | 96 |
93 ;;;---------------------------------------------------------------- | 97 ;;---------------------------------------------------------------- |
94 ;;;---------------------------------------------------------------- | 98 ;; Customization variables |
95 ;;; Customization variables | 99 ;;---------------------------------------------------------------- |
96 ;;;---------------------------------------------------------------- | |
97 ;;;---------------------------------------------------------------- | |
98 (defvar dabbrev-backward-only nil | 100 (defvar dabbrev-backward-only nil |
99 "*If non-nil, `dabbrev-expand' only looks backwards.") | 101 "*If non-nil, `dabbrev-expand' only looks backwards.") |
100 | 102 |
101 (defvar dabbrev-limit nil | 103 (defvar dabbrev-limit nil |
102 "*Limits region searched by `dabbrev-expand' to this many chars away.") | 104 "*Limits region searched by `dabbrev-expand' to this many chars away.") |
211 "If non-nil, a list of buffers which dabbrev should search. | 213 "If non-nil, a list of buffers which dabbrev should search. |
212 If this variable is non-nil, dabbrev will only look in these buffers. | 214 If this variable is non-nil, dabbrev will only look in these buffers. |
213 It will not even look in the current buffer if it is not a member of | 215 It will not even look in the current buffer if it is not a member of |
214 this list.") | 216 this list.") |
215 | 217 |
216 ;;;---------------------------------------------------------------- | 218 ;;---------------------------------------------------------------- |
217 ;;;---------------------------------------------------------------- | 219 ;; Internal variables |
218 ;;; Internal variables | 220 ;;---------------------------------------------------------------- |
219 ;;;---------------------------------------------------------------- | |
220 ;;;---------------------------------------------------------------- | |
221 | 221 |
222 ;; Last obarray of completions in `dabbrev-completion' | 222 ;; Last obarray of completions in `dabbrev-completion' |
223 (defvar dabbrev--last-obarray nil) | 223 (defvar dabbrev--last-obarray nil) |
224 | 224 |
225 ;; Table of expansions seen so far | 225 ;; Table of expansions seen so far |
256 (defvar dabbrev--check-other-buffers dabbrev-check-other-buffers) | 256 (defvar dabbrev--check-other-buffers dabbrev-check-other-buffers) |
257 | 257 |
258 ;; The regexp for recognizing a character in an abbreviation. | 258 ;; The regexp for recognizing a character in an abbreviation. |
259 (defvar dabbrev--abbrev-char-regexp nil) | 259 (defvar dabbrev--abbrev-char-regexp nil) |
260 | 260 |
261 ;;;---------------------------------------------------------------- | 261 ;;---------------------------------------------------------------- |
262 ;;;---------------------------------------------------------------- | 262 ;; Macros |
263 ;;; Macros | 263 ;;---------------------------------------------------------------- |
264 ;;;---------------------------------------------------------------- | |
265 ;;;---------------------------------------------------------------- | |
266 | 264 |
267 ;;; Get the buffer that mini-buffer was activated from | 265 ;;; Get the buffer that mini-buffer was activated from |
268 (defsubst dabbrev--minibuffer-origin () | 266 (defsubst dabbrev--minibuffer-origin () |
269 (car (cdr (buffer-list)))) | 267 (car (cdr (buffer-list)))) |
270 | 268 |
280 (if (, condition) | 278 (if (, condition) |
281 (setq dabbrev-result (cons (, element) dabbrev-result))) | 279 (setq dabbrev-result (cons (, element) dabbrev-result))) |
282 (setq dabbrev-tail (cdr dabbrev-tail))) | 280 (setq dabbrev-tail (cdr dabbrev-tail))) |
283 (nreverse dabbrev-result)))) | 281 (nreverse dabbrev-result)))) |
284 | 282 |
285 ;;;---------------------------------------------------------------- | 283 ;;---------------------------------------------------------------- |
286 ;;;---------------------------------------------------------------- | 284 ;; Exported functions |
287 ;;; Exported functions | 285 ;;---------------------------------------------------------------- |
288 ;;;---------------------------------------------------------------- | |
289 ;;;---------------------------------------------------------------- | |
290 | 286 |
291 ;;;###autoload | 287 ;;;###autoload |
292 (define-key esc-map "/" 'dabbrev-expand) | 288 (define-key esc-map "/" 'dabbrev-expand) |
293 ;;;??? Do we want this? | 289 ;;;??? Do we want this? |
294 ;;;###autoload | 290 ;;;###autoload |
517 ;; Save state for re-expand. | 513 ;; Save state for re-expand. |
518 (setq dabbrev--last-expansion expansion) | 514 (setq dabbrev--last-expansion expansion) |
519 (setq dabbrev--last-abbreviation abbrev) | 515 (setq dabbrev--last-abbreviation abbrev) |
520 (setq dabbrev--last-abbrev-location (point-marker)))))) | 516 (setq dabbrev--last-abbrev-location (point-marker)))))) |
521 | 517 |
522 ;;;---------------------------------------------------------------- | 518 ;;---------------------------------------------------------------- |
523 ;;;---------------------------------------------------------------- | 519 ;; Local functions |
524 ;;; Local functions | 520 ;;---------------------------------------------------------------- |
525 ;;;---------------------------------------------------------------- | |
526 ;;;---------------------------------------------------------------- | |
527 | 521 |
528 ;;; Checks if OTHER-BUFFER has the same major mode as current buffer. | 522 ;;; Checks if OTHER-BUFFER has the same major mode as current buffer. |
529 (defun dabbrev--same-major-mode-p (other-buffer) | 523 (defun dabbrev--same-major-mode-p (other-buffer) |
530 (eq major-mode | 524 (eq major-mode |
531 (save-excursion | 525 (save-excursion |
837 (downcase result) | 831 (downcase result) |
838 result))))))) | 832 result))))))) |
839 | 833 |
840 (provide 'dabbrev) | 834 (provide 'dabbrev) |
841 | 835 |
842 ;; dabbrev.el ends here | 836 ;;; dabbrev.el ends here |
843 | |
844 |