]> code.delx.au - gnu-emacs/blobdiff - lisp/imenu.el
Add new error and function `user-error'.
[gnu-emacs] / lisp / imenu.el
index ceea9420c4c0bee1e6037614c7df22fc4a6cfbcf..feebb96d379b26b6bcc603a9ebe0c44345adf65a 100644 (file)
@@ -266,6 +266,29 @@ The function in this variable is called when selecting a normal index-item.")
   (and (consp (cdr item)) (listp (cadr item))
        (not (eq (car (cadr item)) 'lambda))))
 
+;; Macro to display a progress message.
+;; RELPOS is the relative position to display.
+;; If RELPOS is nil, then the relative position in the buffer
+;; is calculated.
+;; PREVPOS is the variable in which we store the last position displayed.
+(defmacro imenu-progress-message (prevpos &optional relpos reverse)
+
+;; Made obsolete/empty, as computers are now faster than the eye, and
+;; it had problems updating the messages correctly, and could shadow
+;; more important messages/prompts in the minibuffer.  KFS 2004-10-27.
+
+;;  `(and
+;;    imenu-scanning-message
+;;    (let ((pos ,(if relpos
+;;                relpos
+;;              `(imenu--relative-position ,reverse))))
+;;     (if ,(if relpos t
+;;         `(> pos (+ 5 ,prevpos)))
+;;      (progn
+;;        (message imenu-scanning-message pos)
+;;        (setq ,prevpos pos)))))
+)
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;
@@ -556,7 +579,7 @@ See `imenu--index-alist' for the format of the index alist."
                  (funcall imenu-create-index-function))))
        (imenu--truncate-items imenu--index-alist)))
   (or imenu--index-alist noerror
-      (error "No items suitable for an index found in this buffer"))
+      (user-error "No items suitable for an index found in this buffer"))
   (or imenu--index-alist
       (setq imenu--index-alist (list nil)))
   ;; Add a rescan option to the index.
@@ -672,7 +695,7 @@ The alternate method, which is the one most often used, is to call
        ((and imenu-generic-expression)
         (imenu--generic-function imenu-generic-expression))
        (t
-        (error "This buffer cannot use `imenu-default-create-index-function'"))))
+        (user-error "This buffer cannot use `imenu-default-create-index-function'"))))
 
 ;;;
 ;;; Generic index gathering function.
@@ -945,8 +968,8 @@ See the command `imenu' for more information."
            `(menu-item ,name ,(make-sparse-keymap "Imenu")))
          (use-local-map newmap)
          (add-hook 'menu-bar-update-hook 'imenu-update-menubar)))
-    (error "The mode `%s' does not support Imenu"
-           (format-mode-line mode-name))))
+    (user-error "The mode `%s' does not support Imenu"
+                (format-mode-line mode-name))))
 
 ;;;###autoload
 (defun imenu-add-menubar-index ()
@@ -1035,12 +1058,6 @@ for more information."
       (apply function (car index-item) position rest))
     (run-hooks 'imenu-after-jump-hook)))
 
-(dolist (mess
-        '("^No items suitable for an index found in this buffer$"
-          "^This buffer cannot use `imenu-default-create-index-function'$"
-          "^The mode `.*' does not support Imenu$"))
-  (add-to-list 'debug-ignored-errors mess))
-
 (provide 'imenu)
 
 ;;; imenu.el ends here