(Man-notify-when-ready): Don't use window-system. If
[bpt/emacs.git] / lisp / dabbrev.el
index 909b86d..b14a97b 100644 (file)
@@ -1,6 +1,7 @@
 ;;; dabbrev.el --- dynamic abbreviation package
 
-;; Copyright (C) 1985, 86, 92, 94, 96, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 92, 94, 96, 1997, 2000
+;;   Free Software Foundation, Inc.
 
 ;; Author: Don Morrison
 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se>
@@ -193,16 +194,25 @@ Dabbrev always searches the current buffer first.  Then, if
 designated by `dabbrev-select-buffers-function'.
 
 Then, if `dabbrev-check-all-buffers' is non-nil, dabbrev searches
-all the other buffers, except those named in `dabbrev-ignored-buffer-names'."
+all the other buffers, except those named in `dabbrev-ignored-buffer-names',
+or matched by `dabbrev-ignored-regexps'."
   :type 'boolean
   :group 'dabbrev)
 
 (defcustom dabbrev-ignored-buffer-names '("*Messages*" "*Buffer List*")
-  "*List of buffer names that dabbrev should not check."
+  "*List of buffer names that dabbrev should not check.
+See also `dabbrev-ignored-regexps'."
   :type '(repeat (string :tag "Buffer name"))
   :group 'dabbrev
   :version "20.3")
 
+(defcustom dabbrev-ignored-regexps nil
+  "*List of regexps matching names of buffers that dabbrev should not check.
+See also `dabbrev-ignored-buffer-names'."
+  :type '(repeat regexp)
+  :group 'dabbrev
+  :version "21.1")
+
 (defcustom dabbrev-check-other-buffers t
   "*Should \\[dabbrev-expand] look in other buffers?\
 
@@ -390,21 +400,21 @@ if there is a suitable one already."
          (cond
           ((or (not ignore-case-p)
                (not dabbrev-case-replace))
-           (mapcar (function (lambda (string)
-                               (intern string my-obarray)))
+           (mapc (function (lambda (string)
+                             (intern string my-obarray)))
                    completion-list))
           ((string= abbrev (upcase abbrev))
-           (mapcar (function (lambda (string)
-                               (intern (upcase string) my-obarray)))
+           (mapc (function (lambda (string)
+                             (intern (upcase string) my-obarray)))
                    completion-list))
           ((string= (substring abbrev 0 1)
                     (upcase (substring abbrev 0 1)))
-           (mapcar (function (lambda (string)
-                               (intern (capitalize string) my-obarray)))
+           (mapc (function (lambda (string)
+                             (intern (capitalize string) my-obarray)))
                    completion-list))
           (t
-           (mapcar (function (lambda (string)
-                               (intern (downcase string) my-obarray)))
+           (mapc (function (lambda (string)
+                             (intern (downcase string) my-obarray)))
                    completion-list)))
          (setq dabbrev--last-obarray my-obarray)
          (setq dabbrev--last-completion-buffer (current-buffer))
@@ -542,7 +552,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
       (error "No%s dynamic expansion for `%s' found"
             (if old " further" "") abbrev))
      (t
-      (if (not (eq dabbrev--last-buffer dabbrev--last-buffer-found))
+      (if (not (or (eq dabbrev--last-buffer dabbrev--last-buffer-found)
+                  (minibuffer-window-active-p (selected-window))))
          (progn
            (message "Expansion found in '%s'"
                     (buffer-name dabbrev--last-buffer))
@@ -761,9 +772,16 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
                        (nreverse
                         (dabbrev-filter-elements
                          buffer (buffer-list)
-                         (and (not (member (buffer-name buffer)
-                                           dabbrev-ignored-buffer-names))
-                              (not (memq buffer dabbrev--friend-buffer-list)))))
+                         (let ((bn (buffer-name buffer)))
+                           (and (not (member bn dabbrev-ignored-buffer-names))
+                                (not (memq buffer dabbrev--friend-buffer-list))
+                                (not
+                                 (let ((tail dabbrev-ignored-regexps)
+                                       (match nil))
+                                   (while (and tail (not match))
+                                     (setq match (string-match (car tail) bn)
+                                           tail (cdr tail)))
+                                   match))))))
                        dabbrev--friend-buffer-list
                        (append dabbrev--friend-buffer-list
                                non-friend-buffer-list)))))
@@ -916,6 +934,11 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
                  result
                result)))))))
 
+(dolist (mess '("^No dynamic expansion for .* found$"
+               "^No further dynamic expansion for .* found$"
+               "^No possible abbreviation preceding point$"))
+  (add-to-list 'debug-ignored-errors mess))
+
 (provide 'dabbrev)
 
 ;;; dabbrev.el ends here